mirror of
https://github.com/Ed94/gencpp.git
synced 2025-06-14 18:51:47 -07:00
Updated c_library generation to support latest changes with context struct (also prepped for static/dynamic linkage)
This commit is contained in:
@ -236,19 +236,19 @@ template< class Type> forceinline Type tmpl_cast( Code self ) { return * rcast(
|
||||
|
||||
#pragma region Code C-Interface
|
||||
|
||||
void code_append (Code code, Code other );
|
||||
Str code_debug_str (Code code);
|
||||
Code code_duplicate (Code code);
|
||||
Code* code_entry (Code code, u32 idx );
|
||||
bool code_has_entries (Code code);
|
||||
bool code_is_body (Code code);
|
||||
bool code_is_equal (Code code, Code other);
|
||||
bool code_is_valid (Code code);
|
||||
void code_set_global (Code code);
|
||||
StrBuilder code_to_strbuilder (Code self );
|
||||
void code_to_strbuilder_ptr(Code self, StrBuilder* result );
|
||||
Str code_type_str (Code self );
|
||||
bool code_validate_body (Code self );
|
||||
GEN_API void code_append (Code code, Code other );
|
||||
GEN_API Str code_debug_str (Code code);
|
||||
GEN_API Code code_duplicate (Code code);
|
||||
GEN_API Code* code_entry (Code code, u32 idx );
|
||||
GEN_API bool code_has_entries (Code code);
|
||||
GEN_API bool code_is_body (Code code);
|
||||
GEN_API bool code_is_equal (Code code, Code other);
|
||||
GEN_API bool code_is_valid (Code code);
|
||||
GEN_API void code_set_global (Code code);
|
||||
GEN_API StrBuilder code_to_strbuilder (Code self );
|
||||
GEN_API void code_to_strbuilder_ptr(Code self, StrBuilder* result );
|
||||
GEN_API Str code_type_str (Code self );
|
||||
GEN_API bool code_validate_body (Code self );
|
||||
|
||||
#pragma endregion Code C-Interface
|
||||
|
||||
@ -440,7 +440,7 @@ static_assert( sizeof(AST) == AST_POD_Size, "ERROR: AST is not size of AST_POD_S
|
||||
struct InvalidCode_ImplictCaster;
|
||||
#define InvalidCode (InvalidCode_ImplictCaster{})
|
||||
#else
|
||||
#define InvalidCode (void*){ (void*)_ctx->Code_Invalid }
|
||||
#define InvalidCode (void*){ (void*)Code_Invalid }
|
||||
#endif
|
||||
|
||||
#if GEN_COMPILER_CPP
|
||||
|
@ -1407,7 +1407,7 @@ void var_to_strbuilder_ref(CodeVar self, StrBuilder* result )
|
||||
if ( self->Attributes || self->Specs )
|
||||
{
|
||||
if ( self->Attributes )
|
||||
strbuilder_append_fmt( result, "%SB ", specifiers_to_strbuilder(self->Specs) );
|
||||
strbuilder_append_fmt( result, "%SB ", attributes_to_strbuilder(self->Attributes) );
|
||||
|
||||
if ( self->Specs )
|
||||
strbuilder_append_fmt( result, "%SB\n", specifiers_to_strbuilder(self->Specs) );
|
||||
|
@ -17,128 +17,128 @@
|
||||
|
||||
#pragma region Code Type C-Interface
|
||||
|
||||
void body_append ( CodeBody body, Code other );
|
||||
void body_append_body ( CodeBody body, CodeBody other );
|
||||
StrBuilder body_to_strbuilder ( CodeBody body );
|
||||
void body_to_strbuilder_ref ( CodeBody body, StrBuilder* result );
|
||||
void body_to_strbuilder_export( CodeBody body, StrBuilder* result );
|
||||
GEN_API void body_append ( CodeBody body, Code other );
|
||||
GEN_API void body_append_body ( CodeBody body, CodeBody other );
|
||||
GEN_API StrBuilder body_to_strbuilder ( CodeBody body );
|
||||
GEN_API void body_to_strbuilder_ref ( CodeBody body, StrBuilder* result );
|
||||
GEN_API void body_to_strbuilder_export( CodeBody body, StrBuilder* result );
|
||||
|
||||
Code begin_CodeBody( CodeBody body);
|
||||
Code end_CodeBody ( CodeBody body );
|
||||
Code next_CodeBody ( CodeBody body, Code entry_iter );
|
||||
GEN_API Code begin_CodeBody( CodeBody body);
|
||||
GEN_API Code end_CodeBody ( CodeBody body );
|
||||
GEN_API Code next_CodeBody ( CodeBody body, Code entry_iter );
|
||||
|
||||
void class_add_interface ( CodeClass self, CodeTypename interface );
|
||||
StrBuilder class_to_strbuilder ( CodeClass self );
|
||||
void class_to_strbuilder_def( CodeClass self, StrBuilder* result );
|
||||
void class_to_strbuilder_fwd( CodeClass self, StrBuilder* result );
|
||||
GEN_API void class_add_interface ( CodeClass self, CodeTypename interface );
|
||||
GEN_API StrBuilder class_to_strbuilder ( CodeClass self );
|
||||
GEN_API void class_to_strbuilder_def( CodeClass self, StrBuilder* result );
|
||||
GEN_API void class_to_strbuilder_fwd( CodeClass self, StrBuilder* result );
|
||||
|
||||
void params_append (CodeParams params, CodeParams param );
|
||||
CodeParams params_get (CodeParams params, s32 idx);
|
||||
bool params_has_entries (CodeParams params );
|
||||
StrBuilder params_to_strbuilder (CodeParams params );
|
||||
void params_to_strbuilder_ref(CodeParams params, StrBuilder* result );
|
||||
GEN_API void params_append (CodeParams params, CodeParams param );
|
||||
GEN_API CodeParams params_get (CodeParams params, s32 idx);
|
||||
GEN_API bool params_has_entries (CodeParams params );
|
||||
GEN_API StrBuilder params_to_strbuilder (CodeParams params );
|
||||
GEN_API void params_to_strbuilder_ref(CodeParams params, StrBuilder* result );
|
||||
|
||||
CodeParams begin_CodeParams(CodeParams params);
|
||||
CodeParams end_CodeParams (CodeParams params);
|
||||
CodeParams next_CodeParams (CodeParams params, CodeParams entry_iter);
|
||||
GEN_API CodeParams begin_CodeParams(CodeParams params);
|
||||
GEN_API CodeParams end_CodeParams (CodeParams params);
|
||||
GEN_API CodeParams next_CodeParams (CodeParams params, CodeParams entry_iter);
|
||||
|
||||
bool specifiers_append (CodeSpecifiers specifiers, Specifier spec);
|
||||
s32 specifiers_has (CodeSpecifiers specifiers, Specifier spec);
|
||||
s32 specifiers_remove (CodeSpecifiers specifiers, Specifier to_remove );
|
||||
StrBuilder specifiers_to_strbuilder (CodeSpecifiers specifiers);
|
||||
void specifiers_to_strbuilder_ref(CodeSpecifiers specifiers, StrBuilder* result);
|
||||
GEN_API bool specifiers_append (CodeSpecifiers specifiers, Specifier spec);
|
||||
GEN_API s32 specifiers_has (CodeSpecifiers specifiers, Specifier spec);
|
||||
GEN_API s32 specifiers_remove (CodeSpecifiers specifiers, Specifier to_remove );
|
||||
GEN_API StrBuilder specifiers_to_strbuilder (CodeSpecifiers specifiers);
|
||||
GEN_API void specifiers_to_strbuilder_ref(CodeSpecifiers specifiers, StrBuilder* result);
|
||||
|
||||
Specifier* begin_CodeSpecifiers(CodeSpecifiers specifiers);
|
||||
Specifier* end_CodeSpecifiers (CodeSpecifiers specifiers);
|
||||
Specifier* next_CodeSpecifiers (CodeSpecifiers specifiers, Specifier* spec_iter);
|
||||
GEN_API Specifier* begin_CodeSpecifiers(CodeSpecifiers specifiers);
|
||||
GEN_API Specifier* end_CodeSpecifiers (CodeSpecifiers specifiers);
|
||||
GEN_API Specifier* next_CodeSpecifiers (CodeSpecifiers specifiers, Specifier* spec_iter);
|
||||
|
||||
void struct_add_interface (CodeStruct self, CodeTypename interface);
|
||||
StrBuilder struct_to_strbuilder (CodeStruct self);
|
||||
void struct_to_strbuilder_fwd(CodeStruct self, StrBuilder* result);
|
||||
void struct_to_strbuilder_def(CodeStruct self, StrBuilder* result);
|
||||
GEN_API void struct_add_interface (CodeStruct self, CodeTypename interface);
|
||||
GEN_API StrBuilder struct_to_strbuilder (CodeStruct self);
|
||||
GEN_API void struct_to_strbuilder_fwd(CodeStruct self, StrBuilder* result);
|
||||
GEN_API void struct_to_strbuilder_def(CodeStruct self, StrBuilder* result);
|
||||
|
||||
StrBuilder attributes_to_strbuilder (CodeAttributes attributes);
|
||||
void attributes_to_strbuilder_ref(CodeAttributes attributes, StrBuilder* result);
|
||||
GEN_API StrBuilder attributes_to_strbuilder (CodeAttributes attributes);
|
||||
GEN_API void attributes_to_strbuilder_ref(CodeAttributes attributes, StrBuilder* result);
|
||||
|
||||
StrBuilder comment_to_strbuilder (CodeComment comment );
|
||||
void comment_to_strbuilder_ref(CodeComment comment, StrBuilder* result );
|
||||
GEN_API StrBuilder comment_to_strbuilder (CodeComment comment );
|
||||
GEN_API void comment_to_strbuilder_ref(CodeComment comment, StrBuilder* result );
|
||||
|
||||
StrBuilder constructor_to_strbuilder (CodeConstructor constructor);
|
||||
void constructor_to_strbuilder_def(CodeConstructor constructor, StrBuilder* result );
|
||||
void constructor_to_strbuilder_fwd(CodeConstructor constructor, StrBuilder* result );
|
||||
GEN_API StrBuilder constructor_to_strbuilder (CodeConstructor constructor);
|
||||
GEN_API void constructor_to_strbuilder_def(CodeConstructor constructor, StrBuilder* result );
|
||||
GEN_API void constructor_to_strbuilder_fwd(CodeConstructor constructor, StrBuilder* result );
|
||||
|
||||
StrBuilder define_to_strbuilder (CodeDefine self);
|
||||
void define_to_strbuilder_ref(CodeDefine self, StrBuilder* result);
|
||||
GEN_API StrBuilder define_to_strbuilder (CodeDefine self);
|
||||
GEN_API void define_to_strbuilder_ref(CodeDefine self, StrBuilder* result);
|
||||
|
||||
StrBuilder destructor_to_strbuilder (CodeDestructor destructor);
|
||||
void destructor_to_strbuilder_fwd(CodeDestructor destructor, StrBuilder* result );
|
||||
void destructor_to_strbuilder_def(CodeDestructor destructor, StrBuilder* result );
|
||||
GEN_API StrBuilder destructor_to_strbuilder (CodeDestructor destructor);
|
||||
GEN_API void destructor_to_strbuilder_fwd(CodeDestructor destructor, StrBuilder* result );
|
||||
GEN_API void destructor_to_strbuilder_def(CodeDestructor destructor, StrBuilder* result );
|
||||
|
||||
StrBuilder enum_to_strbuilder (CodeEnum self);
|
||||
void enum_to_strbuilder_def (CodeEnum self, StrBuilder* result );
|
||||
void enum_to_strbuilder_fwd (CodeEnum self, StrBuilder* result );
|
||||
void enum_to_strbuilder_class_def(CodeEnum self, StrBuilder* result );
|
||||
void enum_to_strbuilder_class_fwd(CodeEnum self, StrBuilder* result );
|
||||
GEN_API StrBuilder enum_to_strbuilder (CodeEnum self);
|
||||
GEN_API void enum_to_strbuilder_def (CodeEnum self, StrBuilder* result );
|
||||
GEN_API void enum_to_strbuilder_fwd (CodeEnum self, StrBuilder* result );
|
||||
GEN_API void enum_to_strbuilder_class_def(CodeEnum self, StrBuilder* result );
|
||||
GEN_API void enum_to_strbuilder_class_fwd(CodeEnum self, StrBuilder* result );
|
||||
|
||||
StrBuilder exec_to_strbuilder (CodeExec exec);
|
||||
void exec_to_strbuilder_ref(CodeExec exec, StrBuilder* result);
|
||||
GEN_API StrBuilder exec_to_strbuilder (CodeExec exec);
|
||||
GEN_API void exec_to_strbuilder_ref(CodeExec exec, StrBuilder* result);
|
||||
|
||||
void extern_to_strbuilder(CodeExtern self, StrBuilder* result);
|
||||
GEN_API void extern_to_strbuilder(CodeExtern self, StrBuilder* result);
|
||||
|
||||
StrBuilder include_to_strbuilder (CodeInclude self);
|
||||
void include_to_strbuilder_ref(CodeInclude self, StrBuilder* result);
|
||||
GEN_API StrBuilder include_to_strbuilder (CodeInclude self);
|
||||
GEN_API void include_to_strbuilder_ref(CodeInclude self, StrBuilder* result);
|
||||
|
||||
StrBuilder friend_to_strbuilder (CodeFriend self);
|
||||
void friend_to_strbuilder_ref(CodeFriend self, StrBuilder* result);
|
||||
GEN_API StrBuilder friend_to_strbuilder (CodeFriend self);
|
||||
GEN_API void friend_to_strbuilder_ref(CodeFriend self, StrBuilder* result);
|
||||
|
||||
StrBuilder fn_to_strbuilder (CodeFn self);
|
||||
void fn_to_strbuilder_def(CodeFn self, StrBuilder* result);
|
||||
void fn_to_strbuilder_fwd(CodeFn self, StrBuilder* result);
|
||||
GEN_API StrBuilder fn_to_strbuilder (CodeFn self);
|
||||
GEN_API void fn_to_strbuilder_def(CodeFn self, StrBuilder* result);
|
||||
GEN_API void fn_to_strbuilder_fwd(CodeFn self, StrBuilder* result);
|
||||
|
||||
StrBuilder module_to_strbuilder (CodeModule self);
|
||||
void module_to_strbuilder_ref(CodeModule self, StrBuilder* result);
|
||||
GEN_API StrBuilder module_to_strbuilder (CodeModule self);
|
||||
GEN_API void module_to_strbuilder_ref(CodeModule self, StrBuilder* result);
|
||||
|
||||
StrBuilder namespace_to_strbuilder (CodeNS self);
|
||||
void namespace_to_strbuilder_ref(CodeNS self, StrBuilder* result);
|
||||
GEN_API StrBuilder namespace_to_strbuilder (CodeNS self);
|
||||
GEN_API void namespace_to_strbuilder_ref(CodeNS self, StrBuilder* result);
|
||||
|
||||
StrBuilder code_op_to_strbuilder (CodeOperator self);
|
||||
void code_op_to_strbuilder_fwd(CodeOperator self, StrBuilder* result );
|
||||
void code_op_to_strbuilder_def(CodeOperator self, StrBuilder* result );
|
||||
GEN_API StrBuilder code_op_to_strbuilder (CodeOperator self);
|
||||
GEN_API void code_op_to_strbuilder_fwd(CodeOperator self, StrBuilder* result );
|
||||
GEN_API void code_op_to_strbuilder_def(CodeOperator self, StrBuilder* result );
|
||||
|
||||
StrBuilder opcast_to_strbuilder (CodeOpCast op_cast );
|
||||
void opcast_to_strbuilder_def(CodeOpCast op_cast, StrBuilder* result );
|
||||
void opcast_to_strbuilder_fwd(CodeOpCast op_cast, StrBuilder* result );
|
||||
GEN_API StrBuilder opcast_to_strbuilder (CodeOpCast op_cast );
|
||||
GEN_API void opcast_to_strbuilder_def(CodeOpCast op_cast, StrBuilder* result );
|
||||
GEN_API void opcast_to_strbuilder_fwd(CodeOpCast op_cast, StrBuilder* result );
|
||||
|
||||
StrBuilder pragma_to_strbuilder (CodePragma self);
|
||||
void pragma_to_strbuilder_ref(CodePragma self, StrBuilder* result);
|
||||
GEN_API StrBuilder pragma_to_strbuilder (CodePragma self);
|
||||
GEN_API void pragma_to_strbuilder_ref(CodePragma self, StrBuilder* result);
|
||||
|
||||
StrBuilder preprocess_to_strbuilder (CodePreprocessCond cond);
|
||||
void preprocess_to_strbuilder_if (CodePreprocessCond cond, StrBuilder* result );
|
||||
void preprocess_to_strbuilder_ifdef (CodePreprocessCond cond, StrBuilder* result );
|
||||
void preprocess_to_strbuilder_ifndef(CodePreprocessCond cond, StrBuilder* result );
|
||||
void preprocess_to_strbuilder_elif (CodePreprocessCond cond, StrBuilder* result );
|
||||
void preprocess_to_strbuilder_else (CodePreprocessCond cond, StrBuilder* result );
|
||||
void preprocess_to_strbuilder_endif (CodePreprocessCond cond, StrBuilder* result );
|
||||
GEN_API StrBuilder preprocess_to_strbuilder (CodePreprocessCond cond);
|
||||
GEN_API void preprocess_to_strbuilder_if (CodePreprocessCond cond, StrBuilder* result );
|
||||
GEN_API void preprocess_to_strbuilder_ifdef (CodePreprocessCond cond, StrBuilder* result );
|
||||
GEN_API void preprocess_to_strbuilder_ifndef(CodePreprocessCond cond, StrBuilder* result );
|
||||
GEN_API void preprocess_to_strbuilder_elif (CodePreprocessCond cond, StrBuilder* result );
|
||||
GEN_API void preprocess_to_strbuilder_else (CodePreprocessCond cond, StrBuilder* result );
|
||||
GEN_API void preprocess_to_strbuilder_endif (CodePreprocessCond cond, StrBuilder* result );
|
||||
|
||||
StrBuilder template_to_strbuilder (CodeTemplate self);
|
||||
void template_to_strbuilder_ref(CodeTemplate self, StrBuilder* result);
|
||||
GEN_API StrBuilder template_to_strbuilder (CodeTemplate self);
|
||||
GEN_API void template_to_strbuilder_ref(CodeTemplate self, StrBuilder* result);
|
||||
|
||||
StrBuilder typename_to_strbuilder (CodeTypename self);
|
||||
void typename_to_strbuilder_ref(CodeTypename self, StrBuilder* result);
|
||||
GEN_API StrBuilder typename_to_strbuilder (CodeTypename self);
|
||||
GEN_API void typename_to_strbuilder_ref(CodeTypename self, StrBuilder* result);
|
||||
|
||||
StrBuilder typedef_to_strbuilder (CodeTypedef self);
|
||||
void typedef_to_strbuilder_ref(CodeTypedef self, StrBuilder* result );
|
||||
GEN_API StrBuilder typedef_to_strbuilder (CodeTypedef self);
|
||||
GEN_API void typedef_to_strbuilder_ref(CodeTypedef self, StrBuilder* result );
|
||||
|
||||
StrBuilder union_to_strbuilder (CodeUnion self);
|
||||
void union_to_strbuilder_def(CodeUnion self, StrBuilder* result);
|
||||
void union_to_strbuilder_fwd(CodeUnion self, StrBuilder* result);
|
||||
GEN_API StrBuilder union_to_strbuilder (CodeUnion self);
|
||||
GEN_API void union_to_strbuilder_def(CodeUnion self, StrBuilder* result);
|
||||
GEN_API void union_to_strbuilder_fwd(CodeUnion self, StrBuilder* result);
|
||||
|
||||
StrBuilder using_to_strbuilder (CodeUsing op_cast );
|
||||
void using_to_strbuilder_ref(CodeUsing op_cast, StrBuilder* result );
|
||||
void using_to_strbuilder_ns (CodeUsing op_cast, StrBuilder* result );
|
||||
GEN_API StrBuilder using_to_strbuilder (CodeUsing op_cast );
|
||||
GEN_API void using_to_strbuilder_ref(CodeUsing op_cast, StrBuilder* result );
|
||||
GEN_API void using_to_strbuilder_ns (CodeUsing op_cast, StrBuilder* result );
|
||||
|
||||
StrBuilder var_to_strbuilder (CodeVar self);
|
||||
void var_to_strbuilder_ref(CodeVar self, StrBuilder* result);
|
||||
GEN_API StrBuilder var_to_strbuilder (CodeVar self);
|
||||
GEN_API void var_to_strbuilder_ref(CodeVar self, StrBuilder* result);
|
||||
|
||||
#pragma endregion Code Type C-Interface
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||
|
||||
#define GEN_DEFINE_ATTRIBUTE_TOKENS Entry( Tok_Attribute_API_Export, "GEN_API_Export_Code" ) Entry( Tok_Attribute_API_Import, "GEN_API_Import_Code" )
|
||||
#define GEN_DEFINE_ATTRIBUTE_TOKENS Entry( Tok_Attribute_GEN_API, "GEN_API" )
|
||||
|
||||
enum TokType : u32
|
||||
{
|
||||
@ -104,111 +104,109 @@ enum TokType : u32
|
||||
Tok_Type_MS_W64,
|
||||
Tok_Varadic_Argument,
|
||||
Tok___Attributes_Start,
|
||||
Tok_Attribute_API_Export,
|
||||
Tok_Attribute_API_Import,
|
||||
Tok_Attribute_GEN_API,
|
||||
Tok_NumTokens
|
||||
};
|
||||
|
||||
inline Str toktype_to_str( TokType type )
|
||||
{
|
||||
local_persist Str lookup[] = {
|
||||
{ "__invalid__", sizeof( "__invalid__" ) - 1 },
|
||||
{ "private", sizeof( "private" ) - 1 },
|
||||
{ "protected", sizeof( "protected" ) - 1 },
|
||||
{ "public", sizeof( "public" ) - 1 },
|
||||
{ ".", sizeof( "." ) - 1 },
|
||||
{ "::", sizeof( "::" ) - 1 },
|
||||
{ "&", sizeof( "&" ) - 1 },
|
||||
{ "&&", sizeof( "&&" ) - 1 },
|
||||
{ ":", sizeof( ":" ) - 1 },
|
||||
{ "[[", sizeof( "[[" ) - 1 },
|
||||
{ "]]", sizeof( "]]" ) - 1 },
|
||||
{ "{", sizeof( "{" ) - 1 },
|
||||
{ "}", sizeof( "}" ) - 1 },
|
||||
{ "[", sizeof( "[" ) - 1 },
|
||||
{ "]", sizeof( "]" ) - 1 },
|
||||
{ "(", sizeof( "(" ) - 1 },
|
||||
{ ")", sizeof( ")" ) - 1 },
|
||||
{ "__comment__", sizeof( "__comment__" ) - 1 },
|
||||
{ "__comment_end__", sizeof( "__comment_end__" ) - 1 },
|
||||
{ "__comment_start__", sizeof( "__comment_start__" ) - 1 },
|
||||
{ "__character__", sizeof( "__character__" ) - 1 },
|
||||
{ ",", sizeof( "," ) - 1 },
|
||||
{ "class", sizeof( "class" ) - 1 },
|
||||
{ "__attribute__", sizeof( "__attribute__" ) - 1 },
|
||||
{ "__declspec", sizeof( "__declspec" ) - 1 },
|
||||
{ "enum", sizeof( "enum" ) - 1 },
|
||||
{ "extern", sizeof( "extern" ) - 1 },
|
||||
{ "friend", sizeof( "friend" ) - 1 },
|
||||
{ "module", sizeof( "module" ) - 1 },
|
||||
{ "namespace", sizeof( "namespace" ) - 1 },
|
||||
{ "operator", sizeof( "operator" ) - 1 },
|
||||
{ "struct", sizeof( "struct" ) - 1 },
|
||||
{ "template", sizeof( "template" ) - 1 },
|
||||
{ "typedef", sizeof( "typedef" ) - 1 },
|
||||
{ "using", sizeof( "using" ) - 1 },
|
||||
{ "union", sizeof( "union" ) - 1 },
|
||||
{ "__identifier__", sizeof( "__identifier__" ) - 1 },
|
||||
{ "import", sizeof( "import" ) - 1 },
|
||||
{ "export", sizeof( "export" ) - 1 },
|
||||
{ "__new_line__", sizeof( "__new_line__" ) - 1 },
|
||||
{ "__number__", sizeof( "__number__" ) - 1 },
|
||||
{ "__operator__", sizeof( "__operator__" ) - 1 },
|
||||
{ "#", sizeof( "#" ) - 1 },
|
||||
{ "define", sizeof( "define" ) - 1 },
|
||||
{ "if", sizeof( "if" ) - 1 },
|
||||
{ "ifdef", sizeof( "ifdef" ) - 1 },
|
||||
{ "ifndef", sizeof( "ifndef" ) - 1 },
|
||||
{ "elif", sizeof( "elif" ) - 1 },
|
||||
{ "else", sizeof( "else" ) - 1 },
|
||||
{ "endif", sizeof( "endif" ) - 1 },
|
||||
{ "include", sizeof( "include" ) - 1 },
|
||||
{ "pragma", sizeof( "pragma" ) - 1 },
|
||||
{ "__macro_content__", sizeof( "__macro_content__" ) - 1 },
|
||||
{ "__macro__", sizeof( "__macro__" ) - 1 },
|
||||
{ "__unsupported__", sizeof( "__unsupported__" ) - 1 },
|
||||
{ "alignas", sizeof( "alignas" ) - 1 },
|
||||
{ "const", sizeof( "const" ) - 1 },
|
||||
{ "consteval", sizeof( "consteval" ) - 1 },
|
||||
{ "constexpr", sizeof( "constexpr" ) - 1 },
|
||||
{ "constinit", sizeof( "constinit" ) - 1 },
|
||||
{ "explicit", sizeof( "explicit" ) - 1 },
|
||||
{ "extern", sizeof( "extern" ) - 1 },
|
||||
{ "final", sizeof( "final" ) - 1 },
|
||||
{ "forceinline", sizeof( "forceinline" ) - 1 },
|
||||
{ "global", sizeof( "global" ) - 1 },
|
||||
{ "inline", sizeof( "inline" ) - 1 },
|
||||
{ "internal", sizeof( "internal" ) - 1 },
|
||||
{ "local_persist", sizeof( "local_persist" ) - 1 },
|
||||
{ "mutable", sizeof( "mutable" ) - 1 },
|
||||
{ "neverinline", sizeof( "neverinline" ) - 1 },
|
||||
{ "override", sizeof( "override" ) - 1 },
|
||||
{ "static", sizeof( "static" ) - 1 },
|
||||
{ "thread_local", sizeof( "thread_local" ) - 1 },
|
||||
{ "volatile", sizeof( "volatile" ) - 1 },
|
||||
{ "virtual", sizeof( "virtual" ) - 1 },
|
||||
{ "*", sizeof( "*" ) - 1 },
|
||||
{ ";", sizeof( ";" ) - 1 },
|
||||
{ "static_assert", sizeof( "static_assert" ) - 1 },
|
||||
{ "__string__", sizeof( "__string__" ) - 1 },
|
||||
{ "typename", sizeof( "typename" ) - 1 },
|
||||
{ "unsigned", sizeof( "unsigned" ) - 1 },
|
||||
{ "signed", sizeof( "signed" ) - 1 },
|
||||
{ "short", sizeof( "short" ) - 1 },
|
||||
{ "long", sizeof( "long" ) - 1 },
|
||||
{ "bool", sizeof( "bool" ) - 1 },
|
||||
{ "char", sizeof( "char" ) - 1 },
|
||||
{ "int", sizeof( "int" ) - 1 },
|
||||
{ "double", sizeof( "double" ) - 1 },
|
||||
{ "__int8", sizeof( "__int8" ) - 1 },
|
||||
{ "__int16", sizeof( "__int16" ) - 1 },
|
||||
{ "__int32", sizeof( "__int32" ) - 1 },
|
||||
{ "__int64", sizeof( "__int64" ) - 1 },
|
||||
{ "_W64", sizeof( "_W64" ) - 1 },
|
||||
{ "...", sizeof( "..." ) - 1 },
|
||||
{ "__attrib_start__", sizeof( "__attrib_start__" ) - 1 },
|
||||
{ "GEN_API_Export_Code", sizeof( "GEN_API_Export_Code" ) - 1 },
|
||||
{ "GEN_API_Import_Code", sizeof( "GEN_API_Import_Code" ) - 1 },
|
||||
{ "__invalid__", sizeof( "__invalid__" ) - 1 },
|
||||
{ "private", sizeof( "private" ) - 1 },
|
||||
{ "protected", sizeof( "protected" ) - 1 },
|
||||
{ "public", sizeof( "public" ) - 1 },
|
||||
{ ".", sizeof( "." ) - 1 },
|
||||
{ "::", sizeof( "::" ) - 1 },
|
||||
{ "&", sizeof( "&" ) - 1 },
|
||||
{ "&&", sizeof( "&&" ) - 1 },
|
||||
{ ":", sizeof( ":" ) - 1 },
|
||||
{ "[[", sizeof( "[[" ) - 1 },
|
||||
{ "]]", sizeof( "]]" ) - 1 },
|
||||
{ "{", sizeof( "{" ) - 1 },
|
||||
{ "}", sizeof( "}" ) - 1 },
|
||||
{ "[", sizeof( "[" ) - 1 },
|
||||
{ "]", sizeof( "]" ) - 1 },
|
||||
{ "(", sizeof( "(" ) - 1 },
|
||||
{ ")", sizeof( ")" ) - 1 },
|
||||
{ "__comment__", sizeof( "__comment__" ) - 1 },
|
||||
{ "__comment_end__", sizeof( "__comment_end__" ) - 1 },
|
||||
{ "__comment_start__", sizeof( "__comment_start__" ) - 1 },
|
||||
{ "__character__", sizeof( "__character__" ) - 1 },
|
||||
{ ",", sizeof( "," ) - 1 },
|
||||
{ "class", sizeof( "class" ) - 1 },
|
||||
{ "__attribute__", sizeof( "__attribute__" ) - 1 },
|
||||
{ "__declspec", sizeof( "__declspec" ) - 1 },
|
||||
{ "enum", sizeof( "enum" ) - 1 },
|
||||
{ "extern", sizeof( "extern" ) - 1 },
|
||||
{ "friend", sizeof( "friend" ) - 1 },
|
||||
{ "module", sizeof( "module" ) - 1 },
|
||||
{ "namespace", sizeof( "namespace" ) - 1 },
|
||||
{ "operator", sizeof( "operator" ) - 1 },
|
||||
{ "struct", sizeof( "struct" ) - 1 },
|
||||
{ "template", sizeof( "template" ) - 1 },
|
||||
{ "typedef", sizeof( "typedef" ) - 1 },
|
||||
{ "using", sizeof( "using" ) - 1 },
|
||||
{ "union", sizeof( "union" ) - 1 },
|
||||
{ "__identifier__", sizeof( "__identifier__" ) - 1 },
|
||||
{ "import", sizeof( "import" ) - 1 },
|
||||
{ "export", sizeof( "export" ) - 1 },
|
||||
{ "__new_line__", sizeof( "__new_line__" ) - 1 },
|
||||
{ "__number__", sizeof( "__number__" ) - 1 },
|
||||
{ "__operator__", sizeof( "__operator__" ) - 1 },
|
||||
{ "#", sizeof( "#" ) - 1 },
|
||||
{ "define", sizeof( "define" ) - 1 },
|
||||
{ "if", sizeof( "if" ) - 1 },
|
||||
{ "ifdef", sizeof( "ifdef" ) - 1 },
|
||||
{ "ifndef", sizeof( "ifndef" ) - 1 },
|
||||
{ "elif", sizeof( "elif" ) - 1 },
|
||||
{ "else", sizeof( "else" ) - 1 },
|
||||
{ "endif", sizeof( "endif" ) - 1 },
|
||||
{ "include", sizeof( "include" ) - 1 },
|
||||
{ "pragma", sizeof( "pragma" ) - 1 },
|
||||
{ "__macro_content__", sizeof( "__macro_content__" ) - 1 },
|
||||
{ "__macro__", sizeof( "__macro__" ) - 1 },
|
||||
{ "__unsupported__", sizeof( "__unsupported__" ) - 1 },
|
||||
{ "alignas", sizeof( "alignas" ) - 1 },
|
||||
{ "const", sizeof( "const" ) - 1 },
|
||||
{ "consteval", sizeof( "consteval" ) - 1 },
|
||||
{ "constexpr", sizeof( "constexpr" ) - 1 },
|
||||
{ "constinit", sizeof( "constinit" ) - 1 },
|
||||
{ "explicit", sizeof( "explicit" ) - 1 },
|
||||
{ "extern", sizeof( "extern" ) - 1 },
|
||||
{ "final", sizeof( "final" ) - 1 },
|
||||
{ "forceinline", sizeof( "forceinline" ) - 1 },
|
||||
{ "global", sizeof( "global" ) - 1 },
|
||||
{ "inline", sizeof( "inline" ) - 1 },
|
||||
{ "internal", sizeof( "internal" ) - 1 },
|
||||
{ "local_persist", sizeof( "local_persist" ) - 1 },
|
||||
{ "mutable", sizeof( "mutable" ) - 1 },
|
||||
{ "neverinline", sizeof( "neverinline" ) - 1 },
|
||||
{ "override", sizeof( "override" ) - 1 },
|
||||
{ "static", sizeof( "static" ) - 1 },
|
||||
{ "thread_local", sizeof( "thread_local" ) - 1 },
|
||||
{ "volatile", sizeof( "volatile" ) - 1 },
|
||||
{ "virtual", sizeof( "virtual" ) - 1 },
|
||||
{ "*", sizeof( "*" ) - 1 },
|
||||
{ ";", sizeof( ";" ) - 1 },
|
||||
{ "static_assert", sizeof( "static_assert" ) - 1 },
|
||||
{ "__string__", sizeof( "__string__" ) - 1 },
|
||||
{ "typename", sizeof( "typename" ) - 1 },
|
||||
{ "unsigned", sizeof( "unsigned" ) - 1 },
|
||||
{ "signed", sizeof( "signed" ) - 1 },
|
||||
{ "short", sizeof( "short" ) - 1 },
|
||||
{ "long", sizeof( "long" ) - 1 },
|
||||
{ "bool", sizeof( "bool" ) - 1 },
|
||||
{ "char", sizeof( "char" ) - 1 },
|
||||
{ "int", sizeof( "int" ) - 1 },
|
||||
{ "double", sizeof( "double" ) - 1 },
|
||||
{ "__int8", sizeof( "__int8" ) - 1 },
|
||||
{ "__int16", sizeof( "__int16" ) - 1 },
|
||||
{ "__int32", sizeof( "__int32" ) - 1 },
|
||||
{ "__int64", sizeof( "__int64" ) - 1 },
|
||||
{ "_W64", sizeof( "_W64" ) - 1 },
|
||||
{ "...", sizeof( "..." ) - 1 },
|
||||
{ "__attrib_start__", sizeof( "__attrib_start__" ) - 1 },
|
||||
{ "GEN_API", sizeof( "GEN_API" ) - 1 },
|
||||
};
|
||||
return lookup[type];
|
||||
}
|
||||
|
@ -468,5 +468,5 @@ void set_preprocess_define( Str id, b32 is_functional ) {
|
||||
if (is_functional) {
|
||||
strbuilder_append_char( & builder, '(' );
|
||||
}
|
||||
array_append( _ctx->PreprocessorDefines, cache_str(builder) );
|
||||
array_append( _ctx->PreprocessorDefines, cache_str( strbuilder_to_str(builder)) );
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ struct LogEntry
|
||||
typedef void LoggerCallback(LogEntry entry);
|
||||
#endif
|
||||
|
||||
|
||||
// Note(Ed): This is subject to heavily change
|
||||
// with upcoming changes to the library's fallback (default) allocations strategy;
|
||||
// and major changes to lexer/parser context usage.
|
||||
@ -51,7 +50,6 @@ struct Context
|
||||
|
||||
// LoggerCallaback* log_callback; // TODO(Ed): Impl user logger callback as an option.
|
||||
|
||||
//
|
||||
u32 Max_CommentLineLength; // Used by def_comment
|
||||
u32 Max_StrCacheLength; // Any cached string longer than this is always allocated again.
|
||||
|
||||
@ -99,39 +97,39 @@ struct Context
|
||||
};
|
||||
|
||||
// Initialize the library. There first ctx initialized must exist for lifetime of other contextes that come after as its the one that
|
||||
void init(Context* ctx);
|
||||
GEN_API void init(Context* ctx);
|
||||
|
||||
// Currently manually free's the arenas, code for checking for leaks.
|
||||
// However on Windows at least, it doesn't need to occur as the OS will clean up after the process.
|
||||
void deinit(Context* ctx);
|
||||
GEN_API void deinit(Context* ctx);
|
||||
|
||||
// Clears the allocations, but doesn't return to the heap, the calls init() again.
|
||||
// Clears the allocations, but doesn't free the memoery, then calls init() again.
|
||||
// Ease of use.
|
||||
void reset(Context* ctx);
|
||||
GEN_API void reset(Context* ctx);
|
||||
|
||||
void set_context(Context* ctx);
|
||||
GEN_API void set_context(Context* ctx);
|
||||
|
||||
// Alternative way to add a preprocess define entry for the lexer & parser to utilize
|
||||
// if the user doesn't want to use def_define
|
||||
void set_preprocess_define( Str id, b32 is_functional );
|
||||
GEN_API void set_preprocess_define( Str id, b32 is_functional );
|
||||
|
||||
// Used internally to retrive or make string allocations.
|
||||
// Strings are stored in a series of string arenas of fixed size (SizePer_StringArena)
|
||||
StrCached cache_str( Str str );
|
||||
GEN_API StrCached cache_str( Str str );
|
||||
|
||||
/*
|
||||
This provides a fresh Code AST.
|
||||
The gen interface use this as their method from getting a new AST object from the CodePool.
|
||||
Use this if you want to make your own API for formatting the supported Code Types.
|
||||
*/
|
||||
Code make_code();
|
||||
GEN_API Code make_code();
|
||||
|
||||
// Set these before calling gen's init() procedure.
|
||||
|
||||
#pragma region Upfront
|
||||
|
||||
CodeAttributes def_attributes( Str content );
|
||||
CodeComment def_comment ( Str content );
|
||||
GEN_API CodeAttributes def_attributes( Str content );
|
||||
GEN_API CodeComment def_comment ( Str content );
|
||||
|
||||
struct Opts_def_struct {
|
||||
CodeBody body;
|
||||
@ -142,25 +140,25 @@ struct Opts_def_struct {
|
||||
s32 num_interfaces;
|
||||
ModuleFlag mflags;
|
||||
};
|
||||
CodeClass def_class( Str name, Opts_def_struct opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodeClass def_class( Str name, Opts_def_struct opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_constructor {
|
||||
CodeParams params;
|
||||
Code initializer_list;
|
||||
Code body;
|
||||
};
|
||||
CodeConstructor def_constructor( Opts_def_constructor opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodeConstructor def_constructor( Opts_def_constructor opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_define {
|
||||
b32 dont_append_preprocess_defines;
|
||||
};
|
||||
CodeDefine def_define( Str name, Str content, Opts_def_define opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodeDefine def_define( Str name, Str content, Opts_def_define opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_destructor {
|
||||
Code body;
|
||||
CodeSpecifiers specifiers;
|
||||
};
|
||||
CodeDestructor def_destructor( Opts_def_destructor opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodeDestructor def_destructor( Opts_def_destructor opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_enum {
|
||||
CodeBody body;
|
||||
@ -170,11 +168,11 @@ struct Opts_def_enum {
|
||||
ModuleFlag mflags;
|
||||
Code type_macro;
|
||||
};
|
||||
CodeEnum def_enum( Str name, Opts_def_enum opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodeEnum def_enum( Str name, Opts_def_enum opts GEN_PARAM_DEFAULT );
|
||||
|
||||
CodeExec def_execution ( Str content );
|
||||
CodeExtern def_extern_link( Str name, CodeBody body );
|
||||
CodeFriend def_friend ( Code symbol );
|
||||
GEN_API CodeExec def_execution ( Str content );
|
||||
GEN_API CodeExtern def_extern_link( Str name, CodeBody body );
|
||||
GEN_API CodeFriend def_friend ( Code symbol );
|
||||
|
||||
struct Opts_def_function {
|
||||
CodeParams params;
|
||||
@ -184,14 +182,14 @@ struct Opts_def_function {
|
||||
CodeAttributes attrs;
|
||||
ModuleFlag mflags;
|
||||
};
|
||||
CodeFn def_function( Str name, Opts_def_function opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodeFn def_function( Str name, Opts_def_function opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_include { b32 foreign; };
|
||||
struct Opts_def_module { ModuleFlag mflags; };
|
||||
struct Opts_def_namespace { ModuleFlag mflags; };
|
||||
CodeInclude def_include ( Str content, Opts_def_include opts GEN_PARAM_DEFAULT );
|
||||
CodeModule def_module ( Str name, Opts_def_module opts GEN_PARAM_DEFAULT );
|
||||
CodeNS def_namespace( Str name, CodeBody body, Opts_def_namespace opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodeInclude def_include ( Str content, Opts_def_include opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodeModule def_module ( Str name, Opts_def_module opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodeNS def_namespace( Str name, CodeBody body, Opts_def_namespace opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_operator {
|
||||
CodeParams params;
|
||||
@ -201,26 +199,26 @@ struct Opts_def_operator {
|
||||
CodeAttributes attributes;
|
||||
ModuleFlag mflags;
|
||||
};
|
||||
CodeOperator def_operator( Operator op, Str nspace, Opts_def_operator opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodeOperator def_operator( Operator op, Str nspace, Opts_def_operator opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_operator_cast {
|
||||
CodeBody body;
|
||||
CodeSpecifiers specs;
|
||||
};
|
||||
CodeOpCast def_operator_cast( CodeTypename type, Opts_def_operator_cast opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodeOpCast def_operator_cast( CodeTypename type, Opts_def_operator_cast opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_param { Code value; };
|
||||
CodeParams def_param ( CodeTypename type, Str name, Opts_def_param opts GEN_PARAM_DEFAULT );
|
||||
CodePragma def_pragma( Str directive );
|
||||
GEN_API CodeParams def_param ( CodeTypename type, Str name, Opts_def_param opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodePragma def_pragma( Str directive );
|
||||
|
||||
CodePreprocessCond def_preprocess_cond( EPreprocessCond type, Str content );
|
||||
GEN_API CodePreprocessCond def_preprocess_cond( EPreprocessCond type, Str content );
|
||||
|
||||
CodeSpecifiers def_specifier( Specifier specifier );
|
||||
GEN_API CodeSpecifiers def_specifier( Specifier specifier );
|
||||
|
||||
CodeStruct def_struct( Str name, Opts_def_struct opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodeStruct def_struct( Str name, Opts_def_struct opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_template { ModuleFlag mflags; };
|
||||
CodeTemplate def_template( CodeParams params, Code definition, Opts_def_template opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodeTemplate def_template( CodeParams params, Code definition, Opts_def_template opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_type {
|
||||
ETypenameTag type_tag;
|
||||
@ -228,27 +226,27 @@ struct Opts_def_type {
|
||||
CodeSpecifiers specifiers;
|
||||
CodeAttributes attributes;
|
||||
};
|
||||
CodeTypename def_type( Str name, Opts_def_type opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodeTypename def_type( Str name, Opts_def_type opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_typedef {
|
||||
CodeAttributes attributes;
|
||||
ModuleFlag mflags;
|
||||
};
|
||||
CodeTypedef def_typedef( Str name, Code type, Opts_def_typedef opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodeTypedef def_typedef( Str name, Code type, Opts_def_typedef opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_union {
|
||||
CodeAttributes attributes;
|
||||
ModuleFlag mflags;
|
||||
};
|
||||
CodeUnion def_union( Str name, CodeBody body, Opts_def_union opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodeUnion def_union( Str name, CodeBody body, Opts_def_union opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_using {
|
||||
CodeAttributes attributes;
|
||||
ModuleFlag mflags;
|
||||
};
|
||||
CodeUsing def_using( Str name, CodeTypename type, Opts_def_using opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodeUsing def_using( Str name, CodeTypename type, Opts_def_using opts GEN_PARAM_DEFAULT );
|
||||
|
||||
CodeUsing def_using_namespace( Str name );
|
||||
GEN_API CodeUsing def_using_namespace( Str name );
|
||||
|
||||
struct Opts_def_variable
|
||||
{
|
||||
@ -257,36 +255,36 @@ struct Opts_def_variable
|
||||
CodeAttributes attributes;
|
||||
ModuleFlag mflags;
|
||||
};
|
||||
CodeVar def_variable( CodeTypename type, Str name, Opts_def_variable opts GEN_PARAM_DEFAULT );
|
||||
GEN_API CodeVar def_variable( CodeTypename type, Str name, Opts_def_variable opts GEN_PARAM_DEFAULT );
|
||||
|
||||
// Constructs an empty body. Use AST::validate_body() to check if the body is was has valid entries.
|
||||
CodeBody def_body( CodeType type );
|
||||
GEN_API CodeBody def_body( CodeType type );
|
||||
|
||||
// There are two options for defining a struct body, either varadically provided with the args macro to auto-deduce the arg num,
|
||||
/// or provide as an array of Code objects.
|
||||
|
||||
CodeBody def_class_body ( s32 num, ... );
|
||||
CodeBody def_class_body ( s32 num, Code* codes );
|
||||
CodeBody def_enum_body ( s32 num, ... );
|
||||
CodeBody def_enum_body ( s32 num, Code* codes );
|
||||
CodeBody def_export_body ( s32 num, ... );
|
||||
CodeBody def_export_body ( s32 num, Code* codes);
|
||||
CodeBody def_extern_link_body( s32 num, ... );
|
||||
CodeBody def_extern_link_body( s32 num, Code* codes );
|
||||
CodeBody def_function_body ( s32 num, ... );
|
||||
CodeBody def_function_body ( s32 num, Code* codes );
|
||||
CodeBody def_global_body ( s32 num, ... );
|
||||
CodeBody def_global_body ( s32 num, Code* codes );
|
||||
CodeBody def_namespace_body ( s32 num, ... );
|
||||
CodeBody def_namespace_body ( s32 num, Code* codes );
|
||||
CodeParams def_params ( s32 num, ... );
|
||||
CodeParams def_params ( s32 num, CodeParams* params );
|
||||
CodeSpecifiers def_specifiers ( s32 num, ... );
|
||||
CodeSpecifiers def_specifiers ( s32 num, Specifier* specs );
|
||||
CodeBody def_struct_body ( s32 num, ... );
|
||||
CodeBody def_struct_body ( s32 num, Code* codes );
|
||||
CodeBody def_union_body ( s32 num, ... );
|
||||
CodeBody def_union_body ( s32 num, Code* codes );
|
||||
GEN_API CodeBody def_class_body ( s32 num, ... );
|
||||
GEN_API CodeBody def_class_body ( s32 num, Code* codes );
|
||||
GEN_API CodeBody def_enum_body ( s32 num, ... );
|
||||
GEN_API CodeBody def_enum_body ( s32 num, Code* codes );
|
||||
GEN_API CodeBody def_export_body ( s32 num, ... );
|
||||
GEN_API CodeBody def_export_body ( s32 num, Code* codes);
|
||||
GEN_API CodeBody def_extern_link_body( s32 num, ... );
|
||||
GEN_API CodeBody def_extern_link_body( s32 num, Code* codes );
|
||||
GEN_API CodeBody def_function_body ( s32 num, ... );
|
||||
GEN_API CodeBody def_function_body ( s32 num, Code* codes );
|
||||
GEN_API CodeBody def_global_body ( s32 num, ... );
|
||||
GEN_API CodeBody def_global_body ( s32 num, Code* codes );
|
||||
GEN_API CodeBody def_namespace_body ( s32 num, ... );
|
||||
GEN_API CodeBody def_namespace_body ( s32 num, Code* codes );
|
||||
GEN_API CodeParams def_params ( s32 num, ... );
|
||||
GEN_API CodeParams def_params ( s32 num, CodeParams* params );
|
||||
GEN_API CodeSpecifiers def_specifiers ( s32 num, ... );
|
||||
GEN_API CodeSpecifiers def_specifiers ( s32 num, Specifier* specs );
|
||||
GEN_API CodeBody def_struct_body ( s32 num, ... );
|
||||
GEN_API CodeBody def_struct_body ( s32 num, Code* codes );
|
||||
GEN_API CodeBody def_union_body ( s32 num, ... );
|
||||
GEN_API CodeBody def_union_body ( s32 num, Code* codes );
|
||||
|
||||
#pragma endregion Upfront
|
||||
|
||||
@ -326,37 +324,37 @@ struct ParseInfo
|
||||
CodeBody parse_file( Str path );
|
||||
#endif
|
||||
|
||||
CodeClass parse_class ( Str class_def );
|
||||
CodeConstructor parse_constructor ( Str constructor_def );
|
||||
CodeDestructor parse_destructor ( Str destructor_def );
|
||||
CodeEnum parse_enum ( Str enum_def );
|
||||
CodeBody parse_export_body ( Str export_def );
|
||||
CodeExtern parse_extern_link ( Str exten_link_def );
|
||||
CodeFriend parse_friend ( Str friend_def );
|
||||
CodeFn parse_function ( Str fn_def );
|
||||
CodeBody parse_global_body ( Str body_def );
|
||||
CodeNS parse_namespace ( Str namespace_def );
|
||||
CodeOperator parse_operator ( Str operator_def );
|
||||
CodeOpCast parse_operator_cast( Str operator_def );
|
||||
CodeStruct parse_struct ( Str struct_def );
|
||||
CodeTemplate parse_template ( Str template_def );
|
||||
CodeTypename parse_type ( Str type_def );
|
||||
CodeTypedef parse_typedef ( Str typedef_def );
|
||||
CodeUnion parse_union ( Str union_def );
|
||||
CodeUsing parse_using ( Str using_def );
|
||||
CodeVar parse_variable ( Str var_def );
|
||||
GEN_API CodeClass parse_class ( Str class_def );
|
||||
GEN_API CodeConstructor parse_constructor ( Str constructor_def );
|
||||
GEN_API CodeDestructor parse_destructor ( Str destructor_def );
|
||||
GEN_API CodeEnum parse_enum ( Str enum_def );
|
||||
GEN_API CodeBody parse_export_body ( Str export_def );
|
||||
GEN_API CodeExtern parse_extern_link ( Str exten_link_def );
|
||||
GEN_API CodeFriend parse_friend ( Str friend_def );
|
||||
GEN_API CodeFn parse_function ( Str fn_def );
|
||||
GEN_API CodeBody parse_global_body ( Str body_def );
|
||||
GEN_API CodeNS parse_namespace ( Str namespace_def );
|
||||
GEN_API CodeOperator parse_operator ( Str operator_def );
|
||||
GEN_API CodeOpCast parse_operator_cast( Str operator_def );
|
||||
GEN_API CodeStruct parse_struct ( Str struct_def );
|
||||
GEN_API CodeTemplate parse_template ( Str template_def );
|
||||
GEN_API CodeTypename parse_type ( Str type_def );
|
||||
GEN_API CodeTypedef parse_typedef ( Str typedef_def );
|
||||
GEN_API CodeUnion parse_union ( Str union_def );
|
||||
GEN_API CodeUsing parse_using ( Str using_def );
|
||||
GEN_API CodeVar parse_variable ( Str var_def );
|
||||
|
||||
#pragma endregion Parsing
|
||||
|
||||
#pragma region Untyped text
|
||||
|
||||
ssize token_fmt_va( char* buf, usize buf_size, s32 num_tokens, va_list va );
|
||||
GEN_API ssize token_fmt_va( char* buf, usize buf_size, s32 num_tokens, va_list va );
|
||||
//! Do not use directly. Use the token_fmt macro instead.
|
||||
Str token_fmt_impl( ssize, ... );
|
||||
GEN_API Str token_fmt_impl( ssize, ... );
|
||||
|
||||
Code untyped_str ( Str content);
|
||||
Code untyped_fmt ( char const* fmt, ... );
|
||||
Code untyped_token_fmt( s32 num_tokens, char const* fmt, ... );
|
||||
GEN_API Code untyped_str( Str content);
|
||||
GEN_API Code untyped_fmt ( char const* fmt, ... );
|
||||
GEN_API Code untyped_token_fmt( s32 num_tokens, char const* fmt, ... );
|
||||
|
||||
#pragma endregion Untyped text
|
||||
|
||||
|
@ -17,7 +17,6 @@ StrBuilder tok_to_strbuilder(Token tok)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
bool lex__eat( TokArray* self, TokType type );
|
||||
|
||||
Token* lex_current(TokArray* self, bool skip_formatting )
|
||||
|
@ -5,6 +5,24 @@
|
||||
|
||||
#pragma region Macros
|
||||
|
||||
#if GEN_COMPILER_MSVC
|
||||
#ifdef GEN_DYN_LINK
|
||||
#ifdef GEN_EXPORTS
|
||||
#define GEN_API __declspec(dllexport)
|
||||
#else
|
||||
#define GEN_API __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define GEN_API // Empty for static builds
|
||||
#endif
|
||||
#else
|
||||
#ifdef GEN_DYN_LINK
|
||||
#define GEN_API __attribute__((visibility("default")))
|
||||
#else
|
||||
#define GEN_API // Empty for static builds
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef global
|
||||
#define global static // Global variables
|
||||
#endif
|
||||
@ -69,8 +87,13 @@
|
||||
#endif
|
||||
|
||||
#ifndef do_once
|
||||
#define do_once() for ( local_persist b32 once = true; once; once = false )
|
||||
#define do_once_defer( statement ) for ( local_persist b32 once = true; once; once = false, (statement) )
|
||||
#define do_once() \
|
||||
static int __do_once_counter_##__LINE__ = 0; \
|
||||
for(; __do_once_counter_##__LINE__ != 1; __do_once_counter_##__LINE__ = 1 ) \
|
||||
|
||||
#define do_once_defer( expression ) \
|
||||
static int __do_once_counter_##__LINE__ = 0; \
|
||||
for(; __do_once_counter_##__LINE__ != 1; __do_once_counter_##__LINE__ = 1, (expression)) \
|
||||
|
||||
#define do_once_start \
|
||||
do \
|
||||
|
@ -1,2 +1 @@
|
||||
API_Export, GEN_API_Export_Code
|
||||
API_Import, GEN_API_Import_Code
|
||||
GEN_API, GEN_API
|
||||
|
|
Reference in New Issue
Block a user