WIP(broken): Converting base library to use c-linkage symbols only

This commit is contained in:
2024-12-04 11:01:53 -05:00
parent 6081834687
commit 3a55af9ce4
31 changed files with 1283 additions and 1062 deletions

View File

@ -14,13 +14,13 @@ char const* debug_str(Code self)
String* result = & result_stack;
if ( self->Parent )
append_fmt( result, "\n\tParent : %S %S", type_str(self->Parent), self->Name ? self->Name : "" );
string_append_fmt( result, "\n\tParent : %S %S", type_str(self->Parent), self->Name ? self->Name : "" );
else
append_fmt( result, "\n\tParent : %S", "Null" );
string_append_fmt( result, "\n\tParent : %S", "Null" );
append_fmt( result, "\n\tName : %S", self->Name ? self->Name : "Null" );
append_fmt( result, "\n\tType : %S", type_str(self) );
append_fmt( result, "\n\tModule Flags : %S", to_str( self->ModuleFlags ) );
string_append_fmt( result, "\n\tName : %S", self->Name ? self->Name : "Null" );
string_append_fmt( result, "\n\tType : %S", type_str(self) );
string_append_fmt( result, "\n\tModule Flags : %S", to_str( self->ModuleFlags ) );
switch ( self->Type )
{
@ -30,9 +30,9 @@ char const* debug_str(Code self)
case CT_Access_Protected:
case CT_Access_Public:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
break;
case CT_Untyped:
@ -48,74 +48,74 @@ char const* debug_str(Code self)
case CT_Preprocess_IfDef:
case CT_Preprocess_IfNotDef:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tContent: %S", self->Content );
string_append_fmt( result, "\n\tContent: %S", self->Content );
break;
case CT_Class:
case CT_Struct:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
append_fmt( result, "\n\tParentAccess: %s", self->ParentType ? to_str( self->ParentAccess ) : "No Parent" );
append_fmt( result, "\n\tParentType : %s", self->ParentType ? type_str(self->ParentType) : "Null" );
append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
string_append_fmt( result, "\n\tParentAccess: %s", self->ParentType ? to_str( self->ParentAccess ) : "No Parent" );
string_append_fmt( result, "\n\tParentType : %s", self->ParentType ? type_str(self->ParentType) : "Null" );
string_append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
break;
case CT_Class_Fwd:
case CT_Struct_Fwd:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
append_fmt( result, "\n\tParentAccess: %s", self->ParentType ? to_str( self->ParentAccess ) : "No Parent" );
append_fmt( result, "\n\tParentType : %s", self->ParentType ? type_str(self->ParentType) : "Null" );
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
string_append_fmt( result, "\n\tParentAccess: %s", self->ParentType ? to_str( self->ParentAccess ) : "No Parent" );
string_append_fmt( result, "\n\tParentType : %s", self->ParentType ? type_str(self->ParentType) : "Null" );
break;
case CT_Constructor:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
append_fmt( result, "\n\tInitializerList: %S", self->InitializerList ? to_string(self->InitializerList) : "Null" );
append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
string_append_fmt( result, "\n\tInitializerList: %S", self->InitializerList ? to_string(self->InitializerList) : "Null" );
string_append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
string_append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
break;
case CT_Constructor_Fwd:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
append_fmt( result, "\n\tInitializerList: %S", self->InitializerList ? to_string(self->InitializerList) : "Null" );
append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
string_append_fmt( result, "\n\tInitializerList: %S", self->InitializerList ? to_string(self->InitializerList) : "Null" );
string_append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
break;
case CT_Destructor:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
string_append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
break;
case CT_Destructor_Fwd:
@ -124,208 +124,208 @@ char const* debug_str(Code self)
case CT_Enum:
case CT_Enum_Class:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
append_fmt( result, "\n\tUnderlying Type : %S", self->UnderlyingType ? to_string(self->UnderlyingType) : "Null" );
append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
string_append_fmt( result, "\n\tUnderlying Type : %S", self->UnderlyingType ? to_string(self->UnderlyingType) : "Null" );
string_append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
break;
case CT_Enum_Fwd:
case CT_Enum_Class_Fwd:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
append_fmt( result, "\n\tUnderlying Type : %S", self->UnderlyingType ? to_string(self->UnderlyingType) : "Null" );
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
string_append_fmt( result, "\n\tUnderlying Type : %S", self->UnderlyingType ? to_string(self->UnderlyingType) : "Null" );
break;
case CT_Extern_Linkage:
case CT_Namespace:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tBody: %S", self->Body ? debug_str(self->Body) : "Null" );
string_append_fmt( result, "\n\tBody: %S", self->Body ? debug_str(self->Body) : "Null" );
break;
case CT_Friend:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
append_fmt( result, "\n\tDeclaration: %S", self->Declaration ? to_string(self->Declaration) : "Null" );
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
string_append_fmt( result, "\n\tDeclaration: %S", self->Declaration ? to_string(self->Declaration) : "Null" );
break;
case CT_Function:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
append_fmt( result, "\n\tAttributes: %S", self->Attributes ? to_string(self->Attributes) : "Null" );
append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? to_string(self->ReturnType) : "Null" );
append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
string_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? to_string(self->Attributes) : "Null" );
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
string_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? to_string(self->ReturnType) : "Null" );
string_append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
string_append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
break;
case CT_Function_Fwd:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
append_fmt( result, "\n\tAttributes: %S", self->Attributes ? to_string(self->Attributes) : "Null" );
append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? to_string(self->ReturnType) : "Null" );
append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
string_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? to_string(self->Attributes) : "Null" );
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
string_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? to_string(self->ReturnType) : "Null" );
string_append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
break;
case CT_Module:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
break;
case CT_Operator:
case CT_Operator_Member:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
append_fmt( result, "\n\tAttributes: %S", self->Attributes ? to_string(self->Attributes) : "Null" );
append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? to_string(self->ReturnType) : "Null" );
append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
append_fmt( result, "\n\tOp : %S", to_str( self->Op ) );
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
string_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? to_string(self->Attributes) : "Null" );
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
string_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? to_string(self->ReturnType) : "Null" );
string_append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
string_append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
string_append_fmt( result, "\n\tOp : %S", to_str( self->Op ) );
break;
case CT_Operator_Fwd:
case CT_Operator_Member_Fwd:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
append_fmt( result, "\n\tAttributes: %S", self->Attributes ? to_string(self->Attributes) : "Null" );
append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? to_string(self->ReturnType) : "Null" );
append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
append_fmt( result, "\n\tOp : %S", to_str( self->Op ) );
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
string_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? to_string(self->Attributes) : "Null" );
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
string_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? to_string(self->ReturnType) : "Null" );
string_append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
string_append_fmt( result, "\n\tOp : %S", to_str( self->Op ) );
break;
case CT_Operator_Cast:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
append_fmt( result, "\n\tValueType : %S", self->ValueType ? to_string(self->ValueType) : "Null" );
append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
string_append_fmt( result, "\n\tValueType : %S", self->ValueType ? to_string(self->ValueType) : "Null" );
string_append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
break;
case CT_Operator_Cast_Fwd:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
append_fmt( result, "\n\tValueType : %S", self->ValueType ? to_string(self->ValueType) : "Null" );
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
string_append_fmt( result, "\n\tValueType : %S", self->ValueType ? to_string(self->ValueType) : "Null" );
break;
case CT_Parameters:
append_fmt( result, "\n\tNumEntries: %d", self->NumEntries );
append_fmt( result, "\n\tLast : %S", self->Last->Name );
append_fmt( result, "\n\tNext : %S", self->Next->Name );
append_fmt( result, "\n\tValueType : %S", self->ValueType ? to_string(self->ValueType) : "Null" );
append_fmt( result, "\n\tValue : %S", self->Value ? to_string(self->Value) : "Null" );
string_append_fmt( result, "\n\tNumEntries: %d", self->NumEntries );
string_append_fmt( result, "\n\tLast : %S", self->Last->Name );
string_append_fmt( result, "\n\tNext : %S", self->Next->Name );
string_append_fmt( result, "\n\tValueType : %S", self->ValueType ? to_string(self->ValueType) : "Null" );
string_append_fmt( result, "\n\tValue : %S", self->Value ? to_string(self->Value) : "Null" );
break;
case CT_Specifiers:
{
append_fmt( result, "\n\tNumEntries: %d", self->NumEntries );
GEN_NS append( result, "\n\tArrSpecs: " );
string_append_fmt( result, "\n\tNumEntries: %d", self->NumEntries );
string_append_c_str( result, "\n\tArrSpecs: " );
s32 idx = 0;
s32 left = self->NumEntries;
while ( left-- )
{
StrC spec = to_str( self->ArrSpecs[idx] );
append_fmt( result, "%.*s, ", spec.Len, spec.Ptr );
string_append_fmt( result, "%.*s, ", spec.Len, spec.Ptr );
idx++;
}
append_fmt( result, "\n\tNextSpecs: %S", self->NextSpecs ? debug_str(self->NextSpecs) : "Null" );
string_append_fmt( result, "\n\tNextSpecs: %S", self->NextSpecs ? debug_str(self->NextSpecs) : "Null" );
}
break;
case CT_Template:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
append_fmt( result, "\n\tDeclaration: %S", self->Declaration ? to_string(self->Declaration) : "Null" );
string_append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
string_append_fmt( result, "\n\tDeclaration: %S", self->Declaration ? to_string(self->Declaration) : "Null" );
break;
case CT_Typedef:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
append_fmt( result, "\n\tUnderlyingType: %S", self->UnderlyingType ? to_string(self->UnderlyingType) : "Null" );
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
string_append_fmt( result, "\n\tUnderlyingType: %S", self->UnderlyingType ? to_string(self->UnderlyingType) : "Null" );
break;
case CT_Typename:
append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
append_fmt( result, "\n\tReturnType : %S", self->ReturnType ? to_string(self->ReturnType) : "Null" );
append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
append_fmt( result, "\n\tArrExpr : %S", self->ArrExpr ? to_string(self->ArrExpr) : "Null" );
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
string_append_fmt( result, "\n\tReturnType : %S", self->ReturnType ? to_string(self->ReturnType) : "Null" );
string_append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
string_append_fmt( result, "\n\tArrExpr : %S", self->ArrExpr ? to_string(self->ArrExpr) : "Null" );
break;
case CT_Union:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tAttributes: %S", self->Attributes ? to_string(self->Attributes) : "Null" );
append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
string_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? to_string(self->Attributes) : "Null" );
string_append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
break;
case CT_Using:
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
append_fmt( result, "\n\tUnderlyingType: %S", self->UnderlyingType ? to_string(self->UnderlyingType) : "Null" );
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
string_append_fmt( result, "\n\tUnderlyingType: %S", self->UnderlyingType ? to_string(self->UnderlyingType) : "Null" );
break;
case CT_Variable:
@ -333,25 +333,25 @@ char const* debug_str(Code self)
if ( self->Parent && self->Parent->Type == CT_Variable )
{
// Its a NextVar
append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
append_fmt( result, "\n\tValue : %S", self->Value ? to_string(self->Value) : "Null" );
append_fmt( result, "\n\tBitfieldSize: %S", self->BitfieldSize ? to_string(self->BitfieldSize) : "Null" );
append_fmt( result, "\n\tNextVar : %S", self->NextVar ? debug_str(self->NextVar) : "Null" );
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
string_append_fmt( result, "\n\tValue : %S", self->Value ? to_string(self->Value) : "Null" );
string_append_fmt( result, "\n\tBitfieldSize: %S", self->BitfieldSize ? to_string(self->BitfieldSize) : "Null" );
string_append_fmt( result, "\n\tNextVar : %S", self->NextVar ? debug_str(self->NextVar) : "Null" );
break;
}
if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
if ( self->Next )
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
append_fmt( result, "\n\tValueType : %S", self->ValueType ? to_string(self->ValueType) : "Null" );
append_fmt( result, "\n\tBitfieldSize: %S", self->BitfieldSize ? to_string(self->BitfieldSize) : "Null" );
append_fmt( result, "\n\tValue : %S", self->Value ? to_string(self->Value) : "Null" );
append_fmt( result, "\n\tNextVar : %S", self->NextVar ? debug_str(self->NextVar) : "Null" );
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
string_append_fmt( result, "\n\tValueType : %S", self->ValueType ? to_string(self->ValueType) : "Null" );
string_append_fmt( result, "\n\tBitfieldSize: %S", self->BitfieldSize ? to_string(self->BitfieldSize) : "Null" );
string_append_fmt( result, "\n\tValue : %S", self->Value ? to_string(self->Value) : "Null" );
string_append_fmt( result, "\n\tNextVar : %S", self->NextVar ? debug_str(self->NextVar) : "Null" );
break;
}
@ -370,7 +370,7 @@ Code duplicate(Code self)
String to_string(Code self)
{
String result = string_make( GlobalAllocator, "" );
String result = string_make_strc( GlobalAllocator, txt("") );
GEN_NS to_string( self, & result );
return result;
}
@ -392,20 +392,20 @@ void to_string( Code self, String* result )
break;
case CT_NewLine:
append( result,"\n");
string_append_strc( result, txt("\n"));
break;
case CT_Untyped:
case CT_Execution:
case CT_Comment:
case CT_PlatformAttributes:
append( result, self->Content );
string_append_strc( result, self->Content );
break;
case CT_Access_Private:
case CT_Access_Protected:
case CT_Access_Public:
append( result, self->Name );
string_append_strc( result, self->Name );
break;
case CT_Class:
@ -640,23 +640,23 @@ bool is_equal( Code self, Code other )
return false; \
}
#define check_member_content( content ) \
if ( self->content != other->content ) \
{ \
log_fmt("\nAST::is_equal: Member content - "#content " failed\n" \
"AST : %S\n" \
"Other: %S\n" \
, debug_str(self) \
,debug_str(other) \
); \
\
log_fmt("Content cannot be trusted to be unique with this check " \
"so it must be verified by eye for now\n" \
"AST Content:\n%S\n" \
"Other Content:\n%S\n" \
, visualize_whitespace(self->content, GlobalAllocator) \
, visualize_whitespace(other->content, GlobalAllocator) \
); \
#define check_member_content( content ) \
if ( self->content != other->content ) \
{ \
log_fmt("\nAST::is_equal: Member content - "#content " failed\n" \
"AST : %S\n" \
"Other: %S\n" \
, debug_str(self) \
, debug_str(other) \
); \
\
log_fmt("Content cannot be trusted to be unique with this check " \
"so it must be verified by eye for now\n" \
"AST Content:\n%S\n" \
"Other Content:\n%S\n" \
, strc_visualize_whitespace(self->content, GlobalAllocator) \
, strc_visualize_whitespace(other->content, GlobalAllocator) \
); \
}
#define check_member_ast( ast ) \

File diff suppressed because it is too large Load Diff

View File

@ -134,7 +134,7 @@ Code begin( CodeBody body) {
}
inline
Code end(CodeBody body ){
return { nullptr };
return { rcast(AST*, body.ast)->Back->Next };
}
#pragma endregion CodeBody

View File

@ -11,7 +11,7 @@ internal void deinit();
internal
void* Global_Allocator_Proc( void* allocator_data, AllocType type, ssize size, ssize alignment, void* old_memory, ssize old_size, u64 flags )
{
Arena* last = back(& Global_AllocatorBuckets);
Arena* last = array_back(& Global_AllocatorBuckets);
switch ( type )
{
@ -24,13 +24,13 @@ void* Global_Allocator_Proc( void* allocator_data, AllocType type, ssize size, s
if ( bucket.PhysicalStart == nullptr )
GEN_FATAL( "Failed to create bucket for Global_AllocatorBuckets");
if ( ! append( & Global_AllocatorBuckets, bucket ) )
if ( ! array_append( & Global_AllocatorBuckets, bucket ) )
GEN_FATAL( "Failed to append bucket to Global_AllocatorBuckets");
last = back(& Global_AllocatorBuckets);
last = array_back(& Global_AllocatorBuckets);
}
return alloc_align( allocator_info(last), size, alignment );
return alloc_align( arena_allocator_info(last), size, alignment );
}
case EAllocation_FREE:
{
@ -51,10 +51,10 @@ void* Global_Allocator_Proc( void* allocator_data, AllocType type, ssize size, s
if ( bucket.PhysicalStart == nullptr )
GEN_FATAL( "Failed to create bucket for Global_AllocatorBuckets");
if ( ! append( & Global_AllocatorBuckets, bucket ) )
if ( ! array_append( & Global_AllocatorBuckets, bucket ) )
GEN_FATAL( "Failed to append bucket to Global_AllocatorBuckets");
last = back(& Global_AllocatorBuckets);
last = array_back(& Global_AllocatorBuckets);
}
void* result = alloc_align( last->Backing, size, alignment );
@ -249,7 +249,7 @@ void init()
if ( bucket.PhysicalStart == nullptr )
GEN_FATAL( "Failed to create first bucket for Global_AllocatorBuckets");
append( & Global_AllocatorBuckets, bucket );
array_append( & Global_AllocatorBuckets, bucket );
}
// Setup the arrays
@ -272,7 +272,7 @@ void init()
if ( code_pool.PhysicalStart == nullptr )
GEN_FATAL( "gen::init: Failed to initialize the code pool" );
append( & CodePools, code_pool );
array_append( & CodePools, code_pool );
LexArena = arena_init_from_allocator( Allocator_Lexer, LexAllocator_Size );
@ -281,7 +281,7 @@ void init()
if ( string_arena.PhysicalStart == nullptr )
GEN_FATAL( "gen::init: Failed to initialize the string arena" );
append( & StringArenas, string_arena );
array_append( & StringArenas, string_arena );
}
// Setup the hash tables
@ -302,52 +302,52 @@ void init()
void deinit()
{
usize index = 0;
usize left = num(CodePools);
usize left = array_num(CodePools);
do
{
Pool* code_pool = & CodePools[index];
free(code_pool);
pool_free(code_pool);
index++;
}
while ( left--, left );
index = 0;
left = num(StringArenas);
left = array_num(StringArenas);
do
{
Arena* string_arena = & StringArenas[index];
free(string_arena);
arena_free(string_arena);
index++;
}
while ( left--, left );
destroy(& StringCache);
free( & CodePools);
free( & StringArenas);
array_free( & CodePools);
array_free( & StringArenas);
free(& LexArena);
arena_free(& LexArena);
free(& PreprocessorDefines);
array_free(& PreprocessorDefines);
index = 0;
left = num(Global_AllocatorBuckets);
left = array_num(Global_AllocatorBuckets);
do
{
Arena* bucket = & Global_AllocatorBuckets[ index ];
free(bucket);
arena_free(bucket);
index++;
}
while ( left--, left );
free(Global_AllocatorBuckets);
array_free(& Global_AllocatorBuckets);
parser::deinit();
}
void reset()
{
s32 index = 0;
s32 left = num(CodePools);
s32 left = array_num(CodePools);
do
{
Pool* code_pool = & CodePools[index];
@ -357,7 +357,7 @@ void reset()
while ( left--, left );
index = 0;
left = num(StringArenas);
left = array_num(StringArenas);
do
{
Arena* string_arena = & StringArenas[index];
@ -373,7 +373,7 @@ void reset()
AllocatorInfo get_string_allocator( s32 str_length )
{
Arena* last = back(& StringArenas);
Arena* last = array_back(& StringArenas);
usize size_req = str_length + sizeof(StringHeader) + sizeof(char*);
@ -381,13 +381,13 @@ AllocatorInfo get_string_allocator( s32 str_length )
{
Arena new_arena = arena_init_from_allocator( Allocator_StringArena, SizePer_StringArena );
if ( ! append( & StringArenas, new_arena ) )
if ( ! array_append( & StringArenas, new_arena ) )
GEN_FATAL( "gen::get_string_allocator: Failed to allocate a new string arena" );
last = back(& StringArenas);
last = array_back(& StringArenas);
}
return allocator_info(last);
return arena_allocator_info(last);
}
// Will either make or retrive a code string.
@ -402,16 +402,16 @@ StringCached get_cached_string( StrC str )
return * result;
}
String result = string_make( get_string_allocator( str.Len ), str );
set(& StringCache, key, { length(result), result } );
String result = string_make_strc( get_string_allocator( str.Len ), str );
set(& StringCache, key, { str.Len, result } );
return { length(result), result };
return { str.Len, result };
}
// Used internally to retireve a Code object form the CodePool.
Code make_code()
{
Pool* allocator = back( & CodePools);
Pool* allocator = array_back( & CodePools);
if ( allocator->FreeList == nullptr )
{
Pool code_pool = pool_init( Allocator_CodePool, CodePool_NumBlocks, sizeof(AST) );
@ -419,13 +419,13 @@ Code make_code()
if ( code_pool.PhysicalStart == nullptr )
GEN_FATAL( "gen::make_code: Failed to allocate a new code pool - CodePool allcoator returned nullptr." );
if ( ! append( & CodePools, code_pool ) )
if ( ! array_append( & CodePools, code_pool ) )
GEN_FATAL( "gen::make_code: Failed to allocate a new code pool - CodePools failed to append new pool." );
allocator = back( & CodePools);
allocator = array_back( & CodePools);
}
Code result { rcast( AST*, alloc( allocator_info(allocator), sizeof(AST) )) };
Code result { rcast( AST*, alloc( pool_allocator_info(allocator), sizeof(AST) )) };
mem_set( result.ast, 0, sizeof(AST) );
// result->Type = ECode::Invalid;

View File

@ -17,7 +17,7 @@ ssize token_fmt_va( char* buf, usize buf_size, s32 num_tokens, va_list va )
char tok_map_mem[ TokenFmt_TokenMap_MemSize ];
tok_map_arena = arena_init_from_memory( tok_map_mem, sizeof(tok_map_mem) );
tok_map = hashtable_init(StrC, allocator_info(& tok_map_arena) );
tok_map = hashtable_init(StrC, arena_allocator_info(& tok_map_arena) );
s32 left = num_tokens - 1;
@ -94,7 +94,7 @@ ssize token_fmt_va( char* buf, usize buf_size, s32 num_tokens, va_list va )
}
clear(tok_map);
free(& tok_map_arena);
arena_free(& tok_map_arena);
ssize result = buf_size - remaining;
@ -142,7 +142,7 @@ Code untyped_fmt( char const* fmt, ...)
Code
result = make_code();
result->Name = get_cached_string( { str_len(fmt, MaxNameLength), fmt } );
result->Name = get_cached_string( { str_len_capped(fmt, MaxNameLength), fmt } );
result->Type = CT_Untyped;
result->Content = get_cached_string( { length, buf } );

View File

@ -472,23 +472,23 @@ CodeComment def_comment( StrC content )
length++;
str_copy( line, scanner, length );
append_fmt(& cmt_formatted, "//%.*s", length, line );
string_append_fmt(& cmt_formatted, "//%.*s", length, line );
mem_set( line, 0, MaxCommentLineLength );
scanner += length;
}
while ( scanner <= end );
if ( * back(& cmt_formatted) != '\n' )
append( & cmt_formatted, "\n" );
if ( * string_back(cmt_formatted) != '\n' )
string_append_strc( & cmt_formatted, txt("\n") );
Code
result = make_code();
result->Type = CT_Comment;
result->Name = get_cached_string( { length(cmt_formatted), cmt_formatted } );
result->Name = get_cached_string( { string_length(cmt_formatted), cmt_formatted } );
result->Content = result->Name;
free(& cmt_formatted);
string_free(& cmt_formatted);
return (CodeComment) result;
}
@ -908,8 +908,8 @@ CodeInclude def_include( StrC path, Opts_def_include p )
}
StrC content = p.foreign ?
to_str( str_fmt_buf( "<%.*s>", path.Len, path.Ptr ))
: to_str( str_fmt_buf( "\"%.*s\"", path.Len, path.Ptr ));
string_to_strc( str_fmt_buf( "<%.*s>", path.Len, path.Ptr ))
: string_to_strc( str_fmt_buf( "\"%.*s\"", path.Len, path.Ptr ));
Code
result = make_code();

