mirror of
https://github.com/Ed94/metadesk.git
synced 2026-08-05 15:18:46 +00:00
attempting to do a parse on stb_sprintf.h for segregated
This commit is contained in:
@@ -27,6 +27,10 @@ namespace OS_, MD_OS_
|
||||
|
||||
word HAS_ATTRIBUTE, MD_HAS_ATTRIBUTE
|
||||
|
||||
// base/platform.h
|
||||
|
||||
include assert, assert
|
||||
|
||||
// base/linkage.h
|
||||
|
||||
word global, md_global
|
||||
@@ -1094,6 +1098,8 @@ namespace FilePropertyFlag_, MD_FilePropertyFlag_
|
||||
namespace OS_, MD_OS_
|
||||
namespace os_, md_os_
|
||||
|
||||
word os_ctx, os_ctx
|
||||
|
||||
namespace entry_point, md_entry_point
|
||||
|
||||
// metadesk module
|
||||
@@ -1168,6 +1174,12 @@ word parse_from_text, md_parse_from_text
|
||||
namespace debug_string_list_from_tree_, md_debug_string_list_from_tree_
|
||||
word debug_string_list_from_tree, md_debug_string_list_from_tree
|
||||
|
||||
word ParseWorkKind, MD_ParseWorkKind
|
||||
word ParseWorkNode, MD_ParseWorkNode
|
||||
|
||||
word parse__work_push, md_parse__work_push
|
||||
word parse__work_pop, md_parse__work_pop
|
||||
|
||||
// metagen module
|
||||
|
||||
|
||||
|
||||
+22
-6
@@ -22,6 +22,8 @@ gen_Code refactor_and_format( gen_Code code ) {
|
||||
int main()
|
||||
{
|
||||
gen_Context ctx = {0};
|
||||
ctx.InitSize_MacrosTable = gen_kilobytes(64);
|
||||
ctx.InitSize_StrCacheTable = gen_kilobytes(64);
|
||||
gen_init(& ctx);
|
||||
|
||||
register_library_macros();
|
||||
@@ -84,7 +86,7 @@ int main()
|
||||
|
||||
gen_Code mdesk_h = gen_scan_file(path_mdesk "mdesk.h");
|
||||
|
||||
gen_Code base_platfom_c = gen_scan_file(path_base "platform.c");
|
||||
gen_Code base_platform_c = gen_scan_file(path_base "platform.c");
|
||||
gen_Code base_debug_c = gen_scan_file(path_base "debug.c");
|
||||
gen_Code base_memory_substrate_c = gen_scan_file(path_base "memory_substrate.c");
|
||||
gen_Code base_arena_c = gen_scan_file(path_base "arena.c");
|
||||
@@ -140,7 +142,7 @@ int main()
|
||||
|
||||
gen_Code r_mdesk_h = refactor_and_format(mdesk_h);
|
||||
|
||||
gen_Code r_base_platform_c = refactor(base_platfom_c);
|
||||
gen_Code r_base_platform_c = refactor(base_platform_c);
|
||||
gen_Code r_base_debug_c = refactor(base_debug_c);
|
||||
gen_Code r_base_memory_substrate_c = refactor(base_memory_substrate_c);
|
||||
gen_Code r_base_arena_c = refactor(base_arena_c);
|
||||
@@ -158,6 +160,7 @@ int main()
|
||||
gen_Code r_os_c = refactor(os_os_c);
|
||||
|
||||
gen_Code r_mdesk_c = refactor_and_format(mdesk_c);
|
||||
|
||||
#pragma endregion Refactored / Formatted
|
||||
|
||||
if (GENERATE_SINGLEHEADER)
|
||||
@@ -295,6 +298,7 @@ int main()
|
||||
new_line();
|
||||
|
||||
print_section(r_base_platform_c, lit("Platform"));
|
||||
print_section(r_base_debug_c, lit("Debug"));
|
||||
print_section(r_base_memory_substrate_c, lit("Memory Substrate"));
|
||||
print_section(r_base_arena_c, lit("Arena"));
|
||||
print_section(r_base_strings_c, lit("Strings"));
|
||||
@@ -344,6 +348,20 @@ int main()
|
||||
|
||||
if (GENERATE_SEGEREGATED)
|
||||
{
|
||||
gen_CodeBody tb_stb_printf_h_parsed = gen_parse_file(path_third_party "stb/stb_sprintf.h");
|
||||
gen_CodeBody tb_stb_printf_header = gen_def_body(CT_Global_Body);
|
||||
gen_CodeBody tb_stb_printf_source = gen_def_body(CT_Global_Body);
|
||||
|
||||
for (gen_Code stb_code = gen_iterator(CodeBody, tb_stb_printf_h_parsed, stb_code)) switch(stb_code->Type)
|
||||
{
|
||||
case CT_Preprocess_Define:
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// Dependencies
|
||||
|
||||
#define builder header_deps
|
||||
@@ -447,10 +465,7 @@ int main()
|
||||
include(lit("metadesk_deps.h"));
|
||||
|
||||
print(r_mdesk_h);
|
||||
|
||||
print(banner_mdesk);
|
||||
new_line(); new_line();
|
||||
|
||||
new_line();
|
||||
gen_builder_write(header);
|
||||
#undef builder
|
||||
|
||||
@@ -479,6 +494,7 @@ int main()
|
||||
new_line();
|
||||
|
||||
print_section(r_base_platform_c, lit("Platform"));
|
||||
print_section(r_base_debug_c, lit("Debug"));
|
||||
print_section(r_base_memory_substrate_c, lit("Memory Substrate"));
|
||||
print_section(r_base_arena_c, lit("Arena"));
|
||||
print_section(r_base_strings_c, lit("Strings"));
|
||||
|
||||
+52
-1
@@ -26,6 +26,11 @@
|
||||
#define path_scratch_file path_gen "scratch.h"
|
||||
#define path_format_style path_bin ".clang-format "
|
||||
|
||||
#define gen_iterator( Type, container, iter ) \
|
||||
gen_begin_ ## Type(container); \
|
||||
iter != gen_end_ ## Type(container); \
|
||||
iter = gen_next_ ## Type(container, iter)
|
||||
|
||||
// Codegen DSL
|
||||
|
||||
#define lit gen_txt
|
||||
@@ -61,6 +66,53 @@ void print__section(gen_Builder* builder, gen_Code code, gen_Str label) {
|
||||
|
||||
void register_library_macros()
|
||||
{
|
||||
// third_party/stb/stb_sprintf.h
|
||||
gen_register_macros( args(
|
||||
((gen_Macro) { lit("STB_SPRINTF_H_INCLUDE"), MT_Statement, }),
|
||||
((gen_Macro) { lit("STBSP__ASAN"), MT_Statement, }),
|
||||
((gen_Macro) { lit("STBSP__PUBLICDEC"), MT_Statement, MF_Allow_As_Attribute }),
|
||||
((gen_Macro) { lit("STBSP__ATTRIBUTE_FORMAT"), MT_Statement, MF_Functional | MF_Allow_As_Attribute }),
|
||||
((gen_Macro) { lit("STBSP__NOTUSED"), MT_Expression, MF_Functional | MF_Allow_As_Attribute }),
|
||||
((gen_Macro) { lit("STBSP__NOTUSED"), MT_Expression, MF_Functional }),
|
||||
((gen_Macro) { lit("STB_SPRINTF_MIN"), MT_Expression, MF_Allow_As_Identifier }),
|
||||
((gen_Macro) { lit("STB_SPRINTF_DECORATE"), MT_Expression, MF_Functional | MF_Allow_As_Identifier }),
|
||||
((gen_Macro) { lit("stbsp__uint32"), MT_Expression, }),
|
||||
((gen_Macro) { lit("stbsp__int32"), MT_Expression, }),
|
||||
((gen_Macro) { lit("stbsp__uint64"), MT_Expression, }),
|
||||
((gen_Macro) { lit("stbsp__int64"), MT_Expression, }),
|
||||
((gen_Macro) { lit("stbsp__uint16"), MT_Expression, }),
|
||||
((gen_Macro) { lit("stbsp__uintptr"), MT_Expression, }),
|
||||
((gen_Macro) { lit("STB_SPRINTF_MSVC_MODE"), MT_Expression, }),
|
||||
((gen_Macro) { lit("STBSP__PUBLICDEF"), MT_Expression, }),
|
||||
((gen_Macro) { lit("STBSP__UNALIGNED"), MT_Expression, MF_Functional }),
|
||||
((gen_Macro) { lit("STBSP__SPECIAL"), MT_Expression, }),
|
||||
((gen_Macro) { lit("STBSP__LEFTJUST"), MT_Expression, }),
|
||||
((gen_Macro) { lit("STBSP__LEADINGPLUS"), MT_Expression, }),
|
||||
((gen_Macro) { lit("STBSP__LEADINGSPACE"), MT_Expression, }),
|
||||
((gen_Macro) { lit("STBSP__LEADING_0X"), MT_Expression, }),
|
||||
((gen_Macro) { lit("STBSP__LEADINGZERO"), MT_Expression, }),
|
||||
((gen_Macro) { lit("STBSP__INTMAX"), MT_Expression, }),
|
||||
((gen_Macro) { lit("STBSP__TRIPLET_COMMA"), MT_Expression, }),
|
||||
((gen_Macro) { lit("STBSP__NEGATIVE"), MT_Expression, }),
|
||||
((gen_Macro) { lit("STBSP__METRIC_SUFFIX"), MT_Expression, }),
|
||||
((gen_Macro) { lit("STBSP__HALFWIDTH"), MT_Expression, }),
|
||||
((gen_Macro) { lit("STBSP__METRIC_NOSPACE"), MT_Expression, }),
|
||||
((gen_Macro) { lit("STBSP__METRIC_1024"), MT_Expression, }),
|
||||
((gen_Macro) { lit("STBSP__METRIC_JEDEC"), MT_Expression, }),
|
||||
((gen_Macro) { lit("stbsp__chk_cb_bufL"), MT_Expression, MF_Functional }),
|
||||
((gen_Macro) { lit("stbsp__chk_cb_buf"), MT_Expression, MF_Functional }),
|
||||
((gen_Macro) { lit("stbsp__flush_cb"), MT_Expression, MF_Functional }),
|
||||
((gen_Macro) { lit("stbsp__cb_buf_clamp"), MT_Expression, MF_Functional }),
|
||||
((gen_Macro) { lit("STBSP__NUMSZ"), MT_Expression, }),
|
||||
((gen_Macro) { lit("STBSP__COPYFP"), MT_Expression, MF_Functional }),
|
||||
((gen_Macro) { lit("stbsp__tento19th"), MT_Expression, MF_Functional }),
|
||||
((gen_Macro) { lit("stbsp__ddmulthi"), MT_Expression, MF_Functional }),
|
||||
((gen_Macro) { lit("stbsp__ddrenorm"), MT_Expression, MF_Functional }),
|
||||
((gen_Macro) { lit("stbsp__ddmultlo"), MT_Expression, MF_Functional }),
|
||||
((gen_Macro) { lit("stbsp__ddmultlos"), MT_Expression, MF_Functional }),
|
||||
((gen_Macro) { lit("stbsp__ddtoS64"), MT_Expression, MF_Functional })
|
||||
));
|
||||
|
||||
// These in the same order as metadesk.h
|
||||
|
||||
// base/context_cracking.h
|
||||
@@ -578,7 +630,6 @@ void register_library_macros()
|
||||
gen_register_macro((gen_Macro) { lit("quick_sort"), MT_Expression, MF_Functional });
|
||||
// base/strings.h
|
||||
gen_register_macros(args(
|
||||
((gen_Macro) { lit("STB_SPRINTF_DECORATE"), MT_Expression, MF_Functional }),
|
||||
((gen_Macro) { lit("cstring_length"), MT_Expression, MF_Functional }),
|
||||
((gen_Macro) { lit("str8_lit"), MT_Expression, MF_Functional }),
|
||||
((gen_Macro) { lit("str8_lit_comp"), MT_Expression, MF_Functional }),
|
||||
|
||||
Reference in New Issue
Block a user