name fixing, project fixing, temp memory collision fixing

master
Allen Webster 2017-07-09 15:22:57 -04:00
parent f7f9192b41
commit dabda53ddc
16 changed files with 2350 additions and 73 deletions

View File

@ -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

View File

@ -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

View File

@ -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

2
string/build.sh → build_string.sh Executable file → Normal file
View File

@ -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

View File

@ -1,6 +1,11 @@
/*
4coder development build rule.
*/
* Mr. 4th Dimention - Allen Webster
*
* ??.??.????
*
* 4coder development build rule.
*
*/
// TOP
@ -189,20 +194,19 @@ get_defines_from_flags(u32 flags){
"user32.lib winmm.lib gdi32.lib opengl32.lib " \
"..\\foreign_x86\\freetype.lib"
#define CL_ICON "..\\res\\icon.res"
static void
internal void
build(u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, char *out_file, char **defines, char **exports, char **inc_folders){
Temp_Dir temp = fm_pushdir(out_path);
Build_Line line;
fm_init_build_line(&line);
if (arch == Arch_X86){
fm_add_to_line(line, "%s\\windows_scripts\\setup_cl_x86.bat &", code_path);
}
fm_add_to_line(line, "cl");
if (flags & OPTS){
@ -210,8 +214,8 @@ build(u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, c
}
switch (arch){
case Arch_X64: fm_add_to_line(line, "/DFTECH_64_BIT"); break;
case Arch_X86: fm_add_to_line(line, "/DFTECH_32_BIT"); break;
case Arch_X64: fm_add_to_line(line, "-DFTECH_64_BIT"); break;
case Arch_X86: fm_add_to_line(line, "-DFTECH_32_BIT"); break;
default: InvalidCodePath;
}
@ -219,7 +223,7 @@ build(u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, c
if (inc_folders != 0){
for (u32 i = 0; inc_folders[i] != 0; ++i){
char *str = fm_str(code_path, "/", inc_folders[i]);
fm_add_to_line(line, "/I%s", str);
fm_add_to_line(line, "-I%s", str);
}
}
@ -236,51 +240,51 @@ build(u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, c
}
if (flags & DEBUG_INFO){
fm_add_to_line(line, "/Zi");
fm_add_to_line(line, "-Zi");
}
if (flags & OPTIMIZATION){
fm_add_to_line(line, "/O2");
fm_add_to_line(line, "-O2");
}
if (flags & SHARED_CODE){
fm_add_to_line(line, "/LD");
fm_add_to_line(line, "-LD");
}
if (defines != 0){
for (u32 i = 0; defines[i] != 0; ++i){
char *define_flag = fm_str("/D", defines[i]);
fm_add_to_line(line, define_flag);
char *define_flag = fm_str("-D", defines[i]);
fm_add_to_line(line, "%s", define_flag);
}
}
for (u32 i = 0; code_files[i]; ++i){
fm_add_to_line(line, "\"%s\\%s\"", code_path, code_files[i]);
}
fm_add_to_line(line, "/Fe%s", out_file);
fm_add_to_line(line, "/link /INCREMENTAL:NO");
fm_add_to_line(line, "-Fe%s", out_file);
fm_add_to_line(line, "-link -INCREMENTAL:NO");
switch (arch){
case Arch_X64: fm_add_to_line(line, "/MACHINE:X64"); break;
case Arch_X86: fm_add_to_line(line, "/MACHINE:X86"); break;
case Arch_X64: fm_add_to_line(line, "-MACHINE:X64"); break;
case Arch_X86: fm_add_to_line(line, "-MACHINE:X86"); break;
default: InvalidCodePath;
}
if (flags & DEBUG_INFO){
fm_add_to_line(line, "/DEBUG");
fm_add_to_line(line, "-DEBUG");
}
if (flags & SHARED_CODE){
Assert(exports != 0);
fm_add_to_line(line, "/OPT:REF");
fm_add_to_line(line, "-OPT:REF");
for (u32 i = 0; exports[i] != 0; ++i){
char *str = fm_str("/EXPORT:", exports[i]);
char *str = fm_str("-EXPORT:", exports[i]);
fm_add_to_line(line, "%s", str);
}
}
else{
fm_add_to_line(line, "/NODEFAULTLIB:library");
fm_add_to_line(line, "-NODEFAULTLIB:library");
}
fm_finish_build_line(&line);
@ -320,7 +324,7 @@ build(u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, c
# error gcc options not set for this platform
#endif
static void
internal void
build(u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, char *out_file, char **defines, char **exports, char **inc_folders){
Build_Line line;
fm_init_build_line(&line);
@ -387,7 +391,7 @@ build(u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, c
fm_add_to_line(line, "%s", define_flag);
}
}
fm_add_to_line(line, "-I\"%s\"", code_path);
for (u32 i = 0; code_files[i] != 0; ++i){
fm_add_to_line(line, "\"%s/%s\"", code_path, code_files[i]);
@ -408,7 +412,7 @@ build(u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, c
# error build function not defined for this compiler
#endif
static void
internal void
build(u32 flags, u32 arch, char *code_path, char *code_file, char *out_path, char *out_file, char **defines, char **exports, char **inc_folders){
char *code_files[2];
code_files[0] = code_file;
@ -416,10 +420,10 @@ build(u32 flags, u32 arch, char *code_path, char *code_file, char *out_path, cha
build(flags, arch, code_path, code_files, out_path, out_file, defines, exports, inc_folders);
}
static void
internal 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);
@ -439,7 +443,7 @@ site_build(char *cdir, u32 flags){
}
}
static void
internal void
build_and_run(char *cdir, char *filename, char *name, u32 flags){
char *dir = fm_str(BUILD_DIR);
@ -458,17 +462,17 @@ build_and_run(char *cdir, char *filename, char *name, u32 flags){
}
}
static void
internal 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
internal void
metagen(char *cdir){
build_and_run(cdir, "meta/4ed_metagen.cpp", "metagen", OPTS | DEBUG_INFO);
}
static void
internal void
do_buildsuper(char *cdir, char *file, u32 arch){
BEGIN_TIME_SECTION();
Temp_Dir temp = fm_pushdir(fm_str(BUILD_DIR));
@ -485,7 +489,7 @@ do_buildsuper(char *cdir, char *file, u32 arch){
END_TIME_SECTION("build custom");
}
static void
internal void
build_main(char *cdir, b32 update_local_theme, u32 flags, u32 arch){
char *dir = fm_str(BUILD_DIR);
@ -515,7 +519,7 @@ build_main(char *cdir, b32 update_local_theme, u32 flags, u32 arch){
}
}
static void
internal void
standard_build(char *cdir, u32 flags, u32 arch){
fsm_generator(cdir);
metagen(cdir);
@ -541,7 +545,7 @@ get_4coder_dist_name(u32 platform, char *tier, u32 arch){
return(name);
}
static void
internal void
package(char *cdir){
// NOTE(allen): meta
fsm_generator(cdir);
@ -568,7 +572,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 +626,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");

View File

@ -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;
}
@ -503,7 +503,7 @@ fm__prepare(umem item_size, void *i1, va_list list){
umem size = listsize(i1, item_size);
void *result = (void*)fm__push(size);
memcpy(result, i1, size);
void *ln = va_arg(list, void*);
for (;ln != 0;){
size = listsize(ln, item_size);
@ -511,7 +511,7 @@ fm__prepare(umem item_size, void *i1, va_list list){
memcpy(new_str, ln, size);
ln = va_arg(list, void*);
}
void *terminator = (void*)fm__push(item_size);
memset(terminator, 0, item_size);
return(result);

View File

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

View File

@ -1,15 +1,16 @@
extensions=".c.cpp.h.m.bat.sh.4coder";
open_recursively=true;
fkey_command_win[1] = {"echo build: x64 & build.bat", "*compilation*", true , true };
fkey_command_win[2] = {"build_site.bat", "*site*", false , true };
fkey_command_win[3] = {"string\\build.bat", "*compilation*", true , true };
fkey_command_win[4] = {"echo build: x86 & build.bat /DDEV_BUILD_X86", "*compilation*", true , true };
fkey_command_win[5] = {"..\\misc\\run.bat", "*run*", false, false };
fkey_command_win[6] = {"run_profile.bat", "*profile*", false, true };
fkey_command_win[12] = {"package.bat", "*package*", false, true };
fkey_command_win[1] = {"echo build: x64 & build.bat", "*compilation*" , true , true };
fkey_command_win[2] = {"build_site.bat" , "*site*" , false, true };
fkey_command_win[3] = {"build_string.bat" , "*compilation*" , true , true };
fkey_command_win[4] = {"echo build: x86 & build.bat /DDEV_BUILD_X86" , "*compilation*", true, true };
fkey_command_win[5] = {"..\\misc\\run.bat" , "*run*" , false, false };
fkey_command_win[6] = {"run_profile.bat" , "*profile*" , false, true };
fkey_command_win[12] = {"package.bat" , "*package*" , false, true };
fkey_command_linux[1] = {"echo build: x64 & ./build.sh", "*compilation*", true , true };
fkey_command_linux[2] = {"build_site.sh", "*site*", false , true };
fkey_command_linux[4] = {"echo build: x86 & ./build.sh -DDEV_BUILD_X86", "*compilation*", true, true };
fkey_command_linux[12] = {"./package.sh", "*package*", false, true };
fkey_command_linux[1] = {"echo build: x64 & ./build.sh", "*compilation*" , true , true };
fkey_command_linux[2] = {"build_site.sh" , "*site*" , false, true };
fkey_command_linux[3] = {"build_string.sh" , "*compilation*" , true , true };
fkey_command_linux[4] = {"echo build: x86 & ./build.sh -DDEV_BUILD_X86" , "*compilation*", true, true };
fkey_command_linux[12] = {"./package.sh" , "*package*" , false, true };

View File

@ -29,9 +29,9 @@
#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"
///////////////////////////////////////////////////////////////////////////

2273
string/4coder_string.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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,7 +157,7 @@ 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(){
@ -467,11 +466,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);
}