stamenStatic Menu Generator | 
          
| git clone git://git.dimitrijedobrota.com/stamen.git | 
| Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING | 
| commit | 972666d81653fd991e17ca3971c6cf61d3efa7d4 | 
| parent | 472fad60cd717eef6ead0ed88668462e630f78c3 | 
| author | Dimitrije Dobrota < mail@dimitrijedobrota.com > | 
| date | Thu, 13 Jun 2024 20:50:44 +0200 | 
Fix custom display function mechanism
| M | demo/CMakeLists.txt | | | ++ -- | 
| M | demo/dynamic.cpp | | | ++ --- | 
| M | demo/main.cpp | | | ++ --- | 
| M | include/menu.h | | | + | 
| M | src/generate.cpp | | | ++ | 
| M | src/menu.cpp | | | + -- | 
| M | src/stamen.cpp | | | ++ | 
7 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/ demo/CMakeLists.txt b/ demo/CMakeLists.txt
          @@ -17,8 +17,7 @@ 
          target_include_directories(demo PRIVATE ${GENERATE_OUT} ${CMAKE_CURRENT_SOURCE_D
        
        
          set_target_properties(demo PROPERTIES
              VERSION ${PROJECT_VERSION}
              SOVERSION ${PROJECT_VERSION_MAJOR}
              RUNTIME_OUTPUT_DIRECTORY "${GENERATE_OUT}"
          )
              RUNTIME_OUTPUT_DIRECTORY "${GENERATE_OUT}")
          add_custom_command(
              OUTPUT ${GENERATE_OUT}/demo_menu.h ${GENERATE_OUT}/demo_menu.c
        
        
          @@ -40,6 +39,7 @@ 
          set_target_properties(cdemo PROPERTIES
        
        
          add_executable(dynamic dynamic.cpp)
          target_link_libraries(dynamic stamen)
          set_target_properties(dynamic PROPERTIES LINKER_LANGUAGE CXX)
          set_target_properties(dynamic PROPERTIES
              VERSION ${PROJECT_VERSION}
        
        diff --git a/ demo/dynamic.cpp b/ demo/dynamic.cpp
@@ -1,9 +1,8 @@
#include "stamen.hpp"
          #include <iostream>
          // need to link against stamen library
          // in order to use stamen::builtin_display
          const stamen::display_f &stamen::display = stamen::builtin_display;
          // need to link against stamen library in order to use stamen::builtin_display
          const stamen::display_f stamen::stamen_display = stamen::builtin_display;
          int finish(int) { exit(1); }
          diff --git a/ demo/main.cpp b/ demo/main.cpp
@@ -3,9 +3,8 @@
#include <iostream>
          // need to link against stamen library
          // in order to use stamen::builtin_display
          const stamen::display_f &stamen::display = stamen::builtin_display;
          // need to link against stamen library in order to use stamen::builtin_display
          const stamen::display_f stamen::stamen_display = stamen::builtin_display;
          int operation1(int) {
              std::cout << "operation 1" << std::endl;
        
        diff --git a/ include/menu.h b/ include/menu.h
          @@ -32,6 +32,7 @@ 
          class Menu {
        
        
                  display_stub_default = code;
                  return display_stub(-1);
              };
              static void read(const std::string &s);
              static void print(const std::string &entry) { print(entry, 1); }
              static void insert(const std::string &s, callback_f callback) {
        
        diff --git a/ src/generate.cpp b/ src/generate.cpp
@@ -8,6 +8,8 @@
namespace stamen {
          const stamen_display_f stamen_display = stamen::builtin_display;
          class Generator {
            public:
              static void generateInclude(std::ostream &os, bool cpp) {
        
        diff --git a/ src/menu.cpp b/ src/menu.cpp
          @@ -61,8 +61,7 @@ 
          int Menu::display_stub(int idx) {
        
        
              if (ml_it != menu_lookup.end()) {
                  const Menu &menu = ml_it->second;
                  st.push_back(&menu);
                  int ret = builtin_display(menu.title.c_str(), menu.getItemv(),
                                            menu.getSize());
                  int ret = display(menu.title.c_str(), menu.getItemv(), menu.getSize());
                  st.pop_back();
                  return ret;
              }
        
        diff --git a/ src/stamen.cpp b/ src/stamen.cpp
@@ -9,6 +9,8 @@
namespace stamen {
          const display_f &display = stamen_display;
          int dynamic(const char *code) { return Menu::dynamic(code); }
          void read(const char *filename) { Menu::read(filename); }
          void insert(const char *code, callback_f callback) {