View File

@ -221,7 +221,7 @@ forceinline
s32 lex_preprocessor_directive( LexContext* ctx )
{
char const* hash = ctx->scanner;
append( & Tokens, { hash, 1, Tok_Preprocess_Hash, ctx->line, ctx->column, TF_Preprocess } );
array_append( & Tokens, { hash, 1, Tok_Preprocess_Hash, ctx->line, ctx->column, TF_Preprocess } );
move_forward();
SkipWhitespace();
@ -297,14 +297,14 @@ s32 lex_preprocessor_directive( LexContext* ctx )
ctx->token.Length = ctx->token.Length + ctx->token.Text - hash;
ctx->token.Text = hash;
append( & Tokens, ctx->token );
array_append( & Tokens, ctx->token );
return Lex_Continue; // Skip found token, its all handled here.
}
if ( ctx->token.Type == Tok_Preprocess_Else || ctx->token.Type == Tok_Preprocess_EndIf )
{
ctx->token.Flags |= TF_Preprocess_Cond;
append( & Tokens, ctx->token );
array_append( & Tokens, ctx->token );
end_line();
return Lex_Continue;
}
@ -313,7 +313,7 @@ s32 lex_preprocessor_directive( LexContext* ctx )
ctx->token.Flags |= TF_Preprocess_Cond;
}
append( & Tokens, ctx->token );
array_append( & Tokens, ctx->token );
SkipWhitespace();
@ -337,7 +337,7 @@ s32 lex_preprocessor_directive( LexContext* ctx )
name.Length++;
}
append( & Tokens, name );
array_append( & Tokens, name );
u64 key = crc32( name.Text, name.Length );
set(& ctx->defines, key, to_str(name) );
@ -383,7 +383,7 @@ s32 lex_preprocessor_directive( LexContext* ctx )
move_forward();
}
append( & Tokens, preprocess_content );
array_append( & Tokens, preprocess_content );
return Lex_Continue; // Skip found token, its all handled here.
}
@ -445,7 +445,7 @@ s32 lex_preprocessor_directive( LexContext* ctx )
preprocess_content.Length++;
}
append( & Tokens, preprocess_content );
array_append( & Tokens, preprocess_content );
return Lex_Continue; // Skip found token, its all handled here.
}
@ -454,7 +454,7 @@ void lex_found_token( LexContext* ctx )
{
if ( ctx->token.Type != Tok_Invalid )
{
append( & Tokens, ctx->token );
array_append( & Tokens, ctx->token );
return;
}
@ -481,7 +481,7 @@ void lex_found_token( LexContext* ctx )
}
ctx->token.Type = type;
append( & Tokens, ctx->token );
array_append( & Tokens, ctx->token );
return;
}
@ -491,7 +491,7 @@ void lex_found_token( LexContext* ctx )
{
ctx->token.Type = type;
ctx->token.Flags |= TF_Specifier;
append( & Tokens, ctx->token );
array_append( & Tokens, ctx->token );
return;
}
@ -499,7 +499,7 @@ void lex_found_token( LexContext* ctx )
if ( type != Tok_Invalid )
{
ctx->token.Type = type;
append( & Tokens, ctx->token );
array_append( & Tokens, ctx->token );
return;
}
@ -551,7 +551,7 @@ void lex_found_token( LexContext* ctx )
ctx->token.Type = Tok_Identifier;
}
append( & Tokens, ctx->token );
array_append( & Tokens, ctx->token );
}
@ -578,7 +578,7 @@ TokArray lex( StrC content )
return { {}, 0 };
}
foreach( StringCached*, entry, PreprocessorDefines )
for ( StringCached* entry = array_begin(PreprocessorDefines); entry != array_end(PreprocessorDefines); array_next(PreprocessorDefines, entry))
{
s32 length = 0;
char const* scanner = * entry;
@ -596,7 +596,7 @@ TokArray lex( StrC content )
set(& c.defines, key, (StrC) * entry );
}
clear(Tokens);
array_clear(Tokens);
while (c.left )
{
@ -626,7 +626,7 @@ TokArray lex( StrC content )
c.token.Type = Tok_NewLine;
c.token.Length++;
append( & Tokens, c.token );
array_append( & Tokens, c.token );
continue;
}
}
@ -1095,7 +1095,7 @@ TokArray lex( StrC content )
move_forward();
c.token.Length++;
}
append( & Tokens, c.token );
array_append( & Tokens, c.token );
continue;
}
else if ( current == '*' )
@ -1131,7 +1131,7 @@ TokArray lex( StrC content )
move_forward();
c.token.Length++;
}
append( & Tokens, c.token );
array_append( & Tokens, c.token );
// end_line();
continue;
}
@ -1224,9 +1224,9 @@ TokArray lex( StrC content )
}
else
{
s32 start = max( 0, num(Tokens) - 100 );
s32 start = max( 0, array_num(Tokens) - 100 );
log_fmt("\n%d\n", start);
for ( s32 idx = start; idx < num(Tokens); idx++ )
for ( s32 idx = start; idx < array_num(Tokens); idx++ )
{
log_fmt( "Token %d Type: %s : %.*s\n"
, idx
@ -1249,7 +1249,7 @@ TokArray lex( StrC content )
lex_found_token( ctx );
}
if ( num(Tokens) == 0 )
if ( array_num(Tokens) == 0 )
{
log_failure( "Failed to lex any tokens" );
return { {}, 0 };

View File

@ -50,28 +50,28 @@ String to_string(ParseContext ctx)
String result = string_make_reserve( GlobalAllocator, kilobytes(4) );
Token scope_start = ctx.Scope->Start;
Token last_valid = ctx.Tokens.Idx >= num(ctx.Tokens.Arr) ? ctx.Tokens.Arr[num(ctx.Tokens.Arr) -1] : (* current(& ctx.Tokens, true));
Token last_valid = ctx.Tokens.Idx >= array_num(ctx.Tokens.Arr) ? ctx.Tokens.Arr[array_num(ctx.Tokens.Arr) -1] : (* current(& ctx.Tokens, true));
sptr length = scope_start.Length;
char const* current = scope_start.Text + length;
while ( current <= back( & ctx.Tokens.Arr)->Text && *current != '\n' && length < 74 )
while ( current <= array_back( & ctx.Tokens.Arr)->Text && *current != '\n' && length < 74 )
{
current++;
length++;
}
String line = string_make( GlobalAllocator, { length, scope_start.Text } );
append_fmt( & result, "\tScope : %s\n", line );
free(& line);
String line = string_make_strc( GlobalAllocator, { length, scope_start.Text } );
string_append_fmt( & result, "\tScope : %s\n", line );
string_free(& line);
sptr dist = (sptr)last_valid.Text - (sptr)scope_start.Text + 2;
sptr length_from_err = dist;
String line_from_err = string_make( GlobalAllocator, { length_from_err, last_valid.Text } );
String line_from_err = string_make_strc( GlobalAllocator, { length_from_err, last_valid.Text } );
if ( length_from_err < 100 )
append_fmt(& result, "\t(%d, %d):%*c\n", last_valid.Line, last_valid.Column, length_from_err, '^' );
string_append_fmt(& result, "\t(%d, %d):%*c\n", last_valid.Line, last_valid.Column, length_from_err, '^' );
else
append_fmt(& result, "\t(%d, %d)\n", last_valid.Line, last_valid.Column );
string_append_fmt(& result, "\t(%d, %d)\n", last_valid.Line, last_valid.Column );
StackNode* curr_scope = ctx.Scope;
s32 level = 0;
@ -79,11 +79,11 @@ String to_string(ParseContext ctx)
{
if ( is_valid(curr_scope->Name) )
{
append_fmt(& result, "\t%d: %s, AST Name: %.*s\n", level, curr_scope->ProcName.Ptr, curr_scope->Name.Length, curr_scope->Name.Text );
string_append_fmt(& result, "\t%d: %s, AST Name: %.*s\n", level, curr_scope->ProcName.Ptr, curr_scope->Name.Length, curr_scope->Name.Text );
}
else
{
append_fmt(& result, "\t%d: %s\n", level, curr_scope->ProcName.Ptr );
string_append_fmt(& result, "\t%d: %s\n", level, curr_scope->ProcName.Ptr );
}
curr_scope = curr_scope->Prev;
@ -97,7 +97,7 @@ global ParseContext Context;
bool __eat(TokArray* self, TokType type )
{
if ( num(self->Arr) - self->Idx <= 0 )
if ( array_num(self->Arr) - self->Idx <= 0 )
{
log_failure( "No tokens left.\n%s", to_string(Context) );
return false;
@ -136,12 +136,12 @@ bool __eat(TokArray* self, TokType type )
internal
void init()
{
Tokens = array_init_reserve<Token>( allocator_info( & LexArena)
Tokens = array_init_reserve(Token, arena_allocator_info( & LexArena)
, ( LexAllocator_Size - sizeof( ArrayHeader ) ) / sizeof(Token)
);
fixed_arena_init(& defines_map_arena);
defines = hashtable_init_reserve<StrC>( allocator_info( & defines_map_arena), 256 );
defines = hashtable_init_reserve(StrC, allocator_info( & defines_map_arena), 256 );
}
internal
@ -175,7 +175,7 @@ bool _check_parse_args( StrC def, char const* func_name )
# define prevtok (* previous( Context.Tokens, dont_skip_formatting))
# define nexttok (* next( Context.Tokens, skip_formatting ))
# define eat( Type_ ) __eat( & Context.Tokens, Type_ )
# define left ( num(Context.Tokens.Arr) - Context.Tokens.Idx )
# define left ( array_num(Context.Tokens.Arr) - Context.Tokens.Idx )
#ifdef check
#define CHECK_WAS_DEFINED
@ -298,7 +298,7 @@ String strip_formatting( StrC raw_text, bool preserve_newlines = true )
if ( tokleft )
move_fwd();
append( & content, cut_ptr, cut_length );
string_append_c_str_len( & content, cut_ptr, cut_length );
last_cut = sptr( scanner ) - sptr( raw_text.Ptr );
continue;
}
@ -320,7 +320,7 @@ String strip_formatting( StrC raw_text, bool preserve_newlines = true )
if ( tokleft )
move_fwd();
append( & content, cut_ptr, cut_length );
string_append_c_str_len( & content, cut_ptr, cut_length );
last_cut = sptr( scanner ) - sptr( raw_text.Ptr );
continue;
}
@ -334,7 +334,7 @@ String strip_formatting( StrC raw_text, bool preserve_newlines = true )
scanner += 2;
tokleft -= 2;
append( & content, cut_ptr, cut_length );
string_append_c_str_len( & content, cut_ptr, cut_length );
last_cut = sptr( scanner ) - sptr( raw_text.Ptr );
continue;
}
@ -353,7 +353,7 @@ String strip_formatting( StrC raw_text, bool preserve_newlines = true )
if (tokleft)
move_fwd();
append( & content, cut_ptr, cut_length );
string_append_c_str_len( & content, cut_ptr, cut_length );
last_cut = sptr( scanner ) - sptr( raw_text.Ptr );
continue;
}
@ -362,10 +362,10 @@ String strip_formatting( StrC raw_text, bool preserve_newlines = true )
if (scanner[0] == '\t')
{
if (pos > last_cut)
append( & content, cut_ptr, cut_length);
string_append_c_str_len( & content, cut_ptr, cut_length);
if ( * back( & content ) != ' ' )
append( & content, ' ');
if ( * string_back( content ) != ' ' )
string_append_strc( & content, txt(' '));
move_fwd();
last_cut = sptr(scanner) - sptr(raw_text.Ptr);
@ -381,17 +381,17 @@ String strip_formatting( StrC raw_text, bool preserve_newlines = true )
scanner += 2;
tokleft -= 2;
append( & content, cut_ptr, cut_length );
string_append_c_str_len( & content, cut_ptr, cut_length );
last_cut = sptr( scanner ) - sptr( raw_text.Ptr );
continue;
}
if ( pos > last_cut )
append( & content, cut_ptr, cut_length );
string_append_c_str_len( & content, cut_ptr, cut_length );
// Replace with a space
if ( * back( & content ) != ' ' )
append( & content, ' ' );
if ( * string_back( content ) != ' ' )
string_append_strc( & content, txt(' ') );
scanner += 2;
tokleft -= 2;
@ -408,17 +408,17 @@ String strip_formatting( StrC raw_text, bool preserve_newlines = true )
move_fwd();
append( & content, cut_ptr, cut_length );
string_append_c_str_len( & content, cut_ptr, cut_length );
last_cut = sptr( scanner ) - sptr( raw_text.Ptr );
continue;
}
if ( pos > last_cut )
append( & content, cut_ptr, cut_length );
string_append_c_str_len( & content, cut_ptr, cut_length );
// Replace with a space
if ( * back( & content ) != ' ' )
append( & content, ' ' );
string_append_strc( & content, txt(' ') );
move_fwd();
@ -429,7 +429,7 @@ String strip_formatting( StrC raw_text, bool preserve_newlines = true )
// Escaped newlines
if ( scanner[0] == '\\' )
{
append( & content, cut_ptr, cut_length );
string_append_c_str_len( & content, cut_ptr, cut_length );
s32 amount_to_skip = 1;
if ( tokleft > 1 && scanner[1] == '\n' )
@ -456,7 +456,7 @@ String strip_formatting( StrC raw_text, bool preserve_newlines = true )
// Consectuive spaces
if ( tokleft > 1 && char_is_space( scanner[0] ) && char_is_space( scanner[ 1 ] ) )
{
append( & content, cut_ptr, cut_length );
string_append_c_str_len( & content, cut_ptr, cut_length );
do
{
move_fwd();
@ -468,7 +468,7 @@ String strip_formatting( StrC raw_text, bool preserve_newlines = true )
// Preserve only 1 space of formattting
char* last = back(& content);
if ( last == nullptr || * last != ' ' )
append( & content, ' ' );
string_append_strc( & content, txt(' ') );
continue;
}
@ -478,7 +478,7 @@ String strip_formatting( StrC raw_text, bool preserve_newlines = true )
if ( last_cut < raw_text.Len )
{
append( & content, cut_ptr, raw_text.Len - last_cut );
string_append_c_str_len( & content, cut_ptr, raw_text.Len - last_cut );
}
#undef cut_ptr
@ -669,7 +669,7 @@ CodeAttributes parse_attributes()
Code result = make_code();
result->Type = CT_PlatformAttributes;
result->Name = get_cached_string( { length(name_stripped), name_stripped } );
result->Name = get_cached_string( { string_length(name_stripped), name_stripped } );
result->Content = result->Name;
// result->Token =
@ -723,7 +723,7 @@ Code parse_class_struct( TokType which, bool inplace_def = false )
char interface_arr_mem[ kilobytes(4) ] {0};
Array<CodeTypename> interfaces; {
Arena arena = arena_init_from_memory( interface_arr_mem, kilobytes(4) );
interfaces = array_init_reserve<CodeTypename>( allocator_info(& arena), 4 );
interfaces = array_init_reserve(CodeTypename, arena_allocator_info(& arena), 4 );
}
// TODO(Ed) : Make an AST_DerivedType, we'll store any arbitary derived type into there as a linear linked list of them.
@ -754,7 +754,7 @@ Code parse_class_struct( TokType which, bool inplace_def = false )
}
Token interface_tok = parse_identifier();
append( & interfaces, def_type( to_str(interface_tok) ) );
array_append( & interfaces, def_type( to_str(interface_tok) ) );
// <ModuleFlags> <class/struct> <Attributes> <Name> : <Access Specifier> <Name>, ...
}
}
@ -786,7 +786,7 @@ Code parse_class_struct( TokType which, bool inplace_def = false )
if ( inline_cmt )
result->InlineCmt = inline_cmt;
free(& interfaces);
array_free(& interfaces);
return result;
}
@ -1048,9 +1048,9 @@ CodeBody parse_class_struct_body( TokType which, Token name )
if ( attributes )
{
String fused = string_make_reserve( GlobalAllocator, attributes->Content.Len + more_attributes->Content.Len );
append_fmt( & fused, "%S %S", attributes->Content, more_attributes->Content );
string_append_fmt( & fused, "%S %S", attributes->Content, more_attributes->Content );
attributes->Name = get_cached_string({ length(fused), fused });
attributes->Name = get_cached_string( { string_length(fused), fused });
attributes->Content = attributes->Name;
// <Attributes> <Specifiers> <Attributes>
}
@ -1086,7 +1086,7 @@ CodeBody parse_class_struct_body( TokType which, Token name )
{
if ( nexttok.Type == Tok_Capture_Start && name.Length && currtok.Type == Tok_Identifier )
{
if ( str_compare( name.Text, currtok.Text, name.Length ) == 0 )
if ( str_compare_len( name.Text, currtok.Text, name.Length ) == 0 )
{
member = parse_constructor( specifiers );
// <Attributes> <Specifiers> <Name>()
@ -1159,7 +1159,7 @@ Code parse_complicated_definition( TokType which )
s32 idx = tokens.Idx;
s32 level = 0;
for ( ; idx < num(tokens.Arr); idx++ )
for ( ; idx < array_num(tokens.Arr); idx++ )
{
if ( tokens.Arr[ idx ].Type == Tok_BraceCurly_Open )
level++;
@ -1344,7 +1344,7 @@ CodeDefine parse_define()
return define;
}
define->Content = get_cached_string( to_strc( strip_formatting( to_str(currtok), strip_formatting_dont_preserve_newlines )) );
define->Content = get_cached_string( string_to_strc( strip_formatting( to_str(currtok), strip_formatting_dont_preserve_newlines )) );
eat( Tok_Preprocess_Content );
// #define <Name> <Content>
@ -1489,12 +1489,12 @@ CodeFn parse_function_after_name(
}
String
name_stripped = string_make( GlobalAllocator, to_str(name) );
name_stripped = string_make_strc( GlobalAllocator, to_str(name) );
strip_space(name_stripped);
CodeFn
result = (CodeFn) make_code();
result->Name = get_cached_string( to_strc(name_stripped) );
result->Name = get_cached_string( string_to_strc(name_stripped) );
result->ModuleFlags = mflags;
if ( body )
@ -1840,7 +1840,7 @@ CodeBody parse_global_nspace( CodeType which )
bool found_operator_cast_outside_class_implmentation = false;
s32 idx = Context.Tokens.Idx;
for ( ; idx < num(Context.Tokens.Arr); idx++ )
for ( ; idx < array_num(Context.Tokens.Arr); idx++ )
{
Token tok = Context.Tokens.Arr[ idx ];
@ -1912,14 +1912,14 @@ Code parse_global_nspace_constructor_destructor( CodeSpecifiers specifiers )
s32 idx = tokens.Idx;
Token nav = tokens.Arr[ idx ];
for ( ; idx < num(tokens.Arr); idx++, nav = tokens.Arr[ idx ] )
for ( ; idx < array_num(tokens.Arr); idx++, nav = tokens.Arr[ idx ] )
{
if ( nav.Text[0] == '<' )
{
// Skip templated expressions as they mey have expressions with the () operators
s32 capture_level = 0;
s32 template_level = 0;
for ( ; idx < num(tokens.Arr); idx++, nav = tokens.Arr[idx] )
for ( ; idx < array_num(tokens.Arr); idx++, nav = tokens.Arr[idx] )
{
if (nav.Text[ 0 ] == '<')
++ template_level;
@ -2001,7 +2001,7 @@ Code parse_global_nspace_constructor_destructor( CodeSpecifiers specifiers )
tok_left = tokens.Arr[idx];
}
bool is_same = str_compare( tok_right.Text, tok_left.Text, tok_right.Length ) == 0;
bool is_same = str_compare_len( tok_right.Text, tok_left.Text, tok_right.Length ) == 0;
if (tok_left.Type == Tok_Identifier && is_same)
{
// We have found the pattern we desired
@ -2357,7 +2357,7 @@ CodeOperator parse_operator_after_ret_type(
{
StrC str_new = to_str(Op_New);
StrC str_delete = to_str(Op_Delete);
if ( str_compare( currtok.Text, str_new.Ptr, max(str_new.Len - 1, currtok.Length)) == 0)
if ( str_compare_len( currtok.Text, str_new.Ptr, max(str_new.Len - 1, currtok.Length)) == 0)
{
op = Op_New;
eat( Tok_Identifier );
@ -2369,7 +2369,7 @@ CodeOperator parse_operator_after_ret_type(
idx++;
}
Token next = Context.Tokens.Arr[idx];
if ( currtok.Type == Tok_Operator && str_compare(currtok.Text, "[]", 2) == 0)
if ( currtok.Type == Tok_Operator && str_compare_len(currtok.Text, "[]", 2) == 0)
{
eat(Tok_Operator);
op = Op_NewArray;
@ -2381,7 +2381,7 @@ CodeOperator parse_operator_after_ret_type(
op = Op_NewArray;
}
}
else if ( str_compare( currtok.Text, str_delete.Ptr, max(str_delete.Len - 1, currtok.Length )) == 0)
else if ( str_compare_len( currtok.Text, str_delete.Ptr, max(str_delete.Len - 1, currtok.Length )) == 0)
{
op = Op_Delete;
eat(Tok_Identifier);
@ -2393,7 +2393,7 @@ CodeOperator parse_operator_after_ret_type(
idx++;
}
Token next = Context.Tokens.Arr[idx];
if ( currtok.Type == Tok_Operator && str_compare(currtok.Text, "[]", 2) == 0)
if ( currtok.Type == Tok_Operator && str_compare_len(currtok.Text, "[]", 2) == 0)
{
eat(Tok_Operator);
op = Op_DeleteArray;
@ -2513,7 +2513,7 @@ Code parse_operator_function_or_variable( bool expects_function, CodeAttributes
bool found_operator = false;
s32 idx = Context.Tokens.Idx;
for ( ; idx < num(Context.Tokens.Arr); idx++ )
for ( ; idx < array_num(Context.Tokens.Arr); idx++ )
{
Token tok = Context.Tokens.Arr[ idx ];
@ -2730,7 +2730,7 @@ CodeParam parse_params( bool use_template_capture )
eat( currtok.Type );
}
value = untyped_str( to_strc(strip_formatting( to_str(value_tok), strip_formatting_dont_preserve_newlines )) );
value = untyped_str( string_to_strc(strip_formatting( to_str(value_tok), strip_formatting_dont_preserve_newlines )) );
// ( <Macro> <ValueType> <Name> = <Expression>
}
}
@ -2845,7 +2845,7 @@ CodeParam parse_params( bool use_template_capture )
eat( currtok.Type );
}
value = untyped_str( to_strc(strip_formatting( to_str(value_tok), strip_formatting_dont_preserve_newlines )) );
value = untyped_str( string_to_strc(strip_formatting( to_str(value_tok), strip_formatting_dont_preserve_newlines )) );
// ( <Macro> <ValueType> <Name> = <Expression>, <Macro> <ValueType> <Name> = <Expression>
}
// ( <Macro> <ValueType> <Name> = <Expression>, <Macro> <ValueType> <Name> = <Expression>, ..
@ -2957,7 +2957,7 @@ Code parse_simple_preprocess( TokType which )
// <Macro> { <Body> }
StrC prev_proc = Context.Scope->Prev->ProcName;
if ( str_compare( prev_proc.Ptr, "parse_typedef", prev_proc.Len ) != 0 )
if ( str_compare_len( prev_proc.Ptr, "parse_typedef", prev_proc.Len ) != 0 )
{
if ( check( Tok_Statement_End ))
{
@ -2975,7 +2975,7 @@ Code parse_simple_preprocess( TokType which )
}
else
{
if ( str_compare( Context.Scope->Prev->ProcName.Ptr, "parse_typedef", Context.Scope->Prev->ProcName.Len ) != 0 )
if ( str_compare_len( Context.Scope->Prev->ProcName.Ptr, "parse_typedef", Context.Scope->Prev->ProcName.Len ) != 0 )
{
if ( check( Tok_Statement_End ))
{
@ -2994,7 +2994,7 @@ Code parse_simple_preprocess( TokType which )
char const* content = str_fmt_buf( "%.*s ", tok.Length, tok.Text );
Code result = untyped_str( GEN_NS to_str(content) );
Code result = untyped_str( to_strc_from_c_str(content) );
Context.Scope->Name = tok;
pop(& Context);
@ -3494,7 +3494,7 @@ CodeDestructor parse_destructor( CodeSpecifiers specifiers )
append(specifiers, Spec_Pure );
}
else if ( left && str_compare( upcoming.Text, "default", sizeof("default") - 1 ) == 0)
else if ( left && str_compare_len( upcoming.Text, "default", sizeof("default") - 1 ) == 0)
{
body = parse_assignment_expression();
// <Virtual Specifier> ~<
@ -3609,7 +3609,7 @@ CodeEnum parse_enum( bool inplace_def )
// We'll support the enum_underlying macro
StrC sig = txt("enum_underlying");
if (currtok.Length >= sig.Len && str_compare(currtok.Text, sig.Ptr, sig.Len) == 0 )
if (currtok.Length >= sig.Len && str_compare_len(currtok.Text, sig.Ptr, sig.Len) == 0 )
{
use_macro_underlying = true;
underlying_macro = parse_simple_preprocess( Tok_Preprocess_Macro);
@ -4375,7 +4375,7 @@ CodeTemplate parse_template()
bool found_operator_cast_outside_class_implmentation = false;
s32 idx = Context.Tokens.Idx;
for ( ; idx < num(Context.Tokens.Arr); idx++ )
for ( ; idx < array_num(Context.Tokens.Arr); idx++ )
{
Token tok = Context.Tokens.Arr[ idx ];
@ -4829,7 +4829,7 @@ else if ( currtok.Type == Tok_DeclType )
}
#endif
result->Name = get_cached_string( to_strc(name_stripped) );
result->Name = get_cached_string( string_to_strc(name_stripped) );
if ( attributes )
result->Attributes = attributes;
@ -4924,7 +4924,7 @@ CodeTypedef parse_typedef()
s32 idx = tokens.Idx;
s32 level = 0;
for ( ; idx < num(tokens.Arr); idx ++ )
for ( ; idx < array_num(tokens.Arr); idx ++ )
{
if ( tokens.Arr[idx].Type == Tok_BraceCurly_Open )
level++;