mirror of
				https://github.com/Ed94/gencpp.git
				synced 2025-10-31 06:50:53 -07:00 
			
		
		
		
	moved seiralization inlines to inlines.hpp, more adjustments
This commit is contained in:
		| @@ -3,21 +3,6 @@ | ||||
| #include "ast.cpp" | ||||
| #endif | ||||
|  | ||||
| inline | ||||
| StrBuilder attributes_to_strbuilder(CodeAttributes attributes) { | ||||
| 	GEN_ASSERT(attributes); | ||||
| 	char* raw = ccast(char*, str_duplicate( attributes->Content, _ctx->Allocator_Temp ).Ptr); | ||||
| 	StrBuilder result = { raw }; | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| inline | ||||
| void attributes_to_strbuilder_ref(CodeAttributes attributes, StrBuilder* result) { | ||||
| 	GEN_ASSERT(attributes); | ||||
| 	GEN_ASSERT(result); | ||||
| 	strbuilder_append_str(result, attributes->Content); | ||||
| } | ||||
|  | ||||
| StrBuilder body_to_strbuilder(CodeBody body) | ||||
| { | ||||
| 	GEN_ASSERT(body); | ||||
| @@ -47,20 +32,6 @@ StrBuilder body_to_strbuilder(CodeBody body) | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| void body_to_strbuilder_ref( CodeBody body, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(body   != nullptr); | ||||
| 	GEN_ASSERT(result != nullptr); | ||||
| 	Code curr = body->Front; | ||||
| 	s32  left = body->NumEntries; | ||||
| 	while ( left -- ) | ||||
| 	{ | ||||
| 		code_to_strbuilder_ptr(curr, result); | ||||
| 		// strbuilder_append_fmt( result, "%SB", code_to_strbuilder(curr) ); | ||||
| 		++curr; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void body_to_strbuilder_export( CodeBody body, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(body   != nullptr); | ||||
| @@ -79,21 +50,6 @@ void body_to_strbuilder_export( CodeBody body, StrBuilder* result ) | ||||
| 	strbuilder_append_fmt( result, "};\n" ); | ||||
| } | ||||
|  | ||||
| inline | ||||
| StrBuilder comment_to_strbuilder(CodeComment comment) { | ||||
| 	GEN_ASSERT(comment); | ||||
| 	char* raw = ccast(char*, str_duplicate( comment->Content, _ctx->Allocator_Temp ).Ptr); | ||||
| 	StrBuilder result = { raw }; | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| inline | ||||
| void comment_to_strbuilder_ref(CodeComment comment, StrBuilder* result) { | ||||
| 	GEN_ASSERT(comment); | ||||
| 	GEN_ASSERT(result); | ||||
| 	strbuilder_append_str(result, comment->Content); | ||||
| } | ||||
|  | ||||
| StrBuilder constructor_to_strbuilder(CodeConstructor self) | ||||
| { | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 128 ); | ||||
| @@ -189,7 +145,7 @@ void class_to_strbuilder_def( CodeClass self, StrBuilder* result ) | ||||
| 	if ( self->Name.Len ) | ||||
| 		strbuilder_append_str( result, self->Name ); | ||||
|  | ||||
| 	if (self->Specs && specifiers_has(self->Specs, Spec_Final) > -1) | ||||
| 	if (self->Specs && specifiers_has(self->Specs, Spec_Final)) | ||||
| 		strbuilder_append_str(result, txt(" final")); | ||||
|  | ||||
| 	if ( self->ParentType ) | ||||
| @@ -241,13 +197,6 @@ void class_to_strbuilder_fwd( CodeClass self, StrBuilder* result ) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| StrBuilder define_to_strbuilder(CodeDefine define) | ||||
| { | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 512 ); | ||||
| 	define_to_strbuilder_ref(define, & result); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| void define_to_strbuilder_ref(CodeDefine define, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(define); | ||||
| @@ -262,14 +211,6 @@ void define_to_strbuilder_ref(CodeDefine define, StrBuilder* result ) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| StrBuilder define_params_to_strbuilder(CodeDefineParams params) | ||||
| { | ||||
| 	GEN_ASSERT(params); | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 128 ); | ||||
| 	define_params_to_strbuilder_ref( params, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| void define_params_to_strbuilder_ref(CodeDefineParams self, StrBuilder* result) | ||||
| { | ||||
| 	GEN_ASSERT(self); | ||||
| @@ -478,54 +419,6 @@ void enum_to_strbuilder_class_fwd(CodeEnum self, StrBuilder* result ) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| StrBuilder exec_to_strbuilder(CodeExec exec) | ||||
| { | ||||
| 	GEN_ASSERT(exec); | ||||
| 	char* raw = ccast(char*, str_duplicate( exec->Content, _ctx->Allocator_Temp ).Ptr); | ||||
| 	StrBuilder result = { raw }; | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| void extern_to_strbuilder(CodeExtern self, StrBuilder* result ) | ||||
| { | ||||
| 	if ( self->Body ) | ||||
| 		strbuilder_append_fmt( result, "extern \"%S\"\n{\n%SB\n}\n", self->Name, body_to_strbuilder(self->Body) ); | ||||
| 	else | ||||
| 		strbuilder_append_fmt( result, "extern \"%S\"\n{}\n", self->Name ); | ||||
| } | ||||
|  | ||||
| StrBuilder include_to_strbuilder(CodeInclude include) | ||||
| { | ||||
| 	return strbuilder_fmt_buf( _ctx->Allocator_Temp, "#include %S\n", include->Content ); | ||||
| } | ||||
|  | ||||
| void include_to_strbuilder_ref( CodeInclude include, StrBuilder* result ) | ||||
| { | ||||
| 	strbuilder_append_fmt( result, "#include %S\n", include->Content ); | ||||
| } | ||||
|  | ||||
| StrBuilder friend_to_strbuilder(CodeFriend self) | ||||
| { | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 256 ); | ||||
| 	friend_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| void friend_to_strbuilder_ref(CodeFriend self, StrBuilder* result ) | ||||
| { | ||||
| 	strbuilder_append_fmt( result, "friend %SB", code_to_strbuilder(self->Declaration) ); | ||||
|  | ||||
| 	if ( self->Declaration->Type != CT_Function && self->Declaration->Type != CT_Operator && (* result)[ strbuilder_length(* result) - 1 ] != ';' ) | ||||
| 	{ | ||||
| 		strbuilder_append_str( result, txt(";") ); | ||||
| 	} | ||||
|  | ||||
| 	if ( self->InlineCmt ) | ||||
| 		strbuilder_append_fmt( result, "  %S", self->InlineCmt->Content ); | ||||
| 	else | ||||
| 		strbuilder_append_str( result, txt("\n")); | ||||
| } | ||||
|  | ||||
| StrBuilder fn_to_strbuilder(CodeFn self) | ||||
| { | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 512 ); | ||||
| @@ -649,9 +542,9 @@ void fn_to_strbuilder_fwd(CodeFn self, StrBuilder* result ) | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		if ( specifiers_has(self->Specs, Spec_Pure ) >= 0 ) | ||||
| 		if ( specifiers_has(self->Specs, Spec_Pure ) ) | ||||
| 			strbuilder_append_str( result, txt(" = 0") ); | ||||
| 		else if ( specifiers_has(self->Specs, Spec_Delete ) >= 0 ) | ||||
| 		else if ( specifiers_has(self->Specs, Spec_Delete ) ) | ||||
| 			strbuilder_append_str( result, txt(" = delete") ); | ||||
| 	} | ||||
|  | ||||
| @@ -668,13 +561,6 @@ void fn_to_strbuilder_fwd(CodeFn self, StrBuilder* result ) | ||||
| 		strbuilder_append_str( result, txt(";\n") ); | ||||
| } | ||||
|  | ||||
| StrBuilder module_to_strbuilder(CodeModule self) | ||||
| { | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 64 ); | ||||
| 	module_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| void module_to_strbuilder_ref(CodeModule self, StrBuilder* result ) | ||||
| { | ||||
| 	if (((scast(u32, ModuleFlag_Export) & scast(u32, self->ModuleFlags)) == scast(u32, ModuleFlag_Export))) | ||||
| @@ -686,21 +572,6 @@ void module_to_strbuilder_ref(CodeModule self, StrBuilder* result ) | ||||
| 	strbuilder_append_fmt( result, "%S;\n", self->Name ); | ||||
| } | ||||
|  | ||||
| StrBuilder namespace_to_strbuilder(CodeNS self) | ||||
| { | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 512 ); | ||||
| 	namespace_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| void namespace_to_strbuilder_ref(CodeNS self, StrBuilder* result ) | ||||
| { | ||||
| 	if ( bitfield_is_set( u32, self->ModuleFlags, ModuleFlag_Export )) | ||||
| 		strbuilder_append_str( result, txt("export ") ); | ||||
|  | ||||
| 	strbuilder_append_fmt( result, "namespace %S\n{\n%SB\n}\n", self->Name, body_to_strbuilder(self->Body) ); | ||||
| } | ||||
|  | ||||
| StrBuilder code_op_to_strbuilder(CodeOperator self) | ||||
| { | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 512 ); | ||||
| @@ -912,14 +783,6 @@ void opcast_to_strbuilder_fwd(CodeOpCast self, StrBuilder* result ) | ||||
| 		strbuilder_append_fmt( result, "operator %SB();\n", typename_to_strbuilder(self->ValueType) ); | ||||
| } | ||||
|  | ||||
| StrBuilder params_to_strbuilder(CodeParams self) | ||||
| { | ||||
| 	GEN_ASSERT(self); | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 128 ); | ||||
| 	params_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| void params_to_strbuilder_ref( CodeParams self, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(self); | ||||
| @@ -987,62 +850,6 @@ StrBuilder preprocess_to_strbuilder(CodePreprocessCond self) | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| void preprocess_to_strbuilder_if(CodePreprocessCond cond, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(cond); | ||||
| 	strbuilder_append_fmt( result, "#if %S", cond->Content ); | ||||
| } | ||||
|  | ||||
| void preprocess_to_strbuilder_ifdef(CodePreprocessCond cond, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(cond); | ||||
| 	strbuilder_append_fmt( result, "#ifdef %S\n", cond->Content ); | ||||
| } | ||||
|  | ||||
| void preprocess_to_strbuilder_ifndef(CodePreprocessCond cond, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(cond); | ||||
| 	strbuilder_append_fmt( result, "#ifndef %S", cond->Content ); | ||||
| } | ||||
|  | ||||
| void preprocess_to_strbuilder_elif(CodePreprocessCond cond, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(cond); | ||||
| 	strbuilder_append_fmt( result, "#elif %S\n", cond->Content ); | ||||
| } | ||||
|  | ||||
| void preprocess_to_strbuilder_else(CodePreprocessCond cond, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(cond); | ||||
| 	strbuilder_append_str( result, txt("#else\n") ); | ||||
| } | ||||
|  | ||||
| void preprocess_to_strbuilder_endif(CodePreprocessCond cond, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(cond); | ||||
| 	strbuilder_append_str( result, txt("#endif\n") ); | ||||
| } | ||||
|  | ||||
| StrBuilder pragma_to_strbuilder(CodePragma self) | ||||
| { | ||||
| 	GEN_ASSERT(self); | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 256 ); | ||||
| 	pragma_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| void pragma_to_strbuilder_ref(CodePragma self, StrBuilder* result ) | ||||
| { | ||||
| 	strbuilder_append_fmt( result, "#pragma %S\n", self->Content ); | ||||
| } | ||||
|  | ||||
| StrBuilder specifiers_to_strbuilder(CodeSpecifiers self) | ||||
| { | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 64 ); | ||||
| 	specifiers_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| void specifiers_to_strbuilder_ref( CodeSpecifiers self, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(self); | ||||
| @@ -1155,14 +962,6 @@ void struct_to_strbuilder_fwd( CodeStruct self, StrBuilder* result ) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| StrBuilder template_to_strbuilder(CodeTemplate self) | ||||
| { | ||||
| 	GEN_ASSERT(self); | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 1024 ); | ||||
| 	template_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| void template_to_strbuilder_ref(CodeTemplate self, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(self); | ||||
| @@ -1176,13 +975,6 @@ void template_to_strbuilder_ref(CodeTemplate self, StrBuilder* result ) | ||||
| 		strbuilder_append_fmt( result, "template<>\n%SB", code_to_strbuilder(self->Declaration) ); | ||||
| } | ||||
|  | ||||
| StrBuilder typedef_to_strbuilder(CodeTypedef self) | ||||
| { | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 128 ); | ||||
| 	typedef_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| void typedef_to_strbuilder_ref(CodeTypedef self, StrBuilder* result ) | ||||
| { | ||||
| 	if ( bitfield_is_set( u32, self->ModuleFlags, ModuleFlag_Export )) | ||||
| @@ -1218,13 +1010,6 @@ void typedef_to_strbuilder_ref(CodeTypedef self, StrBuilder* result ) | ||||
| 		strbuilder_append_str( result, txt("\n")); | ||||
| } | ||||
|  | ||||
| StrBuilder typename_to_strbuilder(CodeTypename self) | ||||
| { | ||||
| 	StrBuilder result = strbuilder_make_str( _ctx->Allocator_Temp, txt("") ); | ||||
| 	typename_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| void typename_to_strbuilder_ref(CodeTypename self, StrBuilder* result ) | ||||
| { | ||||
| 	#if defined(GEN_USE_NEW_TYPENAME_PARSING) | ||||
| @@ -1346,22 +1131,6 @@ void union_to_strbuilder_fwd(CodeUnion self, StrBuilder* result ) | ||||
| 		strbuilder_append_str( result, txt(";\n")); | ||||
| } | ||||
|  | ||||
| StrBuilder using_to_strbuilder(CodeUsing self) | ||||
| { | ||||
| 	GEN_ASSERT(self); | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 128 ); | ||||
| 	switch ( self->Type ) | ||||
| 	{ | ||||
| 		case CT_Using: | ||||
| 			using_to_strbuilder_ref( self, & result ); | ||||
| 		break; | ||||
| 		case CT_Using_Namespace: | ||||
| 			using_to_strbuilder_ns( self, & result ); | ||||
| 		break; | ||||
| 	} | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| void using_to_strbuilder_ref(CodeUsing self, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(self); | ||||
| @@ -1399,26 +1168,6 @@ void using_to_strbuilder_ref(CodeUsing self, StrBuilder* result ) | ||||
| 		strbuilder_append_str( result, txt("\n")); | ||||
| } | ||||
|  | ||||
| inline | ||||
| void using_to_strbuilder_ns(CodeUsing self, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(self); | ||||
| 	GEN_ASSERT(result); | ||||
| 	if ( self->InlineCmt ) | ||||
| 		strbuilder_append_fmt( result, "using namespace $SC;  %S", self->Name, self->InlineCmt->Content ); | ||||
| 	else | ||||
| 		strbuilder_append_fmt( result, "using namespace %S;\n", self->Name ); | ||||
| } | ||||
|  | ||||
| inline | ||||
| StrBuilder var_to_strbuilder(CodeVar self) | ||||
| { | ||||
| 	GEN_ASSERT(self); | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 256 ); | ||||
| 	var_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| neverinline | ||||
| void var_to_strbuilder_ref(CodeVar self, StrBuilder* result ) | ||||
| { | ||||
|   | ||||
| @@ -23,47 +23,47 @@ GEN_API StrBuilder body_to_strbuilder       ( CodeBody body ); | ||||
| GEN_API void       body_to_strbuilder_ref   ( CodeBody body, StrBuilder* result ); | ||||
| GEN_API void       body_to_strbuilder_export( CodeBody body, StrBuilder* result ); | ||||
|  | ||||
| GEN_API Code begin_CodeBody( CodeBody body); | ||||
| GEN_API Code end_CodeBody  ( CodeBody body ); | ||||
| GEN_API Code next_CodeBody ( CodeBody body, Code entry_iter ); | ||||
| Code begin_CodeBody( CodeBody body); | ||||
| Code end_CodeBody  ( CodeBody body ); | ||||
| Code next_CodeBody ( CodeBody body, Code entry_iter ); | ||||
|  | ||||
| GEN_API void       class_add_interface    ( CodeClass self, CodeTypename interface ); | ||||
|         void       class_add_interface    ( CodeClass self, CodeTypename interface ); | ||||
| GEN_API StrBuilder class_to_strbuilder    ( CodeClass self ); | ||||
| GEN_API void       class_to_strbuilder_def( CodeClass self, StrBuilder* result ); | ||||
| GEN_API void       class_to_strbuilder_fwd( CodeClass self, StrBuilder* result ); | ||||
|  | ||||
| GEN_API void             define_params_append           (CodeDefineParams appendee, CodeDefineParams other ); | ||||
| GEN_API CodeDefineParams define_params_get              (CodeDefineParams params, s32 idx); | ||||
| GEN_API bool             define_params_has_entries      (CodeDefineParams params ); | ||||
|         void             define_params_append           (CodeDefineParams appendee, CodeDefineParams other ); | ||||
|         CodeDefineParams define_params_get              (CodeDefineParams params, s32 idx); | ||||
|         bool             define_params_has_entries      (CodeDefineParams params ); | ||||
| GEN_API StrBuilder       define_params_to_strbuilder    (CodeDefineParams params ); | ||||
| GEN_API void             define_params_to_strbuilder_ref(CodeDefineParams params, StrBuilder* result ); | ||||
|  | ||||
| GEN_API CodeDefineParams begin_CodeDefineParams(CodeDefineParams params); | ||||
| GEN_API CodeDefineParams end_CodeDefineParams  (CodeDefineParams params); | ||||
| GEN_API CodeDefineParams next_CodeDefineParams (CodeDefineParams params, CodeDefineParams entry_iter); | ||||
| CodeDefineParams begin_CodeDefineParams(CodeDefineParams params); | ||||
| CodeDefineParams end_CodeDefineParams  (CodeDefineParams params); | ||||
| CodeDefineParams next_CodeDefineParams (CodeDefineParams params, CodeDefineParams entry_iter); | ||||
|  | ||||
| GEN_API void       params_append           (CodeParams appendee, CodeParams other ); | ||||
| GEN_API CodeParams params_get              (CodeParams params, s32 idx); | ||||
| GEN_API bool       params_has_entries      (CodeParams params ); | ||||
|         void       params_append           (CodeParams appendee, CodeParams other ); | ||||
|         CodeParams params_get              (CodeParams params, s32 idx); | ||||
|         bool       params_has_entries      (CodeParams params ); | ||||
| GEN_API StrBuilder params_to_strbuilder    (CodeParams params ); | ||||
| GEN_API void       params_to_strbuilder_ref(CodeParams params, StrBuilder* result ); | ||||
|  | ||||
| GEN_API CodeParams begin_CodeParams(CodeParams params); | ||||
| GEN_API CodeParams end_CodeParams  (CodeParams params); | ||||
| GEN_API CodeParams next_CodeParams (CodeParams params, CodeParams entry_iter); | ||||
| CodeParams begin_CodeParams(CodeParams params); | ||||
| CodeParams end_CodeParams  (CodeParams params); | ||||
| CodeParams next_CodeParams (CodeParams params, CodeParams entry_iter); | ||||
|  | ||||
| GEN_API bool       specifiers_append           (CodeSpecifiers specifiers, Specifier spec); | ||||
| GEN_API bool       specifiers_has              (CodeSpecifiers specifiers, Specifier spec); | ||||
| GEN_API s32        specifiers_index_of         (CodeSpecifiers specifiers, Specifier spec); | ||||
| GEN_API s32        specifiers_remove           (CodeSpecifiers specifiers, Specifier to_remove ); | ||||
|         bool       specifiers_append           (CodeSpecifiers specifiers, Specifier spec); | ||||
|         bool       specifiers_has              (CodeSpecifiers specifiers, Specifier spec); | ||||
|         s32        specifiers_index_of         (CodeSpecifiers specifiers, Specifier spec); | ||||
|         s32        specifiers_remove           (CodeSpecifiers specifiers, Specifier to_remove ); | ||||
| GEN_API StrBuilder specifiers_to_strbuilder    (CodeSpecifiers specifiers); | ||||
| GEN_API void       specifiers_to_strbuilder_ref(CodeSpecifiers specifiers, StrBuilder* result); | ||||
|  | ||||
| GEN_API Specifier* begin_CodeSpecifiers(CodeSpecifiers specifiers); | ||||
| GEN_API Specifier* end_CodeSpecifiers  (CodeSpecifiers specifiers); | ||||
| GEN_API Specifier* next_CodeSpecifiers (CodeSpecifiers specifiers, Specifier* spec_iter); | ||||
| Specifier* begin_CodeSpecifiers(CodeSpecifiers specifiers); | ||||
| Specifier* end_CodeSpecifiers  (CodeSpecifiers specifiers); | ||||
| Specifier* next_CodeSpecifiers (CodeSpecifiers specifiers, Specifier* spec_iter); | ||||
|  | ||||
| GEN_API void       struct_add_interface    (CodeStruct self, CodeTypename interface); | ||||
|         void       struct_add_interface    (CodeStruct self, CodeTypename interface); | ||||
| GEN_API StrBuilder struct_to_strbuilder    (CodeStruct self); | ||||
| GEN_API void       struct_to_strbuilder_fwd(CodeStruct self, StrBuilder* result); | ||||
| GEN_API void       struct_to_strbuilder_def(CodeStruct self, StrBuilder* result); | ||||
| @@ -146,9 +146,9 @@ GEN_API void       union_to_strbuilder_fwd(CodeUnion self, StrBuilder* result); | ||||
|  | ||||
| GEN_API StrBuilder using_to_strbuilder    (CodeUsing op_cast ); | ||||
| GEN_API void       using_to_strbuilder_ref(CodeUsing op_cast, StrBuilder* result ); | ||||
| GEN_API void       using_to_strbuilder_ns (CodeUsing op_cast, StrBuilder* result ); | ||||
|         void       using_to_strbuilder_ns (CodeUsing op_cast, StrBuilder* result ); | ||||
|  | ||||
| GEN_API StrBuilder var_to_strbuilder    (CodeVar self); | ||||
|         StrBuilder var_to_strbuilder    (CodeVar self); | ||||
| GEN_API void       var_to_strbuilder_ref(CodeVar self, StrBuilder* result); | ||||
|  | ||||
| // TODO(Ed): Move C-Interface inlines here... | ||||
|   | ||||
							
								
								
									
										0
									
								
								base/components/constants.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								base/components/constants.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -3,86 +3,3 @@ | ||||
| #include "inlines.hpp" | ||||
| #include "gen/ast_inlines.hpp" | ||||
| #endif | ||||
|  | ||||
| #pragma region Constants | ||||
|  | ||||
| GEN_API extern Macro enum_underlying_macro; | ||||
|  | ||||
| GEN_API extern Code access_public; | ||||
| GEN_API extern Code access_protected; | ||||
| GEN_API extern Code access_private; | ||||
|  | ||||
| GEN_API extern CodeAttributes attrib_api_export; | ||||
| GEN_API extern CodeAttributes attrib_api_import; | ||||
|  | ||||
| GEN_API extern Code module_global_fragment; | ||||
| GEN_API extern Code module_private_fragment; | ||||
|  | ||||
| GEN_API extern Code fmt_newline; | ||||
|  | ||||
| GEN_API extern CodePragma pragma_once; | ||||
|  | ||||
| GEN_API extern CodeParams param_varadic; | ||||
|  | ||||
| GEN_API extern CodePreprocessCond preprocess_else; | ||||
| GEN_API extern CodePreprocessCond preprocess_endif; | ||||
|  | ||||
| GEN_API extern CodeSpecifiers spec_const; | ||||
| GEN_API extern CodeSpecifiers spec_consteval; | ||||
| GEN_API extern CodeSpecifiers spec_constexpr; | ||||
| GEN_API extern CodeSpecifiers spec_constinit; | ||||
| GEN_API extern CodeSpecifiers spec_extern_linkage; | ||||
| GEN_API extern CodeSpecifiers spec_final; | ||||
| GEN_API extern CodeSpecifiers spec_forceinline; | ||||
| GEN_API extern CodeSpecifiers spec_global; | ||||
| GEN_API extern CodeSpecifiers spec_inline; | ||||
| GEN_API extern CodeSpecifiers spec_internal_linkage; | ||||
| GEN_API extern CodeSpecifiers spec_local_persist; | ||||
| GEN_API extern CodeSpecifiers spec_mutable; | ||||
| GEN_API extern CodeSpecifiers spec_neverinline; | ||||
| GEN_API extern CodeSpecifiers spec_noexcept; | ||||
| GEN_API extern CodeSpecifiers spec_override; | ||||
| GEN_API extern CodeSpecifiers spec_ptr; | ||||
| GEN_API extern CodeSpecifiers spec_pure; | ||||
| GEN_API extern CodeSpecifiers spec_ref; | ||||
| GEN_API extern CodeSpecifiers spec_register; | ||||
| GEN_API extern CodeSpecifiers spec_rvalue; | ||||
| GEN_API extern CodeSpecifiers spec_static_member; | ||||
| GEN_API extern CodeSpecifiers spec_thread_local; | ||||
| GEN_API extern CodeSpecifiers spec_virtual; | ||||
| GEN_API extern CodeSpecifiers spec_volatile; | ||||
|  | ||||
| GEN_API extern CodeTypename t_empty; // Used with varaidc parameters. (Exposing just in case its useful for another circumstance) | ||||
| GEN_API extern CodeTypename t_auto; | ||||
| GEN_API extern CodeTypename t_void; | ||||
| GEN_API extern CodeTypename t_int; | ||||
| GEN_API extern CodeTypename t_bool; | ||||
| GEN_API extern CodeTypename t_char; | ||||
| GEN_API extern CodeTypename t_wchar_t; | ||||
| GEN_API extern CodeTypename t_class; | ||||
| GEN_API extern CodeTypename t_typename; | ||||
|  | ||||
| #ifdef GEN_DEFINE_LIBRARY_CODE_CONSTANTS | ||||
| 	// Predefined typename codes. Are set to readonly and are setup during gen::init() | ||||
| 	GEN_API extern Context* _ctx; | ||||
|  | ||||
| 	GEN_API extern CodeTypename t_b32; | ||||
|  | ||||
| 	GEN_API extern CodeTypename t_s8; | ||||
| 	GEN_API extern CodeTypename t_s16; | ||||
| 	GEN_API extern CodeTypename t_s32; | ||||
| 	GEN_API extern CodeTypename t_s64; | ||||
|  | ||||
| 	GEN_API extern CodeTypename t_u8; | ||||
| 	GEN_API extern CodeTypename t_u16; | ||||
| 	GEN_API extern CodeTypename t_u32; | ||||
| 	GEN_API extern CodeTypename t_u64; | ||||
|  | ||||
| 	GEN_API extern CodeTypename t_ssize; | ||||
| 	GEN_API extern CodeTypename t_usize; | ||||
|  | ||||
| 	GEN_API extern CodeTypename t_f32; | ||||
| 	GEN_API extern CodeTypename t_f64; | ||||
| #endif | ||||
|  | ||||
| #pragma endregion Constants | ||||
|   | ||||
| @@ -3,6 +3,285 @@ | ||||
| #include "interface.hpp" | ||||
| #endif | ||||
|  | ||||
| #pragma region Serialization | ||||
| inline | ||||
| StrBuilder attributes_to_strbuilder(CodeAttributes attributes) { | ||||
| 	GEN_ASSERT(attributes); | ||||
| 	char* raw = ccast(char*, str_duplicate( attributes->Content, get_context()->Allocator_Temp ).Ptr); | ||||
| 	StrBuilder result = { raw }; | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| inline | ||||
| void attributes_to_strbuilder_ref(CodeAttributes attributes, StrBuilder* result) { | ||||
| 	GEN_ASSERT(attributes); | ||||
| 	GEN_ASSERT(result); | ||||
| 	strbuilder_append_str(result, attributes->Content); | ||||
| } | ||||
|  | ||||
| inline | ||||
| StrBuilder comment_to_strbuilder(CodeComment comment) { | ||||
| 	GEN_ASSERT(comment); | ||||
| 	char* raw = ccast(char*, str_duplicate( comment->Content, get_context()->Allocator_Temp ).Ptr); | ||||
| 	StrBuilder result = { raw }; | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| inline | ||||
| void body_to_strbuilder_ref( CodeBody body, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(body   != nullptr); | ||||
| 	GEN_ASSERT(result != nullptr); | ||||
| 	Code curr = body->Front; | ||||
| 	s32  left = body->NumEntries; | ||||
| 	while ( left -- ) | ||||
| 	{ | ||||
| 		code_to_strbuilder_ptr(curr, result); | ||||
| 		// strbuilder_append_fmt( result, "%SB", code_to_strbuilder(curr) ); | ||||
| 		++curr; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| inline | ||||
| void comment_to_strbuilder_ref(CodeComment comment, StrBuilder* result) { | ||||
| 	GEN_ASSERT(comment); | ||||
| 	GEN_ASSERT(result); | ||||
| 	strbuilder_append_str(result, comment->Content); | ||||
| } | ||||
|  | ||||
| inline | ||||
| StrBuilder define_to_strbuilder(CodeDefine define) | ||||
| { | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 512 ); | ||||
| 	define_to_strbuilder_ref(define, & result); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| inline | ||||
| StrBuilder define_params_to_strbuilder(CodeDefineParams params) | ||||
| { | ||||
| 	GEN_ASSERT(params); | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 128 ); | ||||
| 	define_params_to_strbuilder_ref( params, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| inline | ||||
| StrBuilder exec_to_strbuilder(CodeExec exec) | ||||
| { | ||||
| 	GEN_ASSERT(exec); | ||||
| 	char* raw = ccast(char*, str_duplicate( exec->Content, _ctx->Allocator_Temp ).Ptr); | ||||
| 	StrBuilder result = { raw }; | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| inline | ||||
| void extern_to_strbuilder(CodeExtern self, StrBuilder* result ) | ||||
| { | ||||
| 	if ( self->Body ) | ||||
| 		strbuilder_append_fmt( result, "extern \"%S\"\n{\n%SB\n}\n", self->Name, body_to_strbuilder(self->Body) ); | ||||
| 	else | ||||
| 		strbuilder_append_fmt( result, "extern \"%S\"\n{}\n", self->Name ); | ||||
| } | ||||
|  | ||||
| inline | ||||
| StrBuilder include_to_strbuilder(CodeInclude include) | ||||
| { | ||||
| 	return strbuilder_fmt_buf( _ctx->Allocator_Temp, "#include %S\n", include->Content ); | ||||
| } | ||||
|  | ||||
| inline | ||||
| void include_to_strbuilder_ref( CodeInclude include, StrBuilder* result ) | ||||
| { | ||||
| 	strbuilder_append_fmt( result, "#include %S\n", include->Content ); | ||||
| } | ||||
|  | ||||
| inline | ||||
| StrBuilder friend_to_strbuilder(CodeFriend self) | ||||
| { | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 256 ); | ||||
| 	friend_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| inline | ||||
| void friend_to_strbuilder_ref(CodeFriend self, StrBuilder* result ) | ||||
| { | ||||
| 	strbuilder_append_fmt( result, "friend %SB", code_to_strbuilder(self->Declaration) ); | ||||
|  | ||||
| 	if ( self->Declaration->Type != CT_Function && self->Declaration->Type != CT_Operator && (* result)[ strbuilder_length(* result) - 1 ] != ';' ) | ||||
| 	{ | ||||
| 		strbuilder_append_str( result, txt(";") ); | ||||
| 	} | ||||
|  | ||||
| 	if ( self->InlineCmt ) | ||||
| 		strbuilder_append_fmt( result, "  %S", self->InlineCmt->Content ); | ||||
| 	else | ||||
| 		strbuilder_append_str( result, txt("\n")); | ||||
| } | ||||
|  | ||||
| inline | ||||
| StrBuilder module_to_strbuilder(CodeModule self) | ||||
| { | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 64 ); | ||||
| 	module_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| inline | ||||
| StrBuilder namespace_to_strbuilder(CodeNS self) | ||||
| { | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 512 ); | ||||
| 	namespace_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| inline | ||||
| void namespace_to_strbuilder_ref(CodeNS self, StrBuilder* result ) | ||||
| { | ||||
| 	if ( bitfield_is_set( u32, self->ModuleFlags, ModuleFlag_Export )) | ||||
| 		strbuilder_append_str( result, txt("export ") ); | ||||
|  | ||||
| 	strbuilder_append_fmt( result, "namespace %S\n{\n%SB\n}\n", self->Name, body_to_strbuilder(self->Body) ); | ||||
| } | ||||
|  | ||||
| inline | ||||
| StrBuilder params_to_strbuilder(CodeParams self) | ||||
| { | ||||
| 	GEN_ASSERT(self); | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 128 ); | ||||
| 	params_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| inline | ||||
| void preprocess_to_strbuilder_if(CodePreprocessCond cond, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(cond); | ||||
| 	strbuilder_append_fmt( result, "#if %S", cond->Content ); | ||||
| } | ||||
|  | ||||
| inline | ||||
| void preprocess_to_strbuilder_ifdef(CodePreprocessCond cond, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(cond); | ||||
| 	strbuilder_append_fmt( result, "#ifdef %S\n", cond->Content ); | ||||
| } | ||||
|  | ||||
| inline | ||||
| void preprocess_to_strbuilder_ifndef(CodePreprocessCond cond, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(cond); | ||||
| 	strbuilder_append_fmt( result, "#ifndef %S", cond->Content ); | ||||
| } | ||||
|  | ||||
| inline | ||||
| void preprocess_to_strbuilder_elif(CodePreprocessCond cond, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(cond); | ||||
| 	strbuilder_append_fmt( result, "#elif %S\n", cond->Content ); | ||||
| } | ||||
|  | ||||
| inline | ||||
| void preprocess_to_strbuilder_else(CodePreprocessCond cond, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(cond); | ||||
| 	strbuilder_append_str( result, txt("#else\n") ); | ||||
| } | ||||
|  | ||||
| inline | ||||
| void preprocess_to_strbuilder_endif(CodePreprocessCond cond, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(cond); | ||||
| 	strbuilder_append_str( result, txt("#endif\n") ); | ||||
| } | ||||
|  | ||||
| inline | ||||
| StrBuilder pragma_to_strbuilder(CodePragma self) | ||||
| { | ||||
| 	GEN_ASSERT(self); | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 256 ); | ||||
| 	pragma_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| inline | ||||
| void pragma_to_strbuilder_ref(CodePragma self, StrBuilder* result ) | ||||
| { | ||||
| 	strbuilder_append_fmt( result, "#pragma %S\n", self->Content ); | ||||
| } | ||||
|  | ||||
| inline | ||||
| StrBuilder specifiers_to_strbuilder(CodeSpecifiers self) | ||||
| { | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 64 ); | ||||
| 	specifiers_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| inline | ||||
| StrBuilder template_to_strbuilder(CodeTemplate self) | ||||
| { | ||||
| 	GEN_ASSERT(self); | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 1024 ); | ||||
| 	template_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| inline | ||||
| StrBuilder typedef_to_strbuilder(CodeTypedef self) | ||||
| { | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 128 ); | ||||
| 	typedef_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| inline | ||||
| StrBuilder typename_to_strbuilder(CodeTypename self) | ||||
| { | ||||
| 	StrBuilder result = strbuilder_make_str( _ctx->Allocator_Temp, txt("") ); | ||||
| 	typename_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| inline | ||||
| StrBuilder using_to_strbuilder(CodeUsing self) | ||||
| { | ||||
| 	GEN_ASSERT(self); | ||||
| 	StrBuilder result = strbuilder_make_reserve( _ctx->Allocator_Temp, 128 ); | ||||
| 	switch ( self->Type ) | ||||
| 	{ | ||||
| 		case CT_Using: | ||||
| 			using_to_strbuilder_ref( self, & result ); | ||||
| 		break; | ||||
| 		case CT_Using_Namespace: | ||||
| 			using_to_strbuilder_ns( self, & result ); | ||||
| 		break; | ||||
| 	} | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| inline | ||||
| void using_to_strbuilder_ns(CodeUsing self, StrBuilder* result ) | ||||
| { | ||||
| 	GEN_ASSERT(self); | ||||
| 	GEN_ASSERT(result); | ||||
| 	if ( self->InlineCmt ) | ||||
| 		strbuilder_append_fmt( result, "using namespace $S;  %S", self->Name, self->InlineCmt->Content ); | ||||
| 	else | ||||
| 		strbuilder_append_fmt( result, "using namespace %S;\n", self->Name ); | ||||
| } | ||||
|  | ||||
| inline | ||||
| StrBuilder var_to_strbuilder(CodeVar self) | ||||
| { | ||||
| 	GEN_ASSERT(self); | ||||
| 	StrBuilder result = strbuilder_make_reserve( get_context()->Allocator_Temp, 256 ); | ||||
| 	var_to_strbuilder_ref( self, & result ); | ||||
| 	return result; | ||||
| } | ||||
| #pragma endregion Serialization | ||||
|  | ||||
| #pragma region Code | ||||
| inline | ||||
| void code_append( Code self, Code other ) | ||||
|   | ||||
| @@ -99,6 +99,11 @@ struct Context | ||||
| 	s32 temp_serialize_indent; | ||||
| }; | ||||
|  | ||||
| // TODO(Ed): Eventually this library should opt out of an implicit context for baseline implementation | ||||
| // This would automatically make it viable for multi-threaded purposes among other things | ||||
| // An implicit context interface will be provided instead as wrapper procedures as convience. | ||||
| GEN_API extern Context* _ctx; | ||||
|  | ||||
| // Initialize the library. There first ctx initialized must exist for lifetime of other contextes that come after as its the one that | ||||
| GEN_API void init(Context* ctx); | ||||
|  | ||||
| @@ -194,7 +199,7 @@ GEN_API CodeEnum def_enum( Str name, Opts_def_enum opts GEN_PARAM_DEFAULT ); | ||||
|  | ||||
| GEN_API CodeExec   def_execution  ( Str content ); | ||||
| GEN_API CodeExtern def_extern_link( Str name, CodeBody body ); | ||||
| GEN_API CodeFriend def_friend     ( Code symbol ); | ||||
| GEN_API CodeFriend def_friend     ( Code code ); | ||||
|  | ||||
| struct Opts_def_function { | ||||
| 	CodeParams      params; | ||||
| @@ -230,7 +235,7 @@ struct Opts_def_operator_cast { | ||||
| GEN_API CodeOpCast def_operator_cast( CodeTypename type, Opts_def_operator_cast opts GEN_PARAM_DEFAULT ); | ||||
|  | ||||
| struct Opts_def_param { Code value; }; | ||||
| GEN_API CodeParams  def_param ( CodeTypename type, Str name, Opts_def_param opts GEN_PARAM_DEFAULT ); | ||||
| GEN_API CodeParams def_param ( CodeTypename type, Str name, Opts_def_param opts GEN_PARAM_DEFAULT ); | ||||
| GEN_API CodePragma def_pragma( Str directive ); | ||||
|  | ||||
| GEN_API CodePreprocessCond def_preprocess_cond( EPreprocessCond type, Str content ); | ||||
| @@ -244,7 +249,7 @@ GEN_API CodeTemplate def_template( CodeParams params, Code definition, Opts_def_ | ||||
|  | ||||
| struct Opts_def_type { | ||||
| 	ETypenameTag   type_tag; | ||||
| 	Code           arrayexpr; | ||||
| 	Code           array_expr; | ||||
| 	CodeSpecifiers specifiers; | ||||
| 	CodeAttributes attributes; | ||||
| }; | ||||
| @@ -469,3 +474,84 @@ So the full call for this example would be: | ||||
| #pragma endregion Macros | ||||
|  | ||||
| #pragma endregion Gen Interface | ||||
|  | ||||
| #pragma region Constants | ||||
| // Predefined typename codes. Are set to readonly and are setup during gen::init() | ||||
|  | ||||
| GEN_API extern Macro enum_underlying_macro; | ||||
|  | ||||
| GEN_API extern Code access_public; | ||||
| GEN_API extern Code access_protected; | ||||
| GEN_API extern Code access_private; | ||||
|  | ||||
| GEN_API extern CodeAttributes attrib_api_export; | ||||
| GEN_API extern CodeAttributes attrib_api_import; | ||||
|  | ||||
| GEN_API extern Code module_global_fragment; | ||||
| GEN_API extern Code module_private_fragment; | ||||
|  | ||||
| GEN_API extern Code fmt_newline; | ||||
|  | ||||
| GEN_API extern CodePragma pragma_once; | ||||
|  | ||||
| GEN_API extern CodeParams param_varadic; | ||||
|  | ||||
| GEN_API extern CodePreprocessCond preprocess_else; | ||||
| GEN_API extern CodePreprocessCond preprocess_endif; | ||||
|  | ||||
| GEN_API extern CodeSpecifiers spec_const; | ||||
| GEN_API extern CodeSpecifiers spec_consteval; | ||||
| GEN_API extern CodeSpecifiers spec_constexpr; | ||||
| GEN_API extern CodeSpecifiers spec_constinit; | ||||
| GEN_API extern CodeSpecifiers spec_extern_linkage; | ||||
| GEN_API extern CodeSpecifiers spec_final; | ||||
| GEN_API extern CodeSpecifiers spec_forceinline; | ||||
| GEN_API extern CodeSpecifiers spec_global; | ||||
| GEN_API extern CodeSpecifiers spec_inline; | ||||
| GEN_API extern CodeSpecifiers spec_internal_linkage; | ||||
| GEN_API extern CodeSpecifiers spec_local_persist; | ||||
| GEN_API extern CodeSpecifiers spec_mutable; | ||||
| GEN_API extern CodeSpecifiers spec_neverinline; | ||||
| GEN_API extern CodeSpecifiers spec_noexcept; | ||||
| GEN_API extern CodeSpecifiers spec_override; | ||||
| GEN_API extern CodeSpecifiers spec_ptr; | ||||
| GEN_API extern CodeSpecifiers spec_pure; | ||||
| GEN_API extern CodeSpecifiers spec_ref; | ||||
| GEN_API extern CodeSpecifiers spec_register; | ||||
| GEN_API extern CodeSpecifiers spec_rvalue; | ||||
| GEN_API extern CodeSpecifiers spec_static_member; | ||||
| GEN_API extern CodeSpecifiers spec_thread_local; | ||||
| GEN_API extern CodeSpecifiers spec_virtual; | ||||
| GEN_API extern CodeSpecifiers spec_volatile; | ||||
|  | ||||
| GEN_API extern CodeTypename t_empty; // Used with varaidc parameters. (Exposing just in case its useful for another circumstance) | ||||
| GEN_API extern CodeTypename t_auto; | ||||
| GEN_API extern CodeTypename t_void; | ||||
| GEN_API extern CodeTypename t_int; | ||||
| GEN_API extern CodeTypename t_bool; | ||||
| GEN_API extern CodeTypename t_char; | ||||
| GEN_API extern CodeTypename t_wchar_t; | ||||
| GEN_API extern CodeTypename t_class; | ||||
| GEN_API extern CodeTypename t_typename; | ||||
|  | ||||
| #ifdef GEN_DEFINE_LIBRARY_CODE_CONSTANTS | ||||
| 	GEN_API extern CodeTypename t_b32; | ||||
|  | ||||
| 	GEN_API extern CodeTypename t_s8; | ||||
| 	GEN_API extern CodeTypename t_s16; | ||||
| 	GEN_API extern CodeTypename t_s32; | ||||
| 	GEN_API extern CodeTypename t_s64; | ||||
|  | ||||
| 	GEN_API extern CodeTypename t_u8; | ||||
| 	GEN_API extern CodeTypename t_u16; | ||||
| 	GEN_API extern CodeTypename t_u32; | ||||
| 	GEN_API extern CodeTypename t_u64; | ||||
|  | ||||
| 	GEN_API extern CodeTypename t_ssize; | ||||
| 	GEN_API extern CodeTypename t_usize; | ||||
|  | ||||
| 	GEN_API extern CodeTypename t_f32; | ||||
| 	GEN_API extern CodeTypename t_f64; | ||||
| #endif | ||||
|  | ||||
| #pragma endregion Constants | ||||
|   | ||||
| @@ -1114,7 +1114,7 @@ CodeTypename def_type( Str name, Opts_def_type p ) | ||||
| 		GEN_DEBUG_TRAP(); | ||||
| 		return InvalidCode; | ||||
| 	} | ||||
| 	Code           arrayexpr  = p.arrayexpr; | ||||
| 	Code           array_expr = p.array_expr; | ||||
| 	CodeSpecifiers specifiers = p.specifiers; | ||||
| 	CodeAttributes attributes = p.attributes; | ||||
| 	if ( p.attributes && p.attributes->Type != CT_PlatformAttributes ) { | ||||
| @@ -1127,8 +1127,8 @@ CodeTypename def_type( Str name, Opts_def_type p ) | ||||
| 		GEN_DEBUG_TRAP(); | ||||
| 		return InvalidCode; | ||||
| 	} | ||||
| 	if ( p.arrayexpr && p.arrayexpr->Type != CT_Untyped ) { | ||||
| 		log_failure( "gen::def_type: arrayexpr is not of untyped type - %s", code_debug_str((Code)p.arrayexpr) ); | ||||
| 	if ( p.array_expr && p.array_expr->Type != CT_Untyped ) { | ||||
| 		log_failure( "gen::def_type: arrayexpr is not of untyped type - %s", code_debug_str((Code)p.array_expr) ); | ||||
| 		GEN_DEBUG_TRAP(); | ||||
| 		return InvalidCode; | ||||
| 	} | ||||
| @@ -1138,7 +1138,7 @@ CodeTypename def_type( Str name, Opts_def_type p ) | ||||
| 	result->Type       = CT_Typename; | ||||
| 	result->Attributes = p.attributes; | ||||
| 	result->Specs      = p.specifiers; | ||||
| 	result->ArrExpr    = p.arrayexpr; | ||||
| 	result->ArrExpr    = p.array_expr; | ||||
| 	result->TypeTag    = p.type_tag; | ||||
| 	return result; | ||||
| } | ||||
|   | ||||
| @@ -84,7 +84,7 @@ void heap_stats_check( void ) | ||||
| typedef struct _heap_alloc_info _heap_alloc_info; | ||||
| struct _heap_alloc_info | ||||
| { | ||||
| 	ssize    size; | ||||
| 	ssize size; | ||||
| 	void* physical_start; | ||||
| }; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user