mirror of
https://github.com/Ed94/gencpp.git
synced 2024-12-22 07:44:45 -08:00
Merge branch 'string_distinctings_refactor'
This commit is contained in:
commit
78bcc21130
@ -18,6 +18,6 @@ If using the library's provided build scripts:
|
|||||||
.\build.ps1 <compiler> <debug or omit> c_library
|
.\build.ps1 <compiler> <debug or omit> c_library
|
||||||
```
|
```
|
||||||
|
|
||||||
All free from tag identifiers will be prefixed with `gen_` or `GEN_` as the namespace. This can either be changed after generation with a `.refactor` script (or your preferred subst method), OR by modifying c_library.refactor.
|
All free from tag identifiers will be prefixed with `gen_` or `GEN_` as the namespace. This can either be changed after generation with a `.refactor` script (or your preferred subst method), OR by modifying [c_library.refactor](./c_library.refactor).
|
||||||
|
|
||||||
**If c_library.refactor is modified you may need to modify c_library.cpp and its [components](./components/). As some of the container generation relies on that prefix.**
|
**If c_library.refactor is modified you may need to modify c_library.cpp and its [components](./components/). As some of the container generation relies on that prefix.**
|
||||||
|
@ -105,48 +105,31 @@ R"(#define <macro_name>(selector_arg, ...) _Generic( (selector_arg), \
|
|||||||
for ( s32 slot = 1; slot <= num_slots; ++ slot )
|
for ( s32 slot = 1; slot <= num_slots; ++ slot )
|
||||||
{
|
{
|
||||||
Str slot_str = StrBuilder::fmt_buf(GlobalAllocator, "%d", slot).to_str();
|
Str slot_str = StrBuilder::fmt_buf(GlobalAllocator, "%d", slot).to_str();
|
||||||
if (slot == num_slots && false)
|
|
||||||
{
|
|
||||||
define_builder.append( token_fmt( "macro_name", macro_name, "slot", slot_str,
|
|
||||||
R"( GEN_IF_MACRO_DEFINED_INCLUDE_THIS_SLOT_LAST( GENERIC_SLOT_<slot>__<macro_name> ) \
|
|
||||||
)"
|
|
||||||
));
|
|
||||||
// if ( one_arg )
|
|
||||||
// define_builder.append(token_fmt( "macro_name", macro_name, stringize(
|
|
||||||
// default: static_assert(false, "<macro_name>: Failed to select correct function signature (Did you pass the type?)")
|
|
||||||
// )));
|
|
||||||
// else
|
|
||||||
// define_builder.append(token_fmt( "macro_name", macro_name, stringize(
|
|
||||||
// default: static_assert(false, "<macro_name>: Failed to select correct function signature")
|
|
||||||
// )));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
define_builder.append( token_fmt( "macro_name", macro_name, "slot", slot_str,
|
define_builder.append( token_fmt( "macro_name", macro_name, "slot", slot_str,
|
||||||
R"( GEN_IF_MACRO_DEFINED_INCLUDE_THIS_SLOT( GENERIC_SLOT_<slot>__<macro_name> ) \
|
R"(GEN_IF_MACRO_DEFINED_INCLUDE_THIS_SLOT( GENERIC_SLOT_<slot>__<macro_name> ) \
|
||||||
)"
|
)"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
define_builder.append( txt("default: gen_generic_selection_fail") );
|
define_builder.append( txt("default: gen_generic_selection_fail\\\n") );
|
||||||
|
|
||||||
if ( ! one_arg )
|
if ( ! one_arg )
|
||||||
{
|
{
|
||||||
if (opts == GenericSel_By_Ref)
|
if (opts == GenericSel_By_Ref)
|
||||||
define_builder.append(txt("\t)\tGEN_RESOLVED_FUNCTION_CALL( & selector_arg, __VA_ARGS__ )"));
|
define_builder.append(txt(")\\\nGEN_RESOLVED_FUNCTION_CALL( & selector_arg, __VA_ARGS__ )"));
|
||||||
else if (opts == GenericSel_Direct_Type)
|
else if (opts == GenericSel_Direct_Type)
|
||||||
define_builder.append(txt("\t)\tGEN_RESOLVED_FUNCTION_CALL( __VA_ARGS__ )"));
|
define_builder.append(txt(")\\\nGEN_RESOLVED_FUNCTION_CALL( __VA_ARGS__ )"));
|
||||||
else
|
else
|
||||||
define_builder.append(txt("\t)\tGEN_RESOLVED_FUNCTION_CALL( selector_arg, __VA_ARGS__ )"));
|
define_builder.append(txt(")\\\nGEN_RESOLVED_FUNCTION_CALL( selector_arg, __VA_ARGS__ )"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (opts == GenericSel_By_Ref)
|
if (opts == GenericSel_By_Ref)
|
||||||
define_builder.append(txt("\t)\tGEN_RESOLVED_FUNCTION_CALL( & selector_arg )"));
|
define_builder.append(txt(")\\\nGEN_RESOLVED_FUNCTION_CALL( & selector_arg )"));
|
||||||
else if (opts == GenericSel_Direct_Type)
|
else if (opts == GenericSel_Direct_Type)
|
||||||
define_builder.append(txt("\t)\tGEN_RESOLVED_FUNCTION_CALL()"));
|
define_builder.append(txt(")\\\nGEN_RESOLVED_FUNCTION_CALL()"));
|
||||||
else
|
else
|
||||||
define_builder.append(txt("\t)\tGEN_RESOLVED_FUNCTION_CALL( selector_arg )"));
|
define_builder.append(txt(")\\\nGEN_RESOLVED_FUNCTION_CALL( selector_arg )"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add gap for next definition
|
// Add gap for next definition
|
||||||
|
@ -15,6 +15,8 @@ StatementMacros: [
|
|||||||
Macros:
|
Macros:
|
||||||
- enum_underlying(type)=type
|
- enum_underlying(type)=type
|
||||||
- gen_enum_underlying(type)=type
|
- gen_enum_underlying(type)=type
|
||||||
|
# WhitespaceSensitiveMacros: [
|
||||||
|
# ]
|
||||||
|
|
||||||
TypenameMacros: [Array, Hashtable]
|
TypenameMacros: [Array, Hashtable]
|
||||||
SkipMacroDefinitionBody: false
|
SkipMacroDefinitionBody: false
|
||||||
|
Loading…
Reference in New Issue
Block a user