From 37bf8777a44f38fb609fc689e86df20f6e365eeb Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Fri, 24 Feb 2017 20:53:40 -0500 Subject: [PATCH] got 32-bit windows build running --- 4coder_base_commands.cpp | 2 +- 4coder_lib/4coder_mem.h | 2 +- 4ed_system_shared.cpp | 5 +- 4tech_gobble.zip | Bin 0 -> 24057 bytes build.bat | 5 + buildsuper.bat | 2 +- buildsuper_x86.bat | 25 +++ meta/build.cpp | 316 +++++++++++++++++++---------- project.4coder | 10 +- string/4coder_string_build_num.txt | 2 +- string/_4coder_string.ctm | Bin 2564 -> 2580 bytes win32_4ed.cpp | 191 +++++++++-------- win32_gl.h | 22 +- 13 files changed, 365 insertions(+), 217 deletions(-) create mode 100644 4tech_gobble.zip create mode 100644 buildsuper_x86.bat diff --git a/4coder_base_commands.cpp b/4coder_base_commands.cpp index 453bffe1..d85c0616 100644 --- a/4coder_base_commands.cpp +++ b/4coder_base_commands.cpp @@ -388,7 +388,7 @@ CUSTOM_COMMAND_SIG(clean_all_lines){ int32_t line_count = buffer.line_count; int32_t edit_max = line_count; - if (edit_max*sizeof(Buffer_Edit) < app->memory_size){ + if (edit_max*(int32_t)sizeof(Buffer_Edit) < app->memory_size){ Buffer_Edit *edits = (Buffer_Edit*)app->memory; char data[1024]; diff --git a/4coder_lib/4coder_mem.h b/4coder_lib/4coder_mem.h index 8ed09fb5..4371681d 100644 --- a/4coder_lib/4coder_mem.h +++ b/4coder_lib/4coder_mem.h @@ -327,7 +327,7 @@ general_memory_reallocate(General_Memory *general, void *old, i32_4tech old_size if (additional_space > 0){ Bubble *next = bubble->next; if (!(next->flags & MEM_BUBBLE_USED) && - next->size + sizeof(Bubble) >= additional_space){ + next->size + (i32_4tech)sizeof(Bubble) >= additional_space){ general_memory_do_merge(bubble, next); general_memory_attempt_split(general, bubble, size); } diff --git a/4ed_system_shared.cpp b/4ed_system_shared.cpp index cba64e05..3f40fcf9 100644 --- a/4ed_system_shared.cpp +++ b/4ed_system_shared.cpp @@ -31,10 +31,7 @@ init_shared_vars(){ shared_vars.track_node_size = (16 << 10); void *track_nodes = system_get_memory(shared_vars.track_node_size); - i32 track_result = - init_track_system(&shared_vars.track, - shared_vars.track_table, shared_vars.track_table_size, - track_nodes, shared_vars.track_node_size); + i32 track_result = init_track_system(&shared_vars.track, shared_vars.track_table, shared_vars.track_table_size, track_nodes, shared_vars.track_node_size); if (track_result != FileTrack_Good){ exit(1); diff --git a/4tech_gobble.zip b/4tech_gobble.zip new file mode 100644 index 0000000000000000000000000000000000000000..1cd3ffa4c9bb6614d6fd4d285b4853ec3964fc29 GIT binary patch literal 24057 zcmV)dK&QV@O9KQH0000003)SXN&o-=000000000000sa60B~=2WpXc2O9KQH00008 z0Ec}$N?4rXz=SgZ007hg02TlM0B~=2WpXbxV{c?-a$jR%b7grhV{mZYU447oxDEe5 zpF+)^HFjz{N!xX6(_SApNw3-RwkCJocDu(@Y&q6qTRurn>g}@6z8?U-=!LSJw72b9 z+NQP$fFKBhAP7=ho8HOk#X+O*C&8lm%DWhaiPw(?frtNl!RIs%Cc${o^Dg~?=T8Up zcoHS)c;Wqho}}I+@J4?BI-Fj4=?K4*HP7?>IGO`Ajl9`B^}?w)4E%H+2Z?v+-TG60 zR;n` zFpcI{BL<+F#fhNj*P1-tEXwy~B-(=l9dOKOQfH)F1*29nU+Dym06( zqPaH+`r&{n&Xa%$D(Os#+9-&FmUkIYYr-Tzg+w-lSi-AON(IS$hRXY~pNtk>6nmH8 z>)K1ANxQ zaG$<^>V7=&{@m4liC&5(9(ppECSf!s(cXju@Vf3N=*@NSHcUs+JSBp+ejKBJ!08a3 zz3|YlgO(QnAc#R?hAvEqscC-9k$1Mf0S(a#Z-5}I@fzA+XK z(aof=aWD@3OQ_ojKtiV-2N)dCC;p*9rV2ZgxCj@K)eZq+h72ysEO6>)=!9X zG!4ukxs7zIEW#!8p1jrd;D6K7_Ws!+T9KwSf|ZT}8{-BKm?I1k2!5I-GVGHP#?XA` z`3ZD+9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`CkNchaT*5m1U{{VFj+L)OPqwYk@!AVH5No%<*dfeKiEPh z8#Y_X^Q+zvZL$(Y&{Oc=YG+5HxauLEzY85hqu+dugcBtj&#>P`D_t@md<;WEQ zanmk}UO=BiUUBjriAoxSFd&)RnrT-XdUXX4(!BaxJO+f|G#A&kv<>5)-c1eUp^FWN zN>yvY)|N-%mkkfJGDYTmuAyZKE+Np0mSgUSZO$d!QCV$GH8fF2d>2Y=wL9U!xFpjQ z;qk4p#6mu{foHhsz`PuaDELk+FMb87ke0t}lGt7yCwqIiw$YG$(pKsD9i$t`UQHFZD2Xw|*QYjD2EHcbyyoN(f7z&=!JU6b8p?S2B#E&Qa5IXnMKY1qTKUyk?c)%4)BKpHr7L%o$6gY> z2N1F^qh9`5dIodT_649K4*@9*_}^^ADgJaTe=W3sg#T|UjtKbhUpWK-51{3d&Icbe z4e`%-8J^PuAoAtov7;zs~+OL+#&a|Iz3Dod?jh#V_~z*De0@HdW+d V{_=7M{P`LH$c6v_B=!Hw{vWh>ovr`? literal 0 HcmV?d00001 diff --git a/build.bat b/build.bat index 0bccd819..fbd70bc6 100644 --- a/build.bat +++ b/build.bat @@ -10,6 +10,8 @@ SET FirstError=0 SET BUILD_MODE=%1 if "%BUILD_MODE%" == "" (SET BUILD_MODE="/DDEV_BUILD") +REM if "%BUILD_MODE%" == "/DDEV_BUILD_X86" (call "SETUP_CLX86") + pushd ..\build cl %OPTS% ..\code\meta\build.cpp /Zi /Febuild %BUILD_MODE% if %ERRORLEVEL% neq 0 (set FirstError=1) @@ -20,4 +22,7 @@ popd if %ERRORLEVEL% neq 0 (set FirstError=1) :END + +REM if "%BUILD_MODE%" == "/DDEV_BUILD" (call "SETUP_CLX64") + call "ctime" -end 4ed_data.ctm %FirstError% diff --git a/buildsuper.bat b/buildsuper.bat index a4af85a4..0e4b2c61 100644 --- a/buildsuper.bat +++ b/buildsuper.bat @@ -1,6 +1,6 @@ @echo off -IF NOT DEFINED LIB (call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64) +IF NOT DEFINED LIB (call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64) SET SRC=%1 if "%SRC%" == "" SET SRC=4coder_default_bindings.cpp diff --git a/buildsuper_x86.bat b/buildsuper_x86.bat new file mode 100644 index 00000000..22035658 --- /dev/null +++ b/buildsuper_x86.bat @@ -0,0 +1,25 @@ +@echo off + +IF NOT DEFINED LIB (call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64_x86) + +SET SRC=%1 +if "%SRC%" == "" SET SRC=4coder_default_bindings.cpp + +SET OPTS=/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /wd4457 /WX +SET OPTS=%OPTS% /GR- /nologo /FC +SET DEBUG=/Zi +SET BUILD_DLL=/LD /link /INCREMENTAL:NO /OPT:REF +SET EXPORTS=/EXPORT:get_bindings /EXPORT:get_alpha_4coder_version + +REM This stores the path of the buildsuper.bat script +REM in CODE_HOME. This way you can always include the +REM default files no matter where you store your code. +REM And no matter how you call buildsuper.bat. +SET CODE_HOME=%~dp0 + +cl /I%CODE_HOME% %OPTS% %DEBUG% %SRC% /Fecustom_4coder %BUILD_DLL% %EXPORTS% + +REM file spammation preventation +del *.exp +del *.obj +del *.lib diff --git a/meta/build.cpp b/meta/build.cpp index 383f1c4c..bfb186d5 100644 --- a/meta/build.cpp +++ b/meta/build.cpp @@ -131,9 +131,13 @@ init_build_line(Build_Line *line){ #define CL_SITE_INCLUDES "/I..\\..\\foreign /I..\\..\\code" -#define CL_LIBS \ +#define CL_LIBS_X64 \ "user32.lib winmm.lib gdi32.lib opengl32.lib " \ -"..\\foreign\\freetype.lib" +"..\\foreign_x64\\freetype.lib" + +#define CL_LIBS_X86 \ +"user32.lib winmm.lib gdi32.lib opengl32.lib " \ +"..\\foreign_x86\\freetype.lib" #define CL_ICON "..\\res\\icon.res" @@ -142,10 +146,18 @@ init_build_line(Build_Line *line){ static void build_cl(u32 flags, char *code_path, char *code_file, char *out_path, char *out_file, char *exports){ Build_Line line; - Build_Line link_line; init_build_line(&line); + + Build_Line link_line; init_build_line(&link_line); + Build_Line line_prefix; + init_build_line(&line_prefix); + + if (flags & X86){ + build_ap(line_prefix, "SETUP_CLX86 & "); + } + if (flags & OPTS){ build_ap(line, CL_OPTS); } @@ -159,7 +171,12 @@ build_cl(u32 flags, char *code_path, char *code_file, char *out_path, char *out_ } if (flags & LIBS){ - build_ap(line, CL_LIBS); + if (flags & X86){ + build_ap(line, CL_LIBS_X86); + } + else{ + build_ap(line, CL_LIBS_X64); + } } if (flags & ICON){ @@ -210,8 +227,10 @@ build_cl(u32 flags, char *code_path, char *code_file, char *out_path, char *out_ swap_ptr(&line.build_options, &line.build_options_prev); swap_ptr(&link_line.build_options, &link_line.build_options_prev); + swap_ptr(&line_prefix.build_options, &line_prefix.build_options_prev); + Temp_Dir temp = pushdir(out_path); - systemf("cl %s %s\\%s /Fe%s /link /INCREMENTAL:NO %s", line.build_options, code_path, code_file, out_file, link_line.build_options); + systemf("%scl %s %s\\%s /Fe%s /link /INCREMENTAL:NO %s", line_prefix.build_options, line.build_options, code_path, code_file, out_file, link_line.build_options); popdir(temp); } @@ -307,39 +326,28 @@ build(u32 flags, char *code_path, char *code_file, char *out_path, char *out_fil } static void -buildsuper(char *code_path, char *out_path, char *filename){ +buildsuper(char *code_path, char *out_path, char *filename, b32 x86_build){ Temp_Dir temp = pushdir(out_path); - #if defined(IS_CL) - systemf("call \"%s\\buildsuper.bat\" %s", code_path, filename); - + { + char *prefix = ""; + char *build_script = "buildsuper.bat"; + if (x86_build){ + prefix = "setup_clx86 & "; + build_script = "buildsuper_x86.bat"; + } + systemf("%scall \"%s\\%s\" %s", prefix, code_path, build_script, filename); + } #elif defined(IS_GCC) - - systemf("\"%s/buildsuper.sh\" %s", code_path, filename); - + { + systemf("\"%s/buildsuper.sh\" %s", code_path, filename); + } #else #error The build rule for this compiler is not ready #endif - popdir(temp); } -#define META_DIR "../meta" -#define BUILD_DIR "../build" - -#define SITE_DIR "../site" -#define PACK_DIR "../distributions" -#define PACK_DATA_DIR "../data/dist_files" -#define DATA_DIR "../data/test" - -#define PACK_ALPHA_PAR_DIR "../current_dist" -#define PACK_SUPER_PAR_DIR "../current_dist_super" -#define PACK_POWER_PAR_DIR "../current_dist_power" - -#define PACK_ALPHA_DIR PACK_ALPHA_PAR_DIR"/4coder" -#define PACK_SUPER_DIR PACK_SUPER_PAR_DIR"/4coder" -#define PACK_POWER_DIR PACK_POWER_PAR_DIR"/power" - #if defined(IS_WINDOWS) #define PLAT_LAYER "win32_4ed.cpp" #elif defined(IS_LINUX) @@ -348,6 +356,9 @@ buildsuper(char *code_path, char *out_path, char *filename){ #error No platform layer defined for this OS. #endif +#define META_DIR "../meta" +#define BUILD_DIR "../build" + static void fsm_generator(char *cdir){ { @@ -395,7 +406,7 @@ enum{ }; static void -do_buildsuper(char *cdir, i32 custom_option){ +do_buildsuper(char *cdir, i32 custom_option, u32 flags){ char space[1024]; String str = make_fixed_width_string(space); @@ -426,11 +437,15 @@ do_buildsuper(char *cdir, i32 custom_option){ copy_sc(&str, "../4vim/4coder_chronal.cpp"); }break; } - terminate_with_null(&str); + b32 x86_build = false; + if (flags & X86){ + x86_build = true; + } + DECL_STR(dir, BUILD_DIR); - buildsuper(cdir, dir, str.str); + buildsuper(cdir, dir, str.str, x86_build); END_TIME_SECTION("build custom"); } @@ -457,9 +472,9 @@ static void standard_build(char *cdir, u32 flags){ fsm_generator(cdir); metagen(cdir); - do_buildsuper(cdir, Custom_Experiments); - //do_buildsuper(cdir, Custom_Casey); - //do_buildsuper(cdir, Custom_ChronalVim); + do_buildsuper(cdir, Custom_Experiments, flags); + //do_buildsuper(cdir, Custom_Casey, flags); + //do_buildsuper(cdir, Custom_ChronalVim, flags); build_main(cdir, flags); } @@ -481,6 +496,8 @@ site_build(char *cdir, u32 flags){ } } +#define PACK_DIR "../distributions" + static void get_4coder_dist_name(String *zip_file, i32 OS_specific, char *tier, char *ext){ zip_file->size = 0; @@ -526,8 +543,9 @@ package(char *cdir){ fsm_generator(cdir); metagen(cdir); - // NOTE(allen): alpha - build_main(cdir, OPTIMIZATION | KEEP_ASSERT | DEBUG_INFO); +#define SITE_DIR "../site" +#define PACK_DATA_DIR "../data/dist_files" +#define DATA_DIR "../data/test" DECL_STR(build_dir, BUILD_DIR); DECL_STR(site_dir, SITE_DIR); @@ -535,88 +553,170 @@ package(char *cdir){ DECL_STR(pack_data_dir, PACK_DATA_DIR); DECL_STR(data_dir, DATA_DIR); +#define PACK_ALPHA_PAR_DIR "../current_dist" +#define PACK_ALPHA_DIR PACK_ALPHA_PAR_DIR"/4coder" DECL_STR(pack_alpha_par_dir, PACK_ALPHA_PAR_DIR); - DECL_STR(pack_super_par_dir, PACK_SUPER_PAR_DIR); - DECL_STR(pack_power_par_dir, PACK_POWER_PAR_DIR); - DECL_STR(pack_alpha_dir, PACK_ALPHA_DIR); - DECL_STR(pack_super_dir, PACK_SUPER_DIR); - DECL_STR(pack_power_dir, PACK_POWER_DIR); - clear_folder(pack_alpha_par_dir); - make_folder_if_missing(pack_alpha_dir, "3rdparty"); - make_folder_if_missing(pack_dir, "alpha"); - copy_file(build_dir, "4ed"EXE, pack_alpha_dir, 0, 0); - //ONLY_WINDOWS(copy_file(build_dir, "4ed"PDB, pack_alpha_dir, 0, 0)); - copy_file(build_dir, "4ed_app"DLL, pack_alpha_dir, 0, 0); - //ONLY_WINDOWS(copy_file(build_dir, "4ed_app"PDB, pack_alpha_dir, 0, 0)); - copy_all (pack_data_dir, "*", pack_alpha_dir); - copy_file(0, "README.txt", pack_alpha_dir, 0, 0); - copy_file(0, "TODO.txt", pack_alpha_dir, 0, 0); - copy_file(data_dir, "release-config.4coder", pack_alpha_dir, 0, "config.4coder"); +#define PACK_ALPHA_X86_PAR_DIR "../current_dist_x86" +#define PACK_ALPHA_X86_DIR PACK_ALPHA_X86_PAR_DIR"/4coder" + DECL_STR(pack_alpha_x86_par_dir, PACK_ALPHA_X86_PAR_DIR); + DECL_STR(pack_alpha_x86_dir, PACK_ALPHA_X86_DIR); - get_4coder_dist_name(&str, 1, "alpha", "zip"); - zip(pack_alpha_par_dir, "4coder", str.str); - - // NOTE(allen): super - build_main(cdir, OPTIMIZATION | KEEP_ASSERT | DEBUG_INFO | SUPER); - do_buildsuper(cdir, Custom_Default); - - clear_folder(pack_super_par_dir); - make_folder_if_missing(pack_super_dir, "3rdparty"); - make_folder_if_missing(pack_dir, "super"); - make_folder_if_missing(pack_dir, "super-docs"); - - copy_file(build_dir, "4ed"EXE, pack_super_dir, 0, 0); - //ONLY_WINDOWS(copy_file(build_dir, "4ed"PDB, pack_super_dir, 0, 0)); - copy_file(build_dir, "4ed_app"DLL, pack_super_dir, 0, 0); - //ONLY_WINDOWS(copy_file(build_dir, "4ed_app"PDB, pack_super_dir, 0, 0)); - copy_file(build_dir, "custom_4coder"DLL, pack_super_dir, 0, 0); - - copy_all (pack_data_dir, "*", pack_super_dir); - copy_file(0, "README.txt", pack_super_dir, 0, 0); - copy_file(0, "TODO.txt", pack_super_dir, 0, 0); - copy_file(data_dir, "release-config.4coder", pack_super_dir, 0, "config.4coder"); - - copy_all(0, "4coder_*", pack_super_dir); - - copy_file(0, "buildsuper"BAT, pack_super_dir, 0, 0); - - DECL_STR(custom_dir, "4coder_API"); - DECL_STR(custom_helper_dir, "4coder_helper"); - DECL_STR(custom_lib_dir, "4coder_lib"); - DECL_STR(fcpp_dir, "4cpp"); - - char *dir_array[] = { - custom_dir, - custom_helper_dir, - custom_lib_dir, - fcpp_dir, - }; - i32 dir_count = ArrayCount(dir_array); - - for (i32 i = 0; i < dir_count; ++i){ - char *d = dir_array[i]; - make_folder_if_missing(pack_super_dir, d); + // NOTE(allen): alpha + { + char *dest_dirs[] = { + pack_alpha_dir, + pack_alpha_x86_dir, + }; - char space[256]; - String str = make_fixed_width_string(space); - append_sc(&str, pack_super_dir); - append_s_char(&str, platform_correct_slash); - append_sc(&str, d); - terminate_with_null(&str); + char *dest_par_dirs[] = { + pack_alpha_dir, + pack_alpha_x86_dir, + }; - copy_all(d, "*", str.str); + char *zip_dirs[] = { + "alpha", + "alpha_x86", + }; + + Assert(ArrayCount(dest_dirs) == ArrayCount(dest_par_dirs)); + u32 count = ArrayCount(dest_dirs); + + u32 base_flags = OPTIMIZATION | KEEP_ASSERT | DEBUG_INFO; + u32 flags[] = { + 0, + X86, + }; + + for (u32 i = 0; i < count; ++i){ + char *dir = dest_dirs[i]; + char *par_dir = dest_par_dirs[i]; + char *zip_dir = zip_dirs[i]; + + build_main(cdir, base_flags | flags[i]); + + clear_folder(par_dir); + make_folder_if_missing(dir, "3rdparty"); + make_folder_if_missing(pack_dir, zip_dir); + copy_file(build_dir, "4ed"EXE, dir, 0, 0); + copy_file(build_dir, "4ed_app"DLL, dir, 0, 0); + copy_all (pack_data_dir, "*", dir); + copy_file(0, "README.txt", dir, 0, 0); + copy_file(0, "TODO.txt", dir, 0, 0); + copy_file(data_dir, "release-config.4coder", dir, 0, "config.4coder"); + + get_4coder_dist_name(&str, 1, zip_dir, "zip"); + zip(par_dir, "4coder", str.str); + } } - get_4coder_dist_name(&str, 0, "API", "html"); - str2 = front_of_directory(str); - copy_file(site_dir, "custom_docs.html", pack_dir, "super-docs", str2.str); + // NOTE(allen): super +#define PACK_SUPER_PAR_DIR "../current_dist_super" +#define PACK_SUPER_DIR PACK_SUPER_PAR_DIR"/4coder" + DECL_STR(pack_super_par_dir, PACK_SUPER_PAR_DIR); + DECL_STR(pack_super_dir, PACK_SUPER_DIR); - get_4coder_dist_name(&str, 1, "super", "zip"); - zip(pack_super_par_dir, "4coder", str.str); +#define PACK_SUPER_X86_PAR_DIR "../current_dist_super_x86" +#define PACK_SUPER_X86_DIR PACK_SUPER_X86_PAR_DIR"/4coder" + DECL_STR(pack_super_x86_par_dir, PACK_SUPER_X86_PAR_DIR); + DECL_STR(pack_super_x86_dir, PACK_SUPER_X86_DIR); + + { + char *dest_dirs[] = { + pack_super_dir, + pack_super_x86_dir, + }; + + char *dest_par_dirs[] = { + pack_super_dir, + pack_super_x86_dir, + }; + + char *zip_dirs[] = { + "super", + "super_x86", + }; + + Assert(ArrayCount(dest_dirs) == ArrayCount(dest_par_dirs)); + u32 count = ArrayCount(dest_dirs); + + u32 base_flags = OPTIMIZATION | KEEP_ASSERT | DEBUG_INFO | SUPER; + u32 flags[] = { + 0, + X86, + }; + + for (u32 i = 0; i < count; ++i){ + char *dir = dest_dirs[i]; + char *par_dir = dest_par_dirs[i]; + char *zip_dir = zip_dirs[i]; + + build_main(cdir, base_flags | flags[i]); + do_buildsuper(cdir, Custom_Default, flags[i]); + + clear_folder(par_dir); + make_folder_if_missing(dir, "3rdparty"); + make_folder_if_missing(pack_dir, zip_dir); + + copy_file(build_dir, "4ed"EXE, dir, 0, 0); + ONLY_WINDOWS(copy_file(build_dir, "4ed"PDB, dir, 0, 0)); + copy_file(build_dir, "4ed_app"DLL, dir, 0, 0); + ONLY_WINDOWS(copy_file(build_dir, "4ed_app"PDB, dir, 0, 0)); + copy_file(build_dir, "custom_4coder"DLL, dir, 0, 0); + + copy_all (pack_data_dir, "*", dir); + copy_file(0, "README.txt", dir, 0, 0); + copy_file(0, "TODO.txt", dir, 0, 0); + copy_file(data_dir, "release-config.4coder", dir, 0, "config.4coder"); + + copy_all(0, "4coder_*", dir); + + copy_file(0, "buildsuper"BAT, dir, 0, 0); + + DECL_STR(custom_dir, "4coder_API"); + DECL_STR(custom_helper_dir, "4coder_helper"); + DECL_STR(custom_lib_dir, "4coder_lib"); + DECL_STR(fcpp_dir, "4cpp"); + + char *dir_array[] = { + custom_dir, + custom_helper_dir, + custom_lib_dir, + fcpp_dir, + }; + i32 dir_count = ArrayCount(dir_array); + + for (i32 i = 0; i < dir_count; ++i){ + char *d = dir_array[i]; + make_folder_if_missing(dir, d); + + char space[256]; + String str = make_fixed_width_string(space); + append_sc(&str, dir); + append_s_char(&str, platform_correct_slash); + append_sc(&str, d); + terminate_with_null(&str); + + copy_all(d, "*", str.str); + } + + get_4coder_dist_name(&str, 1, zip_dir, "zip"); + zip(par_dir, "4coder", str.str); + } + + make_folder_if_missing(pack_dir, "super-docs"); + get_4coder_dist_name(&str, 0, "API", "html"); + str2 = front_of_directory(str); + copy_file(site_dir, "custom_docs.html", pack_dir, "super-docs", str2.str); + } // NOTE(allen): power +#define PACK_POWER_PAR_DIR "../current_dist_power" +#define PACK_POWER_DIR PACK_POWER_PAR_DIR"/power" + DECL_STR(pack_power_par_dir, PACK_POWER_PAR_DIR); + DECL_STR(pack_power_dir, PACK_POWER_DIR); + clear_folder(pack_power_par_dir); make_folder_if_missing(pack_power_dir, 0); make_folder_if_missing(pack_dir, "power"); diff --git a/project.4coder b/project.4coder index 9b6abdc0..a42cb567 100644 --- a/project.4coder +++ b/project.4coder @@ -1,12 +1,12 @@ extensions=".c.cpp.h.hpp.bat.sh"; open_recursively=false; -fkey_command_win[1] = {"build.bat", "*compilation*", true , true }; -fkey_command_win[2] = {"site\\build.bat", "*compilation*", true , true }; +fkey_command_win[1] = {"echo build: x64 & build.bat", "*compilation*", true , true }; +fkey_command_win[2] = {"site\\build.bat", "*compilation*", true , true }; fkey_command_win[3] = {"string\\build.bat", "*compilation*", true , true }; -fkey_command_win[4] = {"build.bat /DDEV_BUILD_X86", "*compilation*", true , true }; -fkey_command_win[5] = {"..\\misc\\run.bat", "*run*", false, false}; -fkey_command_win[12] = {"package.bat", "*package*", false, 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[12] = {"package.bat", "*package*", false, true }; fkey_command_linux[1] = {"./build.sh", "*compilation*", true , true }; fkey_command_linux[2] = {"site/build.sh", "*compilation*", true , true }; diff --git a/string/4coder_string_build_num.txt b/string/4coder_string_build_num.txt index c6b47a06..6d58b80b 100644 --- a/string/4coder_string_build_num.txt +++ b/string/4coder_string_build_num.txt @@ -1,5 +1,5 @@ 1 0 -62 +63 diff --git a/string/_4coder_string.ctm b/string/_4coder_string.ctm index 00a9bc88ae56b8c26857080431de755093742252..108a7bd6b927e485e4b8166c9522a73dd51967ad 100644 GIT binary patch delta 24 gcmZn>nIf`*g-hUk-{h?CeU})S85kJ8FflLy0BrXMx&QzG delta 7 OcmbOt(ju~fg$n=)kpcez diff --git a/win32_4ed.cpp b/win32_4ed.cpp index 87ecb5df..71deb194 100644 --- a/win32_4ed.cpp +++ b/win32_4ed.cpp @@ -9,6 +9,25 @@ // TOP +// +// Architecture cracking +// + +#if defined(_M_AMD64) +# define CALL_CONVENTION +# define BUILD_X64 +#elif defined(_M_IX86) +# define CALL_CONVENTION __stdcall +# define BUILD_X86 +#else +# error architecture not supported yet +#endif + + +// +// Program setup +// + #include #include #include "4tech_defines.h" @@ -55,6 +74,7 @@ #define WM_4coder_ANIMATE (WM_USER + 0) + // // Win32_Vars structs // @@ -324,7 +344,7 @@ system_signal_cv(i32 crit_id, i32 cv_id){ WakeConditionVariable(win32vars.condition_vars + cv_id); } -internal DWORD +internal DWORD CALL_CONVENTION JobThreadProc(LPVOID lpParameter){ Thread_Context *thread = (Thread_Context*)lpParameter; Work_Queue *queue = win32vars.queues + thread->group_id; @@ -647,7 +667,7 @@ Win32FreeCoroutine(Win32_Coroutine *data){ win32vars.coroutine_free = data; } -internal void +internal void CALL_CONVENTION Win32CoroutineMain(void *arg_){ Win32_Coroutine *c = (Win32_Coroutine*)arg_; c->coroutine.func(&c->coroutine); @@ -1462,7 +1482,7 @@ Font_Load_Sig(system_draw_font_load){ #if SUPPORT_DPI pt_size = round32(pt_size * size_change(win32vars.dpi_x, win32vars.dpi_y)); #endif - + for (b32 success = 0; success == 0;){ #if USE_WIN32_FONTS @@ -1665,9 +1685,8 @@ win32_load_gl_always(char *name, HMODULE module){ return(r); } -internal void -OpenGLDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char *message, const void *userParam) -{ +internal void CALL_CONVENTION +OpenGLDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char *message, const void *userParam){ OutputDebugStringA(message); OutputDebugStringA("\n"); } @@ -1677,10 +1696,6 @@ Win32InitGL(){ // GL context initialization { PIXELFORMATDESCRIPTOR format; - int format_id; - BOOL success; - HDC dc; - format.nSize = sizeof(format); format.nVersion = 1; format.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW; @@ -1708,87 +1723,84 @@ Win32InitGL(){ format.dwVisibleMask = 0; format.dwDamageMask = 0; - dc = GetDC(win32vars.window_handle); + HDC dc = GetDC(win32vars.window_handle); Assert(dc); - format_id = ChoosePixelFormat(dc, &format); + int format_id = ChoosePixelFormat(dc, &format); Assert(format_id != 0); - success = SetPixelFormat(dc, format_id, &format); - Assert(success == TRUE); + BOOL success = SetPixelFormat(dc, format_id, &format); + Assert(success == TRUE); AllowLocal(success); HGLRC glcontext = wglCreateContext(dc); wglMakeCurrent(dc, glcontext); -#if 1 - { - HMODULE module = LoadLibraryA("opengl32.dll"); + HMODULE module = LoadLibraryA("opengl32.dll"); + AllowLocal(module); + + wglCreateContextAttribsARB_Function *wglCreateContextAttribsARB = 0; + wglCreateContextAttribsARB = (wglCreateContextAttribsARB_Function*) + win32_load_gl_always("wglCreateContextAttribsARB", module); + + wglChoosePixelFormatARB_Function *wglChoosePixelFormatARB = 0; + wglChoosePixelFormatARB = (wglChoosePixelFormatARB_Function*) + win32_load_gl_always("wglChoosePixelFormatARB", module); + + if (wglCreateContextAttribsARB != 0 && wglChoosePixelFormatARB != 0){ + const int choosePixel_attribList[] = + { + WGL_DRAW_TO_WINDOW_ARB, TRUE, + WGL_SUPPORT_OPENGL_ARB, TRUE, + //WGL_DOUBLE_BUFFER_ARB, GL_TRUE, + WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB, + WGL_COLOR_BITS_ARB, 32, + WGL_DEPTH_BITS_ARB, 24, + WGL_STENCIL_BITS_ARB, 8, + 0, + }; - wglCreateContextAttribsARB_Function *wglCreateContextAttribsARB = 0; - wglCreateContextAttribsARB = (wglCreateContextAttribsARB_Function*) - win32_load_gl_always("wglCreateContextAttribsARB", module); + i32 extended_format_id = 0; + u32 num_formats = 0; + BOOL result = wglChoosePixelFormatARB(dc, choosePixel_attribList, 0, 1, &extended_format_id, &num_formats); - wglChoosePixelFormatARB_Function *wglChoosePixelFormatARB = 0; - wglChoosePixelFormatARB = (wglChoosePixelFormatARB_Function*) - win32_load_gl_always("wglChoosePixelFormatARB", module); - - if (wglCreateContextAttribsARB != 0 && wglChoosePixelFormatARB != 0){ - const int choosePixel_attribList[] = - { - WGL_DRAW_TO_WINDOW_ARB, TRUE, - WGL_SUPPORT_OPENGL_ARB, TRUE, - //WGL_DOUBLE_BUFFER_ARB, GL_TRUE, - WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB, - WGL_COLOR_BITS_ARB, 32, - WGL_DEPTH_BITS_ARB, 24, - WGL_STENCIL_BITS_ARB, 8, - 0, + if (result != 0 && num_formats > 0){ + const int createContext_attribList[] = { + WGL_CONTEXT_MAJOR_VERSION_ARB, 3, + WGL_CONTEXT_MINOR_VERSION_ARB, 2, + WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, + 0 }; - i32 extended_format_id; - UINT num_formats = 0; - BOOL result = 0; - - result = wglChoosePixelFormatARB(dc, choosePixel_attribList, 0, 1, &extended_format_id, &num_formats); - - if (result != 0 && num_formats > 0){ - const int createContext_attribList[] = { - WGL_CONTEXT_MAJOR_VERSION_ARB, 3, - WGL_CONTEXT_MINOR_VERSION_ARB, 2, - WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, - 0 - }; - - if (extended_format_id == format_id){ - HGLRC extended_context = wglCreateContextAttribsARB(dc, 0, createContext_attribList); - if (extended_context){ - wglMakeCurrent(dc, extended_context); - wglDeleteContext(glcontext); - glcontext = extended_context; - } + if (extended_format_id == format_id){ + HGLRC extended_context = wglCreateContextAttribsARB(dc, 0, createContext_attribList); + if (extended_context){ + wglMakeCurrent(dc, extended_context); + wglDeleteContext(glcontext); + glcontext = extended_context; } } } } + +#if (defined(BUILD_X64) && 1) || (defined(BUILD_X86) && 0) +#if FRED_INTERNAL + // NOTE(casey): This slows down GL but puts error messages to + // the debug console immediately whenever you do something wrong + glDebugMessageCallback_type *glDebugMessageCallback = + (glDebugMessageCallback_type *)win32_load_gl_always("glDebugMessageCallback", module); + glDebugMessageControl_type *glDebugMessageControl = + (glDebugMessageControl_type *)win32_load_gl_always("glDebugMessageControl", module); + if(glDebugMessageCallback != 0 && glDebugMessageControl != 0) + { + glDebugMessageCallback(OpenGLDebugCallback, 0); + glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, 0, GL_TRUE); + glEnable(GL_DEBUG_OUTPUT); + glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); + } +#endif #endif ReleaseDC(win32vars.window_handle, dc); } -#if FRED_INTERNAL - // NOTE(casey): This slows down GL but puts error messages to - // the debug console immediately whenever you do something wrong - glDebugMessageCallback_type *glDebugMessageCallback = - (glDebugMessageCallback_type *)wglGetProcAddress("glDebugMessageCallback"); - glDebugMessageControl_type *glDebugMessageControl = - (glDebugMessageControl_type *)wglGetProcAddress("glDebugMessageControl"); - if(glDebugMessageCallback && glDebugMessageControl) - { - glDebugMessageCallback(OpenGLDebugCallback, 0); - glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, 0, GL_TRUE); - glEnable(GL_DEBUG_OUTPUT); - glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); - } -#endif - glEnable(GL_TEXTURE_2D); glEnable(GL_SCISSOR_TEST); glEnable(GL_BLEND); @@ -2059,7 +2071,7 @@ Win32Callback(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ return(result); } -int +int CALL_CONVENTION WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){ i32 argc = __argc; char **argv = __argv; @@ -2107,6 +2119,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS memory->id = thread->id; thread->queue = &win32vars.queues[BACKGROUND_THREADS]; + thread->handle = CreateThread(0, 0, JobThreadProc, thread, creation_flag, (LPDWORD)&thread->windows_id); } @@ -2124,7 +2137,11 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS LPVOID base; #if FRED_INTERNAL +#if defined(BUILD_X64) base = (LPVOID)TB(1); +#elif defined(BUILD_X86) + base = (LPVOID)MB(96); +#endif #else base = (LPVOID)0; #endif @@ -2133,7 +2150,11 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS memory_vars.vars_memory = VirtualAlloc(base, memory_vars.vars_memory_size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); #if FRED_INTERNAL +#if defined(BUILD_X64) base = (LPVOID)TB(2); +#elif defined(BUILD_X86) + base = (LPVOID)MB(98); +#endif #else base = (LPVOID)0; #endif @@ -2144,13 +2165,13 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS memory_vars.user_memory_size = MB(2); memory_vars.user_memory = VirtualAlloc(base, memory_vars.target_memory_size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); - if (!memory_vars.vars_memory){ - exit(1); - } - win32vars.target.max = MB(1); win32vars.target.push_buffer = (char*)system_get_memory(win32vars.target.max); + if (!memory_vars.vars_memory || !memory_vars.target_memory || !memory_vars.user_memory || !win32vars.target.push_buffer){ + exit(1); + } + // // System and Application Layer Linkage @@ -2241,7 +2262,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS WNDCLASS window_class = {}; window_class.style = CS_HREDRAW|CS_VREDRAW; - window_class.lpfnWndProc = Win32Callback; + window_class.lpfnWndProc = (WNDPROC)(Win32Callback); window_class.hInstance = hInstance; window_class.lpszClassName = "4coder-win32-wndclass"; window_class.hIcon = LoadIcon(hInstance, "main"); @@ -2345,12 +2366,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS // Main Loop // - win32vars.app.init(&win32vars.system, - &win32vars.target, - &memory_vars, - win32vars.clipboard_contents, - current_directory, - win32vars.custom_api); + win32vars.app.init(&win32vars.system, &win32vars.target, &memory_vars, win32vars.clipboard_contents, current_directory, win32vars.custom_api); system_free_memory(current_directory.str); @@ -2550,12 +2566,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS win32vars.send_exit_signal = 0; } - win32vars.app.step(&win32vars.system, - &win32vars.target, - &memory_vars, - &input, - &result, - clparams); + win32vars.app.step(&win32vars.system, &win32vars.target, &memory_vars, &input, &result, clparams); if (result.perform_kill){ keep_playing = 0; diff --git a/win32_gl.h b/win32_gl.h index c5a4a7d6..7cc6248b 100644 --- a/win32_gl.h +++ b/win32_gl.h @@ -55,7 +55,6 @@ Created 27.01.2017 (dd.mm.yyyy) #define WGL_SWAP_UNDEFINED_ARB 0x202A #define WGL_TYPE_RGBA_ARB 0x202B #define WGL_TYPE_COLORINDEX_ARB 0x202C -typedef BOOL wglChoosePixelFormatARB_Function(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); #define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001 #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 @@ -67,14 +66,25 @@ typedef BOOL wglChoosePixelFormatARB_Function(HDC hdc, const int *piAttribIList, #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 #define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 -typedef HGLRC wglCreateContextAttribsARB_Function(HDC hDC, HGLRC hshareContext, const int *attribList); -typedef const char* wglGetExtensionsStringARB_Function(HDC hdc); +typedef BOOL CALL_CONVENTION +wglChoosePixelFormatARB_Function(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); + +typedef HGLRC CALL_CONVENTION +wglCreateContextAttribsARB_Function(HDC hDC, HGLRC hshareContext, const int *attribList); + +typedef const char* CALL_CONVENTION +wglGetExtensionsStringARB_Function(HDC hdc); + +typedef void CALL_CONVENTION +GLDEBUGPROC_TYPE(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char * message, const GLvoid * userParam); -typedef void GLDEBUGPROC_TYPE(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char * message, const GLvoid * userParam); typedef GLDEBUGPROC_TYPE * GLDEBUGPROC; -typedef void glDebugMessageControl_type(GLenum source, GLenum type, GLenum severity, GLsizei count, GLuint * ids, GLboolean enabled); -typedef void glDebugMessageCallback_type(GLDEBUGPROC callback, void * userParam); +typedef void CALL_CONVENTION +glDebugMessageControl_type(GLenum source, GLenum type, GLenum severity, GLsizei count, GLuint * ids, GLboolean enabled); + +typedef void CALL_CONVENTION +glDebugMessageCallback_type(GLDEBUGPROC callback, void * userParam); #define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 #define GL_DEBUG_OUTPUT 0x92E0