Revert "fucked everything over"

This reverts commit 38414d5cb9.
master
Allen Webster 2017-07-09 15:00:13 -04:00
parent 38414d5cb9
commit f7f9192b41
4 changed files with 50 additions and 45 deletions

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 String_Temp;
internal String_Temp fm_begin_temp();
internal void fm_end_temp(String_Temp temp);
typedef umem Temp_Memory;
internal Temp_Memory fm_begin_temp();
internal void fm_end_temp(Temp_Memory 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 String_Temp
internal Temp_Memory
fm_begin_temp(){
return(fm_arena_pos);
}
internal void
fm_end_temp(String_Temp temp){
fm_end_temp(Temp_Memory 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

@ -189,19 +189,20 @@ 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
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){
@ -209,8 +210,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;
}
@ -218,7 +219,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);
}
}
@ -235,51 +236,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, "%s", define_flag);
char *define_flag = fm_str("/D", defines[i]);
fm_add_to_line(line, 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");
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);
@ -354,6 +355,8 @@ build(u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, c
}
fm_add_to_line(line, GCC_INCLUDES" %s", freetype_include);
#else
fm_add_to_line(line, GCC_INCLUDES);
#endif
}
#endif
@ -384,7 +387,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]);
@ -565,7 +568,7 @@ package(char *cdir){
char *tier = tiers[tier_index];
u32 flags = base_flags | tier_flags[tier_index];
String_Temp temp = fm_begin_temp();
Temp_Memory 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]);
@ -619,7 +622,7 @@ package(char *cdir){
// NOTE(allen): power
{
String_Temp temp = fm_begin_temp();
Temp_Memory 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

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

View File

@ -6,6 +6,16 @@ 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"
@ -14,16 +24,6 @@ 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 <stdlib.h>
#include <stdio.h>
@ -158,12 +158,11 @@ print_function_body_code(String *out, Parse_Context *context, int32_t start){
internal void
file_move(char *path, char *file_name){
fm_copy_file(fm_str(file_name), fm_str(path, file_name));
copy_file(0, file_name, path, 0, file_name);
}
int main(){
META_BEGIN();
fm_init_system();
i32 size = (512 << 20);
void *mem = malloc(size);
@ -468,11 +467,11 @@ int main(){
// NOTE(allen): Publish the new file. (Would like to be able to automatically test the result before publishing).
{
fm_make_folder_if_missing(BACKUP_FOLDER SLASH V_MAJ SLASH V_MIN);
make_folder_if_missing(BACKUP_FOLDER SLASH V_MAJ SLASH V_MIN, 0);
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);
fm_delete_file(GENERATED_FILE);
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);
}
@ -480,5 +479,8 @@ int main(){
META_FINISH();
}
#define FTECH_FILE_MOVING_IMPLEMENTATION
#include "../meta/4ed_file_moving.h"
// BOTTOM