From 8849b401958722c8153a4adcbe024804b2dbf6a9 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Sat, 19 Oct 2019 23:01:33 -0700 Subject: [PATCH 1/8] Fix the bad crash on word complete without a needle --- custom/4coder_search.cpp | 2 +- custom/generated/command_metadata.h | 422 ++++++++++++++-------------- 2 files changed, 212 insertions(+), 212 deletions(-) diff --git a/custom/4coder_search.cpp b/custom/4coder_search.cpp index 8e63078f..736a494d 100644 --- a/custom/4coder_search.cpp +++ b/custom/4coder_search.cpp @@ -334,7 +334,6 @@ word_complete_it_release(Word_Complete_Iterator *it){ end_temp(it->arena_restore); table_clear(&it->already_used_table); } - block_zero_struct(it); } function Word_Complete_State @@ -418,6 +417,7 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with ProfileBlock(app, "word complete state init"); word_complete_it_release(&state.it); + block_zero_struct(&state); i64 pos = view_get_cursor_pos(app, view); diff --git a/custom/generated/command_metadata.h b/custom/generated/command_metadata.h index e71dbc7a..a43cec1c 100644 --- a/custom/generated/command_metadata.h +++ b/custom/generated/command_metadata.h @@ -233,217 +233,217 @@ i32 source_name_len; i32 line_number; }; static Command_Metadata fcoder_metacmd_table[211] = { -{ PROC_LINKS(default_view_input_handler, 0), false, "default_view_input_handler", 26, "Input consumption loop for default view behavior", 48, "w:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 56 }, -{ PROC_LINKS(profile_enable, 0), false, "profile_enable", 14, "Allow 4coder's self profiler to gather new profiling information.", 65, "w:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 196 }, -{ PROC_LINKS(profile_disable, 0), false, "profile_disable", 15, "Prevent 4coder's self profiler from gathering new profiling information.", 72, "w:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 202 }, -{ PROC_LINKS(profile_clear, 0), false, "profile_clear", 13, "Clear all profiling information from 4coder's self profiler.", 60, "w:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 208 }, -{ PROC_LINKS(seek_beginning_of_textual_line, 0), false, "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2106 }, -{ PROC_LINKS(seek_end_of_textual_line, 0), false, "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2112 }, -{ PROC_LINKS(seek_beginning_of_line, 0), false, "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2118 }, -{ PROC_LINKS(seek_end_of_line, 0), false, "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2124 }, -{ PROC_LINKS(goto_beginning_of_file, 0), false, "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2130 }, -{ PROC_LINKS(goto_end_of_file, 0), false, "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2138 }, -{ PROC_LINKS(change_active_panel, 0), false, "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 270 }, -{ PROC_LINKS(change_active_panel_backwards, 0), false, "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 280 }, -{ PROC_LINKS(open_panel_vsplit, 0), false, "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 290 }, -{ PROC_LINKS(open_panel_hsplit, 0), false, "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 300 }, -{ PROC_LINKS(suppress_mouse, 0), false, "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 365 }, -{ PROC_LINKS(allow_mouse, 0), false, "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 371 }, -{ PROC_LINKS(toggle_mouse, 0), false, "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 377 }, -{ PROC_LINKS(set_mode_to_original, 0), false, "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 383 }, -{ PROC_LINKS(set_mode_to_notepad_like, 0), false, "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 389 }, -{ PROC_LINKS(toggle_highlight_line_at_cursor, 0), false, "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 395 }, -{ PROC_LINKS(toggle_highlight_enclosing_scopes, 0), false, "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 401 }, -{ PROC_LINKS(toggle_paren_matching_helper, 0), false, "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 407 }, -{ PROC_LINKS(toggle_fullscreen, 0), false, "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 413 }, -{ PROC_LINKS(write_text_input, 0), false, "write_text_input", 16, "Inserts whatever character was used to trigger this command.", 60, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 58 }, -{ PROC_LINKS(write_space, 0), false, "write_space", 11, "Inserts an underscore.", 22, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 66 }, -{ PROC_LINKS(write_underscore, 0), false, "write_underscore", 16, "Inserts an underscore.", 22, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 72 }, -{ PROC_LINKS(delete_char, 0), false, "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 78 }, -{ PROC_LINKS(backspace_char, 0), false, "backspace_char", 14, "Deletes the character to the left of the cursor.", 48, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 95 }, -{ PROC_LINKS(set_mark, 0), false, "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 114 }, -{ PROC_LINKS(cursor_mark_swap, 0), false, "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 123 }, -{ PROC_LINKS(delete_range, 0), false, "delete_range", 12, "Deletes the text in the range between the cursor and the mark.", 62, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 133 }, -{ PROC_LINKS(backspace_alpha_numeric_boundary, 0), false, "backspace_alpha_numeric_boundary", 32, "Delete characters between the cursor position and the first alphanumeric boundary to the left.", 94, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 153 }, -{ PROC_LINKS(delete_alpha_numeric_boundary, 0), false, "delete_alpha_numeric_boundary", 29, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 161 }, -{ PROC_LINKS(snipe_backward_whitespace_or_token_boundary, 0), false, "snipe_backward_whitespace_or_token_boundary", 43, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 181 }, -{ PROC_LINKS(snipe_forward_whitespace_or_token_boundary, 0), false, "snipe_forward_whitespace_or_token_boundary", 42, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 189 }, -{ PROC_LINKS(center_view, 0), false, "center_view", 11, "Centers the view vertically on the line on which the cursor sits.", 65, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 199 }, -{ PROC_LINKS(left_adjust_view, 0), false, "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 213 }, -{ PROC_LINKS(click_set_cursor_and_mark, 0), false, "click_set_cursor_and_mark", 25, "Sets the cursor position and mark to the mouse position.", 56, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 225 }, -{ PROC_LINKS(click_set_cursor, 0), false, "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 235 }, -{ PROC_LINKS(click_set_cursor_if_lbutton, 0), false, "click_set_cursor_if_lbutton", 27, "If the mouse left button is pressed, sets the cursor position to the mouse position.", 84, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 245 }, -{ PROC_LINKS(click_set_mark, 0), false, "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 257 }, -{ PROC_LINKS(mouse_wheel_scroll, 0), false, "mouse_wheel_scroll", 18, "Reads the scroll wheel value from the mouse state and scrolls accordingly.", 74, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 267 }, -{ PROC_LINKS(move_up, 0), false, "move_up", 7, "Moves the cursor up one line.", 29, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 321 }, -{ PROC_LINKS(move_down, 0), false, "move_down", 9, "Moves the cursor down one line.", 31, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 327 }, -{ PROC_LINKS(move_up_10, 0), false, "move_up_10", 10, "Moves the cursor up ten lines.", 30, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 333 }, -{ PROC_LINKS(move_down_10, 0), false, "move_down_10", 12, "Moves the cursor down ten lines.", 32, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 339 }, -{ PROC_LINKS(move_down_textual, 0), false, "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 345 }, -{ PROC_LINKS(page_up, 0), false, "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 355 }, -{ PROC_LINKS(page_down, 0), false, "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 363 }, -{ PROC_LINKS(move_up_to_blank_line, 0), false, "move_up_to_blank_line", 21, "Seeks the cursor up to the next blank line.", 43, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 393 }, -{ PROC_LINKS(move_down_to_blank_line, 0), false, "move_down_to_blank_line", 23, "Seeks the cursor down to the next blank line.", 45, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 399 }, -{ PROC_LINKS(move_up_to_blank_line_skip_whitespace, 0), false, "move_up_to_blank_line_skip_whitespace", 37, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 405 }, -{ PROC_LINKS(move_down_to_blank_line_skip_whitespace, 0), false, "move_down_to_blank_line_skip_whitespace", 39, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 411 }, -{ PROC_LINKS(move_up_to_blank_line_end, 0), false, "move_up_to_blank_line_end", 25, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 417 }, -{ PROC_LINKS(move_down_to_blank_line_end, 0), false, "move_down_to_blank_line_end", 27, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 423 }, -{ PROC_LINKS(move_left, 0), false, "move_left", 9, "Moves the cursor one character to the left.", 43, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 429 }, -{ PROC_LINKS(move_right, 0), false, "move_right", 10, "Moves the cursor one character to the right.", 44, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 441 }, -{ PROC_LINKS(move_right_whitespace_boundary, 0), false, "move_right_whitespace_boundary", 30, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 463 }, -{ PROC_LINKS(move_left_whitespace_boundary, 0), false, "move_left_whitespace_boundary", 29, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 471 }, -{ PROC_LINKS(move_right_token_boundary, 0), false, "move_right_token_boundary", 25, "Seek right for the next end of a token.", 39, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 479 }, -{ PROC_LINKS(move_left_token_boundary, 0), false, "move_left_token_boundary", 24, "Seek left for the next beginning of a token.", 44, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 487 }, -{ PROC_LINKS(move_right_whitespace_or_token_boundary, 0), false, "move_right_whitespace_or_token_boundary", 39, "Seek right for the next end of a token or boundary between whitespace and non-whitespace.", 89, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 495 }, -{ PROC_LINKS(move_left_whitespace_or_token_boundary, 0), false, "move_left_whitespace_or_token_boundary", 38, "Seek left for the next end of a token or boundary between whitespace and non-whitespace.", 88, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 503 }, -{ PROC_LINKS(move_right_alpha_numeric_boundary, 0), false, "move_right_alpha_numeric_boundary", 33, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 511 }, -{ PROC_LINKS(move_left_alpha_numeric_boundary, 0), false, "move_left_alpha_numeric_boundary", 32, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 519 }, -{ PROC_LINKS(move_right_alpha_numeric_or_camel_boundary, 0), false, "move_right_alpha_numeric_or_camel_boundary", 42, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 527 }, -{ PROC_LINKS(move_left_alpha_numeric_or_camel_boundary, 0), false, "move_left_alpha_numeric_or_camel_boundary", 41, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 535 }, -{ PROC_LINKS(select_all, 0), false, "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 545 }, -{ PROC_LINKS(to_uppercase, 0), false, "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 558 }, -{ PROC_LINKS(to_lowercase, 0), false, "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 571 }, -{ PROC_LINKS(clean_all_lines, 0), false, "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 584 }, -{ PROC_LINKS(basic_change_active_panel, 0), false, "basic_change_active_panel", 25, "Change the currently active panel, moving to the panel with the next highest view_id. Will not skipe the build panel if it is open.", 132, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 618 }, -{ PROC_LINKS(close_panel, 0), false, "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 626 }, -{ PROC_LINKS(show_scrollbar, 0), false, "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 635 }, -{ PROC_LINKS(hide_scrollbar, 0), false, "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 642 }, -{ PROC_LINKS(show_filebar, 0), false, "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 649 }, -{ PROC_LINKS(hide_filebar, 0), false, "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 656 }, -{ PROC_LINKS(toggle_filebar, 0), false, "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 663 }, -{ PROC_LINKS(toggle_fps_meter, 0), false, "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 672 }, -{ PROC_LINKS(increase_face_size, 0), false, "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 678 }, -{ PROC_LINKS(decrease_face_size, 0), false, "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 689 }, -{ PROC_LINKS(mouse_wheel_change_face_size, 0), false, "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\\custom\\4coder_base_commands.cpp", 43, 700 }, -{ PROC_LINKS(toggle_virtual_whitespace, 0), false, "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 717 }, -{ PROC_LINKS(toggle_show_whitespace, 0), false, "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 726 }, -{ PROC_LINKS(toggle_line_numbers, 0), false, "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 735 }, -{ PROC_LINKS(exit_4coder, 0), false, "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 741 }, -{ PROC_LINKS(goto_line, 0), false, "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 749 }, -{ PROC_LINKS(search, 0), false, "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 977 }, -{ PROC_LINKS(reverse_search, 0), false, "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 983 }, -{ PROC_LINKS(search_identifier, 0), false, "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 989 }, -{ PROC_LINKS(reverse_search_identifier, 0), false, "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\\custom\\4coder_base_commands.cpp", 43, 995 }, -{ PROC_LINKS(replace_in_range, 0), false, "replace_in_range", 16, "Queries the user for a needle and string. Replaces all occurences of needle with string in the range between cursor and the mark in the active buffer.", 150, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1042 }, -{ PROC_LINKS(replace_in_buffer, 0), false, "replace_in_buffer", 17, "Queries the user for a needle and string. Replaces all occurences of needle with string in the active buffer.", 109, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1051 }, -{ PROC_LINKS(replace_in_all_buffers, 0), false, "replace_in_all_buffers", 22, "Queries the user for a needle and string. Replaces all occurences of needle with string in all editable buffers.", 112, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1060 }, -{ PROC_LINKS(query_replace, 0), false, "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1150 }, -{ PROC_LINKS(query_replace_identifier, 0), false, "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1171 }, -{ PROC_LINKS(query_replace_selection, 0), false, "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1187 }, -{ PROC_LINKS(save_all_dirty_buffers, 0), false, "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1222 }, -{ PROC_LINKS(delete_file_query, 0), false, "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1247 }, -{ PROC_LINKS(save_to_query, 0), false, "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1291 }, -{ PROC_LINKS(rename_file_query, 0), false, "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\\custom\\4coder_base_commands.cpp", 43, 1324 }, -{ PROC_LINKS(make_directory_query, 0), false, "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1362 }, -{ PROC_LINKS(move_line_up, 0), false, "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1396 }, -{ PROC_LINKS(move_line_down, 0), false, "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1402 }, -{ PROC_LINKS(duplicate_line, 0), false, "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1408 }, -{ PROC_LINKS(delete_line, 0), false, "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1422 }, -{ PROC_LINKS(open_file_in_quotes, 0), false, "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1487 }, -{ PROC_LINKS(open_matching_file_cpp, 0), false, "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1519 }, -{ PROC_LINKS(view_buffer_other_panel, 0), false, "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1532 }, -{ PROC_LINKS(swap_buffers_between_panels, 0), false, "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1544 }, -{ PROC_LINKS(kill_buffer, 0), false, "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1578 }, -{ PROC_LINKS(save, 0), false, "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1586 }, -{ PROC_LINKS(reopen, 0), false, "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1596 }, -{ PROC_LINKS(undo, 0), false, "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1825 }, -{ PROC_LINKS(redo, 0), false, "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1838 }, -{ PROC_LINKS(undo_all_buffers, 0), false, "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1852 }, -{ PROC_LINKS(redo_all_buffers, 0), false, "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1923 }, -{ PROC_LINKS(open_in_other, 0), false, "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2024 }, -{ PROC_LINKS(default_file_externally_modified, 0), false, "default_file_externally_modified", 32, "Notes the external modification of attached files by printing a message.", 72, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2031 }, -{ PROC_LINKS(set_eol_mode_to_crlf, 0), false, "set_eol_mode_to_crlf", 20, "Puts the buffer in crlf line ending mode.", 41, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 80 }, -{ PROC_LINKS(set_eol_mode_to_lf, 0), false, "set_eol_mode_to_lf", 18, "Puts the buffer in lf line ending mode.", 39, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 91 }, -{ PROC_LINKS(set_eol_mode_to_binary, 0), false, "set_eol_mode_to_binary", 22, "Puts the buffer in bin line ending mode.", 40, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 102 }, -{ PROC_LINKS(set_eol_mode_from_contents, 0), false, "set_eol_mode_from_contents", 26, "Sets the buffer's line ending mode to match the contents of the buffer.", 71, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 113 }, -{ PROC_LINKS(interactive_switch_buffer, 0), true, "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 477 }, -{ PROC_LINKS(interactive_kill_buffer, 0), true, "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 496 }, -{ PROC_LINKS(interactive_open_or_new, 0), true, "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 567 }, -{ PROC_LINKS(interactive_new, 0), true, "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 606 }, -{ PROC_LINKS(interactive_open, 0), true, "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 639 }, -{ PROC_LINKS(command_lister, 0), true, "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 702 }, -{ PROC_LINKS(auto_indent_whole_file, 0), false, "auto_indent_whole_file", 22, "Audo-indents the entire current buffer.", 39, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 356 }, -{ PROC_LINKS(auto_indent_line_at_cursor, 0), false, "auto_indent_line_at_cursor", 26, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 365 }, -{ PROC_LINKS(auto_indent_range, 0), false, "auto_indent_range", 17, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 375 }, -{ PROC_LINKS(write_text_and_auto_indent, 0), false, "write_text_and_auto_indent", 26, "Inserts text and auto-indents the line on which the cursor sits if any of the text contains 'layout punctuation' such as ;:{}()[]# and new lines.", 145, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 385 }, -{ PROC_LINKS(list_all_locations, 0), false, "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 166 }, -{ PROC_LINKS(list_all_substring_locations, 0), false, "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 172 }, -{ PROC_LINKS(list_all_locations_case_insensitive, 0), false, "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 178 }, -{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), false, "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 184 }, -{ PROC_LINKS(list_all_locations_of_identifier, 0), false, "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 190 }, -{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), false, "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 196 }, -{ PROC_LINKS(list_all_locations_of_selection, 0), false, "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 202 }, -{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), false, "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 208 }, -{ PROC_LINKS(list_all_locations_of_type_definition, 0), false, "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 214 }, -{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), false, "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 222 }, -{ PROC_LINKS(word_complete, 0), false, "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 392 }, -{ PROC_LINKS(goto_jump_at_cursor, 0), false, "goto_jump_at_cursor", 19, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 346 }, -{ PROC_LINKS(goto_jump_at_cursor_same_panel, 0), false, "goto_jump_at_cursor_same_panel", 30, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list.", 167, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 373 }, -{ PROC_LINKS(goto_next_jump, 0), false, "goto_next_jump", 14, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 462 }, -{ PROC_LINKS(goto_prev_jump, 0), false, "goto_prev_jump", 14, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 479 }, -{ PROC_LINKS(goto_next_jump_no_skips, 0), false, "goto_next_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 492 }, -{ PROC_LINKS(goto_prev_jump_no_skips, 0), false, "goto_prev_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 509 }, -{ PROC_LINKS(goto_first_jump, 0), false, "goto_first_jump", 15, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 523 }, -{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), false, "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 540 }, -{ PROC_LINKS(if_read_only_goto_position, 0), false, "if_read_only_goto_position", 26, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 562 }, -{ PROC_LINKS(if_read_only_goto_position_same_panel, 0), false, "if_read_only_goto_position_same_panel", 37, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 579 }, -{ PROC_LINKS(view_jump_list_with_lister, 0), false, "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "w:\\4ed\\code\\custom\\4coder_jump_lister.cpp", 41, 104 }, -{ PROC_LINKS(show_the_log_graph, 0), true, "show_the_log_graph", 18, "Parses *log* and displays the 'log graph' UI", 44, "w:\\4ed\\code\\custom\\4coder_log_parser.cpp", 40, 990 }, -{ PROC_LINKS(copy, 0), false, "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 19 }, -{ PROC_LINKS(cut, 0), false, "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 28 }, -{ PROC_LINKS(paste, 0), false, "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 39 }, -{ PROC_LINKS(paste_next, 0), false, "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 73 }, -{ PROC_LINKS(paste_and_indent, 0), false, "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 115 }, -{ PROC_LINKS(paste_next_and_indent, 0), false, "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 122 }, -{ PROC_LINKS(execute_previous_cli, 0), false, "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "w:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 7 }, -{ PROC_LINKS(execute_any_cli, 0), false, "execute_any_cli", 15, "Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.", 133, "w:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 22 }, -{ PROC_LINKS(build_search, 0), false, "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 128 }, -{ PROC_LINKS(build_in_build_panel, 0), false, "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 163 }, -{ PROC_LINKS(close_build_panel, 0), false, "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 178 }, -{ PROC_LINKS(change_to_build_panel, 0), false, "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 184 }, -{ PROC_LINKS(close_all_code, 0), false, "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 917 }, -{ PROC_LINKS(open_all_code, 0), false, "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 923 }, -{ PROC_LINKS(open_all_code_recursive, 0), false, "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 929 }, -{ PROC_LINKS(load_project, 0), false, "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\\custom\\4coder_project_commands.cpp", 46, 937 }, -{ PROC_LINKS(project_fkey_command, 0), false, "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 944 }, -{ PROC_LINKS(project_go_to_root_directory, 0), false, "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 969 }, -{ PROC_LINKS(setup_new_project, 0), false, "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1303 }, -{ PROC_LINKS(setup_build_bat, 0), false, "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1310 }, -{ PROC_LINKS(setup_build_sh, 0), false, "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1316 }, -{ PROC_LINKS(setup_build_bat_and_sh, 0), false, "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1322 }, -{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1338 }, -{ PROC_LINKS(list_all_functions_current_buffer, 0), false, "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "w:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 267 }, -{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), false, "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "w:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 277 }, -{ PROC_LINKS(list_all_functions_all_buffers, 0), false, "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\\custom\\4coder_function_list.cpp", 43, 289 }, -{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), false, "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\\custom\\4coder_function_list.cpp", 43, 295 }, -{ PROC_LINKS(select_surrounding_scope, 0), false, "select_surrounding_scope", 24, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "w:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 7 }, -{ PROC_LINKS(select_next_scope_absolute, 0), false, "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "w:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 32 }, -{ PROC_LINKS(select_next_scope_after_current, 0), false, "select_next_scope_after_current", 31, "Finds the first scope started by '{' after the mark and puts the cursor and mark on the '{' and '}'. This command is meant to be used after a scope is already selected so that it will have the effect of selecting the next scope after the current scope.", 253, "w:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 41 }, -{ PROC_LINKS(select_prev_scope_absolute, 0), false, "select_prev_scope_absolute", 26, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "w:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 50 }, -{ PROC_LINKS(place_in_scope, 0), false, "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "w:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 67 }, -{ PROC_LINKS(delete_current_scope, 0), false, "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "w:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 73 }, -{ PROC_LINKS(open_long_braces, 0), false, "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 46 }, -{ PROC_LINKS(open_long_braces_semicolon, 0), false, "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 54 }, -{ PROC_LINKS(open_long_braces_break, 0), false, "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 62 }, -{ PROC_LINKS(if0_off, 0), false, "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 70 }, -{ PROC_LINKS(write_todo, 0), false, "write_todo", 10, "At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 76 }, -{ PROC_LINKS(write_hack, 0), false, "write_hack", 10, "At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 82 }, -{ PROC_LINKS(write_note, 0), false, "write_note", 10, "At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 88 }, -{ PROC_LINKS(write_block, 0), false, "write_block", 11, "At the cursor, insert a block comment.", 38, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 94 }, -{ PROC_LINKS(write_zero_struct, 0), false, "write_zero_struct", 17, "At the cursor, insert a ' = {};'.", 33, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 100 }, -{ PROC_LINKS(comment_line, 0), false, "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 125 }, -{ PROC_LINKS(uncomment_line, 0), false, "uncomment_line", 14, "If present, delete '//' at the beginning of the line after leading whitespace.", 78, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 137 }, -{ PROC_LINKS(comment_line_toggle, 0), false, "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 149 }, -{ PROC_LINKS(snippet_lister, 0), false, "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 231 }, -{ PROC_LINKS(miblo_increment_basic, 0), false, "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "w:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 29 }, -{ PROC_LINKS(miblo_decrement_basic, 0), false, "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "w:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 44 }, -{ PROC_LINKS(miblo_increment_time_stamp, 0), false, "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\\custom\\4coder_miblo_numbers.cpp", 43, 231 }, -{ PROC_LINKS(miblo_decrement_time_stamp, 0), false, "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\\custom\\4coder_miblo_numbers.cpp", 43, 237 }, -{ PROC_LINKS(miblo_increment_time_stamp_minute, 0), false, "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\\custom\\4coder_miblo_numbers.cpp", 43, 243 }, -{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), false, "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\\custom\\4coder_miblo_numbers.cpp", 43, 249 }, -{ PROC_LINKS(profile_inspect, 0), true, "profile_inspect", 15, "Inspect all currently collected profiling information in 4coder's self profiler.", 80, "w:\\4ed\\code\\custom\\4coder_profile_inspect.cpp", 45, 377 }, -{ PROC_LINKS(default_startup, 0), false, "default_startup", 15, "Default command for responding to a startup event", 49, "w:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 7 }, -{ PROC_LINKS(default_try_exit, 0), false, "default_try_exit", 16, "Default command for responding to a try-exit event", 50, "w:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 21 }, +{ PROC_LINKS(default_view_input_handler, 0), false, "default_view_input_handler", 26, "Input consumption loop for default view behavior", 48, "c:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 56 }, +{ PROC_LINKS(profile_enable, 0), false, "profile_enable", 14, "Allow 4coder's self profiler to gather new profiling information.", 65, "c:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 196 }, +{ PROC_LINKS(profile_disable, 0), false, "profile_disable", 15, "Prevent 4coder's self profiler from gathering new profiling information.", 72, "c:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 202 }, +{ PROC_LINKS(profile_clear, 0), false, "profile_clear", 13, "Clear all profiling information from 4coder's self profiler.", 60, "c:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 208 }, +{ PROC_LINKS(seek_beginning_of_textual_line, 0), false, "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "c:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2106 }, +{ PROC_LINKS(seek_end_of_textual_line, 0), false, "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "c:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2112 }, +{ PROC_LINKS(seek_beginning_of_line, 0), false, "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "c:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2118 }, +{ PROC_LINKS(seek_end_of_line, 0), false, "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "c:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2124 }, +{ PROC_LINKS(goto_beginning_of_file, 0), false, "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "c:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2130 }, +{ PROC_LINKS(goto_end_of_file, 0), false, "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "c:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2138 }, +{ PROC_LINKS(change_active_panel, 0), false, "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 270 }, +{ PROC_LINKS(change_active_panel_backwards, 0), false, "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 280 }, +{ PROC_LINKS(open_panel_vsplit, 0), false, "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 290 }, +{ PROC_LINKS(open_panel_hsplit, 0), false, "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 300 }, +{ PROC_LINKS(suppress_mouse, 0), false, "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 365 }, +{ PROC_LINKS(allow_mouse, 0), false, "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 371 }, +{ PROC_LINKS(toggle_mouse, 0), false, "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 377 }, +{ PROC_LINKS(set_mode_to_original, 0), false, "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 383 }, +{ PROC_LINKS(set_mode_to_notepad_like, 0), false, "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 389 }, +{ PROC_LINKS(toggle_highlight_line_at_cursor, 0), false, "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 395 }, +{ PROC_LINKS(toggle_highlight_enclosing_scopes, 0), false, "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 401 }, +{ PROC_LINKS(toggle_paren_matching_helper, 0), false, "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 407 }, +{ PROC_LINKS(toggle_fullscreen, 0), false, "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 413 }, +{ PROC_LINKS(write_text_input, 0), false, "write_text_input", 16, "Inserts whatever character was used to trigger this command.", 60, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 58 }, +{ PROC_LINKS(write_space, 0), false, "write_space", 11, "Inserts an underscore.", 22, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 66 }, +{ PROC_LINKS(write_underscore, 0), false, "write_underscore", 16, "Inserts an underscore.", 22, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 72 }, +{ PROC_LINKS(delete_char, 0), false, "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 78 }, +{ PROC_LINKS(backspace_char, 0), false, "backspace_char", 14, "Deletes the character to the left of the cursor.", 48, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 95 }, +{ PROC_LINKS(set_mark, 0), false, "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 114 }, +{ PROC_LINKS(cursor_mark_swap, 0), false, "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 123 }, +{ PROC_LINKS(delete_range, 0), false, "delete_range", 12, "Deletes the text in the range between the cursor and the mark.", 62, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 133 }, +{ PROC_LINKS(backspace_alpha_numeric_boundary, 0), false, "backspace_alpha_numeric_boundary", 32, "Delete characters between the cursor position and the first alphanumeric boundary to the left.", 94, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 153 }, +{ PROC_LINKS(delete_alpha_numeric_boundary, 0), false, "delete_alpha_numeric_boundary", 29, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 161 }, +{ PROC_LINKS(snipe_backward_whitespace_or_token_boundary, 0), false, "snipe_backward_whitespace_or_token_boundary", 43, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 181 }, +{ PROC_LINKS(snipe_forward_whitespace_or_token_boundary, 0), false, "snipe_forward_whitespace_or_token_boundary", 42, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 189 }, +{ PROC_LINKS(center_view, 0), false, "center_view", 11, "Centers the view vertically on the line on which the cursor sits.", 65, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 199 }, +{ PROC_LINKS(left_adjust_view, 0), false, "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 213 }, +{ PROC_LINKS(click_set_cursor_and_mark, 0), false, "click_set_cursor_and_mark", 25, "Sets the cursor position and mark to the mouse position.", 56, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 225 }, +{ PROC_LINKS(click_set_cursor, 0), false, "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 235 }, +{ PROC_LINKS(click_set_cursor_if_lbutton, 0), false, "click_set_cursor_if_lbutton", 27, "If the mouse left button is pressed, sets the cursor position to the mouse position.", 84, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 245 }, +{ PROC_LINKS(click_set_mark, 0), false, "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 257 }, +{ PROC_LINKS(mouse_wheel_scroll, 0), false, "mouse_wheel_scroll", 18, "Reads the scroll wheel value from the mouse state and scrolls accordingly.", 74, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 267 }, +{ PROC_LINKS(move_up, 0), false, "move_up", 7, "Moves the cursor up one line.", 29, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 321 }, +{ PROC_LINKS(move_down, 0), false, "move_down", 9, "Moves the cursor down one line.", 31, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 327 }, +{ PROC_LINKS(move_up_10, 0), false, "move_up_10", 10, "Moves the cursor up ten lines.", 30, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 333 }, +{ PROC_LINKS(move_down_10, 0), false, "move_down_10", 12, "Moves the cursor down ten lines.", 32, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 339 }, +{ PROC_LINKS(move_down_textual, 0), false, "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 345 }, +{ PROC_LINKS(page_up, 0), false, "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 355 }, +{ PROC_LINKS(page_down, 0), false, "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 363 }, +{ PROC_LINKS(move_up_to_blank_line, 0), false, "move_up_to_blank_line", 21, "Seeks the cursor up to the next blank line.", 43, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 393 }, +{ PROC_LINKS(move_down_to_blank_line, 0), false, "move_down_to_blank_line", 23, "Seeks the cursor down to the next blank line.", 45, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 399 }, +{ PROC_LINKS(move_up_to_blank_line_skip_whitespace, 0), false, "move_up_to_blank_line_skip_whitespace", 37, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 405 }, +{ PROC_LINKS(move_down_to_blank_line_skip_whitespace, 0), false, "move_down_to_blank_line_skip_whitespace", 39, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 411 }, +{ PROC_LINKS(move_up_to_blank_line_end, 0), false, "move_up_to_blank_line_end", 25, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 417 }, +{ PROC_LINKS(move_down_to_blank_line_end, 0), false, "move_down_to_blank_line_end", 27, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 423 }, +{ PROC_LINKS(move_left, 0), false, "move_left", 9, "Moves the cursor one character to the left.", 43, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 429 }, +{ PROC_LINKS(move_right, 0), false, "move_right", 10, "Moves the cursor one character to the right.", 44, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 441 }, +{ PROC_LINKS(move_right_whitespace_boundary, 0), false, "move_right_whitespace_boundary", 30, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 463 }, +{ PROC_LINKS(move_left_whitespace_boundary, 0), false, "move_left_whitespace_boundary", 29, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 471 }, +{ PROC_LINKS(move_right_token_boundary, 0), false, "move_right_token_boundary", 25, "Seek right for the next end of a token.", 39, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 479 }, +{ PROC_LINKS(move_left_token_boundary, 0), false, "move_left_token_boundary", 24, "Seek left for the next beginning of a token.", 44, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 487 }, +{ PROC_LINKS(move_right_whitespace_or_token_boundary, 0), false, "move_right_whitespace_or_token_boundary", 39, "Seek right for the next end of a token or boundary between whitespace and non-whitespace.", 89, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 495 }, +{ PROC_LINKS(move_left_whitespace_or_token_boundary, 0), false, "move_left_whitespace_or_token_boundary", 38, "Seek left for the next end of a token or boundary between whitespace and non-whitespace.", 88, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 503 }, +{ PROC_LINKS(move_right_alpha_numeric_boundary, 0), false, "move_right_alpha_numeric_boundary", 33, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 511 }, +{ PROC_LINKS(move_left_alpha_numeric_boundary, 0), false, "move_left_alpha_numeric_boundary", 32, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 519 }, +{ PROC_LINKS(move_right_alpha_numeric_or_camel_boundary, 0), false, "move_right_alpha_numeric_or_camel_boundary", 42, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 527 }, +{ PROC_LINKS(move_left_alpha_numeric_or_camel_boundary, 0), false, "move_left_alpha_numeric_or_camel_boundary", 41, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 535 }, +{ PROC_LINKS(select_all, 0), false, "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 545 }, +{ PROC_LINKS(to_uppercase, 0), false, "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 558 }, +{ PROC_LINKS(to_lowercase, 0), false, "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 571 }, +{ PROC_LINKS(clean_all_lines, 0), false, "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 584 }, +{ PROC_LINKS(basic_change_active_panel, 0), false, "basic_change_active_panel", 25, "Change the currently active panel, moving to the panel with the next highest view_id. Will not skipe the build panel if it is open.", 132, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 618 }, +{ PROC_LINKS(close_panel, 0), false, "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 626 }, +{ PROC_LINKS(show_scrollbar, 0), false, "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 635 }, +{ PROC_LINKS(hide_scrollbar, 0), false, "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 642 }, +{ PROC_LINKS(show_filebar, 0), false, "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 649 }, +{ PROC_LINKS(hide_filebar, 0), false, "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 656 }, +{ PROC_LINKS(toggle_filebar, 0), false, "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 663 }, +{ PROC_LINKS(toggle_fps_meter, 0), false, "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 672 }, +{ PROC_LINKS(increase_face_size, 0), false, "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 678 }, +{ PROC_LINKS(decrease_face_size, 0), false, "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 689 }, +{ PROC_LINKS(mouse_wheel_change_face_size, 0), false, "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, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 700 }, +{ PROC_LINKS(toggle_virtual_whitespace, 0), false, "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 717 }, +{ PROC_LINKS(toggle_show_whitespace, 0), false, "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 726 }, +{ PROC_LINKS(toggle_line_numbers, 0), false, "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 735 }, +{ PROC_LINKS(exit_4coder, 0), false, "exit_4coder", 11, "Attempts to close 4coder.", 25, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 741 }, +{ PROC_LINKS(goto_line, 0), false, "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 749 }, +{ PROC_LINKS(search, 0), false, "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 977 }, +{ PROC_LINKS(reverse_search, 0), false, "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 983 }, +{ PROC_LINKS(search_identifier, 0), false, "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 989 }, +{ PROC_LINKS(reverse_search_identifier, 0), false, "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 995 }, +{ PROC_LINKS(replace_in_range, 0), false, "replace_in_range", 16, "Queries the user for a needle and string. Replaces all occurences of needle with string in the range between cursor and the mark in the active buffer.", 150, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1042 }, +{ PROC_LINKS(replace_in_buffer, 0), false, "replace_in_buffer", 17, "Queries the user for a needle and string. Replaces all occurences of needle with string in the active buffer.", 109, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1051 }, +{ PROC_LINKS(replace_in_all_buffers, 0), false, "replace_in_all_buffers", 22, "Queries the user for a needle and string. Replaces all occurences of needle with string in all editable buffers.", 112, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1060 }, +{ PROC_LINKS(query_replace, 0), false, "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1150 }, +{ PROC_LINKS(query_replace_identifier, 0), false, "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1171 }, +{ PROC_LINKS(query_replace_selection, 0), false, "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1187 }, +{ PROC_LINKS(save_all_dirty_buffers, 0), false, "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1222 }, +{ PROC_LINKS(delete_file_query, 0), false, "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1247 }, +{ PROC_LINKS(save_to_query, 0), false, "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1291 }, +{ PROC_LINKS(rename_file_query, 0), false, "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, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1324 }, +{ PROC_LINKS(make_directory_query, 0), false, "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1362 }, +{ PROC_LINKS(move_line_up, 0), false, "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1396 }, +{ PROC_LINKS(move_line_down, 0), false, "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1402 }, +{ PROC_LINKS(duplicate_line, 0), false, "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1408 }, +{ PROC_LINKS(delete_line, 0), false, "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1422 }, +{ PROC_LINKS(open_file_in_quotes, 0), false, "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1487 }, +{ PROC_LINKS(open_matching_file_cpp, 0), false, "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1519 }, +{ PROC_LINKS(view_buffer_other_panel, 0), false, "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1532 }, +{ PROC_LINKS(swap_buffers_between_panels, 0), false, "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1544 }, +{ PROC_LINKS(kill_buffer, 0), false, "kill_buffer", 11, "Kills the current buffer.", 25, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1578 }, +{ PROC_LINKS(save, 0), false, "save", 4, "Saves the current buffer.", 25, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1586 }, +{ PROC_LINKS(reopen, 0), false, "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1596 }, +{ PROC_LINKS(undo, 0), false, "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1825 }, +{ PROC_LINKS(redo, 0), false, "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1838 }, +{ PROC_LINKS(undo_all_buffers, 0), false, "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1852 }, +{ PROC_LINKS(redo_all_buffers, 0), false, "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1923 }, +{ PROC_LINKS(open_in_other, 0), false, "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2024 }, +{ PROC_LINKS(default_file_externally_modified, 0), false, "default_file_externally_modified", 32, "Notes the external modification of attached files by printing a message.", 72, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2031 }, +{ PROC_LINKS(set_eol_mode_to_crlf, 0), false, "set_eol_mode_to_crlf", 20, "Puts the buffer in crlf line ending mode.", 41, "c:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 80 }, +{ PROC_LINKS(set_eol_mode_to_lf, 0), false, "set_eol_mode_to_lf", 18, "Puts the buffer in lf line ending mode.", 39, "c:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 91 }, +{ PROC_LINKS(set_eol_mode_to_binary, 0), false, "set_eol_mode_to_binary", 22, "Puts the buffer in bin line ending mode.", 40, "c:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 102 }, +{ PROC_LINKS(set_eol_mode_from_contents, 0), false, "set_eol_mode_from_contents", 26, "Sets the buffer's line ending mode to match the contents of the buffer.", 71, "c:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 113 }, +{ PROC_LINKS(interactive_switch_buffer, 0), true, "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 477 }, +{ PROC_LINKS(interactive_kill_buffer, 0), true, "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 496 }, +{ PROC_LINKS(interactive_open_or_new, 0), true, "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 567 }, +{ PROC_LINKS(interactive_new, 0), true, "interactive_new", 15, "Interactively creates a new file.", 33, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 606 }, +{ PROC_LINKS(interactive_open, 0), true, "interactive_open", 16, "Interactively opens a file.", 27, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 639 }, +{ PROC_LINKS(command_lister, 0), true, "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 702 }, +{ PROC_LINKS(auto_indent_whole_file, 0), false, "auto_indent_whole_file", 22, "Audo-indents the entire current buffer.", 39, "c:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 356 }, +{ PROC_LINKS(auto_indent_line_at_cursor, 0), false, "auto_indent_line_at_cursor", 26, "Auto-indents the line on which the cursor sits.", 47, "c:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 365 }, +{ PROC_LINKS(auto_indent_range, 0), false, "auto_indent_range", 17, "Auto-indents the range between the cursor and the mark.", 55, "c:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 375 }, +{ PROC_LINKS(write_text_and_auto_indent, 0), false, "write_text_and_auto_indent", 26, "Inserts text and auto-indents the line on which the cursor sits if any of the text contains 'layout punctuation' such as ;:{}()[]# and new lines.", 145, "c:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 385 }, +{ PROC_LINKS(list_all_locations, 0), false, "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 166 }, +{ PROC_LINKS(list_all_substring_locations, 0), false, "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 172 }, +{ PROC_LINKS(list_all_locations_case_insensitive, 0), false, "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 178 }, +{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), false, "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 184 }, +{ PROC_LINKS(list_all_locations_of_identifier, 0), false, "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 190 }, +{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), false, "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 196 }, +{ PROC_LINKS(list_all_locations_of_selection, 0), false, "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 202 }, +{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), false, "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 208 }, +{ PROC_LINKS(list_all_locations_of_type_definition, 0), false, "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 214 }, +{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), false, "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 222 }, +{ PROC_LINKS(word_complete, 0), false, "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 391 }, +{ PROC_LINKS(goto_jump_at_cursor, 0), false, "goto_jump_at_cursor", 19, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 346 }, +{ PROC_LINKS(goto_jump_at_cursor_same_panel, 0), false, "goto_jump_at_cursor_same_panel", 30, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list.", 167, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 373 }, +{ PROC_LINKS(goto_next_jump, 0), false, "goto_next_jump", 14, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 462 }, +{ PROC_LINKS(goto_prev_jump, 0), false, "goto_prev_jump", 14, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 479 }, +{ PROC_LINKS(goto_next_jump_no_skips, 0), false, "goto_next_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 492 }, +{ PROC_LINKS(goto_prev_jump_no_skips, 0), false, "goto_prev_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 509 }, +{ PROC_LINKS(goto_first_jump, 0), false, "goto_first_jump", 15, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 523 }, +{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), false, "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 540 }, +{ PROC_LINKS(if_read_only_goto_position, 0), false, "if_read_only_goto_position", 26, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 562 }, +{ PROC_LINKS(if_read_only_goto_position_same_panel, 0), false, "if_read_only_goto_position_same_panel", 37, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 579 }, +{ PROC_LINKS(view_jump_list_with_lister, 0), false, "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "c:\\4ed\\code\\custom\\4coder_jump_lister.cpp", 41, 104 }, +{ PROC_LINKS(show_the_log_graph, 0), true, "show_the_log_graph", 18, "Parses *log* and displays the 'log graph' UI", 44, "c:\\4ed\\code\\custom\\4coder_log_parser.cpp", 40, 990 }, +{ PROC_LINKS(copy, 0), false, "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "c:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 19 }, +{ PROC_LINKS(cut, 0), false, "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "c:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 28 }, +{ PROC_LINKS(paste, 0), false, "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "c:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 39 }, +{ PROC_LINKS(paste_next, 0), false, "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "c:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 73 }, +{ PROC_LINKS(paste_and_indent, 0), false, "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "c:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 115 }, +{ PROC_LINKS(paste_next_and_indent, 0), false, "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "c:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 122 }, +{ PROC_LINKS(execute_previous_cli, 0), false, "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "c:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 7 }, +{ PROC_LINKS(execute_any_cli, 0), false, "execute_any_cli", 15, "Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.", 133, "c:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 22 }, +{ PROC_LINKS(build_search, 0), false, "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "c:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 128 }, +{ PROC_LINKS(build_in_build_panel, 0), false, "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "c:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 163 }, +{ PROC_LINKS(close_build_panel, 0), false, "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "c:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 178 }, +{ PROC_LINKS(change_to_build_panel, 0), false, "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "c:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 184 }, +{ PROC_LINKS(close_all_code, 0), false, "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 917 }, +{ PROC_LINKS(open_all_code, 0), false, "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 923 }, +{ PROC_LINKS(open_all_code_recursive, 0), false, "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 929 }, +{ PROC_LINKS(load_project, 0), false, "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, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 937 }, +{ PROC_LINKS(project_fkey_command, 0), false, "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 944 }, +{ PROC_LINKS(project_go_to_root_directory, 0), false, "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 969 }, +{ PROC_LINKS(setup_new_project, 0), false, "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1303 }, +{ PROC_LINKS(setup_build_bat, 0), false, "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1310 }, +{ PROC_LINKS(setup_build_sh, 0), false, "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1316 }, +{ PROC_LINKS(setup_build_bat_and_sh, 0), false, "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1322 }, +{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1338 }, +{ PROC_LINKS(list_all_functions_current_buffer, 0), false, "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "c:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 267 }, +{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), false, "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "c:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 277 }, +{ PROC_LINKS(list_all_functions_all_buffers, 0), false, "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "c:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 289 }, +{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), false, "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "c:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 295 }, +{ PROC_LINKS(select_surrounding_scope, 0), false, "select_surrounding_scope", 24, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 7 }, +{ PROC_LINKS(select_next_scope_absolute, 0), false, "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 32 }, +{ PROC_LINKS(select_next_scope_after_current, 0), false, "select_next_scope_after_current", 31, "Finds the first scope started by '{' after the mark and puts the cursor and mark on the '{' and '}'. This command is meant to be used after a scope is already selected so that it will have the effect of selecting the next scope after the current scope.", 253, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 41 }, +{ PROC_LINKS(select_prev_scope_absolute, 0), false, "select_prev_scope_absolute", 26, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 50 }, +{ PROC_LINKS(place_in_scope, 0), false, "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 67 }, +{ PROC_LINKS(delete_current_scope, 0), false, "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 73 }, +{ PROC_LINKS(open_long_braces, 0), false, "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 46 }, +{ PROC_LINKS(open_long_braces_semicolon, 0), false, "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 54 }, +{ PROC_LINKS(open_long_braces_break, 0), false, "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 62 }, +{ PROC_LINKS(if0_off, 0), false, "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 70 }, +{ PROC_LINKS(write_todo, 0), false, "write_todo", 10, "At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder.", 99, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 76 }, +{ PROC_LINKS(write_hack, 0), false, "write_hack", 10, "At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.", 99, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 82 }, +{ PROC_LINKS(write_note, 0), false, "write_note", 10, "At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.", 99, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 88 }, +{ PROC_LINKS(write_block, 0), false, "write_block", 11, "At the cursor, insert a block comment.", 38, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 94 }, +{ PROC_LINKS(write_zero_struct, 0), false, "write_zero_struct", 17, "At the cursor, insert a ' = {};'.", 33, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 100 }, +{ PROC_LINKS(comment_line, 0), false, "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 125 }, +{ PROC_LINKS(uncomment_line, 0), false, "uncomment_line", 14, "If present, delete '//' at the beginning of the line after leading whitespace.", 78, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 137 }, +{ PROC_LINKS(comment_line_toggle, 0), false, "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 149 }, +{ PROC_LINKS(snippet_lister, 0), false, "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 231 }, +{ PROC_LINKS(miblo_increment_basic, 0), false, "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "c:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 29 }, +{ PROC_LINKS(miblo_decrement_basic, 0), false, "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "c:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 44 }, +{ PROC_LINKS(miblo_increment_time_stamp, 0), false, "miblo_increment_time_stamp", 26, "Increment a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "c:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 231 }, +{ PROC_LINKS(miblo_decrement_time_stamp, 0), false, "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "c:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 237 }, +{ PROC_LINKS(miblo_increment_time_stamp_minute, 0), false, "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, "c:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 243 }, +{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), false, "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, "c:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 249 }, +{ PROC_LINKS(profile_inspect, 0), true, "profile_inspect", 15, "Inspect all currently collected profiling information in 4coder's self profiler.", 80, "c:\\4ed\\code\\custom\\4coder_profile_inspect.cpp", 45, 377 }, +{ PROC_LINKS(default_startup, 0), false, "default_startup", 15, "Default command for responding to a startup event", 49, "c:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 7 }, +{ PROC_LINKS(default_try_exit, 0), false, "default_try_exit", 16, "Default command for responding to a try-exit event", 50, "c:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 21 }, }; static i32 fcoder_metacmd_ID_default_view_input_handler = 0; static i32 fcoder_metacmd_ID_profile_enable = 1; From a5a07c16f88563b8762d1bd5b0b0b358fadfc9ec Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Sun, 20 Oct 2019 19:02:58 -0700 Subject: [PATCH 2/8] Setup for the async --- 4ed.cpp | 30 - 4ed_api_implementation.cpp | 3 + 4ed_coroutine.cpp | 3 +- 4ed_system_api.cpp | 10 + custom/4coder_async_tasks.cpp | 53 + custom/4coder_async_tasks.h | 17 + custom/4coder_base_types.cpp | 3 +- custom/4coder_base_types.h | 8 + custom/4coder_config.cpp | 3172 +++++++++-------- custom/4coder_default_bindings.cpp | 1 + custom/4coder_default_framework.cpp | 1 + custom/4coder_default_framework_variables.cpp | 1 + custom/4coder_default_hooks.cpp | 31 +- custom/4coder_default_include.cpp | 2 + custom/4coder_profile_inspect.cpp | 2 - custom/4coder_types.h | 9 +- custom/generated/command_metadata.h | 422 +-- custom/generated/system_api.cpp | 4 + custom/generated/system_api.h | 10 + custom/generated/system_api_master_list.h | 2 + platform_win32/win32_4ed.cpp | 25 +- ship_files/release-config.4coder | 5 +- 22 files changed, 1979 insertions(+), 1835 deletions(-) create mode 100644 custom/4coder_async_tasks.cpp create mode 100644 custom/4coder_async_tasks.h diff --git a/4ed.cpp b/4ed.cpp index 650cc138..d52c7a56 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -775,36 +775,6 @@ App_Step_Sig(app_step){ } } -#if 0 - // NOTE(allen): apply pending smooth deltas - { - Delta_Rule_Function *delta_rule = models->delta_rule; - for (Panel *panel = layout_get_first_open_panel(layout); - panel != 0; - panel = layout_get_next_open_panel(layout, panel)){ - View *view = panel->view; - - View_ID view_id = view_get_id(&models->live_set, view); - b32 new_target = (b32)view->new_scroll_target; - - File_Edit_Positions edit_pos = view_get_edit_pos(view); - Vec2_f32 pending = view_buffer_point_difference(models, view, - edit_pos.scroll.target, edit_pos.scroll.position); - if (!near_zero(pending, 0.5f)){ - Vec2_f32 partial = scroll_rule(pending, view_id, new_target, animation_dt); - edit_pos.scroll.position = view_move_buffer_point(models, view, - edit_pos.scroll.position, partial); - view_set_edit_pos(view, edit_pos); - models->animate_next_frame = true; - } - else{ - edit_pos.scroll.position = edit_pos.scroll.target; - view_set_edit_pos(view, edit_pos); - } - } - } -#endif - // NOTE(allen): hook for files reloaded { Working_Set *working_set = &models->working_set; diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index 8a40d859..f82a0a7e 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -78,6 +78,9 @@ get_thread_context(Application_Links *app){ Models *models = (Models*)app->cmd_context; tctx = models->tctx; } + else if (app->current_thread != 0){ + tctx = (Thread_Context*)app->current_thread; + } else{ Coroutine *coroutine = (Coroutine*)app->current_coroutine; tctx = coroutine->tctx; diff --git a/4ed_coroutine.cpp b/4ed_coroutine.cpp index 105f5ccb..d14823a5 100644 --- a/4ed_coroutine.cpp +++ b/4ed_coroutine.cpp @@ -31,7 +31,8 @@ coroutine_main(void *ptr){ Coroutine *me = (Coroutine*)ptr; Thread_Context tctx_ = {}; - thread_ctx_init(&tctx_, get_base_allocator_system(), get_base_allocator_system()); + thread_ctx_init(&tctx_, ThreadKind_MainCoroutine, + get_base_allocator_system(), get_base_allocator_system()); me->tctx = &tctx_; // NOTE(allen): Init handshake diff --git a/4ed_system_api.cpp b/4ed_system_api.cpp index 8674c435..ce70b9f5 100644 --- a/4ed_system_api.cpp +++ b/4ed_system_api.cpp @@ -177,6 +177,16 @@ define_api(Arena *arena){ API_Call *call = api_call(arena, api, "thread_get_id", "i32"); } + { + API_Call *call = api_call(arena, api, "acquire_global_frame_mutex", "void"); + api_param(arena, call, "Thread_Context*", "tctx"); + } + + { + API_Call *call = api_call(arena, api, "release_global_frame_mutex", "void"); + api_param(arena, call, "Thread_Context*", "tctx"); + } + { API_Call *call = api_call(arena, api, "mutex_make", "System_Mutex"); } diff --git a/custom/4coder_async_tasks.cpp b/custom/4coder_async_tasks.cpp new file mode 100644 index 00000000..9ae53ece --- /dev/null +++ b/custom/4coder_async_tasks.cpp @@ -0,0 +1,53 @@ +/* + * 4coder_async_tasks.cpp - Implementation of the custom layer asynchronous task system. + */ + +// TOP + +Application_Links *dummy_async_app = 0; + +function void +async_task_handler_init(Application_Links *app){ + //NotImplemented; + dummy_async_app = app; +} + +function Async_Task +async_task_no_dep(Async_Task_Function_Type *func, Data data){ + //NotImplemented; + func(dummy_async_app, data); + return(0); +} + +function Async_Task +async_task_single_dep(Async_Task_Function_Type *func, Data data, Async_Task dependency){ + NotImplemented; +} + +function b32 +async_task_is_pending(Async_Task task){ + NotImplemented; +} + +function b32 +async_task_is_running(Async_Task task){ + NotImplemented; +} + +function b32 +async_task_is_running_or_pending(Async_Task task){ + NotImplemented; +} + +function void +async_task_cancel(Async_Task task){ + NotImplemented; +} + +function void +async_task_join(Async_Task task){ + NotImplemented; +} + +// BOTTOM + diff --git a/custom/4coder_async_tasks.h b/custom/4coder_async_tasks.h new file mode 100644 index 00000000..8dae24f8 --- /dev/null +++ b/custom/4coder_async_tasks.h @@ -0,0 +1,17 @@ +/* + * 4coder_async_tasks.cpp - Types for the custom layer asynchronous task system. + */ + +// TOP + +#if !defined(FCODER_ASYNC_TASKS_H) +#define FCODER_ASYNC_TASKS_H + +typedef void Async_Task_Function_Type(Application_Links *app, Data data); + +typedef u64 Async_Task; + +#endif + +// BOTTOM + diff --git a/custom/4coder_base_types.cpp b/custom/4coder_base_types.cpp index 989e7f3b..b320c7c5 100644 --- a/custom/4coder_base_types.cpp +++ b/custom/4coder_base_types.cpp @@ -2834,9 +2834,10 @@ end_temp(Temp_Memory temp){ //////////////////////////////// internal void -thread_ctx_init(Thread_Context *tctx, Base_Allocator *allocator, +thread_ctx_init(Thread_Context *tctx, Thread_Kind kind, Base_Allocator *allocator, Base_Allocator *prof_allocator){ block_zero_struct(tctx); + tctx->kind = kind; tctx->allocator = allocator; tctx->node_arena = make_arena(allocator, KB(4), 8); diff --git a/custom/4coder_base_types.h b/custom/4coder_base_types.h index efeb62b2..6b3ae3af 100644 --- a/custom/4coder_base_types.h +++ b/custom/4coder_base_types.h @@ -1168,7 +1168,15 @@ struct Profile_Global_List{ //////////////////////////////// +typedef i32 Thread_Kind; +enum{ + ThreadKind_Main, + ThreadKind_MainCoroutine, + ThreadKind_AsyncTasks, +}; + struct Thread_Context{ + Thread_Kind kind; Base_Allocator *allocator; Arena node_arena; Arena_Node *free_arenas; diff --git a/custom/4coder_config.cpp b/custom/4coder_config.cpp index 5efb988b..c3cb6c99 100644 --- a/custom/4coder_config.cpp +++ b/custom/4coder_config.cpp @@ -1,1578 +1,1594 @@ -/* -4coder_config.cpp - Parsing *.4coder files. -*/ - -// TOP - -function String_Const_u8_Array -parse_extension_line_to_extension_list(Arena *arena, String_Const_u8 str){ - i32 count = 0; - for (umem i = 0; i < str.size; i += 1){ - if (str.str[i] == '.'){ - count += 1; - } - } - - String_Const_u8_Array array = {}; - array.count = count; - array.strings = push_array(arena, String_Const_u8, count); - - push_align(arena, 1); - str = string_skip(str, string_find_first(str, '.') + 1); - for (i32 i = 0; i < count; i += 1){ - umem next_period = string_find_first(str, '.'); - String_Const_u8 extension = string_prefix(str, next_period); - str = string_skip(str, next_period + 1); - array.strings[i] = push_string_copy(arena, extension); - } - push_align(arena, 8); - - return(array); -} - -//////////////////////////////// - -function Error_Location -get_error_location(u8 *base, u8 *pos){ - Error_Location location = {}; - location.line_number = 1; - location.column_number = 1; - for (u8 *ptr = base; - ptr < pos; - ptr += 1){ - if (*ptr == '\n'){ - location.line_number += 1; - location.column_number = 1; - } - else{ - location.column_number += 1; - } - } - return(location); -} - -function String_Const_u8 -config_stringize_errors(Arena *arena, Config *parsed){ - String_Const_u8 result = {}; - if (parsed->errors.first != 0){ - List_String_Const_u8 list = {}; - for (Config_Error *error = parsed->errors.first; - error != 0; - error = error->next){ - Error_Location location = get_error_location(parsed->data.str, error->pos); - string_list_pushf(arena, &list, "%.*s:%d:%d: %.*s\n", - string_expand(error->file_name), location.line_number, location.column_number, string_expand(error->text)); - } - result = string_list_flatten(arena, list); - } - return(result); -} - -//////////////////////////////// - -function void -config_parser__advance_to_next(Config_Parser *ctx){ - Token *t = ctx->token; - Token *e = ctx->end; - for (t += 1; - t < e && (t->kind == TokenBaseKind_Comment || - t->kind == TokenBaseKind_Whitespace); - t += 1); - ctx->token = t; -} - -function Config_Parser -make_config_parser(Arena *arena, String_Const_u8 file_name, String_Const_u8 data, Token_Array array){ - Config_Parser ctx = {}; - ctx.start = array.tokens; - ctx.token = ctx.start - 1; - ctx.end = ctx.start + array.count; - ctx.file_name = file_name; - ctx.data = data; - ctx.arena = arena; - config_parser__advance_to_next(&ctx); - return(ctx); -} - -function b32 -config_parser__recognize_base_token(Config_Parser *ctx, Token_Base_Kind kind){ - b32 result = false; - if (ctx->start <= ctx->token && ctx->token < ctx->end){ - result = (ctx->token->kind == kind); - } - else if (kind == TokenBaseKind_EOF){ - result = true; - } - return(result); -} - -function b32 -config_parser__recognize_token(Config_Parser *ctx, Token_Cpp_Kind kind){ - b32 result = false; - if (ctx->start <= ctx->token && ctx->token < ctx->end){ - result = (ctx->token->sub_kind == kind); - } - else if (kind == TokenCppKind_EOF){ - result = true; - } - return(result); -} - -function b32 -config_parser__recognize_boolean(Config_Parser *ctx){ - b32 result = false; - Token *token = ctx->token; - if (ctx->start <= ctx->token && ctx->token < ctx->end){ - result = (token->sub_kind == TokenCppKind_LiteralTrue || - token->sub_kind == TokenCppKind_LiteralFalse); - } - return(result); -} - -function String_Const_u8 -config_parser__get_lexeme(Config_Parser *ctx){ - String_Const_u8 lexeme = {}; - Token *token = ctx->token; - if (ctx->start <= token && token < ctx->end){ - lexeme = SCu8(ctx->data.str + token->pos, token->size); - } - return(lexeme); -} - -function Config_Integer -config_parser__get_int(Config_Parser *ctx){ - Config_Integer config_integer = {}; - String_Const_u8 str = config_parser__get_lexeme(ctx); - if (string_match(string_prefix(str, 2), string_u8_litexpr("0x"))){ - config_integer.is_signed = false; - config_integer.uinteger = (u32)(string_to_integer(string_skip(str, 2), 16)); - } - else{ - b32 is_negative = (string_get_character(str, 0) == '-'); - if (is_negative){ - str = string_skip(str, 1); - } - config_integer.is_signed = true; - config_integer.integer = (i32)(string_to_integer(str, 10)); - if (is_negative){ - config_integer.integer *= -1; - } - } - return(config_integer); -} - -function b32 -config_parser__get_boolean(Config_Parser *ctx){ - String_Const_u8 str = config_parser__get_lexeme(ctx); - return(string_match(str, string_u8_litexpr("true"))); -} - -function b32 -config_parser__recognize_text(Config_Parser *ctx, String_Const_u8 text){ - String_Const_u8 lexeme = config_parser__get_lexeme(ctx); - return(lexeme.str != 0 && string_match(lexeme, text)); -} - -function b32 -config_parser__match_token(Config_Parser *ctx, Token_Cpp_Kind kind){ - b32 result = config_parser__recognize_token(ctx, kind); - if (result){ - config_parser__advance_to_next(ctx); - } - return(result); -} - -function b32 -config_parser__match_text(Config_Parser *ctx, String_Const_u8 text){ - b32 result = config_parser__recognize_text(ctx, text); - if (result){ - config_parser__advance_to_next(ctx); - } - return(result); -} - -#define config_parser__match_text_lit(c,s) config_parser__match_text((c), string_u8_litexpr(s)) - -function Config *config_parser__config (Config_Parser *ctx); -function i32 *config_parser__version (Config_Parser *ctx); -function Config_Assignment *config_parser__assignment(Config_Parser *ctx); -function Config_LValue *config_parser__lvalue (Config_Parser *ctx); -function Config_RValue *config_parser__rvalue (Config_Parser *ctx); -function Config_Compound *config_parser__compound (Config_Parser *ctx); -function Config_Compound_Element *config_parser__element (Config_Parser *ctx); - -function Config* -text_data_and_token_array_to_parse_data(Arena *arena, String_Const_u8 file_name, String_Const_u8 data, Token_Array array){ - Temp_Memory restore_point = begin_temp(arena); - Config_Parser ctx = make_config_parser(arena, file_name, data, array); - Config *config = config_parser__config(&ctx); - if (config == 0){ - end_temp(restore_point); - } - return(config); -} - -// TODO(allen): Move to string library -function Config_Error* -config_error_push(Arena *arena, Config_Error_List *list, String_Const_u8 file_name, u8 *pos, char *error_text){ - Config_Error *error = push_array(arena, Config_Error, 1); - zdll_push_back(list->first, list->last, error); - list->count += 1; - error->file_name = file_name; - error->pos = pos; - error->text = push_string_copy(arena, SCu8(error_text)); - return(error); -} - -function u8* -config_parser__get_pos(Config_Parser *ctx){ - return(ctx->data.str + ctx->token->pos); -} - -function void -config_parser__log_error_pos(Config_Parser *ctx, u8 *pos, char *error_text){ - config_error_push(ctx->arena, &ctx->errors, ctx->file_name, pos, error_text); -} - -function void -config_parser__log_error(Config_Parser *ctx, char *error_text){ - config_parser__log_error_pos(ctx, config_parser__get_pos(ctx), error_text); -} - -function Config* -config_parser__config(Config_Parser *ctx){ - i32 *version = config_parser__version(ctx); - - Config_Assignment *first = 0; - Config_Assignment *last = 0; - i32 count = 0; - for (;!config_parser__recognize_token(ctx, TokenCppKind_EOF);){ - Config_Assignment *assignment = config_parser__assignment(ctx); - if (assignment != 0){ - zdll_push_back(first, last, assignment); - count += 1; - } - } - - Config *config = push_array(ctx->arena, Config, 1); - block_zero_struct(config); - config->version = version; - config->first = first; - config->last = last; - config->count = count; - config->errors = ctx->errors; - config->file_name = ctx->file_name; - config->data = ctx->data; - return(config); -} - -function void -config_parser__recover_parse(Config_Parser *ctx){ - for (;;){ - if (config_parser__match_token(ctx, TokenCppKind_Semicolon)){ - break; - } - if (config_parser__recognize_token(ctx, TokenCppKind_EOF)){ - break; - } - config_parser__advance_to_next(ctx); - } -} - -function i32* -config_parser__version(Config_Parser *ctx){ - require(config_parser__match_text_lit(ctx, "version")); - - if (!config_parser__match_token(ctx, TokenCppKind_ParenOp)){ - config_parser__log_error(ctx, "expected token '(' for version specifier: 'version(#)'"); - config_parser__recover_parse(ctx); - return(0); - } - - if (!config_parser__recognize_base_token(ctx, TokenBaseKind_LiteralInteger)){ - config_parser__log_error(ctx, "expected an integer constant for version specifier: 'version(#)'"); - config_parser__recover_parse(ctx); - return(0); - } - - Config_Integer value = config_parser__get_int(ctx); - config_parser__advance_to_next(ctx); - - if (!config_parser__match_token(ctx, TokenCppKind_ParenCl)){ - config_parser__log_error(ctx, "expected token ')' for version specifier: 'version(#)'"); - config_parser__recover_parse(ctx); - return(0); - } - - if (!config_parser__match_token(ctx, TokenCppKind_Semicolon)){ - config_parser__log_error(ctx, "expected token ';' for version specifier: 'version(#)'"); - config_parser__recover_parse(ctx); - return(0); - } - - i32 *ptr = push_array(ctx->arena, i32, 1); - *ptr = value.integer; - return(ptr); -} - -function Config_Assignment* -config_parser__assignment(Config_Parser *ctx){ - u8 *pos = config_parser__get_pos(ctx); - - Config_LValue *l = config_parser__lvalue(ctx); - if (l == 0){ - config_parser__log_error(ctx, "expected an l-value; l-value formats: 'identifier', 'identifier[#]'"); - config_parser__recover_parse(ctx); - return(0); - } - - if (!config_parser__match_token(ctx, TokenCppKind_Eq)){ - config_parser__log_error(ctx, "expected token '=' for assignment: 'l-value = r-value;'"); - config_parser__recover_parse(ctx); - return(0); - } - - Config_RValue *r = config_parser__rvalue(ctx); - if (r == 0){ - config_parser__log_error(ctx, "expected an r-value; r-value formats:\n" - "\tconstants (true, false, integers, hexadecimal integers, strings, characters)\n" - "\tany l-value that is set in the file\n" - "\tcompound: '{ compound-element, compound-element, compound-element ...}'\n" - "\ta compound-element is an r-value, and can have a layout specifier\n" - "\tcompound-element with layout specifier: .name = r-value, .integer = r-value"); - config_parser__recover_parse(ctx); - return(0); - } - - if (!config_parser__match_token(ctx, TokenCppKind_Semicolon)){ - config_parser__log_error(ctx, "expected token ';' for assignment: 'l-value = r-value;'"); - config_parser__recover_parse(ctx); - return(0); - } - - Config_Assignment *assignment = push_array_zero(ctx->arena, Config_Assignment, 1); - assignment->pos = pos; - assignment->l = l; - assignment->r = r; - return(assignment); -} - -function Config_LValue* -config_parser__lvalue(Config_Parser *ctx){ - require(config_parser__recognize_token(ctx, TokenCppKind_Identifier)); - String_Const_u8 identifier = config_parser__get_lexeme(ctx); - config_parser__advance_to_next(ctx); - - i32 index = 0; - if (config_parser__match_token(ctx, TokenCppKind_BrackOp)){ - require(config_parser__recognize_base_token(ctx, TokenBaseKind_LiteralInteger)); - Config_Integer value = config_parser__get_int(ctx); - index = value.integer; - config_parser__advance_to_next(ctx); - require(config_parser__match_token(ctx, TokenCppKind_BrackCl)); - } - - Config_LValue *lvalue = push_array_zero(ctx->arena, Config_LValue, 1); - lvalue->identifier = identifier; - lvalue->index = index; - return(lvalue); -} - -function Config_RValue* -config_parser__rvalue(Config_Parser *ctx){ - Config_RValue *rvalue = 0; - if (config_parser__recognize_token(ctx, TokenCppKind_Identifier)){ - Config_LValue *l = config_parser__lvalue(ctx); - require(l != 0); - rvalue = push_array_zero(ctx->arena, Config_RValue, 1); - rvalue->type = ConfigRValueType_LValue; - rvalue->lvalue = l; - } - else if (config_parser__recognize_token(ctx, TokenCppKind_BraceOp)){ - config_parser__advance_to_next(ctx); - Config_Compound *compound = config_parser__compound(ctx); - require(compound != 0); - rvalue = push_array_zero(ctx->arena, Config_RValue, 1); - rvalue->type = ConfigRValueType_Compound; - rvalue->compound = compound; - } - else if (config_parser__recognize_boolean(ctx)){ - b32 b = config_parser__get_boolean(ctx); - config_parser__advance_to_next(ctx); - rvalue = push_array_zero(ctx->arena, Config_RValue, 1); - rvalue->type = ConfigRValueType_Boolean; - rvalue->boolean = b; - } - else if (config_parser__recognize_base_token(ctx, TokenBaseKind_LiteralInteger)){ - Config_Integer value = config_parser__get_int(ctx); - config_parser__advance_to_next(ctx); - rvalue = push_array_zero(ctx->arena, Config_RValue, 1); - rvalue->type = ConfigRValueType_Integer; - if (value.is_signed){ - rvalue->integer = value.integer; - } - else{ - rvalue->uinteger = value.uinteger; - } - } - else if (config_parser__recognize_token(ctx, TokenCppKind_LiteralString)){ - String_Const_u8 s = config_parser__get_lexeme(ctx); - config_parser__advance_to_next(ctx); - s = string_chop(string_skip(s, 1), 1); - String_Const_u8 interpreted = string_interpret_escapes(ctx->arena, s); - rvalue = push_array_zero(ctx->arena, Config_RValue, 1); - rvalue->type = ConfigRValueType_String; - rvalue->string = interpreted; - } - else if (config_parser__recognize_token(ctx, TokenCppKind_LiteralCharacter)){ - String_Const_u8 s = config_parser__get_lexeme(ctx); - config_parser__advance_to_next(ctx); - s = string_chop(string_skip(s, 1), 1); - String_Const_u8 interpreted = string_interpret_escapes(ctx->arena, s); - rvalue = push_array_zero(ctx->arena, Config_RValue, 1); - rvalue->type = ConfigRValueType_Character; - rvalue->character = string_get_character(interpreted, 0); - } - return(rvalue); -} - -function void -config_parser__compound__check(Config_Parser *ctx, Config_Compound *compound){ - b32 implicit_index_allowed = true; - for (Config_Compound_Element *node = compound->first; - node != 0; - node = node->next){ - if (node->l.type != ConfigLayoutType_Unset){ - implicit_index_allowed = false; - } - else if (!implicit_index_allowed){ - config_parser__log_error_pos(ctx, node->l.pos, - "encountered unlabeled member after one or more labeled members"); - } - } -} - -function Config_Compound* -config_parser__compound(Config_Parser *ctx){ - Config_Compound_Element *first = 0; - Config_Compound_Element *last = 0; - i32 count = 0; - - Config_Compound_Element *element = config_parser__element(ctx); - require(element != 0); - zdll_push_back(first, last, element); - count += 1; - - for (;config_parser__match_token(ctx, TokenCppKind_Comma);){ - if (config_parser__recognize_token(ctx, TokenCppKind_BraceCl)){ - break; - } - element = config_parser__element(ctx); - require(element != 0); - zdll_push_back(first, last, element); - count += 1; - } - - require(config_parser__match_token(ctx, TokenCppKind_BraceCl)); - - Config_Compound *compound = push_array(ctx->arena, Config_Compound, 1); - block_zero_struct(compound); - compound->first = first; - compound->last = last; - compound->count = count; - config_parser__compound__check(ctx, compound); - return(compound); -} - -function Config_Compound_Element* -config_parser__element(Config_Parser *ctx){ - Config_Layout layout = {}; - layout.pos = config_parser__get_pos(ctx); - if (config_parser__match_token(ctx, TokenCppKind_Dot)){ - if (config_parser__recognize_token(ctx, TokenCppKind_Identifier)){ - layout.type = ConfigLayoutType_Identifier; - layout.identifier = config_parser__get_lexeme(ctx); - config_parser__advance_to_next(ctx); - } - else if (config_parser__recognize_base_token(ctx, TokenBaseKind_LiteralInteger)){ - layout.type = ConfigLayoutType_Integer; - Config_Integer value = config_parser__get_int(ctx); - layout.integer = value.integer; - config_parser__advance_to_next(ctx); - } - else{ - return(0); - } - require(config_parser__match_token(ctx, TokenCppKind_Eq)); - } - Config_RValue *rvalue = config_parser__rvalue(ctx); - require(rvalue != 0); - Config_Compound_Element *element = push_array(ctx->arena, Config_Compound_Element, 1); - block_zero_struct(element); - element->l = layout; - element->r = rvalue; - return(element); -} - -//////////////////////////////// - -function Config_Error* -config_add_error(Arena *arena, Config *config, u8 *pos, char *error_text){ - return(config_error_push(arena, &config->errors, config->file_name, pos, error_text)); -} - -//////////////////////////////// - -function Config_Assignment* -config_lookup_assignment(Config *config, String_Const_u8 var_name, i32 subscript){ - Config_Assignment *assignment = 0; - for (assignment = config->first; - assignment != 0; - assignment = assignment->next){ - Config_LValue *l = assignment->l; - if (l != 0 && string_match(l->identifier, var_name) && l->index == subscript){ - break; - } - } - return(assignment); -} - -function Config_Get_Result -config_var(Config *config, String_Const_u8 var_name, i32 subscript); - -function Config_Get_Result -config_evaluate_rvalue(Config *config, Config_Assignment *assignment, Config_RValue *r){ - Config_Get_Result result = {}; - if (r != 0 && !assignment->visited){ - if (r->type == ConfigRValueType_LValue){ - assignment->visited = true; - Config_LValue *l = r->lvalue; - result = config_var(config, l->identifier, l->index); - assignment->visited = false; - } - else{ - result.success = true; - result.pos = assignment->pos; - result.type = r->type; - switch (r->type){ - case ConfigRValueType_Boolean: - { - result.boolean = r->boolean; - }break; - - case ConfigRValueType_Integer: - { - result.integer = r->integer; - }break; - - case ConfigRValueType_String: - { - result.string = r->string; - }break; - - case ConfigRValueType_Character: - { - result.character = r->character; - }break; - - case ConfigRValueType_Compound: - { - result.compound = r->compound; - }break; - } - } - } - return(result); -} - -function Config_Get_Result -config_var(Config *config, String_Const_u8 var_name, i32 subscript){ - Config_Get_Result result = {}; - Config_Assignment *assignment = config_lookup_assignment(config, var_name, subscript); - if (assignment != 0){ - result = config_evaluate_rvalue(config, assignment, assignment->r); - } - return(result); -} - -function Config_Get_Result -config_compound_member(Config *config, Config_Compound *compound, String_Const_u8 var_name, i32 index){ - Config_Get_Result result = {}; - i32 implicit_index = 0; - b32 implicit_index_is_valid = true; - for (Config_Compound_Element *element = compound->first; - element != 0; - element = element->next, implicit_index += 1){ - b32 element_matches_query = false; - switch (element->l.type){ - case ConfigLayoutType_Unset: - { - if (implicit_index_is_valid && index == implicit_index){ - element_matches_query = true; - } - }break; - - case ConfigLayoutType_Identifier: - { - implicit_index_is_valid = false; - if (string_match(element->l.identifier, var_name)){ - element_matches_query = true; - } - }break; - - case ConfigLayoutType_Integer: - { - implicit_index_is_valid = false; - if (element->l.integer == index){ - element_matches_query = true; - } - }break; - } - if (element_matches_query){ - Config_Assignment dummy_assignment = {}; - dummy_assignment.pos = element->l.pos; - result = config_evaluate_rvalue(config, &dummy_assignment, element->r); - break; - } - } - return(result); -} - -function Config_Iteration_Step_Result -typed_array_iteration_step(Config *parsed, Config_Compound *compound, Config_RValue_Type type, i32 index); - -function i32 -typed_array_get_count(Config *parsed, Config_Compound *compound, Config_RValue_Type type); - -function Config_Get_Result_List -typed_array_reference_list(Arena *arena, Config *parsed, Config_Compound *compound, Config_RValue_Type type); - -#define config_fixed_string_var(c,v,s,o,a) config_placed_string_var((c),(v),(s),(o),(a),sizeof(a)) - -//////////////////////////////// - -function b32 -config_has_var(Config *config, String_Const_u8 var_name, i32 subscript){ - Config_Get_Result result = config_var(config, var_name, subscript); - return(result.success && result.type == ConfigRValueType_NoType); -} - -function b32 -config_has_var(Config *config, char *var_name, i32 subscript){ - return(config_has_var(config, SCu8(var_name), subscript)); -} - -function b32 -config_bool_var(Config *config, String_Const_u8 var_name, i32 subscript, b32* var_out){ - Config_Get_Result result = config_var(config, var_name, subscript); - b32 success = (result.success && result.type == ConfigRValueType_Boolean); - if (success){ - *var_out = result.boolean; - } - return(success); -} -function b32 -config_bool_var(Config *config, String_Const_u8 var_name, i32 subscript, b8 *var_out){ - b32 temp = false; - b32 success = config_bool_var(config, var_name, subscript, &temp); - if (success){ - *var_out = (temp != false); - } - return(success); -} -function b32 -config_bool_var(Config *config, char *var_name, i32 subscript, b32* var_out){ - return(config_bool_var(config, SCu8(var_name), subscript, var_out)); -} -function b32 -config_bool_var(Config *config, char* var_name, i32 subscript, b8 *var_out){ - b32 temp = false; - b32 success = config_bool_var(config, SCu8(var_name), subscript, &temp); - if (success){ - *var_out = (temp != false); - } - return(success); -} - -function b32 -config_int_var(Config *config, String_Const_u8 var_name, i32 subscript, i32* var_out){ - Config_Get_Result result = config_var(config, var_name, subscript); - b32 success = result.success && result.type == ConfigRValueType_Integer; - if (success){ - *var_out = result.integer; - } - return(success); -} - -function b32 -config_int_var(Config *config, char *var_name, i32 subscript, i32* var_out){ - return(config_int_var(config, SCu8(var_name), subscript, var_out)); -} - -function b32 -config_uint_var(Config *config, String_Const_u8 var_name, i32 subscript, u32* var_out){ - Config_Get_Result result = config_var(config, var_name, subscript); - b32 success = result.success && result.type == ConfigRValueType_Integer; - if (success){ - *var_out = result.uinteger; - } - return(success); -} - -function b32 -config_uint_var(Config *config, char *var_name, i32 subscript, u32* var_out){ - return(config_uint_var(config, SCu8(var_name), subscript, var_out)); -} - -function b32 -config_string_var(Config *config, String_Const_u8 var_name, i32 subscript, String_Const_u8* var_out){ - Config_Get_Result result = config_var(config, var_name, subscript); - b32 success = result.success && result.type == ConfigRValueType_String; - if (success){ - *var_out = result.string; - } - return(success); -} - -function b32 -config_string_var(Config *config, char *var_name, i32 subscript, String_Const_u8* var_out){ - return(config_string_var(config, SCu8(var_name), subscript, var_out)); -} - -function b32 -config_placed_string_var(Config *config, String_Const_u8 var_name, i32 subscript, String_Const_u8* var_out, u8 *space, umem space_size){ - Config_Get_Result result = config_var(config, var_name, subscript); - b32 success = (result.success && result.type == ConfigRValueType_String); - if (success){ - umem size = result.string.size; - size = clamp_top(size, space_size); - block_copy(space, result.string.str, size); - *var_out = SCu8(space, size); - } - return(success); -} - -function b32 -config_placed_string_var(Config *config, char *var_name, i32 subscript, String_Const_u8* var_out, u8 *space, umem space_size){ - return(config_placed_string_var(config, SCu8(var_name), subscript, var_out, space, space_size)); -} - -function b32 -config_char_var(Config *config, String_Const_u8 var_name, i32 subscript, char* var_out){ - Config_Get_Result result = config_var(config, var_name, subscript); - b32 success = result.success && result.type == ConfigRValueType_Character; - if (success){ - *var_out = result.character; - } - return(success); -} - -function b32 -config_char_var(Config *config, char *var_name, i32 subscript, char* var_out){ - return(config_char_var(config, SCu8(var_name), subscript, var_out)); -} - -function b32 -config_compound_var(Config *config, String_Const_u8 var_name, i32 subscript, Config_Compound** var_out){ - Config_Get_Result result = config_var(config, var_name, subscript); - b32 success = result.success && result.type == ConfigRValueType_Compound; - if (success){ - *var_out = result.compound; - } - return(success); -} - -function b32 -config_compound_var(Config *config, char *var_name, i32 subscript, Config_Compound** var_out){ - return(config_compound_var(config, SCu8(var_name), subscript, var_out)); -} - -function b32 -config_compound_has_member(Config *config, Config_Compound *compound, - String_Const_u8 var_name, i32 index){ - Config_Get_Result result = config_compound_member(config, compound, var_name, index); - b32 success = result.success && result.type == ConfigRValueType_NoType; - return(success); -} - -function b32 -config_compound_has_member(Config *config, Config_Compound *compound, - char *var_name, i32 index){ - return(config_compound_has_member(config, compound, SCu8(var_name), index)); -} - -function b32 -config_compound_bool_member(Config *config, Config_Compound *compound, - String_Const_u8 var_name, i32 index, b32* var_out){ - Config_Get_Result result = config_compound_member(config, compound, var_name, index); - b32 success = result.success && result.type == ConfigRValueType_Boolean; - if (success){ - *var_out = result.boolean; - } - return(success); -} - -function b32 -config_compound_bool_member(Config *config, Config_Compound *compound, - char *var_name, i32 index, b32* var_out){ - return(config_compound_bool_member(config, compound, SCu8(var_name), index, var_out)); -} - -function b32 -config_compound_int_member(Config *config, Config_Compound *compound, - String_Const_u8 var_name, i32 index, i32* var_out){ - Config_Get_Result result = config_compound_member(config, compound, var_name, index); - b32 success = result.success && result.type == ConfigRValueType_Integer; - if (success){ - *var_out = result.integer; - } - return(success); -} - -function b32 -config_compound_int_member(Config *config, Config_Compound *compound, - char *var_name, i32 index, i32* var_out){ - return(config_compound_int_member(config, compound, SCu8(var_name), index, var_out)); -} - -function b32 -config_compound_uint_member(Config *config, Config_Compound *compound, - String_Const_u8 var_name, i32 index, u32* var_out){ - Config_Get_Result result = config_compound_member(config, compound, var_name, index); - b32 success = result.success && result.type == ConfigRValueType_Integer; - if (success){ - *var_out = result.uinteger; - } - return(success); -} - -function b32 -config_compound_uint_member(Config *config, Config_Compound *compound, - char *var_name, i32 index, u32* var_out){ - return(config_compound_uint_member(config, compound, SCu8(var_name), index, var_out)); -} - -function b32 -config_compound_string_member(Config *config, Config_Compound *compound, - String_Const_u8 var_name, i32 index, String_Const_u8* var_out){ - Config_Get_Result result = config_compound_member(config, compound, var_name, index); - b32 success = (result.success && result.type == ConfigRValueType_String); - if (success){ - *var_out = result.string; - } - return(success); -} - -function b32 -config_compound_string_member(Config *config, Config_Compound *compound, - char *var_name, i32 index, String_Const_u8* var_out){ - return(config_compound_string_member(config, compound, SCu8(var_name), index, var_out)); -} - -function b32 -config_compound_placed_string_member(Config *config, Config_Compound *compound, - String_Const_u8 var_name, i32 index, String_Const_u8* var_out, u8 *space, umem space_size){ - Config_Get_Result result = config_compound_member(config, compound, var_name, index); - b32 success = (result.success && result.type == ConfigRValueType_String); - if (success){ - umem size = result.string.size; - size = clamp_top(size, space_size); - block_copy(space, result.string.str, size); - *var_out = SCu8(space, size); - } - return(success); -} - -function b32 -config_compound_placed_string_member(Config *config, Config_Compound *compound, - char *var_name, i32 index, String_Const_u8* var_out, u8 *space, umem space_size){ - return(config_compound_placed_string_member(config, compound, SCu8(var_name), index, var_out, space, space_size)); -} - -function b32 -config_compound_char_member(Config *config, Config_Compound *compound, - String_Const_u8 var_name, i32 index, char* var_out){ - Config_Get_Result result = config_compound_member(config, compound, var_name, index); - b32 success = result.success && result.type == ConfigRValueType_Character; - if (success){ - *var_out = result.character; - } - return(success); -} - -function b32 -config_compound_char_member(Config *config, Config_Compound *compound, - char *var_name, i32 index, char* var_out){ - return(config_compound_char_member(config, compound, SCu8(var_name), index, var_out)); -} - -function b32 -config_compound_compound_member(Config *config, Config_Compound *compound, - String_Const_u8 var_name, i32 index, Config_Compound** var_out){ - Config_Get_Result result = config_compound_member(config, compound, var_name, index); - b32 success = result.success && result.type == ConfigRValueType_Compound; - if (success){ - *var_out = result.compound; - } - return(success); -} - -function b32 -config_compound_compound_member(Config *config, Config_Compound *compound, - char *var_name, i32 index, Config_Compound** var_out){ - return(config_compound_compound_member(config, compound, SCu8(var_name), index, var_out)); -} - -function Iteration_Step_Result -typed_has_array_iteration_step(Config *config, Config_Compound *compound, i32 index){ - Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_NoType, index); - return(result.step); -} - -function Iteration_Step_Result -typed_bool_array_iteration_step(Config *config, Config_Compound *compound, i32 index, b32* var_out){ - Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Boolean, index); - b32 success = (result.step == Iteration_Good); - if (success){ - *var_out = result.get.boolean; - } - return(result.step); -} - -function Iteration_Step_Result -typed_int_array_iteration_step(Config *config, Config_Compound *compound, i32 index, i32* var_out){ - Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Integer, index); - b32 success = (result.step == Iteration_Good); - if (success){ - *var_out = result.get.integer; - } - return(result.step); -} - -function Iteration_Step_Result -typed_uint_array_iteration_step(Config *config, Config_Compound *compound, i32 index, u32* var_out){ - Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Integer, index); - b32 success = (result.step == Iteration_Good); - if (success){ - *var_out = result.get.uinteger; - } - return(result.step); -} - -function Iteration_Step_Result -typed_string_array_iteration_step(Config *config, Config_Compound *compound, i32 index, String_Const_u8* var_out){ - Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_String, index); - b32 success = (result.step == Iteration_Good); - if (success){ - *var_out = result.get.string; - } - return(result.step); -} - -function Iteration_Step_Result -typed_placed_string_array_iteration_step(Config *config, Config_Compound *compound, i32 index, String_Const_u8* var_out, u8 *space, umem space_size){ - Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_String, index); - b32 success = (result.step == Iteration_Good); - if (success){ - umem size = result.get.string.size; - size = clamp_top(size, space_size); - block_copy(space, result.get.string.str, size); - *var_out = SCu8(space, size); - } - return(result.step); -} - -function Iteration_Step_Result -typed_char_array_iteration_step(Config *config, Config_Compound *compound, i32 index, char* var_out){ - Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Character, index); - b32 success = (result.step == Iteration_Good); - if (success){ - *var_out = result.get.character; - } - return(result.step); -} - -function Iteration_Step_Result -typed_compound_array_iteration_step(Config *config, Config_Compound *compound, i32 index, Config_Compound** var_out){ - Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Compound, index); - b32 success = (result.step == Iteration_Good); - if (success){ - *var_out = result.get.compound; - } - return(result.step); -} - -function i32 -typed_bool_array_get_count(Config *config, Config_Compound *compound){ - i32 count = typed_array_get_count(config, compound, ConfigRValueType_Boolean); - return(count); -} - -function i32 -typed_int_array_get_count(Config *config, Config_Compound *compound){ - i32 count = typed_array_get_count(config, compound, ConfigRValueType_Integer); - return(count); -} - -function i32 -typed_float_array_get_count(Config *config, Config_Compound *compound){ - i32 count = typed_array_get_count(config, compound, ConfigRValueType_Float); - return(count); -} - -function i32 -typed_string_array_get_count(Config *config, Config_Compound *compound){ - i32 count = typed_array_get_count(config, compound, ConfigRValueType_String); - return(count); -} - -function i32 -typed_character_array_get_count(Config *config, Config_Compound *compound){ - i32 count = typed_array_get_count(config, compound, ConfigRValueType_Character); - return(count); -} - -function i32 -typed_compound_array_get_count(Config *config, Config_Compound *compound){ - i32 count = typed_array_get_count(config, compound, ConfigRValueType_Compound); - return(count); -} - -function i32 -typed_no_type_array_get_count(Config *config, Config_Compound *compound){ - i32 count = typed_array_get_count(config, compound, ConfigRValueType_NoType); - return(count); -} - -function Config_Get_Result_List -typed_bool_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ - Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Boolean); - return(list); -} - -function Config_Get_Result_List -typed_int_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ - Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Integer); - return(list); -} - -function Config_Get_Result_List -typed_float_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ - Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Float); - return(list); -} - -function Config_Get_Result_List -typed_string_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ - Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_String); - return(list); -} - -function Config_Get_Result_List -typed_character_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ - Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Character); - return(list); -} - -function Config_Get_Result_List -typed_compound_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ - Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Compound); - return(list); -} - -function Config_Get_Result_List -typed_no_type_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ - Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_NoType); - return(list); -} - -//////////////////////////////// - -function Config_Iteration_Step_Result -typed_array_iteration_step(Config *parsed, Config_Compound *compound, Config_RValue_Type type, i32 index){ - Config_Iteration_Step_Result result = {}; - result.step = Iteration_Quit; - Config_Get_Result get_result = config_compound_member(parsed, compound, string_u8_litexpr("~"), index); - if (get_result.success){ - if (get_result.type == type || type == ConfigRValueType_NoType){ - result.step = Iteration_Good; - result.get = get_result; - } - else{ - result.step = Iteration_Skip; - } - } - return(result); -} - -function i32 -typed_array_get_count(Config *parsed, Config_Compound *compound, Config_RValue_Type type){ - i32 count = 0; - for (i32 i = 0;; ++i){ - Config_Iteration_Step_Result result = typed_array_iteration_step(parsed, compound, type, i); - if (result.step == Iteration_Skip){ - continue; - } - else if (result.step == Iteration_Quit){ - break; - } - count += 1; - } - return(count); -} - -function Config_Get_Result_List -typed_array_reference_list(Arena *arena, Config *parsed, Config_Compound *compound, Config_RValue_Type type){ - Config_Get_Result_List list = {}; - for (i32 i = 0;; ++i){ - Config_Iteration_Step_Result result = typed_array_iteration_step(parsed, compound, type, i); - if (result.step == Iteration_Skip){ - continue; - } - else if (result.step == Iteration_Quit){ - break; - } - Config_Get_Result_Node *node = push_array(arena, Config_Get_Result_Node, 1); - node->result = result.get; - zdll_push_back(list.first, list.last, node); - list.count += 1; - } - return(list); -} - -//////////////////////////////// - -function void -change_mode(Application_Links *app, String_Const_u8 mode){ - fcoder_mode = FCoderMode_Original; - if (string_match(mode, string_u8_litexpr("4coder"))){ - fcoder_mode = FCoderMode_Original; - } - else if (string_match(mode, string_u8_litexpr("notepad-like"))){ - begin_notepad_mode(app); - } - else{ - print_message(app, string_u8_litexpr("Unknown mode.\n")); - } -} - -//////////////////////////////// - -function Token_Array -token_array_from_text(Arena *arena, String_Const_u8 data){ - Token_List list = lex_full_input_cpp(arena, data); - return(token_array_from_list(arena, &list)); -} - -function Config* -text_data_to_parsed_data(Arena *arena, String_Const_u8 file_name, String_Const_u8 data){ - Config *parsed = 0; - Temp_Memory restore_point = begin_temp(arena); - Token_Array array = token_array_from_text(arena, data); - if (array.tokens != 0){ - parsed = text_data_and_token_array_to_parse_data(arena, file_name, data, array); - if (parsed == 0){ - end_temp(restore_point); - } - } - return(parsed); -} - -//////////////////////////////// - -function void -config_init_default(Config_Data *config){ - config->user_name = SCu8(config->user_name_space, (umem)0); - - block_zero_struct(&config->code_exts); - - config->mode = SCu8(config->mode_space, (umem)0); - - config->use_scroll_bars = false; - config->use_file_bars = true; - config->hide_file_bar_in_ui = true; - config->use_error_highlight = true; - config->use_jump_highlight = true; - config->use_scope_highlight = true; - config->use_paren_helper = true; - config->use_comment_keyword = true; - config->lister_whole_word_backspace_when_modified = false; - config->show_line_number_margins = false; - - config->enable_virtual_whitespace = true; - config->enable_code_wrapping = true; - config->automatically_adjust_wrapping = true; - config->automatically_indent_text_on_save = true; - config->automatically_save_changes_on_build = true; - config->automatically_load_project = false; - - config->indent_with_tabs = false; - config->indent_width = 4; - - config->default_wrap_width = 672; - config->default_min_base_width = 550; - - config->default_theme_name = SCu8(config->default_theme_name_space, sizeof("4coder") - 1); - block_copy(config->default_theme_name.str, "4coder", config->default_theme_name.size); - config->highlight_line_at_cursor = true; - - config->default_font_name = SCu8(config->default_font_name_space, (umem)0); - config->default_font_size = 16; - config->default_font_hinting = false; - - config->default_compiler_bat = SCu8(config->default_compiler_bat_space, 2); - block_copy(config->default_compiler_bat.str, "cl", 2); - - config->default_flags_bat = SCu8(config->default_flags_bat_space, (umem)0); - - config->default_compiler_sh = SCu8(config->default_compiler_sh_space, 3); - block_copy(config->default_compiler_sh.str, "g++", 3); - - config->default_flags_sh = SCu8(config->default_flags_sh_space, (umem)0); - - config->lalt_lctrl_is_altgr = false; -} - -function Config* -config_parse__data(Arena *arena, String_Const_u8 file_name, String_Const_u8 data, Config_Data *config){ - config_init_default(config); - - b32 success = false; - - Config *parsed = text_data_to_parsed_data(arena, file_name, data); - if (parsed != 0){ - success = true; - - config_fixed_string_var(parsed, "user_name", 0, - &config->user_name, config->user_name_space); - - String_Const_u8 str = {}; - if (config_string_var(parsed, "treat_as_code", 0, &str)){ - config->code_exts = parse_extension_line_to_extension_list(arena, str); - } - - config_fixed_string_var(parsed, "mode", 0, - &config->mode, config->mode_space); - - config_bool_var(parsed, "use_scroll_bars", 0, &config->use_scroll_bars); - config_bool_var(parsed, "use_file_bars", 0, &config->use_file_bars); - config_bool_var(parsed, "hide_file_bar_in_ui", 0, &config->hide_file_bar_in_ui); - config_bool_var(parsed, "use_error_highlight", 0, &config->use_error_highlight); - config_bool_var(parsed, "use_jump_highlight", 0, &config->use_jump_highlight); - config_bool_var(parsed, "use_scope_highlight", 0, &config->use_scope_highlight); - config_bool_var(parsed, "use_paren_helper", 0, &config->use_paren_helper); - config_bool_var(parsed, "use_comment_keyword", 0, &config->use_comment_keyword); - config_bool_var(parsed, "lister_whole_word_backspace_when_modified", 0, &config->lister_whole_word_backspace_when_modified); - config_bool_var(parsed, "show_line_number_margins", 0, &config->show_line_number_margins); - - - config_bool_var(parsed, "enable_virtual_whitespace", 0, &config->enable_virtual_whitespace); - config_bool_var(parsed, "enable_code_wrapping", 0, &config->enable_code_wrapping); - config_bool_var(parsed, "automatically_adjust_wrapping", 0, &config->automatically_adjust_wrapping); - config_bool_var(parsed, "automatically_indent_text_on_save", 0, &config->automatically_indent_text_on_save); - config_bool_var(parsed, "automatically_save_changes_on_build", 0, &config->automatically_save_changes_on_build); - config_bool_var(parsed, "automatically_load_project", 0, &config->automatically_load_project); - - config_bool_var(parsed, "indent_with_tabs", 0, &config->indent_with_tabs); - config_int_var(parsed, "indent_width", 0, &config->indent_width); - - config_int_var(parsed, "default_wrap_width", 0, &config->default_wrap_width); - config_int_var(parsed, "default_min_base_width", 0, &config->default_min_base_width); - - config_fixed_string_var(parsed, "default_theme_name", 0, - &config->default_theme_name, config->default_theme_name_space); - config_bool_var(parsed, "highlight_line_at_cursor", 0, &config->highlight_line_at_cursor); - - config_fixed_string_var(parsed, "default_font_name", 0, - &config->default_font_name, config->default_font_name_space); - config_int_var(parsed, "default_font_size", 0, &config->default_font_size); - config_bool_var(parsed, "default_font_hinting", 0, &config->default_font_hinting); - - config_fixed_string_var(parsed, "default_compiler_bat", 0, - &config->default_compiler_bat, config->default_compiler_bat_space); - config_fixed_string_var(parsed, "default_flags_bat", 0, - &config->default_flags_bat, config->default_flags_bat_space); - config_fixed_string_var(parsed, "default_compiler_sh", 0, - &config->default_compiler_sh, config->default_compiler_sh_space); - config_fixed_string_var(parsed, "default_flags_sh", 0, - &config->default_flags_sh, config->default_flags_sh_space); - - config_bool_var(parsed, "lalt_lctrl_is_altgr", 0, &config->lalt_lctrl_is_altgr); - } - - if (!success){ - config_init_default(config); - } - - return(parsed); -} - -function Config* -config_parse__file_handle(Arena *arena, String_Const_u8 file_name, FILE *file, Config_Data *config){ - Config *parsed = 0; - Data data = dump_file_handle(arena, file); - if (data.data != 0){ - parsed = config_parse__data(arena, file_name, SCu8(data), config); - } - else{ - config_init_default(config); - } - return(parsed); -} - -function Config* -config_parse__file_name(Application_Links *app, Arena *arena, char *file_name, Config_Data *config){ - Config *parsed = 0; - b32 success = false; - FILE *file = open_file_try_current_path_then_binary_path(app, file_name); - if (file != 0){ - Data data = dump_file_handle(arena, file); - fclose(file); - if (data.data != 0){ - parsed = config_parse__data(arena, SCu8(file_name), SCu8(data), config); - success = true; - } - } - if (!success){ - config_init_default(config); - } - return(parsed); -} - -#if 0 -function void -init_theme_zero(Theme *theme){ - for (i32 i = 0; i < Stag_COUNT; ++i){ - theme->colors[i] = 0; - } -} - -function Config* -theme_parse__data(Partition *arena, String file_name, String data, Theme_Data *theme){ - theme->name = make_fixed_width_string(theme->space); - copy(&theme->name, "unnamed"); - init_theme_zero(&theme->theme); - - Config *parsed = text_data_to_parsed_data(arena, file_name, data); - if (parsed != 0){ - config_fixed_string_var(parsed, "name", 0, &theme->name, theme->space); - - for (i32 i = 0; i < Stag_COUNT; ++i){ - char *name = style_tag_names[i]; - u32 color = 0; - if (!config_uint_var(parsed, name, 0, &color)){ - color = 0xFFFF00FF; - } - theme->theme.colors[i] = color; - } - } - - return(parsed); -} - -function Config* -theme_parse__file_handle(Partition *arena, String file_name, FILE *file, Theme_Data *theme){ - String data = dump_file_handle(arena, file); - Config *parsed = 0; - if (data.str != 0){ - parsed = theme_parse__data(arena, file_name, data, theme); - } - return(parsed); -} - -function Config* -theme_parse__file_name(Application_Links *app, Partition *arena, - char *file_name, Theme_Data *theme){ - Config *parsed = 0; - FILE *file = open_file_try_current_path_then_binary_path(app, file_name); - if (file != 0){ - String data = dump_file_handle(arena, file); - fclose(file); - parsed = theme_parse__data(arena, make_string_slowly(file_name), data, theme); - } - if (parsed == 0){ - char space[256]; - String str = make_fixed_width_string(space); - append(&str, "Did not find "); - append(&str, file_name); - append(&str, ", color scheme not loaded"); - print_message(app, str.str, str.size); - } - return(parsed); -} -#endif - -//////////////////////////////// - -function void -config_feedback_bool(Arena *arena, List_String_Const_u8 *list, char *name, b32 val){ - string_list_pushf(arena, list, "%s = %s;\n", name, (char*)(val?"true":"false")); -} - -function void -config_feedback_string(Arena *arena, List_String_Const_u8 *list, char *name, String_Const_u8 val){ - val.size = clamp_bot(0, val.size); - string_list_pushf(arena, list, "%s = \"%.*s\";\n", name, string_expand(val)); -} - -function void -config_feedback_string(Arena *arena, List_String_Const_u8 *list, char *name, char *val){ - string_list_pushf(arena, list, "%s = \"%s\";\n", name, val); -} - -function void -config_feedback_extension_list(Arena *arena, List_String_Const_u8 *list, char *name, String_Const_u8_Array *extensions){ - string_list_pushf(arena, list, "%s = \"", name); - for (i32 i = 0; i < extensions->count; ++i){ - String_Const_u8 ext = extensions->strings[i]; - string_list_pushf(arena, list, ".%.*s", string_expand(ext)); - } - string_list_push_u8_lit(arena, list, "\";\n"); -} - -function void -config_feedback_int(Arena *arena, List_String_Const_u8 *list, char *name, i32 val){ - string_list_pushf(arena, list, "%s = %d;\n", name, val); -} - -//////////////////////////////// - -function void -load_config_and_apply(Application_Links *app, Arena *out_arena, Config_Data *config, i32 override_font_size, b32 override_hinting){ - Scratch_Block scratch(app); - - linalloc_clear(out_arena); - Config *parsed = config_parse__file_name(app, out_arena, "config.4coder", config); - - if (parsed != 0){ - // Top - print_message(app, string_u8_litexpr("Loaded config file:\n")); - - // Errors - String_Const_u8 error_text = config_stringize_errors(scratch, parsed); - if (error_text.str != 0){ - print_message(app, error_text); - } - - // Values - Temp_Memory temp2 = begin_temp(scratch); - // TODO(allen): switch to List_String_Const_u8 for the whole config system - List_String_Const_u8 list = {}; - - { - config_feedback_string(scratch, &list, "user_name", config->user_name); - config_feedback_extension_list(scratch, &list, "treat_as_code", &config->code_exts); - - config_feedback_string(scratch, &list, "mode", config->mode); - - config_feedback_bool(scratch, &list, "use_scroll_bars", config->use_scroll_bars); - config_feedback_bool(scratch, &list, "use_file_bars", config->use_file_bars); - config_feedback_bool(scratch, &list, "hide_file_bar_in_ui", config->hide_file_bar_in_ui); - config_feedback_bool(scratch, &list, "use_error_highlight", config->use_error_highlight); - config_feedback_bool(scratch, &list, "use_jump_highlight", config->use_jump_highlight); - config_feedback_bool(scratch, &list, "use_scope_highlight", config->use_scope_highlight); - config_feedback_bool(scratch, &list, "use_paren_helper", config->use_paren_helper); - config_feedback_bool(scratch, &list, "use_comment_keyword", config->use_comment_keyword); - config_feedback_bool(scratch, &list, "lister_whole_word_backspace_when_modified", config->lister_whole_word_backspace_when_modified); - config_feedback_bool(scratch, &list, "show_line_number_margins", config->show_line_number_margins); - - config_feedback_bool(scratch, &list, "enable_virtual_whitespace", config->enable_virtual_whitespace); - config_feedback_bool(scratch, &list, "enable_code_wrapping", config->enable_code_wrapping); - config_feedback_bool(scratch, &list, "automatically_indent_text_on_save", config->automatically_indent_text_on_save); - config_feedback_bool(scratch, &list, "automatically_save_changes_on_build", config->automatically_save_changes_on_build); - config_feedback_bool(scratch, &list, "automatically_adjust_wrapping", config->automatically_adjust_wrapping); - config_feedback_bool(scratch, &list, "automatically_load_project", config->automatically_load_project); - - config_feedback_bool(scratch, &list, "indent_with_tabs", config->indent_with_tabs); - config_feedback_int(scratch, &list, "indent_width", config->indent_width); - - config_feedback_int(scratch, &list, "default_wrap_width", config->default_wrap_width); - config_feedback_int(scratch, &list, "default_min_base_width", config->default_min_base_width); - - config_feedback_string(scratch, &list, "default_theme_name", config->default_theme_name); - config_feedback_bool(scratch, &list, "highlight_line_at_cursor", config->highlight_line_at_cursor); - - config_feedback_string(scratch, &list, "default_font_name", config->default_font_name); - config_feedback_int(scratch, &list, "default_font_size", config->default_font_size); - config_feedback_bool(scratch, &list, "default_font_hinting", config->default_font_hinting); - - config_feedback_string(scratch, &list, "default_compiler_bat", config->default_compiler_bat); - config_feedback_string(scratch, &list, "default_flags_bat", config->default_flags_bat); - config_feedback_string(scratch, &list, "default_compiler_sh", config->default_compiler_sh); - config_feedback_string(scratch, &list, "default_flags_sh", config->default_flags_sh); - - config_feedback_bool(scratch, &list, "lalt_lctrl_is_altgr", config->lalt_lctrl_is_altgr); - } - - string_list_push_u8_lit(scratch, &list, "\n"); - String_Const_u8 message = string_list_flatten(scratch, list); - print_message(app, message); - end_temp(temp2); - - // Apply config - change_mode(app, config->mode); - global_set_setting(app, GlobalSetting_LAltLCtrlIsAltGr, config->lalt_lctrl_is_altgr); - - //change_theme(app, config->default_theme_name.str, config->default_theme_name.size); - - Face_Description description = {}; - description.font.file_name = config->default_font_name; - description.font.in_4coder_font_folder = true; - if (override_font_size != 0){ - description.parameters.pt_size = override_font_size; - } - else{ - description.parameters.pt_size = config->default_font_size; - } - description.parameters.hinting = config->default_font_hinting || override_hinting; - if (!modify_global_face_by_description(app, description)){ - description.font.in_4coder_font_folder = !description.font.in_4coder_font_folder; - modify_global_face_by_description(app, description); - } - } -} - -#if 0 -function void -load_theme_file_into_live_set(Application_Links *app, Partition *scratch, char *file_name){ - Temp_Memory temp = begin_temp_memory(scratch); - Theme_Data theme = {}; - Config *config = theme_parse__file_name(app, scratch, file_name, &theme); - String error_text = config_stringize_errors(scratch, config); - print_message(app, error_text.str, error_text.size); - end_temp_memory(temp); - create_theme(app, &theme.theme, theme.name.str, theme.name.size); -} - -function void -load_folder_of_themes_into_live_set(Application_Links *app, Partition *scratch, - char *folder_name){ - char path_space[512]; - String path = make_fixed_width_string(path_space); - path.size = get_4ed_path(app, path_space, sizeof(path_space)); - append(&path, folder_name); - - if (path.size < path.memory_size){ - File_List list = get_file_list(app, path.str, path.size); - for (u32 i = 0; i < list.count; ++i){ - File_Info *info = &list.infos[i]; - if (info->folder){ - continue; - } - String info_file_name = make_string(info->filename, info->filename_len); - char file_name_space[512]; - String file_name = make_fixed_width_string(file_name_space); - copy(&file_name, path); - append(&file_name, "/"); - append(&file_name, info_file_name); - if (terminate_with_null(&file_name)){ - load_theme_file_into_live_set(app, scratch, file_name.str); - } - } - free_file_list(app, list); - } -} -#endif - -// BOTTOM - +/* +4coder_config.cpp - Parsing *.4coder files. +*/ + +// TOP + +function String_Const_u8_Array +parse_extension_line_to_extension_list(Arena *arena, String_Const_u8 str){ + i32 count = 0; + for (umem i = 0; i < str.size; i += 1){ + if (str.str[i] == '.'){ + count += 1; + } + } + + String_Const_u8_Array array = {}; + array.count = count; + array.strings = push_array(arena, String_Const_u8, count); + + push_align(arena, 1); + str = string_skip(str, string_find_first(str, '.') + 1); + for (i32 i = 0; i < count; i += 1){ + umem next_period = string_find_first(str, '.'); + String_Const_u8 extension = string_prefix(str, next_period); + str = string_skip(str, next_period + 1); + array.strings[i] = push_string_copy(arena, extension); + } + push_align(arena, 8); + + return(array); +} + +//////////////////////////////// + +function Error_Location +get_error_location(u8 *base, u8 *pos){ + Error_Location location = {}; + location.line_number = 1; + location.column_number = 1; + for (u8 *ptr = base; + ptr < pos; + ptr += 1){ + if (*ptr == '\n'){ + location.line_number += 1; + location.column_number = 1; + } + else{ + location.column_number += 1; + } + } + return(location); +} + +function String_Const_u8 +config_stringize_errors(Arena *arena, Config *parsed){ + String_Const_u8 result = {}; + if (parsed->errors.first != 0){ + List_String_Const_u8 list = {}; + for (Config_Error *error = parsed->errors.first; + error != 0; + error = error->next){ + Error_Location location = get_error_location(parsed->data.str, error->pos); + string_list_pushf(arena, &list, "%.*s:%d:%d: %.*s\n", + string_expand(error->file_name), location.line_number, location.column_number, string_expand(error->text)); + } + result = string_list_flatten(arena, list); + } + return(result); +} + +//////////////////////////////// + +function void +config_parser__advance_to_next(Config_Parser *ctx){ + Token *t = ctx->token; + Token *e = ctx->end; + for (t += 1; + t < e && (t->kind == TokenBaseKind_Comment || + t->kind == TokenBaseKind_Whitespace); + t += 1); + ctx->token = t; +} + +function Config_Parser +make_config_parser(Arena *arena, String_Const_u8 file_name, String_Const_u8 data, Token_Array array){ + Config_Parser ctx = {}; + ctx.start = array.tokens; + ctx.token = ctx.start - 1; + ctx.end = ctx.start + array.count; + ctx.file_name = file_name; + ctx.data = data; + ctx.arena = arena; + config_parser__advance_to_next(&ctx); + return(ctx); +} + +function b32 +config_parser__recognize_base_token(Config_Parser *ctx, Token_Base_Kind kind){ + b32 result = false; + if (ctx->start <= ctx->token && ctx->token < ctx->end){ + result = (ctx->token->kind == kind); + } + else if (kind == TokenBaseKind_EOF){ + result = true; + } + return(result); +} + +function b32 +config_parser__recognize_token(Config_Parser *ctx, Token_Cpp_Kind kind){ + b32 result = false; + if (ctx->start <= ctx->token && ctx->token < ctx->end){ + result = (ctx->token->sub_kind == kind); + } + else if (kind == TokenCppKind_EOF){ + result = true; + } + return(result); +} + +function b32 +config_parser__recognize_boolean(Config_Parser *ctx){ + b32 result = false; + Token *token = ctx->token; + if (ctx->start <= ctx->token && ctx->token < ctx->end){ + result = (token->sub_kind == TokenCppKind_LiteralTrue || + token->sub_kind == TokenCppKind_LiteralFalse); + } + return(result); +} + +function String_Const_u8 +config_parser__get_lexeme(Config_Parser *ctx){ + String_Const_u8 lexeme = {}; + Token *token = ctx->token; + if (ctx->start <= token && token < ctx->end){ + lexeme = SCu8(ctx->data.str + token->pos, token->size); + } + return(lexeme); +} + +function Config_Integer +config_parser__get_int(Config_Parser *ctx){ + Config_Integer config_integer = {}; + String_Const_u8 str = config_parser__get_lexeme(ctx); + if (string_match(string_prefix(str, 2), string_u8_litexpr("0x"))){ + config_integer.is_signed = false; + config_integer.uinteger = (u32)(string_to_integer(string_skip(str, 2), 16)); + } + else{ + b32 is_negative = (string_get_character(str, 0) == '-'); + if (is_negative){ + str = string_skip(str, 1); + } + config_integer.is_signed = true; + config_integer.integer = (i32)(string_to_integer(str, 10)); + if (is_negative){ + config_integer.integer *= -1; + } + } + return(config_integer); +} + +function b32 +config_parser__get_boolean(Config_Parser *ctx){ + String_Const_u8 str = config_parser__get_lexeme(ctx); + return(string_match(str, string_u8_litexpr("true"))); +} + +function b32 +config_parser__recognize_text(Config_Parser *ctx, String_Const_u8 text){ + String_Const_u8 lexeme = config_parser__get_lexeme(ctx); + return(lexeme.str != 0 && string_match(lexeme, text)); +} + +function b32 +config_parser__match_token(Config_Parser *ctx, Token_Cpp_Kind kind){ + b32 result = config_parser__recognize_token(ctx, kind); + if (result){ + config_parser__advance_to_next(ctx); + } + return(result); +} + +function b32 +config_parser__match_text(Config_Parser *ctx, String_Const_u8 text){ + b32 result = config_parser__recognize_text(ctx, text); + if (result){ + config_parser__advance_to_next(ctx); + } + return(result); +} + +#define config_parser__match_text_lit(c,s) config_parser__match_text((c), string_u8_litexpr(s)) + +function Config *config_parser__config (Config_Parser *ctx); +function i32 *config_parser__version (Config_Parser *ctx); +function Config_Assignment *config_parser__assignment(Config_Parser *ctx); +function Config_LValue *config_parser__lvalue (Config_Parser *ctx); +function Config_RValue *config_parser__rvalue (Config_Parser *ctx); +function Config_Compound *config_parser__compound (Config_Parser *ctx); +function Config_Compound_Element *config_parser__element (Config_Parser *ctx); + +function Config* +text_data_and_token_array_to_parse_data(Arena *arena, String_Const_u8 file_name, String_Const_u8 data, Token_Array array){ + Temp_Memory restore_point = begin_temp(arena); + Config_Parser ctx = make_config_parser(arena, file_name, data, array); + Config *config = config_parser__config(&ctx); + if (config == 0){ + end_temp(restore_point); + } + return(config); +} + +// TODO(allen): Move to string library +function Config_Error* +config_error_push(Arena *arena, Config_Error_List *list, String_Const_u8 file_name, u8 *pos, char *error_text){ + Config_Error *error = push_array(arena, Config_Error, 1); + zdll_push_back(list->first, list->last, error); + list->count += 1; + error->file_name = file_name; + error->pos = pos; + error->text = push_string_copy(arena, SCu8(error_text)); + return(error); +} + +function u8* +config_parser__get_pos(Config_Parser *ctx){ + return(ctx->data.str + ctx->token->pos); +} + +function void +config_parser__log_error_pos(Config_Parser *ctx, u8 *pos, char *error_text){ + config_error_push(ctx->arena, &ctx->errors, ctx->file_name, pos, error_text); +} + +function void +config_parser__log_error(Config_Parser *ctx, char *error_text){ + config_parser__log_error_pos(ctx, config_parser__get_pos(ctx), error_text); +} + +function Config* +config_parser__config(Config_Parser *ctx){ + i32 *version = config_parser__version(ctx); + + Config_Assignment *first = 0; + Config_Assignment *last = 0; + i32 count = 0; + for (;!config_parser__recognize_token(ctx, TokenCppKind_EOF);){ + Config_Assignment *assignment = config_parser__assignment(ctx); + if (assignment != 0){ + zdll_push_back(first, last, assignment); + count += 1; + } + } + + Config *config = push_array(ctx->arena, Config, 1); + block_zero_struct(config); + config->version = version; + config->first = first; + config->last = last; + config->count = count; + config->errors = ctx->errors; + config->file_name = ctx->file_name; + config->data = ctx->data; + return(config); +} + +function void +config_parser__recover_parse(Config_Parser *ctx){ + for (;;){ + if (config_parser__match_token(ctx, TokenCppKind_Semicolon)){ + break; + } + if (config_parser__recognize_token(ctx, TokenCppKind_EOF)){ + break; + } + config_parser__advance_to_next(ctx); + } +} + +function i32* +config_parser__version(Config_Parser *ctx){ + require(config_parser__match_text_lit(ctx, "version")); + + if (!config_parser__match_token(ctx, TokenCppKind_ParenOp)){ + config_parser__log_error(ctx, "expected token '(' for version specifier: 'version(#)'"); + config_parser__recover_parse(ctx); + return(0); + } + + if (!config_parser__recognize_base_token(ctx, TokenBaseKind_LiteralInteger)){ + config_parser__log_error(ctx, "expected an integer constant for version specifier: 'version(#)'"); + config_parser__recover_parse(ctx); + return(0); + } + + Config_Integer value = config_parser__get_int(ctx); + config_parser__advance_to_next(ctx); + + if (!config_parser__match_token(ctx, TokenCppKind_ParenCl)){ + config_parser__log_error(ctx, "expected token ')' for version specifier: 'version(#)'"); + config_parser__recover_parse(ctx); + return(0); + } + + if (!config_parser__match_token(ctx, TokenCppKind_Semicolon)){ + config_parser__log_error(ctx, "expected token ';' for version specifier: 'version(#)'"); + config_parser__recover_parse(ctx); + return(0); + } + + i32 *ptr = push_array(ctx->arena, i32, 1); + *ptr = value.integer; + return(ptr); +} + +function Config_Assignment* +config_parser__assignment(Config_Parser *ctx){ + u8 *pos = config_parser__get_pos(ctx); + + Config_LValue *l = config_parser__lvalue(ctx); + if (l == 0){ + config_parser__log_error(ctx, "expected an l-value; l-value formats: 'identifier', 'identifier[#]'"); + config_parser__recover_parse(ctx); + return(0); + } + + if (!config_parser__match_token(ctx, TokenCppKind_Eq)){ + config_parser__log_error(ctx, "expected token '=' for assignment: 'l-value = r-value;'"); + config_parser__recover_parse(ctx); + return(0); + } + + Config_RValue *r = config_parser__rvalue(ctx); + if (r == 0){ + config_parser__log_error(ctx, "expected an r-value; r-value formats:\n" + "\tconstants (true, false, integers, hexadecimal integers, strings, characters)\n" + "\tany l-value that is set in the file\n" + "\tcompound: '{ compound-element, compound-element, compound-element ...}'\n" + "\ta compound-element is an r-value, and can have a layout specifier\n" + "\tcompound-element with layout specifier: .name = r-value, .integer = r-value"); + config_parser__recover_parse(ctx); + return(0); + } + + if (!config_parser__match_token(ctx, TokenCppKind_Semicolon)){ + config_parser__log_error(ctx, "expected token ';' for assignment: 'l-value = r-value;'"); + config_parser__recover_parse(ctx); + return(0); + } + + Config_Assignment *assignment = push_array_zero(ctx->arena, Config_Assignment, 1); + assignment->pos = pos; + assignment->l = l; + assignment->r = r; + return(assignment); +} + +function Config_LValue* +config_parser__lvalue(Config_Parser *ctx){ + require(config_parser__recognize_token(ctx, TokenCppKind_Identifier)); + String_Const_u8 identifier = config_parser__get_lexeme(ctx); + config_parser__advance_to_next(ctx); + + i32 index = 0; + if (config_parser__match_token(ctx, TokenCppKind_BrackOp)){ + require(config_parser__recognize_base_token(ctx, TokenBaseKind_LiteralInteger)); + Config_Integer value = config_parser__get_int(ctx); + index = value.integer; + config_parser__advance_to_next(ctx); + require(config_parser__match_token(ctx, TokenCppKind_BrackCl)); + } + + Config_LValue *lvalue = push_array_zero(ctx->arena, Config_LValue, 1); + lvalue->identifier = identifier; + lvalue->index = index; + return(lvalue); +} + +function Config_RValue* +config_parser__rvalue(Config_Parser *ctx){ + Config_RValue *rvalue = 0; + if (config_parser__recognize_token(ctx, TokenCppKind_Identifier)){ + Config_LValue *l = config_parser__lvalue(ctx); + require(l != 0); + rvalue = push_array_zero(ctx->arena, Config_RValue, 1); + rvalue->type = ConfigRValueType_LValue; + rvalue->lvalue = l; + } + else if (config_parser__recognize_token(ctx, TokenCppKind_BraceOp)){ + config_parser__advance_to_next(ctx); + Config_Compound *compound = config_parser__compound(ctx); + require(compound != 0); + rvalue = push_array_zero(ctx->arena, Config_RValue, 1); + rvalue->type = ConfigRValueType_Compound; + rvalue->compound = compound; + } + else if (config_parser__recognize_boolean(ctx)){ + b32 b = config_parser__get_boolean(ctx); + config_parser__advance_to_next(ctx); + rvalue = push_array_zero(ctx->arena, Config_RValue, 1); + rvalue->type = ConfigRValueType_Boolean; + rvalue->boolean = b; + } + else if (config_parser__recognize_base_token(ctx, TokenBaseKind_LiteralInteger)){ + Config_Integer value = config_parser__get_int(ctx); + config_parser__advance_to_next(ctx); + rvalue = push_array_zero(ctx->arena, Config_RValue, 1); + rvalue->type = ConfigRValueType_Integer; + if (value.is_signed){ + rvalue->integer = value.integer; + } + else{ + rvalue->uinteger = value.uinteger; + } + } + else if (config_parser__recognize_token(ctx, TokenCppKind_LiteralString)){ + String_Const_u8 s = config_parser__get_lexeme(ctx); + config_parser__advance_to_next(ctx); + s = string_chop(string_skip(s, 1), 1); + String_Const_u8 interpreted = string_interpret_escapes(ctx->arena, s); + rvalue = push_array_zero(ctx->arena, Config_RValue, 1); + rvalue->type = ConfigRValueType_String; + rvalue->string = interpreted; + } + else if (config_parser__recognize_token(ctx, TokenCppKind_LiteralCharacter)){ + String_Const_u8 s = config_parser__get_lexeme(ctx); + config_parser__advance_to_next(ctx); + s = string_chop(string_skip(s, 1), 1); + String_Const_u8 interpreted = string_interpret_escapes(ctx->arena, s); + rvalue = push_array_zero(ctx->arena, Config_RValue, 1); + rvalue->type = ConfigRValueType_Character; + rvalue->character = string_get_character(interpreted, 0); + } + return(rvalue); +} + +function void +config_parser__compound__check(Config_Parser *ctx, Config_Compound *compound){ + b32 implicit_index_allowed = true; + for (Config_Compound_Element *node = compound->first; + node != 0; + node = node->next){ + if (node->l.type != ConfigLayoutType_Unset){ + implicit_index_allowed = false; + } + else if (!implicit_index_allowed){ + config_parser__log_error_pos(ctx, node->l.pos, + "encountered unlabeled member after one or more labeled members"); + } + } +} + +function Config_Compound* +config_parser__compound(Config_Parser *ctx){ + Config_Compound_Element *first = 0; + Config_Compound_Element *last = 0; + i32 count = 0; + + Config_Compound_Element *element = config_parser__element(ctx); + require(element != 0); + zdll_push_back(first, last, element); + count += 1; + + for (;config_parser__match_token(ctx, TokenCppKind_Comma);){ + if (config_parser__recognize_token(ctx, TokenCppKind_BraceCl)){ + break; + } + element = config_parser__element(ctx); + require(element != 0); + zdll_push_back(first, last, element); + count += 1; + } + + require(config_parser__match_token(ctx, TokenCppKind_BraceCl)); + + Config_Compound *compound = push_array(ctx->arena, Config_Compound, 1); + block_zero_struct(compound); + compound->first = first; + compound->last = last; + compound->count = count; + config_parser__compound__check(ctx, compound); + return(compound); +} + +function Config_Compound_Element* +config_parser__element(Config_Parser *ctx){ + Config_Layout layout = {}; + layout.pos = config_parser__get_pos(ctx); + if (config_parser__match_token(ctx, TokenCppKind_Dot)){ + if (config_parser__recognize_token(ctx, TokenCppKind_Identifier)){ + layout.type = ConfigLayoutType_Identifier; + layout.identifier = config_parser__get_lexeme(ctx); + config_parser__advance_to_next(ctx); + } + else if (config_parser__recognize_base_token(ctx, TokenBaseKind_LiteralInteger)){ + layout.type = ConfigLayoutType_Integer; + Config_Integer value = config_parser__get_int(ctx); + layout.integer = value.integer; + config_parser__advance_to_next(ctx); + } + else{ + return(0); + } + require(config_parser__match_token(ctx, TokenCppKind_Eq)); + } + Config_RValue *rvalue = config_parser__rvalue(ctx); + require(rvalue != 0); + Config_Compound_Element *element = push_array(ctx->arena, Config_Compound_Element, 1); + block_zero_struct(element); + element->l = layout; + element->r = rvalue; + return(element); +} + +//////////////////////////////// + +function Config_Error* +config_add_error(Arena *arena, Config *config, u8 *pos, char *error_text){ + return(config_error_push(arena, &config->errors, config->file_name, pos, error_text)); +} + +//////////////////////////////// + +function Config_Assignment* +config_lookup_assignment(Config *config, String_Const_u8 var_name, i32 subscript){ + Config_Assignment *assignment = 0; + for (assignment = config->first; + assignment != 0; + assignment = assignment->next){ + Config_LValue *l = assignment->l; + if (l != 0 && string_match(l->identifier, var_name) && l->index == subscript){ + break; + } + } + return(assignment); +} + +function Config_Get_Result +config_var(Config *config, String_Const_u8 var_name, i32 subscript); + +function Config_Get_Result +config_evaluate_rvalue(Config *config, Config_Assignment *assignment, Config_RValue *r){ + Config_Get_Result result = {}; + if (r != 0 && !assignment->visited){ + if (r->type == ConfigRValueType_LValue){ + assignment->visited = true; + Config_LValue *l = r->lvalue; + result = config_var(config, l->identifier, l->index); + assignment->visited = false; + } + else{ + result.success = true; + result.pos = assignment->pos; + result.type = r->type; + switch (r->type){ + case ConfigRValueType_Boolean: + { + result.boolean = r->boolean; + }break; + + case ConfigRValueType_Integer: + { + result.integer = r->integer; + }break; + + case ConfigRValueType_String: + { + result.string = r->string; + }break; + + case ConfigRValueType_Character: + { + result.character = r->character; + }break; + + case ConfigRValueType_Compound: + { + result.compound = r->compound; + }break; + } + } + } + return(result); +} + +function Config_Get_Result +config_var(Config *config, String_Const_u8 var_name, i32 subscript){ + Config_Get_Result result = {}; + Config_Assignment *assignment = config_lookup_assignment(config, var_name, subscript); + if (assignment != 0){ + result = config_evaluate_rvalue(config, assignment, assignment->r); + } + return(result); +} + +function Config_Get_Result +config_compound_member(Config *config, Config_Compound *compound, String_Const_u8 var_name, i32 index){ + Config_Get_Result result = {}; + i32 implicit_index = 0; + b32 implicit_index_is_valid = true; + for (Config_Compound_Element *element = compound->first; + element != 0; + element = element->next, implicit_index += 1){ + b32 element_matches_query = false; + switch (element->l.type){ + case ConfigLayoutType_Unset: + { + if (implicit_index_is_valid && index == implicit_index){ + element_matches_query = true; + } + }break; + + case ConfigLayoutType_Identifier: + { + implicit_index_is_valid = false; + if (string_match(element->l.identifier, var_name)){ + element_matches_query = true; + } + }break; + + case ConfigLayoutType_Integer: + { + implicit_index_is_valid = false; + if (element->l.integer == index){ + element_matches_query = true; + } + }break; + } + if (element_matches_query){ + Config_Assignment dummy_assignment = {}; + dummy_assignment.pos = element->l.pos; + result = config_evaluate_rvalue(config, &dummy_assignment, element->r); + break; + } + } + return(result); +} + +function Config_Iteration_Step_Result +typed_array_iteration_step(Config *parsed, Config_Compound *compound, Config_RValue_Type type, i32 index); + +function i32 +typed_array_get_count(Config *parsed, Config_Compound *compound, Config_RValue_Type type); + +function Config_Get_Result_List +typed_array_reference_list(Arena *arena, Config *parsed, Config_Compound *compound, Config_RValue_Type type); + +#define config_fixed_string_var(c,v,s,o,a) config_placed_string_var((c),(v),(s),(o),(a),sizeof(a)) + +//////////////////////////////// + +function b32 +config_has_var(Config *config, String_Const_u8 var_name, i32 subscript){ + Config_Get_Result result = config_var(config, var_name, subscript); + return(result.success && result.type == ConfigRValueType_NoType); +} + +function b32 +config_has_var(Config *config, char *var_name, i32 subscript){ + return(config_has_var(config, SCu8(var_name), subscript)); +} + +function b32 +config_bool_var(Config *config, String_Const_u8 var_name, i32 subscript, b32* var_out){ + Config_Get_Result result = config_var(config, var_name, subscript); + b32 success = (result.success && result.type == ConfigRValueType_Boolean); + if (success){ + *var_out = result.boolean; + } + return(success); +} +function b32 +config_bool_var(Config *config, String_Const_u8 var_name, i32 subscript, b8 *var_out){ + b32 temp = false; + b32 success = config_bool_var(config, var_name, subscript, &temp); + if (success){ + *var_out = (temp != false); + } + return(success); +} +function b32 +config_bool_var(Config *config, char *var_name, i32 subscript, b32* var_out){ + return(config_bool_var(config, SCu8(var_name), subscript, var_out)); +} +function b32 +config_bool_var(Config *config, char* var_name, i32 subscript, b8 *var_out){ + b32 temp = false; + b32 success = config_bool_var(config, SCu8(var_name), subscript, &temp); + if (success){ + *var_out = (temp != false); + } + return(success); +} + +function b32 +config_int_var(Config *config, String_Const_u8 var_name, i32 subscript, i32* var_out){ + Config_Get_Result result = config_var(config, var_name, subscript); + b32 success = result.success && result.type == ConfigRValueType_Integer; + if (success){ + *var_out = result.integer; + } + return(success); +} + +function b32 +config_int_var(Config *config, char *var_name, i32 subscript, i32* var_out){ + return(config_int_var(config, SCu8(var_name), subscript, var_out)); +} + +function b32 +config_uint_var(Config *config, String_Const_u8 var_name, i32 subscript, u32* var_out){ + Config_Get_Result result = config_var(config, var_name, subscript); + b32 success = result.success && result.type == ConfigRValueType_Integer; + if (success){ + *var_out = result.uinteger; + } + return(success); +} + +function b32 +config_uint_var(Config *config, char *var_name, i32 subscript, u32* var_out){ + return(config_uint_var(config, SCu8(var_name), subscript, var_out)); +} + +function b32 +config_string_var(Config *config, String_Const_u8 var_name, i32 subscript, String_Const_u8* var_out){ + Config_Get_Result result = config_var(config, var_name, subscript); + b32 success = result.success && result.type == ConfigRValueType_String; + if (success){ + *var_out = result.string; + } + return(success); +} + +function b32 +config_string_var(Config *config, char *var_name, i32 subscript, String_Const_u8* var_out){ + return(config_string_var(config, SCu8(var_name), subscript, var_out)); +} + +function b32 +config_placed_string_var(Config *config, String_Const_u8 var_name, i32 subscript, String_Const_u8* var_out, u8 *space, umem space_size){ + Config_Get_Result result = config_var(config, var_name, subscript); + b32 success = (result.success && result.type == ConfigRValueType_String); + if (success){ + umem size = result.string.size; + size = clamp_top(size, space_size); + block_copy(space, result.string.str, size); + *var_out = SCu8(space, size); + } + return(success); +} + +function b32 +config_placed_string_var(Config *config, char *var_name, i32 subscript, String_Const_u8* var_out, u8 *space, umem space_size){ + return(config_placed_string_var(config, SCu8(var_name), subscript, var_out, space, space_size)); +} + +function b32 +config_char_var(Config *config, String_Const_u8 var_name, i32 subscript, char* var_out){ + Config_Get_Result result = config_var(config, var_name, subscript); + b32 success = result.success && result.type == ConfigRValueType_Character; + if (success){ + *var_out = result.character; + } + return(success); +} + +function b32 +config_char_var(Config *config, char *var_name, i32 subscript, char* var_out){ + return(config_char_var(config, SCu8(var_name), subscript, var_out)); +} + +function b32 +config_compound_var(Config *config, String_Const_u8 var_name, i32 subscript, Config_Compound** var_out){ + Config_Get_Result result = config_var(config, var_name, subscript); + b32 success = result.success && result.type == ConfigRValueType_Compound; + if (success){ + *var_out = result.compound; + } + return(success); +} + +function b32 +config_compound_var(Config *config, char *var_name, i32 subscript, Config_Compound** var_out){ + return(config_compound_var(config, SCu8(var_name), subscript, var_out)); +} + +function b32 +config_compound_has_member(Config *config, Config_Compound *compound, + String_Const_u8 var_name, i32 index){ + Config_Get_Result result = config_compound_member(config, compound, var_name, index); + b32 success = result.success && result.type == ConfigRValueType_NoType; + return(success); +} + +function b32 +config_compound_has_member(Config *config, Config_Compound *compound, + char *var_name, i32 index){ + return(config_compound_has_member(config, compound, SCu8(var_name), index)); +} + +function b32 +config_compound_bool_member(Config *config, Config_Compound *compound, + String_Const_u8 var_name, i32 index, b32* var_out){ + Config_Get_Result result = config_compound_member(config, compound, var_name, index); + b32 success = result.success && result.type == ConfigRValueType_Boolean; + if (success){ + *var_out = result.boolean; + } + return(success); +} + +function b32 +config_compound_bool_member(Config *config, Config_Compound *compound, + char *var_name, i32 index, b32* var_out){ + return(config_compound_bool_member(config, compound, SCu8(var_name), index, var_out)); +} + +function b32 +config_compound_int_member(Config *config, Config_Compound *compound, + String_Const_u8 var_name, i32 index, i32* var_out){ + Config_Get_Result result = config_compound_member(config, compound, var_name, index); + b32 success = result.success && result.type == ConfigRValueType_Integer; + if (success){ + *var_out = result.integer; + } + return(success); +} + +function b32 +config_compound_int_member(Config *config, Config_Compound *compound, + char *var_name, i32 index, i32* var_out){ + return(config_compound_int_member(config, compound, SCu8(var_name), index, var_out)); +} + +function b32 +config_compound_uint_member(Config *config, Config_Compound *compound, + String_Const_u8 var_name, i32 index, u32* var_out){ + Config_Get_Result result = config_compound_member(config, compound, var_name, index); + b32 success = result.success && result.type == ConfigRValueType_Integer; + if (success){ + *var_out = result.uinteger; + } + return(success); +} + +function b32 +config_compound_uint_member(Config *config, Config_Compound *compound, + char *var_name, i32 index, u32* var_out){ + return(config_compound_uint_member(config, compound, SCu8(var_name), index, var_out)); +} + +function b32 +config_compound_string_member(Config *config, Config_Compound *compound, + String_Const_u8 var_name, i32 index, String_Const_u8* var_out){ + Config_Get_Result result = config_compound_member(config, compound, var_name, index); + b32 success = (result.success && result.type == ConfigRValueType_String); + if (success){ + *var_out = result.string; + } + return(success); +} + +function b32 +config_compound_string_member(Config *config, Config_Compound *compound, + char *var_name, i32 index, String_Const_u8* var_out){ + return(config_compound_string_member(config, compound, SCu8(var_name), index, var_out)); +} + +function b32 +config_compound_placed_string_member(Config *config, Config_Compound *compound, + String_Const_u8 var_name, i32 index, String_Const_u8* var_out, u8 *space, umem space_size){ + Config_Get_Result result = config_compound_member(config, compound, var_name, index); + b32 success = (result.success && result.type == ConfigRValueType_String); + if (success){ + umem size = result.string.size; + size = clamp_top(size, space_size); + block_copy(space, result.string.str, size); + *var_out = SCu8(space, size); + } + return(success); +} + +function b32 +config_compound_placed_string_member(Config *config, Config_Compound *compound, + char *var_name, i32 index, String_Const_u8* var_out, u8 *space, umem space_size){ + return(config_compound_placed_string_member(config, compound, SCu8(var_name), index, var_out, space, space_size)); +} + +function b32 +config_compound_char_member(Config *config, Config_Compound *compound, + String_Const_u8 var_name, i32 index, char* var_out){ + Config_Get_Result result = config_compound_member(config, compound, var_name, index); + b32 success = result.success && result.type == ConfigRValueType_Character; + if (success){ + *var_out = result.character; + } + return(success); +} + +function b32 +config_compound_char_member(Config *config, Config_Compound *compound, + char *var_name, i32 index, char* var_out){ + return(config_compound_char_member(config, compound, SCu8(var_name), index, var_out)); +} + +function b32 +config_compound_compound_member(Config *config, Config_Compound *compound, + String_Const_u8 var_name, i32 index, Config_Compound** var_out){ + Config_Get_Result result = config_compound_member(config, compound, var_name, index); + b32 success = result.success && result.type == ConfigRValueType_Compound; + if (success){ + *var_out = result.compound; + } + return(success); +} + +function b32 +config_compound_compound_member(Config *config, Config_Compound *compound, + char *var_name, i32 index, Config_Compound** var_out){ + return(config_compound_compound_member(config, compound, SCu8(var_name), index, var_out)); +} + +function Iteration_Step_Result +typed_has_array_iteration_step(Config *config, Config_Compound *compound, i32 index){ + Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_NoType, index); + return(result.step); +} + +function Iteration_Step_Result +typed_bool_array_iteration_step(Config *config, Config_Compound *compound, i32 index, b32* var_out){ + Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Boolean, index); + b32 success = (result.step == Iteration_Good); + if (success){ + *var_out = result.get.boolean; + } + return(result.step); +} + +function Iteration_Step_Result +typed_int_array_iteration_step(Config *config, Config_Compound *compound, i32 index, i32* var_out){ + Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Integer, index); + b32 success = (result.step == Iteration_Good); + if (success){ + *var_out = result.get.integer; + } + return(result.step); +} + +function Iteration_Step_Result +typed_uint_array_iteration_step(Config *config, Config_Compound *compound, i32 index, u32* var_out){ + Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Integer, index); + b32 success = (result.step == Iteration_Good); + if (success){ + *var_out = result.get.uinteger; + } + return(result.step); +} + +function Iteration_Step_Result +typed_string_array_iteration_step(Config *config, Config_Compound *compound, i32 index, String_Const_u8* var_out){ + Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_String, index); + b32 success = (result.step == Iteration_Good); + if (success){ + *var_out = result.get.string; + } + return(result.step); +} + +function Iteration_Step_Result +typed_placed_string_array_iteration_step(Config *config, Config_Compound *compound, i32 index, String_Const_u8* var_out, u8 *space, umem space_size){ + Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_String, index); + b32 success = (result.step == Iteration_Good); + if (success){ + umem size = result.get.string.size; + size = clamp_top(size, space_size); + block_copy(space, result.get.string.str, size); + *var_out = SCu8(space, size); + } + return(result.step); +} + +function Iteration_Step_Result +typed_char_array_iteration_step(Config *config, Config_Compound *compound, i32 index, char* var_out){ + Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Character, index); + b32 success = (result.step == Iteration_Good); + if (success){ + *var_out = result.get.character; + } + return(result.step); +} + +function Iteration_Step_Result +typed_compound_array_iteration_step(Config *config, Config_Compound *compound, i32 index, Config_Compound** var_out){ + Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Compound, index); + b32 success = (result.step == Iteration_Good); + if (success){ + *var_out = result.get.compound; + } + return(result.step); +} + +function i32 +typed_bool_array_get_count(Config *config, Config_Compound *compound){ + i32 count = typed_array_get_count(config, compound, ConfigRValueType_Boolean); + return(count); +} + +function i32 +typed_int_array_get_count(Config *config, Config_Compound *compound){ + i32 count = typed_array_get_count(config, compound, ConfigRValueType_Integer); + return(count); +} + +function i32 +typed_float_array_get_count(Config *config, Config_Compound *compound){ + i32 count = typed_array_get_count(config, compound, ConfigRValueType_Float); + return(count); +} + +function i32 +typed_string_array_get_count(Config *config, Config_Compound *compound){ + i32 count = typed_array_get_count(config, compound, ConfigRValueType_String); + return(count); +} + +function i32 +typed_character_array_get_count(Config *config, Config_Compound *compound){ + i32 count = typed_array_get_count(config, compound, ConfigRValueType_Character); + return(count); +} + +function i32 +typed_compound_array_get_count(Config *config, Config_Compound *compound){ + i32 count = typed_array_get_count(config, compound, ConfigRValueType_Compound); + return(count); +} + +function i32 +typed_no_type_array_get_count(Config *config, Config_Compound *compound){ + i32 count = typed_array_get_count(config, compound, ConfigRValueType_NoType); + return(count); +} + +function Config_Get_Result_List +typed_bool_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ + Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Boolean); + return(list); +} + +function Config_Get_Result_List +typed_int_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ + Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Integer); + return(list); +} + +function Config_Get_Result_List +typed_float_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ + Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Float); + return(list); +} + +function Config_Get_Result_List +typed_string_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ + Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_String); + return(list); +} + +function Config_Get_Result_List +typed_character_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ + Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Character); + return(list); +} + +function Config_Get_Result_List +typed_compound_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ + Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Compound); + return(list); +} + +function Config_Get_Result_List +typed_no_type_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ + Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_NoType); + return(list); +} + +//////////////////////////////// + +function Config_Iteration_Step_Result +typed_array_iteration_step(Config *parsed, Config_Compound *compound, Config_RValue_Type type, i32 index){ + Config_Iteration_Step_Result result = {}; + result.step = Iteration_Quit; + Config_Get_Result get_result = config_compound_member(parsed, compound, string_u8_litexpr("~"), index); + if (get_result.success){ + if (get_result.type == type || type == ConfigRValueType_NoType){ + result.step = Iteration_Good; + result.get = get_result; + } + else{ + result.step = Iteration_Skip; + } + } + return(result); +} + +function i32 +typed_array_get_count(Config *parsed, Config_Compound *compound, Config_RValue_Type type){ + i32 count = 0; + for (i32 i = 0;; ++i){ + Config_Iteration_Step_Result result = typed_array_iteration_step(parsed, compound, type, i); + if (result.step == Iteration_Skip){ + continue; + } + else if (result.step == Iteration_Quit){ + break; + } + count += 1; + } + return(count); +} + +function Config_Get_Result_List +typed_array_reference_list(Arena *arena, Config *parsed, Config_Compound *compound, Config_RValue_Type type){ + Config_Get_Result_List list = {}; + for (i32 i = 0;; ++i){ + Config_Iteration_Step_Result result = typed_array_iteration_step(parsed, compound, type, i); + if (result.step == Iteration_Skip){ + continue; + } + else if (result.step == Iteration_Quit){ + break; + } + Config_Get_Result_Node *node = push_array(arena, Config_Get_Result_Node, 1); + node->result = result.get; + zdll_push_back(list.first, list.last, node); + list.count += 1; + } + return(list); +} + +//////////////////////////////// + +function void +change_mode(Application_Links *app, String_Const_u8 mode){ + fcoder_mode = FCoderMode_Original; + if (string_match(mode, string_u8_litexpr("4coder"))){ + fcoder_mode = FCoderMode_Original; + } + else if (string_match(mode, string_u8_litexpr("notepad-like"))){ + begin_notepad_mode(app); + } + else{ + print_message(app, string_u8_litexpr("Unknown mode.\n")); + } +} + +//////////////////////////////// + +function Token_Array +token_array_from_text(Arena *arena, String_Const_u8 data){ + Token_List list = lex_full_input_cpp(arena, data); + return(token_array_from_list(arena, &list)); +} + +function Config* +text_data_to_parsed_data(Arena *arena, String_Const_u8 file_name, String_Const_u8 data){ + Config *parsed = 0; + Temp_Memory restore_point = begin_temp(arena); + Token_Array array = token_array_from_text(arena, data); + if (array.tokens != 0){ + parsed = text_data_and_token_array_to_parse_data(arena, file_name, data, array); + if (parsed == 0){ + end_temp(restore_point); + } + } + return(parsed); +} + +//////////////////////////////// + +function void +config_init_default(Config_Data *config){ + config->user_name = SCu8(config->user_name_space, (umem)0); + + block_zero_struct(&config->code_exts); + + config->mode = SCu8(config->mode_space, (umem)0); + + config->use_scroll_bars = false; + config->use_file_bars = true; + config->hide_file_bar_in_ui = true; + config->use_error_highlight = true; + config->use_jump_highlight = true; + config->use_scope_highlight = true; + config->use_paren_helper = true; + config->use_comment_keyword = true; + config->lister_whole_word_backspace_when_modified = false; + config->show_line_number_margins = false; + + config->enable_virtual_whitespace = true; + config->enable_code_wrapping = true; + config->automatically_adjust_wrapping = true; + config->automatically_indent_text_on_save = true; + config->automatically_save_changes_on_build = true; + config->automatically_load_project = false; + + config->indent_with_tabs = false; + config->indent_width = 4; + + config->default_wrap_width = 672; + config->default_min_base_width = 550; + + config->default_theme_name = SCu8(config->default_theme_name_space, sizeof("4coder") - 1); + block_copy(config->default_theme_name.str, "4coder", config->default_theme_name.size); + config->highlight_line_at_cursor = true; + + config->default_font_name = SCu8(config->default_font_name_space, (umem)0); + config->default_font_size = 16; + config->default_font_hinting = false; + + config->default_compiler_bat = SCu8(config->default_compiler_bat_space, 2); + block_copy(config->default_compiler_bat.str, "cl", 2); + + config->default_flags_bat = SCu8(config->default_flags_bat_space, (umem)0); + + config->default_compiler_sh = SCu8(config->default_compiler_sh_space, 3); + block_copy(config->default_compiler_sh.str, "g++", 3); + + config->default_flags_sh = SCu8(config->default_flags_sh_space, (umem)0); + + config->lalt_lctrl_is_altgr = false; +} + +function Config* +config_parse__data(Arena *arena, String_Const_u8 file_name, String_Const_u8 data, Config_Data *config){ + config_init_default(config); + + b32 success = false; + + Config *parsed = text_data_to_parsed_data(arena, file_name, data); + if (parsed != 0){ + success = true; + + config_fixed_string_var(parsed, "user_name", 0, + &config->user_name, config->user_name_space); + + String_Const_u8 str = {}; + if (config_string_var(parsed, "treat_as_code", 0, &str)){ + config->code_exts = parse_extension_line_to_extension_list(arena, str); + } + + config_fixed_string_var(parsed, "mode", 0, + &config->mode, config->mode_space); + + config_bool_var(parsed, "use_scroll_bars", 0, &config->use_scroll_bars); + config_bool_var(parsed, "use_file_bars", 0, &config->use_file_bars); + config_bool_var(parsed, "hide_file_bar_in_ui", 0, &config->hide_file_bar_in_ui); + config_bool_var(parsed, "use_error_highlight", 0, &config->use_error_highlight); + config_bool_var(parsed, "use_jump_highlight", 0, &config->use_jump_highlight); + config_bool_var(parsed, "use_scope_highlight", 0, &config->use_scope_highlight); + config_bool_var(parsed, "use_paren_helper", 0, &config->use_paren_helper); + config_bool_var(parsed, "use_comment_keyword", 0, &config->use_comment_keyword); + config_bool_var(parsed, "lister_whole_word_backspace_when_modified", 0, &config->lister_whole_word_backspace_when_modified); + config_bool_var(parsed, "show_line_number_margins", 0, &config->show_line_number_margins); + + + config_bool_var(parsed, "enable_virtual_whitespace", 0, &config->enable_virtual_whitespace); + config_bool_var(parsed, "enable_code_wrapping", 0, &config->enable_code_wrapping); + config_bool_var(parsed, "automatically_adjust_wrapping", 0, &config->automatically_adjust_wrapping); + config_bool_var(parsed, "automatically_indent_text_on_save", 0, &config->automatically_indent_text_on_save); + config_bool_var(parsed, "automatically_save_changes_on_build", 0, &config->automatically_save_changes_on_build); + config_bool_var(parsed, "automatically_load_project", 0, &config->automatically_load_project); + + config_bool_var(parsed, "indent_with_tabs", 0, &config->indent_with_tabs); + config_int_var(parsed, "indent_width", 0, &config->indent_width); + + config_int_var(parsed, "default_wrap_width", 0, &config->default_wrap_width); + config_int_var(parsed, "default_min_base_width", 0, &config->default_min_base_width); + + config_fixed_string_var(parsed, "default_theme_name", 0, + &config->default_theme_name, config->default_theme_name_space); + config_bool_var(parsed, "highlight_line_at_cursor", 0, &config->highlight_line_at_cursor); + + config_fixed_string_var(parsed, "default_font_name", 0, + &config->default_font_name, config->default_font_name_space); + config_int_var(parsed, "default_font_size", 0, &config->default_font_size); + config_bool_var(parsed, "default_font_hinting", 0, &config->default_font_hinting); + + config_fixed_string_var(parsed, "default_compiler_bat", 0, + &config->default_compiler_bat, config->default_compiler_bat_space); + config_fixed_string_var(parsed, "default_flags_bat", 0, + &config->default_flags_bat, config->default_flags_bat_space); + config_fixed_string_var(parsed, "default_compiler_sh", 0, + &config->default_compiler_sh, config->default_compiler_sh_space); + config_fixed_string_var(parsed, "default_flags_sh", 0, + &config->default_flags_sh, config->default_flags_sh_space); + + config_bool_var(parsed, "lalt_lctrl_is_altgr", 0, &config->lalt_lctrl_is_altgr); + } + + if (!success){ + config_init_default(config); + } + + return(parsed); +} + +function Config* +config_parse__file_handle(Arena *arena, String_Const_u8 file_name, FILE *file, Config_Data *config){ + Config *parsed = 0; + Data data = dump_file_handle(arena, file); + if (data.data != 0){ + parsed = config_parse__data(arena, file_name, SCu8(data), config); + } + else{ + config_init_default(config); + } + return(parsed); +} + +function Config* +config_parse__file_name(Application_Links *app, Arena *arena, char *file_name, Config_Data *config){ + Config *parsed = 0; + b32 success = false; + FILE *file = open_file_try_current_path_then_binary_path(app, file_name); + if (file != 0){ + Data data = dump_file_handle(arena, file); + fclose(file); + if (data.data != 0){ + parsed = config_parse__data(arena, SCu8(file_name), SCu8(data), config); + success = true; + } + } + if (!success){ + config_init_default(config); + } + return(parsed); +} + +#if 0 +function void +init_theme_zero(Theme *theme){ + for (i32 i = 0; i < Stag_COUNT; ++i){ + theme->colors[i] = 0; + } +} + +function Config* +theme_parse__data(Partition *arena, String file_name, String data, Theme_Data *theme){ + theme->name = make_fixed_width_string(theme->space); + copy(&theme->name, "unnamed"); + init_theme_zero(&theme->theme); + + Config *parsed = text_data_to_parsed_data(arena, file_name, data); + if (parsed != 0){ + config_fixed_string_var(parsed, "name", 0, &theme->name, theme->space); + + for (i32 i = 0; i < Stag_COUNT; ++i){ + char *name = style_tag_names[i]; + u32 color = 0; + if (!config_uint_var(parsed, name, 0, &color)){ + color = 0xFFFF00FF; + } + theme->theme.colors[i] = color; + } + } + + return(parsed); +} + +function Config* +theme_parse__file_handle(Partition *arena, String file_name, FILE *file, Theme_Data *theme){ + String data = dump_file_handle(arena, file); + Config *parsed = 0; + if (data.str != 0){ + parsed = theme_parse__data(arena, file_name, data, theme); + } + return(parsed); +} + +function Config* +theme_parse__file_name(Application_Links *app, Partition *arena, + char *file_name, Theme_Data *theme){ + Config *parsed = 0; + FILE *file = open_file_try_current_path_then_binary_path(app, file_name); + if (file != 0){ + String data = dump_file_handle(arena, file); + fclose(file); + parsed = theme_parse__data(arena, make_string_slowly(file_name), data, theme); + } + if (parsed == 0){ + char space[256]; + String str = make_fixed_width_string(space); + append(&str, "Did not find "); + append(&str, file_name); + append(&str, ", color scheme not loaded"); + print_message(app, str.str, str.size); + } + return(parsed); +} +#endif + +//////////////////////////////// + +function void +config_feedback_bool(Arena *arena, List_String_Const_u8 *list, char *name, b32 val){ + string_list_pushf(arena, list, "%s = %s;\n", name, (char*)(val?"true":"false")); +} + +function void +config_feedback_string(Arena *arena, List_String_Const_u8 *list, char *name, String_Const_u8 val){ + val.size = clamp_bot(0, val.size); + string_list_pushf(arena, list, "%s = \"%.*s\";\n", name, string_expand(val)); +} + +function void +config_feedback_string(Arena *arena, List_String_Const_u8 *list, char *name, char *val){ + string_list_pushf(arena, list, "%s = \"%s\";\n", name, val); +} + +function void +config_feedback_extension_list(Arena *arena, List_String_Const_u8 *list, char *name, String_Const_u8_Array *extensions){ + string_list_pushf(arena, list, "%s = \"", name); + for (i32 i = 0; i < extensions->count; ++i){ + String_Const_u8 ext = extensions->strings[i]; + string_list_pushf(arena, list, ".%.*s", string_expand(ext)); + } + string_list_push_u8_lit(arena, list, "\";\n"); +} + +function void +config_feedback_int(Arena *arena, List_String_Const_u8 *list, char *name, i32 val){ + string_list_pushf(arena, list, "%s = %d;\n", name, val); +} + +//////////////////////////////// + +function void +load_config_and_apply(Application_Links *app, Arena *out_arena, Config_Data *config, + i32 override_font_size, b32 override_hinting){ + Scratch_Block scratch(app); + + linalloc_clear(out_arena); + Config *parsed = config_parse__file_name(app, out_arena, "config.4coder", config); + + if (parsed != 0){ + // Top + print_message(app, string_u8_litexpr("Loaded config file:\n")); + + // Errors + String_Const_u8 error_text = config_stringize_errors(scratch, parsed); + if (error_text.str != 0){ + print_message(app, error_text); + } + } + else{ + print_message(app, string_u8_litexpr("Using default config:\n")); + Face_Description description = get_face_description(app, 0); + if (description.font.file_name.str != 0){ + umem size = min(description.font.file_name.size, sizeof(config->default_font_name_space)); + block_copy(config->default_font_name_space, description.font.file_name.str, size); + config->default_font_name.size = size; + } + } + + if (config->default_font_name.size == 0){ +#define M "liberation-mono.ttf" + block_copy(config->default_font_name_space, M, sizeof(M) - 1); + config->default_font_name.size = sizeof(M) - 1; +#undef M + } + + { + // Values + Temp_Memory temp2 = begin_temp(scratch); + List_String_Const_u8 list = {}; + + config_feedback_string(scratch, &list, "user_name", config->user_name); + config_feedback_extension_list(scratch, &list, "treat_as_code", &config->code_exts); + + config_feedback_string(scratch, &list, "mode", config->mode); + + config_feedback_bool(scratch, &list, "use_scroll_bars", config->use_scroll_bars); + config_feedback_bool(scratch, &list, "use_file_bars", config->use_file_bars); + config_feedback_bool(scratch, &list, "hide_file_bar_in_ui", config->hide_file_bar_in_ui); + config_feedback_bool(scratch, &list, "use_error_highlight", config->use_error_highlight); + config_feedback_bool(scratch, &list, "use_jump_highlight", config->use_jump_highlight); + config_feedback_bool(scratch, &list, "use_scope_highlight", config->use_scope_highlight); + config_feedback_bool(scratch, &list, "use_paren_helper", config->use_paren_helper); + config_feedback_bool(scratch, &list, "use_comment_keyword", config->use_comment_keyword); + config_feedback_bool(scratch, &list, "lister_whole_word_backspace_when_modified", config->lister_whole_word_backspace_when_modified); + config_feedback_bool(scratch, &list, "show_line_number_margins", config->show_line_number_margins); + + config_feedback_bool(scratch, &list, "enable_virtual_whitespace", config->enable_virtual_whitespace); + config_feedback_bool(scratch, &list, "enable_code_wrapping", config->enable_code_wrapping); + config_feedback_bool(scratch, &list, "automatically_indent_text_on_save", config->automatically_indent_text_on_save); + config_feedback_bool(scratch, &list, "automatically_save_changes_on_build", config->automatically_save_changes_on_build); + config_feedback_bool(scratch, &list, "automatically_adjust_wrapping", config->automatically_adjust_wrapping); + config_feedback_bool(scratch, &list, "automatically_load_project", config->automatically_load_project); + + config_feedback_bool(scratch, &list, "indent_with_tabs", config->indent_with_tabs); + config_feedback_int(scratch, &list, "indent_width", config->indent_width); + + config_feedback_int(scratch, &list, "default_wrap_width", config->default_wrap_width); + config_feedback_int(scratch, &list, "default_min_base_width", config->default_min_base_width); + + config_feedback_string(scratch, &list, "default_theme_name", config->default_theme_name); + config_feedback_bool(scratch, &list, "highlight_line_at_cursor", config->highlight_line_at_cursor); + + config_feedback_string(scratch, &list, "default_font_name", config->default_font_name); + config_feedback_int(scratch, &list, "default_font_size", config->default_font_size); + config_feedback_bool(scratch, &list, "default_font_hinting", config->default_font_hinting); + + config_feedback_string(scratch, &list, "default_compiler_bat", config->default_compiler_bat); + config_feedback_string(scratch, &list, "default_flags_bat", config->default_flags_bat); + config_feedback_string(scratch, &list, "default_compiler_sh", config->default_compiler_sh); + config_feedback_string(scratch, &list, "default_flags_sh", config->default_flags_sh); + + config_feedback_bool(scratch, &list, "lalt_lctrl_is_altgr", config->lalt_lctrl_is_altgr); + + string_list_push_u8_lit(scratch, &list, "\n"); + String_Const_u8 message = string_list_flatten(scratch, list); + print_message(app, message); + end_temp(temp2); + } + + // Apply config + change_mode(app, config->mode); + global_set_setting(app, GlobalSetting_LAltLCtrlIsAltGr, config->lalt_lctrl_is_altgr); + + //change_theme(app, config->default_theme_name.str, config->default_theme_name.size); + + Face_Description description = {}; + description.font.file_name = config->default_font_name; + if (override_font_size != 0){ + description.parameters.pt_size = override_font_size; + } + else{ + description.parameters.pt_size = config->default_font_size; + } + description.parameters.hinting = config->default_font_hinting || override_hinting; + description.font.in_4coder_font_folder = true; + if (!modify_global_face_by_description(app, description)){ + description.font.in_4coder_font_folder = false; + modify_global_face_by_description(app, description); + } +} + +#if 0 +function void +load_theme_file_into_live_set(Application_Links *app, Partition *scratch, char *file_name){ + Temp_Memory temp = begin_temp_memory(scratch); + Theme_Data theme = {}; + Config *config = theme_parse__file_name(app, scratch, file_name, &theme); + String error_text = config_stringize_errors(scratch, config); + print_message(app, error_text.str, error_text.size); + end_temp_memory(temp); + create_theme(app, &theme.theme, theme.name.str, theme.name.size); +} + +function void +load_folder_of_themes_into_live_set(Application_Links *app, Partition *scratch, + char *folder_name){ + char path_space[512]; + String path = make_fixed_width_string(path_space); + path.size = get_4ed_path(app, path_space, sizeof(path_space)); + append(&path, folder_name); + + if (path.size < path.memory_size){ + File_List list = get_file_list(app, path.str, path.size); + for (u32 i = 0; i < list.count; ++i){ + File_Info *info = &list.infos[i]; + if (info->folder){ + continue; + } + String info_file_name = make_string(info->filename, info->filename_len); + char file_name_space[512]; + String file_name = make_fixed_width_string(file_name_space); + copy(&file_name, path); + append(&file_name, "/"); + append(&file_name, info_file_name); + if (terminate_with_null(&file_name)){ + load_theme_file_into_live_set(app, scratch, file_name.str); + } + } + free_file_list(app, list); + } +} +#endif + +// BOTTOM + diff --git a/custom/4coder_default_bindings.cpp b/custom/4coder_default_bindings.cpp index 7619a89b..d636362f 100644 --- a/custom/4coder_default_bindings.cpp +++ b/custom/4coder_default_bindings.cpp @@ -19,6 +19,7 @@ custom_layer_init(Application_Links *app){ mapping_init(tctx, &framework_mapping); setup_default_mapping(&framework_mapping); global_prof_init(); + async_task_handler_init(app); } #endif diff --git a/custom/4coder_default_framework.cpp b/custom/4coder_default_framework.cpp index 708391c5..44c18e5d 100644 --- a/custom/4coder_default_framework.cpp +++ b/custom/4coder_default_framework.cpp @@ -453,6 +453,7 @@ default_4coder_initialize(Application_Links *app, String_Const_u8_Array file_nam buffer_map_id = managed_id_declare(app, SCu8("DEFAULT.buffer_map_id" )); buffer_eol_setting = managed_id_declare(app, SCu8("DEFAULT.buffer_eol_setting")); + buffer_lex_task = managed_id_declare(app, SCu8("DEFAULT.buffer_lex_task")); sticky_jump_marker_handle = managed_id_declare(app, SCu8("DEFAULT.sticky_jump_marker_handle")); attachment_tokens = managed_id_declare(app, SCu8("DEFAULT.tokens")); diff --git a/custom/4coder_default_framework_variables.cpp b/custom/4coder_default_framework_variables.cpp index 455fd789..61f538b5 100644 --- a/custom/4coder_default_framework_variables.cpp +++ b/custom/4coder_default_framework_variables.cpp @@ -44,6 +44,7 @@ global Managed_ID view_call_next = 0; global Managed_ID buffer_map_id = 0; global Managed_ID buffer_eol_setting = 0; +global Managed_ID buffer_lex_task = 0; global Managed_ID sticky_jump_marker_handle = 0; diff --git a/custom/4coder_default_hooks.cpp b/custom/4coder_default_hooks.cpp index 5a4efa5a..bc883130 100644 --- a/custom/4coder_default_hooks.cpp +++ b/custom/4coder_default_hooks.cpp @@ -92,7 +92,7 @@ CUSTOM_DOC("Input consumption loop for default view behavior") Managed_Scope scope = view_get_managed_scope(app, view); Custom_Command_Function** next_call = 0; - + call_again: next_call = scope_attachment(app, scope, view_call_next, Custom_Command_Function*); *next_call = 0; @@ -539,11 +539,17 @@ BUFFER_NAME_RESOLVER_SIG(default_buffer_name_resolution){ } function void -do_full_lex(Application_Links *app, Buffer_ID buffer_id){ - Scratch_Block scratch(app); +do_full_lex_async__inner(Application_Links *app, Buffer_ID buffer_id){ + Thread_Context *tctx = get_thread_context(app); + Scratch_Block scratch(tctx); + + system_acquire_global_frame_mutex(tctx); String_Const_u8 contents = push_whole_buffer(app, scratch, buffer_id); + system_release_global_frame_mutex(tctx); + Token_List list = lex_full_input_cpp(scratch, contents); + system_acquire_global_frame_mutex(tctx); Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); Base_Allocator *allocator = managed_scope_allocator(app, scope); Token_Array tokens = {}; @@ -554,6 +560,15 @@ do_full_lex(Application_Links *app, Buffer_ID buffer_id){ Token_Array *tokens_ptr = scope_attachment(app, scope, attachment_tokens, Token_Array); block_copy_struct(tokens_ptr, &tokens); + system_release_global_frame_mutex(tctx); +} + +function void +do_full_lex_async(Application_Links *app, Data data){ + if (data.size == sizeof(Buffer_ID)){ + Buffer_ID buffer = *(Buffer_ID*)data.data; + do_full_lex_async__inner(app, buffer); + } } BUFFER_HOOK_SIG(default_begin_buffer){ @@ -643,6 +658,7 @@ BUFFER_HOOK_SIG(default_begin_buffer){ first_call = false; buffer_map_id = managed_id_declare(app, SCu8("DEFAULT.buffer_map_id")); buffer_eol_setting = managed_id_declare(app, SCu8("DEFAULT.buffer_eol_setting")); + buffer_lex_task = managed_id_declare(app, SCu8("DEFAULT.buffer_lex_task")); } Command_Map_ID map_id = (treat_as_code)?(default_code_map):(mapid_file); @@ -672,10 +688,11 @@ BUFFER_HOOK_SIG(default_begin_buffer){ } if (use_lexer){ - do_full_lex(app, buffer_id); + Async_Task lex_task = async_task_no_dep(do_full_lex_async, make_data_struct(&buffer_id)); + Async_Task *lex_task_ptr = scope_attachment(app, scope, buffer_lex_task, Async_Task); + *lex_task_ptr = lex_task; } - // no meaning for return return(0); } @@ -778,7 +795,9 @@ BUFFER_EDIT_RANGE_SIG(default_buffer_edit_range){ else{ scratch.restore(); base_free(allocator, ptr->tokens); - do_full_lex(app, buffer_id); + Async_Task lex_task = async_task_no_dep(do_full_lex_async, make_data_struct(&buffer_id)); + Async_Task *lex_task_ptr = scope_attachment(app, scope, buffer_lex_task, Async_Task); + *lex_task_ptr = lex_task; } #if 0 diff --git a/custom/4coder_default_include.cpp b/custom/4coder_default_include.cpp index aee98a20..85d89273 100644 --- a/custom/4coder_default_include.cpp +++ b/custom/4coder_default_include.cpp @@ -26,6 +26,7 @@ #include "4coder_system_allocator.cpp" #include "4coder_profile.h" +#include "4coder_async_tasks.h" #include "4coder_token.h" #include "generated/lexer_cpp.h" #include "4coder_string_match.h" @@ -64,6 +65,7 @@ #include "4coder_log.cpp" #include "4coder_hash_functions.cpp" #include "4coder_table.cpp" +#include "4coder_async_tasks.cpp" #include "4coder_string_match.cpp" #include "4coder_buffer_seek_constructors.cpp" diff --git a/custom/4coder_profile_inspect.cpp b/custom/4coder_profile_inspect.cpp index 9b75b925..e64636ee 100644 --- a/custom/4coder_profile_inspect.cpp +++ b/custom/4coder_profile_inspect.cpp @@ -85,8 +85,6 @@ profile_parse_record(Arena *arena, Profile_Inspection *insp, slot = profile_parse_get_slot(arena, insp, location, name); } else if (record->id == id){ - String_Const_u8 close_location = record->location; - String_Const_u8 close_name = record->name; slot = profile_parse_get_slot(arena, insp, location, name); node->time.max = record->time; node->closed = true; diff --git a/custom/4coder_types.h b/custom/4coder_types.h index f16f2c48..07403dae 100644 --- a/custom/4coder_types.h +++ b/custom/4coder_types.h @@ -15,6 +15,7 @@ struct Application_Links{ void *cmd_context; + void *current_thread; void *current_coroutine; i32 type_coroutine; }; @@ -373,14 +374,14 @@ STRUCT Theme_Color{ //int_color colors[Stag_COUNT]; //}; -TYPEDEF u32 Face_ID; +typedef u32 Face_ID; -STRUCT Font_Load_Location{ +struct Font_Load_Location{ String_Const_u8 file_name; b32 in_4coder_font_folder; }; -STRUCT Face_Load_Parameters{ +struct Face_Load_Parameters{ u32 pt_size; b32 bold; b32 italic; @@ -388,7 +389,7 @@ STRUCT Face_Load_Parameters{ b32 hinting; }; -STRUCT Face_Description{ +struct Face_Description{ Font_Load_Location font; Face_Load_Parameters parameters; }; diff --git a/custom/generated/command_metadata.h b/custom/generated/command_metadata.h index a43cec1c..3772485e 100644 --- a/custom/generated/command_metadata.h +++ b/custom/generated/command_metadata.h @@ -233,217 +233,217 @@ i32 source_name_len; i32 line_number; }; static Command_Metadata fcoder_metacmd_table[211] = { -{ PROC_LINKS(default_view_input_handler, 0), false, "default_view_input_handler", 26, "Input consumption loop for default view behavior", 48, "c:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 56 }, -{ PROC_LINKS(profile_enable, 0), false, "profile_enable", 14, "Allow 4coder's self profiler to gather new profiling information.", 65, "c:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 196 }, -{ PROC_LINKS(profile_disable, 0), false, "profile_disable", 15, "Prevent 4coder's self profiler from gathering new profiling information.", 72, "c:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 202 }, -{ PROC_LINKS(profile_clear, 0), false, "profile_clear", 13, "Clear all profiling information from 4coder's self profiler.", 60, "c:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 208 }, -{ PROC_LINKS(seek_beginning_of_textual_line, 0), false, "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "c:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2106 }, -{ PROC_LINKS(seek_end_of_textual_line, 0), false, "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "c:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2112 }, -{ PROC_LINKS(seek_beginning_of_line, 0), false, "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "c:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2118 }, -{ PROC_LINKS(seek_end_of_line, 0), false, "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "c:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2124 }, -{ PROC_LINKS(goto_beginning_of_file, 0), false, "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "c:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2130 }, -{ PROC_LINKS(goto_end_of_file, 0), false, "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "c:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2138 }, -{ PROC_LINKS(change_active_panel, 0), false, "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 270 }, -{ PROC_LINKS(change_active_panel_backwards, 0), false, "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 280 }, -{ PROC_LINKS(open_panel_vsplit, 0), false, "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 290 }, -{ PROC_LINKS(open_panel_hsplit, 0), false, "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 300 }, -{ PROC_LINKS(suppress_mouse, 0), false, "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 365 }, -{ PROC_LINKS(allow_mouse, 0), false, "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 371 }, -{ PROC_LINKS(toggle_mouse, 0), false, "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 377 }, -{ PROC_LINKS(set_mode_to_original, 0), false, "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 383 }, -{ PROC_LINKS(set_mode_to_notepad_like, 0), false, "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 389 }, -{ PROC_LINKS(toggle_highlight_line_at_cursor, 0), false, "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 395 }, -{ PROC_LINKS(toggle_highlight_enclosing_scopes, 0), false, "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 401 }, -{ PROC_LINKS(toggle_paren_matching_helper, 0), false, "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 407 }, -{ PROC_LINKS(toggle_fullscreen, 0), false, "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 413 }, -{ PROC_LINKS(write_text_input, 0), false, "write_text_input", 16, "Inserts whatever character was used to trigger this command.", 60, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 58 }, -{ PROC_LINKS(write_space, 0), false, "write_space", 11, "Inserts an underscore.", 22, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 66 }, -{ PROC_LINKS(write_underscore, 0), false, "write_underscore", 16, "Inserts an underscore.", 22, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 72 }, -{ PROC_LINKS(delete_char, 0), false, "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 78 }, -{ PROC_LINKS(backspace_char, 0), false, "backspace_char", 14, "Deletes the character to the left of the cursor.", 48, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 95 }, -{ PROC_LINKS(set_mark, 0), false, "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 114 }, -{ PROC_LINKS(cursor_mark_swap, 0), false, "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 123 }, -{ PROC_LINKS(delete_range, 0), false, "delete_range", 12, "Deletes the text in the range between the cursor and the mark.", 62, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 133 }, -{ PROC_LINKS(backspace_alpha_numeric_boundary, 0), false, "backspace_alpha_numeric_boundary", 32, "Delete characters between the cursor position and the first alphanumeric boundary to the left.", 94, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 153 }, -{ PROC_LINKS(delete_alpha_numeric_boundary, 0), false, "delete_alpha_numeric_boundary", 29, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 161 }, -{ PROC_LINKS(snipe_backward_whitespace_or_token_boundary, 0), false, "snipe_backward_whitespace_or_token_boundary", 43, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 181 }, -{ PROC_LINKS(snipe_forward_whitespace_or_token_boundary, 0), false, "snipe_forward_whitespace_or_token_boundary", 42, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 189 }, -{ PROC_LINKS(center_view, 0), false, "center_view", 11, "Centers the view vertically on the line on which the cursor sits.", 65, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 199 }, -{ PROC_LINKS(left_adjust_view, 0), false, "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 213 }, -{ PROC_LINKS(click_set_cursor_and_mark, 0), false, "click_set_cursor_and_mark", 25, "Sets the cursor position and mark to the mouse position.", 56, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 225 }, -{ PROC_LINKS(click_set_cursor, 0), false, "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 235 }, -{ PROC_LINKS(click_set_cursor_if_lbutton, 0), false, "click_set_cursor_if_lbutton", 27, "If the mouse left button is pressed, sets the cursor position to the mouse position.", 84, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 245 }, -{ PROC_LINKS(click_set_mark, 0), false, "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 257 }, -{ PROC_LINKS(mouse_wheel_scroll, 0), false, "mouse_wheel_scroll", 18, "Reads the scroll wheel value from the mouse state and scrolls accordingly.", 74, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 267 }, -{ PROC_LINKS(move_up, 0), false, "move_up", 7, "Moves the cursor up one line.", 29, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 321 }, -{ PROC_LINKS(move_down, 0), false, "move_down", 9, "Moves the cursor down one line.", 31, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 327 }, -{ PROC_LINKS(move_up_10, 0), false, "move_up_10", 10, "Moves the cursor up ten lines.", 30, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 333 }, -{ PROC_LINKS(move_down_10, 0), false, "move_down_10", 12, "Moves the cursor down ten lines.", 32, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 339 }, -{ PROC_LINKS(move_down_textual, 0), false, "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 345 }, -{ PROC_LINKS(page_up, 0), false, "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 355 }, -{ PROC_LINKS(page_down, 0), false, "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 363 }, -{ PROC_LINKS(move_up_to_blank_line, 0), false, "move_up_to_blank_line", 21, "Seeks the cursor up to the next blank line.", 43, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 393 }, -{ PROC_LINKS(move_down_to_blank_line, 0), false, "move_down_to_blank_line", 23, "Seeks the cursor down to the next blank line.", 45, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 399 }, -{ PROC_LINKS(move_up_to_blank_line_skip_whitespace, 0), false, "move_up_to_blank_line_skip_whitespace", 37, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 405 }, -{ PROC_LINKS(move_down_to_blank_line_skip_whitespace, 0), false, "move_down_to_blank_line_skip_whitespace", 39, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 411 }, -{ PROC_LINKS(move_up_to_blank_line_end, 0), false, "move_up_to_blank_line_end", 25, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 417 }, -{ PROC_LINKS(move_down_to_blank_line_end, 0), false, "move_down_to_blank_line_end", 27, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 423 }, -{ PROC_LINKS(move_left, 0), false, "move_left", 9, "Moves the cursor one character to the left.", 43, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 429 }, -{ PROC_LINKS(move_right, 0), false, "move_right", 10, "Moves the cursor one character to the right.", 44, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 441 }, -{ PROC_LINKS(move_right_whitespace_boundary, 0), false, "move_right_whitespace_boundary", 30, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 463 }, -{ PROC_LINKS(move_left_whitespace_boundary, 0), false, "move_left_whitespace_boundary", 29, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 471 }, -{ PROC_LINKS(move_right_token_boundary, 0), false, "move_right_token_boundary", 25, "Seek right for the next end of a token.", 39, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 479 }, -{ PROC_LINKS(move_left_token_boundary, 0), false, "move_left_token_boundary", 24, "Seek left for the next beginning of a token.", 44, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 487 }, -{ PROC_LINKS(move_right_whitespace_or_token_boundary, 0), false, "move_right_whitespace_or_token_boundary", 39, "Seek right for the next end of a token or boundary between whitespace and non-whitespace.", 89, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 495 }, -{ PROC_LINKS(move_left_whitespace_or_token_boundary, 0), false, "move_left_whitespace_or_token_boundary", 38, "Seek left for the next end of a token or boundary between whitespace and non-whitespace.", 88, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 503 }, -{ PROC_LINKS(move_right_alpha_numeric_boundary, 0), false, "move_right_alpha_numeric_boundary", 33, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 511 }, -{ PROC_LINKS(move_left_alpha_numeric_boundary, 0), false, "move_left_alpha_numeric_boundary", 32, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 519 }, -{ PROC_LINKS(move_right_alpha_numeric_or_camel_boundary, 0), false, "move_right_alpha_numeric_or_camel_boundary", 42, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 527 }, -{ PROC_LINKS(move_left_alpha_numeric_or_camel_boundary, 0), false, "move_left_alpha_numeric_or_camel_boundary", 41, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 535 }, -{ PROC_LINKS(select_all, 0), false, "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 545 }, -{ PROC_LINKS(to_uppercase, 0), false, "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 558 }, -{ PROC_LINKS(to_lowercase, 0), false, "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 571 }, -{ PROC_LINKS(clean_all_lines, 0), false, "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 584 }, -{ PROC_LINKS(basic_change_active_panel, 0), false, "basic_change_active_panel", 25, "Change the currently active panel, moving to the panel with the next highest view_id. Will not skipe the build panel if it is open.", 132, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 618 }, -{ PROC_LINKS(close_panel, 0), false, "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 626 }, -{ PROC_LINKS(show_scrollbar, 0), false, "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 635 }, -{ PROC_LINKS(hide_scrollbar, 0), false, "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 642 }, -{ PROC_LINKS(show_filebar, 0), false, "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 649 }, -{ PROC_LINKS(hide_filebar, 0), false, "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 656 }, -{ PROC_LINKS(toggle_filebar, 0), false, "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 663 }, -{ PROC_LINKS(toggle_fps_meter, 0), false, "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 672 }, -{ PROC_LINKS(increase_face_size, 0), false, "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 678 }, -{ PROC_LINKS(decrease_face_size, 0), false, "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 689 }, -{ PROC_LINKS(mouse_wheel_change_face_size, 0), false, "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, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 700 }, -{ PROC_LINKS(toggle_virtual_whitespace, 0), false, "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 717 }, -{ PROC_LINKS(toggle_show_whitespace, 0), false, "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 726 }, -{ PROC_LINKS(toggle_line_numbers, 0), false, "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 735 }, -{ PROC_LINKS(exit_4coder, 0), false, "exit_4coder", 11, "Attempts to close 4coder.", 25, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 741 }, -{ PROC_LINKS(goto_line, 0), false, "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 749 }, -{ PROC_LINKS(search, 0), false, "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 977 }, -{ PROC_LINKS(reverse_search, 0), false, "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 983 }, -{ PROC_LINKS(search_identifier, 0), false, "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 989 }, -{ PROC_LINKS(reverse_search_identifier, 0), false, "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 995 }, -{ PROC_LINKS(replace_in_range, 0), false, "replace_in_range", 16, "Queries the user for a needle and string. Replaces all occurences of needle with string in the range between cursor and the mark in the active buffer.", 150, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1042 }, -{ PROC_LINKS(replace_in_buffer, 0), false, "replace_in_buffer", 17, "Queries the user for a needle and string. Replaces all occurences of needle with string in the active buffer.", 109, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1051 }, -{ PROC_LINKS(replace_in_all_buffers, 0), false, "replace_in_all_buffers", 22, "Queries the user for a needle and string. Replaces all occurences of needle with string in all editable buffers.", 112, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1060 }, -{ PROC_LINKS(query_replace, 0), false, "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1150 }, -{ PROC_LINKS(query_replace_identifier, 0), false, "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1171 }, -{ PROC_LINKS(query_replace_selection, 0), false, "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1187 }, -{ PROC_LINKS(save_all_dirty_buffers, 0), false, "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1222 }, -{ PROC_LINKS(delete_file_query, 0), false, "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1247 }, -{ PROC_LINKS(save_to_query, 0), false, "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1291 }, -{ PROC_LINKS(rename_file_query, 0), false, "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, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1324 }, -{ PROC_LINKS(make_directory_query, 0), false, "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1362 }, -{ PROC_LINKS(move_line_up, 0), false, "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1396 }, -{ PROC_LINKS(move_line_down, 0), false, "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1402 }, -{ PROC_LINKS(duplicate_line, 0), false, "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1408 }, -{ PROC_LINKS(delete_line, 0), false, "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1422 }, -{ PROC_LINKS(open_file_in_quotes, 0), false, "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1487 }, -{ PROC_LINKS(open_matching_file_cpp, 0), false, "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1519 }, -{ PROC_LINKS(view_buffer_other_panel, 0), false, "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1532 }, -{ PROC_LINKS(swap_buffers_between_panels, 0), false, "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1544 }, -{ PROC_LINKS(kill_buffer, 0), false, "kill_buffer", 11, "Kills the current buffer.", 25, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1578 }, -{ PROC_LINKS(save, 0), false, "save", 4, "Saves the current buffer.", 25, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1586 }, -{ PROC_LINKS(reopen, 0), false, "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1596 }, -{ PROC_LINKS(undo, 0), false, "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1825 }, -{ PROC_LINKS(redo, 0), false, "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1838 }, -{ PROC_LINKS(undo_all_buffers, 0), false, "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1852 }, -{ PROC_LINKS(redo_all_buffers, 0), false, "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1923 }, -{ PROC_LINKS(open_in_other, 0), false, "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2024 }, -{ PROC_LINKS(default_file_externally_modified, 0), false, "default_file_externally_modified", 32, "Notes the external modification of attached files by printing a message.", 72, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2031 }, -{ PROC_LINKS(set_eol_mode_to_crlf, 0), false, "set_eol_mode_to_crlf", 20, "Puts the buffer in crlf line ending mode.", 41, "c:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 80 }, -{ PROC_LINKS(set_eol_mode_to_lf, 0), false, "set_eol_mode_to_lf", 18, "Puts the buffer in lf line ending mode.", 39, "c:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 91 }, -{ PROC_LINKS(set_eol_mode_to_binary, 0), false, "set_eol_mode_to_binary", 22, "Puts the buffer in bin line ending mode.", 40, "c:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 102 }, -{ PROC_LINKS(set_eol_mode_from_contents, 0), false, "set_eol_mode_from_contents", 26, "Sets the buffer's line ending mode to match the contents of the buffer.", 71, "c:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 113 }, -{ PROC_LINKS(interactive_switch_buffer, 0), true, "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 477 }, -{ PROC_LINKS(interactive_kill_buffer, 0), true, "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 496 }, -{ PROC_LINKS(interactive_open_or_new, 0), true, "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 567 }, -{ PROC_LINKS(interactive_new, 0), true, "interactive_new", 15, "Interactively creates a new file.", 33, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 606 }, -{ PROC_LINKS(interactive_open, 0), true, "interactive_open", 16, "Interactively opens a file.", 27, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 639 }, -{ PROC_LINKS(command_lister, 0), true, "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 702 }, -{ PROC_LINKS(auto_indent_whole_file, 0), false, "auto_indent_whole_file", 22, "Audo-indents the entire current buffer.", 39, "c:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 356 }, -{ PROC_LINKS(auto_indent_line_at_cursor, 0), false, "auto_indent_line_at_cursor", 26, "Auto-indents the line on which the cursor sits.", 47, "c:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 365 }, -{ PROC_LINKS(auto_indent_range, 0), false, "auto_indent_range", 17, "Auto-indents the range between the cursor and the mark.", 55, "c:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 375 }, -{ PROC_LINKS(write_text_and_auto_indent, 0), false, "write_text_and_auto_indent", 26, "Inserts text and auto-indents the line on which the cursor sits if any of the text contains 'layout punctuation' such as ;:{}()[]# and new lines.", 145, "c:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 385 }, -{ PROC_LINKS(list_all_locations, 0), false, "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 166 }, -{ PROC_LINKS(list_all_substring_locations, 0), false, "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 172 }, -{ PROC_LINKS(list_all_locations_case_insensitive, 0), false, "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 178 }, -{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), false, "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 184 }, -{ PROC_LINKS(list_all_locations_of_identifier, 0), false, "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 190 }, -{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), false, "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 196 }, -{ PROC_LINKS(list_all_locations_of_selection, 0), false, "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 202 }, -{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), false, "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 208 }, -{ PROC_LINKS(list_all_locations_of_type_definition, 0), false, "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 214 }, -{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), false, "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 222 }, -{ PROC_LINKS(word_complete, 0), false, "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 391 }, -{ PROC_LINKS(goto_jump_at_cursor, 0), false, "goto_jump_at_cursor", 19, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 346 }, -{ PROC_LINKS(goto_jump_at_cursor_same_panel, 0), false, "goto_jump_at_cursor_same_panel", 30, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list.", 167, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 373 }, -{ PROC_LINKS(goto_next_jump, 0), false, "goto_next_jump", 14, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 462 }, -{ PROC_LINKS(goto_prev_jump, 0), false, "goto_prev_jump", 14, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 479 }, -{ PROC_LINKS(goto_next_jump_no_skips, 0), false, "goto_next_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 492 }, -{ PROC_LINKS(goto_prev_jump_no_skips, 0), false, "goto_prev_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 509 }, -{ PROC_LINKS(goto_first_jump, 0), false, "goto_first_jump", 15, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 523 }, -{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), false, "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 540 }, -{ PROC_LINKS(if_read_only_goto_position, 0), false, "if_read_only_goto_position", 26, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 562 }, -{ PROC_LINKS(if_read_only_goto_position_same_panel, 0), false, "if_read_only_goto_position_same_panel", 37, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 579 }, -{ PROC_LINKS(view_jump_list_with_lister, 0), false, "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "c:\\4ed\\code\\custom\\4coder_jump_lister.cpp", 41, 104 }, -{ PROC_LINKS(show_the_log_graph, 0), true, "show_the_log_graph", 18, "Parses *log* and displays the 'log graph' UI", 44, "c:\\4ed\\code\\custom\\4coder_log_parser.cpp", 40, 990 }, -{ PROC_LINKS(copy, 0), false, "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "c:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 19 }, -{ PROC_LINKS(cut, 0), false, "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "c:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 28 }, -{ PROC_LINKS(paste, 0), false, "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "c:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 39 }, -{ PROC_LINKS(paste_next, 0), false, "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "c:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 73 }, -{ PROC_LINKS(paste_and_indent, 0), false, "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "c:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 115 }, -{ PROC_LINKS(paste_next_and_indent, 0), false, "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "c:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 122 }, -{ PROC_LINKS(execute_previous_cli, 0), false, "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "c:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 7 }, -{ PROC_LINKS(execute_any_cli, 0), false, "execute_any_cli", 15, "Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.", 133, "c:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 22 }, -{ PROC_LINKS(build_search, 0), false, "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "c:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 128 }, -{ PROC_LINKS(build_in_build_panel, 0), false, "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "c:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 163 }, -{ PROC_LINKS(close_build_panel, 0), false, "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "c:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 178 }, -{ PROC_LINKS(change_to_build_panel, 0), false, "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "c:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 184 }, -{ PROC_LINKS(close_all_code, 0), false, "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 917 }, -{ PROC_LINKS(open_all_code, 0), false, "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 923 }, -{ PROC_LINKS(open_all_code_recursive, 0), false, "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 929 }, -{ PROC_LINKS(load_project, 0), false, "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, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 937 }, -{ PROC_LINKS(project_fkey_command, 0), false, "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 944 }, -{ PROC_LINKS(project_go_to_root_directory, 0), false, "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 969 }, -{ PROC_LINKS(setup_new_project, 0), false, "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1303 }, -{ PROC_LINKS(setup_build_bat, 0), false, "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1310 }, -{ PROC_LINKS(setup_build_sh, 0), false, "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1316 }, -{ PROC_LINKS(setup_build_bat_and_sh, 0), false, "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1322 }, -{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1338 }, -{ PROC_LINKS(list_all_functions_current_buffer, 0), false, "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "c:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 267 }, -{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), false, "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "c:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 277 }, -{ PROC_LINKS(list_all_functions_all_buffers, 0), false, "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "c:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 289 }, -{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), false, "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "c:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 295 }, -{ PROC_LINKS(select_surrounding_scope, 0), false, "select_surrounding_scope", 24, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 7 }, -{ PROC_LINKS(select_next_scope_absolute, 0), false, "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 32 }, -{ PROC_LINKS(select_next_scope_after_current, 0), false, "select_next_scope_after_current", 31, "Finds the first scope started by '{' after the mark and puts the cursor and mark on the '{' and '}'. This command is meant to be used after a scope is already selected so that it will have the effect of selecting the next scope after the current scope.", 253, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 41 }, -{ PROC_LINKS(select_prev_scope_absolute, 0), false, "select_prev_scope_absolute", 26, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 50 }, -{ PROC_LINKS(place_in_scope, 0), false, "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 67 }, -{ PROC_LINKS(delete_current_scope, 0), false, "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 73 }, -{ PROC_LINKS(open_long_braces, 0), false, "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 46 }, -{ PROC_LINKS(open_long_braces_semicolon, 0), false, "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 54 }, -{ PROC_LINKS(open_long_braces_break, 0), false, "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 62 }, -{ PROC_LINKS(if0_off, 0), false, "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 70 }, -{ PROC_LINKS(write_todo, 0), false, "write_todo", 10, "At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder.", 99, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 76 }, -{ PROC_LINKS(write_hack, 0), false, "write_hack", 10, "At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.", 99, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 82 }, -{ PROC_LINKS(write_note, 0), false, "write_note", 10, "At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.", 99, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 88 }, -{ PROC_LINKS(write_block, 0), false, "write_block", 11, "At the cursor, insert a block comment.", 38, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 94 }, -{ PROC_LINKS(write_zero_struct, 0), false, "write_zero_struct", 17, "At the cursor, insert a ' = {};'.", 33, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 100 }, -{ PROC_LINKS(comment_line, 0), false, "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 125 }, -{ PROC_LINKS(uncomment_line, 0), false, "uncomment_line", 14, "If present, delete '//' at the beginning of the line after leading whitespace.", 78, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 137 }, -{ PROC_LINKS(comment_line_toggle, 0), false, "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 149 }, -{ PROC_LINKS(snippet_lister, 0), false, "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 231 }, -{ PROC_LINKS(miblo_increment_basic, 0), false, "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "c:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 29 }, -{ PROC_LINKS(miblo_decrement_basic, 0), false, "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "c:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 44 }, -{ PROC_LINKS(miblo_increment_time_stamp, 0), false, "miblo_increment_time_stamp", 26, "Increment a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "c:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 231 }, -{ PROC_LINKS(miblo_decrement_time_stamp, 0), false, "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "c:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 237 }, -{ PROC_LINKS(miblo_increment_time_stamp_minute, 0), false, "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, "c:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 243 }, -{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), false, "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, "c:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 249 }, -{ PROC_LINKS(profile_inspect, 0), true, "profile_inspect", 15, "Inspect all currently collected profiling information in 4coder's self profiler.", 80, "c:\\4ed\\code\\custom\\4coder_profile_inspect.cpp", 45, 377 }, -{ PROC_LINKS(default_startup, 0), false, "default_startup", 15, "Default command for responding to a startup event", 49, "c:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 7 }, -{ PROC_LINKS(default_try_exit, 0), false, "default_try_exit", 16, "Default command for responding to a try-exit event", 50, "c:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 21 }, +{ PROC_LINKS(default_view_input_handler, 0), false, "default_view_input_handler", 26, "Input consumption loop for default view behavior", 48, "w:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 56 }, +{ PROC_LINKS(profile_enable, 0), false, "profile_enable", 14, "Allow 4coder's self profiler to gather new profiling information.", 65, "w:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 196 }, +{ PROC_LINKS(profile_disable, 0), false, "profile_disable", 15, "Prevent 4coder's self profiler from gathering new profiling information.", 72, "w:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 202 }, +{ PROC_LINKS(profile_clear, 0), false, "profile_clear", 13, "Clear all profiling information from 4coder's self profiler.", 60, "w:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 208 }, +{ PROC_LINKS(seek_beginning_of_textual_line, 0), false, "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2106 }, +{ PROC_LINKS(seek_end_of_textual_line, 0), false, "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2112 }, +{ PROC_LINKS(seek_beginning_of_line, 0), false, "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2118 }, +{ PROC_LINKS(seek_end_of_line, 0), false, "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2124 }, +{ PROC_LINKS(goto_beginning_of_file, 0), false, "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2130 }, +{ PROC_LINKS(goto_end_of_file, 0), false, "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2138 }, +{ PROC_LINKS(change_active_panel, 0), false, "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 270 }, +{ PROC_LINKS(change_active_panel_backwards, 0), false, "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 280 }, +{ PROC_LINKS(open_panel_vsplit, 0), false, "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 290 }, +{ PROC_LINKS(open_panel_hsplit, 0), false, "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 300 }, +{ PROC_LINKS(suppress_mouse, 0), false, "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 365 }, +{ PROC_LINKS(allow_mouse, 0), false, "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 371 }, +{ PROC_LINKS(toggle_mouse, 0), false, "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 377 }, +{ PROC_LINKS(set_mode_to_original, 0), false, "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 383 }, +{ PROC_LINKS(set_mode_to_notepad_like, 0), false, "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 389 }, +{ PROC_LINKS(toggle_highlight_line_at_cursor, 0), false, "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 395 }, +{ PROC_LINKS(toggle_highlight_enclosing_scopes, 0), false, "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 401 }, +{ PROC_LINKS(toggle_paren_matching_helper, 0), false, "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 407 }, +{ PROC_LINKS(toggle_fullscreen, 0), false, "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 413 }, +{ PROC_LINKS(write_text_input, 0), false, "write_text_input", 16, "Inserts whatever character was used to trigger this command.", 60, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 58 }, +{ PROC_LINKS(write_space, 0), false, "write_space", 11, "Inserts an underscore.", 22, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 66 }, +{ PROC_LINKS(write_underscore, 0), false, "write_underscore", 16, "Inserts an underscore.", 22, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 72 }, +{ PROC_LINKS(delete_char, 0), false, "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 78 }, +{ PROC_LINKS(backspace_char, 0), false, "backspace_char", 14, "Deletes the character to the left of the cursor.", 48, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 95 }, +{ PROC_LINKS(set_mark, 0), false, "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 114 }, +{ PROC_LINKS(cursor_mark_swap, 0), false, "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 123 }, +{ PROC_LINKS(delete_range, 0), false, "delete_range", 12, "Deletes the text in the range between the cursor and the mark.", 62, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 133 }, +{ PROC_LINKS(backspace_alpha_numeric_boundary, 0), false, "backspace_alpha_numeric_boundary", 32, "Delete characters between the cursor position and the first alphanumeric boundary to the left.", 94, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 153 }, +{ PROC_LINKS(delete_alpha_numeric_boundary, 0), false, "delete_alpha_numeric_boundary", 29, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 161 }, +{ PROC_LINKS(snipe_backward_whitespace_or_token_boundary, 0), false, "snipe_backward_whitespace_or_token_boundary", 43, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 181 }, +{ PROC_LINKS(snipe_forward_whitespace_or_token_boundary, 0), false, "snipe_forward_whitespace_or_token_boundary", 42, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 189 }, +{ PROC_LINKS(center_view, 0), false, "center_view", 11, "Centers the view vertically on the line on which the cursor sits.", 65, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 199 }, +{ PROC_LINKS(left_adjust_view, 0), false, "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 213 }, +{ PROC_LINKS(click_set_cursor_and_mark, 0), false, "click_set_cursor_and_mark", 25, "Sets the cursor position and mark to the mouse position.", 56, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 225 }, +{ PROC_LINKS(click_set_cursor, 0), false, "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 235 }, +{ PROC_LINKS(click_set_cursor_if_lbutton, 0), false, "click_set_cursor_if_lbutton", 27, "If the mouse left button is pressed, sets the cursor position to the mouse position.", 84, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 245 }, +{ PROC_LINKS(click_set_mark, 0), false, "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 257 }, +{ PROC_LINKS(mouse_wheel_scroll, 0), false, "mouse_wheel_scroll", 18, "Reads the scroll wheel value from the mouse state and scrolls accordingly.", 74, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 267 }, +{ PROC_LINKS(move_up, 0), false, "move_up", 7, "Moves the cursor up one line.", 29, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 321 }, +{ PROC_LINKS(move_down, 0), false, "move_down", 9, "Moves the cursor down one line.", 31, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 327 }, +{ PROC_LINKS(move_up_10, 0), false, "move_up_10", 10, "Moves the cursor up ten lines.", 30, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 333 }, +{ PROC_LINKS(move_down_10, 0), false, "move_down_10", 12, "Moves the cursor down ten lines.", 32, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 339 }, +{ PROC_LINKS(move_down_textual, 0), false, "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 345 }, +{ PROC_LINKS(page_up, 0), false, "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 355 }, +{ PROC_LINKS(page_down, 0), false, "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 363 }, +{ PROC_LINKS(move_up_to_blank_line, 0), false, "move_up_to_blank_line", 21, "Seeks the cursor up to the next blank line.", 43, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 393 }, +{ PROC_LINKS(move_down_to_blank_line, 0), false, "move_down_to_blank_line", 23, "Seeks the cursor down to the next blank line.", 45, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 399 }, +{ PROC_LINKS(move_up_to_blank_line_skip_whitespace, 0), false, "move_up_to_blank_line_skip_whitespace", 37, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 405 }, +{ PROC_LINKS(move_down_to_blank_line_skip_whitespace, 0), false, "move_down_to_blank_line_skip_whitespace", 39, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 411 }, +{ PROC_LINKS(move_up_to_blank_line_end, 0), false, "move_up_to_blank_line_end", 25, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 417 }, +{ PROC_LINKS(move_down_to_blank_line_end, 0), false, "move_down_to_blank_line_end", 27, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 423 }, +{ PROC_LINKS(move_left, 0), false, "move_left", 9, "Moves the cursor one character to the left.", 43, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 429 }, +{ PROC_LINKS(move_right, 0), false, "move_right", 10, "Moves the cursor one character to the right.", 44, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 441 }, +{ PROC_LINKS(move_right_whitespace_boundary, 0), false, "move_right_whitespace_boundary", 30, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 463 }, +{ PROC_LINKS(move_left_whitespace_boundary, 0), false, "move_left_whitespace_boundary", 29, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 471 }, +{ PROC_LINKS(move_right_token_boundary, 0), false, "move_right_token_boundary", 25, "Seek right for the next end of a token.", 39, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 479 }, +{ PROC_LINKS(move_left_token_boundary, 0), false, "move_left_token_boundary", 24, "Seek left for the next beginning of a token.", 44, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 487 }, +{ PROC_LINKS(move_right_whitespace_or_token_boundary, 0), false, "move_right_whitespace_or_token_boundary", 39, "Seek right for the next end of a token or boundary between whitespace and non-whitespace.", 89, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 495 }, +{ PROC_LINKS(move_left_whitespace_or_token_boundary, 0), false, "move_left_whitespace_or_token_boundary", 38, "Seek left for the next end of a token or boundary between whitespace and non-whitespace.", 88, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 503 }, +{ PROC_LINKS(move_right_alpha_numeric_boundary, 0), false, "move_right_alpha_numeric_boundary", 33, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 511 }, +{ PROC_LINKS(move_left_alpha_numeric_boundary, 0), false, "move_left_alpha_numeric_boundary", 32, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 519 }, +{ PROC_LINKS(move_right_alpha_numeric_or_camel_boundary, 0), false, "move_right_alpha_numeric_or_camel_boundary", 42, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 527 }, +{ PROC_LINKS(move_left_alpha_numeric_or_camel_boundary, 0), false, "move_left_alpha_numeric_or_camel_boundary", 41, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 535 }, +{ PROC_LINKS(select_all, 0), false, "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 545 }, +{ PROC_LINKS(to_uppercase, 0), false, "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 558 }, +{ PROC_LINKS(to_lowercase, 0), false, "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 571 }, +{ PROC_LINKS(clean_all_lines, 0), false, "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 584 }, +{ PROC_LINKS(basic_change_active_panel, 0), false, "basic_change_active_panel", 25, "Change the currently active panel, moving to the panel with the next highest view_id. Will not skipe the build panel if it is open.", 132, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 618 }, +{ PROC_LINKS(close_panel, 0), false, "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 626 }, +{ PROC_LINKS(show_scrollbar, 0), false, "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 635 }, +{ PROC_LINKS(hide_scrollbar, 0), false, "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 642 }, +{ PROC_LINKS(show_filebar, 0), false, "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 649 }, +{ PROC_LINKS(hide_filebar, 0), false, "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 656 }, +{ PROC_LINKS(toggle_filebar, 0), false, "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 663 }, +{ PROC_LINKS(toggle_fps_meter, 0), false, "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 672 }, +{ PROC_LINKS(increase_face_size, 0), false, "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 678 }, +{ PROC_LINKS(decrease_face_size, 0), false, "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 689 }, +{ PROC_LINKS(mouse_wheel_change_face_size, 0), false, "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\\custom\\4coder_base_commands.cpp", 43, 700 }, +{ PROC_LINKS(toggle_virtual_whitespace, 0), false, "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 717 }, +{ PROC_LINKS(toggle_show_whitespace, 0), false, "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 726 }, +{ PROC_LINKS(toggle_line_numbers, 0), false, "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 735 }, +{ PROC_LINKS(exit_4coder, 0), false, "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 741 }, +{ PROC_LINKS(goto_line, 0), false, "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 749 }, +{ PROC_LINKS(search, 0), false, "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 977 }, +{ PROC_LINKS(reverse_search, 0), false, "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 983 }, +{ PROC_LINKS(search_identifier, 0), false, "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 989 }, +{ PROC_LINKS(reverse_search_identifier, 0), false, "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\\custom\\4coder_base_commands.cpp", 43, 995 }, +{ PROC_LINKS(replace_in_range, 0), false, "replace_in_range", 16, "Queries the user for a needle and string. Replaces all occurences of needle with string in the range between cursor and the mark in the active buffer.", 150, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1042 }, +{ PROC_LINKS(replace_in_buffer, 0), false, "replace_in_buffer", 17, "Queries the user for a needle and string. Replaces all occurences of needle with string in the active buffer.", 109, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1051 }, +{ PROC_LINKS(replace_in_all_buffers, 0), false, "replace_in_all_buffers", 22, "Queries the user for a needle and string. Replaces all occurences of needle with string in all editable buffers.", 112, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1060 }, +{ PROC_LINKS(query_replace, 0), false, "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1150 }, +{ PROC_LINKS(query_replace_identifier, 0), false, "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1171 }, +{ PROC_LINKS(query_replace_selection, 0), false, "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1187 }, +{ PROC_LINKS(save_all_dirty_buffers, 0), false, "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1222 }, +{ PROC_LINKS(delete_file_query, 0), false, "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1247 }, +{ PROC_LINKS(save_to_query, 0), false, "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1291 }, +{ PROC_LINKS(rename_file_query, 0), false, "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\\custom\\4coder_base_commands.cpp", 43, 1324 }, +{ PROC_LINKS(make_directory_query, 0), false, "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1362 }, +{ PROC_LINKS(move_line_up, 0), false, "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1396 }, +{ PROC_LINKS(move_line_down, 0), false, "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1402 }, +{ PROC_LINKS(duplicate_line, 0), false, "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1408 }, +{ PROC_LINKS(delete_line, 0), false, "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1422 }, +{ PROC_LINKS(open_file_in_quotes, 0), false, "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1487 }, +{ PROC_LINKS(open_matching_file_cpp, 0), false, "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1519 }, +{ PROC_LINKS(view_buffer_other_panel, 0), false, "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1532 }, +{ PROC_LINKS(swap_buffers_between_panels, 0), false, "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1544 }, +{ PROC_LINKS(kill_buffer, 0), false, "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1578 }, +{ PROC_LINKS(save, 0), false, "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1586 }, +{ PROC_LINKS(reopen, 0), false, "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1596 }, +{ PROC_LINKS(undo, 0), false, "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1825 }, +{ PROC_LINKS(redo, 0), false, "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1838 }, +{ PROC_LINKS(undo_all_buffers, 0), false, "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1852 }, +{ PROC_LINKS(redo_all_buffers, 0), false, "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1923 }, +{ PROC_LINKS(open_in_other, 0), false, "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2024 }, +{ PROC_LINKS(default_file_externally_modified, 0), false, "default_file_externally_modified", 32, "Notes the external modification of attached files by printing a message.", 72, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2031 }, +{ PROC_LINKS(set_eol_mode_to_crlf, 0), false, "set_eol_mode_to_crlf", 20, "Puts the buffer in crlf line ending mode.", 41, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 80 }, +{ PROC_LINKS(set_eol_mode_to_lf, 0), false, "set_eol_mode_to_lf", 18, "Puts the buffer in lf line ending mode.", 39, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 91 }, +{ PROC_LINKS(set_eol_mode_to_binary, 0), false, "set_eol_mode_to_binary", 22, "Puts the buffer in bin line ending mode.", 40, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 102 }, +{ PROC_LINKS(set_eol_mode_from_contents, 0), false, "set_eol_mode_from_contents", 26, "Sets the buffer's line ending mode to match the contents of the buffer.", 71, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 113 }, +{ PROC_LINKS(interactive_switch_buffer, 0), true, "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 477 }, +{ PROC_LINKS(interactive_kill_buffer, 0), true, "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 496 }, +{ PROC_LINKS(interactive_open_or_new, 0), true, "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 567 }, +{ PROC_LINKS(interactive_new, 0), true, "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 606 }, +{ PROC_LINKS(interactive_open, 0), true, "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 639 }, +{ PROC_LINKS(command_lister, 0), true, "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 702 }, +{ PROC_LINKS(auto_indent_whole_file, 0), false, "auto_indent_whole_file", 22, "Audo-indents the entire current buffer.", 39, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 356 }, +{ PROC_LINKS(auto_indent_line_at_cursor, 0), false, "auto_indent_line_at_cursor", 26, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 365 }, +{ PROC_LINKS(auto_indent_range, 0), false, "auto_indent_range", 17, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 375 }, +{ PROC_LINKS(write_text_and_auto_indent, 0), false, "write_text_and_auto_indent", 26, "Inserts text and auto-indents the line on which the cursor sits if any of the text contains 'layout punctuation' such as ;:{}()[]# and new lines.", 145, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 385 }, +{ PROC_LINKS(list_all_locations, 0), false, "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 166 }, +{ PROC_LINKS(list_all_substring_locations, 0), false, "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 172 }, +{ PROC_LINKS(list_all_locations_case_insensitive, 0), false, "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 178 }, +{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), false, "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 184 }, +{ PROC_LINKS(list_all_locations_of_identifier, 0), false, "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 190 }, +{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), false, "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 196 }, +{ PROC_LINKS(list_all_locations_of_selection, 0), false, "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 202 }, +{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), false, "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 208 }, +{ PROC_LINKS(list_all_locations_of_type_definition, 0), false, "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 214 }, +{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), false, "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 222 }, +{ PROC_LINKS(word_complete, 0), false, "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 391 }, +{ PROC_LINKS(goto_jump_at_cursor, 0), false, "goto_jump_at_cursor", 19, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 346 }, +{ PROC_LINKS(goto_jump_at_cursor_same_panel, 0), false, "goto_jump_at_cursor_same_panel", 30, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list.", 167, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 373 }, +{ PROC_LINKS(goto_next_jump, 0), false, "goto_next_jump", 14, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 462 }, +{ PROC_LINKS(goto_prev_jump, 0), false, "goto_prev_jump", 14, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 479 }, +{ PROC_LINKS(goto_next_jump_no_skips, 0), false, "goto_next_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 492 }, +{ PROC_LINKS(goto_prev_jump_no_skips, 0), false, "goto_prev_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 509 }, +{ PROC_LINKS(goto_first_jump, 0), false, "goto_first_jump", 15, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 523 }, +{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), false, "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 540 }, +{ PROC_LINKS(if_read_only_goto_position, 0), false, "if_read_only_goto_position", 26, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 562 }, +{ PROC_LINKS(if_read_only_goto_position_same_panel, 0), false, "if_read_only_goto_position_same_panel", 37, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 579 }, +{ PROC_LINKS(view_jump_list_with_lister, 0), false, "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "w:\\4ed\\code\\custom\\4coder_jump_lister.cpp", 41, 104 }, +{ PROC_LINKS(show_the_log_graph, 0), true, "show_the_log_graph", 18, "Parses *log* and displays the 'log graph' UI", 44, "w:\\4ed\\code\\custom\\4coder_log_parser.cpp", 40, 990 }, +{ PROC_LINKS(copy, 0), false, "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 19 }, +{ PROC_LINKS(cut, 0), false, "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 28 }, +{ PROC_LINKS(paste, 0), false, "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 39 }, +{ PROC_LINKS(paste_next, 0), false, "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 73 }, +{ PROC_LINKS(paste_and_indent, 0), false, "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 115 }, +{ PROC_LINKS(paste_next_and_indent, 0), false, "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 122 }, +{ PROC_LINKS(execute_previous_cli, 0), false, "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "w:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 7 }, +{ PROC_LINKS(execute_any_cli, 0), false, "execute_any_cli", 15, "Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.", 133, "w:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 22 }, +{ PROC_LINKS(build_search, 0), false, "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 128 }, +{ PROC_LINKS(build_in_build_panel, 0), false, "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 163 }, +{ PROC_LINKS(close_build_panel, 0), false, "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 178 }, +{ PROC_LINKS(change_to_build_panel, 0), false, "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 184 }, +{ PROC_LINKS(close_all_code, 0), false, "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 917 }, +{ PROC_LINKS(open_all_code, 0), false, "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 923 }, +{ PROC_LINKS(open_all_code_recursive, 0), false, "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 929 }, +{ PROC_LINKS(load_project, 0), false, "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\\custom\\4coder_project_commands.cpp", 46, 937 }, +{ PROC_LINKS(project_fkey_command, 0), false, "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 944 }, +{ PROC_LINKS(project_go_to_root_directory, 0), false, "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 969 }, +{ PROC_LINKS(setup_new_project, 0), false, "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1303 }, +{ PROC_LINKS(setup_build_bat, 0), false, "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1310 }, +{ PROC_LINKS(setup_build_sh, 0), false, "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1316 }, +{ PROC_LINKS(setup_build_bat_and_sh, 0), false, "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1322 }, +{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1338 }, +{ PROC_LINKS(list_all_functions_current_buffer, 0), false, "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "w:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 267 }, +{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), false, "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "w:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 277 }, +{ PROC_LINKS(list_all_functions_all_buffers, 0), false, "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\\custom\\4coder_function_list.cpp", 43, 289 }, +{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), false, "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\\custom\\4coder_function_list.cpp", 43, 295 }, +{ PROC_LINKS(select_surrounding_scope, 0), false, "select_surrounding_scope", 24, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "w:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 7 }, +{ PROC_LINKS(select_next_scope_absolute, 0), false, "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "w:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 32 }, +{ PROC_LINKS(select_next_scope_after_current, 0), false, "select_next_scope_after_current", 31, "Finds the first scope started by '{' after the mark and puts the cursor and mark on the '{' and '}'. This command is meant to be used after a scope is already selected so that it will have the effect of selecting the next scope after the current scope.", 253, "w:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 41 }, +{ PROC_LINKS(select_prev_scope_absolute, 0), false, "select_prev_scope_absolute", 26, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "w:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 50 }, +{ PROC_LINKS(place_in_scope, 0), false, "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "w:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 67 }, +{ PROC_LINKS(delete_current_scope, 0), false, "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "w:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 73 }, +{ PROC_LINKS(open_long_braces, 0), false, "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 46 }, +{ PROC_LINKS(open_long_braces_semicolon, 0), false, "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 54 }, +{ PROC_LINKS(open_long_braces_break, 0), false, "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 62 }, +{ PROC_LINKS(if0_off, 0), false, "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 70 }, +{ PROC_LINKS(write_todo, 0), false, "write_todo", 10, "At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 76 }, +{ PROC_LINKS(write_hack, 0), false, "write_hack", 10, "At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 82 }, +{ PROC_LINKS(write_note, 0), false, "write_note", 10, "At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 88 }, +{ PROC_LINKS(write_block, 0), false, "write_block", 11, "At the cursor, insert a block comment.", 38, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 94 }, +{ PROC_LINKS(write_zero_struct, 0), false, "write_zero_struct", 17, "At the cursor, insert a ' = {};'.", 33, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 100 }, +{ PROC_LINKS(comment_line, 0), false, "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 125 }, +{ PROC_LINKS(uncomment_line, 0), false, "uncomment_line", 14, "If present, delete '//' at the beginning of the line after leading whitespace.", 78, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 137 }, +{ PROC_LINKS(comment_line_toggle, 0), false, "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 149 }, +{ PROC_LINKS(snippet_lister, 0), false, "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 231 }, +{ PROC_LINKS(miblo_increment_basic, 0), false, "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "w:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 29 }, +{ PROC_LINKS(miblo_decrement_basic, 0), false, "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "w:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 44 }, +{ PROC_LINKS(miblo_increment_time_stamp, 0), false, "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\\custom\\4coder_miblo_numbers.cpp", 43, 231 }, +{ PROC_LINKS(miblo_decrement_time_stamp, 0), false, "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\\custom\\4coder_miblo_numbers.cpp", 43, 237 }, +{ PROC_LINKS(miblo_increment_time_stamp_minute, 0), false, "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\\custom\\4coder_miblo_numbers.cpp", 43, 243 }, +{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), false, "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\\custom\\4coder_miblo_numbers.cpp", 43, 249 }, +{ PROC_LINKS(profile_inspect, 0), true, "profile_inspect", 15, "Inspect all currently collected profiling information in 4coder's self profiler.", 80, "w:\\4ed\\code\\custom\\4coder_profile_inspect.cpp", 45, 375 }, +{ PROC_LINKS(default_startup, 0), false, "default_startup", 15, "Default command for responding to a startup event", 49, "w:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 7 }, +{ PROC_LINKS(default_try_exit, 0), false, "default_try_exit", 16, "Default command for responding to a try-exit event", 50, "w:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 21 }, }; static i32 fcoder_metacmd_ID_default_view_input_handler = 0; static i32 fcoder_metacmd_ID_profile_enable = 1; diff --git a/custom/generated/system_api.cpp b/custom/generated/system_api.cpp index ed253290..5b190f6b 100644 --- a/custom/generated/system_api.cpp +++ b/custom/generated/system_api.cpp @@ -29,6 +29,8 @@ vtable->thread_launch = system_thread_launch; vtable->thread_join = system_thread_join; vtable->thread_free = system_thread_free; vtable->thread_get_id = system_thread_get_id; +vtable->acquire_global_frame_mutex = system_acquire_global_frame_mutex; +vtable->release_global_frame_mutex = system_release_global_frame_mutex; vtable->mutex_make = system_mutex_make; vtable->mutex_acquire = system_mutex_acquire; vtable->mutex_release = system_mutex_release; @@ -77,6 +79,8 @@ system_thread_launch = vtable->thread_launch; system_thread_join = vtable->thread_join; system_thread_free = vtable->thread_free; system_thread_get_id = vtable->thread_get_id; +system_acquire_global_frame_mutex = vtable->acquire_global_frame_mutex; +system_release_global_frame_mutex = vtable->release_global_frame_mutex; system_mutex_make = vtable->mutex_make; system_mutex_acquire = vtable->mutex_acquire; system_mutex_release = vtable->mutex_release; diff --git a/custom/generated/system_api.h b/custom/generated/system_api.h index a54e36fc..5b72162d 100644 --- a/custom/generated/system_api.h +++ b/custom/generated/system_api.h @@ -27,6 +27,8 @@ #define system_thread_join_sig() void system_thread_join(System_Thread thread) #define system_thread_free_sig() void system_thread_free(System_Thread thread) #define system_thread_get_id_sig() i32 system_thread_get_id(void) +#define system_acquire_global_frame_mutex_sig() void system_acquire_global_frame_mutex(Thread_Context* tctx) +#define system_release_global_frame_mutex_sig() void system_release_global_frame_mutex(Thread_Context* tctx) #define system_mutex_make_sig() System_Mutex system_mutex_make(void) #define system_mutex_acquire_sig() void system_mutex_acquire(System_Mutex mutex) #define system_mutex_release_sig() void system_mutex_release(System_Mutex mutex) @@ -71,6 +73,8 @@ typedef System_Thread system_thread_launch_type(Thread_Function* proc, void* ptr typedef void system_thread_join_type(System_Thread thread); typedef void system_thread_free_type(System_Thread thread); typedef i32 system_thread_get_id_type(void); +typedef void system_acquire_global_frame_mutex_type(Thread_Context* tctx); +typedef void system_release_global_frame_mutex_type(Thread_Context* tctx); typedef System_Mutex system_mutex_make_type(void); typedef void system_mutex_acquire_type(System_Mutex mutex); typedef void system_mutex_release_type(System_Mutex mutex); @@ -116,6 +120,8 @@ system_thread_launch_type *thread_launch; system_thread_join_type *thread_join; system_thread_free_type *thread_free; system_thread_get_id_type *thread_get_id; +system_acquire_global_frame_mutex_type *acquire_global_frame_mutex; +system_release_global_frame_mutex_type *release_global_frame_mutex; system_mutex_make_type *mutex_make; system_mutex_acquire_type *mutex_acquire; system_mutex_release_type *mutex_release; @@ -162,6 +168,8 @@ internal System_Thread system_thread_launch(Thread_Function* proc, void* ptr); internal void system_thread_join(System_Thread thread); internal void system_thread_free(System_Thread thread); internal i32 system_thread_get_id(void); +internal void system_acquire_global_frame_mutex(Thread_Context* tctx); +internal void system_release_global_frame_mutex(Thread_Context* tctx); internal System_Mutex system_mutex_make(void); internal void system_mutex_acquire(System_Mutex mutex); internal void system_mutex_release(System_Mutex mutex); @@ -208,6 +216,8 @@ global system_thread_launch_type *system_thread_launch = 0; global system_thread_join_type *system_thread_join = 0; global system_thread_free_type *system_thread_free = 0; global system_thread_get_id_type *system_thread_get_id = 0; +global system_acquire_global_frame_mutex_type *system_acquire_global_frame_mutex = 0; +global system_release_global_frame_mutex_type *system_release_global_frame_mutex = 0; global system_mutex_make_type *system_mutex_make = 0; global system_mutex_acquire_type *system_mutex_acquire = 0; global system_mutex_release_type *system_mutex_release = 0; diff --git a/custom/generated/system_api_master_list.h b/custom/generated/system_api_master_list.h index 94dd6d49..57cef0fe 100644 --- a/custom/generated/system_api_master_list.h +++ b/custom/generated/system_api_master_list.h @@ -27,6 +27,8 @@ api(system) function System_Thread thread_launch(Thread_Function* proc, void* pt api(system) function void thread_join(System_Thread thread); api(system) function void thread_free(System_Thread thread); api(system) function i32 thread_get_id(void); +api(system) function void acquire_global_frame_mutex(Thread_Context* tctx); +api(system) function void release_global_frame_mutex(Thread_Context* tctx); api(system) function System_Mutex mutex_make(void); api(system) function void mutex_acquire(System_Mutex mutex); api(system) function void mutex_release(System_Mutex mutex); diff --git a/platform_win32/win32_4ed.cpp b/platform_win32/win32_4ed.cpp index 83d461d1..803ecf07 100644 --- a/platform_win32/win32_4ed.cpp +++ b/platform_win32/win32_4ed.cpp @@ -188,6 +188,8 @@ struct Win32_Vars{ CONDITION_VARIABLE thread_launch_cv; b32 waiting_for_launch; + System_Mutex global_frame_mutex; + Log_Function *log_string; }; @@ -887,6 +889,20 @@ system_mutex_release_sig(){ } } +internal +system_acquire_global_frame_mutex_sig(){ + if (tctx->kind == ThreadKind_AsyncTasks){ + system_mutex_acquire(win32vars.global_frame_mutex); + } +} + +internal +system_release_global_frame_mutex_sig(){ + if (tctx->kind == ThreadKind_AsyncTasks){ + system_mutex_release(win32vars.global_frame_mutex); + } +} + internal system_mutex_free_sig(){ Win32_Object *object = (Win32_Object*)handle_type_ptr(mutex); @@ -1440,7 +1456,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS // NOTE(allen): context setup Thread_Context _tctx = {}; - thread_ctx_init(&_tctx, get_base_allocator_system(), get_base_allocator_system()); + thread_ctx_init(&_tctx, ThreadKind_Main, get_base_allocator_system(), get_base_allocator_system()); block_zero_struct(&win32vars); win32vars.tctx = &_tctx; @@ -1684,6 +1700,9 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS SetActiveWindow(win32vars.window_handle); ShowWindow(win32vars.window_handle, SW_SHOW); + win32vars.global_frame_mutex = system_mutex_make(); + system_mutex_acquire(win32vars.global_frame_mutex); + u64 timer_start = system_now_time(); MSG msg; for (;keep_running;){ @@ -1921,6 +1940,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS } // NOTE(allen): sleep a bit to cool off :) + system_mutex_release(win32vars.global_frame_mutex); + u64 timer_end = system_now_time(); u64 end_target = timer_start + frame_useconds; @@ -1933,6 +1954,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS } timer_start = system_now_time(); + system_mutex_acquire(win32vars.global_frame_mutex); + win32vars.first = false; } diff --git a/ship_files/release-config.4coder b/ship_files/release-config.4coder index c6e7c8f0..bfe0fc32 100644 --- a/ship_files/release-config.4coder +++ b/ship_files/release-config.4coder @@ -14,10 +14,13 @@ mode = "4coder"; // UI use_scroll_bars = false; use_file_bars = true; -use_line_highlight = true; +use_error_highlight = true; +use_jump_highlight = true; use_scope_highlight = true; use_paren_helper = true; use_comment_keywords = true; +lister_whole_word_backspace_when_modified = false; +show_line_number_margins = false; // Code Wrapping treat_as_code = ".cpp.c.hpp.h.cc.cs.java.rs.glsl.m"; From c7f69d26a0d9b943b23d779c5856a804d597b55e Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Mon, 21 Oct 2019 21:10:29 -0700 Subject: [PATCH 3/8] Async system setup WITHOUT cancelation working yet --- 4ed.cpp | 81 +++++++------ 4ed.h | 6 +- 4ed_allocator_models.cpp | 37 ------ 4ed_api_implementation.cpp | 147 ++++++++++++----------- 4ed_app_models.h | 14 +-- 4ed_app_target.cpp | 1 - 4ed_cli.cpp | 4 +- 4ed_coroutine.cpp | 4 + 4ed_dynamic_variables.cpp | 24 ++-- 4ed_dynamic_variables.h | 30 ++--- 4ed_edit.cpp | 75 ++++++------ 4ed_file.cpp | 83 ++++++------- 4ed_history.cpp | 7 +- 4ed_log.cpp | 6 +- 4ed_text_layout.cpp | 18 +-- 4ed_view.cpp | 201 +++++++++++++++----------------- 4ed_working_set.cpp | 7 +- custom/4coder_async_tasks.cpp | 139 ++++++++++++++++++++-- custom/4coder_async_tasks.h | 38 +++++- custom/4coder_base_types.h | 4 +- custom/4coder_default_hooks.cpp | 7 +- custom/4coder_types.h | 8 +- platform_win32/win32_4ed.cpp | 4 +- 23 files changed, 531 insertions(+), 414 deletions(-) delete mode 100644 4ed_allocator_models.cpp diff --git a/4ed.cpp b/4ed.cpp index d52c7a56..096c7f01 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -10,14 +10,14 @@ // TOP internal void -output_file_append(Models *models, Editing_File *file, String_Const_u8 value){ +output_file_append(Thread_Context *tctx, Models *models, Editing_File *file, String_Const_u8 value){ i64 end = buffer_size(&file->state.buffer); Edit_Behaviors behaviors = {}; - edit_single(models, file, Ii64(end), value, behaviors); + edit_single(tctx, models, file, Ii64(end), value, behaviors); } internal void -file_cursor_to_end(Models *models, Editing_File *file){ +file_cursor_to_end(Thread_Context *tctx, Models *models, Editing_File *file){ Assert(file != 0); i64 pos = buffer_size(&file->state.buffer); Layout *layout = &models->layout; @@ -28,7 +28,7 @@ file_cursor_to_end(Models *models, Editing_File *file){ if (view->file != file){ continue; } - view_set_cursor(models, view, pos); + view_set_cursor(tctx, models, view, pos); view->mark = pos; } } @@ -281,12 +281,12 @@ init_command_line_settings(App_Settings *settings, Plat_Settings *plat_settings, //////////////////////////////// internal Models* -models_init(Thread_Context *tctx){ - Arena *arena = reserve_arena(tctx); - Models *models = push_array_zero(arena, Models, 1); - models->tctx = tctx; - models->arena = arena; - heap_init(&models->heap, tctx->allocator); +models_init(void){ + Arena arena = make_arena_system(); + Models *models = push_array_zero(&arena, Models, 1); + models->arena_ = arena; + models->arena = &models->arena_; + heap_init(&models->heap, get_base_allocator_system()); return(models); } @@ -306,7 +306,7 @@ app_get_logger(void){ } App_Read_Command_Line_Sig(app_read_command_line){ - Models *models = models_init(tctx); + Models *models = models_init(); App_Settings *settings = &models->settings; block_zero_struct(settings); if (argc > 1){ @@ -322,7 +322,6 @@ App_Init_Sig(app_init){ models->keep_playing = true; models->config_api = api; - models->app_links.cmd_context = models; API_VTable_custom custom_vtable = {}; custom_api_fill_vtable(&custom_vtable); @@ -330,7 +329,11 @@ App_Init_Sig(app_init){ system_api_fill_vtable(&system_vtable); Custom_Layer_Init_Type *custom_init = api.init_apis(&custom_vtable, &system_vtable); Assert(custom_init != 0); - custom_init(&models->app_links); + + Application_Links app = {}; + app.tctx = tctx; + app.cmd_context = models; + custom_init(&app); // NOTE(allen): coroutines coroutine_system_init(&models->coroutines); @@ -360,8 +363,8 @@ App_Init_Sig(app_init){ } } - managed_ids_init(models->tctx->allocator, &models->managed_id_set); - lifetime_allocator_init(models->tctx->allocator, &models->lifetime_allocator); + managed_ids_init(tctx->allocator, &models->managed_id_set); + lifetime_allocator_init(tctx->allocator, &models->lifetime_allocator); dynamic_workspace_init(&models->lifetime_allocator, DynamicWorkspace_Global, 0, &models->dynamic_workspace); // NOTE(allen): file setup @@ -371,7 +374,7 @@ App_Init_Sig(app_init){ // NOTE(allen): global_history_init(&models->global_history); - text_layout_init(models, &models->text_layouts); + text_layout_init(tctx, &models->text_layouts); // NOTE(allen): clipboard setup models->working_set.clipboard_max_size = ArrayCount(models->working_set.clipboards); @@ -412,17 +415,17 @@ App_Init_Sig(app_init){ Heap *heap = &models->heap; for (i32 i = 0; i < ArrayCount(init_files); ++i){ Editing_File *file = working_set_allocate_file(&models->working_set, &models->lifetime_allocator); - buffer_bind_name(models, arena, &models->working_set, file, init_files[i].name); + buffer_bind_name(tctx, models, arena, &models->working_set, file, init_files[i].name); if (init_files[i].ptr != 0){ *init_files[i].ptr = file; } File_Attributes attributes = {}; - file_create_from_string(models, file, SCu8(), attributes); + file_create_from_string(tctx, models, file, SCu8(), attributes); if (init_files[i].read_only){ file->settings.read_only = true; - history_free(models, &file->state.history); + history_free(tctx, &file->state.history); } file->settings.never_kill = true; @@ -433,12 +436,12 @@ App_Init_Sig(app_init){ { Panel *panel = layout_initialize(arena, &models->layout); View *new_view = live_set_alloc_view(&models->lifetime_allocator, &models->live_set, panel); - view_init(models, new_view, models->scratch_buffer, models->view_event_handler); + view_init(tctx, models, new_view, models->scratch_buffer, models->view_event_handler); } // NOTE(allen): miscellaneous init hot_directory_init(arena, &models->hot_directory, current_directory); - child_process_container_init(models->tctx->allocator, &models->child_processes); + child_process_container_init(tctx->allocator, &models->child_processes); models->period_wakeup_timer = system_wake_up_timer_create(); } @@ -446,7 +449,7 @@ App_Step_Sig(app_step){ Models *models = (Models*)base_ptr; Mutex_Lock file_order_lock(models->working_set.mutex); - Scratch_Block scratch(models->tctx, Scratch_Share); + Scratch_Block scratch(tctx, Scratch_Share); models->next_animate_delay = max_u32; models->animate_next_frame = false; @@ -462,7 +465,7 @@ App_Step_Sig(app_step){ String_Const_u8 *dest = working_set_next_clipboard_string(&models->heap, &models->working_set, clipboard.size); dest->size = eol_convert_in((char*)dest->str, (char*)clipboard.str, (i32)clipboard.size); if (input->clipboard_changed){ - co_send_core_event(models, CoreCode_NewClipboardContents, *dest); + co_send_core_event(tctx, models, CoreCode_NewClipboardContents, *dest); } } @@ -499,7 +502,7 @@ App_Step_Sig(app_step){ if (system_cli_update_step(cli, dest, max, &amount)){ if (file != 0 && amount > 0){ amount = eol_in_place_convert_in(dest, amount); - output_file_append(models, file, SCu8(dest, amount)); + output_file_append(tctx, models, file, SCu8(dest, amount)); edited_file = true; } } @@ -507,7 +510,7 @@ App_Step_Sig(app_step){ if (system_cli_end_update(cli)){ if (file != 0){ String_Const_u8 str = push_u8_stringf(scratch, "exited with code %d", cli->exit); - output_file_append(models, file, str); + output_file_append(tctx, models, file, str); edited_file = true; } processes_to_free[processes_to_free_count++] = child_process; @@ -515,7 +518,7 @@ App_Step_Sig(app_step){ } if (child_process->cursor_at_end && file != 0){ - file_cursor_to_end(models, file); + file_cursor_to_end(tctx, models, file); } } @@ -639,7 +642,7 @@ App_Step_Sig(app_step){ event.core.code = CoreCode_Startup; event.core.flag_strings = flags; event.core.file_names = file_names; - co_send_event(models, &event); + co_send_event(tctx, models, &event); } // NOTE(allen): consume event stream @@ -689,7 +692,7 @@ App_Step_Sig(app_step){ case EventConsume_ClickChangeView: { // NOTE(allen): run deactivate command - co_send_core_event(models, view, CoreCode_ClickDeactivateView); + co_send_core_event(tctx, models, view, CoreCode_ClickDeactivateView); layout->active_panel = mouse_panel; models->animate_next_frame = true; @@ -697,14 +700,14 @@ App_Step_Sig(app_step){ view = active_panel->view; // NOTE(allen): run activate command - co_send_core_event(models, view, CoreCode_ClickActivateView); + co_send_core_event(tctx, models, view, CoreCode_ClickActivateView); event_was_handled = true; }break; case EventConsume_CustomCommand: { - event_was_handled = co_send_event(models, view, event); + event_was_handled = co_send_event(tctx, models, view, event); }break; } }break; @@ -745,7 +748,10 @@ App_Step_Sig(app_step){ if (models->layout.panel_state_dirty){ models->layout.panel_state_dirty = false; if (models->buffer_viewer_update != 0){ - models->buffer_viewer_update(&models->app_links); + Application_Links app = {}; + app.tctx = tctx; + app.cmd_context = models; + models->buffer_viewer_update(&app); } } @@ -769,7 +775,7 @@ App_Step_Sig(app_step){ panel = layout_get_next_open_panel(layout, panel)){ View *view = panel->view; File_Edit_Positions edit_pos = view_get_edit_pos(view); - edit_pos.scroll.position = view_normalize_buffer_point(models, view, edit_pos.scroll.target); + edit_pos.scroll.position = view_normalize_buffer_point(tctx, models, view, edit_pos.scroll.target); block_zero_struct(&edit_pos.scroll.target); view_set_edit_pos(view, edit_pos); } @@ -787,7 +793,7 @@ App_Step_Sig(app_step){ Editing_File *file = CastFromMember(Editing_File, external_mod_node, node); dll_remove(node); block_zero_struct(node); - co_send_core_event(models, CoreCode_FileExternallyModified, file->id); + co_send_core_event(tctx, models, CoreCode_FileExternallyModified, file->id); } } } @@ -797,7 +803,7 @@ App_Step_Sig(app_step){ models->keep_playing = false; } if (!models->keep_playing){ - if (co_send_core_event(models, CoreCode_TryExit)){ + if (co_send_core_event(tctx, models, CoreCode_TryExit)){ models->keep_playing = true; } } @@ -836,7 +842,10 @@ App_Step_Sig(app_step){ if (ctx != 0){ Render_Caller_Function *render_caller = ctx->ctx.render_caller; if (render_caller != 0){ - render_caller(&models->app_links, frame, view_get_id(live_views, view)); + Application_Links app = {}; + app.tctx = tctx; + app.cmd_context = models; + render_caller(&app, frame, view_get_id(live_views, view)); } } } @@ -846,7 +855,7 @@ App_Step_Sig(app_step){ } // NOTE(allen): flush the log - log_flush(models); + log_flush(tctx, models); // NOTE(allen): set the app_result Application_Step_Result app_result = {}; diff --git a/4ed.h b/4ed.h index ff546206..705a11e2 100644 --- a/4ed.h +++ b/4ed.h @@ -47,7 +47,8 @@ struct Custom_API{ }; #define App_Init_Sig(name) \ -void name(Render_Target *target, \ +void name(Thread_Context *tctx, \ +Render_Target *target, \ void *base_ptr, \ String_Const_u8 clipboard,\ String_Const_u8 current_directory,\ @@ -77,7 +78,8 @@ struct Application_Step_Input{ }; #define App_Step_Sig(name) Application_Step_Result \ -name(Render_Target *target, \ +name(Thread_Context *tctx, \ +Render_Target *target, \ void *base_ptr, \ Application_Step_Input *input) diff --git a/4ed_allocator_models.cpp b/4ed_allocator_models.cpp deleted file mode 100644 index fe74d240..00000000 --- a/4ed_allocator_models.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Mr. 4th Dimention - Allen Webster - * - * 27.08.2019 - * - * Models based arena constructors - * - */ - -// TOP - -internal Arena* -reserve_arena(Models *models, umem chunk_size, umem align){ - Thread_Context *tctx = models->tctx; - return(reserve_arena(tctx, chunk_size, align)); -} - -internal Arena* -reserve_arena(Models *models, umem chunk_size){ - Thread_Context *tctx = models->tctx; - return(reserve_arena(tctx, chunk_size)); -} - -internal Arena* -reserve_arena(Models *models){ - Thread_Context *tctx = models->tctx; - return(reserve_arena(tctx)); -} - -internal void -release_arena(Models *models, Arena *arena){ - Thread_Context *tctx = models->tctx; - release_arena(tctx, arena); -} - -// BOTTOM - diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index f82a0a7e..c2ef5986 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -45,7 +45,9 @@ api_check_view(View *view, Access_Flag access){ function b32 is_running_coroutine(Application_Links *app){ - return(app->current_coroutine != 0); + Thread_Context *tctx = app->tctx; + Thread_Context_Extra_Info *info = (Thread_Context_Extra_Info*)tctx->user_data; + return(info->coroutine != 0); } api(custom) function b32 @@ -73,25 +75,13 @@ global_get_screen_rectangle(Application_Links *app){ api(custom) function Thread_Context* get_thread_context(Application_Links *app){ - Thread_Context *tctx = 0; - if (app->current_coroutine == 0){ - Models *models = (Models*)app->cmd_context; - tctx = models->tctx; - } - else if (app->current_thread != 0){ - tctx = (Thread_Context*)app->current_thread; - } - else{ - Coroutine *coroutine = (Coroutine*)app->current_coroutine; - tctx = coroutine->tctx; - } - return(tctx); + return(app->tctx); } api(custom) function b32 create_child_process(Application_Links *app, String_Const_u8 path, String_Const_u8 command, Child_Process_ID *child_process_id_out){ Models *models = (Models*)app->cmd_context; - return(child_process_call(models, path, command, child_process_id_out)); + return(child_process_call(app->tctx, models, path, command, child_process_id_out)); } api(custom) function b32 @@ -246,7 +236,7 @@ buffer_replace_range(Application_Links *app, Buffer_ID buffer_id, Range_i64 rang i64 size = buffer_size(&file->state.buffer); if (0 <= range.first && range.first <= range.one_past_last && range.one_past_last <= size){ Edit_Behaviors behaviors = {}; - edit_single(models, file, range, string, behaviors); + edit_single(app->tctx, models, file, range, string, behaviors); result = true; } } @@ -261,7 +251,7 @@ buffer_batch_edit(Application_Links *app, Buffer_ID buffer_id, Batch_Edit *batch b32 result = false; if (api_check_buffer(file)){ Edit_Behaviors behaviors = {}; - result = edit_batch(models, file, batch, behaviors); + result = edit_batch(app->tctx, models, file, batch, behaviors); } return(result); } @@ -373,7 +363,7 @@ buffer_line_y_difference(Application_Links *app, Buffer_ID buffer_id, f32 width, if (api_check_buffer(file)){ Face *face = font_set_face_from_id(&models->font_set, face_id); if (face != 0){ - result = file_line_y_difference(models, file, width, face, line_a, line_b); + result = file_line_y_difference(app->tctx, models, file, width, face, line_a, line_b); } } return(result); @@ -387,7 +377,7 @@ buffer_line_shift_y(Application_Links *app, Buffer_ID buffer_id, f32 width, Face if (api_check_buffer(file)){ Face *face = font_set_face_from_id(&models->font_set, face_id); if (face != 0){ - result = file_line_shift_y(models, file, width, face, line, y_shift); + result = file_line_shift_y(app->tctx, models, file, width, face, line, y_shift); } } return(result); @@ -401,7 +391,7 @@ buffer_pos_at_relative_xy(Application_Links *app, Buffer_ID buffer_id, f32 width if (api_check_buffer(file)){ Face *face = font_set_face_from_id(&models->font_set, face_id); if (face != 0){ - result = file_pos_at_relative_xy(models, file, width, face, base_line, relative_xy); + result = file_pos_at_relative_xy(app->tctx, models, file, width, face, base_line, relative_xy); } } return(result); @@ -416,7 +406,7 @@ buffer_relative_xy_of_pos(Application_Links *app, Buffer_ID buffer_id, f32 width if (api_check_buffer(file)){ Face *face = font_set_face_from_id(&models->font_set, face_id); if (face != 0){ - result = file_relative_xy_of_pos(models, file, width, face, base_line, pos); + result = file_relative_xy_of_pos(app->tctx, models, file, width, face, base_line, pos); } } return(result); @@ -431,7 +421,7 @@ buffer_relative_character_from_pos(Application_Links *app, Buffer_ID buffer_id, if (api_check_buffer(file)){ Face *face = font_set_face_from_id(&models->font_set, face_id); if (face != 0){ - result = file_relative_character_from_pos(models, file, width, face, base_line, pos); + result = file_relative_character_from_pos(app->tctx, models, file, width, face, base_line, pos); } } return(result); @@ -446,7 +436,7 @@ buffer_pos_from_relative_character(Application_Links *app, Buffer_ID buffer_id, if (api_check_buffer(file)){ Face *face = font_set_face_from_id(&models->font_set, face_id); if (face != 0){ - result = file_pos_from_relative_character(models, file, width, face, base_line, relative_character); + result = file_pos_from_relative_character(app->tctx, models, file, width, face, base_line, relative_character); } } return(result); @@ -460,7 +450,7 @@ view_line_y_difference(Application_Links *app, View_ID view_id, i64 line_a, i64 View *view = imp_get_view(models, view_id); f32 result = {}; if (api_check_view(view)){ - result = view_line_y_difference(models, view, line_a, line_b); + result = view_line_y_difference(app->tctx, models, view, line_a, line_b); } return(result); } @@ -471,7 +461,7 @@ view_line_shift_y(Application_Links *app, View_ID view_id, i64 line, f32 y_shift View *view = imp_get_view(models, view_id); Line_Shift_Vertical result = {}; if (api_check_view(view)){ - result = view_line_shift_y(models, view, line, y_shift); + result = view_line_shift_y(app->tctx, models, view, line, y_shift); } return(result); } @@ -482,7 +472,7 @@ view_pos_at_relative_xy(Application_Links *app, View_ID view_id, i64 base_line, View *view = imp_get_view(models, view_id); i64 result = -1; if (api_check_view(view)){ - result = view_pos_at_relative_xy(models, view, base_line, relative_xy); + result = view_pos_at_relative_xy(app->tctx, models, view, base_line, relative_xy); } return(result); } @@ -493,7 +483,7 @@ view_relative_xy_of_pos(Application_Links *app, View_ID view_id, i64 base_line, View *view = imp_get_view(models, view_id); Vec2_f32 result = {}; if (api_check_view(view)){ - result = view_relative_xy_of_pos(models, view, base_line, pos); + result = view_relative_xy_of_pos(app->tctx, models, view, base_line, pos); } return(result); } @@ -504,7 +494,7 @@ view_relative_character_from_pos(Application_Links *app, View_ID view_id, i64 b View *view = imp_get_view(models, view_id); i64 result = {}; if (api_check_view(view)){ - result = view_relative_character_from_pos(models, view, base_line, pos); + result = view_relative_character_from_pos(app->tctx, models, view, base_line, pos); } return(result); } @@ -515,7 +505,7 @@ view_pos_from_relative_character(Application_Links *app, View_ID view_id, i64 b View *view = imp_get_view(models, view_id); i64 result = {}; if (api_check_view(view)){ - result = view_pos_from_relative_character(models, view, base_line, character); + result = view_pos_from_relative_character(app->tctx, models, view, base_line, character); } return(result); } @@ -693,12 +683,12 @@ buffer_set_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_I { if (value){ if (!history_is_activated(&file->state.history)){ - history_init(models, &file->state.history); + history_init(app->tctx, models, &file->state.history); } } else{ if (history_is_activated(&file->state.history)){ - history_free(models, &file->state.history); + history_free(app->tctx, &file->state.history); } } }break; @@ -732,7 +722,7 @@ buffer_send_end_signal(Application_Links *app, Buffer_ID buffer_id) Editing_File *file = imp_get_file(models, buffer_id); b32 result = false; if (api_check_buffer(file)){ - file_end_file(models, file); + file_end_file(app->tctx, models, file); result = true; } return(result); @@ -742,7 +732,7 @@ api(custom) function Buffer_ID create_buffer(Application_Links *app, String_Const_u8 file_name, Buffer_Create_Flag flags) { Models *models = (Models*)app->cmd_context; - Editing_File *new_file = create_file(models, file_name, flags); + Editing_File *new_file = create_file(app->tctx, models, file_name, flags); Buffer_ID result = 0; if (new_file != 0){ result = new_file->id; @@ -766,9 +756,10 @@ buffer_save(Application_Links *app, Buffer_ID buffer_id, String_Const_u8 file_na } if (!skip_save){ - Scratch_Block scratch(models->tctx, Scratch_Share); + Thread_Context *tctx = app->tctx; + Scratch_Block scratch(app->tctx, Scratch_Share); String_Const_u8 name = push_string_copy(scratch, file_name); - save_file_to_name(models, file, name.str); + save_file_to_name(tctx, models, file, name.str); result = true; } } @@ -787,15 +778,16 @@ buffer_kill(Application_Links *app, Buffer_ID buffer_id, Buffer_Kill_Flag flags) if (!file->settings.never_kill){ b32 needs_to_save = file_needs_save(file); if (!needs_to_save || (flags & BufferKill_AlwaysKill) != 0){ + Thread_Context *tctx = app->tctx; if (models->end_buffer != 0){ - models->end_buffer(&models->app_links, file->id); + models->end_buffer(app, file->id); } buffer_unbind_name_low_level(working_set, file); if (file->canon.name_size != 0){ buffer_unbind_file(working_set, file); } - file_free(models, file); + file_free(tctx, models, file); working_set_free_file(&models->heap, working_set, file); Layout *layout = &models->layout; @@ -810,7 +802,7 @@ buffer_kill(Application_Links *app, Buffer_ID buffer_id, Buffer_Kill_Flag flags) Assert(file_node != order); view->file = 0; Editing_File *new_file = CastFromMember(Editing_File, touch_node, file_node); - view_set_file(models, view, new_file); + view_set_file(tctx, models, view, new_file); file_node = file_node->next; if (file_node == order){ file_node = file_node->next; @@ -836,7 +828,8 @@ api(custom) function Buffer_Reopen_Result buffer_reopen(Application_Links *app, Buffer_ID buffer_id, Buffer_Reopen_Flag flags) { Models *models = (Models*)app->cmd_context; - Scratch_Block scratch(models->tctx, Scratch_Share); + Thread_Context *tctx = app->tctx; + Scratch_Block scratch(tctx, Scratch_Share); Editing_File *file = imp_get_file(models, buffer_id); Buffer_Reopen_Result result = BufferReopenResult_Failed; if (api_check_buffer(file)){ @@ -875,18 +868,18 @@ buffer_reopen(Application_Links *app, Buffer_ID buffer_id, Buffer_Reopen_Flag fl } Working_Set *working_set = &models->working_set; - file_free(models, file); + file_free(tctx, models, file); working_set_file_default_settings(working_set, file); - file_create_from_string(models, file, SCu8(file_memory, attributes.size), attributes); + file_create_from_string(tctx, models, file, SCu8(file_memory, attributes.size), attributes); for (i32 i = 0; i < vptr_count; ++i){ - view_set_file(models, vptrs[i], file); + view_set_file(tctx, models, vptrs[i], file); vptrs[i]->file = file; i64 line = line_numbers[i]; i64 col = column_numbers[i]; Buffer_Cursor cursor = file_compute_cursor(file, seek_line_col(line, col)); - view_set_cursor(models, vptrs[i], cursor.pos); + view_set_cursor(tctx, models, vptrs[i], cursor.pos); } result = BufferReopenResult_Reopened; } @@ -919,7 +912,7 @@ api(custom) function File_Attributes get_file_attributes(Application_Links *app, String_Const_u8 file_name) { Models *models = (Models*)app->cmd_context; - Scratch_Block scratch(models->tctx, Scratch_Share); + Scratch_Block scratch(app->tctx, Scratch_Share); return(system_quick_file_attributes(scratch, file_name)); } @@ -1172,7 +1165,7 @@ panel_split(Application_Links *app, Panel_ID panel_id, Dimension split_dim){ Live_Views *live_set = &models->live_set; View *new_view = live_set_alloc_view(&models->lifetime_allocator, live_set, new_panel); - view_init(models, new_view, models->scratch_buffer, + view_init(app->tctx, models, new_view, models->scratch_buffer, models->view_event_handler); result = true; } @@ -1321,7 +1314,7 @@ view_get_buffer_region(Application_Links *app, View_ID view_id){ View *view = imp_get_view(models, view_id); Rect_f32 result = {}; if (api_check_view(view)){ - result = view_get_buffer_rect(models, view); + result = view_get_buffer_rect(app->tctx, models, view); } return(result); } @@ -1466,7 +1459,7 @@ view_set_cursor(Application_Links *app, View_ID view_id, Buffer_Seek seek) Assert(file != 0); if (api_check_buffer(file)){ Buffer_Cursor cursor = file_compute_cursor(file, seek); - view_set_cursor(models, view, cursor.pos); + view_set_cursor(app->tctx, models, view, cursor.pos); result = true; } } @@ -1481,15 +1474,16 @@ view_set_buffer_scroll(Application_Links *app, View_ID view_id, Buffer_Scroll sc b32 result = false; View *view = imp_get_view(models, view_id); if (api_check_view(view)){ - scroll.position = view_normalize_buffer_point(models, view, scroll.position); - scroll.target = view_normalize_buffer_point(models, view, scroll.target); + Thread_Context *tctx = app->tctx; + scroll.position = view_normalize_buffer_point(tctx, models, view, scroll.position); + scroll.target = view_normalize_buffer_point(tctx, models, view, scroll.target); scroll.target.pixel_shift.x = f32_round32(scroll.target.pixel_shift.x); scroll.target.pixel_shift.y = f32_round32(scroll.target.pixel_shift.y); scroll.target.pixel_shift.x = clamp_bot(0.f, scroll.target.pixel_shift.x); - Buffer_Layout_Item_List line = view_get_line_layout(models, view, scroll.target.line_number); + Buffer_Layout_Item_List line = view_get_line_layout(tctx, models, view, scroll.target.line_number); scroll.target.pixel_shift.y = clamp(0.f, scroll.target.pixel_shift.y, line.height); if (rule == SetBufferScroll_SnapCursorIntoView){ - view_set_scroll(models, view, scroll); + view_set_scroll(tctx, models, view, scroll); } else{ File_Edit_Positions edit_pos = view_get_edit_pos(view); @@ -1536,7 +1530,7 @@ view_set_buffer(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Se Editing_File *file = working_set_get_file(&models->working_set, buffer_id); if (api_check_buffer(file)){ if (file != view->file){ - view_set_file(models, view, file); + view_set_file(app->tctx, models, view, file); if (!(flags & SetBuffer_KeepOriginalGUI)){ //view_quit_ui(models, view); // TODO(allen): back to base context @@ -1707,7 +1701,7 @@ get_managed_scope_with_multiple_dependencies(Application_Links *app, Managed_Sco Models *models = (Models*)app->cmd_context; Lifetime_Allocator *lifetime_allocator = &models->lifetime_allocator; - Scratch_Block scratch(models->tctx, Scratch_Share); + Scratch_Block scratch(app->tctx, Scratch_Share); // TODO(allen): revisit this struct Node_Ptr{ @@ -2029,9 +2023,11 @@ api(custom) function User_Input get_next_input(Application_Links *app, Event_Property get_properties, Event_Property abort_properties) { Models *models = (Models*)app->cmd_context; + Thread_Context *tctx = app->tctx; + Thread_Context_Extra_Info *tctx_info = (Thread_Context_Extra_Info*)tctx->user_data; User_Input result = {}; - if (app->type_coroutine == Co_View){ - Coroutine *coroutine = (Coroutine*)app->current_coroutine; + if (tctx_info->coroutine != 0){ + Coroutine *coroutine = (Coroutine*)tctx_info->coroutine; if (coroutine != 0){ Co_Out *out = (Co_Out*)coroutine->out; out->request = CoRequest_None; @@ -2213,8 +2209,8 @@ print_message(Application_Links *app, String_Const_u8 message) Editing_File *file = models->message_buffer; b32 result = false; if (file != 0){ - output_file_append(models, file, message); - file_cursor_to_end(models, file); + output_file_append(app->tctx, models, file, message); + file_cursor_to_end(app->tctx, models, file); result = true; } return(result); @@ -2385,7 +2381,7 @@ buffer_history_set_current_state_index(Application_Links *app, Buffer_ID buffer_ if (api_check_buffer(file) && history_is_activated(&file->state.history)){ i32 max_index = history_get_record_count(&file->state.history); if (0 <= index && index <= max_index){ - edit_change_current_history_state(models, file, index); + edit_change_current_history_state(app->tctx, models, file, index); result = true; } } @@ -2398,7 +2394,7 @@ buffer_history_merge_record_range(Application_Links *app, Buffer_ID buffer_id, H Editing_File *file = imp_get_file(models, buffer_id); b32 result = false; if (api_check_buffer(file)){ - result = edit_merge_history_range(models, file, first_index, last_index, flags); + result = edit_merge_history_range(app->tctx, models, file, first_index, last_index, flags); } return(result); } @@ -2502,9 +2498,11 @@ api(custom) function Face_ID try_create_new_face(Application_Links *app, Face_Description *description) { Models *models = (Models*)app->cmd_context; + Thread_Context *tctx = app->tctx; + Thread_Context_Extra_Info *tctx_info = (Thread_Context_Extra_Info*)tctx->user_data; Face_ID result = 0; - if (is_running_coroutine(app)){ - Coroutine *coroutine = (Coroutine*)app->current_coroutine; + if (tctx_info != 0 && tctx_info->coroutine != 0){ + Coroutine *coroutine = (Coroutine*)tctx_info->coroutine; Assert(coroutine != 0); Co_Out *out = (Co_Out*)coroutine->out; out->request = CoRequest_NewFontFace; @@ -2513,6 +2511,9 @@ try_create_new_face(Application_Links *app, Face_Description *description) Co_In *in = (Co_In*)coroutine->in; result = in->face_id; } + else if (tctx_info != 0){ + // This API does nothing when called from an async thread. + } else{ Face *new_face = font_set_new_face(&models->font_set, description); result = new_face->id; @@ -2524,9 +2525,11 @@ api(custom) function b32 try_modify_face(Application_Links *app, Face_ID id, Face_Description *description) { Models *models = (Models*)app->cmd_context; + Thread_Context *tctx = app->tctx; + Thread_Context_Extra_Info *tctx_info = (Thread_Context_Extra_Info*)tctx->user_data; b32 result = false; - if (is_running_coroutine(app)){ - Coroutine *coroutine = (Coroutine*)app->current_coroutine; + if (tctx_info != 0 && tctx_info->coroutine != 0){ + Coroutine *coroutine = (Coroutine*)tctx_info->coroutine; Assert(coroutine != 0); Co_Out *out = (Co_Out*)coroutine->out; out->request = CoRequest_ModifyFace; @@ -2536,6 +2539,9 @@ try_modify_face(Application_Links *app, Face_ID id, Face_Description *descriptio Co_In *in = (Co_In*)coroutine->in; result = in->success; } + else if (tctx_info != 0){ + // This API does nothing when called from an async thread. + } else{ result = font_set_modify_face(&models->font_set, id, description); } @@ -2689,8 +2695,9 @@ text_layout_create(Application_Links *app, Buffer_ID buffer_id, Rect_f32 rect, B Editing_File *file = imp_get_file(models, buffer_id); Text_Layout_ID result = {}; if (api_check_buffer(file)){ - Scratch_Block scratch(app); - Arena *arena = reserve_arena(models->tctx); + Thread_Context *tctx = app->tctx; + Scratch_Block scratch(tctx); + Arena *arena = reserve_arena(tctx); Face *face = file_get_face(models, file); Gap_Buffer *buffer = &file->state.buffer; @@ -2702,7 +2709,7 @@ text_layout_create(Application_Links *app, Buffer_ID buffer_id, Rect_f32 rect, B f32 y = -buffer_point.pixel_shift.y; for (;line_number <= line_count; line_number += 1){ - Buffer_Layout_Item_List line = file_get_line_layout(models, file, dim.x, face, line_number); + Buffer_Layout_Item_List line = file_get_line_layout(tctx, models, file, dim.x, face, line_number); f32 next_y = y + line.height; if (next_y >= dim.y){ break; @@ -2775,7 +2782,7 @@ text_layout_line_on_screen(Application_Links *app, Text_Layout_ID layout_id, i64 for (i64 line_number_it = layout->visible_line_number_range.first;; line_number_it += 1){ - Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, line_number_it); + Buffer_Layout_Item_List line = file_get_line_layout(app->tctx, models, file, width, face, line_number_it); result.max += line.height; if (line_number_it == line_number){ break; @@ -2816,7 +2823,7 @@ text_layout_character_on_screen(Application_Links *app, Text_Layout_ID layout_id Buffer_Layout_Item_List line = {}; for (i64 line_number_it = layout->visible_line_number_range.first;; line_number_it += 1){ - line = file_get_line_layout(models, file, width, face, line_number_it); + line = file_get_line_layout(app->tctx, models, file, width, face, line_number_it); if (line_number_it == line_number){ break; } @@ -2874,7 +2881,7 @@ paint_text_color(Application_Links *app, Text_Layout_ID layout_id, Interval_i64 api(custom) function b32 text_layout_free(Application_Links *app, Text_Layout_ID text_layout_id){ Models *models = (Models*)app->cmd_context; - return(text_layout_erase(models, &models->text_layouts, text_layout_id)); + return(text_layout_erase(app->tctx, models, &models->text_layouts, text_layout_id)); } api(custom) function void @@ -2882,7 +2889,7 @@ draw_text_layout(Application_Links *app, Text_Layout_ID layout_id){ Models *models = (Models*)app->cmd_context; Text_Layout *layout = text_layout_get(&models->text_layouts, layout_id); if (layout != 0 && models->target != 0){ - text_layout_render(models, layout); + text_layout_render(app->tctx, models, layout); } } diff --git a/4ed_app_models.h b/4ed_app_models.h index 472d406b..cdf8b1d1 100644 --- a/4ed_app_models.h +++ b/4ed_app_models.h @@ -35,8 +35,7 @@ enum App_State{ }; struct Models{ - Thread_Context *tctx; - + Arena arena_; Arena *arena; Heap heap; @@ -50,8 +49,6 @@ struct Models{ Child_Process_Container child_processes; Custom_API config_api; - Application_Links app_links; - Render_Caller_Function *render_caller; Delta_Rule_Function *delta_rule; umem delta_rule_memory_size; @@ -141,15 +138,6 @@ struct Consumption_Record{ char consumer[32]; }; -typedef i32 App_Coroutine_Purpose; -enum{ - Co_View, -}; -struct App_Coroutine_State{ - void *co; - i32 type; -}; - struct File_Init{ String_Const_u8 name; Editing_File **ptr; diff --git a/4ed_app_target.cpp b/4ed_app_target.cpp index 99dea7e6..ff1dbf0f 100644 --- a/4ed_app_target.cpp +++ b/4ed_app_target.cpp @@ -79,7 +79,6 @@ #define DYNAMIC_LINK_API #include "generated/font_api.cpp" -#include "4ed_allocator_models.cpp" #include "4ed_log.cpp" #include "4ed_coroutine.cpp" #include "4ed_mem.cpp" diff --git a/4ed_cli.cpp b/4ed_cli.cpp index 72cc8b5e..3c219ef8 100644 --- a/4ed_cli.cpp +++ b/4ed_cli.cpp @@ -98,9 +98,9 @@ child_process_lookup_return_code(Child_Process_Container *container, Child_Proce //////////////////////////////// internal b32 -child_process_call(Models *models, String_Const_u8 path, String_Const_u8 command, Child_Process_ID *id_out){ +child_process_call(Thread_Context *tctx, Models *models, String_Const_u8 path, String_Const_u8 command, Child_Process_ID *id_out){ b32 result = false; - Scratch_Block scratch(&models->app_links); + Scratch_Block scratch(tctx); String_Const_u8 path_n = push_string_copy(scratch, path); String_Const_u8 command_n = push_string_copy(scratch, command); CLI_Handles cli_handles = {}; diff --git a/4ed_coroutine.cpp b/4ed_coroutine.cpp index d14823a5..10224a9d 100644 --- a/4ed_coroutine.cpp +++ b/4ed_coroutine.cpp @@ -30,9 +30,13 @@ internal void coroutine_main(void *ptr){ Coroutine *me = (Coroutine*)ptr; + Thread_Context_Extra_Info tctx_info = {}; + tctx_info.coroutine = me; + Thread_Context tctx_ = {}; thread_ctx_init(&tctx_, ThreadKind_MainCoroutine, get_base_allocator_system(), get_base_allocator_system()); + tctx_.user_data = &tctx_info; me->tctx = &tctx_; // NOTE(allen): Init handshake diff --git a/4ed_dynamic_variables.cpp b/4ed_dynamic_variables.cpp index 5dad2e76..48779479 100644 --- a/4ed_dynamic_variables.cpp +++ b/4ed_dynamic_variables.cpp @@ -67,6 +67,7 @@ internal void lifetime_allocator_init(Base_Allocator *base_allocator, Lifetime_Allocator *lifetime_allocator){ block_zero_struct(lifetime_allocator); lifetime_allocator->allocator = base_allocator; + lifetime_allocator->node_arena = make_arena(base_allocator, KB(4)); lifetime_allocator->key_table = make_table_Data_u64(base_allocator, 100); lifetime_allocator->key_check_table = make_table_u64_u64(base_allocator, 100); lifetime_allocator->scope_id_to_scope_ptr_table = make_table_u64_u64(base_allocator, 100); @@ -250,26 +251,15 @@ lifetime__object_add_key(Lifetime_Allocator *lifetime_allocator, Lifetime_Object internal Lifetime_Object* lifetime_alloc_object(Lifetime_Allocator *lifetime_allocator, i32 user_type, void *user_back_ptr){ - Lifetime_Object *object = lifetime_allocator->free_objects.first; + Lifetime_Object *object = lifetime_allocator->free_objects; if (object == 0){ - i32 new_object_count = 256; - umem new_memory_size = new_object_count*sizeof(Lifetime_Object); - Data new_memory = base_allocate(lifetime_allocator->allocator, new_memory_size); - Lifetime_Object *new_objects = (Lifetime_Object*)new_memory.data; - Lifetime_Object *new_object_ptr = new_objects; - for (i32 i = 0; i < new_object_count; i += 1, new_object_ptr += 1){ - zdll_push_back(lifetime_allocator->free_objects.first, lifetime_allocator->free_objects.last, new_object_ptr); - } - lifetime_allocator->free_objects.count += new_object_count; - object = lifetime_allocator->free_objects.first; + object = push_array(&lifetime_allocator->node_arena, Lifetime_Object, 1); + } + else{ + sll_stack_pop(lifetime_allocator->free_objects); } - - zdll_remove(lifetime_allocator->free_objects.first, lifetime_allocator->free_objects.last, object); - lifetime_allocator->free_objects.count -= 1; - block_zero_struct(object); dynamic_workspace_init(lifetime_allocator, user_type, user_back_ptr, &object->workspace); - return(object); } @@ -313,7 +303,7 @@ internal void lifetime_free_object(Lifetime_Allocator *lifetime_allocator, Lifetime_Object *lifetime_object){ lifetime__object_free_all_keys(lifetime_allocator, lifetime_object); dynamic_workspace_free(lifetime_allocator, &lifetime_object->workspace); - zdll_push_back(lifetime_allocator->free_objects.first, lifetime_allocator->free_objects.last, lifetime_object); + sll_stack_push(lifetime_allocator->free_objects, lifetime_object); } internal void diff --git a/4ed_dynamic_variables.h b/4ed_dynamic_variables.h index 5cb2e4db..1f8352ae 100644 --- a/4ed_dynamic_variables.h +++ b/4ed_dynamic_variables.h @@ -98,18 +98,13 @@ struct Lifetime_Key_Ref_Node{ struct Lifetime_Key *keys[lifetime_key_reference_per_node]; }; -struct Lifetime_Object{ - union{ - struct{ - Lifetime_Object *next; - Lifetime_Object *prev; - }; - struct{ - Lifetime_Key_Ref_Node *key_node_first; - Lifetime_Key_Ref_Node *key_node_last; - i32 key_count; - Dynamic_Workspace workspace; - }; +union Lifetime_Object{ + Lifetime_Object *next; + struct{ + Lifetime_Key_Ref_Node *key_node_first; + Lifetime_Key_Ref_Node *key_node_last; + i32 key_count; + Dynamic_Workspace workspace; }; }; @@ -120,7 +115,7 @@ struct Lifetime_Key{ Lifetime_Key *prev; }; struct{ - struct Lifetime_Object **members; + Lifetime_Object **members; i32 count; Dynamic_Workspace dynamic_workspace; }; @@ -136,12 +131,6 @@ struct Lifetime_Key_Ref_Node_List{ i32 count; }; -struct Lifetime_Object_List{ - Lifetime_Object *first; - Lifetime_Object *last; - i32 count; -}; - struct Lifetime_Key_List{ Lifetime_Key *first; Lifetime_Key *last; @@ -150,8 +139,9 @@ struct Lifetime_Key_List{ struct Lifetime_Allocator{ Base_Allocator *allocator; + Arena node_arena; Lifetime_Key_Ref_Node_List free_key_references; - Lifetime_Object_List free_objects; + Lifetime_Object *free_objects; Lifetime_Key_List free_keys; Table_Data_u64 key_table; Table_u64_u64 key_check_table; diff --git a/4ed_edit.cpp b/4ed_edit.cpp index 558d891c..1d9a28d1 100644 --- a/4ed_edit.cpp +++ b/4ed_edit.cpp @@ -70,7 +70,7 @@ edit_fix_markers__compute_scroll_y(i32 line_height, i32 old_y_val, f32 new_y_val } internal void -edit_fix_markers(Models *models, Editing_File *file, Edit edit){ +edit_fix_markers(Thread_Context *tctx, Models *models, Editing_File *file, Edit edit){ Layout *layout = &models->layout; Lifetime_Object *file_lifetime_object = file->lifetime_object; @@ -97,7 +97,7 @@ edit_fix_markers(Models *models, Editing_File *file, Edit edit){ } cursor_max += total_marker_count; - Scratch_Block scratch(models->tctx, Scratch_Share); + Scratch_Block scratch(tctx, Scratch_Share); Cursor_With_Index *cursors = push_array(scratch, Cursor_With_Index, cursor_max); Cursor_With_Index *r_cursors = push_array(scratch, Cursor_With_Index, cursor_max); @@ -155,7 +155,7 @@ edit_fix_markers(Models *models, Editing_File *file, Edit edit){ i64 cursor_pos = cursors[cursor_count++].pos; view->mark = cursors[cursor_count++].pos; File_Edit_Positions edit_pos = view_get_edit_pos(view); - view_set_cursor_and_scroll(models, view, cursor_pos, edit_pos.scroll); + view_set_cursor_and_scroll(tctx, models, view, cursor_pos, edit_pos.scroll); // TODO(allen): read a cursor for the current scroll line } } @@ -178,7 +178,7 @@ edit_fix_markers(Models *models, Editing_File *file, Edit edit){ } internal void -edit_single(Models *models, Editing_File *file, Interval_i64 range, String_Const_u8 string, Edit_Behaviors behaviors){ +edit_single(Thread_Context *tctx, Models *models, Editing_File *file, Interval_i64 range, String_Const_u8 string, Edit_Behaviors behaviors){ Edit edit = {}; edit.text = string; edit.range = range; @@ -188,7 +188,7 @@ edit_single(Models *models, Editing_File *file, Interval_i64 range, String_Const Assert(edit.range.first <= edit.range.one_past_last); Assert(edit.range.one_past_last <= buffer_size(buffer)); - Scratch_Block scratch(models->tctx, Scratch_Share); + Scratch_Block scratch(tctx, Scratch_Share); // NOTE(allen): history update if (!behaviors.do_not_post_to_history){ @@ -223,19 +223,25 @@ edit_single(Models *models, Editing_File *file, Interval_i64 range, String_Const buffer_remeasure_starts(scratch, buffer, Ii64(line_start, line_end + 1), line_shift, shift_amount); // NOTE(allen): cursor fixing - edit_fix_markers(models, file, edit); + edit_fix_markers(tctx, models, file, edit); // NOTE(allen): edit range hook if (models->buffer_edit_range != 0){ Interval_i64 new_range = Ii64(edit.range.first, edit.range.first + edit.text.size); - models->buffer_edit_range(&models->app_links, file->id, new_range, original_text); + Application_Links app = {}; + app.tctx = tctx;; + app.cmd_context = models; + models->buffer_edit_range(&app, file->id, new_range, original_text); } } internal void -file_end_file(Models *models, Editing_File *file){ +file_end_file(Thread_Context *tctx, Models *models, Editing_File *file){ if (models->end_buffer != 0){ - models->end_buffer(&models->app_links, file->id); + Application_Links app = {}; + app.tctx = tctx; + app.cmd_context = models; + models->end_buffer(&app, file->id); } Lifetime_Allocator *lifetime_allocator = &models->lifetime_allocator; lifetime_free_object(lifetime_allocator, file->lifetime_object); @@ -243,7 +249,7 @@ file_end_file(Models *models, Editing_File *file){ } internal void -edit__apply_record_forward(Models *models, Editing_File *file, Record *record, Edit_Behaviors behaviors_prototype){ +edit__apply_record_forward(Thread_Context *tctx, Models *models, Editing_File *file, Record *record, Edit_Behaviors behaviors_prototype){ // NOTE(allen): // NOTE(allen): // NOTE(allen): // NOTE(allen): // NOTE(allen): // Whenever you change this also change the backward version! @@ -252,7 +258,7 @@ edit__apply_record_forward(Models *models, Editing_File *file, Record *record, E { String_Const_u8 str = record->single.forward_text; Interval_i64 range = Ii64(record->single.first, record->single.first + record->single.backward_text.size); - edit_single(models, file, range, str, behaviors_prototype); + edit_single(tctx, models, file, range, str, behaviors_prototype); }break; case RecordKind_Group: @@ -262,7 +268,7 @@ edit__apply_record_forward(Models *models, Editing_File *file, Record *record, E node != sentinel; node = node->next){ Record *sub_record = CastFromMember(Record, node, node); - edit__apply_record_forward(models, file, sub_record, behaviors_prototype); + edit__apply_record_forward(tctx, models, file, sub_record, behaviors_prototype); } }break; @@ -274,7 +280,7 @@ edit__apply_record_forward(Models *models, Editing_File *file, Record *record, E } internal void -edit__apply_record_backward(Models *models, Editing_File *file, Record *record, Edit_Behaviors behaviors_prototype){ +edit__apply_record_backward(Thread_Context *tctx, Models *models, Editing_File *file, Record *record, Edit_Behaviors behaviors_prototype){ // NOTE(allen): // NOTE(allen): // NOTE(allen): // NOTE(allen): // NOTE(allen): // Whenever you change this also change the forward version! @@ -283,7 +289,7 @@ edit__apply_record_backward(Models *models, Editing_File *file, Record *record, { String_Const_u8 str = record->single.backward_text; Interval_i64 range = Ii64(record->single.first, record->single.first + record->single.forward_text.size); - edit_single(models, file, range, str, behaviors_prototype); + edit_single(tctx, models, file, range, str, behaviors_prototype); }break; case RecordKind_Group: @@ -293,7 +299,7 @@ edit__apply_record_backward(Models *models, Editing_File *file, Record *record, node != sentinel; node = node->prev){ Record *sub_record = CastFromMember(Record, node, node); - edit__apply_record_backward(models, file, sub_record, behaviors_prototype); + edit__apply_record_backward(tctx, models, file, sub_record, behaviors_prototype); } }break; @@ -305,7 +311,7 @@ edit__apply_record_backward(Models *models, Editing_File *file, Record *record, } internal void -edit_change_current_history_state(Models *models, Editing_File *file, i32 target_index){ +edit_change_current_history_state(Thread_Context *tctx, Models *models, Editing_File *file, i32 target_index){ History *history = &file->state.history; if (history->activated && file->state.current_record_index != target_index){ Assert(0 <= target_index && target_index <= history->record_count); @@ -323,13 +329,13 @@ edit_change_current_history_state(Models *models, Editing_File *file, i32 target current += 1; record = CastFromMember(Record, node, record->node.next); Assert(record != dummy_record); - edit__apply_record_forward(models, file, record, behaviors_prototype); + edit__apply_record_forward(tctx, models, file, record, behaviors_prototype); } while (current != target_index); } else{ do{ Assert(record != dummy_record); - edit__apply_record_backward(models, file, record, behaviors_prototype); + edit__apply_record_backward(tctx, models, file, record, behaviors_prototype); current -= 1; record = CastFromMember(Record, node, record->node.prev); } while (current != target_index); @@ -340,7 +346,7 @@ edit_change_current_history_state(Models *models, Editing_File *file, i32 target } internal b32 -edit_merge_history_range(Models *models, Editing_File *file, History_Record_Index first_index, History_Record_Index last_index, Record_Merge_Flag flags){ +edit_merge_history_range(Thread_Context *tctx, Models *models, Editing_File *file, History_Record_Index first_index, History_Record_Index last_index, Record_Merge_Flag flags){ b32 result = false; History *history = &file->state.history; if (history_is_activated(history)){ @@ -354,13 +360,13 @@ edit_merge_history_range(Models *models, Editing_File *file, History_Record_Inde switch (in_range_handler){ case RecordMergeFlag_StateInRange_MoveStateForward: { - edit_change_current_history_state(models, file, last_index); + edit_change_current_history_state(tctx, models, file, last_index); current_index = last_index; }break; case RecordMergeFlag_StateInRange_MoveStateBackward: { - edit_change_current_history_state(models, file, first_index); + edit_change_current_history_state(tctx, models, file, first_index); current_index = first_index; }break; @@ -370,7 +376,7 @@ edit_merge_history_range(Models *models, Editing_File *file, History_Record_Inde }break; } } - Scratch_Block scratch(models->tctx, Scratch_Share); + Scratch_Block scratch(tctx, Scratch_Share); history_merge_records(scratch, history, first_index, last_index); if (current_index >= last_index){ current_index -= (last_index - first_index); @@ -385,7 +391,7 @@ edit_merge_history_range(Models *models, Editing_File *file, History_Record_Inde } internal b32 -edit_batch(Models *models, Editing_File *file, Batch_Edit *batch, Edit_Behaviors behaviors){ +edit_batch(Thread_Context *tctx, Models *models, Editing_File *file, Batch_Edit *batch, Edit_Behaviors behaviors){ b32 result = true; if (batch != 0){ History_Record_Index start_index = 0; @@ -405,7 +411,7 @@ edit_batch(Models *models, Editing_File *file, Batch_Edit *batch, Edit_Behaviors if (0 <= edit_range.first && edit_range.first <= edit_range.one_past_last && edit_range.one_past_last <= size){ - edit_single(models, file, edit_range, insert_string, behaviors); + edit_single(tctx, models, file, edit_range, insert_string, behaviors); shift += replace_range_shift(edit_range, insert_string.size); } else{ @@ -417,7 +423,7 @@ edit_batch(Models *models, Editing_File *file, Batch_Edit *batch, Edit_Behaviors if (history_is_activated(&file->state.history)){ History_Record_Index last_index = file->state.current_record_index; if (start_index + 1 < last_index){ - edit_merge_history_range(models, file, start_index + 1, last_index, RecordMergeFlag_StateInRange_ErrorOut); + edit_merge_history_range(tctx, models, file, start_index + 1, last_index, RecordMergeFlag_StateInRange_ErrorOut); } } } @@ -427,14 +433,14 @@ edit_batch(Models *models, Editing_File *file, Batch_Edit *batch, Edit_Behaviors //////////////////////////////// internal Editing_File* -create_file(Models *models, String_Const_u8 file_name, Buffer_Create_Flag flags){ +create_file(Thread_Context *tctx, Models *models, String_Const_u8 file_name, Buffer_Create_Flag flags){ Editing_File *result = 0; if (file_name.size > 0){ Working_Set *working_set = &models->working_set; Heap *heap = &models->heap; - Scratch_Block scratch(models->tctx); + Scratch_Block scratch(tctx); Editing_File *file = 0; b32 do_empty_buffer = false; @@ -487,9 +493,9 @@ create_file(Models *models, String_Const_u8 file_name, Buffer_Create_Flag flags) file_bind_file_name(working_set, file, string_from_file_name(&canon)); } String_Const_u8 front = string_front_of_path(file_name); - buffer_bind_name(models, scratch, working_set, file, front); + buffer_bind_name(tctx, models, scratch, working_set, file, front); File_Attributes attributes = {}; - file_create_from_string(models, file, SCu8(""), attributes); + file_create_from_string(tctx, models, file, SCu8(""), attributes); result = file; } } @@ -511,8 +517,8 @@ create_file(Models *models, String_Const_u8 file_name, Buffer_Create_Flag flags) if (file != 0){ file_bind_file_name(working_set, file, string_from_file_name(&canon)); String_Const_u8 front = string_front_of_path(file_name); - buffer_bind_name(models, scratch, working_set, file, front); - file_create_from_string(models, file, SCu8(buffer, (i32)attributes.size), attributes); + buffer_bind_name(tctx, models, scratch, working_set, file, front); + file_create_from_string(tctx, models, file, SCu8(buffer, (i32)attributes.size), attributes); result = file; } } @@ -537,7 +543,7 @@ create_file(Models *models, String_Const_u8 file_name, Buffer_Create_Flag flags) i64 size = buffer_size(&file->state.buffer); if (size > 0){ Edit_Behaviors behaviors = {}; - edit_single(models, file, Ii64(0, size), string_u8_litexpr(""), behaviors); + edit_single(tctx, models, file, Ii64(0, size), string_u8_litexpr(""), behaviors); if (has_canon_name){ buffer_is_for_new_file = true; } @@ -547,7 +553,10 @@ create_file(Models *models, String_Const_u8 file_name, Buffer_Create_Flag flags) if (file != 0 && buffer_is_for_new_file && !HasFlag(flags, BufferCreate_SuppressNewFileHook) && models->new_file != 0){ - models->new_file(&models->app_links, file->id); + Application_Links app = {}; + app.tctx = tctx; + app.cmd_context = models; + models->new_file(&app, file->id); } } diff --git a/4ed_file.cpp b/4ed_file.cpp index 43b436bb..825904cd 100644 --- a/4ed_file.cpp +++ b/4ed_file.cpp @@ -137,7 +137,7 @@ file_name_terminate(Editing_File_Name *name){ // TODO(allen): file_name should be String_Const_u8 internal b32 -save_file_to_name(Models *models, Editing_File *file, u8 *file_name){ +save_file_to_name(Thread_Context *tctx, Models *models, Editing_File *file, u8 *file_name){ b32 result = false; b32 using_actual_file_name = false; @@ -149,13 +149,16 @@ save_file_to_name(Models *models, Editing_File *file, u8 *file_name){ if (file_name != 0){ if (models->save_file != 0){ - models->save_file(&models->app_links, file->id); + Application_Links app = {}; + app.tctx = tctx; + app.cmd_context = models; + models->save_file(&app, file->id); } Gap_Buffer *buffer = &file->state.buffer; b32 dos_write_mode = file->settings.dos_write_mode; - Scratch_Block scratch(models->tctx, Scratch_Share); + Scratch_Block scratch(tctx, Scratch_Share); if (!using_actual_file_name){ String_Const_u8 s_file_name = SCu8(file_name); @@ -181,8 +184,8 @@ save_file_to_name(Models *models, Editing_File *file, u8 *file_name){ } internal b32 -save_file(Models *models, Editing_File *file){ - return(save_file_to_name(models, file, 0)); +save_file(Thread_Context *tctx, Models *models, Editing_File *file){ + return(save_file_to_name(tctx, models, file, 0)); } //////////////////////////////// @@ -206,8 +209,7 @@ file_compute_cursor(Editing_File *file, Buffer_Seek seek){ //////////////////////////////// internal void -file_create_from_string(Models *models, Editing_File *file, String_Const_u8 val, File_Attributes attributes){ - Thread_Context *tctx = models->tctx; +file_create_from_string(Thread_Context *tctx, Models *models, Editing_File *file, String_Const_u8 val, File_Attributes attributes){ Scratch_Block scratch(tctx, Scratch_Share); Base_Allocator *allocator = tctx->allocator; @@ -225,7 +227,7 @@ file_create_from_string(Models *models, Editing_File *file, String_Const_u8 val, buffer_measure_starts(scratch, &file->state.buffer); file->lifetime_object = lifetime_alloc_object(&models->lifetime_allocator, DynamicWorkspace_Buffer, file); - history_init(models, &file->state.history); + history_init(tctx, models, &file->state.history); file->state.cached_layouts_arena = make_arena(allocator); file->state.line_layout_table = make_table_Data_u64(allocator, 500); @@ -245,12 +247,15 @@ file_create_from_string(Models *models, Editing_File *file, String_Const_u8 val, //////////////////////////////// if (models->begin_buffer != 0){ - models->begin_buffer(&models->app_links, file->id); + Application_Links app = {}; + app.tctx = tctx; + app.cmd_context = models; + models->begin_buffer(&app, file->id); } } internal void -file_free(Models *models, Editing_File *file){ +file_free(Thread_Context *tctx, Models *models, Editing_File *file){ Lifetime_Allocator *lifetime_allocator = &models->lifetime_allocator; Working_Set *working_set = &models->working_set; @@ -262,7 +267,7 @@ file_free(Models *models, Editing_File *file){ base_free(buffer->allocator, buffer->line_starts); } - history_free(models, &file->state.history); + history_free(tctx, &file->state.history); linalloc_clear(&file->state.cached_layouts_arena); table_free(&file->state.line_layout_table); @@ -288,7 +293,7 @@ file_get_managed_scope(Editing_File *file){ //////////////////////////////// internal Buffer_Layout_Item_List -file_get_line_layout(Models *models, Editing_File *file, f32 width, Face *face, i64 line_number){ +file_get_line_layout(Thread_Context *tctx, Models *models, Editing_File *file, f32 width, Face *face, i64 line_number){ Buffer_Layout_Item_List result = {}; i64 line_count = buffer_line_count(&file->state.buffer); @@ -312,7 +317,7 @@ file_get_line_layout(Models *models, Editing_File *file, f32 width, Face *face, else{ list = push_array(&file->state.cached_layouts_arena, Buffer_Layout_Item_List, 1); Interval_i64 line_range = buffer_get_pos_range_from_line_number(&file->state.buffer, line_number); - *list = buffer_layout(models->tctx, &file->state.cached_layouts_arena, + *list = buffer_layout(tctx, &file->state.cached_layouts_arena, &file->state.buffer, line_range, face, width); key_data = push_data_copy(&file->state.cached_layouts_arena, key_data); table_insert(&file->state.line_layout_table, key_data, (u64)PtrAsInt(list)); @@ -330,7 +335,7 @@ file_clear_layout_cache(Editing_File *file){ } internal Line_Shift_Vertical -file_line_shift_y(Models *models, Editing_File *file, f32 width, Face *face, i64 line_number, f32 y_delta){ +file_line_shift_y(Thread_Context *tctx, Models *models, Editing_File *file, f32 width, Face *face, i64 line_number, f32 y_delta){ Line_Shift_Vertical result = {}; f32 line_y = 0.f; @@ -350,7 +355,7 @@ file_line_shift_y(Models *models, Editing_File *file, f32 width, Face *face, i64 line_number = 1; break; } - Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, line_number); + Buffer_Layout_Item_List line = file_get_line_layout(tctx, models, file, width, face, line_number); line_y -= line.height; } if (!has_result){ @@ -363,7 +368,7 @@ file_line_shift_y(Models *models, Editing_File *file, f32 width, Face *face, i64 b32 has_result = false; i64 line_count = buffer_line_count(&file->state.buffer); for (;;line_number += 1){ - Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, line_number); + Buffer_Layout_Item_List line = file_get_line_layout(tctx, models, file, width, face, line_number); f32 next_y = line_y + line.height; if (y_delta < next_y){ has_result = true; @@ -386,12 +391,12 @@ file_line_shift_y(Models *models, Editing_File *file, f32 width, Face *face, i64 } internal f32 -file_line_y_difference(Models *models, Editing_File *file, f32 width, Face *face, i64 line_a, i64 line_b){ +file_line_y_difference(Thread_Context *tctx, Models *models, Editing_File *file, f32 width, Face *face, i64 line_a, i64 line_b){ f32 result = 0.f; if (line_a != line_b){ Interval_i64 line_range = Ii64(line_a, line_b); for (i64 i = line_range.min; i < line_range.max; i += 1){ - Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, i); + Buffer_Layout_Item_List line = file_get_line_layout(tctx, models, file, width, face, i); result += line.height; } if (line_a < line_b){ @@ -402,25 +407,25 @@ file_line_y_difference(Models *models, Editing_File *file, f32 width, Face *face } internal i64 -file_pos_at_relative_xy(Models *models, Editing_File *file, f32 width, Face *face, i64 base_line, Vec2_f32 relative_xy){ - Line_Shift_Vertical shift = file_line_shift_y(models, file, width, face, base_line, relative_xy.y); +file_pos_at_relative_xy(Thread_Context *tctx, Models *models, Editing_File *file, f32 width, Face *face, i64 base_line, Vec2_f32 relative_xy){ + Line_Shift_Vertical shift = file_line_shift_y(tctx, models, file, width, face, base_line, relative_xy.y); relative_xy.y -= shift.y_delta; - Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, shift.line); + Buffer_Layout_Item_List line = file_get_line_layout(tctx, models, file, width, face, shift.line); return(buffer_layout_nearest_pos_to_xy(line, relative_xy)); } internal Vec2_f32 -file_relative_xy_of_pos(Models *models, Editing_File *file, f32 width, Face *face, i64 base_line, i64 pos){ +file_relative_xy_of_pos(Thread_Context *tctx, Models *models, Editing_File *file, f32 width, Face *face, i64 base_line, i64 pos){ i64 line_number = buffer_get_line_index(&file->state.buffer, pos) + 1; - Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, line_number); + Buffer_Layout_Item_List line = file_get_line_layout(tctx, models, file, width, face, line_number); Vec2_f32 result = buffer_layout_xy_center_of_pos(line, pos); - result.y += file_line_y_difference(models, file, width, face, line_number, base_line); + result.y += file_line_y_difference(tctx, models, file, width, face, line_number, base_line); return(result); } internal Buffer_Point -file_normalize_buffer_point(Models *models, Editing_File *file, f32 width, Face *face, Buffer_Point point){ - Line_Shift_Vertical shift = file_line_shift_y(models, file, width, face, point.line_number, point.pixel_shift.y); +file_normalize_buffer_point(Thread_Context *tctx, Models *models, Editing_File *file, f32 width, Face *face, Buffer_Point point){ + Line_Shift_Vertical shift = file_line_shift_y(tctx, models, file, width, face, point.line_number, point.pixel_shift.y); point.line_number = shift.line; point.pixel_shift.y -= shift.y_delta; point.pixel_shift.x = clamp_bot(0.f, point.pixel_shift.x); @@ -429,15 +434,15 @@ file_normalize_buffer_point(Models *models, Editing_File *file, f32 width, Face } internal Vec2_f32 -file_buffer_point_difference(Models *models, Editing_File *file, f32 width, Face *face, Buffer_Point a, Buffer_Point b){ - f32 y_difference = file_line_y_difference(models, file, width, face, a.line_number, b.line_number); +file_buffer_point_difference(Thread_Context *tctx, Models *models, Editing_File *file, f32 width, Face *face, Buffer_Point a, Buffer_Point b){ + f32 y_difference = file_line_y_difference(tctx, models, file, width, face, a.line_number, b.line_number); Vec2_f32 result = a.pixel_shift - b.pixel_shift; result.y += y_difference; return(result); } internal Line_Shift_Character -file_line_shift_characters(Models *models, Editing_File *file, f32 width, Face *face, i64 line_number, i64 character_delta){ +file_line_shift_characters(Thread_Context *tctx, Models *models, Editing_File *file, f32 width, Face *face, i64 line_number, i64 character_delta){ Line_Shift_Character result = {}; i64 line_character = 0; @@ -457,7 +462,7 @@ file_line_shift_characters(Models *models, Editing_File *file, f32 width, Face * line_number = 1; break; } - Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, line_number); + Buffer_Layout_Item_List line = file_get_line_layout(tctx, models, file, width, face, line_number); line_character -= line.character_count; } if (!has_result){ @@ -470,7 +475,7 @@ file_line_shift_characters(Models *models, Editing_File *file, f32 width, Face * b32 has_result = false; i64 line_count = buffer_line_count(&file->state.buffer); for (;;line_number += 1){ - Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, line_number); + Buffer_Layout_Item_List line = file_get_line_layout(tctx, models, file, width, face, line_number); i64 next_character = line_character + line.character_count; if (character_delta < next_character){ has_result = true; @@ -493,12 +498,12 @@ file_line_shift_characters(Models *models, Editing_File *file, f32 width, Face * } internal i64 -file_line_character_difference(Models *models, Editing_File *file, f32 width, Face *face, i64 line_a, i64 line_b){ +file_line_character_difference(Thread_Context *tctx, Models *models, Editing_File *file, f32 width, Face *face, i64 line_a, i64 line_b){ i64 result = 0; if (line_a != line_b){ Interval_i64 line_range = Ii64(line_a, line_b); for (i64 i = line_range.min; i < line_range.max; i += 1){ - Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, i); + Buffer_Layout_Item_List line = file_get_line_layout(tctx, models, file, width, face, i); result += line.character_count; } if (line_a < line_b){ @@ -509,19 +514,19 @@ file_line_character_difference(Models *models, Editing_File *file, f32 width, Fa } internal i64 -file_pos_from_relative_character(Models *models, Editing_File *file, f32 width, Face *face, i64 base_line, i64 relative_character){ - Line_Shift_Character shift = file_line_shift_characters(models, file, width, face, base_line, relative_character); +file_pos_from_relative_character(Thread_Context *tctx, Models *models, Editing_File *file, f32 width, Face *face, i64 base_line, i64 relative_character){ + Line_Shift_Character shift = file_line_shift_characters(tctx, models, file, width, face, base_line, relative_character); relative_character -= shift.character_delta; - Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, shift.line); + Buffer_Layout_Item_List line = file_get_line_layout(tctx, models, file, width, face, shift.line); return(buffer_layout_get_pos_at_character(line, relative_character)); } internal i64 -file_relative_character_from_pos(Models *models, Editing_File *file, f32 width, Face *face, i64 base_line, i64 pos){ +file_relative_character_from_pos(Thread_Context *tctx, Models *models, Editing_File *file, f32 width, Face *face, i64 base_line, i64 pos){ i64 line_number = buffer_get_line_index(&file->state.buffer, pos) + 1; - Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, line_number); + Buffer_Layout_Item_List line = file_get_line_layout(tctx, models, file, width, face, line_number); i64 result = buffer_layout_character_from_pos(line, pos); - result += file_line_character_difference(models, file, width, face, line_number, base_line); + result += file_line_character_difference(tctx, models, file, width, face, line_number, base_line); return(result); } diff --git a/4ed_history.cpp b/4ed_history.cpp index 1cceeaf4..d18e84b1 100644 --- a/4ed_history.cpp +++ b/4ed_history.cpp @@ -129,9 +129,8 @@ global_history_adjust_edit_grouping_counter(Global_History *global_history, i32 } internal void -history_init(Models *models, History *history){ +history_init(Thread_Context *tctx, Models *models, History *history){ history->activated = true; - Thread_Context *tctx = models->tctx; history->arena = reserve_arena(tctx, KB(32)); heap_init(&history->heap, tctx->allocator); history->heap_wrapper = base_allocator_on_heap(&history->heap); @@ -147,9 +146,9 @@ history_is_activated(History *history){ } internal void -history_free(Models *models, History *history){ +history_free(Thread_Context *tctx, History *history){ if (history->activated){ - release_arena(models, history->arena); + release_arena(tctx, history->arena); heap_free_all(&history->heap); block_zero_struct(history); } diff --git a/4ed_log.cpp b/4ed_log.cpp index 51f3d45c..de9eee94 100644 --- a/4ed_log.cpp +++ b/4ed_log.cpp @@ -31,10 +31,10 @@ log_string(String_Const_u8 str){ } internal void -output_file_append(Models *models, Editing_File *file, String_Const_u8 value); +output_file_append(Thread_Context *tctx, Models *models, Editing_File *file, String_Const_u8 value); internal b32 -log_flush(Models *models){ +log_flush(Thread_Context *tctx, Models *models){ b32 result = false; system_mutex_acquire(global_log.mutex); @@ -42,7 +42,7 @@ log_flush(Models *models){ if (global_log.list.total_size > 0){ String_Const_u8 text = string_list_flatten(&global_log.arena, global_log.list); - output_file_append(models, models->log_buffer, text); + output_file_append(tctx, models, models->log_buffer, text); result = true; } linalloc_clear(&global_log.arena); diff --git a/4ed_text_layout.cpp b/4ed_text_layout.cpp index 1e72bd8b..1057d534 100644 --- a/4ed_text_layout.cpp +++ b/4ed_text_layout.cpp @@ -10,10 +10,10 @@ // TOP internal void -text_layout_init(Models *models, Text_Layout_Container *container){ +text_layout_init(Thread_Context *tctx, Text_Layout_Container *container){ block_zero_struct(container); - container->node_arena = reserve_arena(models->tctx); - container->table = make_table_u64_u64(models->tctx->allocator, 20); + container->node_arena = reserve_arena(tctx); + container->table = make_table_u64_u64(tctx->allocator, 20); } internal Text_Layout* @@ -29,8 +29,8 @@ text_layout_new__alloc_layout(Text_Layout_Container *container){ } internal void -text_layout_release(Models *models, Text_Layout_Container *container, Text_Layout *layout){ - release_arena(models->tctx, layout->arena); +text_layout_release(Thread_Context *tctx, Models *models, Text_Layout_Container *container, Text_Layout *layout){ + release_arena(tctx, layout->arena); sll_stack_push(container->free_nodes, layout); } @@ -65,14 +65,14 @@ text_layout_get(Text_Layout_Container *container, Text_Layout_ID id){ } internal b32 -text_layout_erase(Models *models, Text_Layout_Container *container, Text_Layout_ID id){ +text_layout_erase(Thread_Context *tctx, Models *models, Text_Layout_Container *container, Text_Layout_ID id){ b32 result = false; Table_Lookup lookup = table_lookup(&container->table, id); if (lookup.found_match){ u64 ptr_val = 0; table_read(&container->table, lookup, &ptr_val); Text_Layout *ptr = (Text_Layout*)IntAsPtr(ptr_val); - text_layout_release(models, container, ptr); + text_layout_release(tctx, models, container, ptr); table_erase(&container->table, lookup); result = true; } @@ -82,7 +82,7 @@ text_layout_erase(Models *models, Text_Layout_Container *container, Text_Layout_ //////////////////////////////// internal void -text_layout_render(Models *models, Text_Layout *layout){ +text_layout_render(Thread_Context *tctx, Models *models, Text_Layout *layout){ Editing_File *file = imp_get_file(models, layout->buffer_id); if (file != 0){ Render_Target *target = models->target; @@ -98,7 +98,7 @@ text_layout_render(Models *models, Text_Layout *layout){ i64 line_number = layout->visible_line_number_range.min; i64 line_number_last = layout->visible_line_number_range.max; for (;line_number <= line_number_last; line_number += 1){ - Buffer_Layout_Item_List line = file_get_line_layout(models, file, width, face, line_number); + Buffer_Layout_Item_List line = file_get_line_layout(tctx, models, file, width, face, line_number); for (Buffer_Layout_Item_Block *block = line.first; block != 0; block = block->next){ diff --git a/4ed_view.cpp b/4ed_view.cpp index abfe0973..c3a98040 100644 --- a/4ed_view.cpp +++ b/4ed_view.cpp @@ -148,12 +148,15 @@ view_set_edit_pos(View *view, File_Edit_Positions edit_pos){ //////////////////////////////// internal Rect_f32 -view_get_buffer_rect(Models *models, View *view){ +view_get_buffer_rect(Thread_Context *tctx, Models *models, View *view){ Rect_f32 region = Rf32(view->panel->rect_full); if (models->buffer_region != 0){ Rect_f32 rect = region; Rect_f32 sub_region = Rf32(V2(0, 0), rect_dim(rect)); - sub_region = models->buffer_region(&models->app_links, view_get_id(&models->live_set, view), sub_region); + Application_Links app = {}; + app.tctx = tctx; + app.cmd_context = models; + sub_region = models->buffer_region(&app, view_get_id(&models->live_set, view), sub_region); region.p0 = rect.p0 + sub_region.p0; region.p1 = rect.p0 + sub_region.p1; region.x1 = clamp_top(region.x1, rect.x1); @@ -165,112 +168,112 @@ view_get_buffer_rect(Models *models, View *view){ } internal f32 -view_width(Models *models, View *view){ - return(rect_width(view_get_buffer_rect(models, view))); +view_width(Thread_Context *tctx, Models *models, View *view){ + return(rect_width(view_get_buffer_rect(tctx, models, view))); } internal f32 -view_height(Models *models, View *view){ - return(rect_height(view_get_buffer_rect(models, view))); +view_height(Thread_Context *tctx, Models *models, View *view){ + return(rect_height(view_get_buffer_rect(tctx, models, view))); } //////////////////////////////// internal Buffer_Layout_Item_List -view_get_line_layout(Models *models, View *view, i64 line_number){ +view_get_line_layout(Thread_Context *tctx, Models *models, View *view, i64 line_number){ Editing_File *file = view->file; Face *face = file_get_face(models, file); - f32 width = view_width(models, view); - return(file_get_line_layout(models, file, width, face, line_number)); + f32 width = view_width(tctx, models, view); + return(file_get_line_layout(tctx, models, file, width, face, line_number)); } internal Line_Shift_Vertical -view_line_shift_y(Models *models, View *view, i64 line_number, f32 y_delta){ +view_line_shift_y(Thread_Context *tctx, Models *models, View *view, i64 line_number, f32 y_delta){ Editing_File *file = view->file; Face *face = file_get_face(models, file); - f32 width = view_width(models, view); - return(file_line_shift_y(models, file, width, face, line_number, y_delta)); + f32 width = view_width(tctx, models, view); + return(file_line_shift_y(tctx, models, file, width, face, line_number, y_delta)); } internal f32 -view_line_y_difference(Models *models, View *view, i64 line_a, i64 line_b){ +view_line_y_difference(Thread_Context *tctx, Models *models, View *view, i64 line_a, i64 line_b){ Editing_File *file = view->file; Face *face = file_get_face(models, file); - f32 width = view_width(models, view); - return(file_line_y_difference(models, file, width, face, line_a, line_b)); + f32 width = view_width(tctx, models, view); + return(file_line_y_difference(tctx, models, file, width, face, line_a, line_b)); } internal i64 -view_pos_at_relative_xy(Models *models, View *view, i64 base_line, Vec2_f32 relative_xy){ +view_pos_at_relative_xy(Thread_Context *tctx, Models *models, View *view, i64 base_line, Vec2_f32 relative_xy){ Editing_File *file = view->file; Face *face = file_get_face(models, file); - f32 width = view_width(models, view); - return(file_pos_at_relative_xy(models, file, width, face, base_line, relative_xy)); + f32 width = view_width(tctx, models, view); + return(file_pos_at_relative_xy(tctx, models, file, width, face, base_line, relative_xy)); } internal Vec2_f32 -view_relative_xy_of_pos(Models *models, View *view, i64 base_line, i64 pos){ +view_relative_xy_of_pos(Thread_Context *tctx, Models *models, View *view, i64 base_line, i64 pos){ Editing_File *file = view->file; Face *face = file_get_face(models, file); - f32 width = view_width(models, view); - return(file_relative_xy_of_pos(models, file, width, face, base_line, pos)); + f32 width = view_width(tctx, models, view); + return(file_relative_xy_of_pos(tctx, models, file, width, face, base_line, pos)); } internal Buffer_Point -view_normalize_buffer_point(Models *models, View *view, Buffer_Point point){ +view_normalize_buffer_point(Thread_Context *tctx, Models *models, View *view, Buffer_Point point){ Editing_File *file = view->file; Face *face = file_get_face(models, file); - f32 width = view_width(models, view); - return(file_normalize_buffer_point(models, file, width, face, point)); + f32 width = view_width(tctx, models, view); + return(file_normalize_buffer_point(tctx, models, file, width, face, point)); } internal Vec2_f32 -view_buffer_point_difference(Models *models, View *view, Buffer_Point a, Buffer_Point b){ +view_buffer_point_difference(Thread_Context *tctx, Models *models, View *view, Buffer_Point a, Buffer_Point b){ Editing_File *file = view->file; Face *face = file_get_face(models, file); - f32 width = view_width(models, view); - return(file_buffer_point_difference(models, file, width, face, a, b)); + f32 width = view_width(tctx, models, view); + return(file_buffer_point_difference(tctx, models, file, width, face, a, b)); } internal Buffer_Point -view_move_buffer_point(Models *models, View *view, Buffer_Point buffer_point, Vec2_f32 delta){ +view_move_buffer_point(Thread_Context *tctx, Models *models, View *view, Buffer_Point buffer_point, Vec2_f32 delta){ delta += buffer_point.pixel_shift; - Line_Shift_Vertical shift = view_line_shift_y(models, view, buffer_point.line_number, delta.y); + Line_Shift_Vertical shift = view_line_shift_y(tctx, models, view, buffer_point.line_number, delta.y); buffer_point.line_number = shift.line; buffer_point.pixel_shift = V2f32(delta.x, delta.y - shift.y_delta); return(buffer_point); } internal Line_Shift_Character -view_line_shift_characters(Models *models, View *view, i64 line_number, i64 character_delta){ +view_line_shift_characters(Thread_Context *tctx, Models *models, View *view, i64 line_number, i64 character_delta){ Editing_File *file = view->file; Face *face = file_get_face(models, file); - f32 width = view_width(models, view); - return(file_line_shift_characters(models, file, width, face, line_number, character_delta)); + f32 width = view_width(tctx, models, view); + return(file_line_shift_characters(tctx, models, file, width, face, line_number, character_delta)); } internal i64 -view_line_character_difference(Models *models, View *view, i64 line_a, i64 line_b){ +view_line_character_difference(Thread_Context *tctx, Models *models, View *view, i64 line_a, i64 line_b){ Editing_File *file = view->file; Face *face = file_get_face(models, file); - f32 width = view_width(models, view); - return(file_line_character_difference(models, file, width, face, line_a, line_b)); + f32 width = view_width(tctx, models, view); + return(file_line_character_difference(tctx, models, file, width, face, line_a, line_b)); } internal i64 -view_pos_from_relative_character(Models *models, View *view, i64 base_line, i64 relative_character){ +view_pos_from_relative_character(Thread_Context *tctx, Models *models, View *view, i64 base_line, i64 relative_character){ Editing_File *file = view->file; Face *face = file_get_face(models, file); - f32 width = view_width(models, view); - return(file_pos_from_relative_character(models, file, width, face, base_line, relative_character)); + f32 width = view_width(tctx, models, view); + return(file_pos_from_relative_character(tctx, models, file, width, face, base_line, relative_character)); } internal i64 -view_relative_character_from_pos(Models *models, View *view, i64 base_line, i64 pos){ +view_relative_character_from_pos(Thread_Context *tctx, Models *models, View *view, i64 base_line, i64 pos){ Editing_File *file = view->file; Face *face = file_get_face(models, file); - f32 width = view_width(models, view); - return(file_relative_character_from_pos(models, file, width, face, base_line, pos)); + f32 width = view_width(tctx, models, view); + return(file_relative_character_from_pos(tctx, models, file, width, face, base_line, pos)); } internal Buffer_Cursor @@ -282,14 +285,14 @@ view_compute_cursor(View *view, Buffer_Seek seek){ //////////////////////////////// internal b32 -view_move_view_to_cursor(Models *models, View *view, Buffer_Scroll *scroll){ +view_move_view_to_cursor(Thread_Context *tctx, Models *models, View *view, Buffer_Scroll *scroll){ Editing_File *file = view->file; Face *face = file_get_face(models, file); - Rect_f32 rect = view_get_buffer_rect(models, view); + Rect_f32 rect = view_get_buffer_rect(tctx, models, view); Vec2_f32 view_dim = rect_dim(rect); File_Edit_Positions edit_pos = view_get_edit_pos(view); - Vec2_f32 p = file_relative_xy_of_pos(models, file, view_dim.x, face, scroll->target.line_number, + Vec2_f32 p = file_relative_xy_of_pos(tctx, models, file, view_dim.x, face, scroll->target.line_number, edit_pos.cursor_pos); p -= scroll->target.pixel_shift; @@ -310,7 +313,7 @@ view_move_view_to_cursor(Models *models, View *view, Buffer_Scroll *scroll){ target_p_relative.x = (p.x + typical_advance*1.5f) - view_dim.x; } scroll->target.pixel_shift += target_p_relative; - scroll->target = view_normalize_buffer_point(models, view, scroll->target); + scroll->target = view_normalize_buffer_point(tctx, models, view, scroll->target); scroll->target.pixel_shift.x = f32_round32(scroll->target.pixel_shift.x); scroll->target.pixel_shift.y = f32_round32(scroll->target.pixel_shift.y); @@ -318,13 +321,13 @@ view_move_view_to_cursor(Models *models, View *view, Buffer_Scroll *scroll){ } internal b32 -view_move_cursor_to_view(Models *models, View *view, Buffer_Scroll scroll, i64 *pos_in_out, f32 preferred_x){ +view_move_cursor_to_view(Thread_Context *tctx, Models *models, View *view, Buffer_Scroll scroll, i64 *pos_in_out, f32 preferred_x){ Editing_File *file = view->file; Face *face = file_get_face(models, file); - Rect_f32 rect = view_get_buffer_rect(models, view); + Rect_f32 rect = view_get_buffer_rect(tctx, models, view); Vec2_f32 view_dim = rect_dim(rect); - Vec2_f32 p = file_relative_xy_of_pos(models, file, view_dim.x, face, scroll.target.line_number, *pos_in_out); + Vec2_f32 p = file_relative_xy_of_pos(tctx, models, file, view_dim.x, face, scroll.target.line_number, *pos_in_out); p -= scroll.target.pixel_shift; f32 line_height = face->line_height; @@ -343,7 +346,7 @@ view_move_cursor_to_view(Models *models, View *view, Buffer_Scroll scroll, i64 * b32 result = false; if (adjusted_y){ p += scroll.target.pixel_shift; - *pos_in_out = file_pos_at_relative_xy(models, file, view_dim.x, face, scroll.target.line_number, p); + *pos_in_out = file_pos_at_relative_xy(tctx, models, file, view_dim.x, face, scroll.target.line_number, p); result = true; } @@ -351,33 +354,33 @@ view_move_cursor_to_view(Models *models, View *view, Buffer_Scroll scroll, i64 * } internal void -view_set_cursor(Models *models, View *view, i64 pos){ +view_set_cursor(Thread_Context *tctx, Models *models, View *view, i64 pos){ File_Edit_Positions edit_pos = view_get_edit_pos(view); file_edit_positions_set_cursor(&edit_pos, pos); view_set_edit_pos(view, edit_pos); Buffer_Scroll scroll = edit_pos.scroll; - if (view_move_view_to_cursor(models, view, &scroll)){ + if (view_move_view_to_cursor(tctx, models, view, &scroll)){ edit_pos.scroll = scroll; view_set_edit_pos(view, edit_pos); } } internal void -view_set_scroll(Models *models, View *view, Buffer_Scroll scroll){ +view_set_scroll(Thread_Context *tctx, Models *models, View *view, Buffer_Scroll scroll){ File_Edit_Positions edit_pos = view_get_edit_pos(view); file_edit_positions_set_scroll(&edit_pos, scroll); view_set_edit_pos(view, edit_pos); - if (view_move_cursor_to_view(models, view, edit_pos.scroll, &edit_pos.cursor_pos, view->preferred_x)){ + if (view_move_cursor_to_view(tctx, models, view, edit_pos.scroll, &edit_pos.cursor_pos, view->preferred_x)){ view_set_edit_pos(view, edit_pos); } } internal void -view_set_cursor_and_scroll(Models *models, View *view, i64 pos, Buffer_Scroll scroll){ +view_set_cursor_and_scroll(Thread_Context *tctx, Models *models, View *view, i64 pos, Buffer_Scroll scroll){ File_Edit_Positions edit_pos = view_get_edit_pos(view); file_edit_positions_set_cursor(&edit_pos, pos); Buffer_Cursor cursor = view_compute_cursor(view, seek_pos(pos)); - Vec2_f32 p = view_relative_xy_of_pos(models, view, cursor.line, pos); + Vec2_f32 p = view_relative_xy_of_pos(tctx, models, view, cursor.line, pos); view->preferred_x = p.x; file_edit_positions_set_scroll(&edit_pos, scroll); edit_pos.last_set_type = EditPos_None; @@ -397,7 +400,7 @@ view_post_paste_effect(View *view, f32 seconds, i64 start, i64 size, u32 color){ //////////////////////////////// internal void -view_set_file(Models *models, View *view, Editing_File *file){ +view_set_file(Thread_Context *tctx, Models *models, View *view, Editing_File *file){ Assert(file != 0); Editing_File *old_file = view->file; @@ -412,7 +415,7 @@ view_set_file(Models *models, View *view, Editing_File *file){ view_set_edit_pos(view, edit_pos); view->mark = edit_pos.cursor_pos; Buffer_Cursor cursor = view_compute_cursor(view, seek_pos(edit_pos.cursor_pos)); - Vec2_f32 p = view_relative_xy_of_pos(models, view, cursor.line, edit_pos.cursor_pos); + Vec2_f32 p = view_relative_xy_of_pos(tctx, models, view, cursor.line, edit_pos.cursor_pos); view->preferred_x = p.x; models->layout.panel_state_dirty = true; @@ -463,20 +466,6 @@ view_current_context(View *view){ //////////////////////////////// -internal App_Coroutine_State -get_co_state(Application_Links *app){ - App_Coroutine_State state = {}; - state.co = app->current_coroutine; - state.type = app->type_coroutine; - return(state); -} - -internal void -restore_co_state(Application_Links *app, App_Coroutine_State state){ - app->current_coroutine = state.co; - app->type_coroutine = state.type; -} - internal Coroutine* co_handle_request(Models *models, Coroutine *co, Co_Out *out){ Coroutine *result = 0; @@ -503,17 +492,11 @@ co_handle_request(Models *models, Coroutine *co, Co_Out *out){ } internal Coroutine* -co_run(Models *models, App_Coroutine_Purpose purpose, Coroutine *co, - Co_In *in, Co_Out *out){ - Application_Links *app = &models->app_links; - App_Coroutine_State prev_state = get_co_state(app); - app->current_coroutine = co; - app->type_coroutine = purpose; +co_run(Thread_Context *tctx, Models *models, Coroutine *co, Co_In *in, Co_Out *out){ Coroutine *result = coroutine_run(&models->coroutines, co, in, out); for (;result != 0 && out->request != CoRequest_None;){ result = co_handle_request(models, result, out); } - restore_co_state(app, prev_state); return(result); } @@ -523,15 +506,18 @@ view_event_context_base__inner(Coroutine *coroutine){ Models *models = in->models; Custom_Command_Function *event_context_base = in->event_context_base; Assert(event_context_base != 0); - event_context_base(&models->app_links); + Application_Links app = {}; + app.tctx = coroutine->tctx; + app.cmd_context = models; + event_context_base(&app); } function void -view_init(Models *models, View *view, Editing_File *initial_buffer, +view_init(Thread_Context *tctx, Models *models, View *view, Editing_File *initial_buffer, Custom_Command_Function *event_context_base){ - view_set_file(models, view, initial_buffer); + view_set_file(tctx, models, view, initial_buffer); - view->node_arena = reserve_arena(models->tctx); + view->node_arena = reserve_arena(tctx); View_Context first_ctx = {}; first_ctx.render_caller = models->render_caller; @@ -543,7 +529,7 @@ view_init(Models *models, View *view, Editing_File *initial_buffer, Co_In in = {}; in.models = models; in.event_context_base = event_context_base; - view->co = co_run(models, Co_View, view->co, &in, &view->co_out); + view->co = co_run(tctx, models, view->co, &in, &view->co_out); // TODO(allen): deal with this kind of problem! Assert(view->co != 0); } @@ -572,25 +558,28 @@ view_check_co_exited(Models *models, View *view){ } internal void -co_single_abort(Models *models, View *view){ +co_single_abort(Thread_Context *tctx, Models *models, View *view){ Coroutine *co = view->co; Co_In in = {}; in.user_input.abort = true; - view->co = co_run(models, Co_View, co, &in, &view->co_out); + view->co = co_run(tctx, models, co, &in, &view->co_out); view_check_co_exited(models, view); } internal void -co_full_abort(Models *models, View *view){ +co_full_abort(Thread_Context *tctx, Models *models, View *view){ Coroutine *co = view->co; Co_In in = {}; in.user_input.abort = true; for (u32 j = 0; j < 100 && co != 0; ++j){ - co = co_run(models, Co_View, co, &in, &view->co_out); + co = co_run(tctx, models, co, &in, &view->co_out); } if (co != 0){ #define M "SERIOUS ERROR: full stack abort did not complete" - print_message(&models->app_links, string_u8_litexpr(M)); + Application_Links app = {}; + app.tctx = tctx; + app.cmd_context = models; + print_message(&app, string_u8_litexpr(M)); #undef M } view->co = 0; @@ -598,7 +587,7 @@ co_full_abort(Models *models, View *view){ } function b32 -co_send_event(Models *models, View *view, Input_Event *event){ +co_send_event(Thread_Context *tctx, Models *models, View *view, Input_Event *event){ b32 event_was_handled = false; Coroutine *co = view->co; @@ -613,7 +602,7 @@ co_send_event(Models *models, View *view, Input_Event *event){ in.user_input.event = *event; in.user_input.abort = ((abort_flags & event_flags) != 0); begin_handling_input(models, &in.user_input); - view->co = co_run(models, Co_View, view->co, &in, &view->co_out); + view->co = co_run(tctx, models, view->co, &in, &view->co_out); view_check_co_exited(models, view); if (!HasFlag(event_flags, EventProperty_Animate)){ models->animate_next_frame = true; @@ -625,52 +614,52 @@ co_send_event(Models *models, View *view, Input_Event *event){ } function b32 -co_send_core_event(Models *models, View *view, Core_Code code, String_Const_u8 string){ +co_send_core_event(Thread_Context *tctx, Models *models, View *view, Core_Code code, String_Const_u8 string){ Input_Event event = {}; event.kind = InputEventKind_Core; event.core.code = code; event.core.string = string; - return(co_send_event(models, view, &event)); + return(co_send_event(tctx, models, view, &event)); } function b32 -co_send_core_event(Models *models, View *view, Core_Code code, Buffer_ID id){ +co_send_core_event(Thread_Context *tctx, Models *models, View *view, Core_Code code, Buffer_ID id){ Input_Event event = {}; event.kind = InputEventKind_Core; event.core.code = code; event.core.id = id; - return(co_send_event(models, view, &event)); + return(co_send_event(tctx, models, view, &event)); } function b32 -co_send_core_event(Models *models, View *view, Core_Code code){ - return(co_send_core_event(models, view, code, SCu8())); +co_send_core_event(Thread_Context *tctx, Models *models, View *view, Core_Code code){ + return(co_send_core_event(tctx, models, view, code, SCu8())); } function b32 -co_send_event(Models *models, Input_Event *event){ +co_send_event(Thread_Context *tctx, Models *models, Input_Event *event){ Panel *active_panel = models->layout.active_panel; View *view = active_panel->view; - return(co_send_event(models, view, event)); + return(co_send_event(tctx, models, view, event)); } function b32 -co_send_core_event(Models *models, Core_Code code, String_Const_u8 string){ +co_send_core_event(Thread_Context *tctx, Models *models, Core_Code code, String_Const_u8 string){ Panel *active_panel = models->layout.active_panel; View *view = active_panel->view; - return(co_send_core_event(models, view, code, string)); + return(co_send_core_event(tctx, models, view, code, string)); } function b32 -co_send_core_event(Models *models, Core_Code code, Buffer_ID buffer_id){ +co_send_core_event(Thread_Context *tctx, Models *models, Core_Code code, Buffer_ID buffer_id){ Panel *active_panel = models->layout.active_panel; View *view = active_panel->view; - return(co_send_core_event(models, view, code, buffer_id)); + return(co_send_core_event(tctx, models, view, code, buffer_id)); } function b32 -co_send_core_event(Models *models, Core_Code code){ - return(co_send_core_event(models, code, SCu8())); +co_send_core_event(Thread_Context *tctx, Models *models, Core_Code code){ + return(co_send_core_event(tctx, models, code, SCu8())); } //////////////////////////////// @@ -691,7 +680,7 @@ file_is_viewed(Layout *layout, Editing_File *file){ } internal void -adjust_views_looking_at_file_to_new_cursor(Models *models, Editing_File *file){ +adjust_views_looking_at_file_to_new_cursor(Thread_Context *tctx, Models *models, Editing_File *file){ Layout *layout = &models->layout; for (Panel *panel = layout_get_first_open_panel(layout); panel != 0; @@ -699,7 +688,7 @@ adjust_views_looking_at_file_to_new_cursor(Models *models, Editing_File *file){ View *view = panel->view; if (view->file == file){ File_Edit_Positions edit_pos = view_get_edit_pos(view); - view_set_cursor(models, view, edit_pos.cursor_pos); + view_set_cursor(tctx, models, view, edit_pos.cursor_pos); } } } diff --git a/4ed_working_set.cpp b/4ed_working_set.cpp index ed9ed573..cb5adcfd 100644 --- a/4ed_working_set.cpp +++ b/4ed_working_set.cpp @@ -381,7 +381,7 @@ buffer_unbind_name_low_level(Working_Set *working_set, Editing_File *file){ } internal void -buffer_bind_name(Models *models, Arena *scratch, Working_Set *working_set, Editing_File *file, String_Const_u8 base_name){ +buffer_bind_name(Thread_Context *tctx, Models *models, Arena *scratch, Working_Set *working_set, Editing_File *file, String_Const_u8 base_name){ Temp_Memory temp = begin_temp(scratch); // List of conflict files. @@ -445,7 +445,10 @@ buffer_bind_name(Models *models, Arena *scratch, Working_Set *working_set, Editi // Get user's resolution data. if (models->buffer_name_resolver != 0){ - models->buffer_name_resolver(&models->app_links, conflicts, conflict_count); + Application_Links app = {}; + app.tctx = tctx; + app.cmd_context = models; + models->buffer_name_resolver(&app, conflicts, conflict_count); } // Re-bind all of the files diff --git a/custom/4coder_async_tasks.cpp b/custom/4coder_async_tasks.cpp index 9ae53ece..b4f88b09 100644 --- a/custom/4coder_async_tasks.cpp +++ b/custom/4coder_async_tasks.cpp @@ -4,19 +4,126 @@ // TOP -Application_Links *dummy_async_app = 0; +global Async_System async_system = {}; + +function Async_Node* +async_pop_node(void){ + system_mutex_acquire(async_system.mutex); + for (;async_system.task_count == 0;){ + system_condition_variable_wait(async_system.cv, async_system.mutex); + } + Async_Node *node = async_system.task_first; + sll_queue_pop(async_system.task_first, async_system.task_last); + async_system.task_count -= 1; + system_mutex_release(async_system.mutex); + node->next = 0; + return(node); +} + +function Async_Task +async_push_node(Async_Task_Function_Type *func, Data data){ + Async_Task result = async_system.task_id_counter; + async_system.task_id_counter += 1; + + system_mutex_acquire(async_system.mutex); + Async_Node *node = async_system.free_nodes; + if (node == 0){ + node = push_array(&async_system.node_arena, Async_Node, 1); + } + else{ + sll_stack_pop(async_system.free_nodes); + } + node->task = result; + node->thread = 0; + node->func = func; + node->data.data = (u8*)heap_allocate(&async_system.node_heap, data.size); + block_copy(node->data.data, data.data, data.size); + node->data.size = data.size; + sll_queue_push(async_system.task_first, async_system.task_last, node); + async_system.task_count += 1; + system_condition_variable_signal(async_system.cv); + system_mutex_release(async_system.mutex); + + return(result); +} + +function void +async_free_node(Async_Node *node){ + system_mutex_acquire(async_system.mutex); + heap_free(&async_system.node_heap, node->data.data); + sll_stack_push(async_system.free_nodes, node); + system_mutex_release(async_system.mutex); +} + +function void +async_task_thread(void *thread_ptr){ + Base_Allocator *allocator = get_base_allocator_system(); + + Thread_Context_Extra_Info tctx_info = {}; + tctx_info.async_thread = thread_ptr; + + Thread_Context tctx_ = {}; + Thread_Context *tctx = &tctx_; + thread_ctx_init(tctx, ThreadKind_AsyncTasks, allocator, allocator); + + Async_Thread *thread = (Async_Thread*)thread_ptr; + + Application_Links app = {}; + app.tctx = tctx; + app.cmd_context = async_system.cmd_context; + Async_Context ctx = {&app, thread}; + + for (;;){ + Async_Node *node = async_pop_node(); + node->thread = thread; + thread->node = node; + thread->task = node->task; + node->func(&ctx, node->data); + thread->node = 0; + thread->task = 0; + async_free_node(node); + } +} + +function Async_Node* +async_get_pending_node(Async_Task task){ + Async_Node *result = 0; + for (Async_Node *node = async_system.task_first; + node != 0; + node = node->next){ + if (node->task == task){ + result = node; + break; + } + } + return(result); +} + +function Async_Node* +async_get_running_node(Async_Task task){ + Async_Node *result = 0; + if (async_system.thread.task == task){ + + } + return(result); +} + +//////////////////////////////// function void async_task_handler_init(Application_Links *app){ - //NotImplemented; - dummy_async_app = app; + block_zero_struct(&async_system); + async_system.cmd_context = app->cmd_context; + async_system.node_arena = make_arena_system(KB(4)); + heap_init(&async_system.node_heap, &async_system.node_arena); + async_system.mutex = system_mutex_make(); + async_system.cv = system_condition_variable_make(); + async_system.thread.thread = system_thread_launch(async_task_thread, &async_system.thread); } function Async_Task async_task_no_dep(Async_Task_Function_Type *func, Data data){ - //NotImplemented; - func(dummy_async_app, data); - return(0); + return(async_push_node(func, data)); } function Async_Task @@ -26,22 +133,36 @@ async_task_single_dep(Async_Task_Function_Type *func, Data data, Async_Task depe function b32 async_task_is_pending(Async_Task task){ - NotImplemented; + system_mutex_acquire(async_system.mutex); + Async_Node *node = async_get_pending_node(task); + system_mutex_release(async_system.mutex); + return(node != 0); } function b32 async_task_is_running(Async_Task task){ - NotImplemented; + system_mutex_acquire(async_system.mutex); + Async_Node *node = async_get_running_node(task); + system_mutex_release(async_system.mutex); + return(node != 0); } function b32 async_task_is_running_or_pending(Async_Task task){ - NotImplemented; + system_mutex_acquire(async_system.mutex); + Async_Node *node = async_get_pending_node(task); + if (node != 0){ + node = async_get_running_node(task); + } + system_mutex_release(async_system.mutex); + return(node != 0); } function void async_task_cancel(Async_Task task){ + system_mutex_acquire(async_system.mutex); NotImplemented; + system_mutex_release(async_system.mutex); } function void diff --git a/custom/4coder_async_tasks.h b/custom/4coder_async_tasks.h index 8dae24f8..ab1d4ac9 100644 --- a/custom/4coder_async_tasks.h +++ b/custom/4coder_async_tasks.h @@ -7,10 +7,44 @@ #if !defined(FCODER_ASYNC_TASKS_H) #define FCODER_ASYNC_TASKS_H -typedef void Async_Task_Function_Type(Application_Links *app, Data data); - +typedef void Async_Task_Function_Type(struct Async_Context *actx, Data data); typedef u64 Async_Task; +struct Async_Thread{ + System_Thread thread; + struct Async_Node *node; + Async_Task task; +}; + +struct Async_Node{ + Async_Node *next; + Async_Task task; + Async_Thread *thread; + Async_Task_Function_Type *func; + Data data; +}; + +struct Async_System{ + void *cmd_context; + + Heap node_heap; + Arena node_arena; + System_Mutex mutex; + System_Condition_Variable cv; + Async_Task task_id_counter; + Async_Node *free_nodes; + Async_Node *task_first; + Async_Node *task_last; + i32 task_count; + + Async_Thread thread; +}; + +struct Async_Context{ + Application_Links *app; + Async_Thread *thread; +}; + #endif // BOTTOM diff --git a/custom/4coder_base_types.h b/custom/4coder_base_types.h index 6b3ae3af..4e5f83a0 100644 --- a/custom/4coder_base_types.h +++ b/custom/4coder_base_types.h @@ -478,7 +478,7 @@ union SNode{ #define sll_stack_pop_(h) h=h=h->next #define sll_queue_push_multiple_(f,l,ff,ll) if(ll){if(f){l->next=ff;}else{f=ff;}l=ll;l->next=0;} #define sll_queue_push_(f,l,n) sll_queue_push_multiple_(f,l,n,n) -#define sll_queue_pop_(f,l) if (f==l) { f=l=0; } else { f->next=0;f=f->next; } +#define sll_queue_pop_(f,l) if (f==l) { f=l=0; } else { f=f->next; } #define sll_stack_push(h,n) (sll_stack_push_((h),(n))) #define sll_stack_pop(h) (sll_stack_pop_((h))) @@ -1188,6 +1188,8 @@ struct Thread_Context{ Profile_Record *prof_first; Profile_Record *prof_last; i32 prof_record_count; + + void *user_data; }; typedef i32 Scratch_Share_Code; diff --git a/custom/4coder_default_hooks.cpp b/custom/4coder_default_hooks.cpp index bc883130..8ba19564 100644 --- a/custom/4coder_default_hooks.cpp +++ b/custom/4coder_default_hooks.cpp @@ -539,7 +539,8 @@ BUFFER_NAME_RESOLVER_SIG(default_buffer_name_resolution){ } function void -do_full_lex_async__inner(Application_Links *app, Buffer_ID buffer_id){ +do_full_lex_async__inner(Async_Context *actx, Buffer_ID buffer_id){ + Application_Links *app = actx->app; Thread_Context *tctx = get_thread_context(app); Scratch_Block scratch(tctx); @@ -564,10 +565,10 @@ do_full_lex_async__inner(Application_Links *app, Buffer_ID buffer_id){ } function void -do_full_lex_async(Application_Links *app, Data data){ +do_full_lex_async(Async_Context *actx, Data data){ if (data.size == sizeof(Buffer_ID)){ Buffer_ID buffer = *(Buffer_ID*)data.data; - do_full_lex_async__inner(app, buffer); + do_full_lex_async__inner(actx, buffer); } } diff --git a/custom/4coder_types.h b/custom/4coder_types.h index 07403dae..a063dd4e 100644 --- a/custom/4coder_types.h +++ b/custom/4coder_types.h @@ -13,11 +13,13 @@ #endif +struct Thread_Context_Extra_Info{ + void *coroutine; + void *async_thread; +}; struct Application_Links{ + Thread_Context *tctx; void *cmd_context; - void *current_thread; - void *current_coroutine; - i32 type_coroutine; }; typedef void Custom_Layer_Init_Type(Application_Links *app); void custom_layer_init(Application_Links *app); diff --git a/platform_win32/win32_4ed.cpp b/platform_win32/win32_4ed.cpp index 803ecf07..933185d8 100644 --- a/platform_win32/win32_4ed.cpp +++ b/platform_win32/win32_4ed.cpp @@ -1681,7 +1681,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS Scratch_Block scratch(win32vars.tctx, Scratch_Share); String_Const_u8 curdir = system_get_path(scratch, SystemPath_CurrentDirectory); curdir = string_mod_replace_character(curdir, '\\', '/'); - app.init(&target, base_ptr, win32vars.clipboard_contents, curdir, custom); + app.init(win32vars.tctx, &target, base_ptr, win32vars.clipboard_contents, curdir, custom); } // @@ -1871,7 +1871,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS // NOTE(allen): Application Core Update Application_Step_Result result = {}; if (app.step != 0){ - result = app.step(&target, base_ptr, &input); + result = app.step(win32vars.tctx, &target, base_ptr, &input); } else{ //LOG("app.step == 0 -- skipping\n"); From 1396317884e70ec71eca6ca6119396f843d1b773 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Mon, 21 Oct 2019 22:17:24 -0700 Subject: [PATCH 4/8] Async with cancel and join --- custom/4coder_async_tasks.cpp | 203 +++++++++++++++++++---------- custom/4coder_async_tasks.h | 12 +- custom/4coder_default_bindings.cpp | 2 +- custom/4coder_default_hooks.cpp | 4 +- 4 files changed, 144 insertions(+), 77 deletions(-) diff --git a/custom/4coder_async_tasks.cpp b/custom/4coder_async_tasks.cpp index b4f88b09..3a0e9adf 100644 --- a/custom/4coder_async_tasks.cpp +++ b/custom/4coder_async_tasks.cpp @@ -4,55 +4,55 @@ // TOP -global Async_System async_system = {}; +// TODO(allen): put atomic wrappers in base type layer +#define atomic_write_b32(p,v) (*(p)=(v)) +#define atomic_read_b32(p) (*(p)) + +global Async_System global_async_system = {}; function Async_Node* -async_pop_node(void){ - system_mutex_acquire(async_system.mutex); - for (;async_system.task_count == 0;){ - system_condition_variable_wait(async_system.cv, async_system.mutex); +async_pop_node(Async_System *async_system){ + for (;async_system->task_count == 0;){ + system_condition_variable_wait(async_system->cv, async_system->mutex); } - Async_Node *node = async_system.task_first; - sll_queue_pop(async_system.task_first, async_system.task_last); - async_system.task_count -= 1; - system_mutex_release(async_system.mutex); - node->next = 0; - return(node); + Node *node = async_system->task_sent.next; + Assert(node != &async_system->task_sent); + dll_remove(node); + async_system->task_count -= 1; + Async_Node *a_node = CastFromMember(Async_Node, node, node); + a_node->next = 0; + return(a_node); } function Async_Task -async_push_node(Async_Task_Function_Type *func, Data data){ - Async_Task result = async_system.task_id_counter; - async_system.task_id_counter += 1; +async_push_node(Async_System *async_system, Async_Task_Function_Type *func, Data data){ + Async_Task result = async_system->task_id_counter; + async_system->task_id_counter += 1; - system_mutex_acquire(async_system.mutex); - Async_Node *node = async_system.free_nodes; + Async_Node *node = async_system->free_nodes; if (node == 0){ - node = push_array(&async_system.node_arena, Async_Node, 1); + node = push_array(&async_system->node_arena, Async_Node, 1); } else{ - sll_stack_pop(async_system.free_nodes); + sll_stack_pop(async_system->free_nodes); } node->task = result; node->thread = 0; node->func = func; - node->data.data = (u8*)heap_allocate(&async_system.node_heap, data.size); + node->data.data = (u8*)heap_allocate(&async_system->node_heap, data.size); block_copy(node->data.data, data.data, data.size); node->data.size = data.size; - sll_queue_push(async_system.task_first, async_system.task_last, node); - async_system.task_count += 1; - system_condition_variable_signal(async_system.cv); - system_mutex_release(async_system.mutex); + dll_insert_back(&async_system->task_sent, &node->node); + async_system->task_count += 1; + system_condition_variable_signal(async_system->cv); return(result); } function void -async_free_node(Async_Node *node){ - system_mutex_acquire(async_system.mutex); - heap_free(&async_system.node_heap, node->data.data); - sll_stack_push(async_system.free_nodes, node); - system_mutex_release(async_system.mutex); +async_free_node(Async_System *async_system, Async_Node *node){ + heap_free(&async_system->node_heap, node->data.data); + sll_stack_push(async_system->free_nodes, node); } function void @@ -67,43 +67,61 @@ async_task_thread(void *thread_ptr){ thread_ctx_init(tctx, ThreadKind_AsyncTasks, allocator, allocator); Async_Thread *thread = (Async_Thread*)thread_ptr; + Async_System *async_system = thread->async_system; Application_Links app = {}; app.tctx = tctx; - app.cmd_context = async_system.cmd_context; + app.cmd_context = async_system->cmd_context; Async_Context ctx = {&app, thread}; for (;;){ - Async_Node *node = async_pop_node(); + system_mutex_acquire(async_system->mutex); + Async_Node *node = async_pop_node(async_system); node->thread = thread; thread->node = node; thread->task = node->task; + thread->cancel_signal = false; + thread->join_signal = false; + system_mutex_release(async_system->mutex); + node->func(&ctx, node->data); + + system_mutex_acquire(async_system->mutex); + if (thread->join_signal){ + system_condition_variable_signal(async_system->join_cv); + } + node->thread = 0; thread->node = 0; thread->task = 0; - async_free_node(node); + thread->cancel_signal = false; + thread->join_signal = false; + async_free_node(async_system, node); + system_mutex_release(async_system->mutex); } } function Async_Node* -async_get_pending_node(Async_Task task){ +async_get_pending_node(Async_System *async_system, Async_Task task){ Async_Node *result = 0; - for (Async_Node *node = async_system.task_first; - node != 0; - node = node->next){ - if (node->task == task){ - result = node; - break; + if (task != 0){ + for (Node *node = async_system->task_sent.next; + node != &async_system->task_sent; + node = node->next){ + Async_Node *a_node = CastFromMember(Async_Node, node, node); + if (a_node->task == task){ + result = a_node; + break; + } } } return(result); } function Async_Node* -async_get_running_node(Async_Task task){ +async_get_running_node(Async_System *async_system, Async_Task task){ Async_Node *result = 0; - if (async_system.thread.task == task){ - + if (task != 0 && async_system->thread.task == task){ + result = async_system->thread.node; } return(result); } @@ -111,63 +129,106 @@ async_get_running_node(Async_Task task){ //////////////////////////////// function void -async_task_handler_init(Application_Links *app){ - block_zero_struct(&async_system); - async_system.cmd_context = app->cmd_context; - async_system.node_arena = make_arena_system(KB(4)); - heap_init(&async_system.node_heap, &async_system.node_arena); - async_system.mutex = system_mutex_make(); - async_system.cv = system_condition_variable_make(); - async_system.thread.thread = system_thread_launch(async_task_thread, &async_system.thread); +async_task_handler_init(Application_Links *app, Async_System *async_system){ + block_zero_struct(async_system); + async_system->cmd_context = app->cmd_context; + async_system->node_arena = make_arena_system(KB(4)); + heap_init(&async_system->node_heap, &async_system->node_arena); + async_system->mutex = system_mutex_make(); + async_system->cv = system_condition_variable_make(); + async_system->join_cv = system_condition_variable_make(); + dll_init_sentinel(&async_system->task_sent); + async_system->thread.thread = system_thread_launch(async_task_thread, &async_system->thread); } function Async_Task -async_task_no_dep(Async_Task_Function_Type *func, Data data){ - return(async_push_node(func, data)); +async_task_no_dep(Async_System *async_system, Async_Task_Function_Type *func, Data data){ + system_mutex_acquire(async_system->mutex); + Async_Task result = async_push_node(async_system, func, data); + system_mutex_release(async_system->mutex); + return(result); } function Async_Task -async_task_single_dep(Async_Task_Function_Type *func, Data data, Async_Task dependency){ +async_task_single_dep(Async_System *async_system, Async_Task_Function_Type *func, Data data, Async_Task dependency){ NotImplemented; } function b32 -async_task_is_pending(Async_Task task){ - system_mutex_acquire(async_system.mutex); - Async_Node *node = async_get_pending_node(task); - system_mutex_release(async_system.mutex); +async_task_is_pending(Async_System *async_system, Async_Task task){ + system_mutex_acquire(async_system->mutex); + Async_Node *node = async_get_pending_node(async_system, task); + system_mutex_release(async_system->mutex); return(node != 0); } function b32 -async_task_is_running(Async_Task task){ - system_mutex_acquire(async_system.mutex); - Async_Node *node = async_get_running_node(task); - system_mutex_release(async_system.mutex); +async_task_is_running(Async_System *async_system, Async_Task task){ + system_mutex_acquire(async_system->mutex); + Async_Node *node = async_get_running_node(async_system, task); + system_mutex_release(async_system->mutex); return(node != 0); } function b32 -async_task_is_running_or_pending(Async_Task task){ - system_mutex_acquire(async_system.mutex); - Async_Node *node = async_get_pending_node(task); +async_task_is_running_or_pending(Async_System *async_system, Async_Task task){ + system_mutex_acquire(async_system->mutex); + Async_Node *node = async_get_pending_node(async_system, task); if (node != 0){ - node = async_get_running_node(task); + node = async_get_running_node(async_system, task); } - system_mutex_release(async_system.mutex); + system_mutex_release(async_system->mutex); return(node != 0); } function void -async_task_cancel(Async_Task task){ - system_mutex_acquire(async_system.mutex); - NotImplemented; - system_mutex_release(async_system.mutex); +async_task_cancel(Async_System *async_system, Async_Task task){ + system_mutex_acquire(async_system->mutex); + Async_Node *node = async_get_pending_node(async_system, task); + if (node != 0){ + dll_remove(&node->node); + async_system->task_count -= 1; + async_free_node(async_system, node); + } + else{ + node = async_get_running_node(async_system, task); + if (node != 0){ + b32 *cancel_signal = &node->thread->cancel_signal; + atomic_write_b32(cancel_signal, true); + } + } + system_mutex_release(async_system->mutex); } function void -async_task_join(Async_Task task){ - NotImplemented; +async_task_join(Async_System *async_system, Async_Task task){ + system_mutex_acquire(async_system->mutex); + Async_Node *node = async_get_pending_node(async_system, task); + b32 wait_for_join = false; + if (node != 0){ + dll_remove(&node->node); + dll_insert(&async_system->task_sent, &node->node); + node->thread->join_signal = true; + wait_for_join = true; + } + else{ + node = async_get_running_node(async_system, task); + if (node != 0){ + node->thread->join_signal = true; + wait_for_join = true; + } + } + if (wait_for_join){ + system_condition_variable_wait(async_system->join_cv, async_system->mutex); + } + system_mutex_release(async_system->mutex); +} + +function b32 +async_check_canceled(Async_Context *actx){ + b32 *cancel_signal = &actx->thread->cancel_signal; + b32 result = atomic_read_b32(cancel_signal); + return(result); } // BOTTOM diff --git a/custom/4coder_async_tasks.h b/custom/4coder_async_tasks.h index ab1d4ac9..dd3b5efb 100644 --- a/custom/4coder_async_tasks.h +++ b/custom/4coder_async_tasks.h @@ -12,12 +12,18 @@ typedef u64 Async_Task; struct Async_Thread{ System_Thread thread; + struct Async_System *async_system; struct Async_Node *node; Async_Task task; + b32 cancel_signal; + b32 join_signal; }; struct Async_Node{ - Async_Node *next; + union{ + Async_Node *next; + Node node; + }; Async_Task task; Async_Thread *thread; Async_Task_Function_Type *func; @@ -31,10 +37,10 @@ struct Async_System{ Arena node_arena; System_Mutex mutex; System_Condition_Variable cv; + System_Condition_Variable join_cv; Async_Task task_id_counter; Async_Node *free_nodes; - Async_Node *task_first; - Async_Node *task_last; + Node task_sent; i32 task_count; Async_Thread thread; diff --git a/custom/4coder_default_bindings.cpp b/custom/4coder_default_bindings.cpp index d636362f..6b295fd3 100644 --- a/custom/4coder_default_bindings.cpp +++ b/custom/4coder_default_bindings.cpp @@ -19,7 +19,7 @@ custom_layer_init(Application_Links *app){ mapping_init(tctx, &framework_mapping); setup_default_mapping(&framework_mapping); global_prof_init(); - async_task_handler_init(app); + async_task_handler_init(app, &global_async_system); } #endif diff --git a/custom/4coder_default_hooks.cpp b/custom/4coder_default_hooks.cpp index 8ba19564..b5a1dc70 100644 --- a/custom/4coder_default_hooks.cpp +++ b/custom/4coder_default_hooks.cpp @@ -689,7 +689,7 @@ BUFFER_HOOK_SIG(default_begin_buffer){ } if (use_lexer){ - Async_Task lex_task = async_task_no_dep(do_full_lex_async, make_data_struct(&buffer_id)); + Async_Task lex_task = async_task_no_dep(&global_async_system, do_full_lex_async, make_data_struct(&buffer_id)); Async_Task *lex_task_ptr = scope_attachment(app, scope, buffer_lex_task, Async_Task); *lex_task_ptr = lex_task; } @@ -796,7 +796,7 @@ BUFFER_EDIT_RANGE_SIG(default_buffer_edit_range){ else{ scratch.restore(); base_free(allocator, ptr->tokens); - Async_Task lex_task = async_task_no_dep(do_full_lex_async, make_data_struct(&buffer_id)); + Async_Task lex_task = async_task_no_dep(&global_async_system, do_full_lex_async, make_data_struct(&buffer_id)); Async_Task *lex_task_ptr = scope_attachment(app, scope, buffer_lex_task, Async_Task); *lex_task_ptr = lex_task; } From a8d639da8e248f0acc52bbf1177d48e26f33ea0a Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Mon, 21 Oct 2019 22:53:47 -0700 Subject: [PATCH 5/8] lexer with breaks --- custom/4coder_async_tasks.cpp | 1 + custom/4coder_async_tasks.h | 2 +- custom/4coder_default_hooks.cpp | 41 +- custom/generated/lexer_cpp.cpp | 3765 ++++++++++------- .../lexer_generator/4coder_lex_gen_main.cpp | 114 +- 5 files changed, 2244 insertions(+), 1679 deletions(-) diff --git a/custom/4coder_async_tasks.cpp b/custom/4coder_async_tasks.cpp index 3a0e9adf..aa38dd2d 100644 --- a/custom/4coder_async_tasks.cpp +++ b/custom/4coder_async_tasks.cpp @@ -138,6 +138,7 @@ async_task_handler_init(Application_Links *app, Async_System *async_system){ async_system->cv = system_condition_variable_make(); async_system->join_cv = system_condition_variable_make(); dll_init_sentinel(&async_system->task_sent); + async_system->thread.async_system = async_system; async_system->thread.thread = system_thread_launch(async_task_thread, &async_system->thread); } diff --git a/custom/4coder_async_tasks.h b/custom/4coder_async_tasks.h index dd3b5efb..2e1af6e4 100644 --- a/custom/4coder_async_tasks.h +++ b/custom/4coder_async_tasks.h @@ -11,8 +11,8 @@ typedef void Async_Task_Function_Type(struct Async_Context *actx, Data data); typedef u64 Async_Task; struct Async_Thread{ - System_Thread thread; struct Async_System *async_system; + System_Thread thread; struct Async_Node *node; Async_Task task; b32 cancel_signal; diff --git a/custom/4coder_default_hooks.cpp b/custom/4coder_default_hooks.cpp index b5a1dc70..62729570 100644 --- a/custom/4coder_default_hooks.cpp +++ b/custom/4coder_default_hooks.cpp @@ -541,6 +541,7 @@ BUFFER_NAME_RESOLVER_SIG(default_buffer_name_resolution){ function void do_full_lex_async__inner(Async_Context *actx, Buffer_ID buffer_id){ Application_Links *app = actx->app; + ProfileScope(app, "async lex"); Thread_Context *tctx = get_thread_context(app); Scratch_Block scratch(tctx); @@ -548,20 +549,36 @@ do_full_lex_async__inner(Async_Context *actx, Buffer_ID buffer_id){ String_Const_u8 contents = push_whole_buffer(app, scratch, buffer_id); system_release_global_frame_mutex(tctx); - Token_List list = lex_full_input_cpp(scratch, contents); + Lex_State_Cpp state = {}; + lex_full_input_cpp_init(&state, contents); - system_acquire_global_frame_mutex(tctx); - Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); - Base_Allocator *allocator = managed_scope_allocator(app, scope); - Token_Array tokens = {}; - tokens.tokens = base_array(allocator, Token, list.total_count); - tokens.count = list.total_count; - tokens.max = list.total_count; - token_fill_memory_from_list(tokens.tokens, &list); + Token_List list = {}; + b32 canceled = false; + for (;;){ + ProfileScope(app, "async lex block"); + if (lex_full_input_cpp_breaks(scratch, &list, &state, 10000)){ + break; + } + if (async_check_canceled(actx)){ + canceled = true; + break; + } + } - Token_Array *tokens_ptr = scope_attachment(app, scope, attachment_tokens, Token_Array); - block_copy_struct(tokens_ptr, &tokens); - system_release_global_frame_mutex(tctx); + if (!canceled){ + system_acquire_global_frame_mutex(tctx); + Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); + Base_Allocator *allocator = managed_scope_allocator(app, scope); + Token_Array tokens = {}; + tokens.tokens = base_array(allocator, Token, list.total_count); + tokens.count = list.total_count; + tokens.max = list.total_count; + token_fill_memory_from_list(tokens.tokens, &list); + + Token_Array *tokens_ptr = scope_attachment(app, scope, attachment_tokens, Token_Array); + block_copy_struct(tokens_ptr, &tokens); + system_release_global_frame_mutex(tctx); + } } function void diff --git a/custom/generated/lexer_cpp.cpp b/custom/generated/lexer_cpp.cpp index 90c95275..33c479c2 100644 --- a/custom/generated/lexer_cpp.cpp +++ b/custom/generated/lexer_cpp.cpp @@ -43,860 +43,951 @@ lexeme_table_lookup(u64 *hash_array, String_Const_u8 *key_array, } #endif -u64 main_keys_hash_array[115] = { -0xbf6bcf77f466dd27,0x0000000000000000,0x0000000000000000,0xddafeacf66f79855, -0x0000000000000000,0xdc1a48df5108b771,0x42538c18e51eaa09,0x0000000000000000, -0x0000000000000000,0x0000000000000000,0x22537917f8a8a3eb,0xddafeacf66260e41, -0xbf6bcf7919c5cd77,0x0000000000000000,0x0000000000000000,0x7d6693cbac2bdd35, -0x0000000000000000,0x5b9fb6e2e69394f5,0xbf6bcf7968ce0a97,0x0000000000000000, -0xf3e523d06624f633,0xf3e523d067e7e921,0x0000000000000000,0xe174e4ef910e16f5, -0x0000000000000000,0xbf6bcf7679ec9457,0x8bf3b33d8d78a995,0x0000000000000000, -0x0000000000000000,0x42538c18e51ea93b,0xbf6bcf89bfdadcaf,0x0000000000000000, -0x0000000000000000,0x6513238162438c87,0x0000000000000000,0x0000000000000000, -0xdc1a48e959a6b7cb,0x0000000000000000,0x0000000000000000,0x8bf3bea4cea76929, -0x8bf3b047b147be3f,0x0000000000000000,0x0000000000000000,0x0000000000000000, -0x22537917f8a89707,0xf3e523d1bafd48b7,0xdc19ecdc1f3f3911,0xddafeacf666fc121, -0xf3e523d198883577,0x0000000000000000,0x0000000000000000,0x0000000000000000, -0xddafeacf6608a25d,0xf3e523d1b32acf23,0x0000000000000000,0x0000000000000000, -0x0ca578ca97852d1d,0x0000000000000000,0x0000000000000000,0xddafeacf66f75937, -0x22537917f8a817f5,0x0000000000000000,0x8bf3b4d379e3209b,0x0000000000000000, -0xdc1f2554d985408f,0x22537917f8a92833,0x0000000000000000,0x0000000000000000, -0xdc19eafe1d4c1d47,0xbf6bcf79d5fc73bd,0x0000000000000000,0xdc19e7390520f3bd, -0x0000000000000000,0xdc205ac0aff5457d,0xddafeacf66236661,0x0000000000000000, -0xddafeacf66cdd9b5,0xbf6bcf766259902f,0x0000000000000000,0xbf6bcf79660fe8ef, -0xbf6bcf79f6fb461b,0xdc19f20d6e2f3f0f,0xddafeacf66d373a1,0xdc1a45e31224453f, -0x0000000000000000,0xf3e523d067cb75c1,0x8bf3b4ed96a9dee7,0x0cd7d5c6c06bf5bd, -0x0000000000000000,0xbf6bcf7919d76689,0xe7c91e3f330f2359,0xc31899a1114df135, -0xbf6bcf7679be41ad,0xbf6bcf7691c57781,0x0000000000000000,0x0000000000000000, -0xf3e523d06c30d251,0x0000000000000000,0x22537917f8a8218b,0x8bf3b4a94dbb5eef, -0xf3e523d06c41aad5,0x0000000000000000,0x0000000000000000,0x8bf3b047b147bfd7, -0x0000000000000000,0xbf6bcf79d4a6eb89,0xf3e523d1b5c80ee1,0xddafeacf662637f5, -0x0000000000000000,0xdc1a4095f2b2cc07,0xddafeacf660b2247,0x0000000000000000, -0xbf6bcf765be19f55,0x0000000000000000,0xf3e523d181b6f48f, +u64 main_keys_hash_array[125] = { +0x0000000000000000,0x0000000000000000,0xae0dc40193b178f9,0xb96986ad74366239, +0xae0dc4007d2799c3,0x0000000000000000,0x6b890ab6607df9f5,0xfe4cf8e09552fd7d, +0xb96986abf449ab87,0x0ce3b6f3f2ae6d8b,0xb96986b1e4d5012d,0x0000000000000000, +0xae0dc4006a46609d,0xbae13981c29d9e93,0xb96986ac8864fc5b,0x0000000000000000, +0xfe4cdd7782bcdf87,0x0000000000000000,0x27dc518216dc92b9,0x0000000000000000, +0x0000000000000000,0x0ce3a6b2ed33a3f3,0xb6c16efd6d7f8691,0x0000000000000000, +0x5f1d5c76d1541da9,0x0000000000000000,0x0000000000000000,0xae0dc4006ef1e009, +0xb96986ad76870c01,0xb96986aba21ca901,0xb96986ae1e791a09,0xfe4cda48543d15eb, +0x0000000000000000,0xfe4c21260e153663,0xbae13981c29e1649,0xae0dc4007c306d83, +0x0000000000000000,0x0000000000000000,0x0000000000000000,0xfe53a22c8fba72db, +0x0000000000000000,0x0000000000000000,0xfe4c3c0e0a6459c3,0x0000000000000000, +0x0000000000000000,0x482db76ef4a7c2b9,0x0000000000000000,0x0000000000000000, +0xb96986adef80de03,0xbae13981c29e443f,0x0000000000000000,0x0000000000000000, +0x0000000000000000,0xfe4c3b126f24e73b,0x0000000000000000,0x0000000000000000, +0xb6c16efd6d5e9039,0x0ce3a73cf2370b75,0x0000000000000000,0x0000000000000000, +0x0000000000000000,0x0ce3a6cd0e243afd,0xae0dc4006d60a3dd,0xb6c16efd6d33baeb, +0x0000000000000000,0x0000000000000000,0xae0dc4007c1e53d9,0xfe50f7d974bbaa05, +0xb96986acb1e73223,0xb96986ad72de7ddd,0xb96986ae0d38e84b,0x0000000000000000, +0x0000000000000000,0xfe4c3b65bbba43b3,0x320c5ad54842e269,0xb6c16efd6d7eb2db, +0x0000000000000000,0x0000000000000000,0x0000000000000000,0x0000000000000000, +0xb6c16efd6d41ec49,0xb6c16efd6d3ad8c3,0xb6c16efd6d79768d,0x0000000000000000, +0x0ce3a725764fbd37,0x0000000000000000,0xb6c16efd6d326823,0xae0dc4006a76982b, +0x0000000000000000,0x0000000000000000,0xae0dc40193bc7f19,0xa48abde904c1baf9, +0x0000000000000000,0x0000000000000000,0x0000000000000000,0x0000000000000000, +0x0000000000000000,0xb6c16efd6d379001,0x0000000000000000,0x0000000000000000, +0x0000000000000000,0x0000000000000000,0xb96986ae0d2c0de5,0x0000000000000000, +0xb96986ac4109bb39,0x0000000000000000,0x5ee5e1225dabbaf9,0x6b8a48a90953eeab, +0x0000000000000000,0x0000000000000000,0x0000000000000000,0x0000000000000000, +0xb6c16efd6d3a30eb,0xb96986ae1e53e287,0xfe4c6461b7a951e5,0x0000000000000000, +0xbae13981c29ded97,0xbae13981c29dde75,0x5f1d5c76d1541c8f,0x0000000000000000, +0x0ce3b6f5b502c4ff,0x0000000000000000,0xae0dc4006c0426b9,0x0ce3b6f3f2ae5611, +0xc8cfe7a5027aeab5, }; -u8 main_keys_key_array_0[] = {0x70,0x75,0x62,0x6c,0x69,0x63,}; -u8 main_keys_key_array_3[] = {0x63,0x61,0x73,0x65,}; -u8 main_keys_key_array_5[] = {0x65,0x78,0x70,0x6c,0x69,0x63,0x69,0x74,}; -u8 main_keys_key_array_6[] = {0x64,0x6f,}; -u8 main_keys_key_array_10[] = {0x6e,0x65,0x77,}; -u8 main_keys_key_array_11[] = {0x65,0x6c,0x73,0x65,}; -u8 main_keys_key_array_12[] = {0x65,0x78,0x70,0x6f,0x72,0x74,}; -u8 main_keys_key_array_15[] = {0x64,0x79,0x6e,0x61,0x6d,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,}; -u8 main_keys_key_array_17[] = {0x63,0x6f,0x6e,0x73,0x74,0x5f,0x63,0x61,0x73,0x74,}; -u8 main_keys_key_array_18[] = {0x69,0x6e,0x6c,0x69,0x6e,0x65,}; -u8 main_keys_key_array_20[] = {0x62,0x72,0x65,0x61,0x6b,}; -u8 main_keys_key_array_21[] = {0x66,0x61,0x6c,0x73,0x65,}; -u8 main_keys_key_array_23[] = {0x72,0x65,0x69,0x6e,0x74,0x65,0x72,0x70,0x72,0x65,0x74,0x5f,0x63,0x61,0x73,0x74,}; -u8 main_keys_key_array_25[] = {0x73,0x74,0x61,0x74,0x69,0x63,}; -u8 main_keys_key_array_26[] = {0x6e,0x75,0x6c,0x6c,0x70,0x74,0x72,}; -u8 main_keys_key_array_29[] = {0x69,0x66,}; -u8 main_keys_key_array_30[] = {0x66,0x72,0x69,0x65,0x6e,0x64,}; -u8 main_keys_key_array_33[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x61,0x73,0x73,0x65,0x72,0x74,}; -u8 main_keys_key_array_36[] = {0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,}; -u8 main_keys_key_array_39[] = {0x76,0x69,0x72,0x74,0x75,0x61,0x6c,}; -u8 main_keys_key_array_40[] = {0x61,0x6c,0x69,0x67,0x6e,0x6f,0x66,}; -u8 main_keys_key_array_44[] = {0x69,0x6e,0x74,}; -u8 main_keys_key_array_45[] = {0x73,0x68,0x6f,0x72,0x74,}; -u8 main_keys_key_array_46[] = {0x74,0x79,0x70,0x65,0x6e,0x61,0x6d,0x65,}; -u8 main_keys_key_array_47[] = {0x76,0x6f,0x69,0x64,}; -u8 main_keys_key_array_48[] = {0x63,0x6c,0x61,0x73,0x73,}; -u8 main_keys_key_array_52[] = {0x74,0x72,0x75,0x65,}; -u8 main_keys_key_array_53[] = {0x75,0x6e,0x69,0x6f,0x6e,}; -u8 main_keys_key_array_56[] = {0x70,0x72,0x6f,0x74,0x65,0x63,0x74,0x65,0x64,}; -u8 main_keys_key_array_59[] = {0x63,0x68,0x61,0x72,}; -u8 main_keys_key_array_60[] = {0x61,0x73,0x6d,}; -u8 main_keys_key_array_62[] = {0x74,0x79,0x70,0x65,0x64,0x65,0x66,}; -u8 main_keys_key_array_64[] = {0x76,0x6f,0x6c,0x61,0x74,0x69,0x6c,0x65,}; -u8 main_keys_key_array_65[] = {0x74,0x72,0x79,}; -u8 main_keys_key_array_68[] = {0x64,0x65,0x63,0x6c,0x74,0x79,0x70,0x65,}; -u8 main_keys_key_array_69[] = {0x73,0x69,0x67,0x6e,0x65,0x64,}; -u8 main_keys_key_array_71[] = {0x75,0x6e,0x73,0x69,0x67,0x6e,0x65,0x64,}; -u8 main_keys_key_array_73[] = {0x63,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,}; -u8 main_keys_key_array_74[] = {0x67,0x6f,0x74,0x6f,}; -u8 main_keys_key_array_76[] = {0x62,0x6f,0x6f,0x6c,}; -u8 main_keys_key_array_77[] = {0x64,0x65,0x6c,0x65,0x74,0x65,}; -u8 main_keys_key_array_79[] = {0x64,0x6f,0x75,0x62,0x6c,0x65,}; -u8 main_keys_key_array_80[] = {0x73,0x69,0x7a,0x65,0x6f,0x66,}; -u8 main_keys_key_array_81[] = {0x74,0x65,0x6d,0x70,0x6c,0x61,0x74,0x65,}; -u8 main_keys_key_array_82[] = {0x6c,0x6f,0x6e,0x67,}; -u8 main_keys_key_array_83[] = {0x6e,0x6f,0x65,0x78,0x63,0x65,0x70,0x74,}; -u8 main_keys_key_array_85[] = {0x66,0x6c,0x6f,0x61,0x74,}; -u8 main_keys_key_array_86[] = {0x64,0x65,0x66,0x61,0x75,0x6c,0x74,}; -u8 main_keys_key_array_87[] = {0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,}; -u8 main_keys_key_array_89[] = {0x65,0x78,0x74,0x65,0x72,0x6e,}; -u8 main_keys_key_array_90[] = {0x74,0x68,0x72,0x65,0x61,0x64,0x5f,0x6c,0x6f,0x63,0x61,0x6c,}; -u8 main_keys_key_array_91[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,}; -u8 main_keys_key_array_92[] = {0x73,0x74,0x72,0x75,0x63,0x74,}; -u8 main_keys_key_array_93[] = {0x74,0x79,0x70,0x65,0x69,0x64,}; -u8 main_keys_key_array_96[] = {0x63,0x6f,0x6e,0x73,0x74,}; -u8 main_keys_key_array_98[] = {0x66,0x6f,0x72,}; -u8 main_keys_key_array_99[] = {0x70,0x72,0x69,0x76,0x61,0x74,0x65,}; -u8 main_keys_key_array_100[] = {0x63,0x61,0x74,0x63,0x68,}; -u8 main_keys_key_array_103[] = {0x61,0x6c,0x69,0x67,0x6e,0x61,0x73,}; -u8 main_keys_key_array_105[] = {0x72,0x65,0x74,0x75,0x72,0x6e,}; -u8 main_keys_key_array_106[] = {0x75,0x73,0x69,0x6e,0x67,}; -u8 main_keys_key_array_107[] = {0x65,0x6e,0x75,0x6d,}; -u8 main_keys_key_array_109[] = {0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,}; -u8 main_keys_key_array_110[] = {0x74,0x68,0x69,0x73,}; -u8 main_keys_key_array_112[] = {0x73,0x77,0x69,0x74,0x63,0x68,}; -u8 main_keys_key_array_114[] = {0x77,0x68,0x69,0x6c,0x65,}; -String_Const_u8 main_keys_key_array[115] = { -{main_keys_key_array_0, 6}, +u8 main_keys_key_array_2[] = {0x63,0x6f,0x6e,0x73,0x74,}; +u8 main_keys_key_array_3[] = {0x73,0x74,0x72,0x75,0x63,0x74,}; +u8 main_keys_key_array_4[] = {0x77,0x68,0x69,0x6c,0x65,}; +u8 main_keys_key_array_6[] = {0x70,0x72,0x6f,0x74,0x65,0x63,0x74,0x65,0x64,}; +u8 main_keys_key_array_7[] = {0x65,0x78,0x70,0x6c,0x69,0x63,0x69,0x74,}; +u8 main_keys_key_array_8[] = {0x72,0x65,0x74,0x75,0x72,0x6e,}; +u8 main_keys_key_array_9[] = {0x61,0x6c,0x69,0x67,0x6e,0x6f,0x66,}; +u8 main_keys_key_array_10[] = {0x74,0x79,0x70,0x65,0x69,0x64,}; +u8 main_keys_key_array_12[] = {0x66,0x6c,0x6f,0x61,0x74,}; +u8 main_keys_key_array_13[] = {0x61,0x73,0x6d,}; +u8 main_keys_key_array_14[] = {0x69,0x6e,0x6c,0x69,0x6e,0x65,}; +u8 main_keys_key_array_16[] = {0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,}; +u8 main_keys_key_array_18[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,}; +u8 main_keys_key_array_21[] = {0x70,0x72,0x69,0x76,0x61,0x74,0x65,}; +u8 main_keys_key_array_22[] = {0x74,0x68,0x69,0x73,}; +u8 main_keys_key_array_24[] = {0x64,0x6f,}; +u8 main_keys_key_array_27[] = {0x73,0x68,0x6f,0x72,0x74,}; +u8 main_keys_key_array_28[] = {0x73,0x74,0x61,0x74,0x69,0x63,}; +u8 main_keys_key_array_29[] = {0x70,0x75,0x62,0x6c,0x69,0x63,}; +u8 main_keys_key_array_30[] = {0x65,0x78,0x70,0x6f,0x72,0x74,}; +u8 main_keys_key_array_31[] = {0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,}; +u8 main_keys_key_array_33[] = {0x64,0x65,0x63,0x6c,0x74,0x79,0x70,0x65,}; +u8 main_keys_key_array_34[] = {0x69,0x6e,0x74,}; +u8 main_keys_key_array_35[] = {0x75,0x6e,0x69,0x6f,0x6e,}; +u8 main_keys_key_array_39[] = {0x63,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,}; +u8 main_keys_key_array_42[] = {0x76,0x6f,0x6c,0x61,0x74,0x69,0x6c,0x65,}; +u8 main_keys_key_array_45[] = {0x64,0x79,0x6e,0x61,0x6d,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,}; +u8 main_keys_key_array_48[] = {0x64,0x6f,0x75,0x62,0x6c,0x65,}; +u8 main_keys_key_array_49[] = {0x74,0x72,0x79,}; +u8 main_keys_key_array_53[] = {0x74,0x79,0x70,0x65,0x6e,0x61,0x6d,0x65,}; +u8 main_keys_key_array_56[] = {0x6c,0x6f,0x6e,0x67,}; +u8 main_keys_key_array_57[] = {0x76,0x69,0x72,0x74,0x75,0x61,0x6c,}; +u8 main_keys_key_array_61[] = {0x64,0x65,0x66,0x61,0x75,0x6c,0x74,}; +u8 main_keys_key_array_62[] = {0x63,0x61,0x74,0x63,0x68,}; +u8 main_keys_key_array_63[] = {0x63,0x61,0x73,0x65,}; +u8 main_keys_key_array_66[] = {0x75,0x73,0x69,0x6e,0x67,}; +u8 main_keys_key_array_67[] = {0x6e,0x6f,0x65,0x78,0x63,0x65,0x70,0x74,}; +u8 main_keys_key_array_68[] = {0x64,0x65,0x6c,0x65,0x74,0x65,}; +u8 main_keys_key_array_69[] = {0x73,0x77,0x69,0x74,0x63,0x68,}; +u8 main_keys_key_array_70[] = {0x73,0x69,0x7a,0x65,0x6f,0x66,}; +u8 main_keys_key_array_73[] = {0x74,0x65,0x6d,0x70,0x6c,0x61,0x74,0x65,}; +u8 main_keys_key_array_74[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x61,0x73,0x73,0x65,0x72,0x74,}; +u8 main_keys_key_array_75[] = {0x74,0x72,0x75,0x65,}; +u8 main_keys_key_array_80[] = {0x67,0x6f,0x74,0x6f,}; +u8 main_keys_key_array_81[] = {0x65,0x6e,0x75,0x6d,}; +u8 main_keys_key_array_82[] = {0x76,0x6f,0x69,0x64,}; +u8 main_keys_key_array_84[] = {0x74,0x79,0x70,0x65,0x64,0x65,0x66,}; +u8 main_keys_key_array_86[] = {0x63,0x68,0x61,0x72,}; +u8 main_keys_key_array_87[] = {0x66,0x61,0x6c,0x73,0x65,}; +u8 main_keys_key_array_90[] = {0x63,0x6c,0x61,0x73,0x73,}; +u8 main_keys_key_array_91[] = {0x72,0x65,0x69,0x6e,0x74,0x65,0x72,0x70,0x72,0x65,0x74,0x5f,0x63,0x61,0x73,0x74,}; +u8 main_keys_key_array_97[] = {0x62,0x6f,0x6f,0x6c,}; +u8 main_keys_key_array_102[] = {0x73,0x69,0x67,0x6e,0x65,0x64,}; +u8 main_keys_key_array_104[] = {0x66,0x72,0x69,0x65,0x6e,0x64,}; +u8 main_keys_key_array_106[] = {0x63,0x6f,0x6e,0x73,0x74,0x5f,0x63,0x61,0x73,0x74,}; +u8 main_keys_key_array_107[] = {0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,}; +u8 main_keys_key_array_112[] = {0x65,0x6c,0x73,0x65,}; +u8 main_keys_key_array_113[] = {0x65,0x78,0x74,0x65,0x72,0x6e,}; +u8 main_keys_key_array_114[] = {0x75,0x6e,0x73,0x69,0x67,0x6e,0x65,0x64,}; +u8 main_keys_key_array_116[] = {0x66,0x6f,0x72,}; +u8 main_keys_key_array_117[] = {0x6e,0x65,0x77,}; +u8 main_keys_key_array_118[] = {0x69,0x66,}; +u8 main_keys_key_array_120[] = {0x6e,0x75,0x6c,0x6c,0x70,0x74,0x72,}; +u8 main_keys_key_array_122[] = {0x62,0x72,0x65,0x61,0x6b,}; +u8 main_keys_key_array_123[] = {0x61,0x6c,0x69,0x67,0x6e,0x61,0x73,}; +u8 main_keys_key_array_124[] = {0x74,0x68,0x72,0x65,0x61,0x64,0x5f,0x6c,0x6f,0x63,0x61,0x6c,}; +String_Const_u8 main_keys_key_array[125] = { {0, 0}, {0, 0}, -{main_keys_key_array_3, 4}, +{main_keys_key_array_2, 5}, +{main_keys_key_array_3, 6}, +{main_keys_key_array_4, 5}, {0, 0}, -{main_keys_key_array_5, 8}, -{main_keys_key_array_6, 2}, +{main_keys_key_array_6, 9}, +{main_keys_key_array_7, 8}, +{main_keys_key_array_8, 6}, +{main_keys_key_array_9, 7}, +{main_keys_key_array_10, 6}, +{0, 0}, +{main_keys_key_array_12, 5}, +{main_keys_key_array_13, 3}, +{main_keys_key_array_14, 6}, +{0, 0}, +{main_keys_key_array_16, 8}, +{0, 0}, +{main_keys_key_array_18, 11}, {0, 0}, {0, 0}, +{main_keys_key_array_21, 7}, +{main_keys_key_array_22, 4}, {0, 0}, -{main_keys_key_array_10, 3}, -{main_keys_key_array_11, 4}, -{main_keys_key_array_12, 6}, +{main_keys_key_array_24, 2}, {0, 0}, {0, 0}, -{main_keys_key_array_15, 12}, -{0, 0}, -{main_keys_key_array_17, 10}, -{main_keys_key_array_18, 6}, -{0, 0}, -{main_keys_key_array_20, 5}, -{main_keys_key_array_21, 5}, -{0, 0}, -{main_keys_key_array_23, 16}, -{0, 0}, -{main_keys_key_array_25, 6}, -{main_keys_key_array_26, 7}, -{0, 0}, -{0, 0}, -{main_keys_key_array_29, 2}, +{main_keys_key_array_27, 5}, +{main_keys_key_array_28, 6}, +{main_keys_key_array_29, 6}, {main_keys_key_array_30, 6}, +{main_keys_key_array_31, 8}, {0, 0}, -{0, 0}, -{main_keys_key_array_33, 13}, -{0, 0}, -{0, 0}, -{main_keys_key_array_36, 8}, -{0, 0}, -{0, 0}, -{main_keys_key_array_39, 7}, -{main_keys_key_array_40, 7}, +{main_keys_key_array_33, 8}, +{main_keys_key_array_34, 3}, +{main_keys_key_array_35, 5}, {0, 0}, {0, 0}, {0, 0}, -{main_keys_key_array_44, 3}, -{main_keys_key_array_45, 5}, -{main_keys_key_array_46, 8}, -{main_keys_key_array_47, 4}, -{main_keys_key_array_48, 5}, +{main_keys_key_array_39, 8}, +{0, 0}, +{0, 0}, +{main_keys_key_array_42, 8}, +{0, 0}, +{0, 0}, +{main_keys_key_array_45, 12}, +{0, 0}, +{0, 0}, +{main_keys_key_array_48, 6}, +{main_keys_key_array_49, 3}, {0, 0}, {0, 0}, {0, 0}, -{main_keys_key_array_52, 4}, -{main_keys_key_array_53, 5}, +{main_keys_key_array_53, 8}, {0, 0}, {0, 0}, -{main_keys_key_array_56, 9}, +{main_keys_key_array_56, 4}, +{main_keys_key_array_57, 7}, {0, 0}, {0, 0}, -{main_keys_key_array_59, 4}, -{main_keys_key_array_60, 3}, {0, 0}, -{main_keys_key_array_62, 7}, -{0, 0}, -{main_keys_key_array_64, 8}, -{main_keys_key_array_65, 3}, +{main_keys_key_array_61, 7}, +{main_keys_key_array_62, 5}, +{main_keys_key_array_63, 4}, {0, 0}, {0, 0}, -{main_keys_key_array_68, 8}, +{main_keys_key_array_66, 5}, +{main_keys_key_array_67, 8}, +{main_keys_key_array_68, 6}, {main_keys_key_array_69, 6}, +{main_keys_key_array_70, 6}, {0, 0}, -{main_keys_key_array_71, 8}, {0, 0}, {main_keys_key_array_73, 8}, -{main_keys_key_array_74, 4}, +{main_keys_key_array_74, 13}, +{main_keys_key_array_75, 4}, {0, 0}, -{main_keys_key_array_76, 4}, -{main_keys_key_array_77, 6}, {0, 0}, -{main_keys_key_array_79, 6}, -{main_keys_key_array_80, 6}, -{main_keys_key_array_81, 8}, +{0, 0}, +{0, 0}, +{main_keys_key_array_80, 4}, +{main_keys_key_array_81, 4}, {main_keys_key_array_82, 4}, -{main_keys_key_array_83, 8}, {0, 0}, -{main_keys_key_array_85, 5}, -{main_keys_key_array_86, 7}, -{main_keys_key_array_87, 9}, +{main_keys_key_array_84, 7}, {0, 0}, -{main_keys_key_array_89, 6}, -{main_keys_key_array_90, 12}, -{main_keys_key_array_91, 11}, -{main_keys_key_array_92, 6}, -{main_keys_key_array_93, 6}, +{main_keys_key_array_86, 4}, +{main_keys_key_array_87, 5}, {0, 0}, {0, 0}, -{main_keys_key_array_96, 5}, -{0, 0}, -{main_keys_key_array_98, 3}, -{main_keys_key_array_99, 7}, -{main_keys_key_array_100, 5}, +{main_keys_key_array_90, 5}, +{main_keys_key_array_91, 16}, {0, 0}, {0, 0}, -{main_keys_key_array_103, 7}, {0, 0}, -{main_keys_key_array_105, 6}, -{main_keys_key_array_106, 5}, -{main_keys_key_array_107, 4}, {0, 0}, -{main_keys_key_array_109, 8}, -{main_keys_key_array_110, 4}, {0, 0}, -{main_keys_key_array_112, 6}, +{main_keys_key_array_97, 4}, {0, 0}, -{main_keys_key_array_114, 5}, +{0, 0}, +{0, 0}, +{0, 0}, +{main_keys_key_array_102, 6}, +{0, 0}, +{main_keys_key_array_104, 6}, +{0, 0}, +{main_keys_key_array_106, 10}, +{main_keys_key_array_107, 9}, +{0, 0}, +{0, 0}, +{0, 0}, +{0, 0}, +{main_keys_key_array_112, 4}, +{main_keys_key_array_113, 6}, +{main_keys_key_array_114, 8}, +{0, 0}, +{main_keys_key_array_116, 3}, +{main_keys_key_array_117, 3}, +{main_keys_key_array_118, 2}, +{0, 0}, +{main_keys_key_array_120, 7}, +{0, 0}, +{main_keys_key_array_122, 5}, +{main_keys_key_array_123, 7}, +{main_keys_key_array_124, 12}, }; -Lexeme_Table_Value main_keys_value_array[115] = { -{4, TokenCppKind_Public}, +Lexeme_Table_Value main_keys_value_array[125] = { {0, 0}, {0, 0}, -{4, TokenCppKind_Case}, +{4, TokenCppKind_Const}, +{4, TokenCppKind_Struct}, +{4, TokenCppKind_While}, {0, 0}, +{4, TokenCppKind_Protected}, {4, TokenCppKind_Explicit}, +{4, TokenCppKind_Return}, +{4, TokenCppKind_AlignOf}, +{4, TokenCppKind_TypeID}, +{0, 0}, +{4, TokenCppKind_Float}, +{4, TokenCppKind_Asm}, +{4, TokenCppKind_Inline}, +{0, 0}, +{4, TokenCppKind_Operator}, +{0, 0}, +{4, TokenCppKind_StaticCast}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Private}, +{4, TokenCppKind_This}, +{0, 0}, {4, TokenCppKind_Do}, {0, 0}, {0, 0}, -{0, 0}, -{4, TokenCppKind_New}, -{4, TokenCppKind_Else}, +{4, TokenCppKind_Short}, +{4, TokenCppKind_Static}, +{4, TokenCppKind_Public}, {4, TokenCppKind_Export}, +{4, TokenCppKind_Register}, +{0, 0}, +{4, TokenCppKind_DeclType}, +{4, TokenCppKind_Int}, +{4, TokenCppKind_Union}, +{0, 0}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Continue}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Volatile}, {0, 0}, {0, 0}, {4, TokenCppKind_DynamicCast}, {0, 0}, -{4, TokenCppKind_ConstCast}, -{4, TokenCppKind_Inline}, {0, 0}, -{4, TokenCppKind_Break}, -{8, TokenCppKind_LiteralFalse}, -{0, 0}, -{4, TokenCppKind_ReinterpretCast}, -{0, 0}, -{4, TokenCppKind_Static}, -{4, TokenCppKind_NullPtr}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_If}, -{4, TokenCppKind_Friend}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_StaticAssert}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Operator}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Virtual}, -{4, TokenCppKind_AlignOf}, -{0, 0}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Int}, -{4, TokenCppKind_Short}, -{4, TokenCppKind_Typename}, -{4, TokenCppKind_Void}, -{4, TokenCppKind_Class}, -{0, 0}, -{0, 0}, -{0, 0}, -{8, TokenCppKind_LiteralTrue}, -{4, TokenCppKind_Union}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Protected}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Char}, -{4, TokenCppKind_Asm}, -{0, 0}, -{4, TokenCppKind_Typedef}, -{0, 0}, -{4, TokenCppKind_Volatile}, +{4, TokenCppKind_Double}, {4, TokenCppKind_Try}, {0, 0}, {0, 0}, -{4, TokenCppKind_DeclType}, -{4, TokenCppKind_Signed}, {0, 0}, -{4, TokenCppKind_Unsigned}, +{4, TokenCppKind_Typename}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Long}, +{4, TokenCppKind_Virtual}, +{0, 0}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Default}, +{4, TokenCppKind_Catch}, +{4, TokenCppKind_Case}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Using}, +{4, TokenCppKind_NoExcept}, +{4, TokenCppKind_Delete}, +{4, TokenCppKind_Switch}, +{4, TokenCppKind_SizeOf}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Template}, +{4, TokenCppKind_StaticAssert}, +{8, TokenCppKind_LiteralTrue}, +{0, 0}, +{0, 0}, +{0, 0}, {0, 0}, -{4, TokenCppKind_Continue}, {4, TokenCppKind_Goto}, +{4, TokenCppKind_Enum}, +{4, TokenCppKind_Void}, +{0, 0}, +{4, TokenCppKind_Typedef}, +{0, 0}, +{4, TokenCppKind_Char}, +{8, TokenCppKind_LiteralFalse}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Class}, +{4, TokenCppKind_ReinterpretCast}, +{0, 0}, +{0, 0}, +{0, 0}, +{0, 0}, {0, 0}, {4, TokenCppKind_Bool}, -{4, TokenCppKind_Delete}, {0, 0}, -{4, TokenCppKind_Double}, -{4, TokenCppKind_SizeOf}, -{4, TokenCppKind_Template}, -{4, TokenCppKind_Long}, -{4, TokenCppKind_NoExcept}, {0, 0}, -{4, TokenCppKind_Float}, -{4, TokenCppKind_Default}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Signed}, +{0, 0}, +{4, TokenCppKind_Friend}, +{0, 0}, +{4, TokenCppKind_ConstCast}, {4, TokenCppKind_Namespace}, {0, 0}, +{0, 0}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Else}, {4, TokenCppKind_Extern}, -{4, TokenCppKind_ThreadLocal}, -{4, TokenCppKind_StaticCast}, -{4, TokenCppKind_Struct}, -{4, TokenCppKind_TypeID}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Const}, +{4, TokenCppKind_Unsigned}, {0, 0}, {4, TokenCppKind_For}, -{4, TokenCppKind_Private}, -{4, TokenCppKind_Catch}, +{4, TokenCppKind_New}, +{4, TokenCppKind_If}, {0, 0}, +{4, TokenCppKind_NullPtr}, {0, 0}, +{4, TokenCppKind_Break}, {4, TokenCppKind_AlignAs}, -{0, 0}, -{4, TokenCppKind_Return}, -{4, TokenCppKind_Using}, -{4, TokenCppKind_Enum}, -{0, 0}, -{4, TokenCppKind_Register}, -{4, TokenCppKind_This}, -{0, 0}, -{4, TokenCppKind_Switch}, -{0, 0}, -{4, TokenCppKind_While}, +{4, TokenCppKind_ThreadLocal}, }; -i32 main_keys_slot_count = 115; -u64 main_keys_seed = 0x16bfab524fa54382; +i32 main_keys_slot_count = 125; +u64 main_keys_seed = 0xfa381694d5674125; u64 pp_directives_hash_array[25] = { -0xb609da307054bea3,0x0000000000000000,0x0000000000000000,0xa2e78356ab03f40f, -0x0000000000000000,0x0ee3d6653314ef87,0x0000000000000000,0xa2e7835774c1adef, -0x0ee3d660cdba6a31,0xa2e783568162a20f,0x8736de7657610e07,0x0000000000000000, -0x0ee3d660cf11c00f,0xb609da3070f19257,0xa2e7835772fe8f57,0x0000000000000000, -0xb609da3070f19323,0x0ee3d633c7a04603,0x0000000000000000,0x0000000000000000, -0x81c8a8b11ba92f2b,0xa2e78356842fa881,0x0000000000000000,0x81c8aed73449609b, -0x0000000000000000, +0x0000000000000000,0x34b86dc413bdc61d,0x0000000000000000,0xcc5e69206f9dddbd, +0x0000000000000000,0x65f024ddd53ade19,0x65f02489c656353d,0x0000000000000000, +0xcc5e69207d2543bd,0x35db8e7164ab1e55,0x6bb45a7c34b15b09,0x35db8e7164f625dd, +0x0000000000000000,0x0000000000000000,0x35db8e7164ab3649,0xcc5e692189cbad79, +0x0000000000000000,0xcc5e69207d6608a3,0x0000000000000000,0x0000000000000000, +0x65f02488282ecfbd,0x6bb4b5a2472171e5,0xcc5e6921a27c7d55,0x0000000000000000, +0x65f02489e6243cc7, }; -u8 pp_directives_key_array_0[] = {0x6c,0x69,0x6e,0x65,}; +u8 pp_directives_key_array_1[] = {0x69,0x66,}; u8 pp_directives_key_array_3[] = {0x69,0x66,0x64,0x65,0x66,}; u8 pp_directives_key_array_5[] = {0x70,0x72,0x61,0x67,0x6d,0x61,}; -u8 pp_directives_key_array_7[] = {0x65,0x72,0x72,0x6f,0x72,}; -u8 pp_directives_key_array_8[] = {0x69,0x6d,0x70,0x6f,0x72,0x74,}; -u8 pp_directives_key_array_9[] = {0x75,0x6e,0x64,0x65,0x66,}; -u8 pp_directives_key_array_10[] = {0x69,0x66,}; -u8 pp_directives_key_array_12[] = {0x69,0x66,0x6e,0x64,0x65,0x66,}; -u8 pp_directives_key_array_13[] = {0x65,0x6c,0x69,0x66,}; -u8 pp_directives_key_array_14[] = {0x65,0x6e,0x64,0x69,0x66,}; -u8 pp_directives_key_array_16[] = {0x65,0x6c,0x73,0x65,}; -u8 pp_directives_key_array_17[] = {0x64,0x65,0x66,0x69,0x6e,0x65,}; -u8 pp_directives_key_array_20[] = {0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,}; -u8 pp_directives_key_array_21[] = {0x75,0x73,0x69,0x6e,0x67,}; -u8 pp_directives_key_array_23[] = {0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,}; +u8 pp_directives_key_array_6[] = {0x64,0x65,0x66,0x69,0x6e,0x65,}; +u8 pp_directives_key_array_8[] = {0x75,0x6e,0x64,0x65,0x66,}; +u8 pp_directives_key_array_9[] = {0x65,0x6c,0x69,0x66,}; +u8 pp_directives_key_array_10[] = {0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,}; +u8 pp_directives_key_array_11[] = {0x6c,0x69,0x6e,0x65,}; +u8 pp_directives_key_array_14[] = {0x65,0x6c,0x73,0x65,}; +u8 pp_directives_key_array_15[] = {0x65,0x72,0x72,0x6f,0x72,}; +u8 pp_directives_key_array_17[] = {0x75,0x73,0x69,0x6e,0x67,}; +u8 pp_directives_key_array_20[] = {0x69,0x66,0x6e,0x64,0x65,0x66,}; +u8 pp_directives_key_array_21[] = {0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,}; +u8 pp_directives_key_array_22[] = {0x65,0x6e,0x64,0x69,0x66,}; +u8 pp_directives_key_array_24[] = {0x69,0x6d,0x70,0x6f,0x72,0x74,}; String_Const_u8 pp_directives_key_array[25] = { -{pp_directives_key_array_0, 4}, {0, 0}, +{pp_directives_key_array_1, 2}, {0, 0}, {pp_directives_key_array_3, 5}, {0, 0}, {pp_directives_key_array_5, 6}, +{pp_directives_key_array_6, 6}, {0, 0}, -{pp_directives_key_array_7, 5}, -{pp_directives_key_array_8, 6}, -{pp_directives_key_array_9, 5}, -{pp_directives_key_array_10, 2}, -{0, 0}, -{pp_directives_key_array_12, 6}, -{pp_directives_key_array_13, 4}, -{pp_directives_key_array_14, 5}, -{0, 0}, -{pp_directives_key_array_16, 4}, -{pp_directives_key_array_17, 6}, +{pp_directives_key_array_8, 5}, +{pp_directives_key_array_9, 4}, +{pp_directives_key_array_10, 7}, +{pp_directives_key_array_11, 4}, {0, 0}, {0, 0}, -{pp_directives_key_array_20, 7}, -{pp_directives_key_array_21, 5}, +{pp_directives_key_array_14, 4}, +{pp_directives_key_array_15, 5}, {0, 0}, -{pp_directives_key_array_23, 7}, +{pp_directives_key_array_17, 5}, {0, 0}, +{0, 0}, +{pp_directives_key_array_20, 6}, +{pp_directives_key_array_21, 7}, +{pp_directives_key_array_22, 5}, +{0, 0}, +{pp_directives_key_array_24, 6}, }; Lexeme_Table_Value pp_directives_value_array[25] = { -{5, TokenCppKind_PPLine}, {0, 0}, +{5, TokenCppKind_PPIf}, {0, 0}, {5, TokenCppKind_PPIfDef}, {0, 0}, {5, TokenCppKind_PPPragma}, -{0, 0}, -{5, TokenCppKind_PPError}, -{5, TokenCppKind_PPImport}, -{5, TokenCppKind_PPUndef}, -{5, TokenCppKind_PPIf}, -{0, 0}, -{5, TokenCppKind_PPIfNDef}, -{5, TokenCppKind_PPElIf}, -{5, TokenCppKind_PPEndIf}, -{0, 0}, -{5, TokenCppKind_PPElse}, {5, TokenCppKind_PPDefine}, {0, 0}, +{5, TokenCppKind_PPUndef}, +{5, TokenCppKind_PPElIf}, +{5, TokenCppKind_PPInclude}, +{5, TokenCppKind_PPLine}, +{0, 0}, +{0, 0}, +{5, TokenCppKind_PPElse}, +{5, TokenCppKind_PPError}, {0, 0}, -{5, TokenCppKind_PPVersion}, {5, TokenCppKind_PPUsing}, {0, 0}, -{5, TokenCppKind_PPInclude}, {0, 0}, +{5, TokenCppKind_PPIfNDef}, +{5, TokenCppKind_PPVersion}, +{5, TokenCppKind_PPEndIf}, +{0, 0}, +{5, TokenCppKind_PPImport}, }; i32 pp_directives_slot_count = 25; -u64 pp_directives_seed = 0x20a9103cfa5a977d; +u64 pp_directives_seed = 0x8fec132e93357a37; u64 pp_keys_hash_array[2] = { -0x0000000000000000,0xd488faf5597fb9a7, +0xaa00330834c0d751,0x0000000000000000, }; -u8 pp_keys_key_array_1[] = {0x64,0x65,0x66,0x69,0x6e,0x65,0x64,}; +u8 pp_keys_key_array_0[] = {0x64,0x65,0x66,0x69,0x6e,0x65,0x64,}; String_Const_u8 pp_keys_key_array[2] = { +{pp_keys_key_array_0, 7}, {0, 0}, -{pp_keys_key_array_1, 7}, }; Lexeme_Table_Value pp_keys_value_array[2] = { -{0, 0}, {4, TokenCppKind_PPDefined}, +{0, 0}, }; i32 pp_keys_slot_count = 2; -u64 pp_keys_seed = 0x69b39c166d6f6c83; -internal Token_List -lex_full_input_cpp(Arena *arena, String_Const_u8 input){ -Token_List list = {}; -u32 flags_ZF0 = 0; -u32 flags_KF0 = 0; -u16 flags_KB0 = 0; -u8 *delim_first = input.str; -u8 *delim_one_past_last = input.str; -u8 *emit_ptr = input.str; -u8 *ptr = input.str; -u8 *opl_ptr = ptr + input.size; +u64 pp_keys_seed = 0x444d48e552bc237e; +struct Lex_State_Cpp{ +u32 flags_ZF0; +u32 flags_KF0; +u16 flags_KB0; +u8 *base; +u8 *delim_first; +u8 *delim_one_past_last; +u8 *emit_ptr; +u8 *ptr; +u8 *opl_ptr; +}; +internal void +lex_full_input_cpp_init(Lex_State_Cpp *state_ptr, String_Const_u8 input){ +state_ptr->flags_ZF0 = 0; +state_ptr->flags_KF0 = 0; +state_ptr->flags_KB0 = 0; +state_ptr->base = input.str; +state_ptr->delim_first = input.str; +state_ptr->delim_one_past_last = input.str; +state_ptr->emit_ptr = input.str; +state_ptr->ptr = input.str; +state_ptr->opl_ptr = input.str + input.size; +} +internal b32 +lex_full_input_cpp_breaks(Arena *arena, Token_List *list, Lex_State_Cpp *state_ptr, u64 max){ +b32 result = false; +u64 emit_counter = 0; +Lex_State_Cpp state; +block_copy_struct(&state, state_ptr); { state_label_1: // root -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_EOF; token.kind = 0; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; +result = true; goto end; } } -switch (*ptr){ +switch (*state.ptr){ case 0x00:case 0x01:case 0x02:case 0x03:case 0x04:case 0x05:case 0x06: case 0x07:case 0x08:case 0x0e:case 0x0f:case 0x10:case 0x11:case 0x12: case 0x13:case 0x14:case 0x15:case 0x16:case 0x17:case 0x18:case 0x19: case 0x1a:case 0x1b:case 0x1c:case 0x1d:case 0x1e:case 0x1f:case 0x40: case 0x60:case 0x7f: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x09:case 0x0b:case 0x0c:case 0x0d:case 0x20: { -if ((HasFlag(flags_KF0, 0x2))){ -ptr += 1; +if ((HasFlag(state.flags_KF0, 0x2))){ +state.ptr += 1; goto state_label_4; // error_body } -ptr += 1; +state.ptr += 1; goto state_label_3; // whitespace }break; case 0x0a: { -ptr += 1; -flags_KB0 &= ~(0x1); -flags_KF0 &= ~(0x1); -flags_KF0 &= ~(0x2); +state.ptr += 1; +state.flags_KB0 &= ~(0x1); +state.flags_KF0 &= ~(0x1); +state.flags_KF0 &= ~(0x2); goto state_label_3; // whitespace }break; case 0x21: { -ptr += 1; +state.ptr += 1; goto state_label_60; // op stage }break; case 0x22: { -if ((HasFlag(flags_KF0, 0x1))){ -ptr += 1; +if ((HasFlag(state.flags_KF0, 0x1))){ +state.ptr += 1; goto state_label_26; // include_quotes } -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; case 0x23: { -if ((!HasFlag(flags_KB0, 0x1))){ -ptr += 1; +if ((!HasFlag(state.flags_KB0, 0x1))){ +state.ptr += 1; goto state_label_23; // pp_directive_whitespace } -ptr += 1; +state.ptr += 1; goto state_label_67; // op stage }break; default: { -ptr += 1; +state.ptr += 1; goto state_label_2; // identifier }break; case 0x25: { -ptr += 1; +state.ptr += 1; goto state_label_64; // op stage }break; case 0x26: { -ptr += 1; +state.ptr += 1; goto state_label_61; // op stage }break; case 0x27: { -ptr += 1; -flags_ZF0 |= 0x40; +state.ptr += 1; +state.flags_ZF0 |= 0x40; goto state_label_32; // string }break; case 0x28: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_ParenOp; token.kind = 13; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x29: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_ParenCl; token.kind = 14; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2a: { -ptr += 1; +state.ptr += 1; goto state_label_63; // op stage }break; case 0x2b: { -ptr += 1; +state.ptr += 1; goto state_label_53; // op stage }break; case 0x2c: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Comma; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2d: { -ptr += 1; +state.ptr += 1; goto state_label_54; // op stage }break; case 0x2e: { -ptr += 1; +state.ptr += 1; goto state_label_6; // operator_or_fnumber_dot }break; case 0x2f: { -ptr += 1; +state.ptr += 1; goto state_label_7; // operator_or_comment_slash }break; case 0x30: { -ptr += 1; +state.ptr += 1; goto state_label_9; // znumber }break; case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36:case 0x37: case 0x38:case 0x39: { -ptr += 1; +state.ptr += 1; goto state_label_8; // number }break; case 0x3a: { -ptr += 1; +state.ptr += 1; goto state_label_52; // op stage }break; case 0x3b: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Semicolon; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3c: { -if ((!HasFlag(flags_KF0, 0x1))){ -ptr += 1; +if ((!HasFlag(state.flags_KF0, 0x1))){ +state.ptr += 1; goto state_label_56; // op stage } -ptr += 1; +state.ptr += 1; goto state_label_25; // include_pointy }break; case 0x3d: { -ptr += 1; +state.ptr += 1; goto state_label_59; // op stage }break; case 0x3e: { -ptr += 1; +state.ptr += 1; goto state_label_57; // op stage }break; case 0x3f: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Ternary; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x4c: { -ptr += 1; -flags_ZF0 |= 0x4; +state.ptr += 1; +state.flags_ZF0 |= 0x4; goto state_label_27; // pre_L }break; case 0x52: { -ptr += 1; +state.ptr += 1; goto state_label_31; // pre_R }break; case 0x55: { -ptr += 1; -flags_ZF0 |= 0x20; +state.ptr += 1; +state.flags_ZF0 |= 0x20; goto state_label_29; // pre_U }break; case 0x5b: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_BrackOp; token.kind = 13; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x5c: { -ptr += 1; +state.ptr += 1; goto state_label_5; // backslash }break; case 0x5d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_BrackCl; token.kind = 14; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x5e: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Xor; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x75: { -ptr += 1; -flags_ZF0 |= 0x10; +state.ptr += 1; +state.flags_ZF0 |= 0x10; goto state_label_28; // pre_u }break; case 0x7b: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_BraceOp; token.kind = 11; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x7c: { -ptr += 1; +state.ptr += 1; goto state_label_62; // op stage }break; case 0x7d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_BraceCl; token.kind = 12; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x7e: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Tilde; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_2: // identifier -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_KB0, 0x1)){ -Lexeme_Table_Lookup lookup = lexeme_table_lookup(pp_keys_hash_array, pp_keys_key_array, pp_keys_value_array, pp_keys_slot_count, pp_keys_seed, emit_ptr, token.size); +if (HasFlag(state.flags_KB0, 0x1)){ +Lexeme_Table_Lookup lookup = lexeme_table_lookup(pp_keys_hash_array, pp_keys_key_array, pp_keys_value_array, pp_keys_slot_count, pp_keys_seed, state.emit_ptr, token.size); if (lookup.found_match){ token.kind = lookup.base_kind; token.sub_kind = lookup.sub_kind; break; } } -Lexeme_Table_Lookup lookup = lexeme_table_lookup(main_keys_hash_array, main_keys_key_array, main_keys_value_array, main_keys_slot_count, main_keys_seed, emit_ptr, token.size); +Lexeme_Table_Lookup lookup = lexeme_table_lookup(main_keys_hash_array, main_keys_key_array, main_keys_value_array, main_keys_slot_count, main_keys_seed, state.emit_ptr, token.size); if (lookup.found_match){ token.kind = lookup.base_kind; token.sub_kind = lookup.sub_kind; @@ -905,14 +996,15 @@ break; token.sub_kind = TokenCppKind_Identifier; token.kind = 6; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ case 0x00:case 0x01:case 0x02:case 0x03:case 0x04:case 0x05:case 0x06: case 0x07:case 0x08:case 0x09:case 0x0a:case 0x0b:case 0x0c:case 0x0d: case 0x0e:case 0x0f:case 0x10:case 0x11:case 0x12:case 0x13:case 0x14: @@ -926,19 +1018,19 @@ case 0x7f: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_KB0, 0x1)){ -Lexeme_Table_Lookup lookup = lexeme_table_lookup(pp_keys_hash_array, pp_keys_key_array, pp_keys_value_array, pp_keys_slot_count, pp_keys_seed, emit_ptr, token.size); +if (HasFlag(state.flags_KB0, 0x1)){ +Lexeme_Table_Lookup lookup = lexeme_table_lookup(pp_keys_hash_array, pp_keys_key_array, pp_keys_value_array, pp_keys_slot_count, pp_keys_seed, state.emit_ptr, token.size); if (lookup.found_match){ token.kind = lookup.base_kind; token.sub_kind = lookup.sub_kind; break; } } -Lexeme_Table_Lookup lookup = lexeme_table_lookup(main_keys_hash_array, main_keys_key_array, main_keys_value_array, main_keys_slot_count, main_keys_seed, emit_ptr, token.size); +Lexeme_Table_Lookup lookup = lexeme_table_lookup(main_keys_hash_array, main_keys_key_array, main_keys_value_array, main_keys_slot_count, main_keys_seed, state.emit_ptr, token.size); if (lookup.found_match){ token.kind = lookup.base_kind; token.sub_kind = lookup.sub_kind; @@ -947,835 +1039,943 @@ break; token.sub_kind = TokenCppKind_Identifier; token.kind = 6; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; default: { -ptr += 1; +state.ptr += 1; goto state_label_2; // identifier }break; } } { state_label_3: // whitespace -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Whitespace; token.kind = 1; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Whitespace; token.kind = 1; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x09:case 0x0b:case 0x0c:case 0x0d:case 0x20: { -ptr += 1; +state.ptr += 1; goto state_label_3; // whitespace }break; case 0x0a: { -ptr += 1; -flags_KB0 &= ~(0x1); -flags_KF0 &= ~(0x1); -flags_KF0 &= ~(0x2); +state.ptr += 1; +state.flags_KB0 &= ~(0x1); +state.flags_KF0 &= ~(0x1); +state.flags_KF0 &= ~(0x2); goto state_label_3; // whitespace }break; } } { state_label_4: // error_body -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_PPErrorMessage; token.kind = 10; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { -ptr += 1; +state.ptr += 1; goto state_label_4; // error_body }break; case 0x0a: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_PPErrorMessage; token.kind = 10; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_5: // backslash -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Backslash; token.kind = 1; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Backslash; token.kind = 1; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x0a: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Backslash; token.kind = 1; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_6: // operator_or_fnumber_dot -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Dot; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Dot; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2a: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_DotStar; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2e: { -ptr += 1; +state.ptr += 1; goto state_label_68; // op stage }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37:case 0x38:case 0x39: { -ptr += 1; +state.ptr += 1; goto state_label_10; // fnumber_decimal }break; } } { state_label_7: // operator_or_comment_slash -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Div; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Div; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2a: { -ptr += 1; +state.ptr += 1; goto state_label_49; // comment_block }break; case 0x2f: { -ptr += 1; +state.ptr += 1; goto state_label_51; // comment_line }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_DivEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_8: // number -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralInteger; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralInteger; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2e: { -ptr += 1; +state.ptr += 1; goto state_label_10; // fnumber_decimal }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37:case 0x38:case 0x39: { -ptr += 1; +state.ptr += 1; goto state_label_8; // number }break; case 0x45:case 0x65: { -ptr += 1; +state.ptr += 1; goto state_label_11; // fnumber_exponent }break; case 0x4c: { -ptr += 1; +state.ptr += 1; goto state_label_18; // L_number }break; case 0x55:case 0x75: { -ptr += 1; +state.ptr += 1; goto state_label_17; // U_number }break; case 0x6c: { -ptr += 1; +state.ptr += 1; goto state_label_20; // l_number }break; } } { state_label_9: // znumber -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralInteger; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralInteger; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2e: { -ptr += 1; +state.ptr += 1; goto state_label_10; // fnumber_decimal }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37: { -ptr += 1; -flags_ZF0 |= 0x2; +state.ptr += 1; +state.flags_ZF0 |= 0x2; goto state_label_16; // number_oct }break; case 0x45:case 0x65: { -ptr += 1; +state.ptr += 1; goto state_label_11; // fnumber_exponent }break; case 0x4c: { -ptr += 1; +state.ptr += 1; goto state_label_18; // L_number }break; case 0x55:case 0x75: { -ptr += 1; +state.ptr += 1; goto state_label_17; // U_number }break; case 0x58:case 0x78: { -ptr += 1; -flags_ZF0 |= 0x1; +state.ptr += 1; +state.flags_ZF0 |= 0x1; goto state_label_14; // number_hex_first }break; case 0x6c: { -ptr += 1; +state.ptr += 1; goto state_label_20; // l_number }break; } } { state_label_10: // fnumber_decimal -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37:case 0x38:case 0x39: { -ptr += 1; +state.ptr += 1; goto state_label_10; // fnumber_decimal }break; case 0x45:case 0x65: { -ptr += 1; +state.ptr += 1; goto state_label_11; // fnumber_exponent }break; case 0x46:case 0x66: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat32; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x4c:case 0x6c: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_11: // fnumber_exponent -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2b:case 0x2d: { -ptr += 1; +state.ptr += 1; goto state_label_12; // fnumber_exponent_sign }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37:case 0x38:case 0x39: { -ptr += 1; +state.ptr += 1; goto state_label_13; // fnumber_exponent_digits }break; case 0x46:case 0x66: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat32; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x4c:case 0x6c: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_12: // fnumber_exponent_sign -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37:case 0x38:case 0x39: { -ptr += 1; +state.ptr += 1; goto state_label_13; // fnumber_exponent_digits }break; case 0x46:case 0x66: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat32; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x4c:case 0x6c: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_13: // fnumber_exponent_digits -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37:case 0x38:case 0x39: { -ptr += 1; +state.ptr += 1; goto state_label_13; // fnumber_exponent_digits }break; case 0x46:case 0x66: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat32; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x4c:case 0x6c: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_14: // number_hex_first -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: @@ -1783,47 +1983,52 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_15; // number_hex }break; } } { state_label_15: // number_hex -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralIntegerHex; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralIntegerHex; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: @@ -1831,104 +2036,109 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_15; // number_hex }break; case 0x4c: { -ptr += 1; +state.ptr += 1; goto state_label_18; // L_number }break; case 0x55:case 0x75: { -ptr += 1; +state.ptr += 1; goto state_label_17; // U_number }break; case 0x6c: { -ptr += 1; +state.ptr += 1; goto state_label_20; // l_number }break; } } { state_label_16: // number_oct -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralIntegerOct; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralIntegerOct; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37: { -ptr += 1; -flags_ZF0 |= 0x2; +state.ptr += 1; +state.flags_ZF0 |= 0x2; goto state_label_16; // number_oct }break; case 0x4c: { -ptr += 1; +state.ptr += 1; goto state_label_18; // L_number }break; case 0x55:case 0x75: { -ptr += 1; +state.ptr += 1; goto state_label_17; // U_number }break; case 0x6c: { -ptr += 1; +state.ptr += 1; goto state_label_20; // l_number }break; } } { state_label_17: // U_number -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexU; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctU; token.kind = 8; break; @@ -1936,28 +2146,29 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerU; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexU; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctU; token.kind = 8; break; @@ -1965,40 +2176,44 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerU; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x4c: { -ptr += 1; +state.ptr += 1; goto state_label_19; // UL_number }break; case 0x6c: { -ptr += 1; +state.ptr += 1; goto state_label_21; // Ul_number }break; } } { state_label_18: // L_number -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctL; token.kind = 8; break; @@ -2006,28 +2221,29 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctL; token.kind = 8; break; @@ -2035,32 +2251,36 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x4c: { -ptr += 1; +state.ptr += 1; goto state_label_22; // LL_number }break; case 0x55:case 0x75: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexUL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctUL; token.kind = 8; break; @@ -2068,30 +2288,34 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerUL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_19: // UL_number -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexUL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctUL; token.kind = 8; break; @@ -2099,28 +2323,29 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerUL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexUL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctUL; token.kind = 8; break; @@ -2128,27 +2353,31 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerUL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x4c: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexULL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctULL; token.kind = 8; break; @@ -2156,30 +2385,34 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerULL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_20: // l_number -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctL; token.kind = 8; break; @@ -2187,28 +2420,29 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctL; token.kind = 8; break; @@ -2216,27 +2450,31 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x55:case 0x75: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexUL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctUL; token.kind = 8; break; @@ -2244,35 +2482,39 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerUL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x6c: { -ptr += 1; +state.ptr += 1; goto state_label_22; // LL_number }break; } } { state_label_21: // Ul_number -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexUL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctUL; token.kind = 8; break; @@ -2280,28 +2522,29 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerUL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexUL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctUL; token.kind = 8; break; @@ -2309,27 +2552,31 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerUL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x6c: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexULL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctULL; token.kind = 8; break; @@ -2337,30 +2584,34 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerULL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_22: // LL_number -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexLL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctLL; token.kind = 8; break; @@ -2368,28 +2619,29 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerLL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexLL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctLL; token.kind = 8; break; @@ -2397,27 +2649,31 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerLL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x55:case 0x75: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexULL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctULL; token.kind = 8; break; @@ -2425,55 +2681,64 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerULL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_23: // pp_directive_whitespace -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x09:case 0x0b:case 0x0c:case 0x20: { -ptr += 1; +state.ptr += 1; goto state_label_23; // pp_directive_whitespace }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: @@ -2486,25 +2751,25 @@ case 0x66:case 0x67:case 0x68:case 0x69:case 0x6a:case 0x6b:case 0x6c: case 0x6d:case 0x6e:case 0x6f:case 0x70:case 0x71:case 0x72:case 0x73: case 0x74:case 0x75:case 0x76:case 0x77:case 0x78:case 0x79:case 0x7a: { -delim_first = ptr; -flags_KB0 |= 0x1; -ptr += 1; +state.delim_first = state.ptr; +state.flags_KB0 |= 0x1; +state.ptr += 1; goto state_label_24; // pp_directive }break; } } { state_label_24: // pp_directive -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ -delim_one_past_last = ptr; +state.delim_one_past_last = state.ptr; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -Lexeme_Table_Lookup lookup = lexeme_table_lookup(pp_directives_hash_array, pp_directives_key_array, pp_directives_value_array, pp_directives_slot_count, pp_directives_seed, delim_first, (delim_one_past_last - delim_first)); +Lexeme_Table_Lookup lookup = lexeme_table_lookup(pp_directives_hash_array, pp_directives_key_array, pp_directives_value_array, pp_directives_slot_count, pp_directives_seed, state.delim_first, (state.delim_one_past_last - state.delim_first)); if (lookup.found_match){ token.kind = lookup.base_kind; token.sub_kind = lookup.sub_kind; @@ -2516,31 +2781,32 @@ token.kind = 2; switch (token.sub_kind){ case TokenCppKind_PPInclude: { -flags_KF0 |= 0x1; +state.flags_KF0 |= 0x1; }break; case TokenCppKind_PPError: { -flags_KF0 |= 0x2; +state.flags_KF0 |= 0x2; }break; } -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { -delim_one_past_last = ptr; +state.delim_one_past_last = state.ptr; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -Lexeme_Table_Lookup lookup = lexeme_table_lookup(pp_directives_hash_array, pp_directives_key_array, pp_directives_value_array, pp_directives_slot_count, pp_directives_seed, delim_first, (delim_one_past_last - delim_first)); +Lexeme_Table_Lookup lookup = lexeme_table_lookup(pp_directives_hash_array, pp_directives_key_array, pp_directives_value_array, pp_directives_slot_count, pp_directives_seed, state.delim_first, (state.delim_one_past_last - state.delim_first)); if (lookup.found_match){ token.kind = lookup.base_kind; token.sub_kind = lookup.sub_kind; @@ -2552,17 +2818,21 @@ token.kind = 2; switch (token.sub_kind){ case TokenCppKind_PPInclude: { -flags_KF0 |= 0x1; +state.flags_KF0 |= 0x1; }break; case TokenCppKind_PPError: { -flags_KF0 |= 0x2; +state.flags_KF0 |= 0x2; }break; } -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: @@ -2575,47 +2845,52 @@ case 0x66:case 0x67:case 0x68:case 0x69:case 0x6a:case 0x6b:case 0x6c: case 0x6d:case 0x6e:case 0x6f:case 0x70:case 0x71:case 0x72:case 0x73: case 0x74:case 0x75:case 0x76:case 0x77:case 0x78:case 0x79:case 0x7a: { -ptr += 1; +state.ptr += 1; goto state_label_24; // pp_directive }break; } } { state_label_25: // include_pointy -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x20:case 0x2e:case 0x2f:case 0x30:case 0x31:case 0x32:case 0x33: @@ -2629,65 +2904,74 @@ case 0x69:case 0x6a:case 0x6b:case 0x6c:case 0x6d:case 0x6e:case 0x6f: case 0x70:case 0x71:case 0x72:case 0x73:case 0x74:case 0x75:case 0x76: case 0x77:case 0x78:case 0x79:case 0x7a: { -ptr += 1; +state.ptr += 1; goto state_label_25; // include_pointy }break; case 0x3e: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_PPIncludeFile; token.kind = 10; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_26: // include_quotes -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x20:case 0x2e:case 0x2f:case 0x30:case 0x31:case 0x32:case 0x33: @@ -2701,220 +2985,229 @@ case 0x69:case 0x6a:case 0x6b:case 0x6c:case 0x6d:case 0x6e:case 0x6f: case 0x70:case 0x71:case 0x72:case 0x73:case 0x74:case 0x75:case 0x76: case 0x77:case 0x78:case 0x79:case 0x7a: { -ptr += 1; +state.ptr += 1; goto state_label_26; // include_quotes }break; case 0x22: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_PPIncludeFile; token.kind = 10; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_27: // pre_L -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_2; // identifier } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_2; // identifier }break; case 0x22: { -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; case 0x52: { -ptr += 1; +state.ptr += 1; goto state_label_31; // pre_R }break; } } { state_label_28: // pre_u -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_2; // identifier } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_2; // identifier }break; case 0x22: { -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; case 0x38: { -ptr += 1; -flags_ZF0 |= 0x8; +state.ptr += 1; +state.flags_ZF0 |= 0x8; goto state_label_30; // pre_u8 }break; case 0x52: { -ptr += 1; +state.ptr += 1; goto state_label_31; // pre_R }break; } } { state_label_29: // pre_U -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_2; // identifier } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_2; // identifier }break; case 0x22: { -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; case 0x52: { -ptr += 1; +state.ptr += 1; goto state_label_31; // pre_R }break; } } { state_label_30: // pre_u8 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_2; // identifier } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_2; // identifier }break; case 0x22: { -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; case 0x52: { -ptr += 1; +state.ptr += 1; goto state_label_31; // pre_R }break; } } { state_label_31: // pre_R -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_2; // identifier } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_2; // identifier }break; case 0x22: { -ptr += 1; -delim_first = ptr; +state.ptr += 1; +state.delim_first = state.ptr; goto state_label_45; // raw_string_get_delim }break; } } { state_label_32: // string -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; case 0x0a: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x22: { -if ((!HasFlag(flags_ZF0, 0x40))){ -ptr += 1; +if ((!HasFlag(state.flags_ZF0, 0x40))){ +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x4)){ +if (HasFlag(state.flags_ZF0, 0x4)){ token.sub_kind = TokenCppKind_LiteralStringWide; token.kind = 10; break; } -if (HasFlag(flags_ZF0, 0x8)){ +if (HasFlag(state.flags_ZF0, 0x8)){ token.sub_kind = TokenCppKind_LiteralStringUTF8; token.kind = 10; break; } -if (HasFlag(flags_ZF0, 0x10)){ +if (HasFlag(state.flags_ZF0, 0x10)){ token.sub_kind = TokenCppKind_LiteralStringUTF16; token.kind = 10; break; } -if (HasFlag(flags_ZF0, 0x20)){ +if (HasFlag(state.flags_ZF0, 0x20)){ token.sub_kind = TokenCppKind_LiteralStringUTF32; token.kind = 10; break; @@ -2922,41 +3215,45 @@ break; token.sub_kind = TokenCppKind_LiteralString; token.kind = 10; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root } -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; case 0x27: { -if ((HasFlag(flags_ZF0, 0x40))){ -ptr += 1; +if ((HasFlag(state.flags_ZF0, 0x40))){ +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x4)){ +if (HasFlag(state.flags_ZF0, 0x4)){ token.sub_kind = TokenCppKind_LiteralCharacterWide; token.kind = 10; break; } -if (HasFlag(flags_ZF0, 0x8)){ +if (HasFlag(state.flags_ZF0, 0x8)){ token.sub_kind = TokenCppKind_LiteralCharacterUTF8; token.kind = 10; break; } -if (HasFlag(flags_ZF0, 0x10)){ +if (HasFlag(state.flags_ZF0, 0x10)){ token.sub_kind = TokenCppKind_LiteralCharacterUTF16; token.kind = 10; break; } -if (HasFlag(flags_ZF0, 0x20)){ +if (HasFlag(state.flags_ZF0, 0x20)){ token.sub_kind = TokenCppKind_LiteralCharacterUTF32; token.kind = 10; break; @@ -2964,92 +3261,99 @@ break; token.sub_kind = TokenCppKind_LiteralCharacter; token.kind = 10; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root } -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; case 0x5c: { -ptr += 1; +state.ptr += 1; goto state_label_33; // string_esc }break; } } { state_label_33: // string_esc -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_EOF; token.kind = 0; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; +result = true; goto end; } } -switch (*ptr){ +switch (*state.ptr){ default: { -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37: { -ptr += 1; +state.ptr += 1; goto state_label_34; // string_esc_oct2 }break; case 0x55: { -ptr += 1; +state.ptr += 1; goto state_label_37; // string_esc_universal_8 }break; case 0x75: { -ptr += 1; +state.ptr += 1; goto state_label_41; // string_esc_universal_4 }break; case 0x78: { -ptr += 1; +state.ptr += 1; goto state_label_36; // string_esc_hex }break; } } { state_label_34: // string_esc_oct2 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3057,19 +3361,19 @@ goto state_label_32; // string case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37: { -ptr += 1; +state.ptr += 1; goto state_label_35; // string_esc_oct1 }break; } } { state_label_35: // string_esc_oct1 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3077,19 +3381,19 @@ goto state_label_32; // string case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37: { -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; } } { state_label_36: // string_esc_hex -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3099,19 +3403,19 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_36; // string_esc_hex }break; } } { state_label_37: // string_esc_universal_8 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3121,19 +3425,19 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_38; // string_esc_universal_7 }break; } } { state_label_38: // string_esc_universal_7 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3143,19 +3447,19 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_39; // string_esc_universal_6 }break; } } { state_label_39: // string_esc_universal_6 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3165,19 +3469,19 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_40; // string_esc_universal_5 }break; } } { state_label_40: // string_esc_universal_5 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3187,19 +3491,19 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_41; // string_esc_universal_4 }break; } } { state_label_41: // string_esc_universal_4 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3209,19 +3513,19 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_42; // string_esc_universal_3 }break; } } { state_label_42: // string_esc_universal_3 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3231,19 +3535,19 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_43; // string_esc_universal_2 }break; } } { state_label_43: // string_esc_universal_2 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3253,19 +3557,19 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_44; // string_esc_universal_1 }break; } } { state_label_44: // string_esc_universal_1 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3275,135 +3579,145 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; } } { state_label_45: // raw_string_get_delim -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_EOF; token.kind = 0; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; +result = true; goto end; } } -switch (*ptr){ +switch (*state.ptr){ default: { -ptr += 1; +state.ptr += 1; goto state_label_45; // raw_string_get_delim }break; case 0x20:case 0x29:case 0x5c: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x28: { -delim_one_past_last = ptr; -ptr += 1; +state.delim_one_past_last = state.ptr; +state.ptr += 1; goto state_label_46; // raw_string_find_close }break; } } { state_label_46: // raw_string_find_close -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_EOF; token.kind = 0; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; +result = true; goto end; } } -switch (*ptr){ +switch (*state.ptr){ default: { -ptr += 1; +state.ptr += 1; goto state_label_46; // raw_string_find_close }break; case 0x29: { -ptr += 1; +state.ptr += 1; goto state_label_47; // raw_string_try_delim }break; } } { state_label_47: // raw_string_try_delim -umem delim_length = delim_one_past_last - delim_first; +umem delim_length = state.delim_one_past_last - state.delim_first; umem parse_length = 0; for (;;){ if (parse_length == delim_length){ goto state_label_48; // raw_string_try_quote } -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ goto state_label_48; // raw_string_try_quote } -if (*ptr == delim_first[parse_length]){ -ptr += 1; +if (*state.ptr == state.delim_first[parse_length]){ +state.ptr += 1; parse_length += 1; } else{ @@ -3413,41 +3727,41 @@ goto state_label_46; // raw_string_find_close } { state_label_48: // raw_string_try_quote -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_46; // raw_string_find_close } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_46; // raw_string_find_close }break; case 0x22: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x4)){ +if (HasFlag(state.flags_ZF0, 0x4)){ token.sub_kind = TokenCppKind_LiteralStringWideRaw; token.kind = 10; break; } -if (HasFlag(flags_ZF0, 0x8)){ +if (HasFlag(state.flags_ZF0, 0x8)){ token.sub_kind = TokenCppKind_LiteralStringUTF8Raw; token.kind = 10; break; } -if (HasFlag(flags_ZF0, 0x10)){ +if (HasFlag(state.flags_ZF0, 0x10)){ token.sub_kind = TokenCppKind_LiteralStringUTF16Raw; token.kind = 10; break; } -if (HasFlag(flags_ZF0, 0x20)){ +if (HasFlag(state.flags_ZF0, 0x20)){ token.sub_kind = TokenCppKind_LiteralStringUTF32Raw; token.kind = 10; break; @@ -3455,1200 +3769,1385 @@ break; token.sub_kind = TokenCppKind_LiteralStringRaw; token.kind = 10; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_49: // comment_block -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_BlockComment; token.kind = 3; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_EOF; token.kind = 0; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; +result = true; goto end; } } -switch (*ptr){ +switch (*state.ptr){ default: { -ptr += 1; +state.ptr += 1; goto state_label_49; // comment_block }break; case 0x0a: { -ptr += 1; -flags_KB0 &= ~(0x1); -flags_KF0 &= ~(0x1); +state.ptr += 1; +state.flags_KB0 &= ~(0x1); +state.flags_KF0 &= ~(0x1); goto state_label_49; // comment_block }break; case 0x2a: { -ptr += 1; +state.ptr += 1; goto state_label_50; // comment_block_try_close }break; } } { state_label_50: // comment_block_try_close -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_BlockComment; token.kind = 3; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_EOF; token.kind = 0; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; +result = true; goto end; } } -switch (*ptr){ +switch (*state.ptr){ default: { -ptr += 1; +state.ptr += 1; goto state_label_49; // comment_block }break; case 0x2a: { -ptr += 1; +state.ptr += 1; goto state_label_50; // comment_block_try_close }break; case 0x2f: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_BlockComment; token.kind = 3; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_51: // comment_line -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LineComment; token.kind = 3; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { -ptr += 1; +state.ptr += 1; goto state_label_51; // comment_line }break; case 0x0a: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LineComment; token.kind = 3; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_52: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Colon; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Colon; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3a: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_ColonColon; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_53: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Plus; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Plus; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2b: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_PlusPlus; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_PlusEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_54: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Minus; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Minus; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_MinusMinus; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_MinusEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3e: { -ptr += 1; +state.ptr += 1; goto state_label_55; // op stage }break; } } { state_label_55: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Arrow; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Arrow; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2a: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_ArrowStar; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_56: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Less; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Less; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3c: { -ptr += 1; +state.ptr += 1; goto state_label_65; // op stage }break; case 0x3d: { -ptr += 1; +state.ptr += 1; goto state_label_58; // op stage }break; } } { state_label_57: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Grtr; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Grtr; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_GrtrEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3e: { -ptr += 1; +state.ptr += 1; goto state_label_66; // op stage }break; } } { state_label_58: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LessEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LessEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3e: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Compare; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_59: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Eq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Eq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_EqEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_60: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Not; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Not; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_NotEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_61: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_And; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_And; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x26: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_AndAnd; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_62: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Or; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Or; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x7c: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_OrOr; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_63: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Star; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Star; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_StarEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_64: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Mod; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Mod; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_ModEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_65: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LeftLeft; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LeftLeft; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LeftLeftEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_66: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_RightRight; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_RightRight; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_RightRightEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_67: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_PPStringify; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_PPStringify; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x23: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_PPConcat; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_68: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2e: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_DotDotDot; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } end:; +block_copy_struct(state_ptr, &state); +return(result); +} +internal Token_List +lex_full_input_cpp(Arena *arena, String_Const_u8 input){ +Lex_State_Cpp state = {}; +lex_full_input_cpp_init(&state, input); +Token_List list = {}; +lex_full_input_cpp_breaks(arena, &list, &state, max_u64); return(list); } diff --git a/custom/lexer_generator/4coder_lex_gen_main.cpp b/custom/lexer_generator/4coder_lex_gen_main.cpp index e0be4e06..1284f434 100644 --- a/custom/lexer_generator/4coder_lex_gen_main.cpp +++ b/custom/lexer_generator/4coder_lex_gen_main.cpp @@ -3258,7 +3258,7 @@ gen_flag_check__cont_flow(Flag *flag, b32 value, FILE *out){ if (value == 0){ fprintf(out, "!"); } - fprintf(out, "HasFlag(%.*s%d, 0x%x)", string_expand(flag->base_name), flag->index, flag->value); + fprintf(out, "HasFlag(state.%.*s%d, 0x%x)", string_expand(flag->base_name), flag->index, flag->value); } internal void @@ -3298,6 +3298,7 @@ gen_goto_state__cont_flow(State *state, Action_Context context, FILE *out){ }break; case ActionContext_EndOfFile: { + fprintf(out, "result = true;\n"); fprintf(out, "goto end;\n"); }break; } @@ -3312,11 +3313,11 @@ internal void gen_action__set_flag(Flag *flag, b32 value, FILE *out){ if (flag != 0){ if (value == 0){ - fprintf(out, "%.*s%d &= ~(0x%x);\n", + fprintf(out, "state.%.*s%d &= ~(0x%x);\n", string_expand(flag->base_name), flag->index, flag->value); } else{ - fprintf(out, "%.*s%d |= 0x%x;\n", + fprintf(out, "state.%.*s%d |= 0x%x;\n", string_expand(flag->base_name), flag->index, flag->value); } } @@ -3326,15 +3327,15 @@ internal void gen_emit__fill_token_flags(Flag_Set flags, Flag_Bucket_Set bucket_set, FILE *out){ if (bucket_set.buckets[FlagBindProperty_Bound][FlagResetRule_AutoZero].count > 0){ if (bucket_set.buckets[FlagBindProperty_Bound][FlagResetRule_KeepState].count > 0){ - fprintf(out, "token.flags = flag_ZB0 | flags_KB0;\n"); + fprintf(out, "token.flags = state.flag_ZB0 | state.flags_KB0;\n"); } else{ - fprintf(out, "token.flags = flags_ZB0;\n"); + fprintf(out, "token.flags = state.flags_ZB0;\n"); } } else{ if (bucket_set.buckets[FlagBindProperty_Bound][FlagResetRule_KeepState].count > 0){ - fprintf(out, "token.flags = flags_KB0;\n"); + fprintf(out, "token.flags = state.flags_KB0;\n"); } } for (Flag *flag = flags.first; @@ -3390,25 +3391,25 @@ gen_SLOW_action_list__cont_flow(Arena *scratch, Token_Kind_Set tokens, Flag_Set for (i32 i = 0; i < FlagBindProperty_COUNT; i += 1){ Flag_Bucket *bucket = &bucket_set.buckets[i][FlagResetRule_AutoZero]; for (i32 j = 0; j < bucket->number_of_variables; j += 1){ - fprintf(out, "%.*s%d = 0;\n", string_expand(bucket->pretty_name), j); + fprintf(out, "state.%.*s%d = 0;\n", string_expand(bucket->pretty_name), j); } } }break; case ActionKind_DelimMarkFirst: { - fprintf(out, "delim_first = ptr;\n"); + fprintf(out, "state.delim_first = state.ptr;\n"); }break; case ActionKind_DelimMarkOnePastLast: { - fprintf(out, "delim_one_past_last = ptr;\n"); + fprintf(out, "state.delim_one_past_last = state.ptr;\n"); }break; case ActionKind_Consume: { if (context != ActionContext_EndOfFile){ - fprintf(out, "ptr += 1;\n"); + fprintf(out, "state.ptr += 1;\n"); } else{ result_context = ActionContext_EndOfFile; @@ -3422,8 +3423,8 @@ gen_SLOW_action_list__cont_flow(Arena *scratch, Token_Kind_Set tokens, Flag_Set fprintf(out, "{\n"); fprintf(out, "Token token = {};\n"); - fprintf(out, "token.pos = (i64)(emit_ptr - input.str);\n"); - fprintf(out, "token.size = (i64)(ptr - emit_ptr);\n"); + fprintf(out, "token.pos = (i64)(state.emit_ptr - state.base);\n"); + fprintf(out, "token.size = (i64)(state.ptr - state.emit_ptr);\n"); gen_emit__fill_token_flags(flags, bucket_set, out); @@ -3454,7 +3455,7 @@ gen_SLOW_action_list__cont_flow(Arena *scratch, Token_Kind_Set tokens, Flag_Set fprintf(out, "Lexeme_Table_Lookup lookup = " "lexeme_table_lookup(%.*s_hash_array, %.*s_key_array, " "%.*s_value_array, %.*s_slot_count, %.*s_seed, " - "emit_ptr, token.size);\n", + "state.emit_ptr, token.size);\n", string_expand(keywords->pretty_name), string_expand(keywords->pretty_name), string_expand(keywords->pretty_name), @@ -3478,7 +3479,7 @@ gen_SLOW_action_list__cont_flow(Arena *scratch, Token_Kind_Set tokens, Flag_Set fprintf(out, "Lexeme_Table_Lookup lookup = " "lexeme_table_lookup(%.*s_hash_array, %.*s_key_array, " "%.*s_value_array, %.*s_slot_count, %.*s_seed, " - "delim_first, (delim_one_past_last - delim_first));\n", + "state.delim_first, (state.delim_one_past_last - state.delim_first));\n", string_expand(keywords->pretty_name), string_expand(keywords->pretty_name), string_expand(keywords->pretty_name), @@ -3520,8 +3521,14 @@ gen_SLOW_action_list__cont_flow(Arena *scratch, Token_Kind_Set tokens, Flag_Set fprintf(out, "}\n"); } - fprintf(out, "token_list_push(arena, &list, &token);\n"); - fprintf(out, "emit_ptr = ptr;\n"); + fprintf(out, "token_list_push(arena, list, &token);\n"); + fprintf(out, "emit_counter += 1;\n"); + if (context != ActionContext_EndOfFile){ + fprintf(out, "if (emit_counter == max){\n"); + fprintf(out, "goto end;\n"); + fprintf(out, "}\n"); + } + fprintf(out, "state.emit_ptr = state.ptr;\n"); fprintf(out, "}\n"); }break; } @@ -3535,7 +3542,18 @@ gen_flag_declarations__cont_flow(Flag_Bucket *bucket, FILE *out){ i32 number_of_flag_variables = (bucket->count + max_bits - 1)/max_bits; String_Const_u8 pretty_name = bucket->pretty_name; for (i32 i = 0; i < number_of_flag_variables; i += 1){ - fprintf(out, "u%d %.*s%d = 0;\n", max_bits, string_expand(pretty_name), i); + fprintf(out, "u%d %.*s%d;\n", max_bits, string_expand(pretty_name), i); + } + bucket->number_of_variables = number_of_flag_variables; +} + +internal void +gen_flag_init__cont_flow(Flag_Bucket *bucket, FILE *out){ + i32 max_bits = bucket->max_bits; + i32 number_of_flag_variables = (bucket->count + max_bits - 1)/max_bits; + String_Const_u8 pretty_name = bucket->pretty_name; + for (i32 i = 0; i < number_of_flag_variables; i += 1){ + fprintf(out, "state_ptr->%.*s%d = 0;\n", string_expand(pretty_name), i); } bucket->number_of_variables = number_of_flag_variables; } @@ -3664,23 +3682,43 @@ gen_contiguous_control_flow_lexer(Arena *scratch, Token_Kind_Set tokens, Lexer_M } } - fprintf(out, "internal Token_List\n"); - fprintf(out, "lex_full_input_" LANG_NAME_LOWER_STR "(Arena *arena, String_Const_u8 input){\n"); - fprintf(out, "Token_List list = {};\n"); - + fprintf(out, "struct Lex_State_" LANG_NAME_CAMEL_STR "{\n"); for (i32 i = 0; i < FlagBindProperty_COUNT; i += 1){ for (i32 j = 0; j < FlagResetRule_COUNT; j += 1){ gen_flag_declarations__cont_flow(&bucket_set.buckets[i][j], out); } } + fprintf(out, "u8 *base;\n"); + fprintf(out, "u8 *delim_first;\n"); + fprintf(out, "u8 *delim_one_past_last;\n"); + fprintf(out, "u8 *emit_ptr;\n"); + fprintf(out, "u8 *ptr;\n"); + fprintf(out, "u8 *opl_ptr;\n"); + fprintf(out, "};\n"); - fprintf(out, "u8 *delim_first = input.str;\n"); - fprintf(out, "u8 *delim_one_past_last = input.str;\n"); + fprintf(out, "internal void\n"); + fprintf(out, "lex_full_input_" LANG_NAME_LOWER_STR "_init(Lex_State_" + LANG_NAME_CAMEL_STR " *state_ptr, String_Const_u8 input){\n"); + for (i32 i = 0; i < FlagBindProperty_COUNT; i += 1){ + for (i32 j = 0; j < FlagResetRule_COUNT; j += 1){ + gen_flag_init__cont_flow(&bucket_set.buckets[i][j], out); + } + } + fprintf(out, "state_ptr->base = input.str;\n"); + fprintf(out, "state_ptr->delim_first = input.str;\n"); + fprintf(out, "state_ptr->delim_one_past_last = input.str;\n"); + fprintf(out, "state_ptr->emit_ptr = input.str;\n"); + fprintf(out, "state_ptr->ptr = input.str;\n"); + fprintf(out, "state_ptr->opl_ptr = input.str + input.size;\n"); + fprintf(out, "}\n"); - fprintf(out, "u8 *emit_ptr = input.str;\n"); - - fprintf(out, "u8 *ptr = input.str;\n"); - fprintf(out, "u8 *opl_ptr = ptr + input.size;\n"); + fprintf(out, "internal b32\n"); + fprintf(out, "lex_full_input_" LANG_NAME_LOWER_STR "_breaks(" + "Arena *arena, Token_List *list, Lex_State_" LANG_NAME_CAMEL_STR " *state_ptr, u64 max){\n"); + fprintf(out, "b32 result = false;\n"); + fprintf(out, "u64 emit_counter = 0;\n"); + fprintf(out, "Lex_State_" LANG_NAME_CAMEL_STR " state;\n"); + fprintf(out, "block_copy_struct(&state, state_ptr);\n"); for (State *state = model.states.first; state != 0; @@ -3706,7 +3744,7 @@ gen_contiguous_control_flow_lexer(Arena *scratch, Token_Kind_Set tokens, Lexer_M Transition *failure_trans = trans->next; Assert(failure_trans->condition.kind == TransitionCaseKind_DelimMatchFail); - fprintf(out, "umem delim_length = delim_one_past_last - delim_first;\n"); + fprintf(out, "umem delim_length = state.delim_one_past_last - state.delim_first;\n"); fprintf(out, "umem parse_length = 0;\n"); fprintf(out, "for (;;){\n"); { @@ -3718,7 +3756,7 @@ gen_contiguous_control_flow_lexer(Arena *scratch, Token_Kind_Set tokens, Lexer_M gen_goto_dst_state__cont_flow(success_trans, ActionContext_Normal, out); } fprintf(out, "}\n"); - fprintf(out, "if (ptr == opl_ptr){\n"); + fprintf(out, "if (state.ptr == state.opl_ptr){\n"); { gen_SLOW_action_list__cont_flow(scratch, tokens, model.flags, bucket_set, failure_trans->activation_actions, @@ -3727,8 +3765,8 @@ gen_contiguous_control_flow_lexer(Arena *scratch, Token_Kind_Set tokens, Lexer_M } fprintf(out, "}\n"); - fprintf(out, "if (*ptr == delim_first[parse_length]){\n"); - fprintf(out, "ptr += 1;\n"); + fprintf(out, "if (*state.ptr == state.delim_first[parse_length]){\n"); + fprintf(out, "state.ptr += 1;\n"); fprintf(out, "parse_length += 1;\n"); fprintf(out, "}\n"); fprintf(out, "else{\n"); @@ -3746,7 +3784,7 @@ gen_contiguous_control_flow_lexer(Arena *scratch, Token_Kind_Set tokens, Lexer_M case TransitionCaseKind_ConditionSet: { { - fprintf(out, "if (ptr == opl_ptr){\n"); + fprintf(out, "if (state.ptr == state.opl_ptr){\n"); for (; trans != 0; trans = trans->next){ @@ -3773,7 +3811,7 @@ gen_contiguous_control_flow_lexer(Arena *scratch, Token_Kind_Set tokens, Lexer_M Grouped_Input_Handler_List group_list = opt_grouped_input_handlers(scratch, trans); - fprintf(out, "switch (*ptr){\n"); + fprintf(out, "switch (*state.ptr){\n"); for (Grouped_Input_Handler *group = group_list.first; group != 0; group = group->next){ @@ -3823,6 +3861,16 @@ gen_contiguous_control_flow_lexer(Arena *scratch, Token_Kind_Set tokens, Lexer_M } fprintf(out, "end:;\n"); + fprintf(out, "block_copy_struct(state_ptr, &state);\n"); + fprintf(out, "return(result);\n"); + fprintf(out, "}\n"); + + fprintf(out, "internal Token_List\n"); + fprintf(out, "lex_full_input_" LANG_NAME_LOWER_STR "(Arena *arena, String_Const_u8 input){\n"); + fprintf(out, "Lex_State_" LANG_NAME_CAMEL_STR " state = {};\n"); + fprintf(out, "lex_full_input_" LANG_NAME_LOWER_STR "_init(&state, input);\n"); + fprintf(out, "Token_List list = {};\n"); + fprintf(out, "lex_full_input_" LANG_NAME_LOWER_STR "_breaks(arena, &list, &state, max_u64);\n"); fprintf(out, "return(list);\n"); fprintf(out, "}\n"); From c741cf7c6c5cc4a33d5fe7e0892479ab98719e80 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Mon, 21 Oct 2019 23:02:49 -0700 Subject: [PATCH 6/8] Profiling lexing --- custom/4coder_default_hooks.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/custom/4coder_default_hooks.cpp b/custom/4coder_default_hooks.cpp index 62729570..204997a7 100644 --- a/custom/4coder_default_hooks.cpp +++ b/custom/4coder_default_hooks.cpp @@ -545,9 +545,13 @@ do_full_lex_async__inner(Async_Context *actx, Buffer_ID buffer_id){ Thread_Context *tctx = get_thread_context(app); Scratch_Block scratch(tctx); - system_acquire_global_frame_mutex(tctx); - String_Const_u8 contents = push_whole_buffer(app, scratch, buffer_id); - system_release_global_frame_mutex(tctx); + String_Const_u8 contents = {}; + { + ProfileBlock(app, "async lex contents"); + system_acquire_global_frame_mutex(tctx); + contents = push_whole_buffer(app, scratch, buffer_id); + system_release_global_frame_mutex(tctx); + } Lex_State_Cpp state = {}; lex_full_input_cpp_init(&state, contents); @@ -555,7 +559,7 @@ do_full_lex_async__inner(Async_Context *actx, Buffer_ID buffer_id){ Token_List list = {}; b32 canceled = false; for (;;){ - ProfileScope(app, "async lex block"); + ProfileBlock(app, "async lex block"); if (lex_full_input_cpp_breaks(scratch, &list, &state, 10000)){ break; } @@ -566,6 +570,7 @@ do_full_lex_async__inner(Async_Context *actx, Buffer_ID buffer_id){ } if (!canceled){ + ProfileBlock(app, "async lex save results"); system_acquire_global_frame_mutex(tctx); Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); Base_Allocator *allocator = managed_scope_allocator(app, scope); From 17bc2de308bd9f014d0708c1e9f25721c8614141 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Tue, 22 Oct 2019 00:15:49 -0700 Subject: [PATCH 7/8] Mostly good async lexing works now --- 4ed.cpp | 1 + custom/4coder_async_tasks.cpp | 24 ---- custom/4coder_auto_indent.cpp | 1 + custom/4coder_base_commands.cpp | 1 + custom/4coder_default_hooks.cpp | 174 ++++++++++++++-------------- custom/4coder_draw.cpp | 25 ++-- custom/4coder_eol.cpp | 2 + custom/4coder_jump_sticky.cpp | 6 +- custom/4coder_profile_inspect.cpp | 65 ++++++++--- custom/4coder_profile_inspect.h | 1 + custom/4coder_project_commands.cpp | 3 + custom/generated/command_metadata.h | 84 +++++++------- 12 files changed, 200 insertions(+), 187 deletions(-) diff --git a/4ed.cpp b/4ed.cpp index 096c7f01..0d25b42f 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -7,6 +7,7 @@ * */ + // TOP internal void diff --git a/custom/4coder_async_tasks.cpp b/custom/4coder_async_tasks.cpp index aa38dd2d..e57d1ae7 100644 --- a/custom/4coder_async_tasks.cpp +++ b/custom/4coder_async_tasks.cpp @@ -201,30 +201,6 @@ async_task_cancel(Async_System *async_system, Async_Task task){ system_mutex_release(async_system->mutex); } -function void -async_task_join(Async_System *async_system, Async_Task task){ - system_mutex_acquire(async_system->mutex); - Async_Node *node = async_get_pending_node(async_system, task); - b32 wait_for_join = false; - if (node != 0){ - dll_remove(&node->node); - dll_insert(&async_system->task_sent, &node->node); - node->thread->join_signal = true; - wait_for_join = true; - } - else{ - node = async_get_running_node(async_system, task); - if (node != 0){ - node->thread->join_signal = true; - wait_for_join = true; - } - } - if (wait_for_join){ - system_condition_variable_wait(async_system->join_cv, async_system->mutex); - } - system_mutex_release(async_system->mutex); -} - function b32 async_check_canceled(Async_Context *actx){ b32 *cancel_signal = &actx->thread->cancel_signal; diff --git a/custom/4coder_auto_indent.cpp b/custom/4coder_auto_indent.cpp index 009efdb3..cd142415 100644 --- a/custom/4coder_auto_indent.cpp +++ b/custom/4coder_auto_indent.cpp @@ -300,6 +300,7 @@ get_indentation_array(Application_Links *app, Arena *arena, Buffer_ID buffer, Ra internal b32 auto_indent_buffer(Application_Links *app, Buffer_ID buffer, Range_i64 pos, Indent_Flag flags, i32 tab_width, i32 indent_width){ + ProfileScope(app, "auto indent buffer"); Managed_Scope scope = buffer_get_managed_scope(app, buffer); Token_Array *tokens = scope_attachment(app, scope, attachment_tokens, Token_Array); diff --git a/custom/4coder_base_commands.cpp b/custom/4coder_base_commands.cpp index d4064652..23d3e0eb 100644 --- a/custom/4coder_base_commands.cpp +++ b/custom/4coder_base_commands.cpp @@ -1203,6 +1203,7 @@ CUSTOM_DOC("Queries the user for a string, and incrementally replace every occur function void save_all_dirty_buffers_with_postfix(Application_Links *app, String_Const_u8 postfix){ + ProfileScope(app, "save all dirty buffers"); Scratch_Block scratch(app); for (Buffer_ID buffer = get_buffer_next(app, 0, Access_ReadWriteVisible); buffer != 0; diff --git a/custom/4coder_default_hooks.cpp b/custom/4coder_default_hooks.cpp index 204997a7..0633b436 100644 --- a/custom/4coder_default_hooks.cpp +++ b/custom/4coder_default_hooks.cpp @@ -140,7 +140,7 @@ CUSTOM_DOC("Input consumption loop for default view behavior") } next_call = scope_attachment(app, scope, view_call_next, Custom_Command_Function*); - if (*next_call != 0){ + if (next_call != 0 && *next_call != 0){ binding.custom = *next_call; goto call_again; } @@ -547,8 +547,9 @@ do_full_lex_async__inner(Async_Context *actx, Buffer_ID buffer_id){ String_Const_u8 contents = {}; { - ProfileBlock(app, "async lex contents"); + ProfileBlock(app, "async lex contents (before mutex)"); system_acquire_global_frame_mutex(tctx); + ProfileBlock(app, "async lex contents (after mutex)"); contents = push_whole_buffer(app, scratch, buffer_id); system_release_global_frame_mutex(tctx); } @@ -570,18 +571,22 @@ do_full_lex_async__inner(Async_Context *actx, Buffer_ID buffer_id){ } if (!canceled){ - ProfileBlock(app, "async lex save results"); + ProfileBlock(app, "async lex save results (before mutex)"); system_acquire_global_frame_mutex(tctx); + ProfileBlock(app, "async lex save results (after mutex)"); Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); - Base_Allocator *allocator = managed_scope_allocator(app, scope); - Token_Array tokens = {}; - tokens.tokens = base_array(allocator, Token, list.total_count); - tokens.count = list.total_count; - tokens.max = list.total_count; - token_fill_memory_from_list(tokens.tokens, &list); - - Token_Array *tokens_ptr = scope_attachment(app, scope, attachment_tokens, Token_Array); - block_copy_struct(tokens_ptr, &tokens); + if (scope != 0){ + Base_Allocator *allocator = managed_scope_allocator(app, scope); + Token_Array *tokens_ptr = scope_attachment(app, scope, attachment_tokens, Token_Array); + base_free(allocator, tokens_ptr->tokens); + + Token_Array tokens = {}; + tokens.tokens = base_array(allocator, Token, list.total_count); + tokens.count = list.total_count; + tokens.max = list.total_count; + token_fill_memory_from_list(tokens.tokens, &list); + block_copy_struct(tokens_ptr, &tokens); + } system_release_global_frame_mutex(tctx); } } @@ -595,6 +600,8 @@ do_full_lex_async(Async_Context *actx, Data data){ } BUFFER_HOOK_SIG(default_begin_buffer){ + ProfileScope(app, "begin buffer"); + b32 treat_as_code = false; b32 lex_without_strings = false; (void)(lex_without_strings); @@ -711,9 +718,9 @@ BUFFER_HOOK_SIG(default_begin_buffer){ } if (use_lexer){ - Async_Task lex_task = async_task_no_dep(&global_async_system, do_full_lex_async, make_data_struct(&buffer_id)); + ProfileBlock(app, "begin buffer kick off lexer"); Async_Task *lex_task_ptr = scope_attachment(app, scope, buffer_lex_task, Async_Task); - *lex_task_ptr = lex_task; + *lex_task_ptr = async_task_no_dep(&global_async_system, do_full_lex_async, make_data_struct(&buffer_id)); } // no meaning for return @@ -728,6 +735,7 @@ BUFFER_HOOK_SIG(default_new_file){ BUFFER_HOOK_SIG(default_file_save){ // buffer_id + ProfileScope(app, "default file save"); b32 is_virtual = false; if (global_config.automatically_indent_text_on_save && is_virtual){ auto_indent_buffer(app, buffer_id, buffer_range(app, buffer_id)); @@ -753,7 +761,6 @@ BUFFER_HOOK_SIG(default_file_save){ BUFFER_EDIT_RANGE_SIG(default_buffer_edit_range){ // buffer_id, range, text - ProfileScope(app, "default edit range"); Interval_i64 replace_range = Ii64(range.first, range.first + text.size); @@ -763,92 +770,81 @@ BUFFER_EDIT_RANGE_SIG(default_buffer_edit_range){ Scratch_Block scratch(app); Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); - Token_Array *ptr = scope_attachment(app, scope, attachment_tokens, Token_Array); - if (ptr != 0 && ptr->tokens != 0){ - i64 token_index_first = token_relex_first(ptr, range.first, 1); - i64 token_index_resync_guess = token_relex_resync(ptr, range.one_past_last, 16); - - Token *token_first = ptr->tokens + token_index_first; - Token *token_resync = ptr->tokens + token_index_resync_guess; - - Interval_i64 relex_range = Ii64(token_first->pos, - token_resync->pos + token_resync->size + text_shift); - String_Const_u8 partial_text = push_buffer_range(app, scratch, buffer_id, relex_range); - - Token_List relex_list = lex_full_input_cpp(scratch, partial_text); - if (relex_range.one_past_last < buffer_get_size(app, buffer_id)){ - token_drop_eof(&relex_list); - } - - Token_Relex relex = token_relex(relex_list, relex_range.first - text_shift, - ptr->tokens, token_index_first, token_index_resync_guess); - - Base_Allocator *allocator = managed_scope_allocator(app, scope); - - if (relex.successful_resync){ - i64 token_index_resync = relex.first_resync_index; + Async_Task *lex_task_ptr = scope_attachment(app, scope, buffer_lex_task, Async_Task); + if (async_task_is_running_or_pending(&global_async_system, *lex_task_ptr)){ + async_task_cancel(&global_async_system, *lex_task_ptr); + *lex_task_ptr = async_task_no_dep(&global_async_system, do_full_lex_async, make_data_struct(&buffer_id)); + } + else{ + Token_Array *ptr = scope_attachment(app, scope, attachment_tokens, Token_Array); + if (ptr != 0 && ptr->tokens != 0){ + i64 token_index_first = token_relex_first(ptr, range.first, 1); + i64 token_index_resync_guess = token_relex_resync(ptr, range.one_past_last, 16); - Interval_i64 head = Ii64(0, token_index_first); - Interval_i64 replaced = Ii64(token_index_first, token_index_resync); - Interval_i64 tail = Ii64(token_index_resync, ptr->count); - i64 resynced_count = (token_index_resync_guess + 1) - token_index_resync; - i64 relexed_count = relex_list.total_count - resynced_count; - i64 tail_shift = relexed_count - (token_index_resync - token_index_first); + Token *token_first = ptr->tokens + token_index_first; + Token *token_resync = ptr->tokens + token_index_resync_guess; - i64 new_tokens_count = ptr->count + tail_shift; - Token *new_tokens = base_array(allocator, Token, new_tokens_count); + Interval_i64 relex_range = Ii64(token_first->pos, + token_resync->pos + token_resync->size + text_shift); + String_Const_u8 partial_text = push_buffer_range(app, scratch, buffer_id, relex_range); - Token *old_tokens = ptr->tokens; - block_copy_array_shift(new_tokens, old_tokens, head, 0); - token_fill_memory_from_list(new_tokens + replaced.first, &relex_list, relexed_count); - for (i64 i = 0, index = replaced.first; i < relexed_count; i += 1, index += 1){ - new_tokens[index].pos += relex_range.first; + Token_List relex_list = lex_full_input_cpp(scratch, partial_text); + if (relex_range.one_past_last < buffer_get_size(app, buffer_id)){ + token_drop_eof(&relex_list); } - for (i64 i = tail.first; i < tail.one_past_last; i += 1){ - old_tokens[i].pos += text_shift; + + Token_Relex relex = token_relex(relex_list, relex_range.first - text_shift, + ptr->tokens, token_index_first, token_index_resync_guess); + + Base_Allocator *allocator = managed_scope_allocator(app, scope); + + if (relex.successful_resync){ + i64 token_index_resync = relex.first_resync_index; + + Interval_i64 head = Ii64(0, token_index_first); + Interval_i64 replaced = Ii64(token_index_first, token_index_resync); + Interval_i64 tail = Ii64(token_index_resync, ptr->count); + i64 resynced_count = (token_index_resync_guess + 1) - token_index_resync; + i64 relexed_count = relex_list.total_count - resynced_count; + i64 tail_shift = relexed_count - (token_index_resync - token_index_first); + + i64 new_tokens_count = ptr->count + tail_shift; + Token *new_tokens = base_array(allocator, Token, new_tokens_count); + + Token *old_tokens = ptr->tokens; + block_copy_array_shift(new_tokens, old_tokens, head, 0); + token_fill_memory_from_list(new_tokens + replaced.first, &relex_list, relexed_count); + for (i64 i = 0, index = replaced.first; i < relexed_count; i += 1, index += 1){ + new_tokens[index].pos += relex_range.first; + } + for (i64 i = tail.first; i < tail.one_past_last; i += 1){ + old_tokens[i].pos += text_shift; + } + block_copy_array_shift(new_tokens, ptr->tokens, tail, tail_shift); + + base_free(allocator, ptr->tokens); + + ptr->tokens = new_tokens; + ptr->count = new_tokens_count; + ptr->max = new_tokens_count; } - block_copy_array_shift(new_tokens, ptr->tokens, tail, tail_shift); - - base_free(allocator, ptr->tokens); - - ptr->tokens = new_tokens; - ptr->count = new_tokens_count; - ptr->max = new_tokens_count; - } - else{ - scratch.restore(); - base_free(allocator, ptr->tokens); - Async_Task lex_task = async_task_no_dep(&global_async_system, do_full_lex_async, make_data_struct(&buffer_id)); - Async_Task *lex_task_ptr = scope_attachment(app, scope, buffer_lex_task, Async_Task); - *lex_task_ptr = lex_task; - } - -#if 0 - // NOTE(allen): Assert correctness of relex results. Enable this code - // to track down corruption of the token data. - { - String_Const_u8 full = push_whole_buffer(app, scratch, buffer_id); - Token_List list = lex_full_input_cpp(scratch, full); - Token_Array array = token_array_from_list(scratch, &list); - Assert(array.count == ptr->count); - Token *token_a = array.tokens; - Token *token_b = ptr->tokens; - for (i64 i = 0; i < array.count; i += 1, token_a += 1, token_b += 1){ - Assert(block_match_struct(token_a, token_b)); + else{ + *lex_task_ptr = async_task_no_dep(&global_async_system, do_full_lex_async, + make_data_struct(&buffer_id)); } } -#endif } // no meaning for return return(0); } -BUFFER_HOOK_SIG(default_end_file){ - Scratch_Block scratch(app); - String_Const_u8 buffer_name = push_buffer_unique_name(app, scratch, buffer_id); - String_Const_u8 str = push_u8_stringf(scratch, "Ending file: %s\n", buffer_name.str); - print_message(app, str); +BUFFER_HOOK_SIG(default_end_buffer){ + Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); + Async_Task *lex_task_ptr = scope_attachment(app, scope, buffer_lex_task, Async_Task); + if (lex_task_ptr != 0){ + async_task_cancel(&global_async_system, *lex_task_ptr); + } // no meaning for return return(0); } @@ -871,7 +867,7 @@ set_all_default_hooks(Application_Links *app){ set_custom_hook(app, HookID_BufferNameResolver, default_buffer_name_resolution); set_custom_hook(app, HookID_BeginBuffer, default_begin_buffer); - set_custom_hook(app, HookID_EndBuffer, end_file_close_jump_list); + set_custom_hook(app, HookID_EndBuffer, end_buffer_close_jump_list); set_custom_hook(app, HookID_NewFile, default_new_file); set_custom_hook(app, HookID_SaveFile, default_file_save); set_custom_hook(app, HookID_BufferEditRange, default_buffer_edit_range); diff --git a/custom/4coder_draw.cpp b/custom/4coder_draw.cpp index 07bc196f..c699be5b 100644 --- a/custom/4coder_draw.cpp +++ b/custom/4coder_draw.cpp @@ -648,21 +648,20 @@ draw_notepad_style_cursor_highlight(Application_Links *app, View_ID view_id, function Rect_f32 get_tool_tip_box(Rect_f32 container, Vec2_f32 p, Vec2_f32 box_dims){ - Rect_f32 box = {}; Vec2_f32 container_dims = rect_dim(container); - if (box_dims.x <= container_dims.x && - box_dims.y <= container_dims.y){ - p.x -= 6.f; - p.y += 22.f; - if (p.x + box_dims.x > container.x1){ - p.x = container.x1 - box_dims.x; - } - if (p.y + box_dims.y > container.y1){ - p.y = container.y1 - box_dims.y; - } - box = Rf32_xy_wh(p, box_dims); + box_dims.x = clamp_top(box_dims.x, container_dims.x); + box_dims.y = clamp_top(box_dims.y, container_dims.y); + Vec2_f32 q = p + V2f32(-20.f, 22.f); + if (q.x + box_dims.x > container.x1){ + q.x = container.x1 - box_dims.x; } - return(box); + if (q.y + box_dims.y > container.y1){ + q.y = p.y - box_dims.y - 2.f; + if (q.y < container.y0){ + q.y = (container.y0 + container.y1 - box_dims.y)*0.5f; + } + } + return(Rf32_xy_wh(q, box_dims)); } // BOTTOM diff --git a/custom/4coder_eol.cpp b/custom/4coder_eol.cpp index 1465d401..2f278bae 100644 --- a/custom/4coder_eol.cpp +++ b/custom/4coder_eol.cpp @@ -7,6 +7,7 @@ function void rewrite_lines_to_crlf(Application_Links *app, Buffer_ID buffer){ + ProfileScope(app, "rewrite lines to crlf"); Scratch_Block scratch(app); i64 size = buffer_get_size(app, buffer); @@ -51,6 +52,7 @@ rewrite_lines_to_crlf(Application_Links *app, Buffer_ID buffer){ function void rewrite_lines_to_lf(Application_Links *app, Buffer_ID buffer){ + ProfileScope(app, "rewrite lines to lf"); Scratch_Block scratch(app); Batch_Edit *first = 0; diff --git a/custom/4coder_jump_sticky.cpp b/custom/4coder_jump_sticky.cpp index 135b3f10..d928fa58 100644 --- a/custom/4coder_jump_sticky.cpp +++ b/custom/4coder_jump_sticky.cpp @@ -597,13 +597,13 @@ CUSTOM_DOC("If the buffer in the active view is writable, inserts a character, o // End File Hook // -BUFFER_HOOK_SIG(default_end_file); -BUFFER_HOOK_SIG(end_file_close_jump_list){ +BUFFER_HOOK_SIG(default_end_buffer); +BUFFER_HOOK_SIG(end_buffer_close_jump_list){ Marker_List *list = get_marker_list_for_buffer(buffer_id); if (list != 0){ delete_marker_list(list); } - default_end_file(app, buffer_id); + default_end_buffer(app, buffer_id); return(0); } diff --git a/custom/4coder_profile_inspect.cpp b/custom/4coder_profile_inspect.cpp index e64636ee..0db0330a 100644 --- a/custom/4coder_profile_inspect.cpp +++ b/custom/4coder_profile_inspect.cpp @@ -225,6 +225,7 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){ f32 x_half_padding = x_padding*0.5f; inspect->tab_id_hovered = ProfileInspectTab_None; + block_zero_struct(&inspect->full_name_hovered); block_zero_struct(&inspect->location_jump_hovered); // NOTE(allen): tabs @@ -273,12 +274,14 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){ node = node->next){ Range_f32 y = If32_size(y_pos, block_height); - i32 name_width = 30; + b32 name_too_long = false; + i32 name_width = 45; Fancy_String_List list = {}; if (node->name.size > name_width){ push_fancy_stringf(scratch, &list, fancy_id(Stag_Pop1), "%.*s... ", name_width - 3, node->name.str); + name_too_long = true; } else{ push_fancy_stringf(scratch, &list, fancy_id(Stag_Pop1), @@ -293,7 +296,7 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){ } else{ push_fancy_stringf(scratch, &list, fancy_id(Stag_Pop2), - "%11.8fs ", + "%11.9fs ", ((f32)node->total_time)/1000000.f); } @@ -307,6 +310,9 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){ Rect_f32 box = Rf32(x, y); int_color margin = Stag_Margin; if (rect_contains_point(box, m_p)){ + if (name_too_long){ + inspect->full_name_hovered = node->name; + } inspect->location_jump_hovered = node->location; margin = Stag_Margin_Hover; } @@ -347,24 +353,51 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){ }break; } - if (inspect->tab_id_hovered != ProfileInspectTab_None){ + if (!rect_contains_point(region, m_p)){ + // NOTE(allen): don't draw tool tip when the mouse doesn't hover in our view + } + else if (inspect->tab_id_hovered != ProfileInspectTab_None){ // NOTE(allen): no tool tip for tabs } - else if (inspect->location_jump_hovered.size > 0){ - draw_set_clip(app, region); + else{ + i32 line_count = 0; + Fancy_String_List list[2] = {}; + Fancy_Color color = fancy_rgba(1.f, 1.f, 1.f, 0.5f); - Fancy_String_List list = {}; - push_fancy_stringf(scratch, &list, fancy_rgba(1.f, 1.f, 1.f, 0.5f), - "jump to: '%.*s'", - string_expand(inspect->location_jump_hovered)); - f32 width = get_fancy_string_advance(app, face_id, list.first); - Vec2_f32 dims = V2f32(width + x_padding, line_height + 2.f); - Rect_f32 box = get_tool_tip_box(region, m_p, dims); - if (rect_area(box) > 0.f){ + f32 width = 0.f; + if (inspect->full_name_hovered.size > 0){ + line_count += 1; + push_fancy_stringf(scratch, &list[0], color, "%.*s", + string_expand(inspect->full_name_hovered)); + f32 l_width = get_fancy_string_advance(app, face_id, list[0].first); + width = max(width, l_width); + } + if (inspect->location_jump_hovered.size > 0){ + line_count += 1; + push_fancy_stringf(scratch, &list[1], color, "jump to: '%.*s'", + string_expand(inspect->location_jump_hovered)); + f32 l_width = get_fancy_string_advance(app, face_id, list[1].first); + width = max(width, l_width); + } + + if (line_count > 0){ + Vec2_f32 dims = V2f32(width + x_padding, line_count*line_height + 2.f); + Rect_f32 box = get_tool_tip_box(region, m_p, dims); + draw_set_clip(app, box); + draw_rectangle(app, box, 6.f, 0x80000000); - draw_fancy_string(app, face_id, list.first, - V2f32(box.x0 + x_half_padding, box.y0 + 1.f), - 0, 0); + f32 y = box.y0 + 1.f; + if (inspect->full_name_hovered.size > 0){ + draw_fancy_string(app, face_id, list[0].first, + V2f32(box.x0 + x_half_padding, y), + 0, 0); + y += line_height; + } + if (inspect->location_jump_hovered.size > 0){ + draw_fancy_string(app, face_id, list[1].first, + V2f32(box.x0 + x_half_padding, y), + 0, 0); + } } } } diff --git a/custom/4coder_profile_inspect.h b/custom/4coder_profile_inspect.h index 62d394dc..c9e26826 100644 --- a/custom/4coder_profile_inspect.h +++ b/custom/4coder_profile_inspect.h @@ -62,6 +62,7 @@ struct Profile_Inspection{ Profile_Inspection_Tab tab_id; Profile_Inspection_Tab tab_id_hovered; + String_Const_u8 full_name_hovered; String_Const_u8 location_jump_hovered; }; diff --git a/custom/4coder_project_commands.cpp b/custom/4coder_project_commands.cpp index 7efc0540..f703183c 100644 --- a/custom/4coder_project_commands.cpp +++ b/custom/4coder_project_commands.cpp @@ -138,6 +138,7 @@ open_all_files_in_directory_pattern_match(Application_Links *app, Project_File_Pattern_Array whitelist, Project_File_Pattern_Array blacklist, u32 flags){ + ProfileScope(app, "open all files in directory pattern"); Scratch_Block scratch(app); String_Const_u8 directory = dir; if (!character_is_slash(string_get_character(directory, directory.size - 1))){ @@ -937,6 +938,7 @@ CUSTOM_DOC("Works as open_all_code but also runs in all subdirectories.") CUSTOM_COMMAND_SIG(load_project) CUSTOM_DOC("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.") { + ProfileScope(app, "load project"); save_all_dirty_buffers(app); set_current_project_from_nearest_project_file(app); } @@ -944,6 +946,7 @@ CUSTOM_DOC("Looks for a project.4coder file in the current directory and tries t CUSTOM_COMMAND_SIG(project_fkey_command) CUSTOM_DOC("Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.") { + ProfileScope(app, "project fkey command"); User_Input input = get_current_input(app); b32 got_ind = false; i32 ind = 0; diff --git a/custom/generated/command_metadata.h b/custom/generated/command_metadata.h index 3772485e..e8ab5a66 100644 --- a/custom/generated/command_metadata.h +++ b/custom/generated/command_metadata.h @@ -330,42 +330,42 @@ static Command_Metadata fcoder_metacmd_table[211] = { { PROC_LINKS(query_replace, 0), false, "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1150 }, { PROC_LINKS(query_replace_identifier, 0), false, "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1171 }, { PROC_LINKS(query_replace_selection, 0), false, "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1187 }, -{ PROC_LINKS(save_all_dirty_buffers, 0), false, "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1222 }, -{ PROC_LINKS(delete_file_query, 0), false, "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1247 }, -{ PROC_LINKS(save_to_query, 0), false, "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1291 }, -{ PROC_LINKS(rename_file_query, 0), false, "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\\custom\\4coder_base_commands.cpp", 43, 1324 }, -{ PROC_LINKS(make_directory_query, 0), false, "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1362 }, -{ PROC_LINKS(move_line_up, 0), false, "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1396 }, -{ PROC_LINKS(move_line_down, 0), false, "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1402 }, -{ PROC_LINKS(duplicate_line, 0), false, "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1408 }, -{ PROC_LINKS(delete_line, 0), false, "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1422 }, -{ PROC_LINKS(open_file_in_quotes, 0), false, "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1487 }, -{ PROC_LINKS(open_matching_file_cpp, 0), false, "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1519 }, -{ PROC_LINKS(view_buffer_other_panel, 0), false, "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1532 }, -{ PROC_LINKS(swap_buffers_between_panels, 0), false, "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1544 }, -{ PROC_LINKS(kill_buffer, 0), false, "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1578 }, -{ PROC_LINKS(save, 0), false, "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1586 }, -{ PROC_LINKS(reopen, 0), false, "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1596 }, -{ PROC_LINKS(undo, 0), false, "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1825 }, -{ PROC_LINKS(redo, 0), false, "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1838 }, -{ PROC_LINKS(undo_all_buffers, 0), false, "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1852 }, -{ PROC_LINKS(redo_all_buffers, 0), false, "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1923 }, -{ PROC_LINKS(open_in_other, 0), false, "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2024 }, -{ PROC_LINKS(default_file_externally_modified, 0), false, "default_file_externally_modified", 32, "Notes the external modification of attached files by printing a message.", 72, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2031 }, -{ PROC_LINKS(set_eol_mode_to_crlf, 0), false, "set_eol_mode_to_crlf", 20, "Puts the buffer in crlf line ending mode.", 41, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 80 }, -{ PROC_LINKS(set_eol_mode_to_lf, 0), false, "set_eol_mode_to_lf", 18, "Puts the buffer in lf line ending mode.", 39, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 91 }, -{ PROC_LINKS(set_eol_mode_to_binary, 0), false, "set_eol_mode_to_binary", 22, "Puts the buffer in bin line ending mode.", 40, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 102 }, -{ PROC_LINKS(set_eol_mode_from_contents, 0), false, "set_eol_mode_from_contents", 26, "Sets the buffer's line ending mode to match the contents of the buffer.", 71, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 113 }, +{ PROC_LINKS(save_all_dirty_buffers, 0), false, "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1223 }, +{ PROC_LINKS(delete_file_query, 0), false, "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1248 }, +{ PROC_LINKS(save_to_query, 0), false, "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1292 }, +{ PROC_LINKS(rename_file_query, 0), false, "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\\custom\\4coder_base_commands.cpp", 43, 1325 }, +{ PROC_LINKS(make_directory_query, 0), false, "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1363 }, +{ PROC_LINKS(move_line_up, 0), false, "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1397 }, +{ PROC_LINKS(move_line_down, 0), false, "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1403 }, +{ PROC_LINKS(duplicate_line, 0), false, "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1409 }, +{ PROC_LINKS(delete_line, 0), false, "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1423 }, +{ PROC_LINKS(open_file_in_quotes, 0), false, "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1488 }, +{ PROC_LINKS(open_matching_file_cpp, 0), false, "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1520 }, +{ PROC_LINKS(view_buffer_other_panel, 0), false, "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1533 }, +{ PROC_LINKS(swap_buffers_between_panels, 0), false, "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1545 }, +{ PROC_LINKS(kill_buffer, 0), false, "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1579 }, +{ PROC_LINKS(save, 0), false, "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1587 }, +{ PROC_LINKS(reopen, 0), false, "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1597 }, +{ PROC_LINKS(undo, 0), false, "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1826 }, +{ PROC_LINKS(redo, 0), false, "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1839 }, +{ PROC_LINKS(undo_all_buffers, 0), false, "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1853 }, +{ PROC_LINKS(redo_all_buffers, 0), false, "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1924 }, +{ PROC_LINKS(open_in_other, 0), false, "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2025 }, +{ PROC_LINKS(default_file_externally_modified, 0), false, "default_file_externally_modified", 32, "Notes the external modification of attached files by printing a message.", 72, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2032 }, +{ PROC_LINKS(set_eol_mode_to_crlf, 0), false, "set_eol_mode_to_crlf", 20, "Puts the buffer in crlf line ending mode.", 41, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 82 }, +{ PROC_LINKS(set_eol_mode_to_lf, 0), false, "set_eol_mode_to_lf", 18, "Puts the buffer in lf line ending mode.", 39, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 93 }, +{ PROC_LINKS(set_eol_mode_to_binary, 0), false, "set_eol_mode_to_binary", 22, "Puts the buffer in bin line ending mode.", 40, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 104 }, +{ PROC_LINKS(set_eol_mode_from_contents, 0), false, "set_eol_mode_from_contents", 26, "Sets the buffer's line ending mode to match the contents of the buffer.", 71, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 115 }, { PROC_LINKS(interactive_switch_buffer, 0), true, "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 477 }, { PROC_LINKS(interactive_kill_buffer, 0), true, "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 496 }, { PROC_LINKS(interactive_open_or_new, 0), true, "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 567 }, { PROC_LINKS(interactive_new, 0), true, "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 606 }, { PROC_LINKS(interactive_open, 0), true, "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 639 }, { PROC_LINKS(command_lister, 0), true, "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 702 }, -{ PROC_LINKS(auto_indent_whole_file, 0), false, "auto_indent_whole_file", 22, "Audo-indents the entire current buffer.", 39, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 356 }, -{ PROC_LINKS(auto_indent_line_at_cursor, 0), false, "auto_indent_line_at_cursor", 26, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 365 }, -{ PROC_LINKS(auto_indent_range, 0), false, "auto_indent_range", 17, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 375 }, -{ PROC_LINKS(write_text_and_auto_indent, 0), false, "write_text_and_auto_indent", 26, "Inserts text and auto-indents the line on which the cursor sits if any of the text contains 'layout punctuation' such as ;:{}()[]# and new lines.", 145, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 385 }, +{ PROC_LINKS(auto_indent_whole_file, 0), false, "auto_indent_whole_file", 22, "Audo-indents the entire current buffer.", 39, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 357 }, +{ PROC_LINKS(auto_indent_line_at_cursor, 0), false, "auto_indent_line_at_cursor", 26, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 366 }, +{ PROC_LINKS(auto_indent_range, 0), false, "auto_indent_range", 17, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 376 }, +{ PROC_LINKS(write_text_and_auto_indent, 0), false, "write_text_and_auto_indent", 26, "Inserts text and auto-indents the line on which the cursor sits if any of the text contains 'layout punctuation' such as ;:{}()[]# and new lines.", 145, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 386 }, { PROC_LINKS(list_all_locations, 0), false, "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 166 }, { PROC_LINKS(list_all_substring_locations, 0), false, "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 172 }, { PROC_LINKS(list_all_locations_case_insensitive, 0), false, "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 178 }, @@ -401,17 +401,17 @@ static Command_Metadata fcoder_metacmd_table[211] = { { PROC_LINKS(build_in_build_panel, 0), false, "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 163 }, { PROC_LINKS(close_build_panel, 0), false, "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 178 }, { PROC_LINKS(change_to_build_panel, 0), false, "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 184 }, -{ PROC_LINKS(close_all_code, 0), false, "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 917 }, -{ PROC_LINKS(open_all_code, 0), false, "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 923 }, -{ PROC_LINKS(open_all_code_recursive, 0), false, "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 929 }, -{ PROC_LINKS(load_project, 0), false, "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\\custom\\4coder_project_commands.cpp", 46, 937 }, -{ PROC_LINKS(project_fkey_command, 0), false, "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 944 }, -{ PROC_LINKS(project_go_to_root_directory, 0), false, "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 969 }, -{ PROC_LINKS(setup_new_project, 0), false, "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1303 }, -{ PROC_LINKS(setup_build_bat, 0), false, "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1310 }, -{ PROC_LINKS(setup_build_sh, 0), false, "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1316 }, -{ PROC_LINKS(setup_build_bat_and_sh, 0), false, "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1322 }, -{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1338 }, +{ PROC_LINKS(close_all_code, 0), false, "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 918 }, +{ PROC_LINKS(open_all_code, 0), false, "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 924 }, +{ PROC_LINKS(open_all_code_recursive, 0), false, "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 930 }, +{ PROC_LINKS(load_project, 0), false, "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\\custom\\4coder_project_commands.cpp", 46, 938 }, +{ PROC_LINKS(project_fkey_command, 0), false, "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 946 }, +{ PROC_LINKS(project_go_to_root_directory, 0), false, "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 972 }, +{ PROC_LINKS(setup_new_project, 0), false, "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1306 }, +{ PROC_LINKS(setup_build_bat, 0), false, "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1313 }, +{ PROC_LINKS(setup_build_sh, 0), false, "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1319 }, +{ PROC_LINKS(setup_build_bat_and_sh, 0), false, "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1325 }, +{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1341 }, { PROC_LINKS(list_all_functions_current_buffer, 0), false, "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "w:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 267 }, { PROC_LINKS(list_all_functions_current_buffer_lister, 0), false, "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "w:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 277 }, { PROC_LINKS(list_all_functions_all_buffers, 0), false, "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\\custom\\4coder_function_list.cpp", 43, 289 }, @@ -441,7 +441,7 @@ static Command_Metadata fcoder_metacmd_table[211] = { { PROC_LINKS(miblo_decrement_time_stamp, 0), false, "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\\custom\\4coder_miblo_numbers.cpp", 43, 237 }, { PROC_LINKS(miblo_increment_time_stamp_minute, 0), false, "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\\custom\\4coder_miblo_numbers.cpp", 43, 243 }, { PROC_LINKS(miblo_decrement_time_stamp_minute, 0), false, "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\\custom\\4coder_miblo_numbers.cpp", 43, 249 }, -{ PROC_LINKS(profile_inspect, 0), true, "profile_inspect", 15, "Inspect all currently collected profiling information in 4coder's self profiler.", 80, "w:\\4ed\\code\\custom\\4coder_profile_inspect.cpp", 45, 375 }, +{ PROC_LINKS(profile_inspect, 0), true, "profile_inspect", 15, "Inspect all currently collected profiling information in 4coder's self profiler.", 80, "w:\\4ed\\code\\custom\\4coder_profile_inspect.cpp", 45, 408 }, { PROC_LINKS(default_startup, 0), false, "default_startup", 15, "Default command for responding to a startup event", 49, "w:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 7 }, { PROC_LINKS(default_try_exit, 0), false, "default_try_exit", 16, "Default command for responding to a try-exit event", 50, "w:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 21 }, }; From 3aaa88c2cc0eb91dd77300a8c0899d3e1feae0ed Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Tue, 22 Oct 2019 00:20:43 -0700 Subject: [PATCH 8/8] Clear tokens when beginning a relex async task --- custom/4coder_default_hooks.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/custom/4coder_default_hooks.cpp b/custom/4coder_default_hooks.cpp index 0633b436..6ffc0576 100644 --- a/custom/4coder_default_hooks.cpp +++ b/custom/4coder_default_hooks.cpp @@ -793,11 +793,11 @@ BUFFER_EDIT_RANGE_SIG(default_buffer_edit_range){ token_drop_eof(&relex_list); } + Base_Allocator *allocator = managed_scope_allocator(app, scope); + Token_Relex relex = token_relex(relex_list, relex_range.first - text_shift, ptr->tokens, token_index_first, token_index_resync_guess); - Base_Allocator *allocator = managed_scope_allocator(app, scope); - if (relex.successful_resync){ i64 token_index_resync = relex.first_resync_index; @@ -829,6 +829,8 @@ BUFFER_EDIT_RANGE_SIG(default_buffer_edit_range){ ptr->max = new_tokens_count; } else{ + base_free(allocator, ptr->tokens); + block_zero_struct(ptr); *lex_task_ptr = async_task_no_dep(&global_async_system, do_full_lex_async, make_data_struct(&buffer_id)); }