{
using namespace cemplate; // NOLINT
initlist items; for (auto i = 0UL; i < lmenu.get_size(); i++)
initlist items;
for (auto i = 0UL; i < lmenu.get_size(); i++)
{
items.emplace_back(initlist({
lmenu.get_code(i),
string(lmenu.get_prompt(i)),
lmenu.get_code(i),
}));
}
return initlist_elem(items);
}
void generate_include_c(std::ostream& ost, const arguments_t& args)
{
using namespace cemplate; // NOLINT
ost << pragma_once();
for (const auto& [code, menu] : stamen::menu::menu_lookup)
{
ost << func_decl(menu.get_code(), "int", {{"size_t", "/* unused */"}});
}
(void)args;
}
void generate_source_c(std::ostream& ost, const arguments_t& args)
{
using namespace cemplate; // NOLINT
if (args.user)
{
ost << include("stamen.h", true);
}
else
{
ost << include("stamen/stamen.h");
}
ost << std::format("extern int {}(const char *title, ", args.display);
ost << "const stamen_item_t itemv[], size_t size);\n\n";
for (const auto& [code, _] : stamen::menu::free_lookup)
{
ost << std::format("extern int {}(size_t);\n", code);
}
ost << '\n';
for (const auto& [code, menu] : stamen::menu::menu_lookup)
{
ost << std::format("int {}(size_t /* unused */) {{\n", menu.get_code());
ost << "\tstatic const stamen_item_t items[] = ";
ost << "{\n";
for (auto i = 0UL; i < menu.get_size(); i++)
{
ost << "\t\t{ " << menu.get_code(i);
ost << ", \"" << menu.get_prompt(i) << "\" },\n";
}
ost << "\t};\n";
ost << std::format("\treturn {}(\"{}\"", args.display, menu.get_title());
ost << ", items, sizeof(items) / sizeof(items[0]));\n";
ost << "}\n\n";
}
}
void generate_include_cpp(std::ostream& ost, const arguments_t& args)
void generate_include(std::ostream& ost, const arguments_t& args)
{
using namespace cemplate; // NOLINT