mirror of
				https://github.com/Ed94/gencpp.git
				synced 2025-10-31 06:50:53 -07:00 
			
		
		
		
	progress on c_library.cpp
This commit is contained in:
		| @@ -6,6 +6,7 @@ using namespace gen; | ||||
| CodeBody gen_fixed_arenas() | ||||
| { | ||||
| 	CodeBody result = def_body(ECode::Global_Body); | ||||
| 	result.append(def_pragma(txt("region FixedArena"))); | ||||
|  | ||||
| 	char const* template_struct = stringize( | ||||
| 		struct FixedArena_<Name> | ||||
| @@ -115,5 +116,7 @@ CodeBody gen_fixed_arenas() | ||||
| )" | ||||
| 	))); | ||||
|  | ||||
| 	result.append(def_pragma(txt("endregion FixedArena"))); | ||||
|  | ||||
| 	return result; | ||||
| } | ||||
|   | ||||
| @@ -11,7 +11,7 @@ b32 ignore_preprocess_cond_block( StrC cond_sig, Code& entry_iter, CodeBody& bod | ||||
| 	if ( cond->Content.contains(cond_sig) ) | ||||
| 	{ | ||||
| 		s32 depth = 1; | ||||
| 		++ entry_iter; for(b32 continue_for = true; continue_for && entry_iter != body.end(); ++ entry_iter) switch | ||||
| 		++ entry_iter; for(b32 continue_for = true; continue_for && entry_iter != body.end(); ) switch | ||||
| 		(entry_iter->Type) { | ||||
| 			case ECode::Preprocess_If: | ||||
| 			case ECode::Preprocess_IfDef: | ||||
| @@ -24,24 +24,30 @@ b32 ignore_preprocess_cond_block( StrC cond_sig, Code& entry_iter, CodeBody& bod | ||||
| 				depth --; | ||||
| 				if (depth == 0) { | ||||
| 					continue_for = false; | ||||
| 					break; | ||||
| 				} | ||||
| 			} | ||||
| 			break; | ||||
| 			default: | ||||
| 				++ entry_iter; | ||||
| 			break; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	return entry_iter != body.end(); | ||||
| } | ||||
|  | ||||
| void swap_pragma_region_implementation( StrC region_name, SwapContentProc* swap_content, Code& entry_iter, CodeBody& body ) | ||||
| bool swap_pragma_region_implementation( StrC region_name, SwapContentProc* swap_content, Code& entry_iter, CodeBody& body ) | ||||
| { | ||||
| 	bool found = false; | ||||
| 	CodePragma possible_region = entry_iter.cast<CodePragma>(); | ||||
|  | ||||
| 	String region_sig    = string_fmt_buf(GlobalAllocator, "region %s",    region_name.Ptr); | ||||
| 	String endregion_sig = string_fmt_buf(GlobalAllocator, "endregion %s", region_name.Ptr); | ||||
| 	if ( possible_region->Content.contains(region_sig)) | ||||
| 	{ | ||||
| 		body.append(possible_region); | ||||
| 		found = true; | ||||
| 		// body.append(possible_region); | ||||
| 		body.append(swap_content()); | ||||
|  | ||||
| 		++ entry_iter; for(b32 continue_for = true; continue_for; ++entry_iter) switch | ||||
| @@ -50,12 +56,13 @@ void swap_pragma_region_implementation( StrC region_name, SwapContentProc* swap_ | ||||
| 			{ | ||||
| 				CodePragma possible_end_region = entry_iter.cast<CodePragma>(); | ||||
| 				if ( possible_end_region->Content.contains(endregion_sig) ) { | ||||
| 					body.append(possible_end_region); | ||||
| 					// body.append(possible_end_region); | ||||
| 					continue_for = false; | ||||
| 				} | ||||
| 			} | ||||
| 			break; | ||||
| 		} | ||||
| 		body.append(entry_iter); | ||||
| 	} | ||||
| 	body.append(entry_iter); | ||||
| 	return found; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user