2024-12-10 13:13:14 -08:00
|
|
|
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
|
|
|
|
#define GEN_ENFORCE_STRONG_CODE_TYPES
|
|
|
|
#define GEN_C_LIKE_CPP 1
|
2024-12-10 17:45:00 -08:00
|
|
|
#include "gen.cpp"
|
2024-12-10 13:13:14 -08:00
|
|
|
#include "helpers/push_ignores.inline.hpp"
|
2024-12-10 17:45:00 -08:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
2024-12-10 13:13:14 -08:00
|
|
|
|
|
|
|
GEN_NS_BEGIN
|
2024-12-10 17:45:00 -08:00
|
|
|
#include "helpers/base_codegen.hpp"
|
|
|
|
#include "helpers/misc.hpp"
|
2024-12-10 13:13:14 -08:00
|
|
|
GEN_NS_END
|
|
|
|
|
|
|
|
using namespace gen;
|
|
|
|
|
|
|
|
constexpr char const* path_format_style = "../scripts/.clang-format";
|
2024-12-10 18:35:46 -08:00
|
|
|
constexpr char const* scratch_file = "build/scratch.hpp";
|
2024-12-10 13:13:14 -08:00
|
|
|
|
|
|
|
Code format( Code code ) {
|
|
|
|
return code_refactor_and_format(code, scratch_file, nullptr, path_format_style );
|
|
|
|
}
|
|
|
|
|
2024-12-10 17:45:00 -08:00
|
|
|
constexpr char const* generation_notice =
|
|
|
|
"// This file was generated automatially by gencpp's bootstrap.cpp "
|
|
|
|
"(See: https://github.com/Ed94/gencpp)\n\n";
|
|
|
|
|
2024-12-10 13:13:14 -08:00
|
|
|
int gen_main()
|
|
|
|
{
|
2024-12-13 16:16:52 -08:00
|
|
|
gen::Context ctx {};
|
|
|
|
gen::init( & ctx);
|
2024-12-10 17:45:00 -08:00
|
|
|
|
2024-12-10 18:35:46 -08:00
|
|
|
CodeBody gen_component_header = def_global_body( args(
|
|
|
|
def_preprocess_cond( PreprocessCond_IfDef, txt("GEN_INTELLISENSE_DIRECTIVES") ),
|
|
|
|
pragma_once,
|
|
|
|
def_include(txt("components/types.hpp")),
|
|
|
|
preprocess_endif,
|
|
|
|
fmt_newline,
|
2024-12-12 09:55:15 -08:00
|
|
|
untyped_str( to_str_from_c_str(generation_notice) )
|
2024-12-10 18:35:46 -08:00
|
|
|
));
|
2024-12-10 17:45:00 -08:00
|
|
|
|
2024-12-10 13:13:14 -08:00
|
|
|
CodeBody ecode = gen_ecode ( "enums/ECodeTypes.csv" );
|
|
|
|
CodeBody eoperator = gen_eoperator ( "enums/EOperator.csv" );
|
|
|
|
CodeBody especifier = gen_especifier( "enums/ESpecifier.csv" );
|
2024-12-13 10:20:16 -08:00
|
|
|
CodeBody etoktype = gen_etoktype ( "enums/ETokType.csv", "enums/AttributeTokens.csv" );
|
2024-12-10 13:13:14 -08:00
|
|
|
CodeBody ast_inlines = gen_ast_inlines();
|
|
|
|
|
2024-12-11 10:33:35 -08:00
|
|
|
Builder header_ecode = builder_open( "components/gen/ecodetypes.hpp" );
|
2024-12-10 13:13:14 -08:00
|
|
|
builder_print( & header_ecode, gen_component_header );
|
|
|
|
builder_print( & header_ecode, format(ecode) );
|
|
|
|
builder_write( & header_ecode);
|
|
|
|
|
|
|
|
Builder header_eoperator = builder_open( "components/gen/eoperator.hpp" );
|
|
|
|
builder_print( & header_eoperator, gen_component_header );
|
|
|
|
builder_print( & header_eoperator, format(eoperator) );
|
|
|
|
builder_write( & header_eoperator );
|
|
|
|
|
|
|
|
Builder header_especifier = builder_open( "components/gen/especifier.hpp" );
|
|
|
|
builder_print( & header_especifier, gen_component_header );
|
|
|
|
builder_print( & header_especifier, format(especifier) );
|
|
|
|
builder_write( & header_especifier);
|
2024-12-13 10:20:16 -08:00
|
|
|
|
2024-12-13 17:40:18 -08:00
|
|
|
Builder header_etoktype = builder_open( "components/gen/etoktype.hpp" );
|
2024-12-13 10:20:16 -08:00
|
|
|
builder_print( & header_etoktype, gen_component_header );
|
|
|
|
builder_print( & header_etoktype, format(etoktype) );
|
|
|
|
builder_write( & header_etoktype);
|
2024-12-10 13:13:14 -08:00
|
|
|
|
|
|
|
Builder header_ast_inlines = builder_open( "components/gen/ast_inlines.hpp" );
|
|
|
|
builder_print( & header_ast_inlines, gen_component_header );
|
|
|
|
builder_print( & header_ast_inlines, format(ast_inlines) );
|
|
|
|
builder_write( & header_ast_inlines);
|
2024-12-10 17:45:00 -08:00
|
|
|
|
2024-12-13 16:16:52 -08:00
|
|
|
gen::deinit(& ctx);
|
2024-12-10 17:45:00 -08:00
|
|
|
return 0;
|
|
|
|
}
|