From 56293859af1f4746391cbb1d930ff5d15f3a30cb Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Tue, 18 Dec 2018 18:30:00 -0800 Subject: [PATCH] updated site generator --- 4coder_generated/command_metadata.h | 340 +++++++++++------------- site/4ed_abstract_document.cpp | 363 ++++++++++++-------------- site/4ed_sitegen.cpp | 68 ++--- site/source_material/binding_list.txt | 32 ++- 4 files changed, 376 insertions(+), 427 deletions(-) diff --git a/4coder_generated/command_metadata.h b/4coder_generated/command_metadata.h index 698267d3..67d9a0b8 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 232 +#define command_one_past_last_id 220 #if defined(CUSTOM_COMMAND_SIG) #define PROC_LINKS(x,y) x #else @@ -79,7 +79,6 @@ 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); @@ -114,12 +113,6 @@ 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_change_face_size); CUSTOM_COMMAND_SIG(mouse_wheel_scroll); CUSTOM_COMMAND_SIG(move_down); @@ -131,7 +124,6 @@ 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); @@ -164,9 +156,7 @@ 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); @@ -234,8 +224,6 @@ 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); @@ -252,7 +240,7 @@ char *source_name; int32_t source_name_len; int32_t line_number; }; -static Command_Metadata fcoder_metacmd_table[232] = { +static Command_Metadata fcoder_metacmd_table[220] = { { 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 }, @@ -323,7 +311,6 @@ static Command_Metadata fcoder_metacmd_table[232] = { { 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, 856 }, { PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 765 }, { PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1557 }, -{ 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 }, @@ -358,12 +345,6 @@ static Command_Metadata fcoder_metacmd_table[232] = { { 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, 1245 }, -{ 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_change_face_size, 0), "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 586 }, { 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 }, @@ -375,7 +356,6 @@ static Command_Metadata fcoder_metacmd_table[232] = { { 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 }, @@ -408,9 +388,7 @@ static Command_Metadata fcoder_metacmd_table[232] = { { 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, 1596 }, { 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, 1201 }, -{ 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, 1572 }, -{ 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, 900 }, { 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, 871 }, { 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, 889 }, @@ -478,8 +456,6 @@ static Command_Metadata fcoder_metacmd_table[232] = { { 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, 103 }, { 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, 91 }, { 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, 97 }, { 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, 85 }, @@ -556,166 +532,154 @@ static int32_t fcoder_metacmd_ID_interactive_open = 66; static int32_t fcoder_metacmd_ID_interactive_open_or_new = 67; static int32_t fcoder_metacmd_ID_interactive_switch_buffer = 68; static int32_t fcoder_metacmd_ID_kill_buffer = 69; -static int32_t fcoder_metacmd_ID_kill_rect = 70; -static int32_t fcoder_metacmd_ID_left_adjust_view = 71; -static int32_t fcoder_metacmd_ID_list_all_functions_all_buffers = 72; -static int32_t fcoder_metacmd_ID_list_all_functions_all_buffers_lister = 73; -static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer = 74; -static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer_lister = 75; -static int32_t fcoder_metacmd_ID_list_all_locations = 76; -static int32_t fcoder_metacmd_ID_list_all_locations_case_insensitive = 77; -static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier = 78; -static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 79; -static int32_t fcoder_metacmd_ID_list_all_locations_of_selection = 80; -static int32_t fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 81; -static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition = 82; -static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 83; -static int32_t fcoder_metacmd_ID_list_all_substring_locations = 84; -static int32_t fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 85; -static int32_t fcoder_metacmd_ID_lister__activate = 86; -static int32_t fcoder_metacmd_ID_lister__backspace_text_field = 87; -static int32_t fcoder_metacmd_ID_lister__backspace_text_field__default = 88; -static int32_t fcoder_metacmd_ID_lister__backspace_text_field__file_path = 89; -static int32_t fcoder_metacmd_ID_lister__mouse_press = 90; -static int32_t fcoder_metacmd_ID_lister__mouse_release = 91; -static int32_t fcoder_metacmd_ID_lister__move_down = 92; -static int32_t fcoder_metacmd_ID_lister__move_down__default = 93; -static int32_t fcoder_metacmd_ID_lister__move_up = 94; -static int32_t fcoder_metacmd_ID_lister__move_up__default = 95; -static int32_t fcoder_metacmd_ID_lister__quit = 96; -static int32_t fcoder_metacmd_ID_lister__repaint = 97; -static int32_t fcoder_metacmd_ID_lister__wheel_scroll = 98; -static int32_t fcoder_metacmd_ID_lister__write_character = 99; -static int32_t fcoder_metacmd_ID_lister__write_character__default = 100; -static int32_t fcoder_metacmd_ID_lister__write_character__file_path = 101; -static int32_t fcoder_metacmd_ID_lister__write_character__fixed_list = 102; -static int32_t fcoder_metacmd_ID_load_project = 103; -static int32_t fcoder_metacmd_ID_make_directory_query = 104; -static int32_t fcoder_metacmd_ID_miblo_decrement_basic = 105; -static int32_t fcoder_metacmd_ID_miblo_decrement_time_stamp = 106; -static int32_t fcoder_metacmd_ID_miblo_decrement_time_stamp_minute = 107; -static int32_t fcoder_metacmd_ID_miblo_increment_basic = 108; -static int32_t fcoder_metacmd_ID_miblo_increment_time_stamp = 109; -static int32_t fcoder_metacmd_ID_miblo_increment_time_stamp_minute = 110; -static int32_t fcoder_metacmd_ID_mouse_wheel_change_face_size = 111; -static int32_t fcoder_metacmd_ID_mouse_wheel_scroll = 112; -static int32_t fcoder_metacmd_ID_move_down = 113; -static int32_t fcoder_metacmd_ID_move_down_10 = 114; -static int32_t fcoder_metacmd_ID_move_down_textual = 115; -static int32_t fcoder_metacmd_ID_move_left = 116; -static int32_t fcoder_metacmd_ID_move_line_down = 117; -static int32_t fcoder_metacmd_ID_move_line_up = 118; -static int32_t fcoder_metacmd_ID_move_right = 119; -static int32_t fcoder_metacmd_ID_move_up = 120; -static int32_t fcoder_metacmd_ID_move_up_10 = 121; -static int32_t fcoder_metacmd_ID_multi_line_edit = 122; -static int32_t fcoder_metacmd_ID_newline_or_goto_position_direct = 123; -static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_direct = 124; -static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_sticky = 125; -static int32_t fcoder_metacmd_ID_newline_or_goto_position_sticky = 126; -static int32_t fcoder_metacmd_ID_open_all_code = 127; -static int32_t fcoder_metacmd_ID_open_all_code_recursive = 128; -static int32_t fcoder_metacmd_ID_open_color_tweaker = 129; -static int32_t fcoder_metacmd_ID_open_file_in_quotes = 130; -static int32_t fcoder_metacmd_ID_open_in_other = 131; -static int32_t fcoder_metacmd_ID_open_long_braces = 132; -static int32_t fcoder_metacmd_ID_open_long_braces_break = 133; -static int32_t fcoder_metacmd_ID_open_long_braces_semicolon = 134; -static int32_t fcoder_metacmd_ID_open_matching_file_cpp = 135; -static int32_t fcoder_metacmd_ID_open_panel_hsplit = 136; -static int32_t fcoder_metacmd_ID_open_panel_vsplit = 137; -static int32_t fcoder_metacmd_ID_page_down = 138; -static int32_t fcoder_metacmd_ID_page_up = 139; -static int32_t fcoder_metacmd_ID_paste = 140; -static int32_t fcoder_metacmd_ID_paste_and_indent = 141; -static int32_t fcoder_metacmd_ID_paste_next = 142; -static int32_t fcoder_metacmd_ID_paste_next_and_indent = 143; -static int32_t fcoder_metacmd_ID_place_in_scope = 144; -static int32_t fcoder_metacmd_ID_project_command_lister = 145; -static int32_t fcoder_metacmd_ID_project_fkey_command = 146; -static int32_t fcoder_metacmd_ID_project_go_to_root_directory = 147; -static int32_t fcoder_metacmd_ID_query_replace = 148; -static int32_t fcoder_metacmd_ID_query_replace_identifier = 149; -static int32_t fcoder_metacmd_ID_query_replace_selection = 150; -static int32_t fcoder_metacmd_ID_redo = 151; -static int32_t fcoder_metacmd_ID_reload_themes = 152; -static int32_t fcoder_metacmd_ID_remap_interactive = 153; -static int32_t fcoder_metacmd_ID_rename_file_query = 154; -static int32_t fcoder_metacmd_ID_rename_parameter = 155; -static int32_t fcoder_metacmd_ID_reopen = 156; -static int32_t fcoder_metacmd_ID_replace_all_occurrences = 157; -static int32_t fcoder_metacmd_ID_replace_in_range = 158; -static int32_t fcoder_metacmd_ID_reverse_search = 159; -static int32_t fcoder_metacmd_ID_reverse_search_identifier = 160; -static int32_t fcoder_metacmd_ID_save = 161; -static int32_t fcoder_metacmd_ID_save_all_dirty_buffers = 162; -static int32_t fcoder_metacmd_ID_save_to_query = 163; -static int32_t fcoder_metacmd_ID_scope_absorb_down = 164; -static int32_t fcoder_metacmd_ID_search = 165; -static int32_t fcoder_metacmd_ID_search_identifier = 166; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_left = 167; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_left = 168; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_right = 169; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_right = 170; -static int32_t fcoder_metacmd_ID_seek_beginning_of_line = 171; -static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 172; -static int32_t fcoder_metacmd_ID_seek_end_of_line = 173; -static int32_t fcoder_metacmd_ID_seek_end_of_textual_line = 174; -static int32_t fcoder_metacmd_ID_seek_token_left = 175; -static int32_t fcoder_metacmd_ID_seek_token_right = 176; -static int32_t fcoder_metacmd_ID_seek_white_or_token_left = 177; -static int32_t fcoder_metacmd_ID_seek_white_or_token_right = 178; -static int32_t fcoder_metacmd_ID_seek_whitespace_down = 179; -static int32_t fcoder_metacmd_ID_seek_whitespace_down_end_line = 180; -static int32_t fcoder_metacmd_ID_seek_whitespace_left = 181; -static int32_t fcoder_metacmd_ID_seek_whitespace_right = 182; -static int32_t fcoder_metacmd_ID_seek_whitespace_up = 183; -static int32_t fcoder_metacmd_ID_seek_whitespace_up_end_line = 184; -static int32_t fcoder_metacmd_ID_select_all = 185; -static int32_t fcoder_metacmd_ID_select_next_scope_absolute = 186; -static int32_t fcoder_metacmd_ID_select_prev_scope_absolute = 187; -static int32_t fcoder_metacmd_ID_select_surrounding_scope = 188; -static int32_t fcoder_metacmd_ID_set_bindings_choose = 189; -static int32_t fcoder_metacmd_ID_set_bindings_default = 190; -static int32_t fcoder_metacmd_ID_set_bindings_mac_default = 191; -static int32_t fcoder_metacmd_ID_set_mark = 192; -static int32_t fcoder_metacmd_ID_set_mode_to_notepad_like = 193; -static int32_t fcoder_metacmd_ID_set_mode_to_original = 194; -static int32_t fcoder_metacmd_ID_setup_build_bat = 195; -static int32_t fcoder_metacmd_ID_setup_build_bat_and_sh = 196; -static int32_t fcoder_metacmd_ID_setup_build_sh = 197; -static int32_t fcoder_metacmd_ID_setup_new_project = 198; -static int32_t fcoder_metacmd_ID_show_filebar = 199; -static int32_t fcoder_metacmd_ID_show_scrollbar = 200; -static int32_t fcoder_metacmd_ID_snipe_token_or_word = 201; -static int32_t fcoder_metacmd_ID_snipe_token_or_word_right = 202; -static int32_t fcoder_metacmd_ID_snippet_lister = 203; -static int32_t fcoder_metacmd_ID_suppress_mouse = 204; -static int32_t fcoder_metacmd_ID_swap_buffers_between_panels = 205; -static int32_t fcoder_metacmd_ID_to_lowercase = 206; -static int32_t fcoder_metacmd_ID_to_uppercase = 207; -static int32_t fcoder_metacmd_ID_toggle_filebar = 208; -static int32_t fcoder_metacmd_ID_toggle_fullscreen = 209; -static int32_t fcoder_metacmd_ID_toggle_highlight_enclosing_scopes = 210; -static int32_t fcoder_metacmd_ID_toggle_highlight_line_at_cursor = 211; -static int32_t fcoder_metacmd_ID_toggle_line_wrap = 212; -static int32_t fcoder_metacmd_ID_toggle_mouse = 213; -static int32_t fcoder_metacmd_ID_toggle_paren_matching_helper = 214; -static int32_t fcoder_metacmd_ID_toggle_show_whitespace = 215; -static int32_t fcoder_metacmd_ID_toggle_virtual_whitespace = 216; -static int32_t fcoder_metacmd_ID_uncomment_line = 217; -static int32_t fcoder_metacmd_ID_undo = 218; -static int32_t fcoder_metacmd_ID_view_buffer_other_panel = 219; -static int32_t fcoder_metacmd_ID_view_jump_list_with_lister = 220; -static int32_t fcoder_metacmd_ID_word_complete = 221; -static int32_t fcoder_metacmd_ID_write_and_auto_tab = 222; -static int32_t fcoder_metacmd_ID_write_block = 223; -static int32_t fcoder_metacmd_ID_write_character = 224; -static int32_t fcoder_metacmd_ID_write_explicit_enum_flags = 225; -static int32_t fcoder_metacmd_ID_write_explicit_enum_values = 226; -static int32_t fcoder_metacmd_ID_write_hack = 227; -static int32_t fcoder_metacmd_ID_write_note = 228; -static int32_t fcoder_metacmd_ID_write_todo = 229; -static int32_t fcoder_metacmd_ID_write_underscore = 230; -static int32_t fcoder_metacmd_ID_write_zero_struct = 231; +static int32_t fcoder_metacmd_ID_left_adjust_view = 70; +static int32_t fcoder_metacmd_ID_list_all_functions_all_buffers = 71; +static int32_t fcoder_metacmd_ID_list_all_functions_all_buffers_lister = 72; +static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer = 73; +static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer_lister = 74; +static int32_t fcoder_metacmd_ID_list_all_locations = 75; +static int32_t fcoder_metacmd_ID_list_all_locations_case_insensitive = 76; +static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier = 77; +static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 78; +static int32_t fcoder_metacmd_ID_list_all_locations_of_selection = 79; +static int32_t fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 80; +static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition = 81; +static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 82; +static int32_t fcoder_metacmd_ID_list_all_substring_locations = 83; +static int32_t fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 84; +static int32_t fcoder_metacmd_ID_lister__activate = 85; +static int32_t fcoder_metacmd_ID_lister__backspace_text_field = 86; +static int32_t fcoder_metacmd_ID_lister__backspace_text_field__default = 87; +static int32_t fcoder_metacmd_ID_lister__backspace_text_field__file_path = 88; +static int32_t fcoder_metacmd_ID_lister__mouse_press = 89; +static int32_t fcoder_metacmd_ID_lister__mouse_release = 90; +static int32_t fcoder_metacmd_ID_lister__move_down = 91; +static int32_t fcoder_metacmd_ID_lister__move_down__default = 92; +static int32_t fcoder_metacmd_ID_lister__move_up = 93; +static int32_t fcoder_metacmd_ID_lister__move_up__default = 94; +static int32_t fcoder_metacmd_ID_lister__quit = 95; +static int32_t fcoder_metacmd_ID_lister__repaint = 96; +static int32_t fcoder_metacmd_ID_lister__wheel_scroll = 97; +static int32_t fcoder_metacmd_ID_lister__write_character = 98; +static int32_t fcoder_metacmd_ID_lister__write_character__default = 99; +static int32_t fcoder_metacmd_ID_lister__write_character__file_path = 100; +static int32_t fcoder_metacmd_ID_lister__write_character__fixed_list = 101; +static int32_t fcoder_metacmd_ID_load_project = 102; +static int32_t fcoder_metacmd_ID_make_directory_query = 103; +static int32_t fcoder_metacmd_ID_mouse_wheel_change_face_size = 104; +static int32_t fcoder_metacmd_ID_mouse_wheel_scroll = 105; +static int32_t fcoder_metacmd_ID_move_down = 106; +static int32_t fcoder_metacmd_ID_move_down_10 = 107; +static int32_t fcoder_metacmd_ID_move_down_textual = 108; +static int32_t fcoder_metacmd_ID_move_left = 109; +static int32_t fcoder_metacmd_ID_move_line_down = 110; +static int32_t fcoder_metacmd_ID_move_line_up = 111; +static int32_t fcoder_metacmd_ID_move_right = 112; +static int32_t fcoder_metacmd_ID_move_up = 113; +static int32_t fcoder_metacmd_ID_move_up_10 = 114; +static int32_t fcoder_metacmd_ID_newline_or_goto_position_direct = 115; +static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_direct = 116; +static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_sticky = 117; +static int32_t fcoder_metacmd_ID_newline_or_goto_position_sticky = 118; +static int32_t fcoder_metacmd_ID_open_all_code = 119; +static int32_t fcoder_metacmd_ID_open_all_code_recursive = 120; +static int32_t fcoder_metacmd_ID_open_color_tweaker = 121; +static int32_t fcoder_metacmd_ID_open_file_in_quotes = 122; +static int32_t fcoder_metacmd_ID_open_in_other = 123; +static int32_t fcoder_metacmd_ID_open_long_braces = 124; +static int32_t fcoder_metacmd_ID_open_long_braces_break = 125; +static int32_t fcoder_metacmd_ID_open_long_braces_semicolon = 126; +static int32_t fcoder_metacmd_ID_open_matching_file_cpp = 127; +static int32_t fcoder_metacmd_ID_open_panel_hsplit = 128; +static int32_t fcoder_metacmd_ID_open_panel_vsplit = 129; +static int32_t fcoder_metacmd_ID_page_down = 130; +static int32_t fcoder_metacmd_ID_page_up = 131; +static int32_t fcoder_metacmd_ID_paste = 132; +static int32_t fcoder_metacmd_ID_paste_and_indent = 133; +static int32_t fcoder_metacmd_ID_paste_next = 134; +static int32_t fcoder_metacmd_ID_paste_next_and_indent = 135; +static int32_t fcoder_metacmd_ID_place_in_scope = 136; +static int32_t fcoder_metacmd_ID_project_command_lister = 137; +static int32_t fcoder_metacmd_ID_project_fkey_command = 138; +static int32_t fcoder_metacmd_ID_project_go_to_root_directory = 139; +static int32_t fcoder_metacmd_ID_query_replace = 140; +static int32_t fcoder_metacmd_ID_query_replace_identifier = 141; +static int32_t fcoder_metacmd_ID_query_replace_selection = 142; +static int32_t fcoder_metacmd_ID_redo = 143; +static int32_t fcoder_metacmd_ID_reload_themes = 144; +static int32_t fcoder_metacmd_ID_remap_interactive = 145; +static int32_t fcoder_metacmd_ID_rename_file_query = 146; +static int32_t fcoder_metacmd_ID_reopen = 147; +static int32_t fcoder_metacmd_ID_replace_in_range = 148; +static int32_t fcoder_metacmd_ID_reverse_search = 149; +static int32_t fcoder_metacmd_ID_reverse_search_identifier = 150; +static int32_t fcoder_metacmd_ID_save = 151; +static int32_t fcoder_metacmd_ID_save_all_dirty_buffers = 152; +static int32_t fcoder_metacmd_ID_save_to_query = 153; +static int32_t fcoder_metacmd_ID_scope_absorb_down = 154; +static int32_t fcoder_metacmd_ID_search = 155; +static int32_t fcoder_metacmd_ID_search_identifier = 156; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_left = 157; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_left = 158; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_right = 159; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_right = 160; +static int32_t fcoder_metacmd_ID_seek_beginning_of_line = 161; +static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 162; +static int32_t fcoder_metacmd_ID_seek_end_of_line = 163; +static int32_t fcoder_metacmd_ID_seek_end_of_textual_line = 164; +static int32_t fcoder_metacmd_ID_seek_token_left = 165; +static int32_t fcoder_metacmd_ID_seek_token_right = 166; +static int32_t fcoder_metacmd_ID_seek_white_or_token_left = 167; +static int32_t fcoder_metacmd_ID_seek_white_or_token_right = 168; +static int32_t fcoder_metacmd_ID_seek_whitespace_down = 169; +static int32_t fcoder_metacmd_ID_seek_whitespace_down_end_line = 170; +static int32_t fcoder_metacmd_ID_seek_whitespace_left = 171; +static int32_t fcoder_metacmd_ID_seek_whitespace_right = 172; +static int32_t fcoder_metacmd_ID_seek_whitespace_up = 173; +static int32_t fcoder_metacmd_ID_seek_whitespace_up_end_line = 174; +static int32_t fcoder_metacmd_ID_select_all = 175; +static int32_t fcoder_metacmd_ID_select_next_scope_absolute = 176; +static int32_t fcoder_metacmd_ID_select_prev_scope_absolute = 177; +static int32_t fcoder_metacmd_ID_select_surrounding_scope = 178; +static int32_t fcoder_metacmd_ID_set_bindings_choose = 179; +static int32_t fcoder_metacmd_ID_set_bindings_default = 180; +static int32_t fcoder_metacmd_ID_set_bindings_mac_default = 181; +static int32_t fcoder_metacmd_ID_set_mark = 182; +static int32_t fcoder_metacmd_ID_set_mode_to_notepad_like = 183; +static int32_t fcoder_metacmd_ID_set_mode_to_original = 184; +static int32_t fcoder_metacmd_ID_setup_build_bat = 185; +static int32_t fcoder_metacmd_ID_setup_build_bat_and_sh = 186; +static int32_t fcoder_metacmd_ID_setup_build_sh = 187; +static int32_t fcoder_metacmd_ID_setup_new_project = 188; +static int32_t fcoder_metacmd_ID_show_filebar = 189; +static int32_t fcoder_metacmd_ID_show_scrollbar = 190; +static int32_t fcoder_metacmd_ID_snipe_token_or_word = 191; +static int32_t fcoder_metacmd_ID_snipe_token_or_word_right = 192; +static int32_t fcoder_metacmd_ID_snippet_lister = 193; +static int32_t fcoder_metacmd_ID_suppress_mouse = 194; +static int32_t fcoder_metacmd_ID_swap_buffers_between_panels = 195; +static int32_t fcoder_metacmd_ID_to_lowercase = 196; +static int32_t fcoder_metacmd_ID_to_uppercase = 197; +static int32_t fcoder_metacmd_ID_toggle_filebar = 198; +static int32_t fcoder_metacmd_ID_toggle_fullscreen = 199; +static int32_t fcoder_metacmd_ID_toggle_highlight_enclosing_scopes = 200; +static int32_t fcoder_metacmd_ID_toggle_highlight_line_at_cursor = 201; +static int32_t fcoder_metacmd_ID_toggle_line_wrap = 202; +static int32_t fcoder_metacmd_ID_toggle_mouse = 203; +static int32_t fcoder_metacmd_ID_toggle_paren_matching_helper = 204; +static int32_t fcoder_metacmd_ID_toggle_show_whitespace = 205; +static int32_t fcoder_metacmd_ID_toggle_virtual_whitespace = 206; +static int32_t fcoder_metacmd_ID_uncomment_line = 207; +static int32_t fcoder_metacmd_ID_undo = 208; +static int32_t fcoder_metacmd_ID_view_buffer_other_panel = 209; +static int32_t fcoder_metacmd_ID_view_jump_list_with_lister = 210; +static int32_t fcoder_metacmd_ID_word_complete = 211; +static int32_t fcoder_metacmd_ID_write_and_auto_tab = 212; +static int32_t fcoder_metacmd_ID_write_block = 213; +static int32_t fcoder_metacmd_ID_write_character = 214; +static int32_t fcoder_metacmd_ID_write_hack = 215; +static int32_t fcoder_metacmd_ID_write_note = 216; +static int32_t fcoder_metacmd_ID_write_todo = 217; +static int32_t fcoder_metacmd_ID_write_underscore = 218; +static int32_t fcoder_metacmd_ID_write_zero_struct = 219; #endif diff --git a/site/4ed_abstract_document.cpp b/site/4ed_abstract_document.cpp index d28af9ad..99a2db97 100644 --- a/site/4ed_abstract_document.cpp +++ b/site/4ed_abstract_document.cpp @@ -9,39 +9,16 @@ // TOP -internal char* -get_null_terminated_version(String str){ - char *ptr = 0; - if (str.size > 0){ - if (terminate_with_null(&str)){ - ptr = str.str; - } - else{ - String b = str_alloc(str.size + 1); - copy(&b, str); - terminate_with_null(&b); - ptr = b.str; - } - } - return(ptr); -} - -//////////////////////////////// - struct Enriched_Text{ String fname; String source; }; internal Enriched_Text -load_enriched_text(char *directory, char *filename){ +load_enriched_text(Partition *arena, char *directory, char *filename){ Enriched_Text result = {}; - char *fname = fm_str(directory, "/", filename); - result.fname = str_alloc(str_size(fname) + 1); - fm_align(); - copy(&result.fname, fname); - terminate_with_null(&result.fname); - result.source = file_dump(fname); + result.fname = make_string_slowly(fm_str(arena, directory, "/", filename)); + result.source = file_dump(result.fname.str); return(result); } @@ -67,34 +44,31 @@ get_mangle_rule(String mangle){ } internal String -apply_mangle_rule(String name, u32 mangle_rule){ +apply_mangle_rule(Partition *arena, String name, u32 mangle_rule){ String result = {}; switch (mangle_rule){ case MangleRule_MacroSig: { - result = str_alloc(name.size + 5); - fm_align(); + result = string_push(arena, name.size + 5); + push_align(arena, 8); copy(&result, name); to_upper(&result); append(&result, "_SIG"); terminate_with_null(&result); }break; - case MangleRule_ToLower: { - result = str_alloc(name.size + 1); - fm_align(); + result = string_push(arena, name.size + 1); + push_align(arena, 8); copy(&result, name); to_lower(&result); terminate_with_null(&result); }break; - default: { result = name; }break; } - return(result); } @@ -159,11 +133,9 @@ global Document_Item null_document_item = {}; //////////////////////////////// internal void -set_item_string(String *out, String text){ - *out = str_alloc(text.size + 1); - fm_align(); - copy(out, text); - terminate_with_null(out); +set_item_string(Partition *arena, String *out, String text){ + *out = string_push_copy(arena, text); + push_align(arena, 8); } //////////////////////////////// @@ -186,11 +158,12 @@ clear_list(Basic_List *list){ } internal void* -push_item_on_list(Basic_List *list, i32 item_size){ +push_item_on_list(Partition *arena, Basic_List *list, i32 item_size){ i32 mem_size = item_size + sizeof(Basic_Node); - void *mem = fm__push(mem_size); + void *mem = push_array(arena, char, mem_size); Assert(mem != 0); memset(mem, 0, mem_size); + push_align(arena, 8); Basic_Node *node = (Basic_Node*)mem; if (list->head == 0){ @@ -255,11 +228,11 @@ get_item_by_name(Basic_List list, String name){ } internal Abstract_Item* -create_abstract_item(Basic_List *list, char *name){ +create_abstract_item(Partition *arena, Basic_List *list, char *name){ Abstract_Item *result = 0; Abstract_Item *lookup = get_item_by_name(*list, make_string_slowly(name)); if (lookup == 0){ - result = (Abstract_Item*)push_item_on_list(list, sizeof(*result)); + result = (Abstract_Item*)push_item_on_list(arena, list, sizeof(*result)); } return(result); } @@ -270,10 +243,10 @@ struct Abstract_Item_Array{ }; internal Abstract_Item_Array -get_abstract_item_array(Basic_List *list){ +get_abstract_item_array(Partition *arena, Basic_List *list){ Abstract_Item_Array result = {}; - result.items = (Abstract_Item**)fm_push_array(Abstract_Item*, list->count); + result.items = (Abstract_Item**)push_array(arena, Abstract_Item*, list->count); result.count = list->count; u32 i = 0; @@ -311,8 +284,8 @@ create_document_system(char *code_dir, char *asset_dir, char *src_dir){ } internal void -create_unresolved_include(Document_System *doc_system, Document_Item *include_item){ - Document_Item **new_item = (Document_Item**)push_item_on_list(&doc_system->unresolved_includes, sizeof(*new_item)); +create_unresolved_include(Partition *arena, Document_System *doc_system, Document_Item *include_item){ + Document_Item **new_item = (Document_Item**)push_item_on_list(arena, &doc_system->unresolved_includes, sizeof(*new_item)); *new_item = include_item; } @@ -325,17 +298,19 @@ enum{ }; internal u32 -create_meta_unit(Document_System *doc_system, String name_str, String file_str){ +create_meta_unit(Partition *arena, Document_System *doc_system, String name_str, String file_str){ u32 result = MetaResult_DidParse; - char *name = get_null_terminated_version(name_str); - char *file = get_null_terminated_version(file_str); + String name_z = string_push_copy(arena, name_str); + String file_z = string_push_copy(arena, file_str); + char *name = name_z.str; + char *file = file_z.str; - Abstract_Item *item = create_abstract_item(&doc_system->meta_list, name); + Abstract_Item *item = create_abstract_item(arena, &doc_system->meta_list, name); if (item != 0){ - Meta_Unit *unit = fm_push_array(Meta_Unit, 1); - *unit = compile_meta_unit(doc_system->code_dir, file, ExpandArray(meta_keywords)); + Meta_Unit *unit = push_array(arena, Meta_Unit, 1); + *unit = compile_meta_unit(arena, doc_system->code_dir, file, ExpandArray(meta_keywords)); if (unit->count != 0){ result = true; @@ -355,10 +330,10 @@ create_meta_unit(Document_System *doc_system, String name_str, String file_str){ } internal Abstract_Item* -add_generic_file(Document_System *system, char *source_file, char *extension, char *name){ - Abstract_Item *item = create_abstract_item(&system->file_list, name); +add_generic_file(Partition *arena, Document_System *system, char *source_file, char *extension, char *name){ + Abstract_Item *item = create_abstract_item(arena, &system->file_list, name); if (item){ - char *full_file = fm_str(system->asset_dir, "/", source_file); + char *full_file = fm_str(arena, system->asset_dir, "/", source_file); item->item_type = ItemType_GenericFile; item->extension = extension; @@ -369,10 +344,10 @@ add_generic_file(Document_System *system, char *source_file, char *extension, ch } internal Abstract_Item* -add_image_description(Document_System *system, char *source_file, char *extension, char *name){ - Abstract_Item *item = create_abstract_item(&system->img_list, name); +add_image_description(Partition *arena, Document_System *system, char *source_file, char *extension, char *name){ + Abstract_Item *item = create_abstract_item(arena, &system->img_list, name); if (item != 0){ - char *full_file = fm_str(system->asset_dir, "/", source_file); + char *full_file = fm_str(arena, system->asset_dir, "/", source_file); item->item_type = ItemType_Image; item->name = name; @@ -418,8 +393,8 @@ get_image_instantiation(Basic_List list, i32 w, i32 h){ } internal void -add_image_instantiation(Basic_List *list, i32 w, i32 h){ - Image_Instantiation *instantiation = (Image_Instantiation*)push_item_on_list(list, sizeof(*instantiation)); +add_image_instantiation(Partition *arena, Basic_List *list, i32 w, i32 h){ + Image_Instantiation *instantiation = (Image_Instantiation*)push_item_on_list(arena, list, sizeof(*instantiation)); instantiation->w = w; instantiation->h = h; } @@ -433,9 +408,9 @@ struct Document_Builder{ }; internal Document_Builder -begin_document_description(Document_System *system, char *title, char *name, b32 show_title){ +begin_document_description(Partition *arena, Document_System *system, char *title, char *name, b32 show_title){ Document_Builder builder = {}; - Abstract_Item *doc = create_abstract_item(&system->doc_list, name); + Abstract_Item *doc = create_abstract_item(arena, &system->doc_list, name); if (doc != 0){ builder.doc = doc; @@ -443,11 +418,11 @@ begin_document_description(Document_System *system, char *title, char *name, b32 doc->item_type = ItemType_Document; doc->name = name; - doc->root_item = fm_push_array(Document_Item, 1); + doc->root_item = push_array(arena, Document_Item, 1); *doc->root_item = null_document_item; Document_Item *item = doc->root_item; - set_item_string(&item->section.name, make_string_slowly(name)); + set_item_string(arena, &item->section.name, make_string_slowly(name)); item->section.show_title = show_title; item->type = Doc_Root; @@ -484,9 +459,9 @@ doc_get_item_top(Document_Builder *builder){ } internal Document_Item* -doc_new_item(Document_Builder *builder, u32 type, b32 push = false){ +doc_new_item(Partition *arena, Document_Builder *builder, u32 type, b32 push = false){ Document_Item *parent = doc_get_item_top(builder); - Document_Item *item = fm_push_array(Document_Item, 1); + Document_Item *item = push_array(arena, Document_Item, 1); *item = null_document_item; item->type = type; append_child(parent, item); @@ -497,13 +472,13 @@ doc_new_item(Document_Builder *builder, u32 type, b32 push = false){ } internal Document_Item* -doc_new_item_strings(Document_Builder *builder, u32 type, String s1, String s2, b32 push = false){ - Document_Item *item = doc_new_item(builder, type); +doc_new_item_strings(Partition *arena, Document_Builder *builder, u32 type, String s1, String s2, b32 push = false){ + Document_Item *item = doc_new_item(arena, builder, type); if (s1.size > 0){ - set_item_string(&item->string.string, s1); + set_item_string(arena, &item->string.string, s1); } if (s2.size > 0){ - set_item_string(&item->string.string2, s2); + set_item_string(arena, &item->string.string2, s2); } if (push){ doc_push(builder, item); @@ -512,9 +487,9 @@ doc_new_item_strings(Document_Builder *builder, u32 type, String s1, String s2, } internal Document_Item* -doc_new_item_documentation(Document_Builder *builder, u32 type, String unit, Mangle_Rule mangle_rule, b32 push = false){ - Document_Item *item = doc_new_item(builder, type); - set_item_string(&item->unit_elements.unit, unit); +doc_new_item_documentation(Partition *arena, Document_Builder *builder, u32 type, String unit, Mangle_Rule mangle_rule, b32 push = false){ + Document_Item *item = doc_new_item(arena, builder, type); + set_item_string(arena, &item->unit_elements.unit, unit); item->unit_elements.mangle_rule = mangle_rule; if (push){ doc_push(builder, item); @@ -523,73 +498,73 @@ doc_new_item_documentation(Document_Builder *builder, u32 type, String unit, Man } internal void -begin_section(Document_Builder *builder, char *title, char *id){ - Document_Item *item = doc_new_item(builder, Doc_Section, PUSH); - set_item_string(&item->section.name, make_string_slowly(title)); +begin_section(Partition *arena, Document_Builder *builder, char *title, char *id){ + Document_Item *item = doc_new_item(arena, builder, Doc_Section, PUSH); + set_item_string(arena, &item->section.name, make_string_slowly(title)); item->section.show_title = true; if (id != 0){ - set_item_string(&item->section.id, make_lit_string(id)); + set_item_string(arena, &item->section.id, make_lit_string(id)); } } -#define doc_end(b) doc_pop(b) +#define doc_end(a,b) doc_pop(a,b) -#define begin_style(b,t) doc_new_item_strings(b, Doc_Style, t, null_string, PUSH) -#define begin_link(b,t) doc_new_item_strings(b, Doc_Link, t, null_string, PUSH); -#define begin_list(b) doc_new_item(b, Doc_List, PUSH) -#define begin_item(b) doc_new_item(b, Doc_Item, PUSH) +#define begin_style(a,b,t) doc_new_item_strings(a, b, Doc_Style, t, null_string, PUSH) +#define begin_link(a,b,t) doc_new_item_strings(a, b, Doc_Link, t, null_string, PUSH); +#define begin_list(a,b) doc_new_item(a, b, Doc_List, PUSH) +#define begin_item(a,b) doc_new_item(a, b, Doc_Item, PUSH) internal void -add_include(Document_System *doc_system, Document_Builder *builder, String text){ - Document_Item *item = doc_new_item(builder, Doc_Include); - set_item_string(&item->include.name, text); - create_unresolved_include(doc_system, item); +add_include(Partition *arena, Document_System *doc_system, Document_Builder *builder, String text){ + Document_Item *item = doc_new_item(arena, builder, Doc_Include); + set_item_string(arena, &item->include.name, text); + create_unresolved_include(arena, doc_system, item); } -#define add_error(b,t) doc_new_item_strings(b, Doc_Error, t, null_string) -#define add_todo(b) doc_new_item(b, Doc_Todo) -#define add_doc_list(b,u,m) doc_new_item_documentation(b, Doc_DocList, u, m) -#define add_doc_full(b,u,m) doc_new_item_documentation(b, Doc_DocFull, u, m) -#define add_table_of_contents(b) doc_new_item(b, Doc_TableOfContents) -#define add_plain_old_text(b,t) doc_new_item_strings(b, Doc_PlainOldText, t, null_string); -#define add_version(b) doc_new_item(b, Doc_Version) -#define add_document_link(b,t) doc_new_item_strings(b, Doc_DocumentLink, t, null_string) -#define add_image(b,t,e) doc_new_item_strings(b, Doc_Image, t, e) -#define add_video(b,t) doc_new_item_strings(b, Doc_Video, t, null_string) -#define add_begin_paragraph(b) doc_new_item(b, Doc_BeginParagraph) -#define add_end_paragraph(b) doc_new_item(b, Doc_EndParagraph) +#define add_error(a,b,t) doc_new_item_strings(a, b, Doc_Error, t, null_string) +#define add_todo(a,b) doc_new_item(a, b, Doc_Todo) +#define add_doc_list(a,b,u,m) doc_new_item_documentation(a, b, Doc_DocList, u, m) +#define add_doc_full(a,b,u,m) doc_new_item_documentation(a, b, Doc_DocFull, u, m) +#define add_table_of_contents(a,b) doc_new_item(a, b, Doc_TableOfContents) +#define add_plain_old_text(a,b,t) doc_new_item_strings(a, b, Doc_PlainOldText, t, null_string); +#define add_version(a,b) doc_new_item(a, b, Doc_Version) +#define add_document_link(a,b,t) doc_new_item_strings(a, b, Doc_DocumentLink, t, null_string) +#define add_image(a,b,t,e) doc_new_item_strings(a, b, Doc_Image, t, e) +#define add_video(a,b,t) doc_new_item_strings(a, b, Doc_Video, t, null_string) +#define add_begin_paragraph(a,b) doc_new_item(a, b, Doc_BeginParagraph) +#define add_end_paragraph(a,b) doc_new_item(a, b, Doc_EndParagraph) internal void -doc_pop(Document_Builder *builder){ +doc_pop(Partition *arena, Document_Builder *builder){ if (builder->item_top > 0){ --builder->item_top; } else{ - add_error(builder, make_lit_string("unbalanced groups -- extra end")); + add_error(arena, builder, make_lit_string("unbalanced groups -- extra end")); } } internal void -end_document_description(Document_Builder *builder){ +end_document_description(Partition *arena, Document_Builder *builder){ b32 closing_error = (builder->item_top != 0); if (closing_error){ - add_error(builder, make_lit_string("unbalanced groups -- extra begin")); + add_error(arena, builder, make_lit_string("unbalanced groups -- extra begin")); } for (;builder->item_top > 0;){ - doc_end(builder); + doc_end(arena, builder); } } //////////////////////////////// internal void -report_error_missing_body(Document_Builder *builder, String command_body){ +report_error_missing_body(Partition *arena, Document_Builder *builder, String command_body){ char space[512]; String error_string = make_fixed_width_string(space); append(&error_string, "missing body for "); append(&error_string, command_body); - add_error(builder, error_string); + add_error(arena, builder, error_string); } //////////////////////////////// @@ -683,16 +658,16 @@ extract_command_body(String l, i32 *i_in_out, String *body_text_out){ } internal Abstract_Item* -make_document_from_text(Document_System *doc_system, char *title, char *name, Enriched_Text *text){ +make_document_from_text(Partition *arena, Document_System *doc_system, char *title, char *name, Enriched_Text *text){ String source = text->source; - Document_Builder builder = begin_document_description(doc_system, title, name, false); + Document_Builder builder = begin_document_description(arena, doc_system, title, name, false); if (source.str == 0){ char space[512]; String str = make_fixed_width_string(space); copy(&str, "could not open source file "); copy(&str, text->fname); - add_error(&builder, str); + add_error(arena, &builder, str); } else{ for (String line = get_first_double_line(source); @@ -701,13 +676,13 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En String l = skip_chop_whitespace(line); if (l.size == 0) continue; - add_begin_paragraph(&builder); + add_begin_paragraph(arena, &builder); i32 start = 0, i = 0; for (; i < l.size; ++i){ char ch = l.str[i]; if (ch == '\\'){ - add_plain_old_text(&builder, substr(l, start, i - start)); + add_plain_old_text(arena, &builder, substr(l, start, i - start)); i32 command_start = i + 1; i32 command_end = command_start; @@ -738,7 +713,7 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En switch (match_index){ case Cmd_BackSlash: { - add_plain_old_text(&builder, make_lit_string("\\")); + add_plain_old_text(arena, &builder, make_lit_string("\\")); }break; case Cmd_End: @@ -746,9 +721,9 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En for (Document_Item *top = doc_get_item_top(&builder); top->type == Doc_Item; top = doc_get_item_top(&builder)){ - doc_end(&builder); + doc_end(arena, &builder); } - doc_end(&builder); + doc_end(arena, &builder); }break; case Cmd_Section: @@ -757,14 +732,12 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En if (extract_command_body(l, &i, &body_text)){ String extra_text = {}; extract_command_body(l, &i, &extra_text); - - char *title = get_null_terminated_version(body_text); - char *id = get_null_terminated_version(extra_text); - - begin_section(&builder, title, id); + String title = string_push_copy(arena, body_text); + String id = string_push_copy(arena, extra_text); + begin_section(arena, &builder, title.str, id.str); } else{ - report_error_missing_body(&builder, command_string); + report_error_missing_body(arena, &builder, command_string); } }break; @@ -772,35 +745,35 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En { String body_text = {}; if (extract_command_body(l, &i, &body_text)){ - begin_style(&builder, body_text); + begin_style(arena, &builder, body_text); } else{ - report_error_missing_body(&builder, command_string); + report_error_missing_body(arena, &builder, command_string); } }break; case Cmd_List: { - begin_list(&builder); + begin_list(arena, &builder); }break; case Cmd_Item: { Document_Item *top = doc_get_item_top(&builder); if (top->type == Doc_Item){ - doc_end(&builder); + doc_end(arena, &builder); } - begin_item(&builder); + begin_item(arena, &builder); }break; case Cmd_Link: { String body_text = {}; if (extract_command_body(l, &i, &body_text)){ - begin_link(&builder, body_text); + begin_link(arena, &builder, body_text); } else{ - report_error_missing_body(&builder, command_string); + report_error_missing_body(arena, &builder, command_string); } }break; @@ -809,10 +782,10 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En { String body_text = {}; if (extract_command_body(l, &i, &body_text)){ - add_document_link(&builder, body_text); + add_document_link(arena, &builder, body_text); } else{ - report_error_missing_body(&builder, command_string); + report_error_missing_body(arena, &builder, command_string); } }break; @@ -822,10 +795,10 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En if (extract_command_body(l, &i, &body_text)){ String size_parameter = {}; extract_command_body(l, &i, &size_parameter); - add_image(&builder, body_text, size_parameter); + add_image(arena, &builder, body_text, size_parameter); } else{ - report_error_missing_body(&builder, command_string); + report_error_missing_body(arena, &builder, command_string); } }break; @@ -833,36 +806,36 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En { String body_text = {}; if (extract_command_body(l, &i, &body_text)){ - add_video(&builder, body_text); + add_video(arena, &builder, body_text); } else{ - report_error_missing_body(&builder, command_string); + report_error_missing_body(arena, &builder, command_string); } }break; case Cmd_Version: { - add_version(&builder); + add_version(arena, &builder); }break; case Cmd_TableOfContents: { - add_table_of_contents(&builder); + add_table_of_contents(arena, &builder); }break; case Cmd_Todo: { - add_todo(&builder); + add_todo(arena, &builder); }break; case Cmd_Include: { String body_text = {}; if (extract_command_body(l, &i, &body_text)){ - add_include(doc_system, &builder, body_text); + add_include(arena, doc_system, &builder, body_text); } else{ - report_error_missing_body(&builder, command_string); + report_error_missing_body(arena, &builder, command_string); } }break; @@ -872,21 +845,21 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En String file = {}; if (extract_command_body(l, &i, &name)){ if (extract_command_body(l, &i, &file)){ - u32 result = create_meta_unit(doc_system, name, file); + u32 result = create_meta_unit(arena, doc_system, name, file); if (result == MetaResult_FailedToParse){ char space[512]; String str = make_fixed_width_string(space); append(&str, "parse failed for "); append(&str, file); - add_error(&builder, str); + add_error(arena, &builder, str); } } else{ - report_error_missing_body(&builder, command_string); + report_error_missing_body(arena, &builder, command_string); } } else{ - report_error_missing_body(&builder, command_string); + report_error_missing_body(arena, &builder, command_string); } }break; @@ -906,15 +879,15 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En } if (match_index == Cmd_DocList){ - add_doc_list(&builder, name, mangle_rule); + add_doc_list(arena, &builder, name, mangle_rule); } else{ - add_doc_full(&builder, name, mangle_rule); + add_doc_full(arena, &builder, name, mangle_rule); } } else{ - report_error_missing_body(&builder, command_string); + report_error_missing_body(arena, &builder, command_string); } }break; @@ -924,7 +897,7 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En String error = make_fixed_width_string(space); append(&error, "unrecognized command "); append(&error, command_string); - add_error(&builder, error); + add_error(arena, &builder, error); }break; } @@ -933,14 +906,14 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En } if (start != i){ - add_plain_old_text(&builder, substr(l, start, i - start)); + add_plain_old_text(arena, &builder, substr(l, start, i - start)); } - add_end_paragraph(&builder); + add_end_paragraph(arena, &builder); } } - end_document_description(&builder); + end_document_description(arena, &builder); return(builder.doc); } @@ -952,11 +925,11 @@ struct Unresolved_Include_Array{ }; internal Unresolved_Include_Array -get_unresolved_includes(Document_System *doc_system){ +get_unresolved_includes(Partition *arena, Document_System *doc_system){ Unresolved_Include_Array result = {}; Basic_List *list = &doc_system->unresolved_includes; - result.items = (Document_Item**)fm_push_array(Document_Item*, list->count); + result.items = (Document_Item**)push_array(arena, Document_Item*, list->count); result.count = list->count; u32 i = 0; @@ -970,9 +943,9 @@ get_unresolved_includes(Document_System *doc_system){ } internal void -resolve_all_includes(Document_System *doc_system){ +resolve_all_includes(Partition *arena, Document_System *doc_system){ for (;doc_system->unresolved_includes.count > 0;){ - Unresolved_Include_Array includes = get_unresolved_includes(doc_system); + Unresolved_Include_Array includes = get_unresolved_includes(arena, doc_system); clear_list(&doc_system->unresolved_includes); Document_Item **item_ptr = includes.items; @@ -982,9 +955,9 @@ resolve_all_includes(Document_System *doc_system){ Abstract_Item *inc_doc = get_item_by_name(doc_system->doc_list, item->include.name); if (inc_doc == 0){ String source_text = item->include.name; - Enriched_Text *text = fm_push_array(Enriched_Text, 1); - *text = load_enriched_text(doc_system->src_dir, source_text.str); - inc_doc = make_document_from_text(doc_system, source_text.str, source_text.str, text); + Enriched_Text *text = push_array(arena, Enriched_Text, 1); + *text = load_enriched_text(arena, doc_system->src_dir, source_text.str); + inc_doc = make_document_from_text(arena, doc_system, source_text.str, source_text.str, text); } item->include.document = inc_doc; } @@ -1219,7 +1192,7 @@ output_end_link(String *out){ } internal void -output_image(Document_System *doc_system, String *out, String l, String l2){ +output_image(Partition *arena, Document_System *doc_system, String *out, String l, String l2){ i32 pixel_height = 10; i32 pixel_width = HTML_WIDTH; @@ -1244,7 +1217,7 @@ output_image(Document_System *doc_system, String *out, String l, String l2){ char space[256]; if (img_get_link_string(img_lookup, space, sizeof(space), pixel_width, pixel_height)){ append(out, space); - add_image_instantiation(&img_lookup->img_instantiations, pixel_width, pixel_height); + add_image_instantiation(arena, &img_lookup->img_instantiations, pixel_width, pixel_height); } else{ NotImplemented; @@ -1332,8 +1305,8 @@ print_item_in_list(String *out, String name, char *id_postfix){ } internal void -init_used_links(Used_Links *used, i32 count){ - used->strs = fm_push_array(String, count); +init_used_links(Partition *arena, Used_Links *used, i32 count){ + used->strs = push_array(arena, String, count); used->count = 0; used->max = count; } @@ -1594,18 +1567,18 @@ print_doc_description(String *out, String src){ } internal void -print_struct_docs(String *out, Item_Node *member){ +print_struct_docs(Partition *arena, String *out, Item_Node *member){ for (Item_Node *member_iter = member->first_child; member_iter != 0; member_iter = member_iter->next_sibling){ String type = member_iter->type; if (match_ss(type, make_lit_string("struct")) || match_ss(type, make_lit_string("union"))){ - print_struct_docs(out, member_iter); + print_struct_docs(arena, out, member_iter); } else{ Documentation doc = {}; - perform_doc_parse(member_iter->doc_string, &doc); + perform_doc_parse(arena, member_iter->doc_string, &doc); append(out, "
"); @@ -1640,17 +1613,17 @@ print_see_also(String *out, Documentation *doc){ } internal void -print_function_docs(String *out, String name, String doc_string){ +print_function_docs(Partition *arena, String *out, String name, String doc_string){ if (doc_string.size == 0){ append(out, "No documentation generated for this function."); fprintf(stdout, "warning: no documentation string for %.*s\n", name.size, name.str); } - Temp temp = fm_begin_temp(); + Temp_Memory temp = begin_temp_memory(arena); Documentation doc = {}; - perform_doc_parse(doc_string, &doc); + perform_doc_parse(arena, doc_string, &doc); i32 doc_param_count = doc.param_count; if (doc_param_count > 0){ @@ -1686,14 +1659,14 @@ print_function_docs(String *out, String name, String doc_string){ print_see_also(out, &doc); - fm_end_temp(temp); + end_temp_memory(temp); } internal void -print_item_html(String *out, Used_Links *used, Item_Node *item, char *id_postfix, char *section, i32 I, u32 mangle_rule){ - Temp temp = fm_begin_temp(); +print_item_html(Partition *arena, String *out, Used_Links *used, Item_Node *item, char *id_postfix, char *section, i32 I, u32 mangle_rule){ + Temp_Memory temp = begin_temp_memory(arena); - String name = apply_mangle_rule(item->name, mangle_rule); + String name = apply_mangle_rule(arena, item->name, mangle_rule); /* NOTE(allen): Open a div for the whole item. @@ -1736,7 +1709,7 @@ print_item_html(String *out, Used_Links *used, Item_Node *item, char *id_postfix append(out, "
"); // NOTE(allen): Descriptive section - print_function_docs(out, name, item->doc_string); + print_function_docs(arena, out, name, item->doc_string); }break; case Item_Macro: @@ -1748,7 +1721,7 @@ print_item_html(String *out, Used_Links *used, Item_Node *item, char *id_postfix append(out, ""); // NOTE(allen): Descriptive section - print_function_docs(out, name, item->doc_string); + print_function_docs(arena, out, name, item->doc_string); }break; case Item_Typedef: @@ -1768,7 +1741,7 @@ print_item_html(String *out, Used_Links *used, Item_Node *item, char *id_postfix // NOTE(allen): Descriptive section String doc_string = item->doc_string; Documentation doc = {}; - perform_doc_parse(doc_string, &doc); + perform_doc_parse(arena, doc_string, &doc); String main_doc = doc.main_doc; if (main_doc.size != 0){ @@ -1799,7 +1772,7 @@ print_item_html(String *out, Used_Links *used, Item_Node *item, char *id_postfix // NOTE(allen): Descriptive section String doc_string = item->doc_string; Documentation doc = {}; - perform_doc_parse(doc_string, &doc); + perform_doc_parse(arena, doc_string, &doc); String main_doc = doc.main_doc; if (main_doc.size != 0){ @@ -1820,7 +1793,7 @@ print_item_html(String *out, Used_Links *used, Item_Node *item, char *id_postfix member; member = member->next_sibling){ Documentation doc = {}; - perform_doc_parse(member->doc_string, &doc); + perform_doc_parse(arena, member->doc_string, &doc); append(out, "
"); @@ -1877,7 +1850,7 @@ print_item_html(String *out, Used_Links *used, Item_Node *item, char *id_postfix // NOTE(allen): Descriptive section { Documentation doc = {}; - perform_doc_parse(doc_string, &doc); + perform_doc_parse(arena, doc_string, &doc); String main_doc = doc.main_doc; if (main_doc.size != 0){ @@ -1894,7 +1867,7 @@ print_item_html(String *out, Used_Links *used, Item_Node *item, char *id_postfix if (!hide_members){ if (item->first_child){ append(out, HTML_DOC_HEAD_OPEN"Fields"HTML_DOC_HEAD_CLOSE); - print_struct_docs(out, item); + print_struct_docs(arena, out, item); } } @@ -1910,7 +1883,7 @@ print_item_html(String *out, Used_Links *used, Item_Node *item, char *id_postfix // NOTE(allen): Close the item box append(out, "

"); - fm_end_temp(temp); + end_temp_memory(temp); } global char* html_css = @@ -1983,7 +1956,7 @@ make_output_system(String *out, Document_System *doc_system, Used_Links *used_li } internal void -doc_item_html(Document_Output_System sys, Document_Item *item, b32 head){ +doc_item_html(Partition *arena, Document_Output_System sys, Document_Item *item, b32 head){ switch (item->type){ case Doc_Root: { @@ -2059,7 +2032,7 @@ doc_item_html(Document_Output_System sys, Document_Item *item, b32 head){ append(sys.out, "