Fixed sticky jump bug; working on 32 bit lexer crash

master
Allen Webster 2017-06-16 19:10:50 -04:00
parent 067ffdef58
commit 92e5c30663
9 changed files with 67 additions and 18 deletions

View File

@ -850,11 +850,11 @@ process_config_file(Application_Links *app){
} }
// //
// Color Scheme // Color Theme
// //
static void static void
process_color_scheme_file(Application_Links *app, char *file_name){ load_color_theme_file(Application_Links *app, char *file_name){
Partition *part = &global_part; Partition *part = &global_part;
FILE *file = fopen(file_name, "rb"); FILE *file = fopen(file_name, "rb");
@ -957,7 +957,7 @@ process_color_scheme_file(Application_Links *app, char *file_name){
} }
static void static void
load_color_themes(Application_Links *app){ load_themes_folder(Application_Links *app){
char folder_name_space[512]; char folder_name_space[512];
String folder_name = make_fixed_width_string(folder_name_space); String folder_name = make_fixed_width_string(folder_name_space);
folder_name.size = get_4ed_path(app, folder_name_space, sizeof(folder_name_space)); folder_name.size = get_4ed_path(app, folder_name_space, sizeof(folder_name_space));
@ -975,7 +975,7 @@ load_color_themes(Application_Links *app){
append(&file_name, make_string(info->filename, info->filename_len)); append(&file_name, make_string(info->filename, info->filename_len));
if (file_name.size < file_name.memory_size){ if (file_name.size < file_name.memory_size){
terminate_with_null(&file_name); terminate_with_null(&file_name);
process_color_scheme_file(app, file_name.str); load_color_theme_file(app, file_name.str);
} }
} }
} }
@ -1003,7 +1003,7 @@ static void
default_4coder_initialize(Application_Links *app, bool32 use_scrollbars, bool32 use_file_bars){ default_4coder_initialize(Application_Links *app, bool32 use_scrollbars, bool32 use_file_bars){
init_memory(app); init_memory(app);
process_config_file(app); process_config_file(app);
load_color_themes(app); load_themes_folder(app);
String theme = get_default_theme_name(); String theme = get_default_theme_name();
String font = get_default_font_name(); String font = get_default_font_name();

View File

@ -328,7 +328,12 @@ set_all_default_hooks(Bind_Helper *context){
set_open_file_hook(context, default_file_settings); set_open_file_hook(context, default_file_settings);
set_new_file_hook(context, default_new_file); set_new_file_hook(context, default_new_file);
set_save_file_hook(context, default_file_save); set_save_file_hook(context, default_file_save);
#if defined(FCODER_STICKY_JUMP)
set_end_file_hook(context, end_file_close_jump_list);
#else
set_end_file_hook(context, default_end_file); set_end_file_hook(context, default_end_file);
#endif
set_command_caller(context, default_command_caller); set_command_caller(context, default_command_caller);
set_input_filter(context, default_suppress_mouse_filter); set_input_filter(context, default_suppress_mouse_filter);

View File

@ -27,7 +27,6 @@ TYPE: 'major-system-include'
#include "4coder_system_command.cpp" #include "4coder_system_command.cpp"
#include "4coder_build_commands.cpp" #include "4coder_build_commands.cpp"
#include "4coder_project_commands.cpp" #include "4coder_project_commands.cpp"
#include "4coder_default_hooks.cpp"
#include "4coder_function_list.cpp" #include "4coder_function_list.cpp"
#if !defined(USE_OLD_STYLE_JUMPS) #if !defined(USE_OLD_STYLE_JUMPS)
@ -35,6 +34,8 @@ TYPE: 'major-system-include'
#include "4coder_sticky_jump.cpp" #include "4coder_sticky_jump.cpp"
#endif #endif
#include "4coder_default_hooks.cpp"
#include "4coder_helper/4coder_bind_helper.h" #include "4coder_helper/4coder_bind_helper.h"
#include "4coder_helper/4coder_helper.h" #include "4coder_helper/4coder_helper.h"
#include "4coder_helper/4coder_streaming.h" #include "4coder_helper/4coder_streaming.h"

View File

@ -9,7 +9,6 @@ TYPE: 'drop-in-command-pack'
#if !defined(FCODER_STICKY_JUMP) && !defined(FCODER_JUMP_COMMANDS) #if !defined(FCODER_STICKY_JUMP) && !defined(FCODER_JUMP_COMMANDS)
#define FCODER_STICKY_JUMP #define FCODER_STICKY_JUMP
#define FCODER_JUMP_COMMANDS #define FCODER_JUMP_COMMANDS
#include "4coder_default_framework.h" #include "4coder_default_framework.h"
@ -587,6 +586,7 @@ CUSTOM_COMMAND_SIG(newline_or_goto_position_same_panel){
// End File Hook // End File Hook
// //
OPEN_FILE_HOOK_SIG(default_end_file);
OPEN_FILE_HOOK_SIG(end_file_close_jump_list){ OPEN_FILE_HOOK_SIG(end_file_close_jump_list){
Marker_List *list = get_marker_list_for_buffer(buffer_id); Marker_List *list = get_marker_list_for_buffer(buffer_id);
if (list != 0){ if (list != 0){

View File

@ -582,7 +582,7 @@ setup_command_table(){
// App Functions // App Functions
internal void internal void
app_hardcode_styles(Models *models){ app_hardcode_default_style(Models *models){
Interactive_Style file_info_style = {0}; Interactive_Style file_info_style = {0};
Style *styles = models->styles.styles; Style *styles = models->styles.styles;
Style *style = styles + 1; Style *style = styles + 1;
@ -1140,7 +1140,7 @@ App_Init_Sig(app_init){
// NOTE(allen): style setup // NOTE(allen): style setup
models->global_font_id = 1; models->global_font_id = 1;
app_hardcode_styles(models); app_hardcode_default_style(models);
// NOTE(allen): init first panel // NOTE(allen): init first panel
Command_Data *cmd = &vars->command_data; Command_Data *cmd = &vars->command_data;

View File

@ -22,7 +22,9 @@
#include "4ed_system.h" #include "4ed_system.h"
#include "4ed_profile.h" #include "4ed_profile.h"
//#define USE_DEBUG_MEMORY // TODO(allen): set in compilation line
#define PREFERRED_ALIGNMENT 8
#define USE_DEBUG_MEMORY
#define FSTRING_IMPLEMENTATION #define FSTRING_IMPLEMENTATION
#define FSTRING_C #define FSTRING_C

View File

@ -12,7 +12,7 @@
#ifndef FED_DEBUG_MEM_H #ifndef FED_DEBUG_MEM_H
#define FED_DEBUG_MEM_H #define FED_DEBUG_MEM_H
// NOTE(allen): revent any future instantiation of 4coder_mem.h // NOTE(allen): Prevent any future instantiation of 4coder_mem.h
#define FCODER_MEM_H #define FCODER_MEM_H
#if !defined(OS_PAGE_SIZE) #if !defined(OS_PAGE_SIZE)
@ -31,17 +31,30 @@ debug_gm_open(System_Functions *system, Debug_GM *general, void *memory, i32 siz
static void* static void*
debug_gm_allocate(Debug_GM *general, int32_t size){ debug_gm_allocate(Debug_GM *general, int32_t size){
System_Functions *system = general->system; System_Functions *system = general->system;
local_persist u32 round_val = OS_PAGE_SIZE-1;
size = (size + round_val) & (~round_val); local_persist u32 page_round_val = OS_PAGE_SIZE-1;
void *result = system->memory_allocate(size + OS_PAGE_SIZE); int32_t page_rounded_size = (size + page_round_val) & (~page_round_val);
system->memory_set_protection((u8*)result + size, OS_PAGE_SIZE, 0); u8 *result = (u8*)system->memory_allocate(page_rounded_size + OS_PAGE_SIZE);
return(result); system->memory_set_protection(result + page_rounded_size, OS_PAGE_SIZE, 0);
local_persist u32 align_round_val = PREFERRED_ALIGNMENT-1;
int32_t align_rounded_size = (size + align_round_val) & (~align_round_val);
int32_t offset = page_rounded_size - align_rounded_size;
return(result + offset);
} }
static void static void
debug_gm_free(Debug_GM *general, void *memory){ debug_gm_free(Debug_GM *general, void *memory){
u8 *ptr = (u8*)memory;
umem val = *(umem*)(&ptr);
val &= ~(0xFFF);
ptr = *(u8**)(&val);
Assert(sizeof(val) == sizeof(ptr));
System_Functions *system = general->system; System_Functions *system = general->system;
system->memory_free(memory, 0); system->memory_free(ptr, 0);
} }
static void* static void*

View File

@ -574,6 +574,20 @@ get_4coder_dist_name(String *zip_file, b32 OS_specific, char *folder, char *tier
slash_fix(zip_file->str); slash_fix(zip_file->str);
} }
static void
copy_folder(char *dst_dir, char *src_folder){
make_folder_if_missing(dst_dir, src_folder);
char space[256];
String copy_name = make_fixed_width_string(space);
append_sc(&copy_name, dst_dir);
append_s_char(&copy_name, platform_correct_slash);
append_sc(&copy_name, src_folder);
terminate_with_null(&copy_name);
copy_all(src_folder, "*", copy_name.str);
}
static void static void
package(char *cdir){ package(char *cdir){
char str_space[1024]; char str_space[1024];
@ -665,6 +679,8 @@ package(char *cdir){
copy_all(pack_fonts_dir, "*", fonts_dir); copy_all(pack_fonts_dir, "*", fonts_dir);
copy_file(data_dir, "release-config.4coder", dir, 0, "config.4coder"); copy_file(data_dir, "release-config.4coder", dir, 0, "config.4coder");
copy_folder(dir, "themes");
get_4coder_dist_name(&str, true, zip_dir, tier, arch, "zip"); get_4coder_dist_name(&str, true, zip_dir, tier, arch, "zip");
zip(par_dir, "4coder", str.str); zip(par_dir, "4coder", str.str);
} }
@ -747,11 +763,20 @@ package(char *cdir){
copy_file(0, "buildsuper" BAT, dir, 0, 0); copy_file(0, "buildsuper" BAT, dir, 0, 0);
copy_folder(dir, "4coder_API");
copy_folder(dir, "4coder_helper");
copy_folder(dir, "4coder_lib");
copy_folder(dir, "4cpp");
copy_folder(dir, "languages");
copy_folder(dir, "themes");
#if 0
DECL_STR(custom_dir, "4coder_API"); DECL_STR(custom_dir, "4coder_API");
DECL_STR(custom_helper_dir, "4coder_helper"); DECL_STR(custom_helper_dir, "4coder_helper");
DECL_STR(custom_lib_dir, "4coder_lib"); DECL_STR(custom_lib_dir, "4coder_lib");
DECL_STR(fcpp_dir, "4cpp"); DECL_STR(fcpp_dir, "4cpp");
DECL_STR(languages, "languages"); DECL_STR(languages, "languages");
DECL_STR(themes, "themes");
char *dir_array[] = { char *dir_array[] = {
custom_dir, custom_dir,
@ -759,6 +784,7 @@ package(char *cdir){
custom_lib_dir, custom_lib_dir,
fcpp_dir, fcpp_dir,
languages, languages,
themes,
}; };
i32 dir_count = ArrayCount(dir_array); i32 dir_count = ArrayCount(dir_array);
@ -775,6 +801,7 @@ package(char *cdir){
copy_all(d, "*", copy_name.str); copy_all(d, "*", copy_name.str);
} }
#endif
get_4coder_dist_name(&str, true, zip_dir, tier, arch, "zip"); get_4coder_dist_name(&str, true, zip_dir, tier, arch, "zip");
zip(par_dir, "4coder", str.str); zip(par_dir, "4coder", str.str);
@ -835,7 +862,7 @@ int main(int argc, char **argv){
assert(n < sizeof(cdir)); assert(n < sizeof(cdir));
END_TIME_SECTION("current directory"); END_TIME_SECTION("current directory");
u32 floags = DEBUG_INFO | SUPER | INTERNAL | X86 | LOG; u32 flags = DEBUG_INFO | SUPER | INTERNAL | X86 | LOG;
standard_build(cdir, flags); standard_build(cdir, flags);

View File

@ -4,6 +4,7 @@ open_recursively=true;
fkey_command_win[1] = {"echo build: x64 & build.bat", "*compilation*", true , true }; fkey_command_win[1] = {"echo build: x64 & build.bat", "*compilation*", true , true };
fkey_command_win[2] = {"site\\build.bat", "*site*", false , true }; fkey_command_win[2] = {"site\\build.bat", "*site*", false , true };
fkey_command_win[3] = {"string\\build.bat", "*compilation*", true , 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[5] = {"..\\misc\\run.bat", "*run*", false, false };
fkey_command_win[6] = {"run_profile.bat", "*profile*", false, true }; fkey_command_win[6] = {"run_profile.bat", "*profile*", false, true };
fkey_command_win[12] = {"package.bat", "*package*", false, true }; fkey_command_win[12] = {"package.bat", "*package*", false, true };