mirror of
https://github.com/Ed94/gencpp.git
synced 2025-06-15 03:01:47 -07:00
WIP: Restructuring project
This commit is contained in:
685
base/helpers/base_codegen.hpp
Normal file
685
base/helpers/base_codegen.hpp
Normal file
@ -0,0 +1,685 @@
|
||||
#pragma once
|
||||
|
||||
#include "gen.hpp"
|
||||
|
||||
using namespace gen;
|
||||
|
||||
#include "dependencies/parsing.hpp"
|
||||
#include "misc.hpp"
|
||||
|
||||
CodeBody gen_ecode( char const* path, bool use_c_definition = false )
|
||||
{
|
||||
CSV_Columns2 csv_enum = parse_csv_two_columns(GlobalAllocator, path );
|
||||
|
||||
String enum_entries = string_make_reserve( GlobalAllocator, kilobytes(1) );
|
||||
String to_str_entries = string_make_reserve( GlobalAllocator, kilobytes(1) );
|
||||
String to_keyword_str_entries = string_make_reserve( GlobalAllocator, kilobytes(1) );
|
||||
|
||||
for ( ssize idx = 0; idx < array_num(csv_enum.Col_1); ++ idx ) {
|
||||
char const* code = csv_enum.Col_1[idx].string;
|
||||
char const* keyword = csv_enum.Col_2[idx].string;
|
||||
// TODO(Ed): to_str_entries and the others in here didn't have proper sizing of the StrC slice.
|
||||
string_append_fmt( & enum_entries, "CT_%s,\n", code );
|
||||
string_append_fmt( & to_str_entries, "{ sizeof(\"%s\"), \"%s\" },\n", code, code );
|
||||
string_append_fmt( & to_keyword_str_entries, "{ sizeof(\"%s\") - 1, \"%s\" },\n", keyword, keyword );
|
||||
}
|
||||
|
||||
CodeEnum enum_code;
|
||||
if (use_c_definition) {
|
||||
enum_code = parse_enum(token_fmt_impl((3 + 1) / 2, "entries", string_to_strc(enum_entries),
|
||||
"enum CodeType enum_underlying(u32) { <entries> CT_NumTypes, CT_UnderlyingType = GEN_U32_MAX };"
|
||||
));
|
||||
}
|
||||
else {
|
||||
enum_code = parse_enum(token_fmt_impl((3 + 1) / 2, "entries", string_to_strc(enum_entries),
|
||||
"enum CodeType : u32 { <entries> CT_NumTypes, CT_UnderlyingType = GEN_U32_MAX };"
|
||||
));
|
||||
}
|
||||
|
||||
#pragma push_macro("local_persist")
|
||||
#undef local_persist
|
||||
StrC lookup_size = string_to_strc(string_fmt_buf(GlobalAllocator, "%d", array_num(csv_enum.Col_1) ));
|
||||
CodeBody to_str_fns = parse_global_body( token_fmt(
|
||||
"entries", string_to_strc(to_str_entries)
|
||||
, "keywords", string_to_strc(to_keyword_str_entries)
|
||||
, "num", lookup_size
|
||||
, stringize(
|
||||
inline
|
||||
StrC codetype_to_str( CodeType type )
|
||||
{
|
||||
local_persist
|
||||
StrC lookup[<num>] = {
|
||||
<entries>
|
||||
};
|
||||
return lookup[ type ];
|
||||
}
|
||||
|
||||
inline
|
||||
StrC codetype_to_keyword_str( CodeType type )
|
||||
{
|
||||
local_persist
|
||||
StrC lookup[ <num> ] = {
|
||||
<keywords>
|
||||
};
|
||||
return lookup[ type ];
|
||||
}
|
||||
)));
|
||||
#pragma pop_macro("local_persist")
|
||||
|
||||
CodeBody result = def_body(CT_Global_Body);
|
||||
body_append(result, enum_code);
|
||||
|
||||
if (use_c_definition) {
|
||||
CodeTypedef code_t = parse_typedef(code(typedef enum CodeType CodeType; ));
|
||||
body_append(result, code_t);
|
||||
}
|
||||
|
||||
body_append(result, to_str_fns);
|
||||
|
||||
if (! use_c_definition) {
|
||||
#pragma push_macro("forceinline")
|
||||
#undef forceinline
|
||||
CodeBody alias_mappings = parse_global_body(code(
|
||||
forceinline StrC to_str (CodeType type) { return codetype_to_str(type); }
|
||||
forceinline StrC to_keyword_str(CodeType type) { return codetype_to_keyword_str(type); }
|
||||
));
|
||||
#pragma pop_macro("forceinline")
|
||||
body_append(result, alias_mappings);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeBody gen_eoperator( char const* path, bool use_c_definition = false )
|
||||
{
|
||||
CSV_Columns2 csv_enum = parse_csv_two_columns(GlobalAllocator, path);
|
||||
|
||||
String enum_entries = string_make_reserve( GlobalAllocator, kilobytes(1) );
|
||||
String to_str_entries = string_make_reserve( GlobalAllocator, kilobytes(1) );
|
||||
|
||||
for (usize idx = 0; idx < array_num(csv_enum.Col_1); idx++) {
|
||||
char const* enum_str = csv_enum.Col_1[idx].string;
|
||||
char const* entry_to_str = csv_enum.Col_2[idx].string;
|
||||
|
||||
string_append_fmt( & enum_entries, "Op_%s,\n", enum_str );
|
||||
string_append_fmt( & to_str_entries, "{ sizeof(\"%s\"), \"%s\" },\n", entry_to_str, entry_to_str);
|
||||
}
|
||||
|
||||
CodeEnum enum_code;
|
||||
if (use_c_definition)
|
||||
{
|
||||
#pragma push_macro("enum_underlying")
|
||||
#undef enum_underlying
|
||||
enum_code = parse_enum(token_fmt("entries", string_to_strc(enum_entries), stringize(
|
||||
enum Operator enum_underlying(u32)
|
||||
{
|
||||
<entries>
|
||||
Op_NumOps,
|
||||
Op_UnderlyingType = GEN_U32_MAX
|
||||
};
|
||||
)));
|
||||
#pragma pop_macro("enum_underlying")
|
||||
}
|
||||
else
|
||||
{
|
||||
enum_code = parse_enum(token_fmt("entries", string_to_strc(enum_entries), stringize(
|
||||
enum Operator : u32
|
||||
{
|
||||
<entries>
|
||||
Op_NumOps,
|
||||
Op_UnderlyingType = GEN_U32_MAX
|
||||
};
|
||||
)));
|
||||
}
|
||||
|
||||
#pragma push_macro("local_persist")
|
||||
#undef local_persist
|
||||
StrC lookup_size = string_to_strc(string_fmt_buf(GlobalAllocator, "%d", array_num(csv_enum.Col_1) ));
|
||||
CodeFn to_str = parse_function(token_fmt(
|
||||
"entries", string_to_strc(to_str_entries)
|
||||
, "num", lookup_size
|
||||
, stringize(
|
||||
inline
|
||||
StrC operator_to_str( Operator op )
|
||||
{
|
||||
local_persist
|
||||
StrC lookup[<num>] = {
|
||||
<entries>
|
||||
};
|
||||
|
||||
return lookup[ op ];
|
||||
}
|
||||
)));
|
||||
#pragma pop_macro("local_persist")
|
||||
|
||||
CodeBody result = def_body(CT_Global_Body);
|
||||
body_append(result, enum_code);
|
||||
if ( use_c_definition ) {
|
||||
CodeTypedef operator_t = parse_typedef(code( typedef enum Operator Operator; ));
|
||||
body_append(result, operator_t);
|
||||
}
|
||||
|
||||
body_append(result, to_str);
|
||||
|
||||
if (! use_c_definition)
|
||||
{
|
||||
#pragma push_macro("forceinline")
|
||||
#undef forceinline
|
||||
CodeBody alias_mappings = parse_global_body(code(
|
||||
forceinline StrC to_str(Operator op) { return operator_to_str(op); }
|
||||
));
|
||||
#pragma pop_macro("forceinline")
|
||||
body_append(result, alias_mappings);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeBody gen_especifier( char const* path, bool use_c_definition = false )
|
||||
{
|
||||
CSV_Columns2 csv_enum = parse_csv_two_columns(GlobalAllocator, path);
|
||||
|
||||
String enum_entries = string_make_reserve( GlobalAllocator, kilobytes(1) );
|
||||
String to_str_entries = string_make_reserve( GlobalAllocator, kilobytes(1) );
|
||||
|
||||
for (usize idx = 0; idx < array_num(csv_enum.Col_1); idx++)
|
||||
{
|
||||
char const* enum_str = enum_strs[idx].string;
|
||||
char const* entry_to_str = str_strs [idx].string;
|
||||
|
||||
string_append_fmt( & enum_entries, "Spec_%s,\n", enum_str );
|
||||
string_append_fmt( & to_str_entries, "{ sizeof(\"%s\"), \"%s\" },\n", entry_to_str, entry_to_str);
|
||||
}
|
||||
|
||||
CodeEnum enum_code;
|
||||
if (use_c_definition)
|
||||
{
|
||||
#pragma push_macro("enum_underlying")
|
||||
#undef enum_underlying
|
||||
enum_code = parse_enum(token_fmt("entries", string_to_strc(enum_entries), stringize(
|
||||
enum Specifier enum_underlying(u32)
|
||||
{
|
||||
<entries>
|
||||
Spec_NumSpecifiers,
|
||||
Spec_UnderlyingType = GEN_U32_MAX
|
||||
};
|
||||
)));
|
||||
#pragma pop_macro("enum_underlying")
|
||||
}
|
||||
else
|
||||
{
|
||||
enum_code = parse_enum(token_fmt("entries", string_to_strc(enum_entries), stringize(
|
||||
enum Specifier : u32
|
||||
{
|
||||
<entries>
|
||||
Spec_NumSpecifiers,
|
||||
Spec_UnderlyingType = GEN_U32_MAX
|
||||
};
|
||||
)));
|
||||
}
|
||||
|
||||
CodeFn is_trailing = parse_function(token_fmt("specifier", string_to_strc(to_str_entries), stringize(
|
||||
inline
|
||||
bool spec_is_trailing( Specifier specifier )
|
||||
{
|
||||
return specifier > Spec_Virtual;
|
||||
}
|
||||
)));
|
||||
|
||||
#pragma push_macro("local_persist")
|
||||
#pragma push_macro("do_once_start")
|
||||
#pragma push_macro("do_once_end")
|
||||
#pragma push_macro("forceinline")
|
||||
#pragma push_macro("neverinline")
|
||||
#undef local_persist
|
||||
#undef do_once_start
|
||||
#undef do_once_end
|
||||
#undef forceinline
|
||||
#undef neverinline
|
||||
StrC lookup_size = string_to_strc(string_fmt_buf(GlobalAllocator, "%d", array_num(csv_enum.Col_1) ));
|
||||
CodeFn to_str = parse_function(token_fmt(
|
||||
"entries", string_to_strc(to_str_entries)
|
||||
, "num", lookup_size
|
||||
, stringize(
|
||||
inline
|
||||
StrC spec_to_str( Specifier type )
|
||||
{
|
||||
local_persist
|
||||
StrC lookup[<num>] = {
|
||||
<entries>
|
||||
};
|
||||
|
||||
return lookup[ type ];
|
||||
}
|
||||
)));
|
||||
|
||||
CodeFn to_type = parse_function( token_fmt( "entries", string_to_strc(to_str_entries), stringize(
|
||||
inline
|
||||
Specifier strc_to_specifier( StrC str )
|
||||
{
|
||||
local_persist
|
||||
u32 keymap[ Spec_NumSpecifiers ];
|
||||
do_once_start
|
||||
for ( u32 index = 0; index < Spec_NumSpecifiers; index++ )
|
||||
{
|
||||
StrC enum_str = spec_to_str( (Specifier)index );
|
||||
|
||||
// We subtract 1 to remove the null terminator
|
||||
// This is because the tokens lexed are not null terminated.
|
||||
keymap[index] = crc32( enum_str.Ptr, enum_str.Len - 1);
|
||||
}
|
||||
do_once_end
|
||||
|
||||
u32 hash = crc32( str.Ptr, str.Len );
|
||||
|
||||
for ( u32 index = 0; index < Spec_NumSpecifiers; index++ )
|
||||
{
|
||||
if ( keymap[index] == hash )
|
||||
return (Specifier)index;
|
||||
}
|
||||
|
||||
return Spec_Invalid;
|
||||
}
|
||||
)));
|
||||
#pragma pop_macro("local_persist")
|
||||
#pragma pop_macro("do_once_start")
|
||||
#pragma pop_macro("do_once_end")
|
||||
#pragma pop_macro("forceinline")
|
||||
#pragma pop_macro("neverinline")
|
||||
|
||||
CodeBody result = def_body(CT_Global_Body);
|
||||
body_append(result, enum_code);
|
||||
if (use_c_definition)
|
||||
{
|
||||
CodeTypedef specifier_t = parse_typedef( code(typedef u32 Specifier; ));
|
||||
body_append(result, specifier_t);
|
||||
}
|
||||
|
||||
body_append(result, to_str);
|
||||
body_append(result, is_trailing);
|
||||
body_append(result, to_type);
|
||||
|
||||
if (! use_c_definition)
|
||||
{
|
||||
#pragma push_macro("forceinline")
|
||||
#undef forceinline
|
||||
CodeBody alias_mappings = parse_global_body(code(
|
||||
forceinline StrC to_str (Specifier spec) { return spec_to_str(spec); }
|
||||
forceinline Specifier to_type( StrC str ) { return strc_to_specifier(str); }
|
||||
forceinline bool is_trailing( Specifier specifier ) { return spec_is_trailing(specifier); }
|
||||
));
|
||||
#pragma pop_macro("forceinline")
|
||||
body_append(result, alias_mappings);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeBody gen_etoktype( char const* etok_path, char const* attr_path, bool use_c_definition = false )
|
||||
{
|
||||
char scratch_mem[kilobytes(16)];
|
||||
Arena scratch = arena_init_from_memory( scratch_mem, sizeof(scratch_mem) );
|
||||
|
||||
AllocatorInfo scratch_info = arena_allocator_info(& scratch);
|
||||
|
||||
FileContents enum_content = file_read_contents( scratch_info, file_zero_terminate, etok_path );
|
||||
|
||||
CSV_Object csv_enum_nodes;
|
||||
csv_parse( &csv_enum_nodes, rcast(char*, enum_content.data), GlobalAllocator, false );
|
||||
|
||||
FileContents attrib_content = file_read_contents( scratch_info, file_zero_terminate, attr_path );
|
||||
|
||||
CSV_Object csv_attr_nodes;
|
||||
csv_parse( &csv_attr_nodes, rcast(char*, attrib_content.data), GlobalAllocator, false );
|
||||
|
||||
Array<ADT_Node> enum_strs = csv_enum_nodes.nodes[0].nodes;
|
||||
Array<ADT_Node> enum_str_strs = csv_enum_nodes.nodes[1].nodes;
|
||||
Array<ADT_Node> attribute_strs = csv_attr_nodes.nodes[0].nodes;
|
||||
Array<ADT_Node> attribute_str_strs = csv_attr_nodes.nodes[1].nodes;
|
||||
|
||||
String enum_entries = string_make_reserve( GlobalAllocator, kilobytes(2) );
|
||||
String to_str_entries = string_make_reserve( GlobalAllocator, kilobytes(4) );
|
||||
String attribute_entries = string_make_reserve( GlobalAllocator, kilobytes(2) );
|
||||
String to_str_attributes = string_make_reserve( GlobalAllocator, kilobytes(4) );
|
||||
String attribute_define_entries = string_make_reserve( GlobalAllocator, kilobytes(4) );
|
||||
|
||||
for (usize idx = 0; idx < array_num(enum_strs); idx++)
|
||||
{
|
||||
char const* enum_str = enum_strs[idx].string;
|
||||
char const* entry_to_str = enum_str_strs [idx].string;
|
||||
|
||||
string_append_fmt( & enum_entries, "Tok_%s,\n", enum_str );
|
||||
string_append_fmt( & to_str_entries, "{ sizeof(\"%s\"), \"%s\" },\n", entry_to_str, entry_to_str);
|
||||
}
|
||||
|
||||
for ( usize idx = 0; idx < array_num(attribute_strs); idx++ )
|
||||
{
|
||||
char const* attribute_str = attribute_strs[idx].string;
|
||||
char const* entry_to_str = attribute_str_strs [idx].string;
|
||||
|
||||
string_append_fmt( & attribute_entries, "Tok_Attribute_%s,\n", attribute_str );
|
||||
string_append_fmt( & to_str_attributes, "{ sizeof(\"%s\"), \"%s\" },\n", entry_to_str, entry_to_str);
|
||||
string_append_fmt( & attribute_define_entries, "Entry( Tok_Attribute_%s, \"%s\" )", attribute_str, entry_to_str );
|
||||
|
||||
if ( idx < array_num(attribute_strs) - 1 )
|
||||
string_append_strc( & attribute_define_entries, txt(" \\\n"));
|
||||
else
|
||||
string_append_strc( & attribute_define_entries, txt("\n"));
|
||||
}
|
||||
|
||||
#pragma push_macro("GEN_DEFINE_ATTRIBUTE_TOKENS")
|
||||
#undef GEN_DEFINE_ATTRIBUTE_TOKENS
|
||||
CodeDefine attribute_entires_def = def_define( name(GEN_DEFINE_ATTRIBUTE_TOKENS), string_to_strc(attribute_define_entries) );
|
||||
#pragma pop_macro("GEN_DEFINE_ATTRIBUTE_TOKENS")
|
||||
|
||||
// We cannot parse this enum, it has Attribute names as enums
|
||||
CodeEnum enum_code;
|
||||
if (use_c_definition)
|
||||
{
|
||||
enum_code = parse_enum(token_fmt("entries", string_to_strc(enum_entries), "attribute_toks", string_to_strc(attribute_entries), stringize(
|
||||
enum TokType
|
||||
{
|
||||
<entries>
|
||||
<attribute_toks>
|
||||
Tok_NumTokens,
|
||||
Tok_UnderlyingType = GEN_U32_MAX
|
||||
};
|
||||
)));
|
||||
}
|
||||
else
|
||||
{
|
||||
enum_code = parse_enum(token_fmt("entries", string_to_strc(enum_entries), "attribute_toks", string_to_strc(attribute_entries), stringize(
|
||||
enum TokType : u32
|
||||
{
|
||||
<entries>
|
||||
<attribute_toks>
|
||||
Tok_NumTokens
|
||||
};
|
||||
)));
|
||||
}
|
||||
|
||||
#pragma push_macro("local_persist")
|
||||
#pragma push_macro("do_once_start")
|
||||
#pragma push_macro("do_once_end")
|
||||
#undef local_persist
|
||||
#undef do_once_start
|
||||
#undef do_once_end
|
||||
CodeFn to_str = parse_function(token_fmt("entries", string_to_strc(to_str_entries), "attribute_toks", string_to_strc(to_str_attributes), stringize(
|
||||
inline
|
||||
StrC toktype_to_str( TokType type )
|
||||
{
|
||||
local_persist
|
||||
StrC lookup[] = {
|
||||
<entries>
|
||||
<attribute_toks>
|
||||
};
|
||||
|
||||
return lookup[ type ];
|
||||
}
|
||||
)));
|
||||
|
||||
CodeFn to_type = parse_function( token_fmt( "entries", string_to_strc(to_str_entries), stringize(
|
||||
inline
|
||||
TokType strc_to_toktype( StrC str )
|
||||
{
|
||||
local_persist
|
||||
u32 keymap[ Tok_NumTokens ];
|
||||
do_once_start
|
||||
for ( u32 index = 0; index < Tok_NumTokens; index++ )
|
||||
{
|
||||
StrC enum_str = toktype_to_str( (TokType)index );
|
||||
|
||||
// We subtract 1 to remove the null terminator
|
||||
// This is because the tokens lexed are not null terminated.
|
||||
keymap[index] = crc32( enum_str.Ptr, enum_str.Len - 1);
|
||||
}
|
||||
do_once_end
|
||||
|
||||
u32 hash = crc32( str.Ptr, str.Len );
|
||||
|
||||
for ( u32 index = 0; index < Tok_NumTokens; index++ )
|
||||
{
|
||||
if ( keymap[index] == hash )
|
||||
return (TokType)index;
|
||||
}
|
||||
|
||||
return Tok_Invalid;
|
||||
}
|
||||
)));
|
||||
#pragma pop_macro("local_persist")
|
||||
#pragma pop_macro("do_once_start")
|
||||
#pragma pop_macro("do_once_end")
|
||||
|
||||
CodeBody result = def_body(CT_Global_Body);
|
||||
body_append(result, untyped_str(txt("GEN_NS_PARSER_BEGIN\n\n")));
|
||||
body_append(result, attribute_entires_def);
|
||||
body_append(result, enum_code);
|
||||
if (use_c_definition)
|
||||
{
|
||||
CodeTypedef td_toktype = parse_typedef( code( typedef enum TokType TokType; ));
|
||||
body_append(result, td_toktype);
|
||||
}
|
||||
body_append(result, to_str);
|
||||
body_append(result, to_type);
|
||||
body_append(result, untyped_str(txt("\nGEN_NS_PARSER_END\n\n")));
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeBody gen_ast_inlines()
|
||||
{
|
||||
#pragma push_macro("GEN_NS")
|
||||
#pragma push_macro("rcast")
|
||||
#pragma push_macro("log_failure")
|
||||
#pragma push_macro("CodeInvalid")
|
||||
#undef GEN_NS
|
||||
#undef rcast
|
||||
#undef log_failure
|
||||
#undef CodeInvalid
|
||||
char const* code_impl_tmpl = stringize(
|
||||
\n
|
||||
inline
|
||||
<typename>& <typename>::operator =( Code other )
|
||||
{
|
||||
if ( other.ast != nullptr && other->Parent != nullptr )
|
||||
{
|
||||
ast = rcast( decltype(ast), code_duplicate(other).ast);
|
||||
ast->Parent = { nullptr };
|
||||
}
|
||||
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
return * this;
|
||||
}
|
||||
inline
|
||||
<typename>::operator bool()
|
||||
{
|
||||
return ast != nullptr;
|
||||
}
|
||||
);
|
||||
|
||||
char const* codetype_impl_tmpl = stringize(
|
||||
inline
|
||||
Code<typename>::operator Code()
|
||||
{
|
||||
return *rcast( Code*, this );
|
||||
}
|
||||
inline
|
||||
AST_<typename>* Code<typename>::operator->()
|
||||
{
|
||||
if ( ast == nullptr )
|
||||
{
|
||||
log_failure( "Attempt to dereference a nullptr!" );
|
||||
return nullptr;
|
||||
}
|
||||
return ast;
|
||||
}
|
||||
\n
|
||||
);
|
||||
#pragma pop_macro("GEN_NS")
|
||||
#pragma pop_macro("CodeInvalid")
|
||||
|
||||
CodeBody impl_code = parse_global_body( token_fmt( "typename", StrC name(Code), code_impl_tmpl ));
|
||||
CodeBody impl_code_body = parse_global_body( token_fmt( "typename", StrC name(CodeBody), code_impl_tmpl ));
|
||||
CodeBody impl_code_attr = parse_global_body( token_fmt( "typename", StrC name(CodeAttributes), code_impl_tmpl ));
|
||||
CodeBody impl_code_cmt = parse_global_body( token_fmt( "typename", StrC name(CodeComment), code_impl_tmpl ));
|
||||
CodeBody impl_code_constr = parse_global_body( token_fmt( "typename", StrC name(CodeConstructor), code_impl_tmpl ));
|
||||
CodeBody impl_code_class = parse_global_body( token_fmt( "typename", StrC name(CodeClass), code_impl_tmpl ));
|
||||
CodeBody impl_code_define = parse_global_body( token_fmt( "typename", StrC name(CodeDefine), code_impl_tmpl ));
|
||||
CodeBody impl_code_destruct = parse_global_body( token_fmt( "typename", StrC name(CodeDestructor), code_impl_tmpl ));
|
||||
CodeBody impl_code_enum = parse_global_body( token_fmt( "typename", StrC name(CodeEnum), code_impl_tmpl ));
|
||||
CodeBody impl_code_exec = parse_global_body( token_fmt( "typename", StrC name(CodeExec), code_impl_tmpl ));
|
||||
CodeBody impl_code_extern = parse_global_body( token_fmt( "typename", StrC name(CodeExtern), code_impl_tmpl ));
|
||||
CodeBody impl_code_include = parse_global_body( token_fmt( "typename", StrC name(CodeInclude), code_impl_tmpl ));
|
||||
CodeBody impl_code_friend = parse_global_body( token_fmt( "typename", StrC name(CodeFriend), code_impl_tmpl ));
|
||||
CodeBody impl_code_fn = parse_global_body( token_fmt( "typename", StrC name(CodeFn), code_impl_tmpl ));
|
||||
CodeBody impl_code_module = parse_global_body( token_fmt( "typename", StrC name(CodeModule), code_impl_tmpl ));
|
||||
CodeBody impl_code_ns = parse_global_body( token_fmt( "typename", StrC name(CodeNS), code_impl_tmpl ));
|
||||
CodeBody impl_code_op = parse_global_body( token_fmt( "typename", StrC name(CodeOperator), code_impl_tmpl ));
|
||||
CodeBody impl_code_opcast = parse_global_body( token_fmt( "typename", StrC name(CodeOpCast), code_impl_tmpl ));
|
||||
CodeBody impl_code_param = parse_global_body( token_fmt( "typename", StrC name(CodeParam), code_impl_tmpl ));
|
||||
CodeBody impl_code_pragma = parse_global_body( token_fmt( "typename", StrC name(CodePragma), code_impl_tmpl ));
|
||||
CodeBody impl_code_precond = parse_global_body( token_fmt( "typename", StrC name(CodePreprocessCond), code_impl_tmpl ));
|
||||
CodeBody impl_code_specs = parse_global_body( token_fmt( "typename", StrC name(CodeSpecifiers), code_impl_tmpl ));
|
||||
CodeBody impl_code_struct = parse_global_body( token_fmt( "typename", StrC name(CodeStruct), code_impl_tmpl ));
|
||||
CodeBody impl_code_tmpl = parse_global_body( token_fmt( "typename", StrC name(CodeTemplate), code_impl_tmpl ));
|
||||
CodeBody impl_code_type = parse_global_body( token_fmt( "typename", StrC name(CodeTypename), code_impl_tmpl ));
|
||||
CodeBody impl_code_typedef = parse_global_body( token_fmt( "typename", StrC name(CodeTypedef), code_impl_tmpl ));
|
||||
CodeBody impl_code_union = parse_global_body( token_fmt( "typename", StrC name(CodeUnion), code_impl_tmpl ));
|
||||
CodeBody impl_code_using = parse_global_body( token_fmt( "typename", StrC name(CodeUsing), code_impl_tmpl ));
|
||||
CodeBody impl_code_var = parse_global_body( token_fmt( "typename", StrC name(CodeVar), code_impl_tmpl ));
|
||||
|
||||
body_append(impl_code_attr, parse_global_body( token_fmt( "typename", StrC name(Attributes), codetype_impl_tmpl )));
|
||||
body_append(impl_code_cmt, parse_global_body( token_fmt( "typename", StrC name(Comment), codetype_impl_tmpl )));
|
||||
body_append(impl_code_constr, parse_global_body( token_fmt( "typename", StrC name(Constructor), codetype_impl_tmpl )));
|
||||
body_append(impl_code_define, parse_global_body( token_fmt( "typename", StrC name(Define), codetype_impl_tmpl )));
|
||||
body_append(impl_code_destruct, parse_global_body( token_fmt( "typename", StrC name(Destructor), codetype_impl_tmpl )));
|
||||
body_append(impl_code_enum, parse_global_body( token_fmt( "typename", StrC name(Enum), codetype_impl_tmpl )));
|
||||
body_append(impl_code_exec, parse_global_body( token_fmt( "typename", StrC name(Exec), codetype_impl_tmpl )));
|
||||
body_append(impl_code_extern, parse_global_body( token_fmt( "typename", StrC name(Extern), codetype_impl_tmpl )));
|
||||
body_append(impl_code_include, parse_global_body( token_fmt( "typename", StrC name(Include), codetype_impl_tmpl )));
|
||||
body_append(impl_code_friend, parse_global_body( token_fmt( "typename", StrC name(Friend), codetype_impl_tmpl )));
|
||||
body_append(impl_code_fn, parse_global_body( token_fmt( "typename", StrC name(Fn), codetype_impl_tmpl )));
|
||||
body_append(impl_code_module, parse_global_body( token_fmt( "typename", StrC name(Module), codetype_impl_tmpl )));
|
||||
body_append(impl_code_ns, parse_global_body( token_fmt( "typename", StrC name(NS), codetype_impl_tmpl )));
|
||||
body_append(impl_code_op, parse_global_body( token_fmt( "typename", StrC name(Operator), codetype_impl_tmpl )));
|
||||
body_append(impl_code_opcast, parse_global_body( token_fmt( "typename", StrC name(OpCast), codetype_impl_tmpl )));
|
||||
body_append(impl_code_pragma, parse_global_body( token_fmt( "typename", StrC name(Pragma), codetype_impl_tmpl )));
|
||||
body_append(impl_code_precond, parse_global_body( token_fmt( "typename", StrC name(PreprocessCond), codetype_impl_tmpl )));
|
||||
body_append(impl_code_tmpl, parse_global_body( token_fmt( "typename", StrC name(Template), codetype_impl_tmpl )));
|
||||
body_append(impl_code_type, parse_global_body( token_fmt( "typename", StrC name(Typename), codetype_impl_tmpl )));
|
||||
body_append(impl_code_typedef, parse_global_body( token_fmt( "typename", StrC name(Typedef), codetype_impl_tmpl )));
|
||||
body_append(impl_code_union, parse_global_body( token_fmt( "typename", StrC name(Union), codetype_impl_tmpl )));
|
||||
body_append(impl_code_using, parse_global_body( token_fmt( "typename", StrC name(Using), codetype_impl_tmpl )));
|
||||
body_append(impl_code_var, parse_global_body( token_fmt( "typename", StrC name(Var), codetype_impl_tmpl )));
|
||||
|
||||
#pragma push_macro("forceinline")
|
||||
#undef forceinline
|
||||
char const* cast_tmpl = stringize(
|
||||
forceinline Code::operator Code<typename>() const
|
||||
{
|
||||
return { (AST_<typename>*) ast };
|
||||
}
|
||||
);
|
||||
#pragma pop_macro("forceinline")
|
||||
|
||||
CodeBody impl_cast_body = parse_global_body( token_fmt( "typename", StrC name(Body), cast_tmpl ));
|
||||
CodeBody impl_cast_attribute = parse_global_body( token_fmt( "typename", StrC name(Attributes), cast_tmpl ));
|
||||
CodeBody impl_cast_cmt = parse_global_body( token_fmt( "typename", StrC name(Comment), cast_tmpl ));
|
||||
CodeBody impl_cast_constr = parse_global_body( token_fmt( "typename", StrC name(Constructor), cast_tmpl ));
|
||||
CodeBody impl_cast_class = parse_global_body( token_fmt( "typename", StrC name(Class), cast_tmpl ));
|
||||
CodeBody impl_cast_define = parse_global_body( token_fmt( "typename", StrC name(Define), cast_tmpl ));
|
||||
CodeBody impl_cast_destruct = parse_global_body( token_fmt( "typename", StrC name(Destructor), cast_tmpl ));
|
||||
CodeBody impl_cast_enum = parse_global_body( token_fmt( "typename", StrC name(Enum), cast_tmpl ));
|
||||
CodeBody impl_cast_exec = parse_global_body( token_fmt( "typename", StrC name(Exec), cast_tmpl ));
|
||||
CodeBody impl_cast_extern = parse_global_body( token_fmt( "typename", StrC name(Extern), cast_tmpl ));
|
||||
CodeBody impl_cast_friend = parse_global_body( token_fmt( "typename", StrC name(Friend), cast_tmpl ));
|
||||
CodeBody impl_cast_fn = parse_global_body( token_fmt( "typename", StrC name(Fn), cast_tmpl ));
|
||||
CodeBody impl_cast_include = parse_global_body( token_fmt( "typename", StrC name(Include), cast_tmpl ));
|
||||
CodeBody impl_cast_module = parse_global_body( token_fmt( "typename", StrC name(Module), cast_tmpl ));
|
||||
CodeBody impl_cast_ns = parse_global_body( token_fmt( "typename", StrC name(NS), cast_tmpl ));
|
||||
CodeBody impl_cast_op = parse_global_body( token_fmt( "typename", StrC name(Operator), cast_tmpl ));
|
||||
CodeBody impl_cast_opcast = parse_global_body( token_fmt( "typename", StrC name(OpCast), cast_tmpl ));
|
||||
CodeBody impl_cast_param = parse_global_body( token_fmt( "typename", StrC name(Param), cast_tmpl ));
|
||||
CodeBody impl_cast_pragma = parse_global_body( token_fmt( "typename", StrC name(Pragma), cast_tmpl ));
|
||||
CodeBody impl_cast_precond = parse_global_body( token_fmt( "typename", StrC name(PreprocessCond), cast_tmpl ));
|
||||
CodeBody impl_cast_specs = parse_global_body( token_fmt( "typename", StrC name(Specifiers), cast_tmpl ));
|
||||
CodeBody impl_cast_struct = parse_global_body( token_fmt( "typename", StrC name(Struct), cast_tmpl ));
|
||||
CodeBody impl_cast_tmpl = parse_global_body( token_fmt( "typename", StrC name(Template), cast_tmpl ));
|
||||
CodeBody impl_cast_type = parse_global_body( token_fmt( "typename", StrC name(Typename), cast_tmpl ));
|
||||
CodeBody impl_cast_typedef = parse_global_body( token_fmt( "typename", StrC name(Typedef), cast_tmpl ));
|
||||
CodeBody impl_cast_union = parse_global_body( token_fmt( "typename", StrC name(Union), cast_tmpl ));
|
||||
CodeBody impl_cast_using = parse_global_body( token_fmt( "typename", StrC name(Using), cast_tmpl ));
|
||||
CodeBody impl_cast_var = parse_global_body( token_fmt( "typename", StrC name(Var), cast_tmpl ));
|
||||
|
||||
CodeBody result = def_global_body( args(
|
||||
def_pragma( txt("region generated code inline implementation")),
|
||||
fmt_newline,
|
||||
impl_code,
|
||||
impl_code_body,
|
||||
impl_code_attr,
|
||||
impl_code_cmt,
|
||||
impl_code_constr,
|
||||
impl_code_class,
|
||||
impl_code_define,
|
||||
impl_code_destruct,
|
||||
impl_code_enum,
|
||||
impl_code_exec,
|
||||
impl_code_extern,
|
||||
impl_code_friend,
|
||||
impl_code_fn,
|
||||
impl_code_include,
|
||||
impl_code_module,
|
||||
impl_code_ns,
|
||||
impl_code_op,
|
||||
impl_code_opcast,
|
||||
impl_code_param,
|
||||
impl_code_pragma,
|
||||
impl_code_precond,
|
||||
impl_code_specs,
|
||||
impl_code_struct,
|
||||
impl_code_tmpl,
|
||||
impl_code_type,
|
||||
impl_code_typedef,
|
||||
impl_code_union,
|
||||
impl_code_using,
|
||||
impl_code_var,
|
||||
fmt_newline,
|
||||
def_pragma( txt("endregion generated code inline implementation")),
|
||||
fmt_newline,
|
||||
def_pragma( txt("region generated AST/Code cast implementation")),
|
||||
untyped_str(txt("GEN_OPTIMIZE_MAPPINGS_BEGIN\n")),
|
||||
fmt_newline,
|
||||
impl_cast_body,
|
||||
impl_cast_attribute,
|
||||
impl_cast_cmt,
|
||||
impl_cast_constr,
|
||||
impl_cast_class,
|
||||
impl_cast_define,
|
||||
impl_cast_destruct,
|
||||
impl_cast_enum,
|
||||
impl_cast_exec,
|
||||
impl_cast_extern,
|
||||
impl_cast_friend,
|
||||
impl_cast_fn,
|
||||
impl_cast_include,
|
||||
impl_cast_module,
|
||||
impl_cast_ns,
|
||||
impl_cast_op,
|
||||
impl_cast_opcast,
|
||||
impl_cast_param,
|
||||
impl_cast_pragma,
|
||||
impl_cast_precond,
|
||||
impl_cast_specs,
|
||||
impl_cast_struct,
|
||||
impl_cast_tmpl,
|
||||
impl_cast_type,
|
||||
impl_cast_typedef,
|
||||
impl_cast_union,
|
||||
impl_cast_using,
|
||||
impl_cast_var,
|
||||
fmt_newline,
|
||||
untyped_str(txt("GEN_OPITMIZE_MAPPINGS_END\n")),
|
||||
def_pragma( txt("endregion generated AST/Code cast implementation")),
|
||||
fmt_newline
|
||||
));
|
||||
|
||||
return result;
|
||||
#pragma pop_macro("rcast")
|
||||
#pragma pop_macro("log_failure")
|
||||
}
|
86
base/helpers/misc.hpp
Normal file
86
base/helpers/misc.hpp
Normal file
@ -0,0 +1,86 @@
|
||||
|
||||
#ifdef GEN_INTELLISENSE_DIRECTIVES
|
||||
#pragma once
|
||||
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
|
||||
#define GEN_ENFORCE_STRONG_CODE_TYPES
|
||||
#define GEN_EXPOSE_BACKEND
|
||||
#include "../gen.cpp"
|
||||
|
||||
#include "helpers/push_ignores.inline.hpp"
|
||||
#include "helpers/helper.hpp"
|
||||
|
||||
GEN_NS_BEGIN
|
||||
#include "helpers/push_container_defines.inline.hpp"
|
||||
#include "dependencies/parsing.cpp"
|
||||
#include "helpers/pop_container_defines.inline.hpp"
|
||||
GEN_NS_END
|
||||
|
||||
#include "auxillary/builder.hpp"
|
||||
#include "auxillary/builder.cpp"
|
||||
#include "auxillary/scanner.hpp"
|
||||
#endif
|
||||
|
||||
// Will format a file with the given style at the provided path.
|
||||
// Assumes clang-format is defined in an user-exposed or system enviornment PATH.
|
||||
void clang_format_file( char const* path, char const* style_path )
|
||||
{
|
||||
GEN_ASSERT_NOT_NULL(path);
|
||||
String resolved_path = string_make_strc(GlobalAllocator, to_strc_from_c_str(path));
|
||||
|
||||
String style_arg;
|
||||
if (style_path) {
|
||||
stle_arg = string_make_strc(GlobalAllocator, txt("-style=file:"));
|
||||
string_append_fmt( & style_arg, "%s ", style_path );
|
||||
}
|
||||
|
||||
StrC clang_format = txt("clang-format ")
|
||||
StrC cf_format_inplace = txt("-i ")
|
||||
StrC cf_verbose = txt("-verbose ")
|
||||
|
||||
String command = string_make_strc( GlobalAllocator, clang_format );
|
||||
string_append_strc( & command, cf_format_inplace );
|
||||
string_append_strc( & command, cf_verbose );
|
||||
string_append_string( & command, style_arg );
|
||||
string_append_string( & command, resolved_path );
|
||||
|
||||
log_fmt("\tRunning clang-format:\n");
|
||||
system( command );
|
||||
log_fmt("\tclang-format finished formatting.\n");
|
||||
}
|
||||
// Will refactor a file with the given script at the provided path.
|
||||
// Assumes refactor is defined in an user-exposed or system enviornment PATH.
|
||||
// (See: ./gencpp/scripts/build.ci.ps1 for how)
|
||||
void refactor_file( char const* path, char const* refactor_script )
|
||||
{
|
||||
GEN_ASSERT_NOT_NULL(path, refactor_script);
|
||||
|
||||
#define refactor
|
||||
|
||||
String command = string_make_strc(GlobalAllocator, txt("refactor")));
|
||||
|
||||
log_fmt("\tBeginning refactor:\n");
|
||||
system(command);
|
||||
log_fmt("\nRefactoring complete.\n");
|
||||
|
||||
#undef refactor
|
||||
}
|
||||
|
||||
Code code_refactor_and_format( Code code, char const* scratch_path, char const* refactor_script, char_const* clang_format_sytle_path )
|
||||
{
|
||||
GEN_ASSERT_NOT_NULL(code);
|
||||
GEN_ASSERT_NOT_NULL(scratch_path);
|
||||
Builder scratch_file = builder_open("gen/scratch.hpp");
|
||||
builder_print( & scratch_file, code);
|
||||
builder_write(& scratch_file);
|
||||
|
||||
if (refactor_script) {
|
||||
refactor_file(scratch_path, refactor_script)
|
||||
}
|
||||
if ( clang_format_sytle_path ) {
|
||||
clang_format_file(scratch_path, clang_format_sytle_path);
|
||||
}
|
||||
|
||||
Code result = scan_file( scratch_path );
|
||||
remove("gen/scratch.hpp");
|
||||
return result;
|
||||
}
|
39
base/helpers/pop_container_defines.inline.hpp
Normal file
39
base/helpers/pop_container_defines.inline.hpp
Normal file
@ -0,0 +1,39 @@
|
||||
|
||||
#undef array_init
|
||||
#undef array_init_reserve
|
||||
#undef array_append_array
|
||||
#undef array_append
|
||||
#undef array_append_items
|
||||
#undef array_append_at
|
||||
#undef array_append_items_at
|
||||
#undef array_back
|
||||
#undef array_clear
|
||||
#undef array_fill
|
||||
#undef array_free
|
||||
#undef arary_grow
|
||||
#undef array_num
|
||||
#undef arary_pop
|
||||
#undef arary_remove_at
|
||||
#undef arary_reserve
|
||||
#undef arary_resize
|
||||
#undef arary_set_capacity
|
||||
#undef arary_get_header
|
||||
|
||||
#undef hashtable_init
|
||||
#undef hashtable_init_reserve
|
||||
#undef hashtable_clear
|
||||
#undef hashtable_destroy
|
||||
#undef hashtable_get
|
||||
#undef hashtable_grow
|
||||
#undef hashtable_rehash
|
||||
#undef hashtable_rehash_fast
|
||||
#undef hashtable_remove
|
||||
#undef hashtable_remove_entry
|
||||
#undef hashtable_set
|
||||
#undef hashtable_slot
|
||||
#undef hashtable_map
|
||||
#undef hashtable_map_mut
|
||||
|
||||
//#undef hashtable_add_entry
|
||||
//#undef hashtable_find
|
||||
//#undef hashtable_full
|
7
base/helpers/pop_ignores.inline.hpp
Normal file
7
base/helpers/pop_ignores.inline.hpp
Normal file
@ -0,0 +1,7 @@
|
||||
#ifdef __clang__
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
39
base/helpers/push_container_defines.inline.hpp
Normal file
39
base/helpers/push_container_defines.inline.hpp
Normal file
@ -0,0 +1,39 @@
|
||||
|
||||
#define array_init(type, allocator) array_init <type> (allocator )
|
||||
#define array_init_reserve(type, allocator, cap) array_init_reserve <type> (allocator, cap)
|
||||
#define array_append_array(array, other) array_append_array < get_array_underlying_type(array) > (& array, other )
|
||||
#define array_append(array, value) array_append < get_array_underlying_type(array) > (& array, value )
|
||||
#define array_append_items(array, items, item_num) array_append_items < get_array_underlying_type(array) > (& array, items, item_num )
|
||||
#define array_append_at(array, item, idx ) array_append_at < get_array_underlying_type(array) > (& array, item, idx )
|
||||
#define array_append_at_items(array, items, item_num, idx) array_append_at_items< get_array_underlying_type(array) > (& items, item_num, idx )
|
||||
#define array_back(array) array_back < get_array_underlying_type(array) > (array )
|
||||
#define array_clear(array) array_clear < get_array_underlying_type(array) > (array )
|
||||
#define array_fill(array, begin, end, value) array_fill < get_array_underlying_type(array) > (array, begin, end, value )
|
||||
#define array_free(array) array_free < get_array_underlying_type(array) > (& array )
|
||||
#define arary_grow(array, min_capacity) arary_grow < get_array_underlying_type(array) > (& array, min_capacity)
|
||||
#define array_num(array) array_num < get_array_underlying_type(array) > (array )
|
||||
#define arary_pop(array) arary_pop < get_array_underlying_type(array) > (array )
|
||||
#define arary_remove_at(array, idx) arary_remove_at < get_array_underlying_type(array) > (idx)
|
||||
#define arary_reserve(array, new_capacity) arary_reserve < get_array_underlying_type(array) > (& array, new_capacity )
|
||||
#define arary_resize(array, num) arary_resize < get_array_underlying_type(array) > (& array, num)
|
||||
#define arary_set_capacity(new_capacity) arary_set_capacity < get_array_underlying_type(array) > (& array, new_capacity )
|
||||
#define arary_get_header(array) arary_get_header < get_array_underlying_type(array) > (array )
|
||||
|
||||
#define hashtable_init(type, allocator) hashtable_init <type >(allocator)
|
||||
#define hashtable_init_reserve(type, allocator, num) hashtable_init_reserve<type >(allocator, num)
|
||||
#define hashtable_clear(table) hashtable_clear < get_hashtable_underlying_type(table) >(table)
|
||||
#define hashtable_destroy(table) hashtable_destroy < get_hashtable_underlying_type(table) >(& table)
|
||||
#define hashtable_get(table, key) hashtable_get < get_hashtable_underlying_type(table) >(table, key)
|
||||
#define hashtable_grow(table) hashtable_grow < get_hashtable_underlying_type(table) >(& table)
|
||||
#define hashtable_rehash(table, new_num) hashtable_rehash < get_hashtable_underlying_type(table) >(& table, new_num)
|
||||
#define hashtable_rehash_fast(table) hashtable_rehash_fast < get_hashtable_underlying_type(table) >(table)
|
||||
#define hashtable_remove(table, key) hashtable_remove < get_hashtable_underlying_type(table) >(table, key)
|
||||
#define hashtable_remove_entry(table, idx) hashtable_remove_entry< get_hashtable_underlying_type(table) >(table, idx)
|
||||
#define hashtable_set(table, key, value) hashtable_set < get_hashtable_underlying_type(table) >(& table, key, value)
|
||||
#define hashtable_slot(table, key) hashtable_slot < get_hashtable_underlying_type(table) >(table, key)
|
||||
#define hashtable_map(table, map_proc) hashtable_map < get_hashtable_underlying_type(table) >(table, map_proc)
|
||||
#define hashtable_map_mut(table, map_proc) hashtable_map_mut < get_hashtable_underlying_type(table) >(table, map_proc)
|
||||
|
||||
//#define hashtable_add_entry(table, key) hashtable_add_entry < get_hashtable_underlying_type(table) >(& table, key)
|
||||
//#define hashtable_find(table, key) hashtable_find < get_hashtable_underlying_type(table) >(table, key)
|
||||
//#define hashtable_full(table) hashtable_full < get_hashtable_underlying_type(table) >(table)
|
21
base/helpers/push_ignores.inline.hpp
Normal file
21
base/helpers/push_ignores.inline.hpp
Normal file
@ -0,0 +1,21 @@
|
||||
#ifdef __clang__
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunused-const-variable"
|
||||
# pragma clang diagnostic ignored "-Wunused-but-set-variable"
|
||||
# pragma clang diagnostic ignored "-Wswitch"
|
||||
# pragma clang diagnostic ignored "-Wunused-variable"
|
||||
# pragma clang diagnostic ignored "-Wunknown-pragmas"
|
||||
# pragma clang diagnostic ignored "-Wvarargs"
|
||||
# pragma clang diagnostic ignored "-Wunused-function"
|
||||
# pragma clang diagnostic ignored "-Wbraced-scalar-init"
|
||||
# pragma clang diagnostic ignored "-W#pragma-messages"
|
||||
# pragma clang diagnostic ignored "-Wstatic-in-inline"
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunknown-pragmas"
|
||||
# pragma GCC diagnostic ignored "-Wcomment"
|
||||
# pragma GCC diagnostic ignored "-Wswitch"
|
||||
# pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
78
base/helpers/undef.macros.h
Normal file
78
base/helpers/undef.macros.h
Normal file
@ -0,0 +1,78 @@
|
||||
#if GEN_TIME
|
||||
// This undefines the macros used by the gen library but are not necessary for the user.
|
||||
|
||||
#undef GEN_ARCH_64_BIT
|
||||
#undef GEN_ARCH_32_BIT
|
||||
|
||||
#undef GEN_SYSTEM_ANDROID
|
||||
#undef GEN_SYSTEM_CYGWIN
|
||||
#undef GEN_SYSTEM_EMSCRIPTEN
|
||||
#undef GEN_SYSTEM_FREEBSD
|
||||
#undef GEN_SYSTEM_IOS
|
||||
#undef GEN_SYSTEM_LINUX
|
||||
#undef GEN_SYSTEM_MACOS
|
||||
#undef GEN_SYSTEM_OPENBSD
|
||||
#undef GEN_SYSTEM_OSX
|
||||
#undef GEN_SYSTEM_UNIX
|
||||
#undef GEN_SYSTEM_WINDOWS
|
||||
|
||||
#undef GEN_COMPILER_CLANG
|
||||
#undef GEN_COMPILER_GCC
|
||||
#undef GEN_COMPILER_MINGW
|
||||
#undef GEN_COMPILER_MSVC
|
||||
|
||||
#undef forceinline
|
||||
#undef neverinline
|
||||
|
||||
#undef global
|
||||
#undef internal
|
||||
#undef local_persist
|
||||
|
||||
#undef kilobytes
|
||||
#undef megabytes
|
||||
#undef gigabytes
|
||||
#undef terabytes
|
||||
|
||||
#undef zero_item
|
||||
#undef zero_array
|
||||
|
||||
#undef alloc_item
|
||||
#undef alloc_array
|
||||
|
||||
#undef malloc
|
||||
#undef mfree
|
||||
|
||||
#undef count_of
|
||||
#undef is_between
|
||||
#undef min
|
||||
#undef size_of
|
||||
#undef swap
|
||||
|
||||
#undef bit
|
||||
#undef bitfield_is_equal
|
||||
#undef ccast
|
||||
#undef scast
|
||||
#undef rcast
|
||||
#undef pcast
|
||||
#undef do_once
|
||||
#undef do_once_start
|
||||
#undef do_once_end
|
||||
#undef num_args
|
||||
#undef num_args_impl
|
||||
#undef stringize
|
||||
#undef stringize
|
||||
#undef stringize_va
|
||||
#undef txt
|
||||
|
||||
#undef GEN_TIME
|
||||
#undef gen_main
|
||||
#undef __
|
||||
#undef name
|
||||
#undef code
|
||||
#undef args
|
||||
#undef code_str
|
||||
#undef code_fmt
|
||||
#undef token_fmt
|
||||
|
||||
// GEN_TIME
|
||||
#endif
|
Reference in New Issue
Block a user