From 6e370c5de0a9521cb9ebc14ba53e676f70b40eed Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Sat, 15 Dec 2018 15:31:00 -0800 Subject: [PATCH] Fixed scratch arena problem in new win32 file track --- 4coder_generated/command_metadata.h | 336 ++++++++++++++----------- platform_win32/win32_4ed.cpp | 21 +- platform_win32/win32_4ed_functions.cpp | 32 +-- platform_win32/win32_error_box.cpp | 2 +- platform_win32/win32_utf8.cpp | 27 +- platform_win32/win32_utf8.h | 18 +- 6 files changed, 233 insertions(+), 203 deletions(-) diff --git a/4coder_generated/command_metadata.h b/4coder_generated/command_metadata.h index 784985ee..204f015d 100644 --- a/4coder_generated/command_metadata.h +++ b/4coder_generated/command_metadata.h @@ -2,7 +2,7 @@ #define command_id(c) (fcoder_metacmd_ID_##c) #define command_metadata(c) (&fcoder_metacmd_table[command_id(c)]) #define command_metadata_by_id(id) (&fcoder_metacmd_table[id]) -#define command_one_past_last_id 216 +#define command_one_past_last_id 228 #if defined(CUSTOM_COMMAND_SIG) #define PROC_LINKS(x,y) x #else @@ -77,6 +77,7 @@ CUSTOM_COMMAND_SIG(interactive_open); CUSTOM_COMMAND_SIG(interactive_open_or_new); CUSTOM_COMMAND_SIG(interactive_switch_buffer); CUSTOM_COMMAND_SIG(kill_buffer); +CUSTOM_COMMAND_SIG(kill_rect); CUSTOM_COMMAND_SIG(left_adjust_view); CUSTOM_COMMAND_SIG(list_all_functions_all_buffers); CUSTOM_COMMAND_SIG(list_all_functions_all_buffers_lister); @@ -111,6 +112,12 @@ CUSTOM_COMMAND_SIG(lister__write_character__file_path); CUSTOM_COMMAND_SIG(lister__write_character__fixed_list); CUSTOM_COMMAND_SIG(load_project); CUSTOM_COMMAND_SIG(make_directory_query); +CUSTOM_COMMAND_SIG(miblo_decrement_basic); +CUSTOM_COMMAND_SIG(miblo_decrement_time_stamp); +CUSTOM_COMMAND_SIG(miblo_decrement_time_stamp_minute); +CUSTOM_COMMAND_SIG(miblo_increment_basic); +CUSTOM_COMMAND_SIG(miblo_increment_time_stamp); +CUSTOM_COMMAND_SIG(miblo_increment_time_stamp_minute); CUSTOM_COMMAND_SIG(mouse_wheel_scroll); CUSTOM_COMMAND_SIG(move_down); CUSTOM_COMMAND_SIG(move_down_10); @@ -121,6 +128,7 @@ CUSTOM_COMMAND_SIG(move_line_up); CUSTOM_COMMAND_SIG(move_right); CUSTOM_COMMAND_SIG(move_up); CUSTOM_COMMAND_SIG(move_up_10); +CUSTOM_COMMAND_SIG(multi_line_edit); CUSTOM_COMMAND_SIG(newline_or_goto_position_direct); CUSTOM_COMMAND_SIG(newline_or_goto_position_same_panel_direct); CUSTOM_COMMAND_SIG(newline_or_goto_position_same_panel_sticky); @@ -153,7 +161,9 @@ CUSTOM_COMMAND_SIG(redo); CUSTOM_COMMAND_SIG(reload_themes); CUSTOM_COMMAND_SIG(remap_interactive); CUSTOM_COMMAND_SIG(rename_file_query); +CUSTOM_COMMAND_SIG(rename_parameter); CUSTOM_COMMAND_SIG(reopen); +CUSTOM_COMMAND_SIG(replace_all_occurrences); CUSTOM_COMMAND_SIG(replace_in_range); CUSTOM_COMMAND_SIG(reverse_search); CUSTOM_COMMAND_SIG(reverse_search_identifier); @@ -220,6 +230,8 @@ CUSTOM_COMMAND_SIG(word_complete); CUSTOM_COMMAND_SIG(write_and_auto_tab); CUSTOM_COMMAND_SIG(write_block); CUSTOM_COMMAND_SIG(write_character); +CUSTOM_COMMAND_SIG(write_explicit_enum_flags); +CUSTOM_COMMAND_SIG(write_explicit_enum_values); CUSTOM_COMMAND_SIG(write_hack); CUSTOM_COMMAND_SIG(write_note); CUSTOM_COMMAND_SIG(write_todo); @@ -236,7 +248,7 @@ char *source_name; int32_t source_name_len; int32_t line_number; }; -static Command_Metadata fcoder_metacmd_table[216] = { +static Command_Metadata fcoder_metacmd_table[228] = { { PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 240 }, { PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 722 }, { PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 733 }, @@ -305,6 +317,7 @@ static Command_Metadata fcoder_metacmd_table[216] = { { PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 28, 819 }, { PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 729 }, { PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1538 }, +{ PROC_LINKS(kill_rect, 0), "kill_rect", 9, "Delete characters in a rectangular region. Range testing is done by unwrapped-xy coordinates.", 93, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 26 }, { PROC_LINKS(left_adjust_view, 0), "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 133 }, { PROC_LINKS(list_all_functions_all_buffers, 0), "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 343 }, { PROC_LINKS(list_all_functions_all_buffers_lister, 0), "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 349 }, @@ -339,6 +352,12 @@ static Command_Metadata fcoder_metacmd_table[216] = { { PROC_LINKS(lister__write_character__fixed_list, 0), "lister__write_character__fixed_list", 35, "A lister mode command that handles input for the fixed sure to kill list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 28, 253 }, { PROC_LINKS(load_project, 0), "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1083 }, { PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1226 }, +{ PROC_LINKS(miblo_decrement_basic, 0), "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 110 }, +{ PROC_LINKS(miblo_decrement_time_stamp, 0), "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 383 }, +{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), "miblo_decrement_time_stamp_minute", 33, "Decrement a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 395 }, +{ PROC_LINKS(miblo_increment_basic, 0), "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 94 }, +{ PROC_LINKS(miblo_increment_time_stamp, 0), "miblo_increment_time_stamp", 26, "Increment a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 377 }, +{ PROC_LINKS(miblo_increment_time_stamp_minute, 0), "miblo_increment_time_stamp_minute", 33, "Increment a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 389 }, { PROC_LINKS(mouse_wheel_scroll, 0), "mouse_wheel_scroll", 18, "Reads the scroll wheel value from the mouse state and scrolls accordingly.", 74, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 226 }, { PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 290 }, { PROC_LINKS(move_down_10, 0), "move_down_10", 12, "Moves the cursor down ten lines.", 32, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 302 }, @@ -349,6 +368,7 @@ static Command_Metadata fcoder_metacmd_table[216] = { { PROC_LINKS(move_right, 0), "move_right", 10, "Moves the cursor one character to the right.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 349 }, { PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 284 }, { PROC_LINKS(move_up_10, 0), "move_up_10", 10, "Moves the cursor up ten lines.", 30, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 296 }, +{ PROC_LINKS(multi_line_edit, 0), "multi_line_edit", 15, "Begin multi-line mode. In multi-line mode characters are inserted at every line between the mark and cursor. All characters are inserted at the same character offset into the line. This mode uses line_char coordinates.", 221, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 117 }, { PROC_LINKS(newline_or_goto_position_direct, 0), "newline_or_goto_position_direct", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 101 }, { PROC_LINKS(newline_or_goto_position_same_panel_direct, 0), "newline_or_goto_position_same_panel_direct", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 116 }, { PROC_LINKS(newline_or_goto_position_same_panel_sticky, 0), "newline_or_goto_position_same_panel_sticky", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 588 }, @@ -381,7 +401,9 @@ static Command_Metadata fcoder_metacmd_table[216] = { { PROC_LINKS(reload_themes, 0), "reload_themes", 13, "Loads all the theme files in the theme folder, replacing duplicates with the new theme data.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1577 }, { PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 290 }, { PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1184 }, +{ PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 383 }, { PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1553 }, +{ PROC_LINKS(replace_all_occurrences, 0), "replace_all_occurrences", 23, "Queries the user for two strings, and replaces all occurrences of the first string with the second string in all open buffers.", 126, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 778 }, { PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for two strings, and replaces all occurences of the first string in the range between the cursor and the mark with the second string.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 883 }, { PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 854 }, { PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 872 }, @@ -448,6 +470,8 @@ static Command_Metadata fcoder_metacmd_table[216] = { { PROC_LINKS(write_and_auto_tab, 0), "write_and_auto_tab", 18, "Inserts a character and auto-indents the line on which the cursor sits.", 71, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 745 }, { PROC_LINKS(write_block, 0), "write_block", 11, "At the cursor, insert a block comment.", 38, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 105 }, { PROC_LINKS(write_character, 0), "write_character", 15, "Inserts whatever character was used to trigger this command.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 35 }, +{ PROC_LINKS(write_explicit_enum_flags, 0), "write_explicit_enum_flags", 25, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in to give each a unique power of 2 value, starting from 1. Existing values are overwritten.", 194, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 705 }, +{ PROC_LINKS(write_explicit_enum_values, 0), "write_explicit_enum_values", 26, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in sequentially starting from zero. Existing values are overwritten.", 170, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 699 }, { PROC_LINKS(write_hack, 0), "write_hack", 10, "At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 93 }, { PROC_LINKS(write_note, 0), "write_note", 10, "At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 99 }, { PROC_LINKS(write_todo, 0), "write_todo", 10, "At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 87 }, @@ -522,152 +546,164 @@ static int32_t fcoder_metacmd_ID_interactive_open = 64; static int32_t fcoder_metacmd_ID_interactive_open_or_new = 65; static int32_t fcoder_metacmd_ID_interactive_switch_buffer = 66; static int32_t fcoder_metacmd_ID_kill_buffer = 67; -static int32_t fcoder_metacmd_ID_left_adjust_view = 68; -static int32_t fcoder_metacmd_ID_list_all_functions_all_buffers = 69; -static int32_t fcoder_metacmd_ID_list_all_functions_all_buffers_lister = 70; -static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer = 71; -static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer_lister = 72; -static int32_t fcoder_metacmd_ID_list_all_locations = 73; -static int32_t fcoder_metacmd_ID_list_all_locations_case_insensitive = 74; -static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier = 75; -static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 76; -static int32_t fcoder_metacmd_ID_list_all_locations_of_selection = 77; -static int32_t fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 78; -static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition = 79; -static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 80; -static int32_t fcoder_metacmd_ID_list_all_substring_locations = 81; -static int32_t fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 82; -static int32_t fcoder_metacmd_ID_lister__activate = 83; -static int32_t fcoder_metacmd_ID_lister__backspace_text_field = 84; -static int32_t fcoder_metacmd_ID_lister__backspace_text_field__default = 85; -static int32_t fcoder_metacmd_ID_lister__backspace_text_field__file_path = 86; -static int32_t fcoder_metacmd_ID_lister__mouse_press = 87; -static int32_t fcoder_metacmd_ID_lister__mouse_release = 88; -static int32_t fcoder_metacmd_ID_lister__move_down = 89; -static int32_t fcoder_metacmd_ID_lister__move_down__default = 90; -static int32_t fcoder_metacmd_ID_lister__move_up = 91; -static int32_t fcoder_metacmd_ID_lister__move_up__default = 92; -static int32_t fcoder_metacmd_ID_lister__quit = 93; -static int32_t fcoder_metacmd_ID_lister__repaint = 94; -static int32_t fcoder_metacmd_ID_lister__wheel_scroll = 95; -static int32_t fcoder_metacmd_ID_lister__write_character = 96; -static int32_t fcoder_metacmd_ID_lister__write_character__default = 97; -static int32_t fcoder_metacmd_ID_lister__write_character__file_path = 98; -static int32_t fcoder_metacmd_ID_lister__write_character__fixed_list = 99; -static int32_t fcoder_metacmd_ID_load_project = 100; -static int32_t fcoder_metacmd_ID_make_directory_query = 101; -static int32_t fcoder_metacmd_ID_mouse_wheel_scroll = 102; -static int32_t fcoder_metacmd_ID_move_down = 103; -static int32_t fcoder_metacmd_ID_move_down_10 = 104; -static int32_t fcoder_metacmd_ID_move_down_textual = 105; -static int32_t fcoder_metacmd_ID_move_left = 106; -static int32_t fcoder_metacmd_ID_move_line_down = 107; -static int32_t fcoder_metacmd_ID_move_line_up = 108; -static int32_t fcoder_metacmd_ID_move_right = 109; -static int32_t fcoder_metacmd_ID_move_up = 110; -static int32_t fcoder_metacmd_ID_move_up_10 = 111; -static int32_t fcoder_metacmd_ID_newline_or_goto_position_direct = 112; -static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_direct = 113; -static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_sticky = 114; -static int32_t fcoder_metacmd_ID_newline_or_goto_position_sticky = 115; -static int32_t fcoder_metacmd_ID_open_all_code = 116; -static int32_t fcoder_metacmd_ID_open_all_code_recursive = 117; -static int32_t fcoder_metacmd_ID_open_color_tweaker = 118; -static int32_t fcoder_metacmd_ID_open_file_in_quotes = 119; -static int32_t fcoder_metacmd_ID_open_in_other = 120; -static int32_t fcoder_metacmd_ID_open_long_braces = 121; -static int32_t fcoder_metacmd_ID_open_long_braces_break = 122; -static int32_t fcoder_metacmd_ID_open_long_braces_semicolon = 123; -static int32_t fcoder_metacmd_ID_open_matching_file_cpp = 124; -static int32_t fcoder_metacmd_ID_open_panel_hsplit = 125; -static int32_t fcoder_metacmd_ID_open_panel_vsplit = 126; -static int32_t fcoder_metacmd_ID_page_down = 127; -static int32_t fcoder_metacmd_ID_page_up = 128; -static int32_t fcoder_metacmd_ID_paste = 129; -static int32_t fcoder_metacmd_ID_paste_and_indent = 130; -static int32_t fcoder_metacmd_ID_paste_next = 131; -static int32_t fcoder_metacmd_ID_paste_next_and_indent = 132; -static int32_t fcoder_metacmd_ID_place_in_scope = 133; -static int32_t fcoder_metacmd_ID_project_command_lister = 134; -static int32_t fcoder_metacmd_ID_project_fkey_command = 135; -static int32_t fcoder_metacmd_ID_project_go_to_root_directory = 136; -static int32_t fcoder_metacmd_ID_query_replace = 137; -static int32_t fcoder_metacmd_ID_query_replace_identifier = 138; -static int32_t fcoder_metacmd_ID_query_replace_selection = 139; -static int32_t fcoder_metacmd_ID_redo = 140; -static int32_t fcoder_metacmd_ID_reload_themes = 141; -static int32_t fcoder_metacmd_ID_remap_interactive = 142; -static int32_t fcoder_metacmd_ID_rename_file_query = 143; -static int32_t fcoder_metacmd_ID_reopen = 144; -static int32_t fcoder_metacmd_ID_replace_in_range = 145; -static int32_t fcoder_metacmd_ID_reverse_search = 146; -static int32_t fcoder_metacmd_ID_reverse_search_identifier = 147; -static int32_t fcoder_metacmd_ID_save = 148; -static int32_t fcoder_metacmd_ID_save_all_dirty_buffers = 149; -static int32_t fcoder_metacmd_ID_save_to_query = 150; -static int32_t fcoder_metacmd_ID_scope_absorb_down = 151; -static int32_t fcoder_metacmd_ID_search = 152; -static int32_t fcoder_metacmd_ID_search_identifier = 153; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_left = 154; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_left = 155; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_right = 156; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_right = 157; -static int32_t fcoder_metacmd_ID_seek_beginning_of_line = 158; -static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 159; -static int32_t fcoder_metacmd_ID_seek_end_of_line = 160; -static int32_t fcoder_metacmd_ID_seek_end_of_textual_line = 161; -static int32_t fcoder_metacmd_ID_seek_token_left = 162; -static int32_t fcoder_metacmd_ID_seek_token_right = 163; -static int32_t fcoder_metacmd_ID_seek_white_or_token_left = 164; -static int32_t fcoder_metacmd_ID_seek_white_or_token_right = 165; -static int32_t fcoder_metacmd_ID_seek_whitespace_down = 166; -static int32_t fcoder_metacmd_ID_seek_whitespace_down_end_line = 167; -static int32_t fcoder_metacmd_ID_seek_whitespace_left = 168; -static int32_t fcoder_metacmd_ID_seek_whitespace_right = 169; -static int32_t fcoder_metacmd_ID_seek_whitespace_up = 170; -static int32_t fcoder_metacmd_ID_seek_whitespace_up_end_line = 171; -static int32_t fcoder_metacmd_ID_select_all = 172; -static int32_t fcoder_metacmd_ID_select_next_scope_absolute = 173; -static int32_t fcoder_metacmd_ID_select_prev_scope_absolute = 174; -static int32_t fcoder_metacmd_ID_select_surrounding_scope = 175; -static int32_t fcoder_metacmd_ID_set_bindings_choose = 176; -static int32_t fcoder_metacmd_ID_set_bindings_default = 177; -static int32_t fcoder_metacmd_ID_set_bindings_mac_default = 178; -static int32_t fcoder_metacmd_ID_set_mark = 179; -static int32_t fcoder_metacmd_ID_set_mode_to_notepad_like = 180; -static int32_t fcoder_metacmd_ID_set_mode_to_original = 181; -static int32_t fcoder_metacmd_ID_setup_build_bat = 182; -static int32_t fcoder_metacmd_ID_setup_build_bat_and_sh = 183; -static int32_t fcoder_metacmd_ID_setup_build_sh = 184; -static int32_t fcoder_metacmd_ID_setup_new_project = 185; -static int32_t fcoder_metacmd_ID_show_filebar = 186; -static int32_t fcoder_metacmd_ID_show_scrollbar = 187; -static int32_t fcoder_metacmd_ID_snipe_token_or_word = 188; -static int32_t fcoder_metacmd_ID_snipe_token_or_word_right = 189; -static int32_t fcoder_metacmd_ID_snippet_lister = 190; -static int32_t fcoder_metacmd_ID_suppress_mouse = 191; -static int32_t fcoder_metacmd_ID_swap_buffers_between_panels = 192; -static int32_t fcoder_metacmd_ID_to_lowercase = 193; -static int32_t fcoder_metacmd_ID_to_uppercase = 194; -static int32_t fcoder_metacmd_ID_toggle_filebar = 195; -static int32_t fcoder_metacmd_ID_toggle_fullscreen = 196; -static int32_t fcoder_metacmd_ID_toggle_highlight_enclosing_scopes = 197; -static int32_t fcoder_metacmd_ID_toggle_highlight_line_at_cursor = 198; -static int32_t fcoder_metacmd_ID_toggle_line_wrap = 199; -static int32_t fcoder_metacmd_ID_toggle_mouse = 200; -static int32_t fcoder_metacmd_ID_toggle_paren_matching_helper = 201; -static int32_t fcoder_metacmd_ID_toggle_show_whitespace = 202; -static int32_t fcoder_metacmd_ID_toggle_virtual_whitespace = 203; -static int32_t fcoder_metacmd_ID_undo = 204; -static int32_t fcoder_metacmd_ID_view_buffer_other_panel = 205; -static int32_t fcoder_metacmd_ID_view_jump_list_with_lister = 206; -static int32_t fcoder_metacmd_ID_word_complete = 207; -static int32_t fcoder_metacmd_ID_write_and_auto_tab = 208; -static int32_t fcoder_metacmd_ID_write_block = 209; -static int32_t fcoder_metacmd_ID_write_character = 210; -static int32_t fcoder_metacmd_ID_write_hack = 211; -static int32_t fcoder_metacmd_ID_write_note = 212; -static int32_t fcoder_metacmd_ID_write_todo = 213; -static int32_t fcoder_metacmd_ID_write_underscore = 214; -static int32_t fcoder_metacmd_ID_write_zero_struct = 215; +static int32_t fcoder_metacmd_ID_kill_rect = 68; +static int32_t fcoder_metacmd_ID_left_adjust_view = 69; +static int32_t fcoder_metacmd_ID_list_all_functions_all_buffers = 70; +static int32_t fcoder_metacmd_ID_list_all_functions_all_buffers_lister = 71; +static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer = 72; +static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer_lister = 73; +static int32_t fcoder_metacmd_ID_list_all_locations = 74; +static int32_t fcoder_metacmd_ID_list_all_locations_case_insensitive = 75; +static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier = 76; +static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 77; +static int32_t fcoder_metacmd_ID_list_all_locations_of_selection = 78; +static int32_t fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 79; +static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition = 80; +static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 81; +static int32_t fcoder_metacmd_ID_list_all_substring_locations = 82; +static int32_t fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 83; +static int32_t fcoder_metacmd_ID_lister__activate = 84; +static int32_t fcoder_metacmd_ID_lister__backspace_text_field = 85; +static int32_t fcoder_metacmd_ID_lister__backspace_text_field__default = 86; +static int32_t fcoder_metacmd_ID_lister__backspace_text_field__file_path = 87; +static int32_t fcoder_metacmd_ID_lister__mouse_press = 88; +static int32_t fcoder_metacmd_ID_lister__mouse_release = 89; +static int32_t fcoder_metacmd_ID_lister__move_down = 90; +static int32_t fcoder_metacmd_ID_lister__move_down__default = 91; +static int32_t fcoder_metacmd_ID_lister__move_up = 92; +static int32_t fcoder_metacmd_ID_lister__move_up__default = 93; +static int32_t fcoder_metacmd_ID_lister__quit = 94; +static int32_t fcoder_metacmd_ID_lister__repaint = 95; +static int32_t fcoder_metacmd_ID_lister__wheel_scroll = 96; +static int32_t fcoder_metacmd_ID_lister__write_character = 97; +static int32_t fcoder_metacmd_ID_lister__write_character__default = 98; +static int32_t fcoder_metacmd_ID_lister__write_character__file_path = 99; +static int32_t fcoder_metacmd_ID_lister__write_character__fixed_list = 100; +static int32_t fcoder_metacmd_ID_load_project = 101; +static int32_t fcoder_metacmd_ID_make_directory_query = 102; +static int32_t fcoder_metacmd_ID_miblo_decrement_basic = 103; +static int32_t fcoder_metacmd_ID_miblo_decrement_time_stamp = 104; +static int32_t fcoder_metacmd_ID_miblo_decrement_time_stamp_minute = 105; +static int32_t fcoder_metacmd_ID_miblo_increment_basic = 106; +static int32_t fcoder_metacmd_ID_miblo_increment_time_stamp = 107; +static int32_t fcoder_metacmd_ID_miblo_increment_time_stamp_minute = 108; +static int32_t fcoder_metacmd_ID_mouse_wheel_scroll = 109; +static int32_t fcoder_metacmd_ID_move_down = 110; +static int32_t fcoder_metacmd_ID_move_down_10 = 111; +static int32_t fcoder_metacmd_ID_move_down_textual = 112; +static int32_t fcoder_metacmd_ID_move_left = 113; +static int32_t fcoder_metacmd_ID_move_line_down = 114; +static int32_t fcoder_metacmd_ID_move_line_up = 115; +static int32_t fcoder_metacmd_ID_move_right = 116; +static int32_t fcoder_metacmd_ID_move_up = 117; +static int32_t fcoder_metacmd_ID_move_up_10 = 118; +static int32_t fcoder_metacmd_ID_multi_line_edit = 119; +static int32_t fcoder_metacmd_ID_newline_or_goto_position_direct = 120; +static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_direct = 121; +static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_sticky = 122; +static int32_t fcoder_metacmd_ID_newline_or_goto_position_sticky = 123; +static int32_t fcoder_metacmd_ID_open_all_code = 124; +static int32_t fcoder_metacmd_ID_open_all_code_recursive = 125; +static int32_t fcoder_metacmd_ID_open_color_tweaker = 126; +static int32_t fcoder_metacmd_ID_open_file_in_quotes = 127; +static int32_t fcoder_metacmd_ID_open_in_other = 128; +static int32_t fcoder_metacmd_ID_open_long_braces = 129; +static int32_t fcoder_metacmd_ID_open_long_braces_break = 130; +static int32_t fcoder_metacmd_ID_open_long_braces_semicolon = 131; +static int32_t fcoder_metacmd_ID_open_matching_file_cpp = 132; +static int32_t fcoder_metacmd_ID_open_panel_hsplit = 133; +static int32_t fcoder_metacmd_ID_open_panel_vsplit = 134; +static int32_t fcoder_metacmd_ID_page_down = 135; +static int32_t fcoder_metacmd_ID_page_up = 136; +static int32_t fcoder_metacmd_ID_paste = 137; +static int32_t fcoder_metacmd_ID_paste_and_indent = 138; +static int32_t fcoder_metacmd_ID_paste_next = 139; +static int32_t fcoder_metacmd_ID_paste_next_and_indent = 140; +static int32_t fcoder_metacmd_ID_place_in_scope = 141; +static int32_t fcoder_metacmd_ID_project_command_lister = 142; +static int32_t fcoder_metacmd_ID_project_fkey_command = 143; +static int32_t fcoder_metacmd_ID_project_go_to_root_directory = 144; +static int32_t fcoder_metacmd_ID_query_replace = 145; +static int32_t fcoder_metacmd_ID_query_replace_identifier = 146; +static int32_t fcoder_metacmd_ID_query_replace_selection = 147; +static int32_t fcoder_metacmd_ID_redo = 148; +static int32_t fcoder_metacmd_ID_reload_themes = 149; +static int32_t fcoder_metacmd_ID_remap_interactive = 150; +static int32_t fcoder_metacmd_ID_rename_file_query = 151; +static int32_t fcoder_metacmd_ID_rename_parameter = 152; +static int32_t fcoder_metacmd_ID_reopen = 153; +static int32_t fcoder_metacmd_ID_replace_all_occurrences = 154; +static int32_t fcoder_metacmd_ID_replace_in_range = 155; +static int32_t fcoder_metacmd_ID_reverse_search = 156; +static int32_t fcoder_metacmd_ID_reverse_search_identifier = 157; +static int32_t fcoder_metacmd_ID_save = 158; +static int32_t fcoder_metacmd_ID_save_all_dirty_buffers = 159; +static int32_t fcoder_metacmd_ID_save_to_query = 160; +static int32_t fcoder_metacmd_ID_scope_absorb_down = 161; +static int32_t fcoder_metacmd_ID_search = 162; +static int32_t fcoder_metacmd_ID_search_identifier = 163; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_left = 164; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_left = 165; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_right = 166; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_right = 167; +static int32_t fcoder_metacmd_ID_seek_beginning_of_line = 168; +static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 169; +static int32_t fcoder_metacmd_ID_seek_end_of_line = 170; +static int32_t fcoder_metacmd_ID_seek_end_of_textual_line = 171; +static int32_t fcoder_metacmd_ID_seek_token_left = 172; +static int32_t fcoder_metacmd_ID_seek_token_right = 173; +static int32_t fcoder_metacmd_ID_seek_white_or_token_left = 174; +static int32_t fcoder_metacmd_ID_seek_white_or_token_right = 175; +static int32_t fcoder_metacmd_ID_seek_whitespace_down = 176; +static int32_t fcoder_metacmd_ID_seek_whitespace_down_end_line = 177; +static int32_t fcoder_metacmd_ID_seek_whitespace_left = 178; +static int32_t fcoder_metacmd_ID_seek_whitespace_right = 179; +static int32_t fcoder_metacmd_ID_seek_whitespace_up = 180; +static int32_t fcoder_metacmd_ID_seek_whitespace_up_end_line = 181; +static int32_t fcoder_metacmd_ID_select_all = 182; +static int32_t fcoder_metacmd_ID_select_next_scope_absolute = 183; +static int32_t fcoder_metacmd_ID_select_prev_scope_absolute = 184; +static int32_t fcoder_metacmd_ID_select_surrounding_scope = 185; +static int32_t fcoder_metacmd_ID_set_bindings_choose = 186; +static int32_t fcoder_metacmd_ID_set_bindings_default = 187; +static int32_t fcoder_metacmd_ID_set_bindings_mac_default = 188; +static int32_t fcoder_metacmd_ID_set_mark = 189; +static int32_t fcoder_metacmd_ID_set_mode_to_notepad_like = 190; +static int32_t fcoder_metacmd_ID_set_mode_to_original = 191; +static int32_t fcoder_metacmd_ID_setup_build_bat = 192; +static int32_t fcoder_metacmd_ID_setup_build_bat_and_sh = 193; +static int32_t fcoder_metacmd_ID_setup_build_sh = 194; +static int32_t fcoder_metacmd_ID_setup_new_project = 195; +static int32_t fcoder_metacmd_ID_show_filebar = 196; +static int32_t fcoder_metacmd_ID_show_scrollbar = 197; +static int32_t fcoder_metacmd_ID_snipe_token_or_word = 198; +static int32_t fcoder_metacmd_ID_snipe_token_or_word_right = 199; +static int32_t fcoder_metacmd_ID_snippet_lister = 200; +static int32_t fcoder_metacmd_ID_suppress_mouse = 201; +static int32_t fcoder_metacmd_ID_swap_buffers_between_panels = 202; +static int32_t fcoder_metacmd_ID_to_lowercase = 203; +static int32_t fcoder_metacmd_ID_to_uppercase = 204; +static int32_t fcoder_metacmd_ID_toggle_filebar = 205; +static int32_t fcoder_metacmd_ID_toggle_fullscreen = 206; +static int32_t fcoder_metacmd_ID_toggle_highlight_enclosing_scopes = 207; +static int32_t fcoder_metacmd_ID_toggle_highlight_line_at_cursor = 208; +static int32_t fcoder_metacmd_ID_toggle_line_wrap = 209; +static int32_t fcoder_metacmd_ID_toggle_mouse = 210; +static int32_t fcoder_metacmd_ID_toggle_paren_matching_helper = 211; +static int32_t fcoder_metacmd_ID_toggle_show_whitespace = 212; +static int32_t fcoder_metacmd_ID_toggle_virtual_whitespace = 213; +static int32_t fcoder_metacmd_ID_undo = 214; +static int32_t fcoder_metacmd_ID_view_buffer_other_panel = 215; +static int32_t fcoder_metacmd_ID_view_jump_list_with_lister = 216; +static int32_t fcoder_metacmd_ID_word_complete = 217; +static int32_t fcoder_metacmd_ID_write_and_auto_tab = 218; +static int32_t fcoder_metacmd_ID_write_block = 219; +static int32_t fcoder_metacmd_ID_write_character = 220; +static int32_t fcoder_metacmd_ID_write_explicit_enum_flags = 221; +static int32_t fcoder_metacmd_ID_write_explicit_enum_values = 222; +static int32_t fcoder_metacmd_ID_write_hack = 223; +static int32_t fcoder_metacmd_ID_write_note = 224; +static int32_t fcoder_metacmd_ID_write_todo = 225; +static int32_t fcoder_metacmd_ID_write_underscore = 226; +static int32_t fcoder_metacmd_ID_write_zero_struct = 227; #endif diff --git a/platform_win32/win32_4ed.cpp b/platform_win32/win32_4ed.cpp index 142f51ad..77bbe9ae 100644 --- a/platform_win32/win32_4ed.cpp +++ b/platform_win32/win32_4ed.cpp @@ -336,6 +336,7 @@ struct File_Track_Note_Node{ }; Heap file_track_heap = {}; +Partition file_track_scratch = {}; Directory_Track_Node *file_track_dir_first = 0; Directory_Track_Node *file_track_dir_last = 0; Directory_Track_Node *file_track_dir_free_first = 0; @@ -597,15 +598,15 @@ file_track_worker(void*){ FILE_NOTIFY_INFORMATION *info = (FILE_NOTIFY_INFORMATION*)node_copy.buffer; i32 len = info->FileNameLength/2; - i32 dir_len = GetFinalPathNameByHandle_utf8(dir_node->dir_handle, 0, 0, FILE_NAME_NORMALIZED); + i32 dir_len = GetFinalPathNameByHandle_utf8(&file_track_scratch, dir_node->dir_handle, 0, 0, FILE_NAME_NORMALIZED); i32 req_size = dir_len + (len + 1)*2 + 4; - Temp_Memory temp = begin_temp_memory(&shared_vars.scratch); - u8 *buffer = push_array(&shared_vars.scratch, u8, req_size); + Temp_Memory temp = begin_temp_memory(&file_track_scratch); + u8 *buffer = push_array(&file_track_scratch, u8, req_size); if (buffer != 0){ - u32 path_pos = GetFinalPathNameByHandle_utf8(dir_node->dir_handle, buffer, req_size, FILE_NAME_NORMALIZED); + u32 path_pos = GetFinalPathNameByHandle_utf8(&file_track_scratch, dir_node->dir_handle, buffer, req_size, FILE_NAME_NORMALIZED); buffer[path_pos] = '\\'; path_pos += 1; @@ -639,6 +640,8 @@ file_track_worker(void*){ internal void file_track_init(){ heap_init(&file_track_heap); + i32 scratch_size = KB(128); + file_track_scratch = make_part(system_memory_allocate(scratch_size), scratch_size); InitializeCriticalSection(&file_track_critical_section); file_track_iocp = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 1); file_track_thread = CreateThread(0, 0, file_track_worker, 0, 0, 0); @@ -662,9 +665,9 @@ Sys_Add_Listener_Sig(system_add_listener){ Directory_Track_Node *existing_dir_node = file_track_dir_lookup(dir_name_string); if (existing_dir_node == 0){ - Temp_Memory temp = begin_temp_memory(&shared_vars.scratch); - String dir_name_string_terminated = string_push_copy(&shared_vars.scratch, dir_name_string); - HANDLE dir_handle = CreateFile_utf8((u8*)dir_name_string_terminated.str, + Temp_Memory temp = begin_temp_memory(&file_track_scratch); + String dir_name_string_terminated = string_push_copy(&file_track_scratch, dir_name_string); + HANDLE dir_handle = CreateFile_utf8(&file_track_scratch, (u8*)dir_name_string_terminated.str, FILE_LIST_DIRECTORY, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 0, OPEN_EXISTING, @@ -912,7 +915,7 @@ Sys_CLI_Call_Sig(system_cli_call, path, script_name, cli_out){ startup.wShowWindow = SW_HIDE; PROCESS_INFORMATION info = {}; - if (CreateProcess_utf8((u8*)cmd, (u8*)command_line, 0, 0, TRUE, 0, env_variables, (u8*)path, &startup, &info)){ + if (CreateProcess_utf8(&shared_vars.scratch, (u8*)cmd, (u8*)command_line, 0, 0, TRUE, 0, env_variables, (u8*)path, &startup, &info)){ success = 1; CloseHandle(info.hThread); *(HANDLE*)&cli_out->proc = info.hProcess; @@ -2077,7 +2080,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS // NOTE(allen): Switch to New Title if (result.has_new_title){ - SetWindowText_utf8(win32vars.window_handle, (u8*)result.title_string); + SetWindowText_utf8(&shared_vars.scratch, win32vars.window_handle, (u8*)result.title_string); } // NOTE(allen): Switch to New Cursor diff --git a/platform_win32/win32_4ed_functions.cpp b/platform_win32/win32_4ed_functions.cpp index 5ca0e3f0..d1ebae40 100644 --- a/platform_win32/win32_4ed_functions.cpp +++ b/platform_win32/win32_4ed_functions.cpp @@ -15,13 +15,13 @@ internal Sys_Get_Current_Path_Sig(system_get_current_path){ - i32 result = GetCurrentDirectory_utf8(capacity, (u8*)out); + i32 result = GetCurrentDirectory_utf8(&shared_vars.scratch, capacity, (u8*)out); return(result); } internal Sys_Get_4ed_Path_Sig(system_get_4ed_path){ - i32 size = GetModuleFileName_utf8(0, (u8*)out, capacity); + i32 size = GetModuleFileName_utf8(&shared_vars.scratch, 0, (u8*)out, capacity); if (size < capacity - 1){ String str = make_string(out, size); remove_last_folder(&str); @@ -43,7 +43,7 @@ Sys_Log_Sig(system_log){ str.size = system_get_4ed_path(str.str, str.memory_size); append_sc(&str, "4coder_log.txt"); terminate_with_null(&str); - HANDLE file = CreateFile_utf8(space, GENERIC_WRITE, 0, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); + HANDLE file = CreateFile_utf8(&shared_vars.scratch, space, GENERIC_WRITE, 0, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); if (file != INVALID_HANDLE_VALUE){ SetFilePointer(file, win32vars.log_position, 0, FILE_BEGIN); win32vars.log_position += length; @@ -64,7 +64,7 @@ Sys_Log_Sig(system_log){ internal Sys_File_Can_Be_Made_Sig(system_file_can_be_made){ - HANDLE file = CreateFile_utf8(filename, FILE_APPEND_DATA, 0, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); + HANDLE file = CreateFile_utf8(&shared_vars.scratch, filename, FILE_APPEND_DATA, 0, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); b32 result = false; if (file != INVALID_HANDLE_VALUE){ CloseHandle(file); @@ -141,10 +141,10 @@ Sys_Set_File_List_Sig(system_set_file_list){ append_sc(&dir, directory); terminate_with_null(&dir); - HANDLE dir_handle = CreateFile_utf8((u8*)dir.str, FILE_LIST_DIRECTORY, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, 0); + HANDLE dir_handle = CreateFile_utf8(&shared_vars.scratch, (u8*)dir.str, FILE_LIST_DIRECTORY, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, 0); if (dir_handle != INVALID_HANDLE_VALUE){ - DWORD final_length = GetFinalPathNameByHandle_utf8(dir_handle, (u8*)dir_space, sizeof(dir_space), 0); + DWORD final_length = GetFinalPathNameByHandle_utf8(&shared_vars.scratch, dir_handle, (u8*)dir_space, sizeof(dir_space), 0); CloseHandle(dir_handle); if (final_length + 3 < sizeof(dir_space)){ @@ -178,7 +178,7 @@ Sys_Set_File_List_Sig(system_set_file_list){ } WIN32_FIND_DATA find_data; - HANDLE search = FindFirstFile_utf8(c_str_dir, &find_data); + HANDLE search = FindFirstFile_utf8(&shared_vars.scratch, c_str_dir, &find_data); if (search != INVALID_HANDLE_VALUE){ u32 character_count = 0; @@ -209,7 +209,7 @@ Sys_Set_File_List_Sig(system_set_file_list){ u8 *name = (u8*)(file_list->infos + file_count); u32 corrected_file_count = 0; if (file_list->block != 0){ - search = FindFirstFile_utf8(c_str_dir, &find_data); + search = FindFirstFile_utf8(&shared_vars.scratch, c_str_dir, &find_data); if (search != INVALID_HANDLE_VALUE){ File_Info *info = file_list->infos; @@ -279,10 +279,10 @@ Sys_Get_Canonical_Sig(system_get_canonical){ memcpy(src_space, filename, len); src_space[len] = 0; - HANDLE file = CreateFile_utf8((u8*)src_space, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); + HANDLE file = CreateFile_utf8(&shared_vars.scratch, (u8*)src_space, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (file != INVALID_HANDLE_VALUE){ - DWORD final_length = GetFinalPathNameByHandle_utf8(file, (u8*)buffer, max, 0); + DWORD final_length = GetFinalPathNameByHandle_utf8(&shared_vars.scratch, file, (u8*)buffer, max, 0); if (final_length + 3 < max){ if (buffer[final_length - 1] == 0){ @@ -306,10 +306,10 @@ Sys_Get_Canonical_Sig(system_get_canonical){ memcpy(src_space, path_str.str, path_str.size); src_space[path_str.size] = 0; - HANDLE dir = CreateFile_utf8((u8*)src_space, FILE_LIST_DIRECTORY, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, 0); + HANDLE dir = CreateFile_utf8(&shared_vars.scratch, (u8*)src_space, FILE_LIST_DIRECTORY, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, 0); if (dir != INVALID_HANDLE_VALUE){ - DWORD final_length = GetFinalPathNameByHandle_utf8(dir, (u8*)buffer, max, 0); + DWORD final_length = GetFinalPathNameByHandle_utf8(&shared_vars.scratch, dir, (u8*)buffer, max, 0); if (final_length + 3 < max){ if (buffer[final_length-1] == 0){ @@ -337,7 +337,7 @@ Sys_Get_Canonical_Sig(system_get_canonical){ internal Sys_Load_Handle_Sig(system_load_handle){ b32 result = false; - HANDLE file = CreateFile_utf8((u8*)filename, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); + HANDLE file = CreateFile_utf8(&shared_vars.scratch, (u8*)filename, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (file != INVALID_HANDLE_VALUE){ *(HANDLE*)handle_out = file; @@ -391,7 +391,7 @@ Sys_Load_Close_Sig(system_load_close){ internal Sys_Save_File_Sig(system_save_file){ b32 result = false; - HANDLE file = CreateFile_utf8((u8*)filename, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); + HANDLE file = CreateFile_utf8(&shared_vars.scratch, (u8*)filename, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); if (file != INVALID_HANDLE_VALUE){ DWORD written_total = 0; @@ -429,7 +429,7 @@ Sys_File_Exists_Sig(system_file_exists){ copy_ss(&full_filename, make_string(filename, len)); terminate_with_null(&full_filename); - file = CreateFile_utf8((u8*)full_filename.str, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); + file = CreateFile_utf8(&shared_vars.scratch, (u8*)full_filename.str, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (file != INVALID_HANDLE_VALUE){ CloseHandle(file); @@ -442,7 +442,7 @@ Sys_File_Exists_Sig(system_file_exists){ internal b32 system_directory_exists(char *path){ - DWORD attrib = GetFileAttributes_utf8((u8*)path); + DWORD attrib = GetFileAttributes_utf8(&shared_vars.scratch, (u8*)path); return(attrib != INVALID_FILE_ATTRIBUTES && (attrib & FILE_ATTRIBUTE_DIRECTORY)); } diff --git a/platform_win32/win32_error_box.cpp b/platform_win32/win32_error_box.cpp index 15ba6aff..20ceb116 100644 --- a/platform_win32/win32_error_box.cpp +++ b/platform_win32/win32_error_box.cpp @@ -12,7 +12,7 @@ internal void system_error_box(char *msg, b32 shutdown = true){ LOGF("error box: %s\n", msg); - MessageBox_utf8(0, (u8*)msg, (u8*)"Error", 0); + MessageBox_utf8(&shared_vars.scratch, 0, (u8*)msg, (u8*)"Error", 0); if (shutdown){ exit(1); } diff --git a/platform_win32/win32_utf8.cpp b/platform_win32/win32_utf8.cpp index 44a67aed..39db54a6 100644 --- a/platform_win32/win32_utf8.cpp +++ b/platform_win32/win32_utf8.cpp @@ -38,10 +38,9 @@ input_8_to_16(Partition *scratch, u8 *in){ } internal HANDLE -CreateFile_utf8(u8 *name, DWORD access, DWORD share, LPSECURITY_ATTRIBUTES security, DWORD creation, DWORD flags, HANDLE template_file){ +CreateFile_utf8(Partition *scratch, u8 *name, DWORD access, DWORD share, LPSECURITY_ATTRIBUTES security, DWORD creation, DWORD flags, HANDLE template_file){ HANDLE result = INVALID_HANDLE_VALUE; - Partition *scratch = &shared_vars.scratch; Temp_Memory temp = begin_temp_memory(scratch); Win32_UTF16 name_16 = input_8_to_16(scratch, name); @@ -55,7 +54,7 @@ CreateFile_utf8(u8 *name, DWORD access, DWORD share, LPSECURITY_ATTRIBUTES secur } internal DWORD -GetFinalPathNameByHandle_utf8(HANDLE file, u8 *file_path_out, DWORD path_max, DWORD flags){ +GetFinalPathNameByHandle_utf8(Partition *scratch, HANDLE file, u8 *file_path_out, DWORD path_max, DWORD flags){ DWORD result = 0; if (file_path_out == 0){ @@ -63,7 +62,6 @@ GetFinalPathNameByHandle_utf8(HANDLE file, u8 *file_path_out, DWORD path_max, DW result *= 2; } else{ - Partition *scratch = &shared_vars.scratch; Temp_Memory temp = begin_temp_memory(scratch); u32 path_16_max = KB(32); @@ -87,10 +85,9 @@ GetFinalPathNameByHandle_utf8(HANDLE file, u8 *file_path_out, DWORD path_max, DW } internal HANDLE -FindFirstFile_utf8(u8 *name, LPWIN32_FIND_DATA find_data){ +FindFirstFile_utf8(Partition *scratch, u8 *name, LPWIN32_FIND_DATA find_data){ HANDLE result = INVALID_HANDLE_VALUE; - Partition *scratch = &shared_vars.scratch; Temp_Memory temp = begin_temp_memory(scratch); Win32_UTF16 name_16 = input_8_to_16(scratch, name); @@ -104,10 +101,9 @@ FindFirstFile_utf8(u8 *name, LPWIN32_FIND_DATA find_data){ } internal DWORD -GetFileAttributes_utf8(u8 *name){ +GetFileAttributes_utf8(Partition *scratch, u8 *name){ DWORD result = 0; - Partition *scratch = &shared_vars.scratch; Temp_Memory temp = begin_temp_memory(scratch); Win32_UTF16 name_16 = input_8_to_16(scratch, name); @@ -121,10 +117,9 @@ GetFileAttributes_utf8(u8 *name){ } internal DWORD -GetModuleFileName_utf8(HMODULE module, u8 *file_out, DWORD max){ +GetModuleFileName_utf8(Partition *scratch, HMODULE module, u8 *file_out, DWORD max){ DWORD result = 0; - Partition *scratch = &shared_vars.scratch; Temp_Memory temp = begin_temp_memory(scratch); u32 file_16_max = KB(40); @@ -147,10 +142,9 @@ GetModuleFileName_utf8(HMODULE module, u8 *file_out, DWORD max){ } internal BOOL -CreateProcess_utf8(u8 *app_name, u8 *command, LPSECURITY_ATTRIBUTES security, LPSECURITY_ATTRIBUTES thread, BOOL inherit_handles, DWORD creation, LPVOID environment, u8 *curdir, LPSTARTUPINFO startup, LPPROCESS_INFORMATION process){ +CreateProcess_utf8(Partition *scratch, u8 *app_name, u8 *command, LPSECURITY_ATTRIBUTES security, LPSECURITY_ATTRIBUTES thread, BOOL inherit_handles, DWORD creation, LPVOID environment, u8 *curdir, LPSTARTUPINFO startup, LPPROCESS_INFORMATION process){ BOOL result = false; - Partition *scratch = &shared_vars.scratch; Temp_Memory temp = begin_temp_memory(scratch); Win32_UTF16 app_name_16 = input_8_to_16(scratch, app_name); @@ -171,10 +165,9 @@ CreateProcess_utf8(u8 *app_name, u8 *command, LPSECURITY_ATTRIBUTES security, LP } internal DWORD -GetCurrentDirectory_utf8(DWORD max, u8 *buffer){ +GetCurrentDirectory_utf8(Partition *scratch, DWORD max, u8 *buffer){ DWORD result = 0; - Partition *scratch = &shared_vars.scratch; Temp_Memory temp = begin_temp_memory(scratch); u32 buffer_16_max = KB(40); @@ -196,10 +189,9 @@ GetCurrentDirectory_utf8(DWORD max, u8 *buffer){ } internal int -MessageBox_utf8(HWND owner, u8 *text, u8 *caption, UINT type){ +MessageBox_utf8(Partition *scratch, HWND owner, u8 *text, u8 *caption, UINT type){ int result = 0; - Partition *scratch = &shared_vars.scratch; Temp_Memory temp = begin_temp_memory(scratch); Win32_UTF16 text_16 = input_8_to_16(scratch, text); @@ -216,10 +208,9 @@ MessageBox_utf8(HWND owner, u8 *text, u8 *caption, UINT type){ } internal BOOL -SetWindowText_utf8(HWND window, u8 *string){ +SetWindowText_utf8(Partition *scratch, HWND window, u8 *string){ BOOL result = FALSE; - Partition *scratch = &shared_vars.scratch; Temp_Memory temp = begin_temp_memory(scratch); Win32_UTF16 string_16 = input_8_to_16(scratch, string); diff --git a/platform_win32/win32_utf8.h b/platform_win32/win32_utf8.h index 0095202b..33d11cba 100644 --- a/platform_win32/win32_utf8.h +++ b/platform_win32/win32_utf8.h @@ -13,31 +13,31 @@ #define FRED_WIN32_UTF8_H internal HANDLE -CreateFile_utf8(u8 *name, DWORD access, DWORD share, LPSECURITY_ATTRIBUTES security, DWORD creation, DWORD flags, HANDLE template_file); +CreateFile_utf8(Partition *scratch, u8 *name, DWORD access, DWORD share, LPSECURITY_ATTRIBUTES security, DWORD creation, DWORD flags, HANDLE template_file); internal DWORD -GetFinalPathNameByHandle_utf8(HANDLE file, u8 *file_path_out, DWORD path_max, DWORD flags); +GetFinalPathNameByHandle_utf8(Partition *scratch, HANDLE file, u8 *file_path_out, DWORD path_max, DWORD flags); internal HANDLE -FindFirstFile_utf8(u8 *name, LPWIN32_FIND_DATA find_data); +FindFirstFile_utf8(Partition *scratch, u8 *name, LPWIN32_FIND_DATA find_data); internal DWORD -GetFileAttributes_utf8(u8 *name); +GetFileAttributes_utf8(Partition *scratch, u8 *name); internal DWORD -GetModuleFileName_utf8(HMODULE module, u8 *file_out, DWORD max); +GetModuleFileName_utf8(Partition *scratch, HMODULE module, u8 *file_out, DWORD max); internal BOOL -CreateProcess_utf8(u8 *app_name, u8 *command, LPSECURITY_ATTRIBUTES security, LPSECURITY_ATTRIBUTES thread, BOOL inherit_handles, DWORD creation, LPVOID environment, u8 *curdir, LPSTARTUPINFO startup, LPPROCESS_INFORMATION process); +CreateProcess_utf8(Partition *scratch, u8 *app_name, u8 *command, LPSECURITY_ATTRIBUTES security, LPSECURITY_ATTRIBUTES thread, BOOL inherit_handles, DWORD creation, LPVOID environment, u8 *curdir, LPSTARTUPINFO startup, LPPROCESS_INFORMATION process); internal DWORD -GetCurrentDirectory_utf8(DWORD max, u8 *buffer); +GetCurrentDirectory_utf8(Partition *scratch, DWORD max, u8 *buffer); internal int -MessageBox_utf8(HWND owner, u8 *text, u8 *caption, UINT type); +MessageBox_utf8(Partition *scratch, HWND owner, u8 *text, u8 *caption, UINT type); internal BOOL -SetWindowText_utf8(HWND window, u8 *string); +SetWindowText_utf8(Partition *scratch, HWND window, u8 *string); // For implementation