diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..d2871691 Binary files /dev/null and b/.DS_Store differ diff --git a/build.bat b/build.bat index 9c47c1af..773c5089 100644 --- a/build.bat +++ b/build.bat @@ -9,7 +9,7 @@ SET BUILD_MODE=%1 if "%BUILD_MODE%" == "" (SET BUILD_MODE="/DDEV_BUILD") pushd ..\build -cl %OPTS% kernel32.lib ..\code\meta\build.cpp /Zi /Febuild %BUILD_MODE% +cl %OPTS% kernel32.lib ..\code\meta\4ed_build.cpp /Zi /Febuild %BUILD_MODE% if %ERRORLEVEL% neq 0 (set FirstError=1) if %ERRORLEVEL% neq 0 (goto END) popd diff --git a/build.sh b/build.sh index e4ee756b..10c61be5 100755 --- a/build.sh +++ b/build.sh @@ -39,7 +39,7 @@ fi FLAGS="-D_GNU_SOURCE -fPIC -fpermissive $BUILD_MODE" # Execute -g++ $WARNINGS $FLAGS $CODE_HOME/meta/build.cpp -g -o ../build/build +g++ $WARNINGS $FLAGS $CODE_HOME/meta/4ed_build.cpp -g -o ../build/build ../build/build diff --git a/meta/.DS_Store b/meta/.DS_Store new file mode 100644 index 00000000..05640d8b Binary files /dev/null and b/meta/.DS_Store differ diff --git a/meta/build.cpp b/meta/4ed_build.cpp similarity index 98% rename from meta/build.cpp rename to meta/4ed_build.cpp index 327426e8..ec17efd9 100644 --- a/meta/build.cpp +++ b/meta/4ed_build.cpp @@ -419,7 +419,7 @@ build(u32 flags, u32 arch, char *code_path, char *code_file, char *out_path, cha static void site_build(char *cdir, u32 flags){ { - char *file = fm_str("site/sitegen.cpp"); + char *file = fm_str("site/4ed_sitegen.cpp"); char *dir = fm_str(BUILD_DIR); BEGIN_TIME_SECTION(); build(OPTS | flags, Arch_X64, cdir, file, dir, "sitegen", get_defines_from_flags(flags), 0, includes); @@ -460,7 +460,7 @@ build_and_run(char *cdir, char *filename, char *name, u32 flags){ static void fsm_generator(char *cdir){ - build_and_run(cdir, "meta/fsm_table_generator.cpp", "fsmgen", OPTS | DEBUG_INFO); + build_and_run(cdir, "meta/4ed_fsm_table_generator.cpp", "fsmgen", OPTS | DEBUG_INFO); } static void @@ -568,7 +568,7 @@ package(char *cdir){ char *tier = tiers[tier_index]; u32 flags = base_flags | tier_flags[tier_index]; - Temp_Memory temp = fm_begin_temp(); + String_Temp temp = fm_begin_temp(); char *tier_package_root = fm_str(base_package_root, "_", tier); for (u32 arch = 0; arch < Arch_COUNT; ++arch){ char *par_dir = fm_str(tier_package_root, "_", arch_names[arch]); @@ -622,7 +622,7 @@ package(char *cdir){ // NOTE(allen): power { - Temp_Memory temp = fm_begin_temp(); + String_Temp temp = fm_begin_temp(); char *pack_power_par_dir = fm_str("../current_dist_power"); char *pack_power_dir = fm_str(pack_power_par_dir, "/power"); diff --git a/meta/4ed_file_moving.h b/meta/4ed_file_moving.h index 8ed07b3c..a9105a55 100644 --- a/meta/4ed_file_moving.h +++ b/meta/4ed_file_moving.h @@ -76,9 +76,9 @@ internal char **fm_prepare_list_internal(char **l1, ...); internal char **fm_list_one_item(char *item); // File System Navigation -typedef umem Temp_Memory; -internal Temp_Memory fm_begin_temp(); -internal void fm_end_temp(Temp_Memory temp); +typedef umem String_Temp; +internal String_Temp fm_begin_temp(); +internal void fm_end_temp(String_Temp temp); internal i32 fm_get_current_directory(char *buffer, i32 max); @@ -186,13 +186,13 @@ fm__init_memory(){ fm_arena_memory = (char*)malloc(fm_arena_max); } -internal Temp_Memory +internal String_Temp fm_begin_temp(){ return(fm_arena_pos); } internal void -fm_end_temp(Temp_Memory temp){ +fm_end_temp(String_Temp temp){ fm_arena_pos = temp; } diff --git a/meta/fsm_table_generator.cpp b/meta/4ed_fsm_table_generator.cpp similarity index 100% rename from meta/fsm_table_generator.cpp rename to meta/4ed_fsm_table_generator.cpp diff --git a/meta/meta_parser.cpp b/meta/4ed_meta_parser.cpp similarity index 100% rename from meta/meta_parser.cpp rename to meta/4ed_meta_parser.cpp diff --git a/meta/4ed_metagen.cpp b/meta/4ed_metagen.cpp index b7ddc884..6dcf33fa 100644 --- a/meta/4ed_metagen.cpp +++ b/meta/4ed_metagen.cpp @@ -28,8 +28,8 @@ #include #include -#include "meta_parser.cpp" -#include "out_context.cpp" +#include "4ed_meta_parser.cpp" +#include "4ed_out_context.cpp" ////////////////////////////////////////////////////////////////////////////////////////////////// char *keys_that_need_codes[] = { diff --git a/meta/out_context.cpp b/meta/4ed_out_context.cpp similarity index 100% rename from meta/out_context.cpp rename to meta/4ed_out_context.cpp diff --git a/site/.DS_Store b/site/.DS_Store new file mode 100644 index 00000000..d8dfa096 Binary files /dev/null and b/site/.DS_Store differ diff --git a/site/abstract_document.cpp b/site/4ed_abstract_document.cpp similarity index 100% rename from site/abstract_document.cpp rename to site/4ed_abstract_document.cpp diff --git a/site/sitegen.cpp b/site/4ed_sitegen.cpp similarity index 97% rename from site/sitegen.cpp rename to site/4ed_sitegen.cpp index 8520aa4f..69a3f57a 100644 --- a/site/sitegen.cpp +++ b/site/4ed_sitegen.cpp @@ -23,15 +23,16 @@ #include "../4ed_defines.h" #include "../meta/4ed_meta_defines.h" + #include "../4coder_API/version.h" #define FSTRING_IMPLEMENTATION #include "../4coder_lib/4coder_string.h" #include "../4coder_lib/4coder_mem.h" #include "../4cpp/4cpp_lexer.h" -#include "../meta/meta_parser.cpp" -#include "../meta/out_context.cpp" -#include "abstract_document.cpp" +#include "../meta/4ed_meta_parser.cpp" +#include "../meta/4ed_out_context.cpp" +#include "4ed_abstract_document.cpp" /////////////////////////////////////////////////////////////////////////// @@ -87,14 +88,6 @@ print_function_body_code(String *out, Parse_Context *context, i32 start){ } } -static Alternate_Names_Array -allocate_app_api(Partition *part, i32 count){ - Alternate_Names_Array app_api = {0}; - app_api.names = push_array(part, Alternate_Name, count); - memset(app_api.names, 0, sizeof(Alternate_Name)*count); - return(app_api); -} - static void do_html_output(Document_System *doc_system, Partition *part, char *dst_directory, Abstract_Item *doc){ // NOTE(allen): Output @@ -155,8 +148,6 @@ generate_4coder_docs(Document_System *doc_system, Partition *part, char *code_di Meta_Unit *string_unit = push_struct(part, Meta_Unit); Meta_Unit *custom_funcs_unit = push_struct(part, Meta_Unit); - Alternate_Names_Array *custom_func_names = push_struct(part, Alternate_Names_Array); - Enriched_Text *introduction = push_struct(part, Enriched_Text); Enriched_Text *lexer_introduction = push_struct(part, Enriched_Text); @@ -176,9 +167,11 @@ generate_4coder_docs(Document_System *doc_system, Partition *part, char *code_di *custom_funcs_unit = compile_meta_unit(part, code_directory, "4ed_api_implementation.cpp", ExpandArray(meta_keywords)); Assert(custom_funcs_unit->count != 0); - // NOTE(allen): Compute and store variations of the custom function names - *custom_func_names = allocate_app_api(part, custom_funcs_unit->set.count); + Alternate_Names_Array *custom_func_names = push_struct(part, Alternate_Names_Array); + i32 name_count = custom_funcs_unit->set.count; + custom_func_names->names = push_array(part, Alternate_Name, name_count); + memset(custom_func_names->names, 0, sizeof(*custom_func_names->names)*name_count); for (i32 i = 0; i < custom_funcs_unit->set.count; ++i){ String name_string = custom_funcs_unit->set.items[i].name; diff --git a/string/.DS_Store b/string/.DS_Store new file mode 100644 index 00000000..a499b661 Binary files /dev/null and b/string/.DS_Store differ diff --git a/string/4coder_string_build_num.txt b/string/4coder_string_build_num.txt index 5e3d1b74..c4fa2f97 100644 --- a/string/4coder_string_build_num.txt +++ b/string/4coder_string_build_num.txt @@ -1,5 +1,5 @@ 1 0 -87 +98 diff --git a/string/4tech_standard_preamble.h b/string/4ed_standard_preamble.h similarity index 100% rename from string/4tech_standard_preamble.h rename to string/4ed_standard_preamble.h diff --git a/string/string_builder.cpp b/string/4ed_string_builder.cpp similarity index 98% rename from string/string_builder.cpp rename to string/4ed_string_builder.cpp index 6604a190..ca570fa7 100644 --- a/string/string_builder.cpp +++ b/string/4ed_string_builder.cpp @@ -6,16 +6,6 @@ Created 21.01.2017 (dd.mm.yyyy) // TOP -#include "../4cpp/4cpp_lexer.h" -// TODO(allen): Make sure to only publish the 4coder_string.h if it builds and passes a series of tests. -#define FSTRING_IMPLEMENTATION -#include "../4coder_lib/4coder_string.h" - -#include "../4ed_defines.h" -#include "../meta/4ed_meta_defines.h" -#include "../meta/4ed_file_moving.h" - - #define BUILD_NUMBER_FILE "4coder_string_build_num.txt" #define GENERATED_FILE "4coder_string.h" @@ -24,6 +14,16 @@ Created 21.01.2017 (dd.mm.yyyy) #define BACKUP_FOLDER ".." SLASH ".." SLASH "string_backup" #define PUBLISH_FOLDER ".." SLASH "4coder_helper" +#include "../4cpp/4cpp_lexer.h" +// TODO(allen): Make sure to only publish the 4coder_string.h if it builds and passes a series of tests. +#define FSTRING_IMPLEMENTATION +#include "../4coder_lib/4coder_string.h" + +#include "../4ed_defines.h" +#include "../meta/4ed_meta_defines.h" + +#define FTECH_FILE_MOVING_IMPLEMENTATION +#include "../meta/4ed_file_moving.h" #include #include @@ -37,7 +37,8 @@ Created 21.01.2017 (dd.mm.yyyy) #define V_MAJ STR_(V_MAJ_NUM) #define V_MIN STR_(V_MIN_NUM) -#include "../meta/meta_parser.cpp" +#include "../meta/4ed_meta_parser.cpp" +#include "../meta/4ed_out_context.cpp" static b32 parse_build_number(char *file_name, i32 *major_out, i32 *minor_out, i32 *build_out){ @@ -96,8 +97,6 @@ save_build_number(char *file_name, i32 major, i32 minor, i32 build){ /////////////////////////////// -#include "../meta/out_context.cpp" - // // Meta Parse Rules // @@ -158,12 +157,14 @@ print_function_body_code(String *out, Parse_Context *context, int32_t start){ internal void file_move(char *path, char *file_name){ - copy_file(0, file_name, path, 0, file_name); + fm_copy_file(fm_str(file_name), fm_str(path, "/", file_name)); } int main(){ META_BEGIN(); + fm_init_system(); + i32 size = (512 << 20); void *mem = malloc(size); memset(mem, 0, size); @@ -467,11 +468,11 @@ int main(){ // NOTE(allen): Publish the new file. (Would like to be able to automatically test the result before publishing). { - make_folder_if_missing(BACKUP_FOLDER SLASH V_MAJ SLASH V_MIN, 0); + fm_make_folder_if_missing(BACKUP_FOLDER SLASH V_MAJ SLASH V_MIN); file_move(BACKUP_FOLDER SLASH V_MAJ SLASH V_MIN, INTERNAL_STRING); file_move(BACKUP_FOLDER SLASH V_MAJ SLASH V_MIN, GENERATED_FILE); //file_move(PUBLISH_FOLDER, GENERATED_FILE); - delete_file(GENERATED_FILE); + fm_delete_file(GENERATED_FILE); printf("published "GENERATED_FILE": v%d.%d.%d\n", major_number, minor_number, build_number); save_build_number(BUILD_NUMBER_FILE, major_number, minor_number, build_number + 1); } @@ -479,8 +480,5 @@ int main(){ META_FINISH(); } -#define FTECH_FILE_MOVING_IMPLEMENTATION -#include "../meta/4ed_file_moving.h" - // BOTTOM diff --git a/string/build.bat b/string/build.bat index 4da879ec..d4299d9d 100644 --- a/string/build.bat +++ b/string/build.bat @@ -6,7 +6,7 @@ SET OPTS=%OPTS% -wd4611 -GR- -EHa- -nologo -FC SET FirstError=0 pushd ..\build -cl %OPTS% ..\code\string\string_builder.cpp /Zi /Festring_builder +cl %OPTS% ..\code\string\4ed_string_builder.cpp /Zi /Festring_builder if %ERRORLEVEL% neq 0 (set FirstError=1) if %ERRORLEVEL% neq 0 (goto END) popd diff --git a/string/build.sh b/string/build.sh index b56cb914..2832e70c 100755 --- a/string/build.sh +++ b/string/build.sh @@ -3,7 +3,7 @@ WARNINGS="-Wno-write-strings -Wno-comment -Wno-logical-op-parentheses -Wno-null-dereference -Wno-switch" FLAGS="-D_GNU_SOURCE -fPIC -fpermissive" -g++ $WARNINGS $FLAGS ../code/string/string_builder.cpp -g -o ../build/string_builder +g++ $WARNINGS $FLAGS ../code/string/4ed_string_builder.cpp -g -o ../build/string_builder pushd string ../../build/string_builder