stamen

Static Menu Generator
git clone git://git.dimitrijedobrota.com/stamen.git
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING

commit 15ae7d7f7b1ca24b5c6fc4f9ccea7cca3be1ebe3
parent e5fe507b67ac4461aec1195a99eb2ba44ffeca2d
author Dimitrije Dobrota < mail@dimitrijedobrota.com >
date Sat, 29 Jun 2024 19:11:47 +0200

Version 1.2

Diffstat:
M CMakeLists.txt | + -
M README.md | + -
M example/example_c.c | ++++++++++++ ----
M source/menu.cpp | + -

4 files changed, 15 insertions(+), 7 deletions(-)


diff --git a/ CMakeLists.txt b/ CMakeLists.txt

@@ -4,7 +4,7 @@ include(cmake/prelude.cmake)


project(
stamen
VERSION 1.1.1
VERSION 1.2.0
DESCRIPTION "Static menu generator"
HOMEPAGE_URL "https://git.dimitrijedobrota.com/stamen"
LANGUAGES C CXX

diff --git a/ README.md b/ README.md

@@ -22,7 +22,7 @@ The main advantage of stamen is two modes it can operate in:

## Dependencies

* CMake 3.25.2 or latter
* Compiler with C++20 support
* Compiler with C++20 support (tested: clang 16.0.5, gcc 13.2.0)
* [Poafloc 1.1](https://github.com/DimitrijeDobrota/poafloc)


diff --git a/ example/example_c.c b/ example/example_c.c

@@ -4,29 +4,37 @@

#include "demo_menu.h"
#include "stamen/stamen.h"

int operation1(size_t /* unsused */)
int operation1(size_t unused)
{
(void)unused;

printf("operation 1\n");
printf("Some operation is done\n");
return 1;
}

int operation2(size_t /* unsused */)
int operation2(size_t unused)
{
(void)unused;

printf("operation 2\n");
printf("Some other operation is done\n");
return 1;
}

int operation3(size_t /* unsused */)
int operation3(size_t unused)
{
(void)unused;

printf("operation 3\n");
printf("Yet another operation is done\n");
return 1;
}

int finish(size_t /* unsused */)
int finish(size_t unused)
{
(void)unused;

printf("finishing...\n");
exit(0);
}

diff --git a/ source/menu.cpp b/ source/menu.cpp

@@ -90,7 +90,7 @@ void menu_t::insert(const std::string& code,

callback_f callback)
{
char* buffer = new char[prompt.size() + 1]; // NOLINT
strcpy(buffer, prompt.c_str()); // NOLINT
strcpy(buffer, prompt.c_str()); // NOLINT

m_items.emplace_back(callback, buffer);
m_codes.emplace_back(code, prompt);