mirror of
				https://github.com/Ed94/gencpp.git
				synced 2025-10-31 06:50:53 -07:00 
			
		
		
		
	Updated c_library generation to support latest changes with context struct (also prepped for static/dynamic linkage)
This commit is contained in:
		| @@ -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]; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user