mirror of
https://github.com/Ed94/gencpp.git
synced 2024-11-10 02:54:53 -08:00
Formatting fixes
This commit is contained in:
parent
4a87a42db0
commit
387787b88d
@ -222,7 +222,7 @@ String AST::to_string()
|
|||||||
# define ProcessModuleFlags() \
|
# define ProcessModuleFlags() \
|
||||||
if ( bitfield_is_equal( u32, ModuleFlags, ModuleFlag::Export )) \
|
if ( bitfield_is_equal( u32, ModuleFlags, ModuleFlag::Export )) \
|
||||||
result.append( "export " ); \
|
result.append( "export " ); \
|
||||||
\
|
\
|
||||||
if ( bitfield_is_equal( u32, ModuleFlags, ModuleFlag::Import )) \
|
if ( bitfield_is_equal( u32, ModuleFlags, ModuleFlag::Import )) \
|
||||||
result.append( "import " ); \
|
result.append( "import " ); \
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# define AST_BODY_CLASS_UNALLOWED_TYPES \
|
# define AST_BODY_CLASS_UNALLOWED_TYPES \
|
||||||
case PlatformAttributes: \
|
case PlatformAttributes: \
|
||||||
case Class_Body: \
|
case Class_Body: \
|
||||||
case Enum_Body: \
|
case Enum_Body: \
|
||||||
case Extern_Linkage: \
|
case Extern_Linkage: \
|
||||||
@ -19,7 +19,7 @@
|
|||||||
case Access_Public: \
|
case Access_Public: \
|
||||||
case Access_Protected: \
|
case Access_Protected: \
|
||||||
case Access_Private: \
|
case Access_Private: \
|
||||||
case PlatformAttributes: \
|
case PlatformAttributes: \
|
||||||
case Class_Body: \
|
case Class_Body: \
|
||||||
case Enum_Body: \
|
case Enum_Body: \
|
||||||
case Extern_Linkage: \
|
case Extern_Linkage: \
|
||||||
@ -42,7 +42,7 @@
|
|||||||
case Access_Public: \
|
case Access_Public: \
|
||||||
case Access_Protected: \
|
case Access_Protected: \
|
||||||
case Access_Private: \
|
case Access_Private: \
|
||||||
case PlatformAttributes: \
|
case PlatformAttributes: \
|
||||||
case Class_Body: \
|
case Class_Body: \
|
||||||
case Enum_Body: \
|
case Enum_Body: \
|
||||||
case Execution: \
|
case Execution: \
|
||||||
|
@ -10,12 +10,12 @@ global StringTable StringCache;
|
|||||||
|
|
||||||
global Arena LexArena;
|
global Arena LexArena;
|
||||||
|
|
||||||
global AllocatorInfo Allocator_DataArrays = heap();
|
global AllocatorInfo Allocator_DataArrays = heap();
|
||||||
global AllocatorInfo Allocator_CodePool = heap();
|
global AllocatorInfo Allocator_CodePool = heap();
|
||||||
global AllocatorInfo Allocator_Lexer = heap();
|
global AllocatorInfo Allocator_Lexer = heap();
|
||||||
global AllocatorInfo Allocator_StringArena = heap();
|
global AllocatorInfo Allocator_StringArena = heap();
|
||||||
global AllocatorInfo Allocator_StringTable = heap();
|
global AllocatorInfo Allocator_StringTable = heap();
|
||||||
global AllocatorInfo Allocator_TypeTable = heap();
|
global AllocatorInfo Allocator_TypeTable = heap();
|
||||||
#pragma endregion StaticData
|
#pragma endregion StaticData
|
||||||
|
|
||||||
#pragma region Constants
|
#pragma region Constants
|
||||||
|
@ -27,22 +27,22 @@ void AST::append( AST* other )
|
|||||||
char const* AST::debug_str()
|
char const* AST::debug_str()
|
||||||
{
|
{
|
||||||
char const* fmt = stringize(
|
char const* fmt = stringize(
|
||||||
\nCode Debug:
|
\nCode Debug:
|
||||||
\nType : %s
|
\nType : %s
|
||||||
\nParent : %s
|
\nParent : %s
|
||||||
\nName : %s
|
\nName : %s
|
||||||
\nComment : %s
|
\nComment : %s
|
||||||
);
|
);
|
||||||
|
|
||||||
// These should be used immediately in a log.
|
// These should be used immediately in a log.
|
||||||
// Thus if its desired to keep the debug str
|
// Thus if its desired to keep the debug str
|
||||||
// for multiple calls to bprintf,
|
// for multiple calls to bprintf,
|
||||||
// allocate this to proper string.
|
// allocate this to proper string.
|
||||||
return str_fmt_buf( fmt
|
return str_fmt_buf( fmt
|
||||||
, type_str()
|
, type_str()
|
||||||
, Parent ? Parent->Name : ""
|
, Parent ? Parent->Name : ""
|
||||||
, Name ? Name : ""
|
, Name ? Name : ""
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Code& AST::entry( u32 idx )
|
Code& AST::entry( u32 idx )
|
||||||
@ -351,7 +351,7 @@ CodeBody def_body( CodeT type )
|
|||||||
StrC token_fmt_impl( sw num, ... )
|
StrC token_fmt_impl( sw num, ... )
|
||||||
{
|
{
|
||||||
local_persist thread_local
|
local_persist thread_local
|
||||||
char buf[GEN_PRINTF_MAXLEN] = { 0 };
|
char buf[GEN_PRINTF_MAXLEN] = { 0 };
|
||||||
mem_set( buf, 0, GEN_PRINTF_MAXLEN );
|
mem_set( buf, 0, GEN_PRINTF_MAXLEN );
|
||||||
|
|
||||||
va_list va;
|
va_list va;
|
||||||
|
@ -62,7 +62,7 @@ void* Global_Allocator_Proc( void* allocator_data, AllocType type, sw size, sw a
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal
|
internal
|
||||||
void define_constants()
|
void define_constants()
|
||||||
{
|
{
|
||||||
Code::Global = make_code();
|
Code::Global = make_code();
|
||||||
Code::Global->Name = get_cached_string( txt_StrC("Global Code") );
|
Code::Global->Name = get_cached_string( txt_StrC("Global Code") );
|
||||||
@ -71,9 +71,9 @@ internal
|
|||||||
Code::Invalid = make_code();
|
Code::Invalid = make_code();
|
||||||
Code::Invalid.set_global();
|
Code::Invalid.set_global();
|
||||||
|
|
||||||
# define def_constant_code_type( Type_ ) \
|
# define def_constant_code_type( Type_ ) \
|
||||||
t_##Type_ = def_type( name(Type_) ); \
|
t_##Type_ = def_type( name(Type_) ); \
|
||||||
t_##Type_.set_global();
|
t_##Type_.set_global();
|
||||||
|
|
||||||
def_constant_code_type( auto );
|
def_constant_code_type( auto );
|
||||||
def_constant_code_type( void );
|
def_constant_code_type( void );
|
||||||
@ -162,9 +162,9 @@ internal
|
|||||||
# undef internal
|
# undef internal
|
||||||
# undef local_persist
|
# undef local_persist
|
||||||
|
|
||||||
# define def_constant_spec( Type_, ... ) \
|
# define def_constant_spec( Type_, ... ) \
|
||||||
spec_##Type_ = def_specifiers( num_args(__VA_ARGS__), __VA_ARGS__); \
|
spec_##Type_ = def_specifiers( num_args(__VA_ARGS__), __VA_ARGS__); \
|
||||||
spec_##Type_.set_global();
|
spec_##Type_.set_global();
|
||||||
|
|
||||||
def_constant_spec( const, ESpecifier::Const );
|
def_constant_spec( const, ESpecifier::Const );
|
||||||
def_constant_spec( consteval, ESpecifier::Consteval );
|
def_constant_spec( consteval, ESpecifier::Consteval );
|
||||||
@ -187,7 +187,7 @@ internal
|
|||||||
def_constant_spec( virtual, ESpecifier::Virtual );
|
def_constant_spec( virtual, ESpecifier::Virtual );
|
||||||
def_constant_spec( volatile, ESpecifier::Volatile)
|
def_constant_spec( volatile, ESpecifier::Volatile)
|
||||||
|
|
||||||
spec_local_persist = def_specifiers( 1, ESpecifier::Local_Persist );
|
spec_local_persist = def_specifiers( 1, ESpecifier::Local_Persist );
|
||||||
spec_local_persist.set_global();
|
spec_local_persist.set_global();
|
||||||
|
|
||||||
# pragma pop_macro( "global" )
|
# pragma pop_macro( "global" )
|
||||||
@ -361,7 +361,6 @@ StringCached get_cached_string( StrC str )
|
|||||||
}
|
}
|
||||||
|
|
||||||
String result = String::make( get_string_allocator( str.Len ), str );
|
String result = String::make( get_string_allocator( str.Len ), str );
|
||||||
|
|
||||||
StringCache.set( key, result );
|
StringCache.set( key, result );
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -24,12 +24,12 @@ Code make_code();
|
|||||||
// Set these before calling gen's init() procedure.
|
// Set these before calling gen's init() procedure.
|
||||||
// Data
|
// Data
|
||||||
|
|
||||||
void set_allocator_data_arrays ( AllocatorInfo data_array_allocator );
|
void set_allocator_data_arrays ( AllocatorInfo data_array_allocator );
|
||||||
void set_allocator_code_pool ( AllocatorInfo pool_allocator );
|
void set_allocator_code_pool ( AllocatorInfo pool_allocator );
|
||||||
void set_allocator_lexer ( AllocatorInfo lex_allocator );
|
void set_allocator_lexer ( AllocatorInfo lex_allocator );
|
||||||
void set_allocator_string_arena ( AllocatorInfo string_allocator );
|
void set_allocator_string_arena( AllocatorInfo string_allocator );
|
||||||
void set_allocator_string_table ( AllocatorInfo string_allocator );
|
void set_allocator_string_table( AllocatorInfo string_allocator );
|
||||||
void set_allocator_type_table ( AllocatorInfo type_reg_allocator );
|
void set_allocator_type_table ( AllocatorInfo type_reg_allocator );
|
||||||
|
|
||||||
#pragma region Upfront
|
#pragma region Upfront
|
||||||
CodeAttributes def_attributes( StrC content );
|
CodeAttributes def_attributes( StrC content );
|
||||||
@ -152,4 +152,3 @@ Code untyped_str ( StrC content);
|
|||||||
Code untyped_fmt ( char const* fmt, ... );
|
Code untyped_fmt ( char const* fmt, ... );
|
||||||
Code untyped_token_fmt( char const* fmt, s32 num_tokens, ... );
|
Code untyped_token_fmt( char const* fmt, s32 num_tokens, ... );
|
||||||
#pragma endregion Untyped text
|
#pragma endregion Untyped text
|
||||||
|
|
||||||
|
@ -741,7 +741,7 @@ namespace Parser
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma region Helper Macros
|
#pragma region Helper Macros
|
||||||
# define check_parse_args( func, def ) \
|
# define check_parse_args( func, def ) \
|
||||||
if ( def.Len <= 0 ) \
|
if ( def.Len <= 0 ) \
|
||||||
{ \
|
{ \
|
||||||
log_failure( "gen::" stringize(func) ": length must greater than 0" ); \
|
log_failure( "gen::" stringize(func) ": length must greater than 0" ); \
|
||||||
|
@ -6,7 +6,7 @@ enum class OpValidateResult : u32
|
|||||||
};
|
};
|
||||||
|
|
||||||
inline
|
inline
|
||||||
OpValidateResult operator__validate( OperatorT op, CodeParam params_code, CodeType ret_type, CodeSpecifiers specifier )
|
OpValidateResult operator__validate( OperatorT op, CodeParam params_code, CodeType ret_type, CodeSpecifiers specifier )
|
||||||
{
|
{
|
||||||
using namespace EOperator;
|
using namespace EOperator;
|
||||||
|
|
||||||
@ -20,26 +20,26 @@ inline
|
|||||||
# define check_params() \
|
# define check_params() \
|
||||||
if ( ! params_code ) \
|
if ( ! params_code ) \
|
||||||
{ \
|
{ \
|
||||||
log_failure("gen::def_operator: params is null and operator%s requires it", to_str(op)); \
|
log_failure("gen::def_operator: params is null and operator%s requires it", to_str(op)); \
|
||||||
return OpValidateResult::Fail; \
|
return OpValidateResult::Fail; \
|
||||||
} \
|
} \
|
||||||
if ( params_code->Type != ECode::Parameters ) \
|
if ( params_code->Type != ECode::Parameters ) \
|
||||||
{ \
|
{ \
|
||||||
log_failure("gen::def_operator: params is not of Parameters type - %s", params_code.debug_str()); \
|
log_failure("gen::def_operator: params is not of Parameters type - %s", params_code.debug_str()); \
|
||||||
return OpValidateResult::Fail; \
|
return OpValidateResult::Fail; \
|
||||||
}
|
}
|
||||||
|
|
||||||
# define check_param_eq_ret() \
|
# define check_param_eq_ret() \
|
||||||
if ( ! is_member_symbol && params_code->ValueType != ret_type ) \
|
if ( ! is_member_symbol && params_code->ValueType != ret_type ) \
|
||||||
{ \
|
{ \
|
||||||
log_failure("gen_def_operator: operator%s requires first parameter to equal return type\n" \
|
log_failure("gen_def_operator: operator%s requires first parameter to equal return type\n" \
|
||||||
"param types: %s\n" \
|
"param types: %s\n" \
|
||||||
"return type: %s", \
|
"return type: %s", \
|
||||||
to_str(op), \
|
to_str(op), \
|
||||||
params_code.debug_str(), \
|
params_code.debug_str(), \
|
||||||
ret_type.debug_str() \
|
ret_type.debug_str() \
|
||||||
); \
|
); \
|
||||||
return OpValidateResult::Fail; \
|
return OpValidateResult::Fail; \
|
||||||
}
|
}
|
||||||
#pragma endregion Helper Macros
|
#pragma endregion Helper Macros
|
||||||
|
|
||||||
@ -65,10 +65,10 @@ inline
|
|||||||
if ( params_code->NumEntries > 1 )
|
if ( params_code->NumEntries > 1 )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: "
|
log_failure("gen::def_operator: "
|
||||||
"operator%s does not support non-member definition (more than one parameter provided) - %s",
|
"operator%s does not support non-member definition (more than one parameter provided) - %s",
|
||||||
to_str(op),
|
to_str(op),
|
||||||
params_code.debug_str()
|
params_code.debug_str()
|
||||||
);
|
);
|
||||||
return OpValidateResult::Fail;
|
return OpValidateResult::Fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,10 +96,10 @@ inline
|
|||||||
if (params_code->NumEntries > 2 )
|
if (params_code->NumEntries > 2 )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: operator%s may not be defined with more than two parametes - param count; %d\n%s"
|
log_failure("gen::def_operator: operator%s may not be defined with more than two parametes - param count; %d\n%s"
|
||||||
, to_str(op)
|
, to_str(op)
|
||||||
, params_code->NumEntries
|
, params_code->NumEntries
|
||||||
, params_code.debug_str()
|
, params_code.debug_str()
|
||||||
);
|
);
|
||||||
return OpValidateResult::Fail;
|
return OpValidateResult::Fail;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -112,9 +112,9 @@ inline
|
|||||||
if ( params_code->Type != ECode::Parameters )
|
if ( params_code->Type != ECode::Parameters )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: operator%s params code provided is not of Parameters type - %s"
|
log_failure("gen::def_operator: operator%s params code provided is not of Parameters type - %s"
|
||||||
, to_str(op)
|
, to_str(op)
|
||||||
, params_code.debug_str()
|
, params_code.debug_str()
|
||||||
);
|
);
|
||||||
return OpValidateResult::Fail;
|
return OpValidateResult::Fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,18 +134,18 @@ inline
|
|||||||
if ( ! params_code.get(1).is_equal( t_int ) )
|
if ( ! params_code.get(1).is_equal( t_int ) )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: "
|
log_failure("gen::def_operator: "
|
||||||
"operator%s requires second parameter of non-member definition to be int for post-decrement",
|
"operator%s requires second parameter of non-member definition to be int for post-decrement",
|
||||||
to_str(op)
|
to_str(op)
|
||||||
);
|
);
|
||||||
return OpValidateResult::Fail;
|
return OpValidateResult::Fail;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure("gen::def_operator: operator%s recieved unexpected number of parameters recived %d instead of 0-2"
|
log_failure("gen::def_operator: operator%s recieved unexpected number of parameters recived %d instead of 0-2"
|
||||||
, to_str(op)
|
, to_str(op)
|
||||||
, params_code->NumEntries
|
, params_code->NumEntries
|
||||||
);
|
);
|
||||||
return OpValidateResult::Fail;
|
return OpValidateResult::Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,21 +168,21 @@ inline
|
|||||||
if ( params_code->ValueType.is_equal( ret_type ) )
|
if ( params_code->ValueType.is_equal( ret_type ) )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: "
|
log_failure("gen::def_operator: "
|
||||||
"operator%s is non-member symbol yet first paramter does not equal return type\n"
|
"operator%s is non-member symbol yet first paramter does not equal return type\n"
|
||||||
"param type: %s\n"
|
"param type: %s\n"
|
||||||
"return type: %s\n"
|
"return type: %s\n"
|
||||||
, params_code.debug_str()
|
, params_code.debug_str()
|
||||||
, ret_type.debug_str()
|
, ret_type.debug_str()
|
||||||
);
|
);
|
||||||
return OpValidateResult::Fail;
|
return OpValidateResult::Fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( params_code->NumEntries > 1 )
|
if ( params_code->NumEntries > 1 )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: operator%s may not have more than one parameter - param count: %d"
|
log_failure("gen::def_operator: operator%s may not have more than one parameter - param count: %d"
|
||||||
, to_str(op)
|
, to_str(op)
|
||||||
, params_code->NumEntries
|
, params_code->NumEntries
|
||||||
);
|
);
|
||||||
return OpValidateResult::Fail;
|
return OpValidateResult::Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -210,21 +210,21 @@ inline
|
|||||||
if ( ! params_code->ValueType.is_equal( ret_type ) )
|
if ( ! params_code->ValueType.is_equal( ret_type ) )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: "
|
log_failure("gen::def_operator: "
|
||||||
"operator%s is non-member symbol yet first paramter does not equal return type\n"
|
"operator%s is non-member symbol yet first paramter does not equal return type\n"
|
||||||
"param type: %s\n"
|
"param type: %s\n"
|
||||||
"return type: %s\n"
|
"return type: %s\n"
|
||||||
, params_code.debug_str()
|
, params_code.debug_str()
|
||||||
, ret_type.debug_str()
|
, ret_type.debug_str()
|
||||||
);
|
);
|
||||||
return OpValidateResult::Fail;
|
return OpValidateResult::Fail;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure("gen::def_operator: operator%s recieved unexpected number of paramters recived %d instead of 0-2"
|
log_failure("gen::def_operator: operator%s recieved unexpected number of paramters recived %d instead of 0-2"
|
||||||
, to_str(op)
|
, to_str(op)
|
||||||
, params_code->NumEntries
|
, params_code->NumEntries
|
||||||
);
|
);
|
||||||
return OpValidateResult::Fail;
|
return OpValidateResult::Fail;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -244,9 +244,9 @@ inline
|
|||||||
if ( params_code->NumEntries != 1 )
|
if ( params_code->NumEntries != 1 )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: operator%s recieved unexpected number of paramters recived %d instead of 0-1"
|
log_failure("gen::def_operator: operator%s recieved unexpected number of paramters recived %d instead of 0-1"
|
||||||
, to_str(op)
|
, to_str(op)
|
||||||
, params_code->NumEntries
|
, params_code->NumEntries
|
||||||
);
|
);
|
||||||
return OpValidateResult::Fail;
|
return OpValidateResult::Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,9 +254,9 @@ inline
|
|||||||
if ( ! ret_type.is_equal( t_bool ))
|
if ( ! ret_type.is_equal( t_bool ))
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: operator%s return type must be of type bool - %s"
|
log_failure("gen::def_operator: operator%s return type must be of type bool - %s"
|
||||||
, to_str(op)
|
, to_str(op)
|
||||||
, ret_type.debug_str()
|
, ret_type.debug_str()
|
||||||
);
|
);
|
||||||
return OpValidateResult::Fail;
|
return OpValidateResult::Fail;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -282,9 +282,9 @@ inline
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure("gen::def_operator: operator%s recieved unexpected number of paramters recived %d instead of 1-2"
|
log_failure("gen::def_operator: operator%s recieved unexpected number of paramters recived %d instead of 1-2"
|
||||||
, to_str(op)
|
, to_str(op)
|
||||||
, params_code->NumEntries
|
, params_code->NumEntries
|
||||||
);
|
);
|
||||||
return OpValidateResult::Fail;
|
return OpValidateResult::Fail;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -295,9 +295,9 @@ inline
|
|||||||
if ( params_code && params_code->NumEntries > 1)
|
if ( params_code && params_code->NumEntries > 1)
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: operator%s recieved unexpected number of paramters recived %d instead of 0-1"
|
log_failure("gen::def_operator: operator%s recieved unexpected number of paramters recived %d instead of 0-1"
|
||||||
, to_str(op)
|
, to_str(op)
|
||||||
, params_code->NumEntries
|
, params_code->NumEntries
|
||||||
);
|
);
|
||||||
return OpValidateResult::Fail;
|
return OpValidateResult::Fail;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -627,7 +627,7 @@ CodeFriend def_friend( Code declaration )
|
|||||||
}
|
}
|
||||||
|
|
||||||
CodeFn def_function( StrC name
|
CodeFn def_function( StrC name
|
||||||
, CodeParam params , CodeType ret_type, Code body
|
, CodeParam params , CodeType ret_type, Code body
|
||||||
, CodeSpecifiers specifiers, CodeAttributes attributes
|
, CodeSpecifiers specifiers, CodeAttributes attributes
|
||||||
, ModuleFlag mflags )
|
, ModuleFlag mflags )
|
||||||
{
|
{
|
||||||
@ -765,7 +765,7 @@ CodeNamespace def_namespace( StrC name, Code body, ModuleFlag mflags )
|
|||||||
|
|
||||||
CodeOperator def_operator( OperatorT op
|
CodeOperator def_operator( OperatorT op
|
||||||
, CodeParam params_code, CodeType ret_type, Code body
|
, CodeParam params_code, CodeType ret_type, Code body
|
||||||
, CodeSpecifiers specifiers, CodeAttributes attributes
|
, CodeSpecifiers specifiers, CodeAttributes attributes
|
||||||
, ModuleFlag mflags )
|
, ModuleFlag mflags )
|
||||||
{
|
{
|
||||||
using namespace ECode;
|
using namespace ECode;
|
||||||
@ -1828,4 +1828,3 @@ CodeBody def_union_body( s32 num, CodeUnion* codes )
|
|||||||
# undef name_check
|
# undef name_check
|
||||||
# undef null_check
|
# undef null_check
|
||||||
# undef null_or_invalid_check
|
# undef null_or_invalid_check
|
||||||
|
|
||||||
|
@ -4,12 +4,12 @@ sw token_fmt_va( char* buf, uw buf_size, s32 num_tokens, va_list va )
|
|||||||
sw remaining = buf_size;
|
sw remaining = buf_size;
|
||||||
|
|
||||||
local_persist
|
local_persist
|
||||||
Arena tok_map_arena;
|
Arena tok_map_arena;
|
||||||
|
|
||||||
HashTable<StrC> tok_map;
|
HashTable<StrC> tok_map;
|
||||||
{
|
{
|
||||||
local_persist
|
local_persist
|
||||||
char tok_map_mem[ TokenFmt_TokenMap_MemSize ];
|
char tok_map_mem[ TokenFmt_TokenMap_MemSize ];
|
||||||
|
|
||||||
tok_map_arena = Arena::init_from_memory( tok_map_mem, sizeof(tok_map_mem) );
|
tok_map_arena = Arena::init_from_memory( tok_map_mem, sizeof(tok_map_mem) );
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ sw token_fmt_va( char* buf, uw buf_size, s32 num_tokens, va_list va )
|
|||||||
Code untyped_str( StrC content )
|
Code untyped_str( StrC content )
|
||||||
{
|
{
|
||||||
Code
|
Code
|
||||||
result = make_code();
|
result = make_code();
|
||||||
result->Name = get_cached_string( content );
|
result->Name = get_cached_string( content );
|
||||||
result->Type = ECode::Untyped;
|
result->Type = ECode::Untyped;
|
||||||
result->Content = result->Name;
|
result->Content = result->Name;
|
||||||
@ -112,7 +112,7 @@ Code untyped_str( StrC content )
|
|||||||
Code untyped_fmt( char const* fmt, ...)
|
Code untyped_fmt( char const* fmt, ...)
|
||||||
{
|
{
|
||||||
local_persist thread_local
|
local_persist thread_local
|
||||||
char buf[GEN_PRINTF_MAXLEN] = { 0 };
|
char buf[GEN_PRINTF_MAXLEN] = { 0 };
|
||||||
|
|
||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, fmt);
|
va_start(va, fmt);
|
||||||
@ -120,7 +120,7 @@ Code untyped_fmt( char const* fmt, ...)
|
|||||||
va_end(va);
|
va_end(va);
|
||||||
|
|
||||||
Code
|
Code
|
||||||
result = make_code();
|
result = make_code();
|
||||||
result->Name = get_cached_string( { str_len(fmt, MaxNameLength), fmt } );
|
result->Name = get_cached_string( { str_len(fmt, MaxNameLength), fmt } );
|
||||||
result->Type = ECode::Untyped;
|
result->Type = ECode::Untyped;
|
||||||
result->Content = get_cached_string( { length, buf } );
|
result->Content = get_cached_string( { length, buf } );
|
||||||
@ -131,7 +131,7 @@ Code untyped_fmt( char const* fmt, ...)
|
|||||||
Code untyped_token_fmt( s32 num_tokens, ... )
|
Code untyped_token_fmt( s32 num_tokens, ... )
|
||||||
{
|
{
|
||||||
local_persist thread_local
|
local_persist thread_local
|
||||||
char buf[GEN_PRINTF_MAXLEN] = { 0 };
|
char buf[GEN_PRINTF_MAXLEN] = { 0 };
|
||||||
|
|
||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, num_tokens);
|
va_start(va, num_tokens);
|
||||||
@ -139,7 +139,7 @@ Code untyped_token_fmt( s32 num_tokens, ... )
|
|||||||
va_end(va);
|
va_end(va);
|
||||||
|
|
||||||
Code
|
Code
|
||||||
result = make_code();
|
result = make_code();
|
||||||
result->Name = get_cached_string( { length, buf } );
|
result->Name = get_cached_string( { length, buf } );
|
||||||
result->Type = ECode::Untyped;
|
result->Type = ECode::Untyped;
|
||||||
result->Content = result->Name;
|
result->Content = result->Name;
|
||||||
|
@ -92,7 +92,7 @@
|
|||||||
#define size_of( x ) ( sw )( sizeof( x ) )
|
#define size_of( x ) ( sw )( sizeof( x ) )
|
||||||
|
|
||||||
template< class Type >
|
template< class Type >
|
||||||
void swap( Type a, Type b )
|
void swap( Type& a, Type& b )
|
||||||
{
|
{
|
||||||
Type tmp = a;
|
Type tmp = a;
|
||||||
a = b;
|
a = b;
|
||||||
|
Loading…
Reference in New Issue
Block a user