got string build working again

master
Allen Webster 2017-07-09 00:28:33 -04:00
parent f76b564d95
commit f474c25dc3
19 changed files with 41 additions and 50 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@ -9,7 +9,7 @@ SET BUILD_MODE=%1
if "%BUILD_MODE%" == "" (SET BUILD_MODE="/DDEV_BUILD") if "%BUILD_MODE%" == "" (SET BUILD_MODE="/DDEV_BUILD")
pushd ..\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 (set FirstError=1)
if %ERRORLEVEL% neq 0 (goto END) if %ERRORLEVEL% neq 0 (goto END)
popd popd

View File

@ -39,7 +39,7 @@ fi
FLAGS="-D_GNU_SOURCE -fPIC -fpermissive $BUILD_MODE" FLAGS="-D_GNU_SOURCE -fPIC -fpermissive $BUILD_MODE"
# Execute # 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 ../build/build

BIN
meta/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -419,7 +419,7 @@ build(u32 flags, u32 arch, char *code_path, char *code_file, char *out_path, cha
static void static void
site_build(char *cdir, u32 flags){ 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); char *dir = fm_str(BUILD_DIR);
BEGIN_TIME_SECTION(); BEGIN_TIME_SECTION();
build(OPTS | flags, Arch_X64, cdir, file, dir, "sitegen", get_defines_from_flags(flags), 0, includes); 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 static void
fsm_generator(char *cdir){ 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 static void
@ -568,7 +568,7 @@ package(char *cdir){
char *tier = tiers[tier_index]; char *tier = tiers[tier_index];
u32 flags = base_flags | tier_flags[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); char *tier_package_root = fm_str(base_package_root, "_", tier);
for (u32 arch = 0; arch < Arch_COUNT; ++arch){ for (u32 arch = 0; arch < Arch_COUNT; ++arch){
char *par_dir = fm_str(tier_package_root, "_", arch_names[arch]); char *par_dir = fm_str(tier_package_root, "_", arch_names[arch]);
@ -622,7 +622,7 @@ package(char *cdir){
// NOTE(allen): power // 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_par_dir = fm_str("../current_dist_power");
char *pack_power_dir = fm_str(pack_power_par_dir, "/power"); char *pack_power_dir = fm_str(pack_power_par_dir, "/power");

View File

@ -76,9 +76,9 @@ internal char **fm_prepare_list_internal(char **l1, ...);
internal char **fm_list_one_item(char *item); internal char **fm_list_one_item(char *item);
// File System Navigation // File System Navigation
typedef umem Temp_Memory; typedef umem String_Temp;
internal Temp_Memory fm_begin_temp(); internal String_Temp fm_begin_temp();
internal void fm_end_temp(Temp_Memory temp); internal void fm_end_temp(String_Temp temp);
internal i32 fm_get_current_directory(char *buffer, i32 max); 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); fm_arena_memory = (char*)malloc(fm_arena_max);
} }
internal Temp_Memory internal String_Temp
fm_begin_temp(){ fm_begin_temp(){
return(fm_arena_pos); return(fm_arena_pos);
} }
internal void internal void
fm_end_temp(Temp_Memory temp){ fm_end_temp(String_Temp temp){
fm_arena_pos = temp; fm_arena_pos = temp;
} }

View File

@ -28,8 +28,8 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "meta_parser.cpp" #include "4ed_meta_parser.cpp"
#include "out_context.cpp" #include "4ed_out_context.cpp"
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
char *keys_that_need_codes[] = { char *keys_that_need_codes[] = {

BIN
site/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -23,15 +23,16 @@
#include "../4ed_defines.h" #include "../4ed_defines.h"
#include "../meta/4ed_meta_defines.h" #include "../meta/4ed_meta_defines.h"
#include "../4coder_API/version.h" #include "../4coder_API/version.h"
#define FSTRING_IMPLEMENTATION #define FSTRING_IMPLEMENTATION
#include "../4coder_lib/4coder_string.h" #include "../4coder_lib/4coder_string.h"
#include "../4coder_lib/4coder_mem.h" #include "../4coder_lib/4coder_mem.h"
#include "../4cpp/4cpp_lexer.h" #include "../4cpp/4cpp_lexer.h"
#include "../meta/meta_parser.cpp" #include "../meta/4ed_meta_parser.cpp"
#include "../meta/out_context.cpp" #include "../meta/4ed_out_context.cpp"
#include "abstract_document.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 static void
do_html_output(Document_System *doc_system, Partition *part, char *dst_directory, Abstract_Item *doc){ do_html_output(Document_System *doc_system, Partition *part, char *dst_directory, Abstract_Item *doc){
// NOTE(allen): Output // 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 *string_unit = push_struct(part, Meta_Unit);
Meta_Unit *custom_funcs_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 *introduction = push_struct(part, Enriched_Text);
Enriched_Text *lexer_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)); *custom_funcs_unit = compile_meta_unit(part, code_directory, "4ed_api_implementation.cpp", ExpandArray(meta_keywords));
Assert(custom_funcs_unit->count != 0); Assert(custom_funcs_unit->count != 0);
// NOTE(allen): Compute and store variations of the custom function names // 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){ for (i32 i = 0; i < custom_funcs_unit->set.count; ++i){
String name_string = custom_funcs_unit->set.items[i].name; String name_string = custom_funcs_unit->set.items[i].name;

BIN
string/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -1,5 +1,5 @@
1 1
0 0
87 98

View File

@ -6,16 +6,6 @@ Created 21.01.2017 (dd.mm.yyyy)
// TOP // 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 BUILD_NUMBER_FILE "4coder_string_build_num.txt"
#define GENERATED_FILE "4coder_string.h" #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 BACKUP_FOLDER ".." SLASH ".." SLASH "string_backup"
#define PUBLISH_FOLDER ".." SLASH "4coder_helper" #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 <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -37,7 +37,8 @@ Created 21.01.2017 (dd.mm.yyyy)
#define V_MAJ STR_(V_MAJ_NUM) #define V_MAJ STR_(V_MAJ_NUM)
#define V_MIN STR_(V_MIN_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 static b32
parse_build_number(char *file_name, i32 *major_out, i32 *minor_out, i32 *build_out){ 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 // Meta Parse Rules
// //
@ -158,12 +157,14 @@ print_function_body_code(String *out, Parse_Context *context, int32_t start){
internal void internal void
file_move(char *path, char *file_name){ 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(){ int main(){
META_BEGIN(); META_BEGIN();
fm_init_system();
i32 size = (512 << 20); i32 size = (512 << 20);
void *mem = malloc(size); void *mem = malloc(size);
memset(mem, 0, 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). // 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, INTERNAL_STRING);
file_move(BACKUP_FOLDER SLASH V_MAJ SLASH V_MIN, GENERATED_FILE); file_move(BACKUP_FOLDER SLASH V_MAJ SLASH V_MIN, GENERATED_FILE);
//file_move(PUBLISH_FOLDER, 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); 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); save_build_number(BUILD_NUMBER_FILE, major_number, minor_number, build_number + 1);
} }
@ -479,8 +480,5 @@ int main(){
META_FINISH(); META_FINISH();
} }
#define FTECH_FILE_MOVING_IMPLEMENTATION
#include "../meta/4ed_file_moving.h"
// BOTTOM // BOTTOM

View File

@ -6,7 +6,7 @@ SET OPTS=%OPTS% -wd4611 -GR- -EHa- -nologo -FC
SET FirstError=0 SET FirstError=0
pushd ..\build 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 (set FirstError=1)
if %ERRORLEVEL% neq 0 (goto END) if %ERRORLEVEL% neq 0 (goto END)
popd popd

View File

@ -3,7 +3,7 @@
WARNINGS="-Wno-write-strings -Wno-comment -Wno-logical-op-parentheses -Wno-null-dereference -Wno-switch" WARNINGS="-Wno-write-strings -Wno-comment -Wno-logical-op-parentheses -Wno-null-dereference -Wno-switch"
FLAGS="-D_GNU_SOURCE -fPIC -fpermissive" 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 pushd string
../../build/string_builder ../../build/string_builder