From c9fe9175f660b94c511e2ac857c982f1c325dfea Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Wed, 4 Sep 2019 11:26:51 -0700 Subject: [PATCH] Lex Gen Main; C++ Lexer Model --- 4coder_API/4coder_types.h | 38 - 4coder_file.h | 6 +- 4coder_generated/app_functions.h | 1111 ++++++------------ 4coder_generated/command_metadata.h | 711 +----------- 4coder_malloc_allocator.cpp | 12 +- 4coder_metadata_generator.cpp | 432 +++---- 4coder_token.h | 54 + languages/4coder_language_cpp.cpp | 24 + languages/4coder_language_cpp.h | 168 +-- lexer_generator/4coder_lex_gen_main.cpp | 1103 ++++++++++++++++++ meta/4ed_build.cpp | 7 - meta/4ed_meta_parser.cpp | 1378 +---------------------- meta/4ed_metagen.cpp | 1111 ------------------ 13 files changed, 1815 insertions(+), 4340 deletions(-) create mode 100644 4coder_token.h create mode 100644 languages/4coder_language_cpp.cpp create mode 100644 lexer_generator/4coder_lex_gen_main.cpp delete mode 100644 meta/4ed_metagen.cpp diff --git a/4coder_API/4coder_types.h b/4coder_API/4coder_types.h index 01260347..2b969e35 100644 --- a/4coder_API/4coder_types.h +++ b/4coder_API/4coder_types.h @@ -664,43 +664,5 @@ STRUCT Process_State{ i64 return_code; }; -ENUM(i16, Token_Base_Kind){ - TokenBaseKind_EOF, - TokenBaseKind_Whitespace, - TokenBaseKind_LexError, - TokenBaseKind_Comment, - TokenBaseKind_Keyword, - TokenBaseKind_Identifier, - TokenBaseKind_Operator, - TokenBaseKind_LiteralInteger, - TokenBaseKind_LiteralFloat, - TokenBaseKind_LiteralString, - TokenBaseKind_ScopeOpen, - TokenBaseKind_ScopeClose, - TokenBaseKind_ParentheticalOpen, - TokenBaseKind_ParentheticalClose, - - TokenBaseKind_COUNT, -}; - -ENUM(u16, Token_Base_Flags){ - TokenBaseFlag_PreProcessorBody = 1, -}; - -STRUCT Token{ - i64 pos; - i64 size; - Token_Base_Kind kind; - Token_Base_Flags flags; - i16 sub_kind; - u16 sub_flags; -}; - -STRUCT Token_Array{ - Token *tokens; - i64 count; - i64 max; -}; - #endif diff --git a/4coder_file.h b/4coder_file.h index 09197291..6df08572 100644 --- a/4coder_file.h +++ b/4coder_file.h @@ -468,15 +468,15 @@ get_file_list(Partition *part, Filename_Character *pattern, File_Filter *filter) # error metdata generator not supported on this platform #endif -static String_Const_char +static String_Const_u8 file_dump(Arena *arena, char *name){ - String_Const_char text = {}; + String_Const_u8 text = {}; FILE *file = fopen(name, "rb"); if (file != 0){ fseek(file, 0, SEEK_END); text.size = ftell(file); fseek(file, 0, SEEK_SET); - text.str = push_array(arena, char, text.size + 1); + text.str = push_array(arena, u8, text.size + 1); if (text.str == 0){ fprintf(stdout, "fatal error: not enough memory in partition for file dumping"); exit(1); diff --git a/4coder_generated/app_functions.h b/4coder_generated/app_functions.h index 619c6b9c..940dfc43 100644 --- a/4coder_generated/app_functions.h +++ b/4coder_generated/app_functions.h @@ -364,747 +364,379 @@ typedef OPEN_COLOR_PICKER_SIG(Open_Color_Picker_Function); typedef ANIMATE_IN_N_MILLISECONDS_SIG(Animate_In_N_Milliseconds_Function); typedef BUFFER_FIND_ALL_MATCHES_SIG(Buffer_Find_All_Matches_Function); struct Application_Links{ -#if defined(ALLOW_DEP_4CODER) -Global_Set_Setting_Function *global_set_setting; -Global_Set_Mapping_Function *global_set_mapping; -Global_Get_Screen_Rectangle_Function *global_get_screen_rectangle; -Context_Get_Arena_Function *context_get_arena; -Context_Get_Base_Allocator_Function *context_get_base_allocator; -Create_Child_Process_Function *create_child_process; -Child_Process_Set_Target_Buffer_Function *child_process_set_target_buffer; -Buffer_Get_Attached_Child_Process_Function *buffer_get_attached_child_process; -Child_Process_Get_Attached_Buffer_Function *child_process_get_attached_buffer; -Child_Process_Get_State_Function *child_process_get_state; -Clipboard_Post_Function *clipboard_post; -Clipboard_Count_Function *clipboard_count; -Push_Clipboard_Index_Function *push_clipboard_index; -Get_Buffer_Count_Function *get_buffer_count; -Get_Buffer_Next_Function *get_buffer_next; -Get_Buffer_By_Name_Function *get_buffer_by_name; -Get_Buffer_By_File_Name_Function *get_buffer_by_file_name; -Buffer_Read_Range_Function *buffer_read_range; -Buffer_Replace_Range_Function *buffer_replace_range; -Buffer_Batch_Edit_Function *buffer_batch_edit; -Buffer_Seek_String_Function *buffer_seek_string; -Buffer_Seek_Character_Class_Function *buffer_seek_character_class; -Buffer_Line_Y_Difference_Function *buffer_line_y_difference; -Buffer_Line_Shift_Y_Function *buffer_line_shift_y; -Buffer_Pos_At_Relative_XY_Function *buffer_pos_at_relative_xy; -Buffer_Relative_XY_Of_Pos_Function *buffer_relative_xy_of_pos; -Buffer_Relative_Character_From_Pos_Function *buffer_relative_character_from_pos; -Buffer_Pos_From_Relative_Character_Function *buffer_pos_from_relative_character; -View_Line_Y_Difference_Function *view_line_y_difference; -View_Line_Shift_Y_Function *view_line_shift_y; -View_Pos_At_Relative_XY_Function *view_pos_at_relative_xy; -View_Relative_XY_Of_Pos_Function *view_relative_xy_of_pos; -View_Relative_Character_From_Pos_Function *view_relative_character_from_pos; -View_Pos_From_Relative_Character_Function *view_pos_from_relative_character; -Buffer_Exists_Function *buffer_exists; -Buffer_Ready_Function *buffer_ready; -Buffer_Get_Access_Flags_Function *buffer_get_access_flags; -Buffer_Get_Size_Function *buffer_get_size; -Buffer_Get_Line_Count_Function *buffer_get_line_count; -Push_Buffer_Base_Name_Function *push_buffer_base_name; -Push_Buffer_Unique_Name_Function *push_buffer_unique_name; -Push_Buffer_File_Name_Function *push_buffer_file_name; -Buffer_Get_Dirty_State_Function *buffer_get_dirty_state; -Buffer_Set_Dirty_State_Function *buffer_set_dirty_state; -Buffer_Get_Setting_Function *buffer_get_setting; -Buffer_Set_Setting_Function *buffer_set_setting; -Buffer_Get_Managed_Scope_Function *buffer_get_managed_scope; -Buffer_Send_End_Signal_Function *buffer_send_end_signal; -Create_Buffer_Function *create_buffer; -Buffer_Save_Function *buffer_save; -Buffer_Kill_Function *buffer_kill; -Buffer_Reopen_Function *buffer_reopen; -Buffer_Get_File_Attributes_Function *buffer_get_file_attributes; -Get_File_Attributes_Function *get_file_attributes; -Get_View_Next_Function *get_view_next; -Get_View_Prev_Function *get_view_prev; -Get_Active_View_Function *get_active_view; -Get_Active_Panel_Function *get_active_panel; -View_Exists_Function *view_exists; -View_Get_Buffer_Function *view_get_buffer; -View_Get_Cursor_Pos_Function *view_get_cursor_pos; -View_Get_Mark_Pos_Function *view_get_mark_pos; -View_Get_Preferred_X_Function *view_get_preferred_x; -View_Set_Preferred_X_Function *view_set_preferred_x; -View_Get_Screen_Rect_Function *view_get_screen_rect; -View_Get_Panel_Function *view_get_panel; -Panel_Get_View_Function *panel_get_view; -Panel_Is_Split_Function *panel_is_split; -Panel_Is_Leaf_Function *panel_is_leaf; -Panel_Split_Function *panel_split; -Panel_Set_Split_Function *panel_set_split; -Panel_Swap_Children_Function *panel_swap_children; -Panel_Get_Parent_Function *panel_get_parent; -Panel_Get_Child_Function *panel_get_child; -Panel_Get_Max_Function *panel_get_max; -Panel_Get_Margin_Function *panel_get_margin; -View_Close_Function *view_close; -View_Get_Buffer_Region_Function *view_get_buffer_region; -View_Get_Buffer_Scroll_Function *view_get_buffer_scroll; -View_Get_Basic_Scroll_Function *view_get_basic_scroll; -View_Set_Active_Function *view_set_active; -View_Get_Setting_Function *view_get_setting; -View_Set_Setting_Function *view_set_setting; -View_Get_Managed_Scope_Function *view_get_managed_scope; -Buffer_Compute_Cursor_Function *buffer_compute_cursor; -View_Compute_Cursor_Function *view_compute_cursor; -View_Set_Cursor_Function *view_set_cursor; -View_Set_Buffer_Scroll_Function *view_set_buffer_scroll; -View_Set_Basic_Scroll_Function *view_set_basic_scroll; -View_Set_Mark_Function *view_set_mark; -View_Set_Buffer_Function *view_set_buffer; -View_Post_Fade_Function *view_post_fade; -View_Begin_UI_Mode_Function *view_begin_ui_mode; -View_End_UI_Mode_Function *view_end_ui_mode; -View_Is_In_UI_Mode_Function *view_is_in_ui_mode; -View_Set_Quit_UI_Handler_Function *view_set_quit_ui_handler; -View_Get_Quit_UI_Handler_Function *view_get_quit_ui_handler; -Create_User_Managed_Scope_Function *create_user_managed_scope; -Destroy_User_Managed_Scope_Function *destroy_user_managed_scope; -Get_Global_Managed_Scope_Function *get_global_managed_scope; -Get_Managed_Scope_With_Multiple_Dependencies_Function *get_managed_scope_with_multiple_dependencies; -Managed_Scope_Clear_Contents_Function *managed_scope_clear_contents; -Managed_Scope_Clear_Self_All_Dependent_Scopes_Function *managed_scope_clear_self_all_dependent_scopes; -Managed_Scope_Allocator_Function *managed_scope_allocator; -Managed_Id_Declare_Function *managed_id_declare; -Managed_Scope_Get_Attachment_Function *managed_scope_get_attachment; -Managed_Scope_Attachment_Erase_Function *managed_scope_attachment_erase; -Alloc_Managed_Memory_In_Scope_Function *alloc_managed_memory_in_scope; -Alloc_Buffer_Markers_On_Buffer_Function *alloc_buffer_markers_on_buffer; -Managed_Object_Get_Item_Size_Function *managed_object_get_item_size; -Managed_Object_Get_Item_Count_Function *managed_object_get_item_count; -Managed_Object_Get_Pointer_Function *managed_object_get_pointer; -Managed_Object_Get_Type_Function *managed_object_get_type; -Managed_Object_Get_Containing_Scope_Function *managed_object_get_containing_scope; -Managed_Object_Free_Function *managed_object_free; -Managed_Object_Store_Data_Function *managed_object_store_data; -Managed_Object_Load_Data_Function *managed_object_load_data; -Get_User_Input_Function *get_user_input; -Get_Command_Input_Function *get_command_input; -Set_Command_Input_Function *set_command_input; -Get_Mouse_State_Function *get_mouse_state; -Get_Active_Query_Bars_Function *get_active_query_bars; -Start_Query_Bar_Function *start_query_bar; -End_Query_Bar_Function *end_query_bar; -Print_Message_Function *print_message; -Log_String_Function *log_string; -Thread_Get_ID_Function *thread_get_id; -Get_Largest_Face_ID_Function *get_largest_face_id; -Set_Global_Face_Function *set_global_face; -Buffer_History_Get_Max_Record_Index_Function *buffer_history_get_max_record_index; -Buffer_History_Get_Record_Info_Function *buffer_history_get_record_info; -Buffer_History_Get_Group_Sub_Record_Function *buffer_history_get_group_sub_record; -Buffer_History_Get_Current_State_Index_Function *buffer_history_get_current_state_index; -Buffer_History_Set_Current_State_Index_Function *buffer_history_set_current_state_index; -Buffer_History_Merge_Record_Range_Function *buffer_history_merge_record_range; -Buffer_History_Clear_After_Current_State_Function *buffer_history_clear_after_current_state; -Global_History_Edit_Group_Begin_Function *global_history_edit_group_begin; -Global_History_Edit_Group_End_Function *global_history_edit_group_end; -Buffer_Set_Face_Function *buffer_set_face; -Get_Face_Description_Function *get_face_description; -Get_Face_Metrics_Function *get_face_metrics; -Get_Face_ID_Function *get_face_id; -Try_Create_New_Face_Function *try_create_new_face; -Try_Modify_Face_Function *try_modify_face; -Try_Release_Face_Function *try_release_face; -Set_Theme_Colors_Function *set_theme_colors; -Get_Theme_Colors_Function *get_theme_colors; -Finalize_Color_Function *finalize_color; -Push_Hot_Directory_Function *push_hot_directory; -Set_Hot_Directory_Function *set_hot_directory; -Get_File_List_Function *get_file_list; -Set_GUI_Up_Down_Keys_Function *set_gui_up_down_keys; -Memory_Allocate_Function *memory_allocate; -Memory_Set_Protection_Function *memory_set_protection; -Memory_Free_Function *memory_free; -Push_4ed_Path_Function *push_4ed_path; -Show_Mouse_Cursor_Function *show_mouse_cursor; -Set_Edit_Finished_Hook_Repeat_Speed_Function *set_edit_finished_hook_repeat_speed; -Set_Fullscreen_Function *set_fullscreen; -Is_Fullscreen_Function *is_fullscreen; -Send_Exit_Signal_Function *send_exit_signal; -Set_Window_Title_Function *set_window_title; -Get_Microseconds_Timestamp_Function *get_microseconds_timestamp; -Draw_String_Function *draw_string; -Get_String_Advance_Function *get_string_advance; -Draw_Rectangle_Function *draw_rectangle; -Draw_Rectangle_Outline_Function *draw_rectangle_outline; -Draw_Clip_Push_Function *draw_clip_push; -Draw_Clip_Pop_Function *draw_clip_pop; -Draw_Coordinate_Center_Push_Function *draw_coordinate_center_push; -Draw_Coordinate_Center_Pop_Function *draw_coordinate_center_pop; -Text_Layout_Create_Function *text_layout_create; -Text_Layout_Get_Buffer_Function *text_layout_get_buffer; -Text_Layout_Get_Visible_Range_Function *text_layout_get_visible_range; -Text_Layout_Line_On_Screen_Function *text_layout_line_on_screen; -Text_Layout_Character_On_Screen_Function *text_layout_character_on_screen; -Paint_Text_Color_Function *paint_text_color; -Text_Layout_Free_Function *text_layout_free; -Draw_Text_Layout_Function *draw_text_layout; -Open_Color_Picker_Function *open_color_picker; -Animate_In_N_Milliseconds_Function *animate_in_n_milliseconds; -Buffer_Find_All_Matches_Function *buffer_find_all_matches; -#else -Global_Set_Setting_Function *global_set_setting_; -Global_Set_Mapping_Function *global_set_mapping_; -Global_Get_Screen_Rectangle_Function *global_get_screen_rectangle_; -Context_Get_Arena_Function *context_get_arena_; -Context_Get_Base_Allocator_Function *context_get_base_allocator_; -Create_Child_Process_Function *create_child_process_; -Child_Process_Set_Target_Buffer_Function *child_process_set_target_buffer_; -Buffer_Get_Attached_Child_Process_Function *buffer_get_attached_child_process_; -Child_Process_Get_Attached_Buffer_Function *child_process_get_attached_buffer_; -Child_Process_Get_State_Function *child_process_get_state_; -Clipboard_Post_Function *clipboard_post_; -Clipboard_Count_Function *clipboard_count_; -Push_Clipboard_Index_Function *push_clipboard_index_; -Get_Buffer_Count_Function *get_buffer_count_; -Get_Buffer_Next_Function *get_buffer_next_; -Get_Buffer_By_Name_Function *get_buffer_by_name_; -Get_Buffer_By_File_Name_Function *get_buffer_by_file_name_; -Buffer_Read_Range_Function *buffer_read_range_; -Buffer_Replace_Range_Function *buffer_replace_range_; -Buffer_Batch_Edit_Function *buffer_batch_edit_; -Buffer_Seek_String_Function *buffer_seek_string_; -Buffer_Seek_Character_Class_Function *buffer_seek_character_class_; -Buffer_Line_Y_Difference_Function *buffer_line_y_difference_; -Buffer_Line_Shift_Y_Function *buffer_line_shift_y_; -Buffer_Pos_At_Relative_XY_Function *buffer_pos_at_relative_xy_; -Buffer_Relative_XY_Of_Pos_Function *buffer_relative_xy_of_pos_; -Buffer_Relative_Character_From_Pos_Function *buffer_relative_character_from_pos_; -Buffer_Pos_From_Relative_Character_Function *buffer_pos_from_relative_character_; -View_Line_Y_Difference_Function *view_line_y_difference_; -View_Line_Shift_Y_Function *view_line_shift_y_; -View_Pos_At_Relative_XY_Function *view_pos_at_relative_xy_; -View_Relative_XY_Of_Pos_Function *view_relative_xy_of_pos_; -View_Relative_Character_From_Pos_Function *view_relative_character_from_pos_; -View_Pos_From_Relative_Character_Function *view_pos_from_relative_character_; -Buffer_Exists_Function *buffer_exists_; -Buffer_Ready_Function *buffer_ready_; -Buffer_Get_Access_Flags_Function *buffer_get_access_flags_; -Buffer_Get_Size_Function *buffer_get_size_; -Buffer_Get_Line_Count_Function *buffer_get_line_count_; -Push_Buffer_Base_Name_Function *push_buffer_base_name_; -Push_Buffer_Unique_Name_Function *push_buffer_unique_name_; -Push_Buffer_File_Name_Function *push_buffer_file_name_; -Buffer_Get_Dirty_State_Function *buffer_get_dirty_state_; -Buffer_Set_Dirty_State_Function *buffer_set_dirty_state_; -Buffer_Get_Setting_Function *buffer_get_setting_; -Buffer_Set_Setting_Function *buffer_set_setting_; -Buffer_Get_Managed_Scope_Function *buffer_get_managed_scope_; -Buffer_Send_End_Signal_Function *buffer_send_end_signal_; -Create_Buffer_Function *create_buffer_; -Buffer_Save_Function *buffer_save_; -Buffer_Kill_Function *buffer_kill_; -Buffer_Reopen_Function *buffer_reopen_; -Buffer_Get_File_Attributes_Function *buffer_get_file_attributes_; -Get_File_Attributes_Function *get_file_attributes_; -Get_View_Next_Function *get_view_next_; -Get_View_Prev_Function *get_view_prev_; -Get_Active_View_Function *get_active_view_; -Get_Active_Panel_Function *get_active_panel_; -View_Exists_Function *view_exists_; -View_Get_Buffer_Function *view_get_buffer_; -View_Get_Cursor_Pos_Function *view_get_cursor_pos_; -View_Get_Mark_Pos_Function *view_get_mark_pos_; -View_Get_Preferred_X_Function *view_get_preferred_x_; -View_Set_Preferred_X_Function *view_set_preferred_x_; -View_Get_Screen_Rect_Function *view_get_screen_rect_; -View_Get_Panel_Function *view_get_panel_; -Panel_Get_View_Function *panel_get_view_; -Panel_Is_Split_Function *panel_is_split_; -Panel_Is_Leaf_Function *panel_is_leaf_; -Panel_Split_Function *panel_split_; -Panel_Set_Split_Function *panel_set_split_; -Panel_Swap_Children_Function *panel_swap_children_; -Panel_Get_Parent_Function *panel_get_parent_; -Panel_Get_Child_Function *panel_get_child_; -Panel_Get_Max_Function *panel_get_max_; -Panel_Get_Margin_Function *panel_get_margin_; -View_Close_Function *view_close_; -View_Get_Buffer_Region_Function *view_get_buffer_region_; -View_Get_Buffer_Scroll_Function *view_get_buffer_scroll_; -View_Get_Basic_Scroll_Function *view_get_basic_scroll_; -View_Set_Active_Function *view_set_active_; -View_Get_Setting_Function *view_get_setting_; -View_Set_Setting_Function *view_set_setting_; -View_Get_Managed_Scope_Function *view_get_managed_scope_; -Buffer_Compute_Cursor_Function *buffer_compute_cursor_; -View_Compute_Cursor_Function *view_compute_cursor_; -View_Set_Cursor_Function *view_set_cursor_; -View_Set_Buffer_Scroll_Function *view_set_buffer_scroll_; -View_Set_Basic_Scroll_Function *view_set_basic_scroll_; -View_Set_Mark_Function *view_set_mark_; -View_Set_Buffer_Function *view_set_buffer_; -View_Post_Fade_Function *view_post_fade_; -View_Begin_UI_Mode_Function *view_begin_ui_mode_; -View_End_UI_Mode_Function *view_end_ui_mode_; -View_Is_In_UI_Mode_Function *view_is_in_ui_mode_; -View_Set_Quit_UI_Handler_Function *view_set_quit_ui_handler_; -View_Get_Quit_UI_Handler_Function *view_get_quit_ui_handler_; -Create_User_Managed_Scope_Function *create_user_managed_scope_; -Destroy_User_Managed_Scope_Function *destroy_user_managed_scope_; -Get_Global_Managed_Scope_Function *get_global_managed_scope_; -Get_Managed_Scope_With_Multiple_Dependencies_Function *get_managed_scope_with_multiple_dependencies_; -Managed_Scope_Clear_Contents_Function *managed_scope_clear_contents_; -Managed_Scope_Clear_Self_All_Dependent_Scopes_Function *managed_scope_clear_self_all_dependent_scopes_; -Managed_Scope_Allocator_Function *managed_scope_allocator_; -Managed_Id_Declare_Function *managed_id_declare_; -Managed_Scope_Get_Attachment_Function *managed_scope_get_attachment_; -Managed_Scope_Attachment_Erase_Function *managed_scope_attachment_erase_; -Alloc_Managed_Memory_In_Scope_Function *alloc_managed_memory_in_scope_; -Alloc_Buffer_Markers_On_Buffer_Function *alloc_buffer_markers_on_buffer_; -Managed_Object_Get_Item_Size_Function *managed_object_get_item_size_; -Managed_Object_Get_Item_Count_Function *managed_object_get_item_count_; -Managed_Object_Get_Pointer_Function *managed_object_get_pointer_; -Managed_Object_Get_Type_Function *managed_object_get_type_; -Managed_Object_Get_Containing_Scope_Function *managed_object_get_containing_scope_; -Managed_Object_Free_Function *managed_object_free_; -Managed_Object_Store_Data_Function *managed_object_store_data_; -Managed_Object_Load_Data_Function *managed_object_load_data_; -Get_User_Input_Function *get_user_input_; -Get_Command_Input_Function *get_command_input_; -Set_Command_Input_Function *set_command_input_; -Get_Mouse_State_Function *get_mouse_state_; -Get_Active_Query_Bars_Function *get_active_query_bars_; -Start_Query_Bar_Function *start_query_bar_; -End_Query_Bar_Function *end_query_bar_; -Print_Message_Function *print_message_; -Log_String_Function *log_string_; -Thread_Get_ID_Function *thread_get_id_; -Get_Largest_Face_ID_Function *get_largest_face_id_; -Set_Global_Face_Function *set_global_face_; -Buffer_History_Get_Max_Record_Index_Function *buffer_history_get_max_record_index_; -Buffer_History_Get_Record_Info_Function *buffer_history_get_record_info_; -Buffer_History_Get_Group_Sub_Record_Function *buffer_history_get_group_sub_record_; -Buffer_History_Get_Current_State_Index_Function *buffer_history_get_current_state_index_; -Buffer_History_Set_Current_State_Index_Function *buffer_history_set_current_state_index_; -Buffer_History_Merge_Record_Range_Function *buffer_history_merge_record_range_; -Buffer_History_Clear_After_Current_State_Function *buffer_history_clear_after_current_state_; -Global_History_Edit_Group_Begin_Function *global_history_edit_group_begin_; -Global_History_Edit_Group_End_Function *global_history_edit_group_end_; -Buffer_Set_Face_Function *buffer_set_face_; -Get_Face_Description_Function *get_face_description_; -Get_Face_Metrics_Function *get_face_metrics_; -Get_Face_ID_Function *get_face_id_; -Try_Create_New_Face_Function *try_create_new_face_; -Try_Modify_Face_Function *try_modify_face_; -Try_Release_Face_Function *try_release_face_; -Set_Theme_Colors_Function *set_theme_colors_; -Get_Theme_Colors_Function *get_theme_colors_; -Finalize_Color_Function *finalize_color_; -Push_Hot_Directory_Function *push_hot_directory_; -Set_Hot_Directory_Function *set_hot_directory_; -Get_File_List_Function *get_file_list_; -Set_GUI_Up_Down_Keys_Function *set_gui_up_down_keys_; -Memory_Allocate_Function *memory_allocate_; -Memory_Set_Protection_Function *memory_set_protection_; -Memory_Free_Function *memory_free_; -Push_4ed_Path_Function *push_4ed_path_; -Show_Mouse_Cursor_Function *show_mouse_cursor_; -Set_Edit_Finished_Hook_Repeat_Speed_Function *set_edit_finished_hook_repeat_speed_; -Set_Fullscreen_Function *set_fullscreen_; -Is_Fullscreen_Function *is_fullscreen_; -Send_Exit_Signal_Function *send_exit_signal_; -Set_Window_Title_Function *set_window_title_; -Get_Microseconds_Timestamp_Function *get_microseconds_timestamp_; -Draw_String_Function *draw_string_; -Get_String_Advance_Function *get_string_advance_; -Draw_Rectangle_Function *draw_rectangle_; -Draw_Rectangle_Outline_Function *draw_rectangle_outline_; -Draw_Clip_Push_Function *draw_clip_push_; -Draw_Clip_Pop_Function *draw_clip_pop_; -Draw_Coordinate_Center_Push_Function *draw_coordinate_center_push_; -Draw_Coordinate_Center_Pop_Function *draw_coordinate_center_pop_; -Text_Layout_Create_Function *text_layout_create_; -Text_Layout_Get_Buffer_Function *text_layout_get_buffer_; -Text_Layout_Get_Visible_Range_Function *text_layout_get_visible_range_; -Text_Layout_Line_On_Screen_Function *text_layout_line_on_screen_; -Text_Layout_Character_On_Screen_Function *text_layout_character_on_screen_; -Paint_Text_Color_Function *paint_text_color_; -Text_Layout_Free_Function *text_layout_free_; -Draw_Text_Layout_Function *draw_text_layout_; -Open_Color_Picker_Function *open_color_picker_; -Animate_In_N_Milliseconds_Function *animate_in_n_milliseconds_; -Buffer_Find_All_Matches_Function *buffer_find_all_matches_; -#endif -void *memory; -int32_t memory_size; -void *cmd_context; -void *system_links; -void *current_coroutine; -int32_t type_coroutine; + Global_Set_Setting_Function *global_set_setting_; + Global_Set_Mapping_Function *global_set_mapping_; + Global_Get_Screen_Rectangle_Function *global_get_screen_rectangle_; + Context_Get_Arena_Function *context_get_arena_; + Context_Get_Base_Allocator_Function *context_get_base_allocator_; + Create_Child_Process_Function *create_child_process_; + Child_Process_Set_Target_Buffer_Function *child_process_set_target_buffer_; + Buffer_Get_Attached_Child_Process_Function *buffer_get_attached_child_process_; + Child_Process_Get_Attached_Buffer_Function *child_process_get_attached_buffer_; + Child_Process_Get_State_Function *child_process_get_state_; + Clipboard_Post_Function *clipboard_post_; + Clipboard_Count_Function *clipboard_count_; + Push_Clipboard_Index_Function *push_clipboard_index_; + Get_Buffer_Count_Function *get_buffer_count_; + Get_Buffer_Next_Function *get_buffer_next_; + Get_Buffer_By_Name_Function *get_buffer_by_name_; + Get_Buffer_By_File_Name_Function *get_buffer_by_file_name_; + Buffer_Read_Range_Function *buffer_read_range_; + Buffer_Replace_Range_Function *buffer_replace_range_; + Buffer_Batch_Edit_Function *buffer_batch_edit_; + Buffer_Seek_String_Function *buffer_seek_string_; + Buffer_Seek_Character_Class_Function *buffer_seek_character_class_; + Buffer_Line_Y_Difference_Function *buffer_line_y_difference_; + Buffer_Line_Shift_Y_Function *buffer_line_shift_y_; + Buffer_Pos_At_Relative_XY_Function *buffer_pos_at_relative_xy_; + Buffer_Relative_XY_Of_Pos_Function *buffer_relative_xy_of_pos_; + Buffer_Relative_Character_From_Pos_Function *buffer_relative_character_from_pos_; + Buffer_Pos_From_Relative_Character_Function *buffer_pos_from_relative_character_; + View_Line_Y_Difference_Function *view_line_y_difference_; + View_Line_Shift_Y_Function *view_line_shift_y_; + View_Pos_At_Relative_XY_Function *view_pos_at_relative_xy_; + View_Relative_XY_Of_Pos_Function *view_relative_xy_of_pos_; + View_Relative_Character_From_Pos_Function *view_relative_character_from_pos_; + View_Pos_From_Relative_Character_Function *view_pos_from_relative_character_; + Buffer_Exists_Function *buffer_exists_; + Buffer_Ready_Function *buffer_ready_; + Buffer_Get_Access_Flags_Function *buffer_get_access_flags_; + Buffer_Get_Size_Function *buffer_get_size_; + Buffer_Get_Line_Count_Function *buffer_get_line_count_; + Push_Buffer_Base_Name_Function *push_buffer_base_name_; + Push_Buffer_Unique_Name_Function *push_buffer_unique_name_; + Push_Buffer_File_Name_Function *push_buffer_file_name_; + Buffer_Get_Dirty_State_Function *buffer_get_dirty_state_; + Buffer_Set_Dirty_State_Function *buffer_set_dirty_state_; + Buffer_Get_Setting_Function *buffer_get_setting_; + Buffer_Set_Setting_Function *buffer_set_setting_; + Buffer_Get_Managed_Scope_Function *buffer_get_managed_scope_; + Buffer_Send_End_Signal_Function *buffer_send_end_signal_; + Create_Buffer_Function *create_buffer_; + Buffer_Save_Function *buffer_save_; + Buffer_Kill_Function *buffer_kill_; + Buffer_Reopen_Function *buffer_reopen_; + Buffer_Get_File_Attributes_Function *buffer_get_file_attributes_; + Get_File_Attributes_Function *get_file_attributes_; + Get_View_Next_Function *get_view_next_; + Get_View_Prev_Function *get_view_prev_; + Get_Active_View_Function *get_active_view_; + Get_Active_Panel_Function *get_active_panel_; + View_Exists_Function *view_exists_; + View_Get_Buffer_Function *view_get_buffer_; + View_Get_Cursor_Pos_Function *view_get_cursor_pos_; + View_Get_Mark_Pos_Function *view_get_mark_pos_; + View_Get_Preferred_X_Function *view_get_preferred_x_; + View_Set_Preferred_X_Function *view_set_preferred_x_; + View_Get_Screen_Rect_Function *view_get_screen_rect_; + View_Get_Panel_Function *view_get_panel_; + Panel_Get_View_Function *panel_get_view_; + Panel_Is_Split_Function *panel_is_split_; + Panel_Is_Leaf_Function *panel_is_leaf_; + Panel_Split_Function *panel_split_; + Panel_Set_Split_Function *panel_set_split_; + Panel_Swap_Children_Function *panel_swap_children_; + Panel_Get_Parent_Function *panel_get_parent_; + Panel_Get_Child_Function *panel_get_child_; + Panel_Get_Max_Function *panel_get_max_; + Panel_Get_Margin_Function *panel_get_margin_; + View_Close_Function *view_close_; + View_Get_Buffer_Region_Function *view_get_buffer_region_; + View_Get_Buffer_Scroll_Function *view_get_buffer_scroll_; + View_Get_Basic_Scroll_Function *view_get_basic_scroll_; + View_Set_Active_Function *view_set_active_; + View_Get_Setting_Function *view_get_setting_; + View_Set_Setting_Function *view_set_setting_; + View_Get_Managed_Scope_Function *view_get_managed_scope_; + Buffer_Compute_Cursor_Function *buffer_compute_cursor_; + View_Compute_Cursor_Function *view_compute_cursor_; + View_Set_Cursor_Function *view_set_cursor_; + View_Set_Buffer_Scroll_Function *view_set_buffer_scroll_; + View_Set_Basic_Scroll_Function *view_set_basic_scroll_; + View_Set_Mark_Function *view_set_mark_; + View_Set_Buffer_Function *view_set_buffer_; + View_Post_Fade_Function *view_post_fade_; + View_Begin_UI_Mode_Function *view_begin_ui_mode_; + View_End_UI_Mode_Function *view_end_ui_mode_; + View_Is_In_UI_Mode_Function *view_is_in_ui_mode_; + View_Set_Quit_UI_Handler_Function *view_set_quit_ui_handler_; + View_Get_Quit_UI_Handler_Function *view_get_quit_ui_handler_; + Create_User_Managed_Scope_Function *create_user_managed_scope_; + Destroy_User_Managed_Scope_Function *destroy_user_managed_scope_; + Get_Global_Managed_Scope_Function *get_global_managed_scope_; + Get_Managed_Scope_With_Multiple_Dependencies_Function *get_managed_scope_with_multiple_dependencies_; + Managed_Scope_Clear_Contents_Function *managed_scope_clear_contents_; + Managed_Scope_Clear_Self_All_Dependent_Scopes_Function *managed_scope_clear_self_all_dependent_scopes_; + Managed_Scope_Allocator_Function *managed_scope_allocator_; + Managed_Id_Declare_Function *managed_id_declare_; + Managed_Scope_Get_Attachment_Function *managed_scope_get_attachment_; + Managed_Scope_Attachment_Erase_Function *managed_scope_attachment_erase_; + Alloc_Managed_Memory_In_Scope_Function *alloc_managed_memory_in_scope_; + Alloc_Buffer_Markers_On_Buffer_Function *alloc_buffer_markers_on_buffer_; + Managed_Object_Get_Item_Size_Function *managed_object_get_item_size_; + Managed_Object_Get_Item_Count_Function *managed_object_get_item_count_; + Managed_Object_Get_Pointer_Function *managed_object_get_pointer_; + Managed_Object_Get_Type_Function *managed_object_get_type_; + Managed_Object_Get_Containing_Scope_Function *managed_object_get_containing_scope_; + Managed_Object_Free_Function *managed_object_free_; + Managed_Object_Store_Data_Function *managed_object_store_data_; + Managed_Object_Load_Data_Function *managed_object_load_data_; + Get_User_Input_Function *get_user_input_; + Get_Command_Input_Function *get_command_input_; + Set_Command_Input_Function *set_command_input_; + Get_Mouse_State_Function *get_mouse_state_; + Get_Active_Query_Bars_Function *get_active_query_bars_; + Start_Query_Bar_Function *start_query_bar_; + End_Query_Bar_Function *end_query_bar_; + Print_Message_Function *print_message_; + Log_String_Function *log_string_; + Thread_Get_ID_Function *thread_get_id_; + Get_Largest_Face_ID_Function *get_largest_face_id_; + Set_Global_Face_Function *set_global_face_; + Buffer_History_Get_Max_Record_Index_Function *buffer_history_get_max_record_index_; + Buffer_History_Get_Record_Info_Function *buffer_history_get_record_info_; + Buffer_History_Get_Group_Sub_Record_Function *buffer_history_get_group_sub_record_; + Buffer_History_Get_Current_State_Index_Function *buffer_history_get_current_state_index_; + Buffer_History_Set_Current_State_Index_Function *buffer_history_set_current_state_index_; + Buffer_History_Merge_Record_Range_Function *buffer_history_merge_record_range_; + Buffer_History_Clear_After_Current_State_Function *buffer_history_clear_after_current_state_; + Global_History_Edit_Group_Begin_Function *global_history_edit_group_begin_; + Global_History_Edit_Group_End_Function *global_history_edit_group_end_; + Buffer_Set_Face_Function *buffer_set_face_; + Get_Face_Description_Function *get_face_description_; + Get_Face_Metrics_Function *get_face_metrics_; + Get_Face_ID_Function *get_face_id_; + Try_Create_New_Face_Function *try_create_new_face_; + Try_Modify_Face_Function *try_modify_face_; + Try_Release_Face_Function *try_release_face_; + Set_Theme_Colors_Function *set_theme_colors_; + Get_Theme_Colors_Function *get_theme_colors_; + Finalize_Color_Function *finalize_color_; + Push_Hot_Directory_Function *push_hot_directory_; + Set_Hot_Directory_Function *set_hot_directory_; + Get_File_List_Function *get_file_list_; + Set_GUI_Up_Down_Keys_Function *set_gui_up_down_keys_; + Memory_Allocate_Function *memory_allocate_; + Memory_Set_Protection_Function *memory_set_protection_; + Memory_Free_Function *memory_free_; + Push_4ed_Path_Function *push_4ed_path_; + Show_Mouse_Cursor_Function *show_mouse_cursor_; + Set_Edit_Finished_Hook_Repeat_Speed_Function *set_edit_finished_hook_repeat_speed_; + Set_Fullscreen_Function *set_fullscreen_; + Is_Fullscreen_Function *is_fullscreen_; + Send_Exit_Signal_Function *send_exit_signal_; + Set_Window_Title_Function *set_window_title_; + Get_Microseconds_Timestamp_Function *get_microseconds_timestamp_; + Draw_String_Function *draw_string_; + Get_String_Advance_Function *get_string_advance_; + Draw_Rectangle_Function *draw_rectangle_; + Draw_Rectangle_Outline_Function *draw_rectangle_outline_; + Draw_Clip_Push_Function *draw_clip_push_; + Draw_Clip_Pop_Function *draw_clip_pop_; + Draw_Coordinate_Center_Push_Function *draw_coordinate_center_push_; + Draw_Coordinate_Center_Pop_Function *draw_coordinate_center_pop_; + Text_Layout_Create_Function *text_layout_create_; + Text_Layout_Get_Buffer_Function *text_layout_get_buffer_; + Text_Layout_Get_Visible_Range_Function *text_layout_get_visible_range_; + Text_Layout_Line_On_Screen_Function *text_layout_line_on_screen_; + Text_Layout_Character_On_Screen_Function *text_layout_character_on_screen_; + Paint_Text_Color_Function *paint_text_color_; + Text_Layout_Free_Function *text_layout_free_; + Draw_Text_Layout_Function *draw_text_layout_; + Open_Color_Picker_Function *open_color_picker_; + Animate_In_N_Milliseconds_Function *animate_in_n_milliseconds_; + Buffer_Find_All_Matches_Function *buffer_find_all_matches_; + void *memory; + int32_t memory_size; + void *cmd_context; + void *system_links; + void *current_coroutine; + int32_t type_coroutine; }; #define FillAppLinksAPI(app_links) do{\ -app_links->global_set_setting_ = Global_Set_Setting;\ -app_links->global_set_mapping_ = Global_Set_Mapping;\ -app_links->global_get_screen_rectangle_ = Global_Get_Screen_Rectangle;\ -app_links->context_get_arena_ = Context_Get_Arena;\ -app_links->context_get_base_allocator_ = Context_Get_Base_Allocator;\ -app_links->create_child_process_ = Create_Child_Process;\ -app_links->child_process_set_target_buffer_ = Child_Process_Set_Target_Buffer;\ -app_links->buffer_get_attached_child_process_ = Buffer_Get_Attached_Child_Process;\ -app_links->child_process_get_attached_buffer_ = Child_Process_Get_Attached_Buffer;\ -app_links->child_process_get_state_ = Child_Process_Get_State;\ -app_links->clipboard_post_ = Clipboard_Post;\ -app_links->clipboard_count_ = Clipboard_Count;\ -app_links->push_clipboard_index_ = Push_Clipboard_Index;\ -app_links->get_buffer_count_ = Get_Buffer_Count;\ -app_links->get_buffer_next_ = Get_Buffer_Next;\ -app_links->get_buffer_by_name_ = Get_Buffer_By_Name;\ -app_links->get_buffer_by_file_name_ = Get_Buffer_By_File_Name;\ -app_links->buffer_read_range_ = Buffer_Read_Range;\ -app_links->buffer_replace_range_ = Buffer_Replace_Range;\ -app_links->buffer_batch_edit_ = Buffer_Batch_Edit;\ -app_links->buffer_seek_string_ = Buffer_Seek_String;\ -app_links->buffer_seek_character_class_ = Buffer_Seek_Character_Class;\ -app_links->buffer_line_y_difference_ = Buffer_Line_Y_Difference;\ -app_links->buffer_line_shift_y_ = Buffer_Line_Shift_Y;\ -app_links->buffer_pos_at_relative_xy_ = Buffer_Pos_At_Relative_XY;\ -app_links->buffer_relative_xy_of_pos_ = Buffer_Relative_XY_Of_Pos;\ -app_links->buffer_relative_character_from_pos_ = Buffer_Relative_Character_From_Pos;\ -app_links->buffer_pos_from_relative_character_ = Buffer_Pos_From_Relative_Character;\ -app_links->view_line_y_difference_ = View_Line_Y_Difference;\ -app_links->view_line_shift_y_ = View_Line_Shift_Y;\ -app_links->view_pos_at_relative_xy_ = View_Pos_At_Relative_XY;\ -app_links->view_relative_xy_of_pos_ = View_Relative_XY_Of_Pos;\ -app_links->view_relative_character_from_pos_ = View_Relative_Character_From_Pos;\ -app_links->view_pos_from_relative_character_ = View_Pos_From_Relative_Character;\ -app_links->buffer_exists_ = Buffer_Exists;\ -app_links->buffer_ready_ = Buffer_Ready;\ -app_links->buffer_get_access_flags_ = Buffer_Get_Access_Flags;\ -app_links->buffer_get_size_ = Buffer_Get_Size;\ -app_links->buffer_get_line_count_ = Buffer_Get_Line_Count;\ -app_links->push_buffer_base_name_ = Push_Buffer_Base_Name;\ -app_links->push_buffer_unique_name_ = Push_Buffer_Unique_Name;\ -app_links->push_buffer_file_name_ = Push_Buffer_File_Name;\ -app_links->buffer_get_dirty_state_ = Buffer_Get_Dirty_State;\ -app_links->buffer_set_dirty_state_ = Buffer_Set_Dirty_State;\ -app_links->buffer_get_setting_ = Buffer_Get_Setting;\ -app_links->buffer_set_setting_ = Buffer_Set_Setting;\ -app_links->buffer_get_managed_scope_ = Buffer_Get_Managed_Scope;\ -app_links->buffer_send_end_signal_ = Buffer_Send_End_Signal;\ -app_links->create_buffer_ = Create_Buffer;\ -app_links->buffer_save_ = Buffer_Save;\ -app_links->buffer_kill_ = Buffer_Kill;\ -app_links->buffer_reopen_ = Buffer_Reopen;\ -app_links->buffer_get_file_attributes_ = Buffer_Get_File_Attributes;\ -app_links->get_file_attributes_ = Get_File_Attributes;\ -app_links->get_view_next_ = Get_View_Next;\ -app_links->get_view_prev_ = Get_View_Prev;\ -app_links->get_active_view_ = Get_Active_View;\ -app_links->get_active_panel_ = Get_Active_Panel;\ -app_links->view_exists_ = View_Exists;\ -app_links->view_get_buffer_ = View_Get_Buffer;\ -app_links->view_get_cursor_pos_ = View_Get_Cursor_Pos;\ -app_links->view_get_mark_pos_ = View_Get_Mark_Pos;\ -app_links->view_get_preferred_x_ = View_Get_Preferred_X;\ -app_links->view_set_preferred_x_ = View_Set_Preferred_X;\ -app_links->view_get_screen_rect_ = View_Get_Screen_Rect;\ -app_links->view_get_panel_ = View_Get_Panel;\ -app_links->panel_get_view_ = Panel_Get_View;\ -app_links->panel_is_split_ = Panel_Is_Split;\ -app_links->panel_is_leaf_ = Panel_Is_Leaf;\ -app_links->panel_split_ = Panel_Split;\ -app_links->panel_set_split_ = Panel_Set_Split;\ -app_links->panel_swap_children_ = Panel_Swap_Children;\ -app_links->panel_get_parent_ = Panel_Get_Parent;\ -app_links->panel_get_child_ = Panel_Get_Child;\ -app_links->panel_get_max_ = Panel_Get_Max;\ -app_links->panel_get_margin_ = Panel_Get_Margin;\ -app_links->view_close_ = View_Close;\ -app_links->view_get_buffer_region_ = View_Get_Buffer_Region;\ -app_links->view_get_buffer_scroll_ = View_Get_Buffer_Scroll;\ -app_links->view_get_basic_scroll_ = View_Get_Basic_Scroll;\ -app_links->view_set_active_ = View_Set_Active;\ -app_links->view_get_setting_ = View_Get_Setting;\ -app_links->view_set_setting_ = View_Set_Setting;\ -app_links->view_get_managed_scope_ = View_Get_Managed_Scope;\ -app_links->buffer_compute_cursor_ = Buffer_Compute_Cursor;\ -app_links->view_compute_cursor_ = View_Compute_Cursor;\ -app_links->view_set_cursor_ = View_Set_Cursor;\ -app_links->view_set_buffer_scroll_ = View_Set_Buffer_Scroll;\ -app_links->view_set_basic_scroll_ = View_Set_Basic_Scroll;\ -app_links->view_set_mark_ = View_Set_Mark;\ -app_links->view_set_buffer_ = View_Set_Buffer;\ -app_links->view_post_fade_ = View_Post_Fade;\ -app_links->view_begin_ui_mode_ = View_Begin_UI_Mode;\ -app_links->view_end_ui_mode_ = View_End_UI_Mode;\ -app_links->view_is_in_ui_mode_ = View_Is_In_UI_Mode;\ -app_links->view_set_quit_ui_handler_ = View_Set_Quit_UI_Handler;\ -app_links->view_get_quit_ui_handler_ = View_Get_Quit_UI_Handler;\ -app_links->create_user_managed_scope_ = Create_User_Managed_Scope;\ -app_links->destroy_user_managed_scope_ = Destroy_User_Managed_Scope;\ -app_links->get_global_managed_scope_ = Get_Global_Managed_Scope;\ -app_links->get_managed_scope_with_multiple_dependencies_ = Get_Managed_Scope_With_Multiple_Dependencies;\ -app_links->managed_scope_clear_contents_ = Managed_Scope_Clear_Contents;\ -app_links->managed_scope_clear_self_all_dependent_scopes_ = Managed_Scope_Clear_Self_All_Dependent_Scopes;\ -app_links->managed_scope_allocator_ = Managed_Scope_Allocator;\ -app_links->managed_id_declare_ = Managed_Id_Declare;\ -app_links->managed_scope_get_attachment_ = Managed_Scope_Get_Attachment;\ -app_links->managed_scope_attachment_erase_ = Managed_Scope_Attachment_Erase;\ -app_links->alloc_managed_memory_in_scope_ = Alloc_Managed_Memory_In_Scope;\ -app_links->alloc_buffer_markers_on_buffer_ = Alloc_Buffer_Markers_On_Buffer;\ -app_links->managed_object_get_item_size_ = Managed_Object_Get_Item_Size;\ -app_links->managed_object_get_item_count_ = Managed_Object_Get_Item_Count;\ -app_links->managed_object_get_pointer_ = Managed_Object_Get_Pointer;\ -app_links->managed_object_get_type_ = Managed_Object_Get_Type;\ -app_links->managed_object_get_containing_scope_ = Managed_Object_Get_Containing_Scope;\ -app_links->managed_object_free_ = Managed_Object_Free;\ -app_links->managed_object_store_data_ = Managed_Object_Store_Data;\ -app_links->managed_object_load_data_ = Managed_Object_Load_Data;\ -app_links->get_user_input_ = Get_User_Input;\ -app_links->get_command_input_ = Get_Command_Input;\ -app_links->set_command_input_ = Set_Command_Input;\ -app_links->get_mouse_state_ = Get_Mouse_State;\ -app_links->get_active_query_bars_ = Get_Active_Query_Bars;\ -app_links->start_query_bar_ = Start_Query_Bar;\ -app_links->end_query_bar_ = End_Query_Bar;\ -app_links->print_message_ = Print_Message;\ -app_links->log_string_ = Log_String;\ -app_links->thread_get_id_ = Thread_Get_ID;\ -app_links->get_largest_face_id_ = Get_Largest_Face_ID;\ -app_links->set_global_face_ = Set_Global_Face;\ -app_links->buffer_history_get_max_record_index_ = Buffer_History_Get_Max_Record_Index;\ -app_links->buffer_history_get_record_info_ = Buffer_History_Get_Record_Info;\ -app_links->buffer_history_get_group_sub_record_ = Buffer_History_Get_Group_Sub_Record;\ -app_links->buffer_history_get_current_state_index_ = Buffer_History_Get_Current_State_Index;\ -app_links->buffer_history_set_current_state_index_ = Buffer_History_Set_Current_State_Index;\ -app_links->buffer_history_merge_record_range_ = Buffer_History_Merge_Record_Range;\ -app_links->buffer_history_clear_after_current_state_ = Buffer_History_Clear_After_Current_State;\ -app_links->global_history_edit_group_begin_ = Global_History_Edit_Group_Begin;\ -app_links->global_history_edit_group_end_ = Global_History_Edit_Group_End;\ -app_links->buffer_set_face_ = Buffer_Set_Face;\ -app_links->get_face_description_ = Get_Face_Description;\ -app_links->get_face_metrics_ = Get_Face_Metrics;\ -app_links->get_face_id_ = Get_Face_ID;\ -app_links->try_create_new_face_ = Try_Create_New_Face;\ -app_links->try_modify_face_ = Try_Modify_Face;\ -app_links->try_release_face_ = Try_Release_Face;\ -app_links->set_theme_colors_ = Set_Theme_Colors;\ -app_links->get_theme_colors_ = Get_Theme_Colors;\ -app_links->finalize_color_ = Finalize_Color;\ -app_links->push_hot_directory_ = Push_Hot_Directory;\ -app_links->set_hot_directory_ = Set_Hot_Directory;\ -app_links->get_file_list_ = Get_File_List;\ -app_links->set_gui_up_down_keys_ = Set_GUI_Up_Down_Keys;\ -app_links->memory_allocate_ = Memory_Allocate;\ -app_links->memory_set_protection_ = Memory_Set_Protection;\ -app_links->memory_free_ = Memory_Free;\ -app_links->push_4ed_path_ = Push_4ed_Path;\ -app_links->show_mouse_cursor_ = Show_Mouse_Cursor;\ -app_links->set_edit_finished_hook_repeat_speed_ = Set_Edit_Finished_Hook_Repeat_Speed;\ -app_links->set_fullscreen_ = Set_Fullscreen;\ -app_links->is_fullscreen_ = Is_Fullscreen;\ -app_links->send_exit_signal_ = Send_Exit_Signal;\ -app_links->set_window_title_ = Set_Window_Title;\ -app_links->get_microseconds_timestamp_ = Get_Microseconds_Timestamp;\ -app_links->draw_string_ = Draw_String;\ -app_links->get_string_advance_ = Get_String_Advance;\ -app_links->draw_rectangle_ = Draw_Rectangle;\ -app_links->draw_rectangle_outline_ = Draw_Rectangle_Outline;\ -app_links->draw_clip_push_ = Draw_Clip_Push;\ -app_links->draw_clip_pop_ = Draw_Clip_Pop;\ -app_links->draw_coordinate_center_push_ = Draw_Coordinate_Center_Push;\ -app_links->draw_coordinate_center_pop_ = Draw_Coordinate_Center_Pop;\ -app_links->text_layout_create_ = Text_Layout_Create;\ -app_links->text_layout_get_buffer_ = Text_Layout_Get_Buffer;\ -app_links->text_layout_get_visible_range_ = Text_Layout_Get_Visible_Range;\ -app_links->text_layout_line_on_screen_ = Text_Layout_Line_On_Screen;\ -app_links->text_layout_character_on_screen_ = Text_Layout_Character_On_Screen;\ -app_links->paint_text_color_ = Paint_Text_Color;\ -app_links->text_layout_free_ = Text_Layout_Free;\ -app_links->draw_text_layout_ = Draw_Text_Layout;\ -app_links->open_color_picker_ = Open_Color_Picker;\ -app_links->animate_in_n_milliseconds_ = Animate_In_N_Milliseconds;\ -app_links->buffer_find_all_matches_ = Buffer_Find_All_Matches;} while(false) -#if defined(ALLOW_DEP_4CODER) -static b32 global_set_setting(Application_Links *app, Global_Setting_ID setting, i32 value){return(app->global_set_setting(app, setting, value));} -static b32 global_set_mapping(Application_Links *app, void *data, i32 size){return(app->global_set_mapping(app, data, size));} -static Rect_f32 global_get_screen_rectangle(Application_Links *app){return(app->global_get_screen_rectangle(app));} -static Arena* context_get_arena(Application_Links *app){return(app->context_get_arena(app));} -static Base_Allocator* context_get_base_allocator(Application_Links *app){return(app->context_get_base_allocator(app));} -static b32 create_child_process(Application_Links *app, String_Const_u8 path, String_Const_u8 command, Child_Process_ID *child_process_id_out){return(app->create_child_process(app, path, command, child_process_id_out));} -static b32 child_process_set_target_buffer(Application_Links *app, Child_Process_ID child_process_id, Buffer_ID buffer_id, Child_Process_Set_Target_Flags flags){return(app->child_process_set_target_buffer(app, child_process_id, buffer_id, flags));} -static Child_Process_ID buffer_get_attached_child_process(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_attached_child_process(app, buffer_id));} -static Buffer_ID child_process_get_attached_buffer(Application_Links *app, Child_Process_ID child_process_id){return(app->child_process_get_attached_buffer(app, child_process_id));} -static Process_State child_process_get_state(Application_Links *app, Child_Process_ID child_process_id){return(app->child_process_get_state(app, child_process_id));} -static b32 clipboard_post(Application_Links *app, i32 clipboard_id, String_Const_u8 string){return(app->clipboard_post(app, clipboard_id, string));} -static i32 clipboard_count(Application_Links *app, i32 clipboard_id){return(app->clipboard_count(app, clipboard_id));} -static String_Const_u8 push_clipboard_index(Application_Links *app, Arena *arena, i32 clipboard_id, i32 item_index){return(app->push_clipboard_index(app, arena, clipboard_id, item_index));} -static i32 get_buffer_count(Application_Links *app){return(app->get_buffer_count(app));} -static Buffer_ID get_buffer_next(Application_Links *app, Buffer_ID buffer_id, Access_Flag access){return(app->get_buffer_next(app, buffer_id, access));} -static Buffer_ID get_buffer_by_name(Application_Links *app, String_Const_u8 name, Access_Flag access){return(app->get_buffer_by_name(app, name, access));} -static Buffer_ID get_buffer_by_file_name(Application_Links *app, String_Const_u8 file_name, Access_Flag access){return(app->get_buffer_by_file_name(app, file_name, access));} -static b32 buffer_read_range(Application_Links *app, Buffer_ID buffer_id, Range_i64 range, char *out){return(app->buffer_read_range(app, buffer_id, range, out));} -static b32 buffer_replace_range(Application_Links *app, Buffer_ID buffer_id, Range_i64 range, String_Const_u8 string){return(app->buffer_replace_range(app, buffer_id, range, string));} -static b32 buffer_batch_edit(Application_Links *app, Buffer_ID buffer_id, Batch_Edit *batch){return(app->buffer_batch_edit(app, buffer_id, batch));} -static String_Match buffer_seek_string(Application_Links *app, Buffer_ID buffer, String_Const_u8 needle, Scan_Direction direction, i64 start_pos){return(app->buffer_seek_string(app, buffer, needle, direction, start_pos));} -static String_Match buffer_seek_character_class(Application_Links *app, Buffer_ID buffer, Character_Predicate *predicate, Scan_Direction direction, i64 start_pos){return(app->buffer_seek_character_class(app, buffer, predicate, direction, start_pos));} -static f32 buffer_line_y_difference(Application_Links *app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 line_a, i64 line_b){return(app->buffer_line_y_difference(app, buffer_id, width, face_id, line_a, line_b));} -static Line_Shift_Vertical buffer_line_shift_y(Application_Links *app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 line, f32 y_shift){return(app->buffer_line_shift_y(app, buffer_id, width, face_id, line, y_shift));} -static i64 buffer_pos_at_relative_xy(Application_Links *app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, Vec2_f32 relative_xy){return(app->buffer_pos_at_relative_xy(app, buffer_id, width, face_id, base_line, relative_xy));} -static Vec2_f32 buffer_relative_xy_of_pos(Application_Links *app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 pos){return(app->buffer_relative_xy_of_pos(app, buffer_id, width, face_id, base_line, pos));} -static i64 buffer_relative_character_from_pos(Application_Links *app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 pos){return(app->buffer_relative_character_from_pos(app, buffer_id, width, face_id, base_line, pos));} -static i64 buffer_pos_from_relative_character(Application_Links *app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 relative_character){return(app->buffer_pos_from_relative_character(app, buffer_id, width, face_id, base_line, relative_character));} -static f32 view_line_y_difference(Application_Links *app, View_ID view_id, i64 line_a, i64 line_b){return(app->view_line_y_difference(app, view_id, line_a, line_b));} -static Line_Shift_Vertical view_line_shift_y(Application_Links *app, View_ID view_id, i64 line, f32 y_shift){return(app->view_line_shift_y(app, view_id, line, y_shift));} -static i64 view_pos_at_relative_xy(Application_Links *app, View_ID view_id, i64 base_line, Vec2_f32 relative_xy){return(app->view_pos_at_relative_xy(app, view_id, base_line, relative_xy));} -static Vec2_f32 view_relative_xy_of_pos(Application_Links *app, View_ID view_id, i64 base_line, i64 pos){return(app->view_relative_xy_of_pos(app, view_id, base_line, pos));} -static i64 view_relative_character_from_pos(Application_Links *app, View_ID view_id, i64 base_line, i64 pos){return(app->view_relative_character_from_pos(app, view_id, base_line, pos));} -static i64 view_pos_from_relative_character(Application_Links *app, View_ID view_id, i64 base_line, i64 character){return(app->view_pos_from_relative_character(app, view_id, base_line, character));} -static b32 buffer_exists(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_exists(app, buffer_id));} -static b32 buffer_ready(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_ready(app, buffer_id));} -static Access_Flag buffer_get_access_flags(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_access_flags(app, buffer_id));} -static i64 buffer_get_size(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_size(app, buffer_id));} -static i64 buffer_get_line_count(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_line_count(app, buffer_id));} -static String_Const_u8 push_buffer_base_name(Application_Links *app, Arena *arena, Buffer_ID buffer_id){return(app->push_buffer_base_name(app, arena, buffer_id));} -static String_Const_u8 push_buffer_unique_name(Application_Links *app, Arena *out, Buffer_ID buffer_id){return(app->push_buffer_unique_name(app, out, buffer_id));} -static String_Const_u8 push_buffer_file_name(Application_Links *app, Arena *arena, Buffer_ID buffer_id){return(app->push_buffer_file_name(app, arena, buffer_id));} -static Dirty_State buffer_get_dirty_state(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_dirty_state(app, buffer_id));} -static b32 buffer_set_dirty_state(Application_Links *app, Buffer_ID buffer_id, Dirty_State dirty_state){return(app->buffer_set_dirty_state(app, buffer_id, dirty_state));} -static b32 buffer_get_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 *value_out){return(app->buffer_get_setting(app, buffer_id, setting, value_out));} -static b32 buffer_set_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 value){return(app->buffer_set_setting(app, buffer_id, setting, value));} -static Managed_Scope buffer_get_managed_scope(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_managed_scope(app, buffer_id));} -static b32 buffer_send_end_signal(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_send_end_signal(app, buffer_id));} -static Buffer_ID create_buffer(Application_Links *app, String_Const_u8 file_name, Buffer_Create_Flag flags){return(app->create_buffer(app, file_name, flags));} -static b32 buffer_save(Application_Links *app, Buffer_ID buffer_id, String_Const_u8 file_name, Buffer_Save_Flag flags){return(app->buffer_save(app, buffer_id, file_name, flags));} -static Buffer_Kill_Result buffer_kill(Application_Links *app, Buffer_ID buffer_id, Buffer_Kill_Flag flags){return(app->buffer_kill(app, buffer_id, flags));} -static Buffer_Reopen_Result buffer_reopen(Application_Links *app, Buffer_ID buffer_id, Buffer_Reopen_Flag flags){return(app->buffer_reopen(app, buffer_id, flags));} -static File_Attributes buffer_get_file_attributes(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_file_attributes(app, buffer_id));} -static File_Attributes get_file_attributes(Application_Links *app, String_Const_u8 file_name){return(app->get_file_attributes(app, file_name));} -static View_ID get_view_next(Application_Links *app, View_ID view_id, Access_Flag access){return(app->get_view_next(app, view_id, access));} -static View_ID get_view_prev(Application_Links *app, View_ID view_id, Access_Flag access){return(app->get_view_prev(app, view_id, access));} -static View_ID get_active_view(Application_Links *app, Access_Flag access){return(app->get_active_view(app, access));} -static Panel_ID get_active_panel(Application_Links *app){return(app->get_active_panel(app));} -static b32 view_exists(Application_Links *app, View_ID view_id){return(app->view_exists(app, view_id));} -static Buffer_ID view_get_buffer(Application_Links *app, View_ID view_id, Access_Flag access){return(app->view_get_buffer(app, view_id, access));} -static i64 view_get_cursor_pos(Application_Links *app, View_ID view_id){return(app->view_get_cursor_pos(app, view_id));} -static i64 view_get_mark_pos(Application_Links *app, View_ID view_id){return(app->view_get_mark_pos(app, view_id));} -static f32 view_get_preferred_x(Application_Links *app, View_ID view_id){return(app->view_get_preferred_x(app, view_id));} -static b32 view_set_preferred_x(Application_Links *app, View_ID view_id, f32 x){return(app->view_set_preferred_x(app, view_id, x));} -static Rect_f32 view_get_screen_rect(Application_Links *app, View_ID view_id){return(app->view_get_screen_rect(app, view_id));} -static Panel_ID view_get_panel(Application_Links *app, View_ID view_id){return(app->view_get_panel(app, view_id));} -static View_ID panel_get_view(Application_Links *app, Panel_ID panel_id){return(app->panel_get_view(app, panel_id));} -static b32 panel_is_split(Application_Links *app, Panel_ID panel_id){return(app->panel_is_split(app, panel_id));} -static b32 panel_is_leaf(Application_Links *app, Panel_ID panel_id){return(app->panel_is_leaf(app, panel_id));} -static b32 panel_split(Application_Links *app, Panel_ID panel_id, Panel_Split_Orientation orientation){return(app->panel_split(app, panel_id, orientation));} -static b32 panel_set_split(Application_Links *app, Panel_ID panel_id, Panel_Split_Kind kind, float t){return(app->panel_set_split(app, panel_id, kind, t));} -static b32 panel_swap_children(Application_Links *app, Panel_ID panel_id, Panel_Split_Kind kind, float t){return(app->panel_swap_children(app, panel_id, kind, t));} -static Panel_ID panel_get_parent(Application_Links *app, Panel_ID panel_id){return(app->panel_get_parent(app, panel_id));} -static Panel_ID panel_get_child(Application_Links *app, Panel_ID panel_id, Panel_Child which_child){return(app->panel_get_child(app, panel_id, which_child));} -static Panel_ID panel_get_max(Application_Links *app, Panel_ID panel_id){return(app->panel_get_max(app, panel_id));} -static Rect_i32 panel_get_margin(Application_Links *app, Panel_ID panel_id){return(app->panel_get_margin(app, panel_id));} -static b32 view_close(Application_Links *app, View_ID view_id){return(app->view_close(app, view_id));} -static Rect_f32 view_get_buffer_region(Application_Links *app, View_ID view_id){return(app->view_get_buffer_region(app, view_id));} -static Buffer_Scroll view_get_buffer_scroll(Application_Links *app, View_ID view_id){return(app->view_get_buffer_scroll(app, view_id));} -static Basic_Scroll view_get_basic_scroll(Application_Links *app, View_ID view_id){return(app->view_get_basic_scroll(app, view_id));} -static b32 view_set_active(Application_Links *app, View_ID view_id){return(app->view_set_active(app, view_id));} -static b32 view_get_setting(Application_Links *app, View_ID view_id, View_Setting_ID setting, i32 *value_out){return(app->view_get_setting(app, view_id, setting, value_out));} -static b32 view_set_setting(Application_Links *app, View_ID view_id, View_Setting_ID setting, i32 value){return(app->view_set_setting(app, view_id, setting, value));} -static Managed_Scope view_get_managed_scope(Application_Links *app, View_ID view_id){return(app->view_get_managed_scope(app, view_id));} -static Buffer_Cursor buffer_compute_cursor(Application_Links *app, Buffer_ID buffer, Buffer_Seek seek){return(app->buffer_compute_cursor(app, buffer, seek));} -static Buffer_Cursor view_compute_cursor(Application_Links *app, View_ID view_id, Buffer_Seek seek){return(app->view_compute_cursor(app, view_id, seek));} -static b32 view_set_cursor(Application_Links *app, View_ID view_id, Buffer_Seek seek){return(app->view_set_cursor(app, view_id, seek));} -static b32 view_set_buffer_scroll(Application_Links *app, View_ID view_id, Buffer_Scroll scroll){return(app->view_set_buffer_scroll(app, view_id, scroll));} -static b32 view_set_basic_scroll(Application_Links *app, View_ID view_id, Basic_Scroll scroll){return(app->view_set_basic_scroll(app, view_id, scroll));} -static b32 view_set_mark(Application_Links *app, View_ID view_id, Buffer_Seek seek){return(app->view_set_mark(app, view_id, seek));} -static b32 view_set_buffer(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Set_Buffer_Flag flags){return(app->view_set_buffer(app, view_id, buffer_id, flags));} -static b32 view_post_fade(Application_Links *app, View_ID view_id, f32 seconds, Range_i64 range, int_color color){return(app->view_post_fade(app, view_id, seconds, range, color));} -static b32 view_begin_ui_mode(Application_Links *app, View_ID view_id){return(app->view_begin_ui_mode(app, view_id));} -static b32 view_end_ui_mode(Application_Links *app, View_ID view_id){return(app->view_end_ui_mode(app, view_id));} -static b32 view_is_in_ui_mode(Application_Links *app, View_ID view_id){return(app->view_is_in_ui_mode(app, view_id));} -static b32 view_set_quit_ui_handler(Application_Links *app, View_ID view_id, UI_Quit_Function_Type *quit_function){return(app->view_set_quit_ui_handler(app, view_id, quit_function));} -static b32 view_get_quit_ui_handler(Application_Links *app, View_ID view_id, UI_Quit_Function_Type **quit_function_out){return(app->view_get_quit_ui_handler(app, view_id, quit_function_out));} -static Managed_Scope create_user_managed_scope(Application_Links *app){return(app->create_user_managed_scope(app));} -static b32 destroy_user_managed_scope(Application_Links *app, Managed_Scope scope){return(app->destroy_user_managed_scope(app, scope));} -static Managed_Scope get_global_managed_scope(Application_Links *app){return(app->get_global_managed_scope(app));} -static Managed_Scope get_managed_scope_with_multiple_dependencies(Application_Links *app, Managed_Scope *scopes, i32 count){return(app->get_managed_scope_with_multiple_dependencies(app, scopes, count));} -static b32 managed_scope_clear_contents(Application_Links *app, Managed_Scope scope){return(app->managed_scope_clear_contents(app, scope));} -static b32 managed_scope_clear_self_all_dependent_scopes(Application_Links *app, Managed_Scope scope){return(app->managed_scope_clear_self_all_dependent_scopes(app, scope));} -static Base_Allocator* managed_scope_allocator(Application_Links *app, Managed_Scope scope){return(app->managed_scope_allocator(app, scope));} -static Managed_ID managed_id_declare(Application_Links *app, String_Const_u8 name){return(app->managed_id_declare(app, name));} -static void* managed_scope_get_attachment(Application_Links *app, Managed_Scope scope, Managed_ID id, umem size){return(app->managed_scope_get_attachment(app, scope, id, size));} -static void* managed_scope_attachment_erase(Application_Links *app, Managed_Scope scope, Managed_ID id){return(app->managed_scope_attachment_erase(app, scope, id));} -static Managed_Object alloc_managed_memory_in_scope(Application_Links *app, Managed_Scope scope, i32 item_size, i32 count){return(app->alloc_managed_memory_in_scope(app, scope, item_size, count));} -static Managed_Object alloc_buffer_markers_on_buffer(Application_Links *app, Buffer_ID buffer_id, i32 count, Managed_Scope *optional_extra_scope){return(app->alloc_buffer_markers_on_buffer(app, buffer_id, count, optional_extra_scope));} -static u32 managed_object_get_item_size(Application_Links *app, Managed_Object object){return(app->managed_object_get_item_size(app, object));} -static u32 managed_object_get_item_count(Application_Links *app, Managed_Object object){return(app->managed_object_get_item_count(app, object));} -static void* managed_object_get_pointer(Application_Links *app, Managed_Object object){return(app->managed_object_get_pointer(app, object));} -static Managed_Object_Type managed_object_get_type(Application_Links *app, Managed_Object object){return(app->managed_object_get_type(app, object));} -static Managed_Scope managed_object_get_containing_scope(Application_Links *app, Managed_Object object){return(app->managed_object_get_containing_scope(app, object));} -static b32 managed_object_free(Application_Links *app, Managed_Object object){return(app->managed_object_free(app, object));} -static b32 managed_object_store_data(Application_Links *app, Managed_Object object, u32 first_index, u32 count, void *mem){return(app->managed_object_store_data(app, object, first_index, count, mem));} -static b32 managed_object_load_data(Application_Links *app, Managed_Object object, u32 first_index, u32 count, void *mem_out){return(app->managed_object_load_data(app, object, first_index, count, mem_out));} -static User_Input get_user_input(Application_Links *app, Input_Type_Flag get_type, Input_Type_Flag abort_type){return(app->get_user_input(app, get_type, abort_type));} -static User_Input get_command_input(Application_Links *app){return(app->get_command_input(app));} -static void set_command_input(Application_Links *app, Key_Event_Data key_data){(app->set_command_input(app, key_data));} -static Mouse_State get_mouse_state(Application_Links *app){return(app->get_mouse_state(app));} -static b32 get_active_query_bars(Application_Links *app, View_ID view_id, i32 max_result_count, Query_Bar_Ptr_Array *array_out){return(app->get_active_query_bars(app, view_id, max_result_count, array_out));} -static b32 start_query_bar(Application_Links *app, Query_Bar *bar, u32 flags){return(app->start_query_bar(app, bar, flags));} -static void end_query_bar(Application_Links *app, Query_Bar *bar, u32 flags){(app->end_query_bar(app, bar, flags));} -static b32 print_message(Application_Links *app, String_Const_u8 message){return(app->print_message(app, message));} -static b32 log_string(Application_Links *app, String_Const_u8 str){return(app->log_string(app, str));} -static i32 thread_get_id(Application_Links *app){return(app->thread_get_id(app));} -static Face_ID get_largest_face_id(Application_Links *app){return(app->get_largest_face_id(app));} -static b32 set_global_face(Application_Links *app, Face_ID id, b32 apply_to_all_buffers){return(app->set_global_face(app, id, apply_to_all_buffers));} -static History_Record_Index buffer_history_get_max_record_index(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_history_get_max_record_index(app, buffer_id));} -static Record_Info buffer_history_get_record_info(Application_Links *app, Buffer_ID buffer_id, History_Record_Index index){return(app->buffer_history_get_record_info(app, buffer_id, index));} -static Record_Info buffer_history_get_group_sub_record(Application_Links *app, Buffer_ID buffer_id, History_Record_Index index, i32 sub_index){return(app->buffer_history_get_group_sub_record(app, buffer_id, index, sub_index));} -static History_Record_Index buffer_history_get_current_state_index(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_history_get_current_state_index(app, buffer_id));} -static b32 buffer_history_set_current_state_index(Application_Links *app, Buffer_ID buffer_id, History_Record_Index index){return(app->buffer_history_set_current_state_index(app, buffer_id, index));} -static b32 buffer_history_merge_record_range(Application_Links *app, Buffer_ID buffer_id, History_Record_Index first_index, History_Record_Index last_index, Record_Merge_Flag flags){return(app->buffer_history_merge_record_range(app, buffer_id, first_index, last_index, flags));} -static b32 buffer_history_clear_after_current_state(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_history_clear_after_current_state(app, buffer_id));} -static void global_history_edit_group_begin(Application_Links *app){(app->global_history_edit_group_begin(app));} -static void global_history_edit_group_end(Application_Links *app){(app->global_history_edit_group_end(app));} -static b32 buffer_set_face(Application_Links *app, Buffer_ID buffer_id, Face_ID id){return(app->buffer_set_face(app, buffer_id, id));} -static Face_Description get_face_description(Application_Links *app, Face_ID face_id){return(app->get_face_description(app, face_id));} -static Face_Metrics get_face_metrics(Application_Links *app, Face_ID face_id){return(app->get_face_metrics(app, face_id));} -static Face_ID get_face_id(Application_Links *app, Buffer_ID buffer_id){return(app->get_face_id(app, buffer_id));} -static Face_ID try_create_new_face(Application_Links *app, Face_Description *description){return(app->try_create_new_face(app, description));} -static b32 try_modify_face(Application_Links *app, Face_ID id, Face_Description *description){return(app->try_modify_face(app, id, description));} -static b32 try_release_face(Application_Links *app, Face_ID id, Face_ID replacement_id){return(app->try_release_face(app, id, replacement_id));} -static void set_theme_colors(Application_Links *app, Theme_Color *colors, i32 count){(app->set_theme_colors(app, colors, count));} -static void get_theme_colors(Application_Links *app, Theme_Color *colors, i32 count){(app->get_theme_colors(app, colors, count));} -static argb_color finalize_color(Application_Links *app, int_color color){return(app->finalize_color(app, color));} -static String_Const_u8 push_hot_directory(Application_Links *app, Arena *arena){return(app->push_hot_directory(app, arena));} -static b32 set_hot_directory(Application_Links *app, String_Const_u8 string){return(app->set_hot_directory(app, string));} -static File_List get_file_list(Application_Links *app, Arena *arena, String_Const_u8 directory){return(app->get_file_list(app, arena, directory));} -static void set_gui_up_down_keys(Application_Links *app, Key_Code up_key, Key_Modifier up_key_modifier, Key_Code down_key, Key_Modifier down_key_modifier){(app->set_gui_up_down_keys(app, up_key, up_key_modifier, down_key, down_key_modifier));} -static void* memory_allocate(Application_Links *app, i32 size){return(app->memory_allocate(app, size));} -static b32 memory_set_protection(Application_Links *app, void *ptr, i32 size, Memory_Protect_Flags flags){return(app->memory_set_protection(app, ptr, size, flags));} -static void memory_free(Application_Links *app, void *ptr, i32 size){(app->memory_free(app, ptr, size));} -static String_Const_u8 push_4ed_path(Application_Links *app, Arena *arena){return(app->push_4ed_path(app, arena));} -static void show_mouse_cursor(Application_Links *app, Mouse_Cursor_Show_Type show){(app->show_mouse_cursor(app, show));} -static b32 set_edit_finished_hook_repeat_speed(Application_Links *app, u32 milliseconds){return(app->set_edit_finished_hook_repeat_speed(app, milliseconds));} -static b32 set_fullscreen(Application_Links *app, b32 full_screen){return(app->set_fullscreen(app, full_screen));} -static b32 is_fullscreen(Application_Links *app){return(app->is_fullscreen(app));} -static void send_exit_signal(Application_Links *app){(app->send_exit_signal(app));} -static b32 set_window_title(Application_Links *app, String_Const_u8 title){return(app->set_window_title(app, title));} -static Microsecond_Time_Stamp get_microseconds_timestamp(Application_Links *app){return(app->get_microseconds_timestamp(app));} -static Vec2 draw_string(Application_Links *app, Face_ID font_id, String_Const_u8 str, Vec2 point, int_color color, u32 flags, Vec2 delta){return(app->draw_string(app, font_id, str, point, color, flags, delta));} -static f32 get_string_advance(Application_Links *app, Face_ID font_id, String_Const_u8 str){return(app->get_string_advance(app, font_id, str));} -static void draw_rectangle(Application_Links *app, Rect_f32 rect, int_color color){(app->draw_rectangle(app, rect, color));} -static void draw_rectangle_outline(Application_Links *app, Rect_f32 rect, int_color color){(app->draw_rectangle_outline(app, rect, color));} -static void draw_clip_push(Application_Links *app, Rect_f32 clip_box){(app->draw_clip_push(app, clip_box));} -static f32_Rect draw_clip_pop(Application_Links *app){return(app->draw_clip_pop(app));} -static void draw_coordinate_center_push(Application_Links *app, Vec2 point){(app->draw_coordinate_center_push(app, point));} -static Vec2 draw_coordinate_center_pop(Application_Links *app){return(app->draw_coordinate_center_pop(app));} -static Text_Layout_ID text_layout_create(Application_Links *app, Buffer_ID buffer_id, Rect_f32 rect, Buffer_Point buffer_point){return(app->text_layout_create(app, buffer_id, rect, buffer_point));} -static b32 text_layout_get_buffer(Application_Links *app, Text_Layout_ID text_layout_id, Buffer_ID *buffer_id_out){return(app->text_layout_get_buffer(app, text_layout_id, buffer_id_out));} -static Interval_i64 text_layout_get_visible_range(Application_Links *app, Text_Layout_ID text_layout_id){return(app->text_layout_get_visible_range(app, text_layout_id));} -static Rect_f32 text_layout_line_on_screen(Application_Links *app, Text_Layout_ID layout_id, i64 line_number){return(app->text_layout_line_on_screen(app, layout_id, line_number));} -static Rect_f32 text_layout_character_on_screen(Application_Links *app, Text_Layout_ID layout_id, i64 pos){return(app->text_layout_character_on_screen(app, layout_id, pos));} -static void paint_text_color(Application_Links *app, Text_Layout_ID layout_id, Interval_i64 range, int_color color){(app->paint_text_color(app, layout_id, range, color));} -static b32 text_layout_free(Application_Links *app, Text_Layout_ID text_layout_id){return(app->text_layout_free(app, text_layout_id));} -static void draw_text_layout(Application_Links *app, Text_Layout_ID layout_id){(app->draw_text_layout(app, layout_id));} -static void open_color_picker(Application_Links *app, Color_Picker *picker){(app->open_color_picker(app, picker));} -static void animate_in_n_milliseconds(Application_Links *app, u32 n){(app->animate_in_n_milliseconds(app, n));} -static String_Match_List buffer_find_all_matches(Application_Links *app, Arena *arena, Buffer_ID buffer, i32 string_id, Range_i64 range, String_Const_u8 needle, Character_Predicate *predicate, Scan_Direction direction){return(app->buffer_find_all_matches(app, arena, buffer, string_id, range, needle, predicate, direction));} -#else + app_links->global_set_setting_ = Global_Set_Setting;\ + app_links->global_set_mapping_ = Global_Set_Mapping;\ + app_links->global_get_screen_rectangle_ = Global_Get_Screen_Rectangle;\ + app_links->context_get_arena_ = Context_Get_Arena;\ + app_links->context_get_base_allocator_ = Context_Get_Base_Allocator;\ + app_links->create_child_process_ = Create_Child_Process;\ + app_links->child_process_set_target_buffer_ = Child_Process_Set_Target_Buffer;\ + app_links->buffer_get_attached_child_process_ = Buffer_Get_Attached_Child_Process;\ + app_links->child_process_get_attached_buffer_ = Child_Process_Get_Attached_Buffer;\ + app_links->child_process_get_state_ = Child_Process_Get_State;\ + app_links->clipboard_post_ = Clipboard_Post;\ + app_links->clipboard_count_ = Clipboard_Count;\ + app_links->push_clipboard_index_ = Push_Clipboard_Index;\ + app_links->get_buffer_count_ = Get_Buffer_Count;\ + app_links->get_buffer_next_ = Get_Buffer_Next;\ + app_links->get_buffer_by_name_ = Get_Buffer_By_Name;\ + app_links->get_buffer_by_file_name_ = Get_Buffer_By_File_Name;\ + app_links->buffer_read_range_ = Buffer_Read_Range;\ + app_links->buffer_replace_range_ = Buffer_Replace_Range;\ + app_links->buffer_batch_edit_ = Buffer_Batch_Edit;\ + app_links->buffer_seek_string_ = Buffer_Seek_String;\ + app_links->buffer_seek_character_class_ = Buffer_Seek_Character_Class;\ + app_links->buffer_line_y_difference_ = Buffer_Line_Y_Difference;\ + app_links->buffer_line_shift_y_ = Buffer_Line_Shift_Y;\ + app_links->buffer_pos_at_relative_xy_ = Buffer_Pos_At_Relative_XY;\ + app_links->buffer_relative_xy_of_pos_ = Buffer_Relative_XY_Of_Pos;\ + app_links->buffer_relative_character_from_pos_ = Buffer_Relative_Character_From_Pos;\ + app_links->buffer_pos_from_relative_character_ = Buffer_Pos_From_Relative_Character;\ + app_links->view_line_y_difference_ = View_Line_Y_Difference;\ + app_links->view_line_shift_y_ = View_Line_Shift_Y;\ + app_links->view_pos_at_relative_xy_ = View_Pos_At_Relative_XY;\ + app_links->view_relative_xy_of_pos_ = View_Relative_XY_Of_Pos;\ + app_links->view_relative_character_from_pos_ = View_Relative_Character_From_Pos;\ + app_links->view_pos_from_relative_character_ = View_Pos_From_Relative_Character;\ + app_links->buffer_exists_ = Buffer_Exists;\ + app_links->buffer_ready_ = Buffer_Ready;\ + app_links->buffer_get_access_flags_ = Buffer_Get_Access_Flags;\ + app_links->buffer_get_size_ = Buffer_Get_Size;\ + app_links->buffer_get_line_count_ = Buffer_Get_Line_Count;\ + app_links->push_buffer_base_name_ = Push_Buffer_Base_Name;\ + app_links->push_buffer_unique_name_ = Push_Buffer_Unique_Name;\ + app_links->push_buffer_file_name_ = Push_Buffer_File_Name;\ + app_links->buffer_get_dirty_state_ = Buffer_Get_Dirty_State;\ + app_links->buffer_set_dirty_state_ = Buffer_Set_Dirty_State;\ + app_links->buffer_get_setting_ = Buffer_Get_Setting;\ + app_links->buffer_set_setting_ = Buffer_Set_Setting;\ + app_links->buffer_get_managed_scope_ = Buffer_Get_Managed_Scope;\ + app_links->buffer_send_end_signal_ = Buffer_Send_End_Signal;\ + app_links->create_buffer_ = Create_Buffer;\ + app_links->buffer_save_ = Buffer_Save;\ + app_links->buffer_kill_ = Buffer_Kill;\ + app_links->buffer_reopen_ = Buffer_Reopen;\ + app_links->buffer_get_file_attributes_ = Buffer_Get_File_Attributes;\ + app_links->get_file_attributes_ = Get_File_Attributes;\ + app_links->get_view_next_ = Get_View_Next;\ + app_links->get_view_prev_ = Get_View_Prev;\ + app_links->get_active_view_ = Get_Active_View;\ + app_links->get_active_panel_ = Get_Active_Panel;\ + app_links->view_exists_ = View_Exists;\ + app_links->view_get_buffer_ = View_Get_Buffer;\ + app_links->view_get_cursor_pos_ = View_Get_Cursor_Pos;\ + app_links->view_get_mark_pos_ = View_Get_Mark_Pos;\ + app_links->view_get_preferred_x_ = View_Get_Preferred_X;\ + app_links->view_set_preferred_x_ = View_Set_Preferred_X;\ + app_links->view_get_screen_rect_ = View_Get_Screen_Rect;\ + app_links->view_get_panel_ = View_Get_Panel;\ + app_links->panel_get_view_ = Panel_Get_View;\ + app_links->panel_is_split_ = Panel_Is_Split;\ + app_links->panel_is_leaf_ = Panel_Is_Leaf;\ + app_links->panel_split_ = Panel_Split;\ + app_links->panel_set_split_ = Panel_Set_Split;\ + app_links->panel_swap_children_ = Panel_Swap_Children;\ + app_links->panel_get_parent_ = Panel_Get_Parent;\ + app_links->panel_get_child_ = Panel_Get_Child;\ + app_links->panel_get_max_ = Panel_Get_Max;\ + app_links->panel_get_margin_ = Panel_Get_Margin;\ + app_links->view_close_ = View_Close;\ + app_links->view_get_buffer_region_ = View_Get_Buffer_Region;\ + app_links->view_get_buffer_scroll_ = View_Get_Buffer_Scroll;\ + app_links->view_get_basic_scroll_ = View_Get_Basic_Scroll;\ + app_links->view_set_active_ = View_Set_Active;\ + app_links->view_get_setting_ = View_Get_Setting;\ + app_links->view_set_setting_ = View_Set_Setting;\ + app_links->view_get_managed_scope_ = View_Get_Managed_Scope;\ + app_links->buffer_compute_cursor_ = Buffer_Compute_Cursor;\ + app_links->view_compute_cursor_ = View_Compute_Cursor;\ + app_links->view_set_cursor_ = View_Set_Cursor;\ + app_links->view_set_buffer_scroll_ = View_Set_Buffer_Scroll;\ + app_links->view_set_basic_scroll_ = View_Set_Basic_Scroll;\ + app_links->view_set_mark_ = View_Set_Mark;\ + app_links->view_set_buffer_ = View_Set_Buffer;\ + app_links->view_post_fade_ = View_Post_Fade;\ + app_links->view_begin_ui_mode_ = View_Begin_UI_Mode;\ + app_links->view_end_ui_mode_ = View_End_UI_Mode;\ + app_links->view_is_in_ui_mode_ = View_Is_In_UI_Mode;\ + app_links->view_set_quit_ui_handler_ = View_Set_Quit_UI_Handler;\ + app_links->view_get_quit_ui_handler_ = View_Get_Quit_UI_Handler;\ + app_links->create_user_managed_scope_ = Create_User_Managed_Scope;\ + app_links->destroy_user_managed_scope_ = Destroy_User_Managed_Scope;\ + app_links->get_global_managed_scope_ = Get_Global_Managed_Scope;\ + app_links->get_managed_scope_with_multiple_dependencies_ = Get_Managed_Scope_With_Multiple_Dependencies;\ + app_links->managed_scope_clear_contents_ = Managed_Scope_Clear_Contents;\ + app_links->managed_scope_clear_self_all_dependent_scopes_ = Managed_Scope_Clear_Self_All_Dependent_Scopes;\ + app_links->managed_scope_allocator_ = Managed_Scope_Allocator;\ + app_links->managed_id_declare_ = Managed_Id_Declare;\ + app_links->managed_scope_get_attachment_ = Managed_Scope_Get_Attachment;\ + app_links->managed_scope_attachment_erase_ = Managed_Scope_Attachment_Erase;\ + app_links->alloc_managed_memory_in_scope_ = Alloc_Managed_Memory_In_Scope;\ + app_links->alloc_buffer_markers_on_buffer_ = Alloc_Buffer_Markers_On_Buffer;\ + app_links->managed_object_get_item_size_ = Managed_Object_Get_Item_Size;\ + app_links->managed_object_get_item_count_ = Managed_Object_Get_Item_Count;\ + app_links->managed_object_get_pointer_ = Managed_Object_Get_Pointer;\ + app_links->managed_object_get_type_ = Managed_Object_Get_Type;\ + app_links->managed_object_get_containing_scope_ = Managed_Object_Get_Containing_Scope;\ + app_links->managed_object_free_ = Managed_Object_Free;\ + app_links->managed_object_store_data_ = Managed_Object_Store_Data;\ + app_links->managed_object_load_data_ = Managed_Object_Load_Data;\ + app_links->get_user_input_ = Get_User_Input;\ + app_links->get_command_input_ = Get_Command_Input;\ + app_links->set_command_input_ = Set_Command_Input;\ + app_links->get_mouse_state_ = Get_Mouse_State;\ + app_links->get_active_query_bars_ = Get_Active_Query_Bars;\ + app_links->start_query_bar_ = Start_Query_Bar;\ + app_links->end_query_bar_ = End_Query_Bar;\ + app_links->print_message_ = Print_Message;\ + app_links->log_string_ = Log_String;\ + app_links->thread_get_id_ = Thread_Get_ID;\ + app_links->get_largest_face_id_ = Get_Largest_Face_ID;\ + app_links->set_global_face_ = Set_Global_Face;\ + app_links->buffer_history_get_max_record_index_ = Buffer_History_Get_Max_Record_Index;\ + app_links->buffer_history_get_record_info_ = Buffer_History_Get_Record_Info;\ + app_links->buffer_history_get_group_sub_record_ = Buffer_History_Get_Group_Sub_Record;\ + app_links->buffer_history_get_current_state_index_ = Buffer_History_Get_Current_State_Index;\ + app_links->buffer_history_set_current_state_index_ = Buffer_History_Set_Current_State_Index;\ + app_links->buffer_history_merge_record_range_ = Buffer_History_Merge_Record_Range;\ + app_links->buffer_history_clear_after_current_state_ = Buffer_History_Clear_After_Current_State;\ + app_links->global_history_edit_group_begin_ = Global_History_Edit_Group_Begin;\ + app_links->global_history_edit_group_end_ = Global_History_Edit_Group_End;\ + app_links->buffer_set_face_ = Buffer_Set_Face;\ + app_links->get_face_description_ = Get_Face_Description;\ + app_links->get_face_metrics_ = Get_Face_Metrics;\ + app_links->get_face_id_ = Get_Face_ID;\ + app_links->try_create_new_face_ = Try_Create_New_Face;\ + app_links->try_modify_face_ = Try_Modify_Face;\ + app_links->try_release_face_ = Try_Release_Face;\ + app_links->set_theme_colors_ = Set_Theme_Colors;\ + app_links->get_theme_colors_ = Get_Theme_Colors;\ + app_links->finalize_color_ = Finalize_Color;\ + app_links->push_hot_directory_ = Push_Hot_Directory;\ + app_links->set_hot_directory_ = Set_Hot_Directory;\ + app_links->get_file_list_ = Get_File_List;\ + app_links->set_gui_up_down_keys_ = Set_GUI_Up_Down_Keys;\ + app_links->memory_allocate_ = Memory_Allocate;\ + app_links->memory_set_protection_ = Memory_Set_Protection;\ + app_links->memory_free_ = Memory_Free;\ + app_links->push_4ed_path_ = Push_4ed_Path;\ + app_links->show_mouse_cursor_ = Show_Mouse_Cursor;\ + app_links->set_edit_finished_hook_repeat_speed_ = Set_Edit_Finished_Hook_Repeat_Speed;\ + app_links->set_fullscreen_ = Set_Fullscreen;\ + app_links->is_fullscreen_ = Is_Fullscreen;\ + app_links->send_exit_signal_ = Send_Exit_Signal;\ + app_links->set_window_title_ = Set_Window_Title;\ + app_links->get_microseconds_timestamp_ = Get_Microseconds_Timestamp;\ + app_links->draw_string_ = Draw_String;\ + app_links->get_string_advance_ = Get_String_Advance;\ + app_links->draw_rectangle_ = Draw_Rectangle;\ + app_links->draw_rectangle_outline_ = Draw_Rectangle_Outline;\ + app_links->draw_clip_push_ = Draw_Clip_Push;\ + app_links->draw_clip_pop_ = Draw_Clip_Pop;\ + app_links->draw_coordinate_center_push_ = Draw_Coordinate_Center_Push;\ + app_links->draw_coordinate_center_pop_ = Draw_Coordinate_Center_Pop;\ + app_links->text_layout_create_ = Text_Layout_Create;\ + app_links->text_layout_get_buffer_ = Text_Layout_Get_Buffer;\ + app_links->text_layout_get_visible_range_ = Text_Layout_Get_Visible_Range;\ + app_links->text_layout_line_on_screen_ = Text_Layout_Line_On_Screen;\ + app_links->text_layout_character_on_screen_ = Text_Layout_Character_On_Screen;\ + app_links->paint_text_color_ = Paint_Text_Color;\ + app_links->text_layout_free_ = Text_Layout_Free;\ + app_links->draw_text_layout_ = Draw_Text_Layout;\ + app_links->open_color_picker_ = Open_Color_Picker;\ + app_links->animate_in_n_milliseconds_ = Animate_In_N_Milliseconds;\ + app_links->buffer_find_all_matches_ = Buffer_Find_All_Matches;\ +} while(false) static b32 global_set_setting(Application_Links *app, Global_Setting_ID setting, i32 value){return(app->global_set_setting_(app, setting, value));} static b32 global_set_mapping(Application_Links *app, void *data, i32 size){return(app->global_set_mapping_(app, data, size));} static Rect_f32 global_get_screen_rectangle(Application_Links *app){return(app->global_get_screen_rectangle_(app));} @@ -1287,4 +919,3 @@ static void draw_text_layout(Application_Links *app, Text_Layout_ID layout_id){( static void open_color_picker(Application_Links *app, Color_Picker *picker){(app->open_color_picker_(app, picker));} static void animate_in_n_milliseconds(Application_Links *app, u32 n){(app->animate_in_n_milliseconds_(app, n));} static String_Match_List buffer_find_all_matches(Application_Links *app, Arena *arena, Buffer_ID buffer, i32 string_id, Range_i64 range, String_Const_u8 needle, Character_Predicate *predicate, Scan_Direction direction){return(app->buffer_find_all_matches_(app, arena, buffer, string_id, range, needle, predicate, direction));} -#endif diff --git a/4coder_generated/command_metadata.h b/4coder_generated/command_metadata.h index e7e1aebb..100127e4 100644 --- a/4coder_generated/command_metadata.h +++ b/4coder_generated/command_metadata.h @@ -2,723 +2,24 @@ #define command_id(c) (fcoder_metacmd_ID_##c) #define command_metadata(c) (&fcoder_metacmd_table[command_id(c)]) #define command_metadata_by_id(id) (&fcoder_metacmd_table[id]) -#define command_one_past_last_id 233 +#define command_one_past_last_id 0 #if defined(CUSTOM_COMMAND_SIG) #define PROC_LINKS(x,y) x #else #define PROC_LINKS(x,y) y #endif #if defined(CUSTOM_COMMAND_SIG) -CUSTOM_COMMAND_SIG(write_explicit_enum_flags); -CUSTOM_COMMAND_SIG(seek_beginning_of_textual_line); -CUSTOM_COMMAND_SIG(seek_end_of_textual_line); -CUSTOM_COMMAND_SIG(seek_beginning_of_line); -CUSTOM_COMMAND_SIG(seek_end_of_line); -CUSTOM_COMMAND_SIG(goto_beginning_of_file); -CUSTOM_COMMAND_SIG(goto_end_of_file); -CUSTOM_COMMAND_SIG(change_active_panel); -CUSTOM_COMMAND_SIG(change_active_panel_backwards); -CUSTOM_COMMAND_SIG(open_panel_vsplit); -CUSTOM_COMMAND_SIG(open_panel_hsplit); -CUSTOM_COMMAND_SIG(suppress_mouse); -CUSTOM_COMMAND_SIG(allow_mouse); -CUSTOM_COMMAND_SIG(toggle_mouse); -CUSTOM_COMMAND_SIG(set_mode_to_original); -CUSTOM_COMMAND_SIG(set_mode_to_notepad_like); -CUSTOM_COMMAND_SIG(toggle_highlight_line_at_cursor); -CUSTOM_COMMAND_SIG(toggle_highlight_enclosing_scopes); -CUSTOM_COMMAND_SIG(toggle_paren_matching_helper); -CUSTOM_COMMAND_SIG(toggle_fullscreen); -CUSTOM_COMMAND_SIG(remap_interactive); -CUSTOM_COMMAND_SIG(write_character); -CUSTOM_COMMAND_SIG(write_underscore); -CUSTOM_COMMAND_SIG(delete_char); -CUSTOM_COMMAND_SIG(backspace_char); -CUSTOM_COMMAND_SIG(set_mark); -CUSTOM_COMMAND_SIG(cursor_mark_swap); -CUSTOM_COMMAND_SIG(delete_range); -CUSTOM_COMMAND_SIG(backspace_alpha_numeric_boundary); -CUSTOM_COMMAND_SIG(delete_alpha_numeric_boundary); -CUSTOM_COMMAND_SIG(snipe_backward_whitespace_or_token_boundary); -CUSTOM_COMMAND_SIG(snipe_forward_whitespace_or_token_boundary); -CUSTOM_COMMAND_SIG(center_view); -CUSTOM_COMMAND_SIG(left_adjust_view); -CUSTOM_COMMAND_SIG(click_set_cursor_and_mark); -CUSTOM_COMMAND_SIG(click_set_cursor); -CUSTOM_COMMAND_SIG(click_set_cursor_if_lbutton); -CUSTOM_COMMAND_SIG(click_set_mark); -CUSTOM_COMMAND_SIG(mouse_wheel_scroll); -CUSTOM_COMMAND_SIG(move_up); -CUSTOM_COMMAND_SIG(move_down); -CUSTOM_COMMAND_SIG(move_up_10); -CUSTOM_COMMAND_SIG(move_down_10); -CUSTOM_COMMAND_SIG(move_down_textual); -CUSTOM_COMMAND_SIG(page_up); -CUSTOM_COMMAND_SIG(page_down); -CUSTOM_COMMAND_SIG(move_up_to_blank_line); -CUSTOM_COMMAND_SIG(move_down_to_blank_line); -CUSTOM_COMMAND_SIG(move_up_to_blank_line_skip_whitespace); -CUSTOM_COMMAND_SIG(move_down_to_blank_line_skip_whitespace); -CUSTOM_COMMAND_SIG(move_up_to_blank_line_end); -CUSTOM_COMMAND_SIG(move_down_to_blank_line_end); -CUSTOM_COMMAND_SIG(move_left); -CUSTOM_COMMAND_SIG(move_right); -CUSTOM_COMMAND_SIG(move_right_whitespace_boundary); -CUSTOM_COMMAND_SIG(move_left_whitespace_boundary); -CUSTOM_COMMAND_SIG(move_right_token_boundary); -CUSTOM_COMMAND_SIG(move_left_token_boundary); -CUSTOM_COMMAND_SIG(move_right_whitespace_or_token_boundary); -CUSTOM_COMMAND_SIG(move_left_whitespace_or_token_boundary); -CUSTOM_COMMAND_SIG(move_right_alpha_numeric_boundary); -CUSTOM_COMMAND_SIG(move_left_alpha_numeric_boundary); -CUSTOM_COMMAND_SIG(move_right_alpha_numeric_or_camel_boundary); -CUSTOM_COMMAND_SIG(move_left_alpha_numeric_or_camel_boundary); -CUSTOM_COMMAND_SIG(select_all); -CUSTOM_COMMAND_SIG(to_uppercase); -CUSTOM_COMMAND_SIG(to_lowercase); -CUSTOM_COMMAND_SIG(clean_all_lines); -CUSTOM_COMMAND_SIG(basic_change_active_panel); -CUSTOM_COMMAND_SIG(close_panel); -CUSTOM_COMMAND_SIG(show_scrollbar); -CUSTOM_COMMAND_SIG(hide_scrollbar); -CUSTOM_COMMAND_SIG(show_filebar); -CUSTOM_COMMAND_SIG(hide_filebar); -CUSTOM_COMMAND_SIG(toggle_filebar); -CUSTOM_COMMAND_SIG(toggle_line_wrap); -CUSTOM_COMMAND_SIG(toggle_fps_meter); -CUSTOM_COMMAND_SIG(increase_line_wrap); -CUSTOM_COMMAND_SIG(decrease_line_wrap); -CUSTOM_COMMAND_SIG(increase_face_size); -CUSTOM_COMMAND_SIG(decrease_face_size); -CUSTOM_COMMAND_SIG(mouse_wheel_change_face_size); -CUSTOM_COMMAND_SIG(toggle_virtual_whitespace); -CUSTOM_COMMAND_SIG(toggle_show_whitespace); -CUSTOM_COMMAND_SIG(toggle_line_numbers); -CUSTOM_COMMAND_SIG(eol_dosify); -CUSTOM_COMMAND_SIG(eol_nixify); -CUSTOM_COMMAND_SIG(exit_4coder); -CUSTOM_COMMAND_SIG(goto_line); -CUSTOM_COMMAND_SIG(search); -CUSTOM_COMMAND_SIG(reverse_search); -CUSTOM_COMMAND_SIG(search_identifier); -CUSTOM_COMMAND_SIG(reverse_search_identifier); -CUSTOM_COMMAND_SIG(replace_in_range); -CUSTOM_COMMAND_SIG(replace_in_buffer); -CUSTOM_COMMAND_SIG(replace_in_all_buffers); -CUSTOM_COMMAND_SIG(query_replace); -CUSTOM_COMMAND_SIG(query_replace_identifier); -CUSTOM_COMMAND_SIG(query_replace_selection); -CUSTOM_COMMAND_SIG(save_all_dirty_buffers); -CUSTOM_COMMAND_SIG(delete_file_query); -CUSTOM_COMMAND_SIG(save_to_query); -CUSTOM_COMMAND_SIG(rename_file_query); -CUSTOM_COMMAND_SIG(make_directory_query); -CUSTOM_COMMAND_SIG(move_line_up); -CUSTOM_COMMAND_SIG(move_line_down); -CUSTOM_COMMAND_SIG(duplicate_line); -CUSTOM_COMMAND_SIG(delete_line); -CUSTOM_COMMAND_SIG(open_file_in_quotes); -CUSTOM_COMMAND_SIG(open_matching_file_cpp); -CUSTOM_COMMAND_SIG(view_buffer_other_panel); -CUSTOM_COMMAND_SIG(swap_buffers_between_panels); -CUSTOM_COMMAND_SIG(kill_buffer); -CUSTOM_COMMAND_SIG(save); -CUSTOM_COMMAND_SIG(reopen); -CUSTOM_COMMAND_SIG(undo); -CUSTOM_COMMAND_SIG(redo); -CUSTOM_COMMAND_SIG(undo_all_buffers); -CUSTOM_COMMAND_SIG(redo_all_buffers); -CUSTOM_COMMAND_SIG(open_in_other); -CUSTOM_COMMAND_SIG(lister__quit); -CUSTOM_COMMAND_SIG(lister__activate); -CUSTOM_COMMAND_SIG(lister__write_character); -CUSTOM_COMMAND_SIG(lister__backspace_text_field); -CUSTOM_COMMAND_SIG(lister__move_up); -CUSTOM_COMMAND_SIG(lister__move_down); -CUSTOM_COMMAND_SIG(lister__wheel_scroll); -CUSTOM_COMMAND_SIG(lister__mouse_press); -CUSTOM_COMMAND_SIG(lister__mouse_release); -CUSTOM_COMMAND_SIG(lister__repaint); -CUSTOM_COMMAND_SIG(lister__write_character__default); -CUSTOM_COMMAND_SIG(lister__backspace_text_field__default); -CUSTOM_COMMAND_SIG(lister__move_up__default); -CUSTOM_COMMAND_SIG(lister__move_down__default); -CUSTOM_COMMAND_SIG(lister__write_character__file_path); -CUSTOM_COMMAND_SIG(lister__backspace_text_field__file_path); -CUSTOM_COMMAND_SIG(lister__write_character__fixed_list); -CUSTOM_COMMAND_SIG(interactive_switch_buffer); -CUSTOM_COMMAND_SIG(interactive_kill_buffer); -CUSTOM_COMMAND_SIG(interactive_open_or_new); -CUSTOM_COMMAND_SIG(interactive_new); -CUSTOM_COMMAND_SIG(interactive_open); -CUSTOM_COMMAND_SIG(command_lister); -CUSTOM_COMMAND_SIG(auto_tab_whole_file); -CUSTOM_COMMAND_SIG(auto_tab_line_at_cursor); -CUSTOM_COMMAND_SIG(auto_tab_range); -CUSTOM_COMMAND_SIG(write_and_auto_tab); -CUSTOM_COMMAND_SIG(list_all_locations); -CUSTOM_COMMAND_SIG(list_all_substring_locations); -CUSTOM_COMMAND_SIG(list_all_locations_case_insensitive); -CUSTOM_COMMAND_SIG(list_all_substring_locations_case_insensitive); -CUSTOM_COMMAND_SIG(list_all_locations_of_identifier); -CUSTOM_COMMAND_SIG(list_all_locations_of_identifier_case_insensitive); -CUSTOM_COMMAND_SIG(list_all_locations_of_selection); -CUSTOM_COMMAND_SIG(list_all_locations_of_selection_case_insensitive); -CUSTOM_COMMAND_SIG(list_all_locations_of_type_definition); -CUSTOM_COMMAND_SIG(list_all_locations_of_type_definition_of_identifier); -CUSTOM_COMMAND_SIG(word_complete); -CUSTOM_COMMAND_SIG(goto_jump_at_cursor); -CUSTOM_COMMAND_SIG(goto_jump_at_cursor_same_panel); -CUSTOM_COMMAND_SIG(goto_next_jump); -CUSTOM_COMMAND_SIG(goto_prev_jump); -CUSTOM_COMMAND_SIG(goto_next_jump_no_skips); -CUSTOM_COMMAND_SIG(goto_prev_jump_no_skips); -CUSTOM_COMMAND_SIG(goto_first_jump); -CUSTOM_COMMAND_SIG(goto_first_jump_same_panel_sticky); -CUSTOM_COMMAND_SIG(newline_or_goto_position); -CUSTOM_COMMAND_SIG(newline_or_goto_position_same_panel); -CUSTOM_COMMAND_SIG(view_jump_list_with_lister); -CUSTOM_COMMAND_SIG(log_graph__escape); -CUSTOM_COMMAND_SIG(log_graph__scroll_wheel); -CUSTOM_COMMAND_SIG(log_graph__page_up); -CUSTOM_COMMAND_SIG(log_graph__page_down); -CUSTOM_COMMAND_SIG(log_graph__click_select_event); -CUSTOM_COMMAND_SIG(log_graph__click_jump_to_event_source); -CUSTOM_COMMAND_SIG(show_the_log_graph); -CUSTOM_COMMAND_SIG(copy); -CUSTOM_COMMAND_SIG(cut); -CUSTOM_COMMAND_SIG(paste); -CUSTOM_COMMAND_SIG(paste_next); -CUSTOM_COMMAND_SIG(paste_and_indent); -CUSTOM_COMMAND_SIG(paste_next_and_indent); -CUSTOM_COMMAND_SIG(execute_previous_cli); -CUSTOM_COMMAND_SIG(execute_any_cli); -CUSTOM_COMMAND_SIG(build_search); -CUSTOM_COMMAND_SIG(build_in_build_panel); -CUSTOM_COMMAND_SIG(close_build_panel); -CUSTOM_COMMAND_SIG(change_to_build_panel); -CUSTOM_COMMAND_SIG(close_all_code); -CUSTOM_COMMAND_SIG(open_all_code); -CUSTOM_COMMAND_SIG(open_all_code_recursive); -CUSTOM_COMMAND_SIG(load_project); -CUSTOM_COMMAND_SIG(project_fkey_command); -CUSTOM_COMMAND_SIG(project_go_to_root_directory); -CUSTOM_COMMAND_SIG(setup_new_project); -CUSTOM_COMMAND_SIG(setup_build_bat); -CUSTOM_COMMAND_SIG(setup_build_sh); -CUSTOM_COMMAND_SIG(setup_build_bat_and_sh); -CUSTOM_COMMAND_SIG(project_command_lister); -CUSTOM_COMMAND_SIG(list_all_functions_current_buffer); -CUSTOM_COMMAND_SIG(list_all_functions_current_buffer_lister); -CUSTOM_COMMAND_SIG(list_all_functions_all_buffers); -CUSTOM_COMMAND_SIG(list_all_functions_all_buffers_lister); -CUSTOM_COMMAND_SIG(select_surrounding_scope); -CUSTOM_COMMAND_SIG(select_next_scope_absolute); -CUSTOM_COMMAND_SIG(select_prev_scope_absolute); -CUSTOM_COMMAND_SIG(place_in_scope); -CUSTOM_COMMAND_SIG(delete_current_scope); -CUSTOM_COMMAND_SIG(scope_absorb_down); -CUSTOM_COMMAND_SIG(open_long_braces); -CUSTOM_COMMAND_SIG(open_long_braces_semicolon); -CUSTOM_COMMAND_SIG(open_long_braces_break); -CUSTOM_COMMAND_SIG(if0_off); -CUSTOM_COMMAND_SIG(write_todo); -CUSTOM_COMMAND_SIG(write_hack); -CUSTOM_COMMAND_SIG(write_note); -CUSTOM_COMMAND_SIG(write_block); -CUSTOM_COMMAND_SIG(write_zero_struct); -CUSTOM_COMMAND_SIG(comment_line); -CUSTOM_COMMAND_SIG(uncomment_line); -CUSTOM_COMMAND_SIG(comment_line_toggle); -CUSTOM_COMMAND_SIG(snippet_lister); -CUSTOM_COMMAND_SIG(set_bindings_choose); -CUSTOM_COMMAND_SIG(set_bindings_default); -CUSTOM_COMMAND_SIG(set_bindings_mac_default); -CUSTOM_COMMAND_SIG(miblo_increment_basic); -CUSTOM_COMMAND_SIG(miblo_decrement_basic); -CUSTOM_COMMAND_SIG(miblo_increment_time_stamp); -CUSTOM_COMMAND_SIG(miblo_decrement_time_stamp); -CUSTOM_COMMAND_SIG(miblo_increment_time_stamp_minute); -CUSTOM_COMMAND_SIG(miblo_decrement_time_stamp_minute); -CUSTOM_COMMAND_SIG(rename_parameter); -CUSTOM_COMMAND_SIG(write_explicit_enum_values); #endif struct Command_Metadata{ PROC_LINKS(Custom_Command_Function, void) *proc; char *name; -int32_t name_len; +i32 name_len; char *description; -int32_t description_len; +i32 description_len; char *source_name; -int32_t source_name_len; -int32_t line_number; +i32 source_name_len; +i32 line_number; }; -static Command_Metadata fcoder_metacmd_table[233] = { -{ PROC_LINKS(write_explicit_enum_flags, 0), "write_explicit_enum_flags", 25, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in to give each a unique power of 2 value, starting from 1. Existing values are overwritten.", 194, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 502 }, -{ PROC_LINKS(seek_beginning_of_textual_line, 0), "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "w:\\4ed\\code\\4coder_seek.cpp", 27, 29 }, -{ PROC_LINKS(seek_end_of_textual_line, 0), "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "w:\\4ed\\code\\4coder_seek.cpp", 27, 35 }, -{ PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "w:\\4ed\\code\\4coder_seek.cpp", 27, 41 }, -{ PROC_LINKS(seek_end_of_line, 0), "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "w:\\4ed\\code\\4coder_seek.cpp", 27, 47 }, -{ PROC_LINKS(goto_beginning_of_file, 0), "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "w:\\4ed\\code\\4coder_seek.cpp", 27, 53 }, -{ PROC_LINKS(goto_end_of_file, 0), "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "w:\\4ed\\code\\4coder_seek.cpp", 27, 61 }, -{ PROC_LINKS(change_active_panel, 0), "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 201 }, -{ PROC_LINKS(change_active_panel_backwards, 0), "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 211 }, -{ PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 221 }, -{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 231 }, -{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 294 }, -{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 300 }, -{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 306 }, -{ PROC_LINKS(set_mode_to_original, 0), "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 312 }, -{ PROC_LINKS(set_mode_to_notepad_like, 0), "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 318 }, -{ PROC_LINKS(toggle_highlight_line_at_cursor, 0), "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 324 }, -{ PROC_LINKS(toggle_highlight_enclosing_scopes, 0), "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 330 }, -{ PROC_LINKS(toggle_paren_matching_helper, 0), "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 336 }, -{ PROC_LINKS(toggle_fullscreen, 0), "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 342 }, -{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 350 }, -{ PROC_LINKS(write_character, 0), "write_character", 15, "Inserts whatever character was used to trigger this command.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 57 }, -{ PROC_LINKS(write_underscore, 0), "write_underscore", 16, "Inserts an underscore.", 22, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 66 }, -{ PROC_LINKS(delete_char, 0), "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 73 }, -{ PROC_LINKS(backspace_char, 0), "backspace_char", 14, "Deletes the character to the left of the cursor.", 48, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 90 }, -{ PROC_LINKS(set_mark, 0), "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 109 }, -{ PROC_LINKS(cursor_mark_swap, 0), "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 118 }, -{ PROC_LINKS(delete_range, 0), "delete_range", 12, "Deletes the text in the range between the cursor and the mark.", 62, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 128 }, -{ PROC_LINKS(backspace_alpha_numeric_boundary, 0), "backspace_alpha_numeric_boundary", 32, "Delete characters between the cursor position and the first alphanumeric boundary to the left.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 148 }, -{ PROC_LINKS(delete_alpha_numeric_boundary, 0), "delete_alpha_numeric_boundary", 29, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 156 }, -{ PROC_LINKS(snipe_backward_whitespace_or_token_boundary, 0), "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\\4coder_base_commands.cpp", 36, 176 }, -{ PROC_LINKS(snipe_forward_whitespace_or_token_boundary, 0), "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\\4coder_base_commands.cpp", 36, 184 }, -{ PROC_LINKS(center_view, 0), "center_view", 11, "Centers the view vertically on the line on which the cursor sits.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 197 }, -{ PROC_LINKS(left_adjust_view, 0), "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 211 }, -{ PROC_LINKS(click_set_cursor_and_mark, 0), "click_set_cursor_and_mark", 25, "Sets the cursor position and mark to the mouse position.", 56, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 223 }, -{ PROC_LINKS(click_set_cursor, 0), "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 235 }, -{ PROC_LINKS(click_set_cursor_if_lbutton, 0), "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\\4coder_base_commands.cpp", 36, 247 }, -{ PROC_LINKS(click_set_mark, 0), "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 261 }, -{ PROC_LINKS(mouse_wheel_scroll, 0), "mouse_wheel_scroll", 18, "Reads the scroll wheel value from the mouse state and scrolls accordingly.", 74, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 273 }, -{ PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 334 }, -{ PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 340 }, -{ PROC_LINKS(move_up_10, 0), "move_up_10", 10, "Moves the cursor up ten lines.", 30, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 346 }, -{ PROC_LINKS(move_down_10, 0), "move_down_10", 12, "Moves the cursor down ten lines.", 32, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 352 }, -{ PROC_LINKS(move_down_textual, 0), "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 358 }, -{ PROC_LINKS(page_up, 0), "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 368 }, -{ PROC_LINKS(page_down, 0), "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 376 }, -{ PROC_LINKS(move_up_to_blank_line, 0), "move_up_to_blank_line", 21, "Seeks the cursor up to the next blank line.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 405 }, -{ PROC_LINKS(move_down_to_blank_line, 0), "move_down_to_blank_line", 23, "Seeks the cursor down to the next blank line.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 411 }, -{ PROC_LINKS(move_up_to_blank_line_skip_whitespace, 0), "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\\4coder_base_commands.cpp", 36, 417 }, -{ PROC_LINKS(move_down_to_blank_line_skip_whitespace, 0), "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\\4coder_base_commands.cpp", 36, 423 }, -{ PROC_LINKS(move_up_to_blank_line_end, 0), "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\\4coder_base_commands.cpp", 36, 429 }, -{ PROC_LINKS(move_down_to_blank_line_end, 0), "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\\4coder_base_commands.cpp", 36, 435 }, -{ PROC_LINKS(move_left, 0), "move_left", 9, "Moves the cursor one character to the left.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 441 }, -{ PROC_LINKS(move_right, 0), "move_right", 10, "Moves the cursor one character to the right.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 453 }, -{ PROC_LINKS(move_right_whitespace_boundary, 0), "move_right_whitespace_boundary", 30, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 475 }, -{ PROC_LINKS(move_left_whitespace_boundary, 0), "move_left_whitespace_boundary", 29, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 483 }, -{ PROC_LINKS(move_right_token_boundary, 0), "move_right_token_boundary", 25, "Seek right for the next end of a token.", 39, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 491 }, -{ PROC_LINKS(move_left_token_boundary, 0), "move_left_token_boundary", 24, "Seek left for the next beginning of a token.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 499 }, -{ PROC_LINKS(move_right_whitespace_or_token_boundary, 0), "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\\4coder_base_commands.cpp", 36, 507 }, -{ PROC_LINKS(move_left_whitespace_or_token_boundary, 0), "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\\4coder_base_commands.cpp", 36, 515 }, -{ PROC_LINKS(move_right_alpha_numeric_boundary, 0), "move_right_alpha_numeric_boundary", 33, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 523 }, -{ PROC_LINKS(move_left_alpha_numeric_boundary, 0), "move_left_alpha_numeric_boundary", 32, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 531 }, -{ PROC_LINKS(move_right_alpha_numeric_or_camel_boundary, 0), "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\\4coder_base_commands.cpp", 36, 539 }, -{ PROC_LINKS(move_left_alpha_numeric_or_camel_boundary, 0), "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\\4coder_base_commands.cpp", 36, 547 }, -{ PROC_LINKS(select_all, 0), "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\\4coder_base_commands.cpp", 36, 568 }, -{ PROC_LINKS(to_uppercase, 0), "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 581 }, -{ PROC_LINKS(to_lowercase, 0), "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 594 }, -{ PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 607 }, -{ PROC_LINKS(basic_change_active_panel, 0), "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\\4coder_base_commands.cpp", 36, 641 }, -{ PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 649 }, -{ PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 658 }, -{ PROC_LINKS(hide_scrollbar, 0), "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 665 }, -{ PROC_LINKS(show_filebar, 0), "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 672 }, -{ PROC_LINKS(hide_filebar, 0), "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 679 }, -{ PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 686 }, -{ PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 695 }, -{ PROC_LINKS(toggle_fps_meter, 0), "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 708 }, -{ PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 714 }, -{ PROC_LINKS(decrease_line_wrap, 0), "decrease_line_wrap", 18, "Decrases the current buffer's width for line wrapping.", 54, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 727 }, -{ PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 740 }, -{ PROC_LINKS(decrease_face_size, 0), "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 751 }, -{ PROC_LINKS(mouse_wheel_change_face_size, 0), "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 762 }, -{ PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 779 }, -{ PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 789 }, -{ PROC_LINKS(toggle_line_numbers, 0), "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 798 }, -{ PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 804 }, -{ PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 812 }, -{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 820 }, -{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 828 }, -{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1039 }, -{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1045 }, -{ PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1051 }, -{ PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1062 }, -{ PROC_LINKS(replace_in_range, 0), "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\\4coder_base_commands.cpp", 36, 1113 }, -{ PROC_LINKS(replace_in_buffer, 0), "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\\4coder_base_commands.cpp", 36, 1122 }, -{ PROC_LINKS(replace_in_all_buffers, 0), "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\\4coder_base_commands.cpp", 36, 1131 }, -{ PROC_LINKS(query_replace, 0), "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\\4coder_base_commands.cpp", 36, 1219 }, -{ PROC_LINKS(query_replace_identifier, 0), "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\\4coder_base_commands.cpp", 36, 1239 }, -{ PROC_LINKS(query_replace_selection, 0), "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\\4coder_base_commands.cpp", 36, 1255 }, -{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1290 }, -{ PROC_LINKS(delete_file_query, 0), "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\\4coder_base_commands.cpp", 36, 1315 }, -{ PROC_LINKS(save_to_query, 0), "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\\4coder_base_commands.cpp", 36, 1353 }, -{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1388 }, -{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1428 }, -{ PROC_LINKS(move_line_up, 0), "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\\4coder_base_commands.cpp", 36, 1461 }, -{ PROC_LINKS(move_line_down, 0), "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\\4coder_base_commands.cpp", 36, 1467 }, -{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1473 }, -{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1487 }, -{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1552 }, -{ PROC_LINKS(open_matching_file_cpp, 0), "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\\4coder_base_commands.cpp", 36, 1584 }, -{ PROC_LINKS(view_buffer_other_panel, 0), "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\\4coder_base_commands.cpp", 36, 1597 }, -{ PROC_LINKS(swap_buffers_between_panels, 0), "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\\4coder_base_commands.cpp", 36, 1609 }, -{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1645 }, -{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1653 }, -{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1665 }, -{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1723 }, -{ PROC_LINKS(redo, 0), "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1736 }, -{ PROC_LINKS(undo_all_buffers, 0), "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1750 }, -{ PROC_LINKS(redo_all_buffers, 0), "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1824 }, -{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1927 }, -{ PROC_LINKS(lister__quit, 0), "lister__quit", 12, "A lister mode command that quits the list without executing any actions.", 72, "w:\\4ed\\code\\4coder_lists.cpp", 28, 8 }, -{ PROC_LINKS(lister__activate, 0), "lister__activate", 16, "A lister mode command that activates the list's action on the highlighted item.", 79, "w:\\4ed\\code\\4coder_lists.cpp", 28, 15 }, -{ PROC_LINKS(lister__write_character, 0), "lister__write_character", 23, "A lister mode command that dispatches to the lister's write character handler.", 78, "w:\\4ed\\code\\4coder_lists.cpp", 28, 30 }, -{ PROC_LINKS(lister__backspace_text_field, 0), "lister__backspace_text_field", 28, "A lister mode command that dispatches to the lister's backspace text field handler.", 83, "w:\\4ed\\code\\4coder_lists.cpp", 28, 40 }, -{ PROC_LINKS(lister__move_up, 0), "lister__move_up", 15, "A lister mode command that dispatches to the lister's navigate up handler.", 74, "w:\\4ed\\code\\4coder_lists.cpp", 28, 50 }, -{ PROC_LINKS(lister__move_down, 0), "lister__move_down", 17, "A lister mode command that dispatches to the lister's navigate down handler.", 76, "w:\\4ed\\code\\4coder_lists.cpp", 28, 60 }, -{ PROC_LINKS(lister__wheel_scroll, 0), "lister__wheel_scroll", 20, "A lister mode command that scrolls the list in response to the mouse wheel.", 75, "w:\\4ed\\code\\4coder_lists.cpp", 28, 70 }, -{ PROC_LINKS(lister__mouse_press, 0), "lister__mouse_press", 19, "A lister mode command that beings a click interaction with a list item under the mouse.", 87, "w:\\4ed\\code\\4coder_lists.cpp", 28, 84 }, -{ PROC_LINKS(lister__mouse_release, 0), "lister__mouse_release", 21, "A lister mode command that ends a click interaction with a list item under the mouse, possibly activating it.", 109, "w:\\4ed\\code\\4coder_lists.cpp", 28, 95 }, -{ PROC_LINKS(lister__repaint, 0), "lister__repaint", 15, "A lister mode command that updates the lists UI data.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 110 }, -{ PROC_LINKS(lister__write_character__default, 0), "lister__write_character__default", 32, "A lister mode command that inserts a new character to the text field.", 69, "w:\\4ed\\code\\4coder_lists.cpp", 28, 120 }, -{ PROC_LINKS(lister__backspace_text_field__default, 0), "lister__backspace_text_field__default", 37, "A lister mode command that backspaces one character from the text field.", 72, "w:\\4ed\\code\\4coder_lists.cpp", 28, 139 }, -{ PROC_LINKS(lister__move_up__default, 0), "lister__move_up__default", 24, "A lister mode command that moves the highlighted item one up in the list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 28, 153 }, -{ PROC_LINKS(lister__move_down__default, 0), "lister__move_down__default", 26, "A lister mode command that moves the highlighted item one down in the list.", 75, "w:\\4ed\\code\\4coder_lists.cpp", 28, 168 }, -{ PROC_LINKS(lister__write_character__file_path, 0), "lister__write_character__file_path", 34, "A lister mode command that inserts a character into the text field of a file system list.", 89, "w:\\4ed\\code\\4coder_lists.cpp", 28, 183 }, -{ PROC_LINKS(lister__backspace_text_field__file_path, 0), "lister__backspace_text_field__file_path", 39, "A lister mode command that backspaces one character from the text field of a file system list.", 94, "w:\\4ed\\code\\4coder_lists.cpp", 28, 208 }, -{ PROC_LINKS(lister__write_character__fixed_list, 0), "lister__write_character__fixed_list", 35, "A lister mode command that handles input for the fixed sure to kill list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 28, 249 }, -{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 723 }, -{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 28, 742 }, -{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 28, 815 }, -{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 854 }, -{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 887 }, -{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 969 }, -{ PROC_LINKS(auto_tab_whole_file, 0), "auto_tab_whole_file", 19, "Audo-indents the entire current buffer.", 39, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 526 }, -{ PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 535 }, -{ PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 545 }, -{ PROC_LINKS(write_and_auto_tab, 0), "write_and_auto_tab", 18, "Inserts a character and auto-indents the line on which the cursor sits.", 71, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 555 }, -{ PROC_LINKS(list_all_locations, 0), "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\\4coder_search.cpp", 29, 166 }, -{ PROC_LINKS(list_all_substring_locations, 0), "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\\4coder_search.cpp", 29, 172 }, -{ PROC_LINKS(list_all_locations_case_insensitive, 0), "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\\4coder_search.cpp", 29, 178 }, -{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), "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\\4coder_search.cpp", 29, 184 }, -{ PROC_LINKS(list_all_locations_of_identifier, 0), "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\\4coder_search.cpp", 29, 190 }, -{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), "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\\4coder_search.cpp", 29, 196 }, -{ PROC_LINKS(list_all_locations_of_selection, 0), "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\\4coder_search.cpp", 29, 202 }, -{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), "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\\4coder_search.cpp", 29, 208 }, -{ PROC_LINKS(list_all_locations_of_type_definition, 0), "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\\4coder_search.cpp", 29, 214 }, -{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), "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\\4coder_search.cpp", 29, 222 }, -{ PROC_LINKS(word_complete, 0), "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\\4coder_search.cpp", 29, 376 }, -{ PROC_LINKS(goto_jump_at_cursor, 0), "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\\4coder_jump_sticky.cpp", 34, 353 }, -{ PROC_LINKS(goto_jump_at_cursor_same_panel, 0), "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\\4coder_jump_sticky.cpp", 34, 380 }, -{ PROC_LINKS(goto_next_jump, 0), "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\\4coder_jump_sticky.cpp", 34, 469 }, -{ PROC_LINKS(goto_prev_jump, 0), "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\\4coder_jump_sticky.cpp", 34, 486 }, -{ PROC_LINKS(goto_next_jump_no_skips, 0), "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\\4coder_jump_sticky.cpp", 34, 499 }, -{ PROC_LINKS(goto_prev_jump_no_skips, 0), "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\\4coder_jump_sticky.cpp", 34, 516 }, -{ PROC_LINKS(goto_first_jump, 0), "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\\4coder_jump_sticky.cpp", 34, 530 }, -{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), "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\\4coder_jump_sticky.cpp", 34, 547 }, -{ PROC_LINKS(newline_or_goto_position, 0), "newline_or_goto_position", 24, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 569 }, -{ PROC_LINKS(newline_or_goto_position_same_panel, 0), "newline_or_goto_position_same_panel", 35, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 586 }, -{ PROC_LINKS(view_jump_list_with_lister, 0), "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\\4coder_jump_lister.cpp", 34, 104 }, -{ PROC_LINKS(log_graph__escape, 0), "log_graph__escape", 17, "Ends the log grapher", 20, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 906 }, -{ PROC_LINKS(log_graph__scroll_wheel, 0), "log_graph__scroll_wheel", 23, "Scrolls the log graph", 21, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 915 }, -{ PROC_LINKS(log_graph__page_up, 0), "log_graph__page_up", 18, "Scroll the log graph up one whole page", 38, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 926 }, -{ PROC_LINKS(log_graph__page_down, 0), "log_graph__page_down", 20, "Scroll the log graph down one whole page", 40, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 934 }, -{ PROC_LINKS(log_graph__click_select_event, 0), "log_graph__click_select_event", 29, "Select the event record at the mouse point in the log graph", 59, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 968 }, -{ PROC_LINKS(log_graph__click_jump_to_event_source, 0), "log_graph__click_jump_to_event_source", 37, "Jump to the code that logged the event record at the mouse point in the log graph", 81, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 987 }, -{ PROC_LINKS(show_the_log_graph, 0), "show_the_log_graph", 18, "Parser *log* and displays the 'log graph' UI", 44, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 1035 }, -{ PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 19 }, -{ PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 28 }, -{ PROC_LINKS(paste, 0), "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 39 }, -{ PROC_LINKS(paste_next, 0), "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\\4coder_clipboard.cpp", 32, 73 }, -{ PROC_LINKS(paste_and_indent, 0), "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 114 }, -{ PROC_LINKS(paste_next_and_indent, 0), "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\\4coder_clipboard.cpp", 32, 121 }, -{ PROC_LINKS(execute_previous_cli, 0), "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\\4coder_system_command.cpp", 37, 7 }, -{ PROC_LINKS(execute_any_cli, 0), "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\\4coder_system_command.cpp", 37, 22 }, -{ PROC_LINKS(build_search, 0), "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\\4coder_build_commands.cpp", 37, 128 }, -{ PROC_LINKS(build_in_build_panel, 0), "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\\4coder_build_commands.cpp", 37, 163 }, -{ PROC_LINKS(close_build_panel, 0), "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 178 }, -{ PROC_LINKS(change_to_build_panel, 0), "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 184 }, -{ PROC_LINKS(close_all_code, 0), "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\\4coder_project_commands.cpp", 39, 921 }, -{ PROC_LINKS(open_all_code, 0), "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\\4coder_project_commands.cpp", 39, 927 }, -{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 933 }, -{ PROC_LINKS(load_project, 0), "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 941 }, -{ PROC_LINKS(project_fkey_command, 0), "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\\4coder_project_commands.cpp", 39, 948 }, -{ PROC_LINKS(project_go_to_root_directory, 0), "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\\4coder_project_commands.cpp", 39, 971 }, -{ PROC_LINKS(setup_new_project, 0), "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\\4coder_project_commands.cpp", 39, 1306 }, -{ PROC_LINKS(setup_build_bat, 0), "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1313 }, -{ PROC_LINKS(setup_build_sh, 0), "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1319 }, -{ PROC_LINKS(setup_build_bat_and_sh, 0), "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1325 }, -{ PROC_LINKS(project_command_lister, 0), "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1340 }, -{ PROC_LINKS(list_all_functions_current_buffer, 0), "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\\4coder_function_list.cpp", 36, 276 }, -{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), "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\\4coder_function_list.cpp", 36, 286 }, -{ PROC_LINKS(list_all_functions_all_buffers, 0), "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 298 }, -{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 304 }, -{ PROC_LINKS(select_surrounding_scope, 0), "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\\4coder_scope_commands.cpp", 37, 352 }, -{ PROC_LINKS(select_next_scope_absolute, 0), "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\\4coder_scope_commands.cpp", 37, 367 }, -{ PROC_LINKS(select_prev_scope_absolute, 0), "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\\4coder_scope_commands.cpp", 37, 386 }, -{ PROC_LINKS(place_in_scope, 0), "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\\4coder_scope_commands.cpp", 37, 460 }, -{ PROC_LINKS(delete_current_scope, 0), "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 466 }, -{ PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 698 }, -{ PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 46 }, -{ PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 54 }, -{ PROC_LINKS(open_long_braces_break, 0), "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 62 }, -{ PROC_LINKS(if0_off, 0), "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 70 }, -{ PROC_LINKS(write_todo, 0), "write_todo", 10, "At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 76 }, -{ PROC_LINKS(write_hack, 0), "write_hack", 10, "At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 82 }, -{ PROC_LINKS(write_note, 0), "write_note", 10, "At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 88 }, -{ PROC_LINKS(write_block, 0), "write_block", 11, "At the cursor, insert a block comment.", 38, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 94 }, -{ PROC_LINKS(write_zero_struct, 0), "write_zero_struct", 17, "At the cursor, insert a ' = {};'.", 33, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 100 }, -{ PROC_LINKS(comment_line, 0), "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 125 }, -{ PROC_LINKS(uncomment_line, 0), "uncomment_line", 14, "If present, delete '//' at the beginning of the line after leading whitespace.", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 137 }, -{ PROC_LINKS(comment_line_toggle, 0), "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 149 }, -{ PROC_LINKS(snippet_lister, 0), "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 235 }, -{ PROC_LINKS(set_bindings_choose, 0), "set_bindings_choose", 19, "Remap keybindings using the 'choose' mapping rule.", 50, "w:\\4ed\\code\\4coder_remapping_commands.cpp", 41, 41 }, -{ PROC_LINKS(set_bindings_default, 0), "set_bindings_default", 20, "Remap keybindings using the 'default' mapping rule.", 51, "w:\\4ed\\code\\4coder_remapping_commands.cpp", 41, 51 }, -{ PROC_LINKS(set_bindings_mac_default, 0), "set_bindings_mac_default", 24, "Remap keybindings using the 'mac-default' mapping rule.", 55, "w:\\4ed\\code\\4coder_remapping_commands.cpp", 41, 66 }, -{ PROC_LINKS(miblo_increment_basic, 0), "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 29 }, -{ PROC_LINKS(miblo_decrement_basic, 0), "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 44 }, -{ PROC_LINKS(miblo_increment_time_stamp, 0), "miblo_increment_time_stamp", 26, "Increment a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 231 }, -{ PROC_LINKS(miblo_decrement_time_stamp, 0), "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 237 }, -{ PROC_LINKS(miblo_increment_time_stamp_minute, 0), "miblo_increment_time_stamp_minute", 33, "Increment a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 243 }, -{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), "miblo_decrement_time_stamp_minute", 33, "Decrement a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 249 }, -{ PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 187 }, -{ PROC_LINKS(write_explicit_enum_values, 0), "write_explicit_enum_values", 26, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in sequentially starting from zero. Existing values are overwritten.", 170, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 496 }, +static Command_Metadata fcoder_metacmd_table[0] = { }; -static int32_t fcoder_metacmd_ID_write_explicit_enum_flags = 0; -static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 1; -static int32_t fcoder_metacmd_ID_seek_end_of_textual_line = 2; -static int32_t fcoder_metacmd_ID_seek_beginning_of_line = 3; -static int32_t fcoder_metacmd_ID_seek_end_of_line = 4; -static int32_t fcoder_metacmd_ID_goto_beginning_of_file = 5; -static int32_t fcoder_metacmd_ID_goto_end_of_file = 6; -static int32_t fcoder_metacmd_ID_change_active_panel = 7; -static int32_t fcoder_metacmd_ID_change_active_panel_backwards = 8; -static int32_t fcoder_metacmd_ID_open_panel_vsplit = 9; -static int32_t fcoder_metacmd_ID_open_panel_hsplit = 10; -static int32_t fcoder_metacmd_ID_suppress_mouse = 11; -static int32_t fcoder_metacmd_ID_allow_mouse = 12; -static int32_t fcoder_metacmd_ID_toggle_mouse = 13; -static int32_t fcoder_metacmd_ID_set_mode_to_original = 14; -static int32_t fcoder_metacmd_ID_set_mode_to_notepad_like = 15; -static int32_t fcoder_metacmd_ID_toggle_highlight_line_at_cursor = 16; -static int32_t fcoder_metacmd_ID_toggle_highlight_enclosing_scopes = 17; -static int32_t fcoder_metacmd_ID_toggle_paren_matching_helper = 18; -static int32_t fcoder_metacmd_ID_toggle_fullscreen = 19; -static int32_t fcoder_metacmd_ID_remap_interactive = 20; -static int32_t fcoder_metacmd_ID_write_character = 21; -static int32_t fcoder_metacmd_ID_write_underscore = 22; -static int32_t fcoder_metacmd_ID_delete_char = 23; -static int32_t fcoder_metacmd_ID_backspace_char = 24; -static int32_t fcoder_metacmd_ID_set_mark = 25; -static int32_t fcoder_metacmd_ID_cursor_mark_swap = 26; -static int32_t fcoder_metacmd_ID_delete_range = 27; -static int32_t fcoder_metacmd_ID_backspace_alpha_numeric_boundary = 28; -static int32_t fcoder_metacmd_ID_delete_alpha_numeric_boundary = 29; -static int32_t fcoder_metacmd_ID_snipe_backward_whitespace_or_token_boundary = 30; -static int32_t fcoder_metacmd_ID_snipe_forward_whitespace_or_token_boundary = 31; -static int32_t fcoder_metacmd_ID_center_view = 32; -static int32_t fcoder_metacmd_ID_left_adjust_view = 33; -static int32_t fcoder_metacmd_ID_click_set_cursor_and_mark = 34; -static int32_t fcoder_metacmd_ID_click_set_cursor = 35; -static int32_t fcoder_metacmd_ID_click_set_cursor_if_lbutton = 36; -static int32_t fcoder_metacmd_ID_click_set_mark = 37; -static int32_t fcoder_metacmd_ID_mouse_wheel_scroll = 38; -static int32_t fcoder_metacmd_ID_move_up = 39; -static int32_t fcoder_metacmd_ID_move_down = 40; -static int32_t fcoder_metacmd_ID_move_up_10 = 41; -static int32_t fcoder_metacmd_ID_move_down_10 = 42; -static int32_t fcoder_metacmd_ID_move_down_textual = 43; -static int32_t fcoder_metacmd_ID_page_up = 44; -static int32_t fcoder_metacmd_ID_page_down = 45; -static int32_t fcoder_metacmd_ID_move_up_to_blank_line = 46; -static int32_t fcoder_metacmd_ID_move_down_to_blank_line = 47; -static int32_t fcoder_metacmd_ID_move_up_to_blank_line_skip_whitespace = 48; -static int32_t fcoder_metacmd_ID_move_down_to_blank_line_skip_whitespace = 49; -static int32_t fcoder_metacmd_ID_move_up_to_blank_line_end = 50; -static int32_t fcoder_metacmd_ID_move_down_to_blank_line_end = 51; -static int32_t fcoder_metacmd_ID_move_left = 52; -static int32_t fcoder_metacmd_ID_move_right = 53; -static int32_t fcoder_metacmd_ID_move_right_whitespace_boundary = 54; -static int32_t fcoder_metacmd_ID_move_left_whitespace_boundary = 55; -static int32_t fcoder_metacmd_ID_move_right_token_boundary = 56; -static int32_t fcoder_metacmd_ID_move_left_token_boundary = 57; -static int32_t fcoder_metacmd_ID_move_right_whitespace_or_token_boundary = 58; -static int32_t fcoder_metacmd_ID_move_left_whitespace_or_token_boundary = 59; -static int32_t fcoder_metacmd_ID_move_right_alpha_numeric_boundary = 60; -static int32_t fcoder_metacmd_ID_move_left_alpha_numeric_boundary = 61; -static int32_t fcoder_metacmd_ID_move_right_alpha_numeric_or_camel_boundary = 62; -static int32_t fcoder_metacmd_ID_move_left_alpha_numeric_or_camel_boundary = 63; -static int32_t fcoder_metacmd_ID_select_all = 64; -static int32_t fcoder_metacmd_ID_to_uppercase = 65; -static int32_t fcoder_metacmd_ID_to_lowercase = 66; -static int32_t fcoder_metacmd_ID_clean_all_lines = 67; -static int32_t fcoder_metacmd_ID_basic_change_active_panel = 68; -static int32_t fcoder_metacmd_ID_close_panel = 69; -static int32_t fcoder_metacmd_ID_show_scrollbar = 70; -static int32_t fcoder_metacmd_ID_hide_scrollbar = 71; -static int32_t fcoder_metacmd_ID_show_filebar = 72; -static int32_t fcoder_metacmd_ID_hide_filebar = 73; -static int32_t fcoder_metacmd_ID_toggle_filebar = 74; -static int32_t fcoder_metacmd_ID_toggle_line_wrap = 75; -static int32_t fcoder_metacmd_ID_toggle_fps_meter = 76; -static int32_t fcoder_metacmd_ID_increase_line_wrap = 77; -static int32_t fcoder_metacmd_ID_decrease_line_wrap = 78; -static int32_t fcoder_metacmd_ID_increase_face_size = 79; -static int32_t fcoder_metacmd_ID_decrease_face_size = 80; -static int32_t fcoder_metacmd_ID_mouse_wheel_change_face_size = 81; -static int32_t fcoder_metacmd_ID_toggle_virtual_whitespace = 82; -static int32_t fcoder_metacmd_ID_toggle_show_whitespace = 83; -static int32_t fcoder_metacmd_ID_toggle_line_numbers = 84; -static int32_t fcoder_metacmd_ID_eol_dosify = 85; -static int32_t fcoder_metacmd_ID_eol_nixify = 86; -static int32_t fcoder_metacmd_ID_exit_4coder = 87; -static int32_t fcoder_metacmd_ID_goto_line = 88; -static int32_t fcoder_metacmd_ID_search = 89; -static int32_t fcoder_metacmd_ID_reverse_search = 90; -static int32_t fcoder_metacmd_ID_search_identifier = 91; -static int32_t fcoder_metacmd_ID_reverse_search_identifier = 92; -static int32_t fcoder_metacmd_ID_replace_in_range = 93; -static int32_t fcoder_metacmd_ID_replace_in_buffer = 94; -static int32_t fcoder_metacmd_ID_replace_in_all_buffers = 95; -static int32_t fcoder_metacmd_ID_query_replace = 96; -static int32_t fcoder_metacmd_ID_query_replace_identifier = 97; -static int32_t fcoder_metacmd_ID_query_replace_selection = 98; -static int32_t fcoder_metacmd_ID_save_all_dirty_buffers = 99; -static int32_t fcoder_metacmd_ID_delete_file_query = 100; -static int32_t fcoder_metacmd_ID_save_to_query = 101; -static int32_t fcoder_metacmd_ID_rename_file_query = 102; -static int32_t fcoder_metacmd_ID_make_directory_query = 103; -static int32_t fcoder_metacmd_ID_move_line_up = 104; -static int32_t fcoder_metacmd_ID_move_line_down = 105; -static int32_t fcoder_metacmd_ID_duplicate_line = 106; -static int32_t fcoder_metacmd_ID_delete_line = 107; -static int32_t fcoder_metacmd_ID_open_file_in_quotes = 108; -static int32_t fcoder_metacmd_ID_open_matching_file_cpp = 109; -static int32_t fcoder_metacmd_ID_view_buffer_other_panel = 110; -static int32_t fcoder_metacmd_ID_swap_buffers_between_panels = 111; -static int32_t fcoder_metacmd_ID_kill_buffer = 112; -static int32_t fcoder_metacmd_ID_save = 113; -static int32_t fcoder_metacmd_ID_reopen = 114; -static int32_t fcoder_metacmd_ID_undo = 115; -static int32_t fcoder_metacmd_ID_redo = 116; -static int32_t fcoder_metacmd_ID_undo_all_buffers = 117; -static int32_t fcoder_metacmd_ID_redo_all_buffers = 118; -static int32_t fcoder_metacmd_ID_open_in_other = 119; -static int32_t fcoder_metacmd_ID_lister__quit = 120; -static int32_t fcoder_metacmd_ID_lister__activate = 121; -static int32_t fcoder_metacmd_ID_lister__write_character = 122; -static int32_t fcoder_metacmd_ID_lister__backspace_text_field = 123; -static int32_t fcoder_metacmd_ID_lister__move_up = 124; -static int32_t fcoder_metacmd_ID_lister__move_down = 125; -static int32_t fcoder_metacmd_ID_lister__wheel_scroll = 126; -static int32_t fcoder_metacmd_ID_lister__mouse_press = 127; -static int32_t fcoder_metacmd_ID_lister__mouse_release = 128; -static int32_t fcoder_metacmd_ID_lister__repaint = 129; -static int32_t fcoder_metacmd_ID_lister__write_character__default = 130; -static int32_t fcoder_metacmd_ID_lister__backspace_text_field__default = 131; -static int32_t fcoder_metacmd_ID_lister__move_up__default = 132; -static int32_t fcoder_metacmd_ID_lister__move_down__default = 133; -static int32_t fcoder_metacmd_ID_lister__write_character__file_path = 134; -static int32_t fcoder_metacmd_ID_lister__backspace_text_field__file_path = 135; -static int32_t fcoder_metacmd_ID_lister__write_character__fixed_list = 136; -static int32_t fcoder_metacmd_ID_interactive_switch_buffer = 137; -static int32_t fcoder_metacmd_ID_interactive_kill_buffer = 138; -static int32_t fcoder_metacmd_ID_interactive_open_or_new = 139; -static int32_t fcoder_metacmd_ID_interactive_new = 140; -static int32_t fcoder_metacmd_ID_interactive_open = 141; -static int32_t fcoder_metacmd_ID_command_lister = 142; -static int32_t fcoder_metacmd_ID_auto_tab_whole_file = 143; -static int32_t fcoder_metacmd_ID_auto_tab_line_at_cursor = 144; -static int32_t fcoder_metacmd_ID_auto_tab_range = 145; -static int32_t fcoder_metacmd_ID_write_and_auto_tab = 146; -static int32_t fcoder_metacmd_ID_list_all_locations = 147; -static int32_t fcoder_metacmd_ID_list_all_substring_locations = 148; -static int32_t fcoder_metacmd_ID_list_all_locations_case_insensitive = 149; -static int32_t fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 150; -static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier = 151; -static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 152; -static int32_t fcoder_metacmd_ID_list_all_locations_of_selection = 153; -static int32_t fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 154; -static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition = 155; -static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 156; -static int32_t fcoder_metacmd_ID_word_complete = 157; -static int32_t fcoder_metacmd_ID_goto_jump_at_cursor = 158; -static int32_t fcoder_metacmd_ID_goto_jump_at_cursor_same_panel = 159; -static int32_t fcoder_metacmd_ID_goto_next_jump = 160; -static int32_t fcoder_metacmd_ID_goto_prev_jump = 161; -static int32_t fcoder_metacmd_ID_goto_next_jump_no_skips = 162; -static int32_t fcoder_metacmd_ID_goto_prev_jump_no_skips = 163; -static int32_t fcoder_metacmd_ID_goto_first_jump = 164; -static int32_t fcoder_metacmd_ID_goto_first_jump_same_panel_sticky = 165; -static int32_t fcoder_metacmd_ID_newline_or_goto_position = 166; -static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel = 167; -static int32_t fcoder_metacmd_ID_view_jump_list_with_lister = 168; -static int32_t fcoder_metacmd_ID_log_graph__escape = 169; -static int32_t fcoder_metacmd_ID_log_graph__scroll_wheel = 170; -static int32_t fcoder_metacmd_ID_log_graph__page_up = 171; -static int32_t fcoder_metacmd_ID_log_graph__page_down = 172; -static int32_t fcoder_metacmd_ID_log_graph__click_select_event = 173; -static int32_t fcoder_metacmd_ID_log_graph__click_jump_to_event_source = 174; -static int32_t fcoder_metacmd_ID_show_the_log_graph = 175; -static int32_t fcoder_metacmd_ID_copy = 176; -static int32_t fcoder_metacmd_ID_cut = 177; -static int32_t fcoder_metacmd_ID_paste = 178; -static int32_t fcoder_metacmd_ID_paste_next = 179; -static int32_t fcoder_metacmd_ID_paste_and_indent = 180; -static int32_t fcoder_metacmd_ID_paste_next_and_indent = 181; -static int32_t fcoder_metacmd_ID_execute_previous_cli = 182; -static int32_t fcoder_metacmd_ID_execute_any_cli = 183; -static int32_t fcoder_metacmd_ID_build_search = 184; -static int32_t fcoder_metacmd_ID_build_in_build_panel = 185; -static int32_t fcoder_metacmd_ID_close_build_panel = 186; -static int32_t fcoder_metacmd_ID_change_to_build_panel = 187; -static int32_t fcoder_metacmd_ID_close_all_code = 188; -static int32_t fcoder_metacmd_ID_open_all_code = 189; -static int32_t fcoder_metacmd_ID_open_all_code_recursive = 190; -static int32_t fcoder_metacmd_ID_load_project = 191; -static int32_t fcoder_metacmd_ID_project_fkey_command = 192; -static int32_t fcoder_metacmd_ID_project_go_to_root_directory = 193; -static int32_t fcoder_metacmd_ID_setup_new_project = 194; -static int32_t fcoder_metacmd_ID_setup_build_bat = 195; -static int32_t fcoder_metacmd_ID_setup_build_sh = 196; -static int32_t fcoder_metacmd_ID_setup_build_bat_and_sh = 197; -static int32_t fcoder_metacmd_ID_project_command_lister = 198; -static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer = 199; -static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer_lister = 200; -static int32_t fcoder_metacmd_ID_list_all_functions_all_buffers = 201; -static int32_t fcoder_metacmd_ID_list_all_functions_all_buffers_lister = 202; -static int32_t fcoder_metacmd_ID_select_surrounding_scope = 203; -static int32_t fcoder_metacmd_ID_select_next_scope_absolute = 204; -static int32_t fcoder_metacmd_ID_select_prev_scope_absolute = 205; -static int32_t fcoder_metacmd_ID_place_in_scope = 206; -static int32_t fcoder_metacmd_ID_delete_current_scope = 207; -static int32_t fcoder_metacmd_ID_scope_absorb_down = 208; -static int32_t fcoder_metacmd_ID_open_long_braces = 209; -static int32_t fcoder_metacmd_ID_open_long_braces_semicolon = 210; -static int32_t fcoder_metacmd_ID_open_long_braces_break = 211; -static int32_t fcoder_metacmd_ID_if0_off = 212; -static int32_t fcoder_metacmd_ID_write_todo = 213; -static int32_t fcoder_metacmd_ID_write_hack = 214; -static int32_t fcoder_metacmd_ID_write_note = 215; -static int32_t fcoder_metacmd_ID_write_block = 216; -static int32_t fcoder_metacmd_ID_write_zero_struct = 217; -static int32_t fcoder_metacmd_ID_comment_line = 218; -static int32_t fcoder_metacmd_ID_uncomment_line = 219; -static int32_t fcoder_metacmd_ID_comment_line_toggle = 220; -static int32_t fcoder_metacmd_ID_snippet_lister = 221; -static int32_t fcoder_metacmd_ID_set_bindings_choose = 222; -static int32_t fcoder_metacmd_ID_set_bindings_default = 223; -static int32_t fcoder_metacmd_ID_set_bindings_mac_default = 224; -static int32_t fcoder_metacmd_ID_miblo_increment_basic = 225; -static int32_t fcoder_metacmd_ID_miblo_decrement_basic = 226; -static int32_t fcoder_metacmd_ID_miblo_increment_time_stamp = 227; -static int32_t fcoder_metacmd_ID_miblo_decrement_time_stamp = 228; -static int32_t fcoder_metacmd_ID_miblo_increment_time_stamp_minute = 229; -static int32_t fcoder_metacmd_ID_miblo_decrement_time_stamp_minute = 230; -static int32_t fcoder_metacmd_ID_rename_parameter = 231; -static int32_t fcoder_metacmd_ID_write_explicit_enum_values = 232; #endif diff --git a/4coder_malloc_allocator.cpp b/4coder_malloc_allocator.cpp index 0ee8d54f..40ebfa83 100644 --- a/4coder_malloc_allocator.cpp +++ b/4coder_malloc_allocator.cpp @@ -26,12 +26,18 @@ make_malloc_base_allocator(void){ global Base_Allocator malloc_base_allocator = {}; -internal Arena -make_arena_malloc(umem chunk_size, umem align){ +internal Base_Allocator* +get_allocator_malloc(void){ if (malloc_base_allocator.reserve == 0){ malloc_base_allocator = make_malloc_base_allocator(); } - return(make_arena(&malloc_base_allocator, chunk_size, align)); + return(&malloc_base_allocator); +} + +internal Arena +make_arena_malloc(umem chunk_size, umem align){ + Base_Allocator *allocator = get_allocator_malloc(); + return(make_arena(allocator, chunk_size, align)); } internal Arena diff --git a/4coder_metadata_generator.cpp b/4coder_metadata_generator.cpp index 6527d36f..6b7f08f1 100644 --- a/4coder_metadata_generator.cpp +++ b/4coder_metadata_generator.cpp @@ -7,14 +7,14 @@ #define COMMAND_METADATA_OUT "4coder_generated/command_metadata.h" #include "4coder_base_types.h" +#include "4coder_token.h" #include "4coder_base_types.cpp" #include "4coder_stringf.cpp" #include "4coder_malloc_allocator.cpp" #include "4coder_file.h" - -#include "4coder_lib/4cpp_lexer.h" +#include "languages/4coder_language_cpp.h" #include #include @@ -26,24 +26,24 @@ /////////////////////////////// struct Line_Column_Coordinates{ - int32_t line; - int32_t column; + i64 line; + i64 column; }; static Line_Column_Coordinates -line_column_coordinates(String_Const_char text, int32_t pos){ +line_column_coordinates(String_Const_u8 text, i64 pos){ if (pos < 0){ pos = 0; } - if (pos > text.size){ - pos = (i32)text.size; + if (pos > (i64)text.size){ + pos = (i64)text.size; } Line_Column_Coordinates coords = {}; coords.line = 1; coords.column = 1; - char *end = text.str + pos; - for (char *p = text.str; p < end; ++p){ + u8 *end = text.str + pos; + for (u8 *p = text.str; p < end; ++p){ if (*p == '\n'){ ++coords.line; coords.column = 1; @@ -56,16 +56,17 @@ line_column_coordinates(String_Const_char text, int32_t pos){ return(coords); } -static int32_t -line_number(String_Const_char text, int32_t pos){ +static i64 +line_number(String_Const_u8 text, i64 pos){ Line_Column_Coordinates coords = line_column_coordinates(text, pos); return(coords.line); } static void -error(char *source_name, String_Const_char text, int32_t pos, char *msg){ +error(u8 *source_name, String_Const_u8 text, i64 pos, u8 *msg){ Line_Column_Coordinates coords = line_column_coordinates(text, pos); - fprintf(stdout, "%s:%d:%d: %s\n", source_name, coords.line, coords.column, msg); + fprintf(stdout, "%s:%lld:%lld: %s\n", + source_name, coords.line, coords.column, msg); fflush(stdout); } @@ -73,8 +74,8 @@ error(char *source_name, String_Const_char text, int32_t pos, char *msg){ struct Reader{ Arena *error_arena; - char *source_name; - String_Const_char text; + u8 *source_name; + String_Const_u8 text; Token_Array tokens; Token *ptr; }; @@ -85,7 +86,7 @@ struct Temp_Read{ }; static Reader -make_reader(Cpp_Token_Array array, char *source_name, String_Const_char text){ +make_reader(Token_Array array, u8 *source_name, String_Const_u8 text){ Reader reader = {}; reader.tokens = array; reader.ptr = array.tokens; @@ -113,7 +114,8 @@ prev_token(Reader *reader){ break; } - if (result.type != CPP_TOKEN_COMMENT && result.type != CPP_TOKEN_JUNK){ + if (result.kind != TokenBaseKind_Comment && + result.kind != TokenBaseKind_LexError){ break; } } @@ -137,11 +139,12 @@ get_token(Reader *reader){ else{ reader->ptr = reader->tokens.tokens + reader->tokens.count; memset(&result, 0, sizeof(result)); - result.start = (i32)reader->text.size; + result.pos = reader->text.size; break; } - if (result.type != CPP_TOKEN_COMMENT && result.type != CPP_TOKEN_JUNK){ + if (result.kind != TokenBaseKind_Comment && + result.kind != TokenBaseKind_LexError){ break; } } @@ -158,7 +161,7 @@ peek_token(Reader *reader){ } if (reader->ptr >= reader->tokens.tokens + reader->tokens.count){ - result.start = (i32)reader->text.size; + result.pos = reader->text.size; } else{ result = *reader->ptr; @@ -167,20 +170,19 @@ peek_token(Reader *reader){ return(result); } -static int32_t +static i64 peek_pos(Reader *reader){ Token token = peek_token(reader); - return(token.start); + return(token.pos); } -static int32_t -line_number(Reader *reader, int32_t pos){ - int32_t result = line_number(reader->text, pos); - return(result); +static i64 +line_number(Reader *reader, i64 pos){ + return(line_number(reader->text, pos)); } static void -error(Reader *reader, int32_t pos, char *msg){ +error(Reader *reader, i64 pos, u8 *msg){ error(reader->source_name, reader->text, pos, msg); } @@ -199,15 +201,15 @@ end_temp_read(Temp_Read temp){ /////////////////////////////// -static String_Const_char -token_str(String_Const_char text, Token token){ - String_Const_char str = string_prefix(string_skip(text, token.start), token.size); +static String_Const_u8 +token_str(String_Const_u8 text, Token token){ + String_Const_u8 str = string_prefix(string_skip(text, token.pos), token.size); return(str); } /////////////////////////////// -typedef uint32_t Meta_Command_Entry_Type; +typedef u32 Meta_Command_Entry_Type; enum{ MetaCommandEntry_DocString, MetaCommandEntry_Alias, @@ -215,15 +217,15 @@ enum{ struct Meta_Command_Entry{ Meta_Command_Entry *next; - String_Const_char name; - char *source_name; - int32_t line_number; + String_Const_u8 name; + u8 *source_name; + i64 line_number; union{ struct{ - String_Const_char doc; + String_Const_u8 doc; } docstring; struct{ - String_Const_char potential; + String_Const_u8 potential; } alias; }; }; @@ -231,21 +233,21 @@ struct Meta_Command_Entry{ struct Meta_Command_Entry_Arrays{ Meta_Command_Entry *first_doc_string; Meta_Command_Entry *last_doc_string; - int32_t doc_string_count; + i32 doc_string_count; Meta_Command_Entry *first_alias; Meta_Command_Entry *last_alias; - int32_t alias_count; + i32 alias_count; }; /////////////////////////////// -static int32_t -quick_sort_part(Meta_Command_Entry **entries, int32_t first, int32_t one_past_last){ - int32_t pivot = one_past_last - 1; - String_Const_char pivot_key = entries[pivot]->name; - int32_t j = first; - for (int32_t i = first; i < pivot; ++i){ +static i32 +quick_sort_part(Meta_Command_Entry **entries, i32 first, i32 one_past_last){ + i32 pivot = one_past_last - 1; + String_Const_u8 pivot_key = entries[pivot]->name; + i32 j = first; + for (i32 i = first; i < pivot; ++i){ if (string_compare(entries[i]->name, pivot_key) < 0){ Swap(Meta_Command_Entry*, entries[i], entries[j]); ++j; @@ -256,19 +258,19 @@ quick_sort_part(Meta_Command_Entry **entries, int32_t first, int32_t one_past_la } static void -quick_sort(Meta_Command_Entry **entries, int32_t first, int32_t one_past_last){ +quick_sort(Meta_Command_Entry **entries, i32 first, i32 one_past_last){ if (first + 1 < one_past_last){ - int32_t pivot = quick_sort_part(entries, first, one_past_last); + i32 pivot = quick_sort_part(entries, first, one_past_last); quick_sort(entries, first, pivot); quick_sort(entries, pivot + 1, one_past_last); } } static Meta_Command_Entry** -get_sorted_meta_commands(Arena *arena, Meta_Command_Entry *first, int32_t count){ +get_sorted_meta_commands(Arena *arena, Meta_Command_Entry *first, i32 count){ Meta_Command_Entry **entries = push_array(arena, Meta_Command_Entry*, count); - int32_t i = 0; + i32 i = 0; for (Meta_Command_Entry *entry = first; entry != 0; entry = entry->next, ++i){ @@ -284,7 +286,7 @@ get_sorted_meta_commands(Arena *arena, Meta_Command_Entry *first, int32_t count) /////////////////////////////// static b32 -has_duplicate_entry(Meta_Command_Entry *first, String_Const_char name){ +has_duplicate_entry(Meta_Command_Entry *first, String_Const_u8 name){ b32 has_duplicate = false; for (Meta_Command_Entry *entry = first; entry != 0; @@ -299,26 +301,25 @@ has_duplicate_entry(Meta_Command_Entry *first, String_Const_char name){ /////////////////////////////// static b32 -require_key_identifier(Reader *reader, char *str, int32_t *opt_pos_out = 0){ +require_key_identifier(Reader *reader, String_Const_u8 string, i64 *opt_pos_out){ b32 success = false; - String_Const_char string = SCchar(str); - Token token = get_token(reader); - if (token.type == CPP_TOKEN_IDENTIFIER){ - String_Const_char lexeme = token_str(reader->text, token); + if (token.kind == TokenBaseKind_Identifier){ + String_Const_u8 lexeme = token_str(reader->text, token); if (string_match(lexeme, string)){ success = true; if (opt_pos_out != 0){ - *opt_pos_out = token.start; + *opt_pos_out = token.pos; } } } if (!success){ Temp_Memory temp = begin_temp(reader->error_arena); - String_Const_char error_string = push_stringf(reader->error_arena, "expected to find '%s'", str); - error(reader, token.start, error_string.str); + String_Const_u8 error_string = push_u8_stringf(reader->error_arena, "expected to find '%.*s'", + string.size, string.str); + error(reader, token.pos, error_string.str); end_temp(temp); } @@ -326,153 +327,198 @@ require_key_identifier(Reader *reader, char *str, int32_t *opt_pos_out = 0){ } static b32 -require_open_parenthese(Reader *reader, int32_t *opt_pos_out = 0){ +require_key_identifier(Reader *reader, char *str, i64 *opt_pos_out){ + return(require_key_identifier(reader, SCu8(str), opt_pos_out)); +} + +static b32 +require_key_identifier(Reader *reader, String_Const_u8 string){ + return(require_key_identifier(reader, string, 0)); +} + +static b32 +require_key_identifier(Reader *reader, char *str){ + return(require_key_identifier(reader, SCu8(str), 0)); +} + +static b32 +require_open_parenthese(Reader *reader, i64 *opt_pos_out){ + b32 success = false; + Token token = get_token(reader); + if (token.kind == TokenBaseKind_ParentheticalOpen){ + success = true; + if (opt_pos_out != 0){ + *opt_pos_out = token.pos; + } + } + if (!success){ + error(reader, token.pos, (u8*)"expected to find '('"); + } + return(success); +} + +static b32 +require_open_parenthese(Reader *reader){ + return(require_open_parenthese(reader, 0)); +} + +static b32 +require_close_parenthese(Reader *reader, i64 *opt_pos_out){ + b32 success = false; + Token token = get_token(reader); + if (token.kind == TokenBaseKind_ParentheticalClose){ + success = true; + if (opt_pos_out != 0){ + *opt_pos_out = token.pos; + } + } + if (!success){ + error(reader, token.pos, (u8*)"expected to find ')'"); + } + return(success); +} + +static b32 +require_close_parenthese(Reader *reader){ + return(require_close_parenthese(reader, 0)); +} + +static b32 +require_comma(Reader *reader, i64 *opt_pos_out){ b32 success = false; Token token = get_token(reader); - if (token.type == CPP_TOKEN_PARENTHESE_OPEN){ + if (token.sub_kind == TokenCppKind_Comma){ success = true; if (opt_pos_out != 0){ - *opt_pos_out = token.start; + *opt_pos_out = token.pos; } } if (!success){ - error(reader, token.start, "expected to find '('"); + error(reader, token.pos, (u8*)"expected to find ','"); } return(success); } static b32 -require_close_parenthese(Reader *reader, int32_t *opt_pos_out = 0){ +require_comma(Reader *reader){ + return(require_comma(reader, 0)); +} + +static b32 +require_define(Reader *reader, i64 *opt_pos_out){ b32 success = false; Token token = get_token(reader); - if (token.type == CPP_TOKEN_PARENTHESE_CLOSE){ + if (token.sub_kind == TokenCppKind_Define){ success = true; if (opt_pos_out != 0){ - *opt_pos_out = token.start; + *opt_pos_out = token.pos; } } if (!success){ - error(reader, token.start, "expected to find ')'"); + error(reader, token.pos, (u8*)"expected to find '#define'"); } return(success); } static b32 -require_comma(Reader *reader, int32_t *opt_pos_out = 0){ - b32 success = false; - - Token token = get_token(reader); - if (token.type == CPP_TOKEN_COMMA){ - success = true; - if (opt_pos_out != 0){ - *opt_pos_out = token.start; - } - } - - if (!success){ - error(reader, token.start, "expected to find ','"); - } - - return(success); +require_define(Reader *reader){ + return(require_define(reader, 0)); } static b32 -require_define(Reader *reader, int32_t *opt_pos_out = 0){ +extract_identifier(Reader *reader, String_Const_u8 *str_out, i64 *opt_pos_out){ b32 success = false; Token token = get_token(reader); - if (token.type == CPP_PP_DEFINE){ - success = true; - if (opt_pos_out != 0){ - *opt_pos_out = token.start; - } - } - - if (!success){ - error(reader, token.start, "expected to find '#define'"); - } - - return(success); -} - -static b32 -extract_identifier(Reader *reader, String_Const_char *str_out, int32_t *opt_pos_out = 0){ - b32 success = false; - - Token token = get_token(reader); - if (token.type == CPP_TOKEN_IDENTIFIER){ - String_Const_char lexeme = token_str(reader->text, token); + if (token.kind == TokenBaseKind_Identifier){ + String_Const_u8 lexeme = token_str(reader->text, token); *str_out = lexeme; success = true; if (opt_pos_out != 0){ - *opt_pos_out = token.start; + *opt_pos_out = token.pos; } } if (!success){ - error(reader, token.start, "expected to find an identifier"); + error(reader, token.pos, (u8*)"expected to find an identifier"); } return(success); } static b32 -extract_integer(Reader *reader, String_Const_char *str_out, int32_t *opt_pos_out = 0){ +extract_identifier(Reader *reader, String_Const_u8 *str_out){ + return(extract_identifier(reader, str_out, 0)); +} + +static b32 +extract_integer(Reader *reader, String_Const_u8 *str_out, i64 *opt_pos_out){ b32 success = false; Token token = get_token(reader); - if (token.type == CPP_TOKEN_INTEGER_CONSTANT){ - String_Const_char lexeme = token_str(reader->text, token); + if (token.kind == TokenBaseKind_LiteralInteger){ + String_Const_u8 lexeme = token_str(reader->text, token); *str_out = lexeme; success = true; if (opt_pos_out != 0){ - *opt_pos_out = token.start; + *opt_pos_out = token.pos; } } if (!success){ - error(reader, token.start, "expected to find an integer"); + error(reader, token.pos, (u8*)"expected to find an integer"); + } + + return(success); +} + + +static b32 +extract_integer(Reader *reader, String_Const_u8 *str_out){ + return(extract_integer(reader, str_out, 0)); +} + +static b32 +extract_string(Reader *reader, String_Const_u8 *str_out, i64 *opt_pos_out){ + b32 success = false; + + Token token = get_token(reader); + if (token.kind == TokenBaseKind_LiteralString){ + String_Const_u8 lexeme = token_str(reader->text, token); + *str_out = lexeme; + success = true; + if (opt_pos_out != 0){ + *opt_pos_out = token.pos; + } + } + + if (!success){ + error(reader, token.pos, (u8*)"expected to find a string literal"); } return(success); } static b32 -extract_string(Reader *reader, String_Const_char *str_out, int32_t *opt_pos_out = 0){ - b32 success = false; - - Token token = get_token(reader); - if (token.type == CPP_TOKEN_STRING_CONSTANT){ - String_Const_char lexeme = token_str(reader->text, token); - *str_out = lexeme; - success = true; - if (opt_pos_out != 0){ - *opt_pos_out = token.start; - } - } - - if (!success){ - error(reader, token.start, "expected to find a string literal"); - } - - return(success); +extract_string(Reader *reader, String_Const_u8 *str_out){ + return(extract_string(reader, str_out, 0)); } static b32 parse_documented_command(Arena *arena, Meta_Command_Entry_Arrays *arrays, Reader *reader){ - String_Const_char name = {}; - String_Const_char file_name = {}; - String_Const_char line_number = {}; - String_Const_char doc = {}; + String_Const_u8 name = {}; + String_Const_u8 file_name = {}; + String_Const_u8 line_number = {}; + String_Const_u8 doc = {}; // Getting the command's name - int32_t start_pos = 0; + i64 start_pos = 0; if (!require_key_identifier(reader, "CUSTOM_COMMAND_SIG", &start_pos)){ return(false); } @@ -514,13 +560,13 @@ parse_documented_command(Arena *arena, Meta_Command_Entry_Arrays *arrays, Reader return(false); } - int32_t doc_pos = 0; + i64 doc_pos = 0; if (!extract_string(reader, &doc, &doc_pos)){ return(false); } if (doc.size < 1 || doc.str[0] != '"'){ - error(reader, doc_pos, "warning: doc strings with string literal prefixes not allowed"); + error(reader, doc_pos, (u8*)"warning: doc strings with string literal prefixes not allowed"); return(false); } @@ -529,14 +575,14 @@ parse_documented_command(Arena *arena, Meta_Command_Entry_Arrays *arrays, Reader } if (has_duplicate_entry(arrays->first_doc_string, name)){ - error(reader, start_pos, "warning: multiple commands with the same name and separate doc strings, skipping this one"); + error(reader, start_pos, (u8*)"warning: multiple commands with the same name and separate doc strings, skipping this one"); return(false); } doc = string_chop(string_skip(doc, 1), 1); - String_Const_char file_name_unquoted = string_chop(string_skip(file_name, 1), 1); - String_Const_char source_name = string_interpret_escapes(arena, file_name_unquoted); + String_Const_u8 file_name_unquoted = string_chop(string_skip(file_name, 1), 1); + String_Const_u8 source_name = string_interpret_escapes(arena, file_name_unquoted); Meta_Command_Entry *new_entry = push_array(arena, Meta_Command_Entry, 1); new_entry->name = name; @@ -551,11 +597,11 @@ parse_documented_command(Arena *arena, Meta_Command_Entry_Arrays *arrays, Reader static b32 parse_alias(Arena *arena, Meta_Command_Entry_Arrays *arrays, Reader *reader){ - String_Const_char name = {}; - String_Const_char potential = {}; + String_Const_u8 name = {}; + String_Const_u8 potential = {}; // Getting the alias's name - int32_t start_pos = 0; + i64 start_pos = 0; if (!require_define(reader, &start_pos)){ return(false); } @@ -595,9 +641,9 @@ parse_alias(Arena *arena, Meta_Command_Entry_Arrays *arrays, Reader *reader){ /////////////////////////////// static void -parse_text(Arena *arena, Meta_Command_Entry_Arrays *entry_arrays, char *source_name, String_Const_char text){ - Token_Array array = cpp_make_token_array(1024); - cpp_lex_file(text.str, (i32)text.size, &array); +parse_text(Arena *arena, Meta_Command_Entry_Arrays *entry_arrays, u8 *source_name, String_Const_u8 text){ + Base_Allocator *allocator = get_allocator_malloc(); + Token_Array array = lex_cpp_initial(allocator, text); Reader reader_ = make_reader(array, source_name, text); Reader *reader = &reader_; @@ -605,25 +651,25 @@ parse_text(Arena *arena, Meta_Command_Entry_Arrays *entry_arrays, char *source_n for (;;){ Token token = get_token(reader); - if (token.type == CPP_TOKEN_IDENTIFIER){ - String_Const_char lexeme = token_str(text, token); + if (token.kind == TokenBaseKind_Identifier){ + String_Const_u8 lexeme = token_str(text, token); - b32 in_preproc_body = ((token.flags & CPP_TFLAG_PP_BODY) != 0); + b32 in_preproc_body = HasFlag(token.flags, TokenBaseFlag_PreprocessorBody); - if (!in_preproc_body && string_match(lexeme, string_litexpr("CUSTOM_DOC"))){ + if (!in_preproc_body && string_match(lexeme, string_u8_litexpr("CUSTOM_DOC"))){ Temp_Read temp_read = begin_temp_read(reader); b32 found_start_pos = false; - for (int32_t R = 0; R < 10; ++R){ + for (i32 R = 0; R < 10; ++R){ Token p_token = prev_token(reader); - if (p_token.type == CPP_TOKEN_IDENTIFIER){ - String_Const_char p_lexeme = token_str(text, p_token); - if (string_match(p_lexeme, string_litexpr("CUSTOM_COMMAND_SIG"))){ + if (p_token.kind == TokenBaseKind_Identifier){ + String_Const_u8 p_lexeme = token_str(text, p_token); + if (string_match(p_lexeme, string_u8_litexpr("CUSTOM_COMMAND_SIG"))){ found_start_pos = true; break; } } - if (p_token.type == 0){ + if (p_token.kind == TokenBaseKind_EOF){ break; } } @@ -637,19 +683,19 @@ parse_text(Arena *arena, Meta_Command_Entry_Arrays *entry_arrays, char *source_n } } } - else if (string_match(lexeme, string_litexpr("CUSTOM_ALIAS"))){ + else if (string_match(lexeme, string_u8_litexpr("CUSTOM_ALIAS"))){ Temp_Read temp_read = begin_temp_read(reader); b32 found_start_pos = false; - for (int32_t R = 0; R < 3; ++R){ + for (i32 R = 0; R < 3; ++R){ Token p_token = prev_token(reader); - if (p_token.type == CPP_PP_DEFINE){ + if (p_token.sub_kind == TokenCppKind_Define){ if (R == 2){ found_start_pos = true; } break; } - if (p_token.type == 0){ + if (p_token.kind == TokenBaseKind_EOF){ break; } } @@ -665,16 +711,16 @@ parse_text(Arena *arena, Meta_Command_Entry_Arrays *entry_arrays, char *source_n } } - if (token.type == 0){ + if (token.kind == TokenBaseKind_EOF){ break; } } - cpp_free_token_array(array); + base_free(allocator, array.tokens); } static void -parse_file(Arena *arena, Meta_Command_Entry_Arrays *entry_arrays, Filename_Character *name_, int32_t len){ +parse_file(Arena *arena, Meta_Command_Entry_Arrays *entry_arrays, Filename_Character *name_, i32 len){ char *name = unencode(arena, name_, len); if (name == 0){ if (sizeof(*name_) == 2){ @@ -686,20 +732,20 @@ parse_file(Arena *arena, Meta_Command_Entry_Arrays *entry_arrays, Filename_Chara return; } - String_Const_char text = file_dump(arena, name); - parse_text(arena, entry_arrays, name, text); + String_Const_u8 text = file_dump(arena, name); + parse_text(arena, entry_arrays, (u8*)name, text); } static void parse_files_by_pattern(Arena *arena, Meta_Command_Entry_Arrays *entry_arrays, Filename_Character *pattern, b32 recursive){ Cross_Platform_File_List list = get_file_list(arena, pattern, filter_all); - for (int32_t i = 0; i < list.count; ++i){ + for (i32 i = 0; i < list.count; ++i){ Cross_Platform_File_Info *info = &list.info[i]; String_Const_Any info_name = SCany(info->name, info->len); Temp_Memory temp = begin_temp(arena); - String_Const_char info_name_ascii = string_char_from_any(arena, info_name); - b32 is_generated = string_match(info_name_ascii, string_litexpr("4coder_generated")); + String_Const_u8 info_name_ascii = string_u8_from_any(arena, info_name); + b32 is_generated = string_match(info_name_ascii, string_u8_litexpr("4coder_generated")); end_temp(temp); if (info->is_folder && is_generated){ @@ -709,7 +755,7 @@ parse_files_by_pattern(Arena *arena, Meta_Command_Entry_Arrays *entry_arrays, Fi continue; } - int32_t full_name_len = list.path_length + 1 + info->len; + i32 full_name_len = list.path_length + 1 + info->len; if (info->is_folder){ full_name_len += 2; } @@ -752,7 +798,7 @@ main(int argc, char **argv){ show_usage(argc, argv); } - b32 recursive = string_match(SCchar(argv[1]), string_litexpr("-R")); + b32 recursive = string_match(SCu8(argv[1]), string_u8_litexpr("-R")); if (recursive && argc < 4){ show_usage(argc, argv); } @@ -762,13 +808,13 @@ main(int argc, char **argv){ char *out_directory = argv[2]; - int32_t start_i = 2; + i32 start_i = 2; if (recursive){ start_i = 3; } Meta_Command_Entry_Arrays entry_arrays = {}; - for (int32_t i = start_i; i < argc; ++i){ + for (i32 i = start_i; i < argc; ++i){ Filename_Character *pattern_name = encode(arena, argv[i]); parse_files_by_pattern(arena, &entry_arrays, pattern_name, recursive); } @@ -780,9 +826,9 @@ main(int argc, char **argv){ } { - String_Const_char str = SCchar(out_directory, out_dir_len); + String_Const_u8 str = SCu8(out_directory, out_dir_len); str = string_skip_chop_whitespace(str); - out_directory = str.str; + out_directory = (char*)str.str; out_dir_len = str.size; } @@ -795,7 +841,7 @@ main(int argc, char **argv){ FILE *out = fopen(out_file_name, "wb"); if (out != 0){ - int32_t entry_count = entry_arrays.doc_string_count; + i32 entry_count = entry_arrays.doc_string_count; Meta_Command_Entry **entries = get_sorted_meta_commands(arena, entry_arrays.first_doc_string, entry_count); fprintf(out, "#if !defined(META_PASS)\n"); @@ -810,7 +856,7 @@ main(int argc, char **argv){ fprintf(out, "#endif\n"); fprintf(out, "#if defined(CUSTOM_COMMAND_SIG)\n"); - for (int32_t i = 0; i < entry_count; ++i){ + for (i32 i = 0; i < entry_count; ++i){ Meta_Command_Entry *entry = entries[i]; fprintf(out, "CUSTOM_COMMAND_SIG(%.*s);\n", str_to_l_c(entry->name)); } @@ -820,18 +866,18 @@ main(int argc, char **argv){ "struct Command_Metadata{\n" "PROC_LINKS(Custom_Command_Function, void) *proc;\n" "char *name;\n" - "int32_t name_len;\n" + "i32 name_len;\n" "char *description;\n" - "int32_t description_len;\n" + "i32 description_len;\n" "char *source_name;\n" - "int32_t source_name_len;\n" - "int32_t line_number;\n" + "i32 source_name_len;\n" + "i32 line_number;\n" "};\n"); fprintf(out, "static Command_Metadata fcoder_metacmd_table[%d] = {\n", entry_arrays.doc_string_count); - for (int32_t i = 0; i < entry_count; ++i){ + for (i32 i = 0; i < entry_count; ++i){ Meta_Command_Entry *entry = entries[i]; Temp_Memory temp = begin_temp(arena); @@ -839,27 +885,31 @@ main(int argc, char **argv){ // HACK(allen): We could just get these at the HEAD END of the process, // then we only have to do it once per file, and pass the lengths through. //umem source_name_len = cstring_length(entry->source_name); - String_Const_char source_name = SCchar(entry->source_name); - String_Const_char printable = string_replace(arena, source_name, - SCchar("\\"), SCchar("\\\\"), - StringFill_NullTerminate); + String_Const_u8 source_name = SCu8(entry->source_name); + String_Const_u8 printable = string_replace(arena, source_name, + SCu8("\\"), SCu8("\\\\"), + StringFill_NullTerminate); fprintf(out, - "{ PROC_LINKS(%.*s, 0), \"%.*s\", %d, \"%.*s\", %d, \"%s\", %d, %d },\n", - str_to_l_c(entry->name), - str_to_l_c(entry->name), (i32)entry->name.size, - str_to_l_c(entry->docstring.doc), (i32)entry->docstring.doc.size, - printable.str, (i32)source_name.size, entry->line_number); + "{ PROC_LINKS(%.*s, 0), \"%.*s\", %d, \"%.*s\", %d, \"%s\", %d, %lld },\n", + string_expand(entry->name), + string_expand(entry->name), + (i32)entry->name.size, + string_expand(entry->docstring.doc), + (i32)entry->docstring.doc.size, + printable.str, + (i32)source_name.size, + entry->line_number); end_temp(temp); } fprintf(out, "};\n"); - int32_t id = 0; - for (int32_t i = 0; i < entry_count; ++i){ + i32 id = 0; + for (i32 i = 0; i < entry_count; ++i){ Meta_Command_Entry *entry = entries[i]; - fprintf(out, "static int32_t fcoder_metacmd_ID_%.*s = %d;\n", - str_to_l_c(entry->name), id); + fprintf(out, "static i32 fcoder_metacmd_ID_%.*s = %d;\n", + string_expand(entry->name), id); ++id; } diff --git a/4coder_token.h b/4coder_token.h new file mode 100644 index 00000000..a9f33ec9 --- /dev/null +++ b/4coder_token.h @@ -0,0 +1,54 @@ +/* + * 4coder token types + */ + +// TOP + +#if !defined(FCODER_TOKEN_H) +#define FCODER_TOKEN_H + +typedef i16 Token_Base_Kind; +enum{ + TokenBaseKind_EOF, + TokenBaseKind_Whitespace, + TokenBaseKind_LexError, + TokenBaseKind_Comment, + TokenBaseKind_Keyword, + TokenBaseKind_Preprocessor, + TokenBaseKind_Identifier, + TokenBaseKind_Operator, + TokenBaseKind_LiteralInteger, + TokenBaseKind_LiteralFloat, + TokenBaseKind_LiteralString, + TokenBaseKind_ScopeOpen, + TokenBaseKind_ScopeClose, + TokenBaseKind_ParentheticalOpen, + TokenBaseKind_ParentheticalClose, + + TokenBaseKind_COUNT, +}; + +typedef u16 Token_Base_Flag; +enum{ + TokenBaseFlag_PreprocessorBody = 1, +}; + +struct Token{ + i64 pos; + i64 size; + Token_Base_Kind kind; + Token_Base_Flag flags; + i16 sub_kind; + u16 sub_flags; +}; + +struct Token_Array{ + Token *tokens; + i64 count; + i64 max; +}; + +#endif + +// BOTTOM + diff --git a/languages/4coder_language_cpp.cpp b/languages/4coder_language_cpp.cpp new file mode 100644 index 00000000..a69b3b26 --- /dev/null +++ b/languages/4coder_language_cpp.cpp @@ -0,0 +1,24 @@ +/* +4coder_language_cpp.cpp - C++ language parser. +*/ + +// TOP + +internal Token_Array +lex_cpp_initial(Base_Allocator *allocator, String_Const_u8 contents){ + Token_Array result = {}; + result.tokens = base_array(allocator, Token, 2); + result.count = 2; + result.max = 2; + result.tokens[0].pos = 0; + result.tokens[0].size = contents.size; + result.tokens[0].kind = TokenBaseKind_COUNT; + result.tokens[0].sub_kind = 0; + result.tokens[1].pos = contents.size; + result.tokens[1].size = 0; + result.tokens[1].kind = TokenBaseKind_EOF; + return(result); +} + +// BOTTOM + diff --git a/languages/4coder_language_cpp.h b/languages/4coder_language_cpp.h index c271136f..9a91b76c 100644 --- a/languages/4coder_language_cpp.h +++ b/languages/4coder_language_cpp.h @@ -1,5 +1,5 @@ /* -4coder_language_cpp.h - Sets up the C++ language context. +4coder_language_cpp.h - C++ language extension for the token types. */ // TOP @@ -7,171 +7,9 @@ #if !defined(FCODER_LANGUAGE_CPP_H) #define FCODER_LANGUAGE_CPP_H -// TODO(allen): Organize this better! - -internal Token_Array -lex_cpp_initial(Base_Allocator *allocator, String_Const_u8 contents){ - Token_Array result = {}; - result.tokens = base_array(allocator, Token, 2); - result.count = 2; - result.max = 2; - result.tokens[0].pos = 0; - result.tokens[0].size = contents.size; - result.tokens[0].kind = TokenBaseKind_COUNT; - result.tokens[0].sub_kind = 0; - result.tokens[1].pos = contents.size; - result.tokens[1].size = 0; - result.tokens[1].kind = TokenBaseKind_EOF; - return(result); -} - -#if 0 -static Parse_Context_ID parse_context_language_cpp; - -#define PSAT(s, t) {s, sizeof(s)-1, t} -static void -init_language_cpp(Application_Links *app){ - if (parse_context_language_cpp != 0) return; +enum{ - Parser_String_And_Type kw[] = { - PSAT("true" , CPP_TOKEN_TRUE), - PSAT("false" , CPP_TOKEN_FALSE), - - PSAT("and" , CPP_TOKEN_AND), - PSAT("and_eq" , CPP_TOKEN_ANDEQ), - PSAT("bitand" , CPP_TOKEN_BIT_AND), - PSAT("bitor" , CPP_TOKEN_BIT_OR), - PSAT("or" , CPP_TOKEN_OR), - PSAT("or_eq" , CPP_TOKEN_OREQ), - PSAT("sizeof" , CPP_TOKEN_SIZEOF), - PSAT("alignof" , CPP_TOKEN_ALIGNOF), - PSAT("decltype" , CPP_TOKEN_DECLTYPE), - PSAT("throw" , CPP_TOKEN_THROW), - PSAT("new" , CPP_TOKEN_NEW), - PSAT("delete" , CPP_TOKEN_DELETE), - PSAT("xor" , CPP_TOKEN_BIT_XOR), - PSAT("xor_eq" , CPP_TOKEN_XOREQ), - PSAT("not" , CPP_TOKEN_NOT), - PSAT("not_eq" , CPP_TOKEN_NOTEQ), - PSAT("typeid" , CPP_TOKEN_TYPEID), - PSAT("compl" , CPP_TOKEN_BIT_NOT), - - PSAT("void" , CPP_TOKEN_VOID), - PSAT("bool" , CPP_TOKEN_BOOL), - PSAT("char" , CPP_TOKEN_CHAR), - PSAT("int" , CPP_TOKEN_INT), - PSAT("float" , CPP_TOKEN_FLOAT), - PSAT("double" , CPP_TOKEN_DOUBLE), - - PSAT("long" , CPP_TOKEN_LONG), - PSAT("short" , CPP_TOKEN_SHORT), - PSAT("unsigned" , CPP_TOKEN_UNSIGNED), - PSAT("signed" , CPP_TOKEN_SIGNED), - - PSAT("const" , CPP_TOKEN_CONST), - PSAT("volatile" , CPP_TOKEN_VOLATILE), - - PSAT("asm" , CPP_TOKEN_ASM), - PSAT("break" , CPP_TOKEN_BREAK), - PSAT("case" , CPP_TOKEN_CASE), - PSAT("catch" , CPP_TOKEN_CATCH), - PSAT("continue" , CPP_TOKEN_CONTINUE), - PSAT("default" , CPP_TOKEN_DEFAULT), - PSAT("do" , CPP_TOKEN_DO), - PSAT("else" , CPP_TOKEN_ELSE), - PSAT("for" , CPP_TOKEN_FOR), - PSAT("goto" , CPP_TOKEN_GOTO), - PSAT("if" , CPP_TOKEN_IF), - PSAT("return" , CPP_TOKEN_RETURN), - PSAT("switch" , CPP_TOKEN_SWITCH), - PSAT("try" , CPP_TOKEN_TRY), - PSAT("while" , CPP_TOKEN_WHILE), - PSAT("static_assert" , CPP_TOKEN_STATIC_ASSERT), - - PSAT("const_cast" , CPP_TOKEN_CONST_CAST), - PSAT("dynamic_cast" , CPP_TOKEN_DYNAMIC_CAST), - PSAT("reinterpret_cast" , CPP_TOKEN_REINTERPRET_CAST), - PSAT("static_cast" , CPP_TOKEN_STATIC_CAST), - - PSAT("class" , CPP_TOKEN_CLASS), - PSAT("enum" , CPP_TOKEN_ENUM), - PSAT("struct" , CPP_TOKEN_STRUCT), - PSAT("typedef" , CPP_TOKEN_TYPEDEF), - PSAT("union" , CPP_TOKEN_UNION), - PSAT("template" , CPP_TOKEN_TEMPLATE), - PSAT("typename" , CPP_TOKEN_TYPENAME), - - PSAT("friend" , CPP_TOKEN_FRIEND), - PSAT("namespace" , CPP_TOKEN_NAMESPACE), - PSAT("private" , CPP_TOKEN_PRIVATE), - PSAT("protected" , CPP_TOKEN_PROTECTED), - PSAT("public" , CPP_TOKEN_PUBLIC), - PSAT("using" , CPP_TOKEN_USING), - - PSAT("extern" , CPP_TOKEN_EXTERN), - PSAT("export" , CPP_TOKEN_EXPORT), - PSAT("inline" , CPP_TOKEN_INLINE), - PSAT("static" , CPP_TOKEN_STATIC), - PSAT("internal", CPP_TOKEN_STATIC), - PSAT("virtual" , CPP_TOKEN_VIRTUAL), - - PSAT("alignas" , CPP_TOKEN_ALIGNAS), - PSAT("explicit" , CPP_TOKEN_EXPLICIT), - PSAT("noexcept" , CPP_TOKEN_NOEXCEPT), - PSAT("nullptr" , CPP_TOKEN_NULLPTR), - PSAT("operator" , CPP_TOKEN_OPERATOR), - PSAT("register" , CPP_TOKEN_REGISTER), - PSAT("this" , CPP_TOKEN_THIS), - PSAT("thread_local" , CPP_TOKEN_THREAD_LOCAL), - -#if defined(EXTRA_KEYWORDS) -#include EXTRA_KEYWORDS -#undef EXTRA_KEYWORDS -#endif - }; - - Parser_String_And_Type pp[] = { - PSAT("include" , CPP_PP_INCLUDE ), - PSAT("INCLUDE" , CPP_PP_INCLUDE ), - PSAT("version" , CPP_PP_VERSION ), - PSAT("VERSION" , CPP_PP_VERSION ), - PSAT("ifndef" , CPP_PP_IFNDEF ), - PSAT("IFNDEF" , CPP_PP_IFNDEF ), - PSAT("define" , CPP_PP_DEFINE ), - PSAT("DEFINE" , CPP_PP_DEFINE ), - PSAT("import" , CPP_PP_IMPORT ), - PSAT("IMPORT" , CPP_PP_IMPORT ), - PSAT("pragma" , CPP_PP_PRAGMA ), - PSAT("PRAGMA" , CPP_PP_PRAGMA ), - PSAT("undef" , CPP_PP_UNDEF ), - PSAT("UNDEF" , CPP_PP_UNDEF ), - PSAT("endif" , CPP_PP_ENDIF ), - PSAT("ENDIF" , CPP_PP_ENDIF ), - PSAT("error" , CPP_PP_ERROR ), - PSAT("ERROR" , CPP_PP_ERROR ), - PSAT("ifdef" , CPP_PP_IFDEF ), - PSAT("IFDEF" , CPP_PP_IFDEF ), - PSAT("using" , CPP_PP_USING ), - PSAT("USING" , CPP_PP_USING ), - PSAT("else" , CPP_PP_ELSE ), - PSAT("ELSE" , CPP_PP_ELSE ), - PSAT("elif" , CPP_PP_ELIF ), - PSAT("ELIF" , CPP_PP_ELIF ), - PSAT("line" , CPP_PP_LINE ), - PSAT("LINE" , CPP_PP_LINE ), - PSAT("if" , CPP_PP_IF ), - PSAT("IF" , CPP_PP_IF ), - -#if defined(EXTRA_PREPROPS) -#include EXTRA_PREPROPS -#undef EXTRA_PREPROPS -#endif - }; - - parse_context_language_cpp = create_parse_context(app, kw, ArrayCount(kw), pp, ArrayCount(pp)); -} -#undef PSAT -#endif +}; #endif diff --git a/lexer_generator/4coder_lex_gen_main.cpp b/lexer_generator/4coder_lex_gen_main.cpp new file mode 100644 index 00000000..616752c4 --- /dev/null +++ b/lexer_generator/4coder_lex_gen_main.cpp @@ -0,0 +1,1103 @@ +/* +4coder_lex_gen_main.cpp - A generator for language lexers. +*/ + +// TOP + +#if !defined(LANG_NAME_LOWER) || !defined(LANG_NAME_CAMEL) +#error 4coder_lex_get_main.cpp not correctly included. +#endif + +#include "4coder_base_types.h" +#include "4coder_table.h" +#include "4coder_token.h" + +#include "4coder_base_types.cpp" +#include "4coder_stringf.cpp" +#include "4coder_malloc_allocator.cpp" +#include "4coder_table.cpp" + +//////////////////////////////// + +struct Keyword{ + Keyword *next; + String_Const_u8 name; + String_Const_u8 lexeme; + Token_Base_Kind base_kind; +}; + +struct Keyword_Set{ + Keyword *first; + Keyword *last; + i32 count; +}; + +struct Character_Name_Set{ + Table_u64_Data char_to_name; +}; + +struct Operator{ + Operator *next; + String_Const_u8 op; + String_Const_u8 name; + Token_Base_Kind base_kind; +}; + +struct Operator_Set{ + Operator *first; + Operator *last; + i32 count; +}; + +struct Direct_Kind{ + Direct_Kind *next; + String_Const_u8 name; + Token_Base_Kind base_kind; +}; + +//////////////////////////////// + +int main(void){ + // utf-8 bytes + u8 utf8[129]; + for (u16 i = 0; i < 128; i += 1){ + utf8[i] = i + 128; + } + utf8[128] = 0; + + // Base Names + char_name('{', "BraceOp"); + char_name('}', "BraceCl"); + char_name('(', "ParenOp"); + char_name(')', "ParenCl"); + char_name('[', "BrackOp"); + char_name(']', "BrackCl"); + char_name('-', "Minus"); + char_name('+', "Plus"); + char_name('.', "Dot"); + char_name('!', "Bang"); + char_name('*', "Star"); + char_name(',', "Comma"); + char_name(':', "Colon"); + char_name(';', "Semicolon"); + char_name('@', "At"); + char_name('#', "Pound"); + char_name('$', "Dollar"); + char_name('%', "Percent"); + char_name('^', "Carrot"); + char_name('&', "And"); + char_name('=', "Eq"); + char_name('<', "Less"); + char_name('>', "Grtr"); + char_name('~', "Tilde"); + char_name('/', "Slash"); + char_name('?', "Question"); + char_name('|', "Pipe"); + + // CPP Names + char_name('!', "Not"); + char_name('|', "Or"); + char_name('%', "Mod"); + char_name('^', "Xor"); + char_name('?', "Ternary"); + + // Typical Base Token Kinds + select_base_kind(TokenBaseKind_EOF); + direct_token_kind("EOF"); + + select_base_kind(TokenBaseKind_Whitespace); + direct_token_kind("Whitespace"); + + select_base_kind(TokenBaseKind_LexError); + direct_token_kind("LexError"); + + // CPP Direct Toke Kinds + select_base_kind(TokenBaseKind_Comment); + direct_token_kind("BlockComment"); + direct_token_kind("LineComment"); + + select_base_kind(TokenBaseKind_Whitespace); + direct_token_kind("Backslash"); + + select_base_kind(TokenBaseKind_LiteralInteger); + direct_token_kind("LiteralInteger"): + direct_token_kind("LiteralIntegerU"): + direct_token_kind("LiteralIntegerL"): + direct_token_kind("LiteralIntegerUL"): + direct_token_kind("LiteralIntegerLL"): + direct_token_kind("LiteralIntegerULL"): + direct_token_kind("LiteralIntegerHex"): + direct_token_kind("LiteralIntegerHexU"): + direct_token_kind("LiteralIntegerHexL"): + direct_token_kind("LiteralIntegerHexUL"): + direct_token_kind("LiteralIntegerHexLL"): + direct_token_kind("LiteralIntegerHexULL"): + direct_token_kind("LiteralIntegerOct"): + direct_token_kind("LiteralIntegerOctU"): + direct_token_kind("LiteralIntegerOctL"): + direct_token_kind("LiteralIntegerOctUL"): + direct_token_kind("LiteralIntegerOctLL"): + direct_token_kind("LiteralIntegerOctULL"): + + select_base_kind(TokenBaseKind_LiteralFloat); + direct_token_kind("LiteralFloat32"): + direct_token_kind("LiteralFloat64"): + + select_base_kind(TokenBaseKind_LiteralString); + direct_token_kind("LiteralString"): + direct_token_kind("LiteralStringWide"): + direct_token_kind("LiteralStringUTF8"): + direct_token_kind("LiteralStringUTF16"): + direct_token_kind("LiteralStringUTF32"): + direct_token_kind("LiteralStringRaw"): + direct_token_kind("LiteralStringWideRaw"): + direct_token_kind("LiteralStringUTF8Raw"): + direct_token_kind("LiteralStringUTF16Raw"): + direct_token_kind("LiteralStringUTF32Raw"): + direct_token_kind("LiteralCharacter"): + direct_token_kind("LiteralCharacterWide"): + direct_token_kind("LiteralCharacterUTF8"): + direct_token_kind("LiteralCharacterUTF16"): + direct_token_kind("LiteralCharacterUTF32"): + direct_token_kind("PPIncludeFile"); + + // CPP Operators + Operator_Set *main_ops = begin_op_set(); + + select_base_kind(TokenBaseKind_ScopeOpen); + op("{"); + select_base_kind(TokenBaseKind_ScopeClose); + op("}"); + select_base_kind(TokenBaseKind_ParentheticalOpen); + op("("); + op("["); + select_base_kind(TokenBaseKind_ParentheticalClose); + op(")"); + op("]"); + select_base_kind(TokenBaseKind_Operator); + op(":"); + op("..."); + + op("::"); + op("++"); + op("--"); + op("."); + op("->", "Arrow"); + op("+"); + op("-"); + op("!"); + op("~"); + op("*"); + op("&"); + op(".*"); + op("->*", "ArrowStar"); + op("/"); + op("%"); + + char_name('<', "Left"); + char_name('>', "Right"); + op("<<"); + op(">>"); + + op("<=>", "Compare"); + + char_name('<', "Less"); + char_name('>', "Grtr"); + op("<"); + op("<="); + op(">"); + op(">="); + op("=="); + op("!="); + + op("^"); + op("|"); + op("&&"); + op("||"); + op("?"); + op("="); + op("+="); + op("-="); + op("*="); + op("/="); + op("%="); + + char_name('<', "Left"); + char_name('>', "Right"); + op("<<="); + op(">>="); + + op(","); + + // CPP Preprocess Operators + Operator_Set *pp_ops = begin_op_set(); + + op("#", "PPStringify"); + op("##", "PPConcat"); + + // CPP Keywords + Keyword_Set *main_keys = begin_key_set(); + + select_base_kind(TokenBaseKind_Keyword); + key("Void"); + key("Bool"); + key("Char"); + key("Int"); + key("Float"); + key("Double"); + key("Long"); + key("Short"); + key("Unsigned"); + key("Signed"); + key("Const"); + key("Volatile"); + key("Asm"); + key("Break"); + key("Case"); + key("Catch"); + key("Continue"); + key("Default"); + key("Do"); + key("Else"); + key("For"); + key("Goto"); + key("If"); + key("Return"); + key("Switch"); + key("Try"); + key("While"); + key("StaticAssert", "static_assert"); + key("ConstCast", "const_cast"); + key("DynamicCast", "dynamic_cast"); + key("ReinterpretCast", "reinterpret_cast"); + key("StaticCast", "static_cast"); + key("Class"); + key("Enum"); + key("Struct"); + key("Typedef"); + key("Union"); + key("Template"); + key("Typename"); + key("Friend"); + key("Namespace"); + key("Private"); + key("Protected"); + key("Public"); + key("Using"); + key("Extern"); + key("Export"); + key("Inline"); + key("Static"); + key("Virtual"); + key("AlignAs"); + key("Explicit"); + key("NoExcept"); + key("NullPtr"); + key("Operator"); + key("Register"); + key("This"); + key("ThreadLocal", "thread_local"); + key("SizeOf"); + key("AlignOf"); + key("DeclType"); + key("TypeID"); + key("New"); + key("Delete"); + key_unmatchable("KeywordGeneric"); + + select_base_kind(TokenBaseKind_LiteralInteger); + key("LiteralTrue", "true"); + key("LiteralFalse", "false"); + + select_base_kind(TokenBaseKind_Identifier); + key_fallback("Identifier"); + + // CPP Preprocess Directives + Keyword_Set *pp_directive_set = begin_key_set(); + + select_base_kind(TokenBaseKind_Preprocessor); + key("PPInclude", "#include"); + key("PPVersion", "#version"); + key("PPDefine", "#define"); + key("PPUndef", "#undef"); + key("PPIf", "#if"); + key("PPIfDef", "#ifdef"); + key("PPIfNDef", "#ifndef"); + key("PPElse", "#else"); + key("PPElIf", "#elif"); + key("PPEndIf", "#endif"); + key("PPError", "#error"); + key("PPImport", "#import"); + key("PPUsing", "#using"); + key("PPLine", "#line"); + key("PPPragma", "#pragma"); + key_fallback("PPUnknown"); + + // CPP Preprocess Keywords + Keyword_Set *pp_keys = begin_key_set(); + + select_base_kind(TokenBaseKind_Keyword); + key("PPDefined", "defined"); + + // State Machine + State *root = begin_state_machine(); + + Flag *is_hex = add_flag(AutoZero); + Flag *is_oct = add_flag(AutoZero); + Flag *is_pp_body = add_flag(KeepState); + Flag *is_include_body = add_flag(KeepState); + Flag *is_wide = add_flag(AutoZero); + Flag *is_utf8 = add_flag(AutoZero); + Flag *is_utf16 = add_flag(AutoZero); + Flag *is_utf32 = add_flag(AutoZero); + Flag *is_char = add_flag(AutoZero); + + flag_bind(is_pp_body, TokenBaseFlag_PreprocessorBody); + + State *identifier = add_state(); + State *whitespace = add_state(); + State *whitespace_end_pp = add_state(); + State *backslash = add_state(); + + State *operator_or_fnumber_dot = add_state(); + State *operator_or_comment_slash = add_state(); + + State *number = add_state(); + State *znumber = add_state(); + + State *fnumber_decimal = add_state(); + State *fnumber_exponent = add_state(); + State *fnumber_exponent_sign = add_state(); + State *fnumber_exponent_digits = add_state(); + + State *number_hex = add_state(); + State *number_oct = add_state(); + + State *U_number = add_state(); + State *L_number = add_state(); + State *UL_number = add_state(); + State *LU_number = add_state(); + State *l_number = add_state(); + State *Ul_number = add_state(); + State *lU_number = add_state(); + State *LL_number = add_state(); + State *ULL_number = add_state(); + + State *pp_directive = add_state(); + + State *include_pointy = add_state(); + State *include_quotes = add_state(); + + State *pre_L = add_state(); + State *pre_u = add_state(); + State *pre_U = add_state(); + State *pre_u8 = add_state(); + State *pre_R = add_state(); + + State *character = add_state(); + State *string = add_state(); + State *string_esc = add_state(); + State *string_esc_oc2 = add_state(); + State *string_esc_oc1 = add_state(); + State *string_esc_hex = add_state(); + State *string_esc_universal_8 = add_state(); + State *string_esc_universal_7 = add_state(); + State *string_esc_universal_6 = add_state(); + State *string_esc_universal_5 = add_state(); + State *string_esc_universal_4 = add_state(); + State *string_esc_universal_3 = add_state(); + State *string_esc_universal_2 = add_state(); + State *string_esc_universal_1 = add_state(); + + State *raw_string = add_state(); + State *raw_string_get_delim = add_state(); + State *raw_string_finish_delim = add_state(); + State *raw_string_find_close = add_state(); + State *raw_string_try_delim = add_state(); + State *raw_string_try_quote = add_state(); + + State *comment_block = add_state(); + State *comment_block_try_close = add_state(); + State *comment_block_newline = add_state(); + State *comment_line = add_state(); + + Operator_Set *main_ops_without_dot_or_slash = copy_op_set(main_ops); + remove_ops_with_prefix(main_ops_without_dot, "."); + remove_ops_with_prefix(main_ops_without_dot, "/"); + + Operator_Set *main_ops_with_dot = copy_op_set(main_ops); + remove_ops_without_prefix(main_ops_with_dot, "."); + ops_string_skip(main_ops_with_dot, 1); + + //// + + select_state(root); + sm_case("abcdefghijklmnopqrstvwxyz" + "ABCDEFGHIJKMNOPQSTVWXYZ" + "_$", + identifier); + sm_case(utf8, identifier); + sm_case("L", pre_L); + sm_case("u", pre_u); + sm_case("U", pre_U); + sm_case("R", pre_R); + + sm_case(" \r\t\f\v", whitespace); + sm_case("\n", whitespace_end_pp); + sm_case("\\", backslash); + + sm_case(".", operator_or_fnumber_dot); + sm_case("/", operator_or_comment_slash); + { + Character_Set *char_set = new_char_set(); + char_set_union_ops(char_set, main_ops_without_dot_or_slash); + char_set_remove(char_set, ".", emit); + } + { + Emit_Rule *emit = add_emit_rule(); + handler_token_kind("LexError"); + sm_fallback(emit); + } + + //// + + select_state(include_quotes); + sm_case("abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "_. /\\" + "0123456789", + include_pointy); + { + Emit_Rule *emit = add_emit_rule(); + handler_token_kind("PPIncludeFile"); + sm_case("\"", emit); + } + { + Emit_Rule *emit = add_emit_rule(); + handler_token_kind("LexError"); + sm_fallback(emit); + } + + //// + + select_state(pre_L); + sm_set_flag(is_wide, true); + sm_case("\"", string); + sm_case("R", pre_R); + sm_fallback_peek(identifier); + + //// + + select_state(pre_u); + sm_set_flag(is_utf16, true); + sm_case("\"", string); + sm_case("8", pre_u8); + sm_case("R", pre_R); + sm_fallback_peek(identifier); + + //// + + select_state(pre_U); + sm_set_flag(is_utf32, true); + sm_case("\"", string); + sm_case("R", pre_R); + sm_fallback_peek(identifier); + + //// + + select_state(pre_u8); + sm_set_flag(is_utf8, true); + sm_case("\"", string); + sm_case("R", pre_R); + sm_fallback_peek(identifier); + + //// + + select_state(pre_R); + sm_case("\"", raw_string); + sm_fallback_peek(identifier); + + //// + + select_state(character); + sm_set_flag(is_char, true); + sm_fallback_peek(string); + + //// + + select_state(string); + { + Emit_Rule *emit = add_emit_rule(); + handler_token_kind(is_wide, "LiteralStringWide"); + handler_token_kind(is_utf8 , "LiteralStringUTF8"); + handler_token_kind(is_utf16, "LiteralStringUTF16"); + handler_token_kind(is_utf32, "LiteralStringUTF32"); + handler_token_kind("LiteralString"); + sm_case_flagged(is_char, false, "\"", emit); + } + { + Emit_Rule *emit = add_emit_rule(); + handler_token_kind(is_wide, "LiteralCharacterWide"); + handler_token_kind(is_utf8 , "LiteralCharacterUTF8"); + handler_token_kind(is_utf16, "LiteralCharacterUTF16"); + handler_token_kind(is_utf32, "LiteralCharacterUTF32"); + handler_token_kind("LiteralCharacter"); + sm_case_flagged(is_char, true, "\'", emit); + } + sm_case("\\", string_esc); + { + Emit_Rule *emit = add_emit_rule(); + handler_token_kind("LexError"); + sm_case_peek("\n", emit); + } + sm_case_flagged(is_char, true, "\"", string); + sm_case_flagged(is_char, false, "\'", string); + sm_fallback(string); + + //// + + select_state(string_esc); + sm_case("'\"?\\abfnrtv", string); + sm_case("01234567", string_esc_oct2); + sm_case("x", string_esc_hex); + sm_case("u", string_esc_universal_4); + sm_case("U", string_esc_universal_8); + { + Emit_Rule *emit = add_emit_rule(); + handler_token_kind("LexError"); + sm_case_peek("\n", emit); + } + sm_fallback(string); + + //// + + select_state(string_esc_oct2); + sm_case("01234567", string_esc_oct1); + sm_fallback_peek(string); + + //// + + select_state(string_esc_oct1); + sm_case("01234567", string); + sm_fallback_peek(string); + + //// + + select_state(string_esc_hex); + sm_case("0123456789abcdefABCDEF", string_esc_hex); + sm_fallback_peek(string); + + //// + + select_state(string_esc_universal_8); + sm_case("0123456789abcdefABCDEF", string_esc_universal_7); + sm_fallback_peek(string); + + //// + + select_state(string_esc_universal_7); + sm_case("0123456789abcdefABCDEF", string_esc_universal_6); + sm_fallback_peek(string); + + //// + + select_state(string_esc_universal_6); + sm_case("0123456789abcdefABCDEF", string_esc_universal_5); + sm_fallback_peek(string); + + //// + + select_state(string_esc_universal_5); + sm_case("0123456789abcdefABCDEF", string_esc_universal_4); + sm_fallback_peek(string); + + //// + + select_state(string_esc_universal_4); + sm_case("0123456789abcdefABCDEF", string_esc_universal_3); + sm_fallback_peek(string); + + //// + + select_state(string_esc_universal_3); + sm_case("0123456789abcdefABCDEF", string_esc_universal_2); + sm_fallback_peek(string); + + //// + + select_state(string_esc_universal_2); + sm_case("0123456789abcdefABCDEF", string_esc_universal_1); + sm_fallback_peek(string); + + //// + + select_state(string_esc_universal_1); + sm_case("0123456789abcdefABCDEF", string); + sm_fallback_peek(string); + + //// + + select_state(raw_string); + sm_delim_mark_first(); + sm_fallback_peek(raw_string_get_delim); + + //// + + select_state(raw_string_get_delim); + sm_case_peek("(", raw_string_finish_delim); + { + Emit_Rule *emit = add_emit_rule(); + handler_token_kind("LexError"); + sm_case(" \\)", emit); + } + sm_fallback(raw_string_get_delim); + + //// + + select_state(raw_string_finish_delim); + sm_delim_mark_one_past_last(); + sm_fallback(raw_string_find_close); + + //// + + select_state(raw_string_find_close); + sm_case(")", raw_string_try_delim); + sm_fallback(raw_string_find_close); + + //// + + select_state(raw_string_try_delim); + sm_match_delim(raw_string_try_quote); + sm_fallback_peek(raw_string_find_close); + + //// + + select_state(raw_string_try_quote); + { + Emit_Rule *emit = add_emit_rule(); + handler_token_kind(is_wide, "LiteralStringWideRaw"); + handler_token_kind(is_utf8 , "LiteralStringUTF8Raw"); + handler_token_kind(is_utf16, "LiteralStringUTF16Raw"); + handler_token_kind(is_utf32, "LiteralStringUTF32Raw"); + handler_token_kind("LiteralStringRaw"); + sm_case("\"", emit); + } + sm_fallback_peek(raw_string_find_close); + + //// + + select_state(comment_block); + sm_case("*", comment_block_try_close); + sm_case("\n", comment_block_newline); + sm_fallback(comment_block); + + //// + + select_state(comment_block_try_close); + { + Emit_Rule *emit = add_emit_rule(); + handler_token_kind("BlockComment"); + sm_case("/", emit); + } + sm_case("*", comment_block_try_close); + sm_fallback(comment_block); + + //// + + select_state(comment_block_newline); + sm_set_flag(is_pp_body, false); + sm_set_flag(is_include_body, false); + sm_fallback_peek(comment_block); + + //// + + select_state(comment_line); + { + Emit_Rule *emit = add_emit_rule(); + handler_token_kind("LineComment"); + sm_case_peek("\n", emit); + } + sm_fallback(comment_line); + +} + +// BOTTOM + diff --git a/meta/4ed_build.cpp b/meta/4ed_build.cpp index c99546ad..3e5df5c9 100644 --- a/meta/4ed_build.cpp +++ b/meta/4ed_build.cpp @@ -472,11 +472,6 @@ fsm_generator(Arena *arena, char *cdir){ build_and_run(arena, cdir, "meta/4ed_fsm_table_generator.cpp", "fsmgen", OPTS | DEBUG_INFO); } -internal void -metagen(Arena *arena, char *cdir){ - build_and_run(arena, cdir, "meta/4ed_metagen.cpp", "metagen", OPTS | DEBUG_INFO); -} - internal void string_build(Arena *arena, char *cdir){ char *dir = fm_str(arena, BUILD_DIR); @@ -580,7 +575,6 @@ build_main(Arena *arena, char *cdir, b32 update_local_theme, u32 flags, u32 arch internal void standard_build(Arena *arena, char *cdir, u32 flags, u32 arch){ //fsm_generator(arena, cdir); - metagen(arena, cdir); //do_buildsuper(arena, cdir, fm_str(arena, custom_files[Custom_Default]), arch); do_buildsuper(arena, cdir, fm_str(arena, custom_files[Custom_Experiments]), arch); @@ -609,7 +603,6 @@ internal void package(Arena *arena, char *cdir){ // NOTE(allen): meta fsm_generator(arena, cdir); - metagen(arena, cdir); char *build_dir = fm_str(arena, BUILD_DIR); char *pack_dir = fm_str(arena, PACK_DIR); diff --git a/meta/4ed_meta_parser.cpp b/meta/4ed_meta_parser.cpp index e5aae02d..df909844 100644 --- a/meta/4ed_meta_parser.cpp +++ b/meta/4ed_meta_parser.cpp @@ -9,1383 +9,7 @@ // TOP -#if !defined(FRED_META_PARSER_CPP) -#define FRED_META_PARSER_CPP - -struct Parse_Context{ - Token *token_s; - Token *token_e; - Token *token; - char *data; -}; - -struct Argument{ - String_Const_char param_string; - String_Const_char param_name; - //String param_string; - //String param_name; -}; - -struct Argument_Breakdown{ - i32 count; - Argument *args; -}; - -struct Documentation{ - i32 param_count; - String_Const_char *param_name; - String_Const_char *param_docs; - String_Const_char return_doc; - String_Const_char main_doc; - i32 see_also_count; - String_Const_char *see_also; - //String *param_name; - //String *param_docs; - //String return_doc; - //String main_doc; - //String *see_also; -}; - -enum Item_Type{ - Item_Null, - Item_Function, - Item_CppName, - Item_Macro, - Item_Typedef, - Item_Struct, - Item_Union, - Item_Enum, - Item_Type_Count, -#define Item_Type_User0 Item_Type_Count -}; - -struct Item_Node{ - i32 t; - - String_Const_char cpp_name; - String_Const_char name; - String_Const_char ret; - String_Const_char args; - String_Const_char body; - String_Const_char marker; - - String_Const_char value; - String_Const_char type; - String_Const_char type_postfix; - String_Const_char doc_string; - - //String cpp_name; - //String name; - //String ret; - //String args; - //String body; - //String marker; - - //String value; - //String type; - //String type_postfix; - //String doc_string; - - Argument_Breakdown breakdown; - Documentation doc; - - Item_Node *first_child; - Item_Node *next_sibling; -}; - -struct Item_Set{ - Item_Node *items; - i32 count; -}; - -struct Parse{ - String_Const_char code; - //String code; - Token_Array tokens; - i32 item_count; -}; - -struct Meta_Unit{ - Item_Set set; - Parse *parse; - i32 count; -}; - -struct Meta_Keywords{ - String_Const_char key; - //String key; - Item_Type type; -}; - -struct Used_Links{ - String_Const_char *strs; - //String *strs; - i32 count, max; -}; - -internal Item_Node null_item_node = {}; - -internal String_Const_char -SCchar_range(char *data, i32 start, i32 end){ - return(SCchar(data + start, data + end)); -} - -internal String_Const_char -get_lexeme(Token token, char *code){ - String_Const_char str = SCchar(code + token.start, token.size); - return(str); -} - -internal Parse_Context -setup_parse_context(char *data, Token_Array array){ - Parse_Context context; - context.token_s = array.tokens; - context.token_e = array.tokens + array.count; - context.token = context.token_s; - context.data = data; - return(context); -} - -internal Parse_Context -setup_parse_context(Parse parse){ - Parse_Context context; - context.token_s = parse.tokens.tokens; - context.token_e = parse.tokens.tokens + parse.tokens.count; - context.token = context.token_s; - context.data = parse.code.str; - return(context); -} - -internal Token* -get_token(Parse_Context *context){ - Token *result = context->token; - if (result >= context->token_e){ - result = 0; - } - return(result); -} - -internal Token* -get_next_token(Parse_Context *context){ - Token *result = context->token+1; - context->token = result; - if (result >= context->token_e){ - result = 0; - context->token = context->token_e; - } - return(result); -} - -internal Token* -get_prev_token(Parse_Context *context){ - Token *result = context->token-1; - if (result < context->token_s){ - result = 0; - } - else{ - context->token = result; - } - return(result); -} - -internal Token* -can_back_step(Parse_Context *context){ - Token *result = context->token-1; - if (result < context->token_s){ - result = 0; - } - return(result); -} - -internal Token* -set_token(Parse_Context *context, Token *token){ - Token *result = 0; - if (token >= context->token_s && token < context->token_e){ - context->token = token; - result = token; - } - return(result); -} - -internal Item_Set -allocate_item_set(Arena *arena, i32 count){ - Item_Set item_set = {}; - if (count > 0){ - item_set.items = push_array(arena, Item_Node, count); - item_set.count = count; - memset(item_set.items, 0, sizeof(Item_Node)*count); - } - return(item_set); -} - -internal String_Const_char -file_dump(char *filename){ - String_Const_char result = {}; - FILE *file = fopen(filename, "rb"); - if (file){ - fseek(file, 0, SEEK_END); - result.size = ftell(file); - fseek(file, 0, SEEK_SET); - result.str = (char*)malloc(result.size + 1); - fread(result.str, 1, result.size, file); - result.str[result.size] = 0; - fclose(file); - } - return(result); -} - -internal Parse -meta_lex(char *filename){ - Parse result = {}; - result.code = file_dump(filename); - if (result.code.str != 0){ - result.tokens = cpp_make_token_array(1024); - cpp_lex_file(result.code.str, (i32)result.code.size, &result.tokens); - } - return(result); -} - -internal String_Const_char -get_first_line(String_Const_char source){ - umem pos = string_find_first(source, '\n'); - String_Const_char line = string_prefix(source, pos); - return(line); -} - -internal String_Const_char -get_next_line(String_Const_char source, String_Const_char line){ - String_Const_char next = {}; - umem pos = (umem)(line.str - source.str) + line.size; - umem start = 0; - - if (pos < source.size){ - Assert(source.str[pos] == '\n'); - start = pos + 1; - - if (start < source.size){ - pos = string_find_first(string_skip(source, start), '\n'); - next = string_prefix(string_skip(source, start), pos - start); - } - } - - return(next); -} - -internal b32 -is_comment(String_Const_char str){ - b32 result = string_match(string_prefix(str, 2), string_litexpr("//")); - return(result); -} - -typedef enum Doc_Note_Type{ - DOC_PARAM, - DOC_RETURN, - DOC, - DOC_SEE, - DOC_HIDE, - HIDE_MEMBERS, -} Doc_Note_Type; - -internal String_Const_char -defined_doc_notes[] = { - string_litinit("DOC_PARAM"), - string_litinit("DOC_RETURN"), - string_litinit("DOC"), - string_litinit("DOC_SEE"), - string_litinit("DOC_HIDE"), - string_litinit("HIDE_MEMBERS"), -}; - -internal b32 -check_and_fix_docs(String_Const_char *doc_string){ - b32 result = false; - - if (doc_string->size > 4){ - if (doc_string->str[0] == '/'){ - if (doc_string->str[1] == '*'){ - if (doc_string->str[doc_string->size - 2] == '*'){ - if (doc_string->str[doc_string->size - 1] == '/'){ - result = true; - *doc_string = string_skip(string_chop(*doc_string, 2), 2); - } - } - } - } - } - - return(result); -} - -internal i32 -get_doc_string_from_prev(Parse_Context *context, String_Const_char *doc_string){ - i32 result = false; - - if (can_back_step(context)){ - Token *prev_token = get_token(context) - 1; - if (prev_token->type == CPP_TOKEN_COMMENT){ - *doc_string = get_lexeme(*prev_token, context->data); - if (check_and_fix_docs(doc_string)){ - result = true; - } - else{ - block_zero_struct(doc_string); - } - } - } - - return(result); -} - -internal String_Const_char -doc_parse_note(String_Const_char source, i32 *pos){ - String_Const_char result = {}; - - i32 p = *pos; - i32 start = p; - for (; p < source.size; ++p){ - if (source.str[p] == '('){ - break; - } - } - if (p != source.size){ - result = SCchar(source.str + start, source.str + p); - result = string_skip_chop_whitespace(result); - } - *pos = p; - - return(result); -} - -internal String_Const_char -doc_parse_note_string(String_Const_char source, i32 *pos){ - String_Const_char result = {}; - - Assert(source.str[*pos] == '('); - - i32 p = *pos + 1; - i32 start = p; - - i32 nest_level = 0; - - for (; p < source.size; ++p){ - if (source.str[p] == ')'){ - if (nest_level == 0){ - break; - } - else{ - --nest_level; - } - } - else if (source.str[p] == '('){ - ++nest_level; - } - } - if (p != source.size){ - result = SCchar(source.str + start, source.str + p); - result = string_skip_chop_whitespace(result); - ++p; - } - *pos = p; - - return(result); -} - -internal String_Const_char -doc_parse_parameter(String_Const_char source, i32 *pos){ - String_Const_char result = {}; - - i32 p = *pos; - i32 start = p; - - for (; p < source.size; ++p){ - if (source.str[p] == ','){ - break; - } - } - if (p != source.size){ - result = SCchar(source.str + start, source.str + start + p); - result = string_skip_chop_whitespace(result); - ++p; - } - *pos = p; - - return(result); -} - -internal String_Const_char -doc_parse_last_parameter(String_Const_char source, i32 *pos){ - String_Const_char result = {}; - - i32 p = *pos; - i32 start = p; - - for (; p < source.size; ++p){ - if (source.str[p] == ')'){ - break; - } - } - if (p == source.size){ - result = SCchar(source.str + start, source.str + p); - result = string_skip_chop_whitespace(result); - } - *pos = p; - - return(result); -} - -internal b32 -string_set_match_table(void *string_array, umem item_size, i32 count, String_Const_char needle, i32 *index_out){ - b32 result = false; - u8 *ptr = (u8*)string_array; - for (i32 i = 0; i < count; i += 1, ptr += item_size){ - String_Const_char *string_ptr = (String_Const_char*)ptr; - if (string_match(*string_ptr, needle)){ - *index_out = i; - result = true; - break; - } - } - return(result); -} - -internal b32 -string_set_match(String_Const_char *string_array, i32 count, String_Const_char needle, i32 *index_out){ - return(string_set_match_table(string_array, sizeof(*string_array), count, needle, index_out)); -} -internal void -perform_doc_parse(Arena *arena, String_Const_char doc_string, Documentation *doc){ - i32 keep_parsing = true; - i32 pos = 0; - - i32 param_count = 0; - i32 see_count = 0; - - do{ - String_Const_char doc_note = doc_parse_note(doc_string, &pos); - if (doc_note.size == 0){ - keep_parsing = false; - } - else{ - i32 doc_note_type; - if (string_set_match(defined_doc_notes, ArrayCount(defined_doc_notes), doc_note, &doc_note_type)){ - - doc_parse_note_string(doc_string, &pos); - - switch (doc_note_type){ - case DOC_PARAM: ++param_count; break; - case DOC_SEE: ++see_count; break; - } - } - } - }while(keep_parsing); - - if (param_count + see_count > 0){ - doc->param_name = push_array(arena, String_Const_char, param_count); - doc->param_docs = push_array(arena, String_Const_char, param_count); - doc->see_also = push_array(arena, String_Const_char, see_count); - doc->param_count = param_count; - doc->see_also_count = see_count; - } - - i32 param_index = 0; - i32 see_index = 0; - - keep_parsing = true; - pos = 0; - do{ - String_Const_char doc_note = doc_parse_note(doc_string, &pos); - if (doc_note.size == 0){ - keep_parsing = false; - } - else{ - i32 doc_note_type; - if (string_set_match(defined_doc_notes, ArrayCount(defined_doc_notes), doc_note, &doc_note_type)){ - - String_Const_char doc_note_string = doc_parse_note_string(doc_string, &pos); - - switch (doc_note_type){ - case DOC_PARAM: - { - Assert(param_index < param_count); - i32 param_pos = 0; - String_Const_char param_name = doc_parse_parameter(doc_note_string, ¶m_pos); - String_Const_char param_docs = doc_parse_last_parameter(doc_note_string, ¶m_pos); - doc->param_name[param_index] = param_name; - doc->param_docs[param_index] = param_docs; - ++param_index; - }break; - - case DOC_RETURN: - { - doc->return_doc = doc_note_string; - }break; - - case DOC: - { - doc->main_doc = doc_note_string; - }break; - - case DOC_SEE: - { - Assert(see_index < see_count); - doc->see_also[see_index++] = doc_note_string; - }break; - } - } - else{ - fprintf(stderr, "warning: invalid doc note %.*s\n", (i32)doc_note.size, doc_note.str); - } - } - }while(keep_parsing); -} - -internal i32 -struct_parse(Arena *arena, i32 is_struct, Parse_Context *context, Item_Node *top_member); - -internal i32 -struct_parse_member(Parse_Context *context, Item_Node *member){ - i32 result = false; - - Token *token = get_token(context); - - String_Const_char doc_string = {}; - get_doc_string_from_prev(context, &doc_string); - - Token *start_token = token; - - for (; (token = get_token(context)) != 0; get_next_token(context)){ - if (token->type == CPP_TOKEN_SEMICOLON){ - break; - } - } - - if (token){ - String_Const_char name = {}; - Token *token_j = 0; - i32 nest_level = 0; - - for (; (token_j = get_token(context)) > start_token; get_prev_token(context)){ - if (token_j->type == CPP_TOKEN_BRACKET_CLOSE){ - ++nest_level; - } - else if (token_j->type == CPP_TOKEN_BRACKET_OPEN){ - --nest_level; - if (nest_level < 0){ - break; - } - } - - if (nest_level == 0){ - if (token_j->type == CPP_TOKEN_IDENTIFIER){ - break; - } - } - } - - name = string_skip_chop_whitespace(get_lexeme(*token_j, context->data)); - - String_Const_char type = string_skip_chop_whitespace(SCchar_range(context->data, start_token->start, token_j->start)); - - String_Const_char type_postfix = string_skip_chop_whitespace(SCchar_range(context->data, token_j->start + token_j->size, token->start)); - - set_token(context, token+1); - result = true; - - member->name = name; - member->type = type; - member->type_postfix = type_postfix; - member->doc_string = doc_string; - member->first_child = 0; - member->next_sibling = 0; - } - - return(result); -} - -internal Item_Node* -struct_parse_next_member(Arena *arena, Parse_Context *context){ - Item_Node *result = 0; - - Token *token = 0; - - for (; (token = get_token(context)) != 0; get_next_token(context)){ - if (token->type == CPP_TOKEN_IDENTIFIER || - (token->flags & CPP_TFLAG_IS_KEYWORD)){ - String_Const_char lexeme = get_lexeme(*token, context->data); - - if (string_match(lexeme, string_litexpr("STRUCT"))){ - Item_Node *member = push_array(arena, Item_Node, 1); - if (struct_parse(arena, true, context, member)){ - result = member; - break; - } - else{ - Assert(!"unhandled error"); - } - } - else if (string_match(lexeme, string_litexpr("UNION"))){ - Item_Node *member = push_array(arena, Item_Node, 1); - if (struct_parse(arena, false, context, member)){ - result = member; - break; - } - else{ - Assert(!"unhandled error"); - } - } - else{ - Item_Node *member = push_array(arena, Item_Node, 1); - if (struct_parse_member(context, member)){ - result = member; - break; - } - else{ - Assert(!"unhandled error"); - } - } - } - else if (token->type == CPP_TOKEN_BRACE_CLOSE){ - break; - } - } - - return(result); -} - -internal i32 -struct_parse(Arena *arena, i32 is_struct, Parse_Context *context, Item_Node *top_member){ - i32 result = false; - - Token *start_token = get_token(context); - Token *token = 0; - - String_Const_char doc_string = {}; - get_doc_string_from_prev(context, &doc_string); - - for (; (token = get_token(context)) != 0; get_next_token(context)){ - if (token->type == CPP_TOKEN_BRACE_OPEN){ - break; - } - } - - if (token){ - Token *token_j = token; - - for (; (token_j = get_token(context)) > start_token; get_prev_token(context)){ - if (token_j->type == CPP_TOKEN_IDENTIFIER){ - break; - } - } - - String_Const_char name = {}; - if (token_j != start_token){ - name = string_skip_chop_whitespace(get_lexeme(*token_j, context->data)); - } - - String_Const_char type = {}; - if (is_struct){ - type = string_litexpr("struct"); - } - else{ - type = string_litexpr("union"); - } - - set_token(context, token+1); - Item_Node *new_member = struct_parse_next_member(arena, context); - - if (new_member){ - top_member->first_child = new_member; - - Item_Node *head_member = new_member; - for(;;){ - new_member = struct_parse_next_member(arena, context); - if (new_member){ - head_member->next_sibling = new_member; - head_member = new_member; - } - else{ - break; - } - } - } - - for (; (token = get_token(context)) != 0; get_next_token(context)){ - if (token->type == CPP_TOKEN_SEMICOLON){ - break; - } - } - ++token; - - if (is_struct){ - top_member->t = Item_Struct; - } - else{ - top_member->t = Item_Union; - } - top_member->name = name; - top_member->type = type; - top_member->doc_string = doc_string; - top_member->next_sibling = 0; - - result = true; - } - - return(result); -} - -internal i32 -typedef_parse(Parse_Context *context, Item_Node *item){ - i32 result = false; - - Token *token = get_token(context); - String_Const_char doc_string = {}; - get_doc_string_from_prev(context, &doc_string); - - Token *start_token = token; - - for (; (token = get_token(context)) != 0; get_next_token(context)){ - if (token->type == CPP_TOKEN_SEMICOLON){ - break; - } - } - - if (token){ - Token *token_j = token; - - for (; (token_j = get_token(context)) > start_token; get_prev_token(context)){ - if (token_j->type == CPP_TOKEN_IDENTIFIER){ - break; - } - } - - String_Const_char name = get_lexeme(*token_j, context->data); - - String_Const_char type = string_skip_chop_whitespace(SCchar_range(context->data, start_token->start + start_token->size, token_j->start)); - - item->t = Item_Typedef; - item->type = type; - item->name = name; - item->doc_string = doc_string; - result = true; - } - - set_token(context, token); - - return(result); -} - -internal i32 -enum_parse(Arena *arena, Parse_Context *context, Item_Node *item){ - i32 result = false; - - String_Const_char parent_doc_string = {}; - get_doc_string_from_prev(context, &parent_doc_string); - - Token *parent_start_token = get_token(context); - Token *token = 0; - - for (; (token = get_token(context)) != 0; get_next_token(context)){ - if (token->type == CPP_TOKEN_BRACE_OPEN){ - break; - } - } - - if (token){ - String_Const_char parent_name = {}; - Token *token_j = 0; - - for (; (token_j = get_token(context)) != 0; get_prev_token(context)){ - if (token_j->type == CPP_TOKEN_IDENTIFIER){ - break; - } - } - - parent_name = get_lexeme(*token_j, context->data); - - set_token(context, token); - for (; (token = get_token(context)) > parent_start_token; get_next_token(context)){ - if (token->type == CPP_TOKEN_BRACE_OPEN){ - break; - } - } - - if (token){ - Item_Node *first_member = 0; - Item_Node *head_member = 0; - - for (; (token = get_token(context)) != 0; get_next_token(context)){ - if (token->type == CPP_TOKEN_BRACE_CLOSE){ - break; - } - else if (token->type == CPP_TOKEN_IDENTIFIER){ - String_Const_char doc_string = {}; - String_Const_char name = {}; - String_Const_char value = {}; - get_doc_string_from_prev(context, &doc_string); - - name = get_lexeme(*token, context->data); - - token = get_next_token(context); - - if (token){ - if (token->type == CPP_TOKEN_EQ){ - Token *start_token = token; - - for (; (token = get_token(context)) != 0; get_next_token(context)){ - if (token->type == CPP_TOKEN_COMMA || - token->type == CPP_TOKEN_BRACE_CLOSE){ - break; - } - } - - value = string_skip_chop_whitespace(SCchar_range(context->data, start_token->start + start_token->size, token->start)); - - get_prev_token(context); - } - else{ - get_prev_token(context); - } - } - - Item_Node *new_member = push_array(arena, Item_Node, 1); - if (first_member == 0){ - first_member = new_member; - } - - if (head_member){ - head_member->next_sibling = new_member; - } - head_member = new_member; - - new_member->name = name; - new_member->value = value; - new_member->doc_string = doc_string; - new_member->next_sibling = 0; - } - } - - if ((token = get_token(context)) != 0){ - for (; (token = get_token(context)) != 0; get_next_token(context)){ - if (token->type == CPP_TOKEN_BRACE_CLOSE){ - break; - } - } - get_next_token(context); - - item->t = Item_Enum; - item->name = parent_name; - item->doc_string = parent_doc_string; - item->first_child = first_member; - result = true; - } - } - } - - return(result); -} - -internal Argument_Breakdown -allocate_argument_breakdown(Arena *arena, i32 count){ - Argument_Breakdown breakdown = {}; - if (count > 0){ - breakdown.count = count; - breakdown.args = push_array(arena, Argument, count); - memset(breakdown.args, 0, sizeof(Argument)*count); - } - return(breakdown); -} - -/* -Parse arguments by giving pointers to the tokens: -foo(a, ... , z) - ^ ^ -*/ -internal Argument_Breakdown -parameter_parse(Arena *arena, char *data, Token *args_start_token, Token *args_end_token){ - i32 arg_index = 0; - Token *arg_token = args_start_token + 1; - i32 param_string_start = arg_token->start; - - i32 arg_count = 1; - arg_token = args_start_token; - for (; arg_token < args_end_token; ++arg_token){ - if (arg_token->type == CPP_TOKEN_COMMA){ - ++arg_count; - } - } - - Argument_Breakdown breakdown = allocate_argument_breakdown(arena, arg_count); - - arg_token = args_start_token + 1; - for (; arg_token <= args_end_token; ++arg_token){ - if (arg_token->type == CPP_TOKEN_COMMA || - arg_token->type == CPP_TOKEN_PARENTHESE_CLOSE){ - - i32 size = arg_token->start - param_string_start; - String_Const_char param_string = SCchar(data + param_string_start, size); - param_string = string_chop_whitespace(param_string); - breakdown.args[arg_index].param_string = param_string; - - for (Token *param_name_token = arg_token - 1; - param_name_token->start > param_string_start; - --param_name_token){ - if (param_name_token->type == CPP_TOKEN_IDENTIFIER){ - i32 name_start = param_name_token->start; - i32 name_size = param_name_token->size; - breakdown.args[arg_index].param_name = SCchar(data + name_start, name_size); - break; - } - } - - ++arg_index; - - if (arg_token+1 <= args_end_token){ - param_string_start = arg_token[1].start; - } - } - } - - return(breakdown); -} - -/* -Moves the context in the following way: -~~~~~~~ name( ~~~~~~~ - ^ -> ^ -*/ -internal i32 -function_parse_goto_name(Parse_Context *context){ - i32 result = false; - - Token *token = 0; - - { - for (; (token = get_token(context)) != 0; get_next_token(context)){ - if (token->type == CPP_TOKEN_PARENTHESE_OPEN){ - break; - } - } - - if (get_token(context)){ - do{ - token = get_prev_token(context); - }while(token->type == CPP_TOKEN_COMMENT); - - if (token->type == CPP_TOKEN_IDENTIFIER){ - result = true; - } - } - } - - return(result); -} - -/* -Moves the context in the following way: -~~~~~~~ name( ~~~~~~~ /* XXX // - ^ ---------------> ^ -*/ -internal i32 -function_get_doc(Parse_Context *context, char *data, String_Const_char *doc_string){ - i32 result = false; - - Token *token = get_token(context); - String_Const_char lexeme = {}; - - if (function_parse_goto_name(context)){ - if (token->type == CPP_TOKEN_IDENTIFIER){ - for (; (token = get_token(context)) != 0; get_next_token(context)){ - if (token->type == CPP_TOKEN_COMMENT){ - lexeme = get_lexeme(*token, data); - if (check_and_fix_docs(&lexeme)){ - *doc_string = lexeme; - result = true; - break; - } - } - else if (token->type == CPP_TOKEN_BRACE_OPEN){ - break; - } - } - } - } - - return(result); -} - -internal i32 -cpp_name_parse(Parse_Context *context, String_Const_char *name){ - i32 result = false; - - Token *token = 0; - Token *token_start = get_token(context); - - token = get_next_token(context); - if (token && token->type == CPP_TOKEN_PARENTHESE_OPEN){ - token = get_next_token(context); - if (token && token->type == CPP_TOKEN_IDENTIFIER){ - token = get_next_token(context); - if (token && token->type == CPP_TOKEN_PARENTHESE_CLOSE){ - *name = get_lexeme(*(token-1), context->data); - result = true; - } - } - } - - if (!result){ - set_token(context, token_start); - } - - return(result); -} - -/* -Moves the context in the following way: - RETTY~ name( ~~~~~~~ ) - ^ ---------------> ^ -*/ -internal i32 -function_sig_parse(Arena *arena, Parse_Context *context, Item_Node *item, String_Const_char cpp_name){ - i32 result = false; - - Token *token = 0; - Token *args_start_token = 0; - Token *ret_token = get_token(context); - - if (function_parse_goto_name(context)){ - token = get_token(context); - args_start_token = token+1; - item->name = get_lexeme(*token, context->data); - - item->ret = string_chop_whitespace(SCchar_range(context->data, ret_token->start, token->start)); - - for (; (token = get_token(context)) != 0; get_next_token(context)){ - if (token->type == CPP_TOKEN_PARENTHESE_CLOSE){ - break; - } - } - - if (token){ - item->args = SCchar_range(context->data, args_start_token->start, token->start + token->size); - item->t = Item_Function; - item->cpp_name = cpp_name; - item->breakdown = parameter_parse(arena, context->data, args_start_token, token); - - Assert(get_token(context)->type == CPP_TOKEN_PARENTHESE_CLOSE); - result = true; - } - } - - return(result); -} - -/* -Moves the context in the following way: - MARKER ~~~ name( ~~~~~~~ ) - ^ -------------------> ^ -*/ -internal i32 -function_parse(Arena *arena, Parse_Context *context, Item_Node *item, String_Const_char cpp_name){ - i32 result = false; - - String_Const_char doc_string = {}; - Token *token = get_token(context); - - item->marker = get_lexeme(*token, context->data); - - if (function_get_doc(context, context->data, &doc_string)){ - item->doc_string = doc_string; - } - - set_token(context, token); - if (get_next_token(context)){ - if (function_sig_parse(arena, context, item, cpp_name)){ - Assert(get_token(context)->type == CPP_TOKEN_PARENTHESE_CLOSE); - result = true; - } - } - - return(result); -} - -/* -Moves the context in the following way: - /* ~~~ // #define - ^ ----> ^ -*/ -internal i32 -macro_parse_check(Parse_Context *context){ - i32 result = false; - - Token *token = 0; - - if ((token = get_next_token(context)) != 0){ - if (token->type == CPP_TOKEN_COMMENT){ - if ((token = get_next_token(context)) != 0){ - if (token->type == CPP_PP_DEFINE){ - result = true; - } - } - } - } - - return(result); -} - -/* -Moves the context in the following way: - /* ~~~ // #define ~~~~~~~~~~~~~~~~~ NOT_IN_MACRO_BODY - ^ ----------------------------> ^ -*/ -internal i32 -macro_parse(Arena *arena, Parse_Context *context, Item_Node *item){ - i32 result = false; - - Token *token = 0; - Token *doc_token = 0; - Token *args_start_token = 0; - - String_Const_char doc_string = {}; - - if (macro_parse_check(context)){ - token = get_token(context); - if (can_back_step(context)){ - doc_token = token-1; - - doc_string = get_lexeme(*doc_token, context->data); - - if (check_and_fix_docs(&doc_string)){ - item->doc_string = doc_string; - - for (; (token = get_token(context)) != 0; get_next_token(context)){ - if (token->type == CPP_TOKEN_IDENTIFIER){ - break; - } - } - - if (get_token(context) && (token->flags & CPP_TFLAG_PP_BODY)){ - item->name = get_lexeme(*token, context->data); - - if ((token = get_next_token(context)) != 0){ - args_start_token = token; - for (; (token = get_token(context)) != 0; get_next_token(context)){ - if (token->type == CPP_TOKEN_PARENTHESE_CLOSE){ - break; - } - } - - if (token){ - item->args = SCchar_range(context->data, args_start_token->start, token->start + token->size); - - item->breakdown = parameter_parse(arena, context->data, args_start_token, token); - - if ((token = get_next_token(context)) != 0){ - Token *body_start = token; - - if (body_start->flags & CPP_TFLAG_PP_BODY){ - for (; (token = get_token(context)) != 0; get_next_token(context)){ - if (!(token->flags & CPP_TFLAG_PP_BODY)){ - break; - } - } - - token = get_prev_token(context); - - item->body = SCchar_range(context->data, body_start->start,token->start + token->size); - } - } - - item->t = Item_Macro; - result = true; - } - } - } - } - } - } - - return(result); -} - -internal Meta_Unit -compile_meta_unit(Arena *arena, char *code_directory, char **files, Meta_Keywords *meta_keywords, i32 key_count){ - Meta_Unit unit = {}; - - i32 file_count = 0; - for (char **file_ptr = files; *file_ptr; ++file_ptr, ++file_count); - - unit.count = file_count; - unit.parse = push_array(arena, Parse, file_count); - - b32 all_files_lexed = true; - i32 i = 0; - for (char **file_ptr = files; *file_ptr; ++file_ptr, ++i){ - List_String_Const_char name_list = {}; - string_list_push(arena, &name_list, SCchar(code_directory)); -#if OS_WINDOWS - string_list_push_lit(arena, &name_list, "\\"); -#else - string_list_push_lit(arena, &name_list, "/"); -#endif - string_list_push(arena, &name_list, SCchar(*file_ptr)); - String_Const_char name = string_list_flatten(arena, name_list, StringFill_NullTerminate); - - unit.parse[i] = meta_lex(name.str); - if (unit.parse[i].code.str == 0){ - all_files_lexed = false; - break; - } - } - - if (all_files_lexed){ - // TODO(allen): This stage counts nested structs and unions which is not correct. Luckily it only means we over allocate by a few items, but fixing it to be exactly correct would be nice. - for (i32 J = 0; J < unit.count; ++J){ - Token *token = 0; - Parse_Context context_ = setup_parse_context(unit.parse[J]); - Parse_Context *context = &context_; - - for (; (token = get_token(context)) != 0; get_next_token(context)){ - if (!(token->flags & CPP_TFLAG_PP_BODY)){ - - String_Const_char lexeme = get_lexeme(*token, context->data); - i32 match_index = 0; - if (string_set_match_table(meta_keywords, sizeof(*meta_keywords), key_count, lexeme, &match_index)){ - Item_Type type = meta_keywords[match_index].type; - - if (type > Item_Null && type < Item_Type_Count){ - ++unit.set.count; - } - else{ - // TODO(allen): Warning - } - } - } - } - } - - if (unit.set.count > 0){ - unit.set = allocate_item_set(arena, unit.set.count); - } - - i32 index = 0; - - for (i32 J = 0; J < unit.count; ++J){ - Token *token = 0; - Parse_Context context_ = setup_parse_context(unit.parse[J]); - Parse_Context *context = &context_; - - String_Const_char cpp_name = {}; - i32 has_cpp_name = 0; - - for (; (token = get_token(context)) != 0; get_next_token(context)){ - if (!(token->flags & CPP_TFLAG_PP_BODY)){ - - String_Const_char lexeme = get_lexeme(*token, context->data); - i32 match_index = 0; - if (string_set_match_table(meta_keywords, sizeof(*meta_keywords), key_count, lexeme, &match_index)){ - Item_Type type = meta_keywords[match_index].type; - - switch (type){ - case Item_Function: - { - if (function_parse(arena, context, unit.set.items + index, cpp_name)){ - Assert(unit.set.items[index].t == Item_Function); - ++index; - } - else{ - fprintf(stderr, "warning: invalid function signature\n"); - } - }break; - - case Item_CppName: - { - if (cpp_name_parse(context, &cpp_name)){ - has_cpp_name = 1; - } - else{ - // TODO(allen): warning message - } - }break; - - case Item_Macro: - { - if (macro_parse(arena, context, unit.set.items + index)){ - Assert(unit.set.items[index].t == Item_Macro); - ++index; - } - else{ - // TODO(allen): warning message - } - }break; - - case Item_Typedef: //typedef - { - if (typedef_parse(context, unit.set.items + index)){ - Assert(unit.set.items[index].t == Item_Typedef); - ++index; - } - else{ - // TODO(allen): warning message - } - }break; - - case Item_Struct: case Item_Union: //struct/union - { - if (struct_parse(arena, (type == Item_Struct), context, unit.set.items + index)){ - Assert(unit.set.items[index].t == Item_Struct ||unit.set.items[index].t == Item_Union); - ++index; - } - else{ - // TODO(allen): warning message - } - }break; - - case Item_Enum: //ENUM - { - if (enum_parse(arena, context, unit.set.items + index)){ - Assert(unit.set.items[index].t == Item_Enum); - ++index; - } - else{ - // TODO(allen): warning message - } - }break; - - } - } - } - - if (has_cpp_name){ - has_cpp_name = 0; - } - else{ - block_zero_struct(&cpp_name); - } - - unit.parse[J].item_count = index; - } - - // NOTE(allen): This is necessary for now because - // the original count is slightly overestimated thanks - // to nested structs and unions. - unit.set.count = index; - } - } - else{ - unit.parse = 0; - unit.count = 0; - } - - return(unit); -} - -internal Meta_Unit -compile_meta_unit(Arena *arena, char *code_directory, char *file, Meta_Keywords *meta_keywords, i32 key_count){ - char *file_array[2] = {file, 0}; - return(compile_meta_unit(arena, code_directory, file_array, meta_keywords, key_count)); -} - -#endif +#error kill this // BOTTOM diff --git a/meta/4ed_metagen.cpp b/meta/4ed_metagen.cpp deleted file mode 100644 index d039b4c5..00000000 --- a/meta/4ed_metagen.cpp +++ /dev/null @@ -1,1111 +0,0 @@ -/* - * Mr. 4th Dimention - Allen Webster - * - * 25.02.2016 - * - * File editing view for 4coder - * - */ - -// TOP - -#define API_H "4coder_generated/app_functions.h" -#define REMAPPING_FILE "4coder_generated/remapping.h" - -#include "4coder_base_types.h" -#include "4ed_meta_defines.h" -#include "4coder_API/4coder_version.h" -#include "4coder_API/4coder_keycodes.h" - -#include "4coder_base_types.cpp" -#include "4coder_stringf.cpp" -# define FSTRING_IMPLEMENTATION -#include "4coder_lib/4cpp_lexer.h" - -#include -#include -#include - -#define FTECH_FILE_MOVING_IMPLEMENTATION -#include "4ed_file_moving.h" -#include "4ed_meta_parser.cpp" -#include "4ed_meta_keywords.h" - -// -// Meta Parse Rules -// - -struct App_API_Name{ - String_Const_char macro; - String_Const_char public_name; -}; - -struct App_API{ - App_API_Name *names; -}; - -internal App_API -allocate_app_api(Arena *arena, i32 count){ - App_API app_api = {}; - app_api.names = push_array(arena, App_API_Name, count); - memset(app_api.names, 0, sizeof(App_API_Name)*count); - return(app_api); -} - -internal void -generate_custom_headers(Arena *arena){ - Temp_Memory temp = begin_temp(arena); - - // NOTE(allen): Parse the customization API files - static char *functions_files[] = { "4ed_api_implementation.cpp", 0 }; - Meta_Unit unit_custom = compile_meta_unit(arena, ".", functions_files, ExpandArray(meta_keywords)); - if (unit_custom.parse == 0){ - Assert(!"Missing one or more input files!"); - } - - // NOTE(allen): Compute and store variations of the function names - App_API func_4ed_names = allocate_app_api(arena, unit_custom.set.count); - - for (i32 i = 0; i < unit_custom.set.count; ++i){ - String_Const_char name_string = unit_custom.set.items[i].name; - - List_String_Const_char macro_list = {}; - string_list_push(arena, ¯o_list, string_mod_upper(push_string_copy(arena, name_string))); - string_list_push_lit(arena, ¯o_list, "_SIG"); - func_4ed_names.names[i].macro = string_list_flatten(arena, macro_list); - - func_4ed_names.names[i].public_name = string_mod_lower(push_string_copy(arena, name_string)); - } - - // NOTE(allen): Output - List_String_Const_char out_list = {}; - - // NOTE(allen): Custom API headers - string_list_push_lit(arena, &out_list, "struct Application_Links;\n"); - - for (i32 i = 0; i < unit_custom.set.count; ++i){ - string_list_pushf(arena, &out_list, "#define %.*s(n) %.*s n%.*s\n", - string_expand(func_4ed_names.names[i].macro), - string_expand(unit_custom.set.items[i].ret), - string_expand(unit_custom.set.items[i].args)); -#if 0 - append(&out, "#define "); - append(&out, func_4ed_names.names[i].macro); - append(&out, "(n) "); - append(&out, unit_custom.set.items[i].ret); - append(&out, " n"); - append(&out, unit_custom.set.items[i].args); - append_s_char(&out, '\n'); -#endif - } - - for (i32 i = 0; i < unit_custom.set.count; ++i){ - string_list_pushf(arena, &out_list, "typedef %.*s(%.*s_Function);\n", - string_expand(func_4ed_names.names[i].macro), - string_expand(unit_custom.set.items[i].name)); -#if 0 - append(&out, "typedef "); - append(&out, func_4ed_names.names[i].macro); - append_s_char(&out, '('); - append(&out, unit_custom.set.items[i].name); - append(&out, "_Function);\n"); -#endif - } - - string_list_push_lit(arena, &out_list, "struct Application_Links{\n"); - string_list_push_lit(arena, &out_list, "#if defined(ALLOW_DEP_4CODER)\n"); - for (i32 i = 0; i < unit_custom.set.count; ++i){ - string_list_pushf(arena, &out_list, "%.*s_Function *%.*s;\n", - string_expand(unit_custom.set.items[i].name), - string_expand(func_4ed_names.names[i].public_name)); -#if 0 - append(&out, unit_custom.set.items[i].name); - append(&out, "_Function *"); - append(&out, func_4ed_names.names[i].public_name); - append(&out, ";\n"); -#endif - } - - string_list_push_lit(arena, &out_list, "#else\n"); - - for (i32 i = 0; i < unit_custom.set.count; ++i){ - string_list_pushf(arena, &out_list, "%.*s_Function *%.*s_;\n", - string_expand(unit_custom.set.items[i].name), - string_expand(func_4ed_names.names[i].public_name)); -#if 0 - append(&out, unit_custom.set.items[i].name); - append(&out, "_Function *"); - append(&out, func_4ed_names.names[i].public_name); - append(&out, "_;\n"); -#endif - } - - string_list_push_lit(arena, &out_list, "#endif\n"); - - string_list_push_lit(arena, &out_list, - "void *memory;\n" - "int32_t memory_size;\n" - "void *cmd_context;\n" - "void *system_links;\n" - "void *current_coroutine;\n" - "int32_t type_coroutine;\n" - "};\n"); - - string_list_push_lit(arena, &out_list, "#define FillAppLinksAPI(app_links) do{"); - - for (i32 i = 0; i < unit_custom.set.count; ++i){ - string_list_pushf(arena, &out_list, "\\\napp_links->%.*s_ = %.*s;", - string_expand(func_4ed_names.names[i].public_name), - string_expand(unit_custom.set.items[i].name)); - } - - string_list_push_lit(arena, &out_list, "} while(false)\n"); - - string_list_push_lit(arena, &out_list, "#if defined(ALLOW_DEP_4CODER)\n"); - for (i32 use_dep = 1; use_dep >= 0; --use_dep){ - for (i32 i = 0; i < unit_custom.set.count; ++i){ - Argument_Breakdown breakdown = unit_custom.set.items[i].breakdown; - String_Const_char ret = unit_custom.set.items[i].ret; - String_Const_char public_name = func_4ed_names.names[i].public_name; - - string_list_pushf(arena, &out_list, "static %.*s %.*s(", - string_expand(ret), string_expand(public_name)); - for (i32 j = 0; j < breakdown.count; j += 1){ - if (j + 1 != breakdown.count){ - string_list_pushf(arena, &out_list, "%.*s, ", - string_expand(breakdown.args[j].param_string)); - } - else{ - string_list_push(arena, &out_list, breakdown.args[j].param_string); - } - } - string_list_push_lit(arena, &out_list, "){"); - - if (string_match(ret, string_litexpr("void"))){ - string_list_push_lit(arena, &out_list, "("); - } - else{ - string_list_push_lit(arena, &out_list, "return("); - } - - string_list_pushf(arena, &out_list, "app->%.*s", string_expand(public_name)); - if (!use_dep){ - string_list_push_lit(arena, &out_list, "_"); - } - - string_list_push_lit(arena, &out_list, "("); - for (i32 j = 0; j < breakdown.count; ++j){ - if (j + 1 != breakdown.count){ - string_list_pushf(arena, &out_list, "%.*s, ", - string_expand(breakdown.args[j].param_name)); - } - else{ - string_list_push(arena, &out_list, breakdown.args[j].param_name); - } - } - string_list_push_lit(arena, &out_list, "));}\n"); - } - if (use_dep == 1){ - string_list_push_lit(arena, &out_list, "#else\n"); - } - } - string_list_push_lit(arena, &out_list, "#endif\n"); - - String_Const_char out = string_list_flatten(arena, out_list); - fm_write_file(API_H, out.str, (i32)out.size); - - end_temp(temp); -} - -////////////////////////////////////////////////////////////////////////////////////////////////// - -struct Key_Bind{ - Key_Bind *next; - - b32 vanilla; - u32 keycode; - u32 modifiers; - - char *command; - i32 command_len; -}; - -struct Sub_Map{ - Sub_Map *next; - - char *name; - i32 name_len; - char *description; - i32 description_len; - char *parent; - i32 parent_len; - b32 has_vanilla; - Key_Bind *first_key_bind; - Key_Bind *last_key_bind; - i32 key_bind_count; -}; - -struct Mapping{ - Mapping *next; - - char *name; - i32 name_len; - char *description; - i32 description_len; - Sub_Map *first_sub_map; - Sub_Map *last_sub_map; - i32 sub_map_count; -}; - -struct Mapping_Array{ - Mapping *first_mapping; - Mapping *last_mapping; - i32 mapping_count; - - Mapping *current_mapping; - Sub_Map *current_sub_map; -}; - -enum{ - MDFR_NONE = 0x0, - MDFR_CTRL = 0x1, - MDFR_ALT = 0x2, - MDFR_CMND = 0x4, - MDFR_SHIFT = 0x8, -}; - -////////////////////////////////////////////////////////////////////////////////////////////////// - -internal void -emit_begin_mapping(Arena *arena, Mapping_Array *array, char *name, char *description){ - Assert(array->current_mapping == 0); - Mapping *mapping = push_array(arena, Mapping, 1); - mapping->name = fm_basic_str(arena, name); - mapping->name_len = (i32)cstring_length(name); - mapping->description = fm_basic_str(arena, description); - mapping->description_len = (i32)cstring_length(description); - mapping->first_sub_map = 0; - mapping->last_sub_map = 0; - mapping->sub_map_count = 0; - sll_queue_push(array->first_mapping, array->last_mapping, mapping); - ++array->mapping_count; - array->current_mapping = mapping; -} - -internal void -emit_end_mapping(Mapping_Array *array){ - Assert(array->current_mapping != 0); - array->current_mapping = 0; -} - -internal void -emit_begin_map(Arena *arena, Mapping_Array *array, char *mapid, char *description){ - Assert(array->current_mapping != 0); - Assert(array->current_sub_map == 0); - - Sub_Map *sub_map = push_array(arena, Sub_Map, 1); - sub_map->name = fm_basic_str(arena, mapid); - sub_map->name_len = (i32)cstring_length(mapid); - sub_map->description = fm_basic_str(arena, description); - sub_map->description_len = (i32)cstring_length(description); - sub_map->parent = 0; - sub_map->parent_len = 0; - sub_map->first_key_bind = 0; - sub_map->last_key_bind = 0; - sub_map->key_bind_count = 0; - - Mapping *mapping = array->current_mapping; - sll_queue_push(mapping->first_sub_map, mapping->last_sub_map, sub_map); - ++mapping->sub_map_count; - - array->current_sub_map = sub_map; -} - -internal void -emit_end_map(Mapping_Array *array){ - Assert(array->current_mapping != 0); - Assert(array->current_sub_map != 0); - array->current_sub_map = 0; -} - -internal void -emit_inherit_map(Arena *arena, Mapping_Array *array, char *mapid){ - Assert(array->current_mapping != 0); - Assert(array->current_sub_map != 0); - - Sub_Map *sub_map = array->current_sub_map; - Assert(sub_map->parent == 0); - - sub_map->parent = fm_basic_str(arena, mapid); - sub_map->parent_len = (i32)cstring_length(mapid); -} - -internal void -emit_bind(Arena *arena, Mapping_Array *array, u32 keycode, u32 modifiers, char *command){ - Assert(array->current_mapping != 0); - Assert(array->current_sub_map != 0); - - b32 is_duplicate = false; - Sub_Map *sub_map = array->current_sub_map; - for (Key_Bind *bind = sub_map->first_key_bind; - bind != 0; - bind = bind->next){ - if (!bind->vanilla && keycode == bind->keycode && modifiers == bind->modifiers){ - fprintf(stdout, "duplicate binding for %u %u\n", keycode, modifiers); - is_duplicate = true; - break; - } - } - - if (!is_duplicate){ - Key_Bind *bind = push_array(arena, Key_Bind, 1); - bind->vanilla = false; - bind->keycode = keycode; - bind->modifiers = modifiers; - bind->command = fm_basic_str(arena, command); - bind->command_len = (i32)cstring_length(command); - sll_queue_push(sub_map->first_key_bind, sub_map->last_key_bind, bind); - ++sub_map->key_bind_count; - } -} - -internal void -emit_bind_all_modifiers(Arena *arena, Mapping_Array *mappings, u32 code, char *command){ - emit_bind(arena, mappings, code, MDFR_NONE, command); - emit_bind(arena, mappings, code, MDFR_CTRL, command); - emit_bind(arena, mappings, code, MDFR_ALT , command); - emit_bind(arena, mappings, code, MDFR_CMND, command); - emit_bind(arena, mappings, code, MDFR_CTRL|MDFR_ALT , command); - emit_bind(arena, mappings, code, MDFR_ALT |MDFR_CMND, command); - emit_bind(arena, mappings, code, MDFR_CTRL|MDFR_CMND, command); - emit_bind(arena, mappings, code, MDFR_CTRL|MDFR_ALT|MDFR_CMND, command); -} - -internal void -emit_bind_vanilla_keys(Arena *arena, Mapping_Array *array, u32 modifiers, char *command){ - Assert(array->current_mapping != 0); - Assert(array->current_sub_map != 0); - - b32 is_duplicate = false; - Sub_Map *sub_map = array->current_sub_map; - for (Key_Bind *bind = sub_map->first_key_bind; - bind != 0; - bind = bind->next){ - if (bind->vanilla && modifiers == bind->modifiers){ - fprintf(stdout, "duplicate vanilla binding %u\n", modifiers); - is_duplicate = true; - break; - } - } - - if (!is_duplicate){ - Key_Bind *bind = push_array(arena, Key_Bind, 1); - bind->vanilla = true; - bind->keycode = 0; - bind->modifiers = modifiers; - bind->command = fm_basic_str(arena, command); - bind->command_len = (i32)cstring_length(command); - sll_queue_push(sub_map->first_key_bind, sub_map->last_key_bind, bind); - ++sub_map->key_bind_count; - } -} - -#define begin_mapping(pa,mp,n,d) emit_begin_mapping(pa,mp, #n, d) -#define end_mapping(mp) emit_end_mapping(mp) -#define begin_map(pa,mp,mapid,d) emit_begin_map(pa,mp, #mapid, d) -#define end_map(mp) emit_end_map(mp) -#define inherit_map(pa,mp,mapid) emit_inherit_map(pa,mp, #mapid) -#define bind(pa,mp,k,md,c) emit_bind(pa,mp, k, md, #c) -#define bind_all_modifiers(pa,mp,k,c) emit_bind_all_modifiers(pa,mp, k, #c) -#define bind_vanilla_keys(pa,mp,md,c) emit_bind_vanilla_keys(pa,mp, md, #c) - -////////////////////////////////////////////////////////////////////////////////////////////////// - -internal void -generate_remapping_code_and_data(Arena *arena){ - Temp_Memory temp = begin_temp(arena); - - // Generate mapping array data structure - Mapping_Array mappings_ = {}; - Mapping_Array *mappings = &mappings_; - - begin_mapping(arena, mappings, default, "The default 4coder bindings - typically good for Windows and Linux"); - { - // NOTE(allen): GLOBAL - begin_map(arena, mappings, mapid_global, "The following bindings apply in all situations."); - - bind(arena, mappings, ',', MDFR_CTRL, change_active_panel); - bind(arena, mappings, '<', MDFR_CTRL, change_active_panel_backwards); - - bind(arena, mappings, 'n', MDFR_CTRL, interactive_new); - bind(arena, mappings, 'o', MDFR_CTRL, interactive_open_or_new); - bind(arena, mappings, 'o', MDFR_ALT , open_in_other); - bind(arena, mappings, 'k', MDFR_CTRL, interactive_kill_buffer); - bind(arena, mappings, 'i', MDFR_CTRL, interactive_switch_buffer); - bind(arena, mappings, 'h', MDFR_CTRL, project_go_to_root_directory); - bind(arena, mappings, 'S', MDFR_CTRL, save_all_dirty_buffers); - - bind(arena, mappings, key_scroll_lock, MDFR_NONE, toggle_filebar); - bind(arena, mappings, key_pause, MDFR_NONE, toggle_filebar); - bind(arena, mappings, key_caps, MDFR_NONE, toggle_filebar); - - bind(arena, mappings, '.', MDFR_ALT, change_to_build_panel); - bind(arena, mappings, ',', MDFR_ALT, close_build_panel); - bind(arena, mappings, 'n', MDFR_ALT, goto_next_jump); - bind(arena, mappings, 'N', MDFR_ALT, goto_prev_jump); - bind(arena, mappings, 'M', MDFR_ALT, goto_first_jump); - bind(arena, mappings, 'm', MDFR_ALT, build_in_build_panel); - bind(arena, mappings, 'b', MDFR_ALT, toggle_filebar); - - bind(arena, mappings, 'z', MDFR_ALT, execute_any_cli); - bind(arena, mappings, 'Z', MDFR_ALT, execute_previous_cli); - - bind(arena, mappings, 'x', MDFR_ALT, command_lister); - bind(arena, mappings, 'X', MDFR_ALT, project_command_lister); - - bind(arena, mappings, 'I', MDFR_CTRL, list_all_functions_all_buffers_lister); - bind(arena, mappings, 'E', MDFR_ALT, exit_4coder); - - bind(arena, mappings, key_f1, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f2, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f3, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f4, MDFR_NONE, project_fkey_command); - - bind(arena, mappings, key_f5, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f6, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f7, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f8, MDFR_NONE, project_fkey_command); - - bind(arena, mappings, key_f9, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f10, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f11, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f12, MDFR_NONE, project_fkey_command); - - bind(arena, mappings, key_f13, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f14, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f15, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f16, MDFR_NONE, project_fkey_command); - - bind(arena, mappings, key_mouse_wheel, MDFR_NONE, mouse_wheel_scroll); - bind(arena, mappings, key_mouse_wheel, MDFR_CTRL, mouse_wheel_change_face_size); - - end_map(mappings); - - // NOTE(allen): FILE - begin_map(arena, mappings, mapid_file, "The following bindings apply in general text files and most apply in code files, but some are overriden by other commands specific to code files."); - - bind_vanilla_keys(arena, mappings, MDFR_NONE, write_character); - - bind(arena, mappings, key_mouse_left, MDFR_NONE, click_set_cursor_and_mark); - bind(arena, mappings, key_click_activate_view, MDFR_NONE, click_set_cursor_and_mark); - bind(arena, mappings, key_mouse_left_release, MDFR_NONE, click_set_cursor); - bind(arena, mappings, key_mouse_move, MDFR_NONE, click_set_cursor_if_lbutton); - - bind(arena, mappings, key_del, MDFR_NONE, delete_char); - bind(arena, mappings, key_del, MDFR_SHIFT, delete_char); - bind(arena, mappings, key_back, MDFR_NONE, backspace_char); - bind(arena, mappings, key_back, MDFR_SHIFT, backspace_char); - - bind(arena, mappings, key_up, MDFR_NONE, move_up); - bind(arena, mappings, key_down, MDFR_NONE, move_down); - bind(arena, mappings, key_left, MDFR_NONE, move_left); - bind(arena, mappings, key_right, MDFR_NONE, move_right); - bind(arena, mappings, key_up, MDFR_SHIFT, move_up); - bind(arena, mappings, key_down, MDFR_SHIFT, move_down); - bind(arena, mappings, key_left, MDFR_SHIFT, move_left); - bind(arena, mappings, key_right, MDFR_SHIFT, move_right); - - bind(arena, mappings, key_end, MDFR_NONE, seek_end_of_line); - bind(arena, mappings, key_home, MDFR_NONE, seek_beginning_of_line); - bind(arena, mappings, key_page_up, MDFR_CTRL, goto_beginning_of_file); - bind(arena, mappings, key_page_down, MDFR_CTRL, goto_end_of_file); - bind(arena, mappings, key_page_up, MDFR_NONE, page_up); - bind(arena, mappings, key_page_down, MDFR_NONE, page_down); - bind(arena, mappings, key_end, MDFR_SHIFT, seek_end_of_line); - bind(arena, mappings, key_home, MDFR_SHIFT, seek_beginning_of_line); - bind(arena, mappings, key_page_up, MDFR_CTRL|MDFR_SHIFT, goto_beginning_of_file); - bind(arena, mappings, key_page_down, MDFR_CTRL|MDFR_SHIFT, goto_end_of_file); - bind(arena, mappings, key_page_up, MDFR_SHIFT, page_up); - bind(arena, mappings, key_page_down, MDFR_SHIFT, page_down); - - bind(arena, mappings, key_up, MDFR_CTRL, move_up_to_blank_line_skip_whitespace); - bind(arena, mappings, key_down, MDFR_CTRL, move_down_to_blank_line_end); - bind(arena, mappings, key_left, MDFR_CTRL, move_left_whitespace_boundary); - bind(arena, mappings, key_right, MDFR_CTRL, move_right_whitespace_boundary); - bind(arena, mappings, key_up, MDFR_CTRL|MDFR_SHIFT, move_up_to_blank_line_skip_whitespace); - bind(arena, mappings, key_down, MDFR_CTRL|MDFR_SHIFT, move_down_to_blank_line_end); - bind(arena, mappings, key_left, MDFR_CTRL|MDFR_SHIFT, move_left_whitespace_boundary); - bind(arena, mappings, key_right, MDFR_CTRL|MDFR_SHIFT, move_right_whitespace_boundary); - - bind(arena, mappings, key_up, MDFR_ALT, move_line_up); - bind(arena, mappings, key_down, MDFR_ALT, move_line_down); - - bind(arena, mappings, key_back, MDFR_CTRL, backspace_alpha_numeric_boundary); - bind(arena, mappings, key_del, MDFR_CTRL, delete_alpha_numeric_boundary); - bind(arena, mappings, key_back, MDFR_ALT, snipe_backward_whitespace_or_token_boundary); - bind(arena, mappings, key_del, MDFR_ALT, snipe_forward_whitespace_or_token_boundary); - - bind(arena, mappings, ' ', MDFR_CTRL, set_mark); - bind(arena, mappings, 'a', MDFR_CTRL, replace_in_range); - bind(arena, mappings, 'c', MDFR_CTRL, copy); - bind(arena, mappings, 'd', MDFR_CTRL, delete_range); - bind(arena, mappings, 'D', MDFR_CTRL, delete_line); - bind(arena, mappings, 'e', MDFR_CTRL, center_view); - bind(arena, mappings, 'E', MDFR_CTRL, left_adjust_view); - bind(arena, mappings, 'f', MDFR_CTRL, search); - bind(arena, mappings, 'F', MDFR_CTRL, list_all_locations); - bind(arena, mappings, 'F', MDFR_ALT , list_all_substring_locations_case_insensitive); - bind(arena, mappings, 'g', MDFR_CTRL, goto_line); - bind(arena, mappings, 'G', MDFR_CTRL, list_all_locations_of_selection); - bind(arena, mappings, 'j', MDFR_CTRL, snippet_lister); - bind(arena, mappings, 'K', MDFR_CTRL, kill_buffer); - bind(arena, mappings, 'L', MDFR_CTRL, duplicate_line); - bind(arena, mappings, 'm', MDFR_CTRL, cursor_mark_swap); - bind(arena, mappings, 'O', MDFR_CTRL, reopen); - bind(arena, mappings, 'q', MDFR_CTRL, query_replace); - bind(arena, mappings, 'Q', MDFR_CTRL, query_replace_identifier); - bind(arena, mappings, 'q', MDFR_ALT , query_replace_selection); - bind(arena, mappings, 'r', MDFR_CTRL, reverse_search); - bind(arena, mappings, 's', MDFR_CTRL, save); - bind(arena, mappings, 't', MDFR_CTRL, search_identifier); - bind(arena, mappings, 'T', MDFR_CTRL, list_all_locations_of_identifier); - bind(arena, mappings, 'v', MDFR_CTRL, paste_and_indent); - bind(arena, mappings, 'V', MDFR_CTRL, paste_next_and_indent); - bind(arena, mappings, 'x', MDFR_CTRL, cut); - bind(arena, mappings, 'y', MDFR_CTRL, redo); - bind(arena, mappings, 'z', MDFR_CTRL, undo); - - bind(arena, mappings, '1', MDFR_CTRL, view_buffer_other_panel); - bind(arena, mappings, '2', MDFR_CTRL, swap_buffers_between_panels); - - bind(arena, mappings, '\n', MDFR_NONE, newline_or_goto_position); - bind(arena, mappings, '\n', MDFR_SHIFT, newline_or_goto_position_same_panel); - bind(arena, mappings, '>', MDFR_CTRL, view_jump_list_with_lister); - bind(arena, mappings, ' ', MDFR_SHIFT, write_character); - - end_map(mappings); - - // NOTE(allen): CODE - begin_map(arena, mappings, default_code_map, "The following commands only apply in files where the lexer (syntax highlighting) is turned on."); - - inherit_map(arena, mappings, mapid_file); - - bind(arena, mappings, key_left , MDFR_CTRL, move_left_alpha_numeric_or_camel_boundary); - bind(arena, mappings, key_right, MDFR_CTRL, move_right_alpha_numeric_or_camel_boundary); - - bind(arena, mappings, key_left , MDFR_ALT, move_left_alpha_numeric_boundary); - bind(arena, mappings, key_right, MDFR_ALT, move_right_alpha_numeric_boundary); - - bind(arena, mappings, '\n', MDFR_NONE, write_and_auto_tab); - bind(arena, mappings, '\n', MDFR_SHIFT, write_and_auto_tab); - bind(arena, mappings, '}', MDFR_NONE, write_and_auto_tab); - bind(arena, mappings, ')', MDFR_NONE, write_and_auto_tab); - bind(arena, mappings, ']', MDFR_NONE, write_and_auto_tab); - bind(arena, mappings, ';', MDFR_NONE, write_and_auto_tab); - bind(arena, mappings, '#', MDFR_NONE, write_and_auto_tab); - - bind(arena, mappings, ';', MDFR_CTRL, comment_line_toggle); - - bind(arena, mappings, '\t', MDFR_NONE, word_complete); - bind(arena, mappings, '\t', MDFR_CTRL, auto_tab_range); - bind(arena, mappings, '\t', MDFR_SHIFT, auto_tab_line_at_cursor); - - bind(arena, mappings, 'r', MDFR_ALT, write_block); - bind(arena, mappings, 't', MDFR_ALT, write_todo); - bind(arena, mappings, 'y', MDFR_ALT, write_note); - - bind(arena, mappings, 'D', MDFR_ALT, list_all_locations_of_type_definition); - bind(arena, mappings, 'T', MDFR_ALT, list_all_locations_of_type_definition_of_identifier); - - bind(arena, mappings, '[', MDFR_CTRL, open_long_braces); - bind(arena, mappings, '{', MDFR_CTRL, open_long_braces_semicolon); - bind(arena, mappings, '}', MDFR_CTRL, open_long_braces_break); - - bind(arena, mappings, '[', MDFR_ALT, select_surrounding_scope); - bind(arena, mappings, ']', MDFR_ALT, select_prev_scope_absolute); - bind(arena, mappings, '\'', MDFR_ALT, select_next_scope_absolute); - bind(arena, mappings, '/', MDFR_ALT, place_in_scope); - bind(arena, mappings, '-', MDFR_ALT, delete_current_scope); - bind(arena, mappings, 'j', MDFR_ALT, scope_absorb_down); - - bind(arena, mappings, 'i', MDFR_ALT, if0_off); - - bind(arena, mappings, '1', MDFR_ALT, open_file_in_quotes); - bind(arena, mappings, '2', MDFR_ALT, open_matching_file_cpp); - bind(arena, mappings, '0', MDFR_CTRL, write_zero_struct); - - end_map(mappings); - - // NOTE(allen): LISTER - begin_map(arena, mappings, default_lister_ui_map, - "These commands apply in 'lister mode' such as when you open a file."); - - bind_vanilla_keys(arena, mappings, MDFR_NONE, lister__write_character); - bind(arena, mappings, key_esc, MDFR_NONE, lister__quit); - bind(arena, mappings, '\n', MDFR_NONE, lister__activate); - bind(arena, mappings, '\t', MDFR_NONE, lister__activate); - bind_all_modifiers(arena, mappings, key_back, lister__backspace_text_field); - bind(arena, mappings, key_up , MDFR_NONE, lister__move_up); - bind(arena, mappings, 'k' , MDFR_ALT , lister__move_up); - bind(arena, mappings, key_page_up , MDFR_NONE, lister__move_up); - bind(arena, mappings, key_down , MDFR_NONE, lister__move_down); - bind(arena, mappings, 'j' , MDFR_ALT , lister__move_down); - bind(arena, mappings, key_page_down, MDFR_NONE, lister__move_down); - bind(arena, mappings, key_mouse_wheel , MDFR_NONE, lister__wheel_scroll); - bind(arena, mappings, key_mouse_left , MDFR_NONE, lister__mouse_press); - bind(arena, mappings, key_mouse_left_release, MDFR_NONE, lister__mouse_release); - bind(arena, mappings, key_mouse_move, MDFR_NONE, lister__repaint); - bind(arena, mappings, key_animate , MDFR_NONE, lister__repaint); - - end_map(mappings); - } - end_mapping(mappings); - - begin_mapping(arena, mappings, mac_default, "Default 4coder bindings on a Mac keyboard"); - { - // NOTE(allen): GLOBAL - begin_map(arena, mappings, mapid_global, "The following bindings apply in all situations."); - - bind(arena, mappings, ',', MDFR_CMND, change_active_panel); - bind(arena, mappings, '<', MDFR_CMND, change_active_panel_backwards); - - bind(arena, mappings, 'n', MDFR_CMND, interactive_new); - bind(arena, mappings, 'o', MDFR_CMND, interactive_open_or_new); - bind(arena, mappings, 'o', MDFR_CTRL, open_in_other); - bind(arena, mappings, 'k', MDFR_CMND, interactive_kill_buffer); - bind(arena, mappings, 'i', MDFR_CMND, interactive_switch_buffer); - bind(arena, mappings, 'h', MDFR_CMND, project_go_to_root_directory); - bind(arena, mappings, 'S', MDFR_CMND, save_all_dirty_buffers); - - bind(arena, mappings, '.', MDFR_CTRL, change_to_build_panel); - bind(arena, mappings, ',', MDFR_CTRL, close_build_panel); - bind(arena, mappings, 'n', MDFR_CTRL, goto_next_jump); - bind(arena, mappings, 'N', MDFR_CTRL, goto_prev_jump); - bind(arena, mappings, 'M', MDFR_CTRL, goto_first_jump); - bind(arena, mappings, 'm', MDFR_CTRL, build_in_build_panel); - bind(arena, mappings, 'b', MDFR_CTRL, toggle_filebar); - - bind(arena, mappings, 'z', MDFR_CTRL, execute_any_cli); - bind(arena, mappings, 'Z', MDFR_CTRL, execute_previous_cli); - - bind(arena, mappings, 'x', MDFR_CTRL, command_lister); - bind(arena, mappings, 'X', MDFR_CTRL, project_command_lister); - - bind(arena, mappings, 'I', MDFR_CMND, list_all_functions_all_buffers_lister); - bind(arena, mappings, 'E', MDFR_CTRL, exit_4coder); - - bind(arena, mappings, key_f1, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f2, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f3, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f4, MDFR_NONE, project_fkey_command); - - bind(arena, mappings, key_f5, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f6, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f7, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f8, MDFR_NONE, project_fkey_command); - - bind(arena, mappings, key_f9, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f10, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f11, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f12, MDFR_NONE, project_fkey_command); - - bind(arena, mappings, key_f13, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f14, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f15, MDFR_NONE, project_fkey_command); - bind(arena, mappings, key_f16, MDFR_NONE, project_fkey_command); - - bind(arena, mappings, key_mouse_wheel, MDFR_NONE, mouse_wheel_scroll); - bind(arena, mappings, key_mouse_wheel, MDFR_CMND, mouse_wheel_change_face_size); - - end_map(mappings); - - // NOTE(allen): FILE - begin_map(arena, mappings, mapid_file, "The following bindings apply in general text files and most apply in code files, but some are overriden by other commands specific to code files."); - - bind_vanilla_keys(arena, mappings, MDFR_NONE, write_character); - bind_vanilla_keys(arena, mappings, MDFR_ALT, write_character); - - bind(arena, mappings, key_mouse_left, MDFR_NONE, click_set_cursor_and_mark); - bind(arena, mappings, key_click_activate_view, MDFR_NONE, click_set_cursor_and_mark); - bind(arena, mappings, key_mouse_left_release, MDFR_NONE, click_set_cursor); - bind(arena, mappings, key_mouse_move, MDFR_NONE, click_set_cursor_if_lbutton); - - bind(arena, mappings, key_del, MDFR_NONE, delete_char); - bind(arena, mappings, key_del, MDFR_SHIFT, delete_char); - bind(arena, mappings, key_back, MDFR_NONE, backspace_char); - bind(arena, mappings, key_back, MDFR_SHIFT, backspace_char); - - bind(arena, mappings, key_up, MDFR_NONE, move_up); - bind(arena, mappings, key_down, MDFR_NONE, move_down); - bind(arena, mappings, key_left, MDFR_NONE, move_left); - bind(arena, mappings, key_right, MDFR_NONE, move_right); - bind(arena, mappings, key_up, MDFR_SHIFT, move_up); - bind(arena, mappings, key_down, MDFR_SHIFT, move_down); - bind(arena, mappings, key_left, MDFR_SHIFT, move_left); - bind(arena, mappings, key_right, MDFR_SHIFT, move_right); - - bind(arena, mappings, key_end, MDFR_NONE, seek_end_of_line); - bind(arena, mappings, key_home, MDFR_NONE, seek_beginning_of_line); - bind(arena, mappings, key_page_up, MDFR_CTRL, goto_beginning_of_file); - bind(arena, mappings, key_page_down, MDFR_CTRL, goto_end_of_file); - bind(arena, mappings, key_page_up, MDFR_NONE, page_up); - bind(arena, mappings, key_page_down, MDFR_NONE, page_down); - bind(arena, mappings, key_end, MDFR_SHIFT, seek_end_of_line); - bind(arena, mappings, key_home, MDFR_SHIFT, seek_beginning_of_line); - bind(arena, mappings, key_page_up, MDFR_CTRL|MDFR_SHIFT, goto_beginning_of_file); - bind(arena, mappings, key_page_down, MDFR_CTRL|MDFR_SHIFT, goto_end_of_file); - bind(arena, mappings, key_page_up, MDFR_SHIFT, page_up); - bind(arena, mappings, key_page_down, MDFR_SHIFT, page_down); - - bind(arena, mappings, key_up, MDFR_CMND, move_up_to_blank_line_skip_whitespace); - bind(arena, mappings, key_down, MDFR_CMND, move_down_to_blank_line_end); - bind(arena, mappings, key_left, MDFR_CMND, move_left_whitespace_boundary); - bind(arena, mappings, key_right, MDFR_CMND, move_right_whitespace_boundary); - bind(arena, mappings, key_up, MDFR_CMND|MDFR_SHIFT, move_up_to_blank_line_skip_whitespace); - bind(arena, mappings, key_down, MDFR_CMND|MDFR_SHIFT, move_down_to_blank_line_end); - bind(arena, mappings, key_left, MDFR_CMND|MDFR_SHIFT, move_left_whitespace_boundary); - bind(arena, mappings, key_right, MDFR_CMND|MDFR_SHIFT, move_right_whitespace_boundary); - - bind(arena, mappings, key_up, MDFR_ALT, move_line_up); - bind(arena, mappings, key_down, MDFR_ALT, move_line_down); - - bind(arena, mappings, key_back, MDFR_CMND, backspace_alpha_numeric_boundary); - bind(arena, mappings, key_del, MDFR_CMND, delete_alpha_numeric_boundary); - bind(arena, mappings, key_back, MDFR_CTRL, snipe_backward_whitespace_or_token_boundary); - bind(arena, mappings, key_del, MDFR_CTRL, snipe_forward_whitespace_or_token_boundary); - - bind(arena, mappings, '/', MDFR_CMND, set_mark); - bind(arena, mappings, 'a', MDFR_CMND, replace_in_range); - bind(arena, mappings, 'c', MDFR_CMND, copy); - bind(arena, mappings, 'd', MDFR_CMND, delete_range); - bind(arena, mappings, 'D', MDFR_CMND, delete_line); - bind(arena, mappings, 'e', MDFR_CMND, center_view); - bind(arena, mappings, 'E', MDFR_CMND, left_adjust_view); - bind(arena, mappings, 'f', MDFR_CMND, search); - bind(arena, mappings, 'F', MDFR_CMND, list_all_locations); - bind(arena, mappings, 'F', MDFR_CTRL, list_all_substring_locations_case_insensitive); - bind(arena, mappings, 'g', MDFR_CMND, goto_line); - bind(arena, mappings, 'G', MDFR_CMND, list_all_locations_of_selection); - bind(arena, mappings, 'K', MDFR_CMND, kill_buffer); - bind(arena, mappings, 'L', MDFR_CMND, duplicate_line); - bind(arena, mappings, 'm', MDFR_CMND, cursor_mark_swap); - bind(arena, mappings, 'O', MDFR_CMND, reopen); - bind(arena, mappings, 'q', MDFR_CMND, query_replace); - bind(arena, mappings, 'Q', MDFR_CMND, query_replace_identifier); - bind(arena, mappings, 'r', MDFR_CMND, reverse_search); - bind(arena, mappings, 's', MDFR_CMND, save); - bind(arena, mappings, 't', MDFR_CMND, search_identifier); - bind(arena, mappings, 'T', MDFR_CMND, list_all_locations_of_identifier); - bind(arena, mappings, 'v', MDFR_CMND, paste_and_indent); - bind(arena, mappings, 'V', MDFR_CMND, paste_next_and_indent); - bind(arena, mappings, 'x', MDFR_CMND, cut); - bind(arena, mappings, 'y', MDFR_CMND, redo); - bind(arena, mappings, 'z', MDFR_CMND, undo); - - bind(arena, mappings, '1', MDFR_CMND, view_buffer_other_panel); - bind(arena, mappings, '2', MDFR_CMND, swap_buffers_between_panels); - - bind(arena, mappings, '\n', MDFR_NONE, newline_or_goto_position); - bind(arena, mappings, '\n', MDFR_SHIFT, newline_or_goto_position_same_panel); - bind(arena, mappings, '>', MDFR_CMND, view_jump_list_with_lister); - bind(arena, mappings, ' ', MDFR_SHIFT, write_character); - - end_map(mappings); - - // NOTE(allen): CODE - begin_map(arena, mappings, default_code_map, "The following commands only apply in files where the lexer (syntax highlighting) is turned on."); - - inherit_map(arena, mappings, mapid_file); - - bind(arena, mappings, key_left , MDFR_CMND, move_left_alpha_numeric_or_camel_boundary); - bind(arena, mappings, key_right, MDFR_CMND, move_right_alpha_numeric_or_camel_boundary); - - bind(arena, mappings, key_left , MDFR_CTRL, move_left_alpha_numeric_boundary); - bind(arena, mappings, key_right, MDFR_CTRL, move_right_alpha_numeric_boundary); - - bind(arena, mappings, '\n', MDFR_NONE, write_and_auto_tab); - bind(arena, mappings, '\n', MDFR_SHIFT, write_and_auto_tab); - bind(arena, mappings, '}', MDFR_NONE, write_and_auto_tab); - bind(arena, mappings, ')', MDFR_NONE, write_and_auto_tab); - bind(arena, mappings, ']', MDFR_NONE, write_and_auto_tab); - bind(arena, mappings, ';', MDFR_NONE, write_and_auto_tab); - bind(arena, mappings, '#', MDFR_NONE, write_and_auto_tab); - - bind(arena, mappings, ';', MDFR_CTRL, comment_line_toggle); - - bind(arena, mappings, '\t', MDFR_NONE, word_complete); - bind(arena, mappings, '\t', MDFR_CMND, auto_tab_range); - bind(arena, mappings, '\t', MDFR_SHIFT, auto_tab_line_at_cursor); - - bind(arena, mappings, 'r', MDFR_CTRL, write_block); - bind(arena, mappings, 't', MDFR_CTRL, write_todo); - bind(arena, mappings, 'y', MDFR_CTRL, write_note); - - bind(arena, mappings, 'D', MDFR_CTRL, list_all_locations_of_type_definition); - bind(arena, mappings, 'T', MDFR_CTRL, list_all_locations_of_type_definition_of_identifier); - - bind(arena, mappings, '[', MDFR_CMND, open_long_braces); - bind(arena, mappings, '{', MDFR_CMND, open_long_braces_semicolon); - bind(arena, mappings, '}', MDFR_CMND, open_long_braces_break); - - bind(arena, mappings, '[', MDFR_CTRL, select_surrounding_scope); - bind(arena, mappings, ']', MDFR_CTRL, select_prev_scope_absolute); - bind(arena, mappings, '\'', MDFR_CTRL, select_next_scope_absolute); - bind(arena, mappings, '/', MDFR_CTRL, place_in_scope); - bind(arena, mappings, '-', MDFR_CTRL, delete_current_scope); - bind(arena, mappings, 'j', MDFR_CTRL, scope_absorb_down); - - bind(arena, mappings, 'i', MDFR_CTRL, if0_off); - - bind(arena, mappings, '1', MDFR_CTRL, open_file_in_quotes); - bind(arena, mappings, '2', MDFR_CTRL, open_matching_file_cpp); - bind(arena, mappings, '0', MDFR_CMND, write_zero_struct); - - end_map(mappings); - - // NOTE(allen): LISTER - begin_map(arena, mappings, default_lister_ui_map, - "These commands apply in 'lister mode' such as when you open a file."); - - bind_vanilla_keys(arena, mappings, MDFR_NONE, lister__write_character); - bind(arena, mappings, key_esc, MDFR_NONE, lister__quit); - bind(arena, mappings, '\n', MDFR_NONE, lister__activate); - bind(arena, mappings, '\t', MDFR_NONE, lister__activate); - bind_all_modifiers(arena, mappings, key_back, lister__backspace_text_field); - bind(arena, mappings, key_up , MDFR_NONE, lister__move_up); - bind(arena, mappings, key_page_up , MDFR_NONE, lister__move_up); - bind(arena, mappings, key_down , MDFR_NONE, lister__move_down); - bind(arena, mappings, key_page_down, MDFR_NONE, lister__move_down); - bind(arena, mappings, key_mouse_wheel , MDFR_NONE, lister__wheel_scroll); - bind(arena, mappings, key_mouse_left , MDFR_NONE, lister__mouse_press); - bind(arena, mappings, key_mouse_left_release, MDFR_NONE, lister__mouse_release); - bind(arena, mappings, key_mouse_move, MDFR_NONE, lister__repaint); - bind(arena, mappings, key_animate , MDFR_NONE, lister__repaint); - - end_map(mappings); - } - end_mapping(mappings); - - // Generate remapping from mapping array - FILE *out = fopen(REMAPPING_FILE, "wb"); - if (out != 0){ - - fprintf(out, "#if defined(CUSTOM_COMMAND_SIG)\n"); - for (Mapping *mapping = mappings->first_mapping; - mapping != 0; - mapping = mapping->next){ - fprintf(out, "void fill_keys_%s(Bind_Helper *context){\n", mapping->name); - - for (Sub_Map *sub_map = mapping->first_sub_map; - sub_map != 0; - sub_map = sub_map->next){ - fprintf(out, "begin_map(context, %s);\n", sub_map->name); - - if (sub_map->parent != 0){ - fprintf(out, "inherit_map(context, %s);\n", sub_map->parent); - } - - for (Key_Bind *bind = sub_map->first_key_bind; - bind != 0; - bind = bind->next){ - Temp_Memory bind_temp = begin_temp(arena); - - List_String_Const_char mdfr_list = {}; - b32 has_base = false; - - if (bind->modifiers & MDFR_CTRL){ - if (has_base){ - string_list_push_lit(arena, &mdfr_list, "|"); - } - string_list_push_lit(arena, &mdfr_list, "MDFR_CTRL"); - has_base = true; - } - if (bind->modifiers & MDFR_ALT){ - if (has_base){ - string_list_push_lit(arena, &mdfr_list, "|"); - } - string_list_push_lit(arena, &mdfr_list, "MDFR_ALT"); - has_base = true; - } - if (bind->modifiers & MDFR_CMND){ - if (has_base){ - string_list_push_lit(arena, &mdfr_list, "|"); - } - string_list_push_lit(arena, &mdfr_list, "MDFR_CMND"); - has_base = true; - } - if (bind->modifiers & MDFR_SHIFT){ - if (has_base){ - string_list_push_lit(arena, &mdfr_list, "|"); - } - string_list_push_lit(arena, &mdfr_list, "MDFR_SHIFT"); - has_base = true; - } - if (bind->modifiers == 0){ - string_list_push_lit(arena, &mdfr_list, "MDFR_NONE"); - has_base = true; - } - String_Const_char mdfr = string_list_flatten(arena, mdfr_list, StringFill_NullTerminate); - - if (bind->vanilla){ - if (bind->modifiers == 0){ - fprintf(out, "bind_vanilla_keys(context, %s);\n", bind->command); - } - else{ - fprintf(out, "bind_vanilla_keys(context, %s, %s);\n", mdfr.str, bind->command); - } - } - else{ - char key_str_space[16]; - i32 size = 0; - char *key_str = global_key_name(bind->keycode, &size); - if (key_str == 0){ - key_str = key_str_space; - if (bind->keycode == '\n'){ - memcpy(key_str_space, "'\\n'", 5); - } - else if (bind->keycode == '\t'){ - memcpy(key_str_space, "'\\t'", 5); - } - else if (bind->keycode == '\''){ - memcpy(key_str_space, "'\\''", 5); - } - else if (bind->keycode == '\\'){ - memcpy(key_str_space, "'\\\\'", 5); - } - else{ - Assert(bind->keycode <= 127); - key_str_space[0] = '\''; - key_str_space[1] = (char)bind->keycode; - key_str_space[2] = '\''; - key_str_space[3] = 0; - } - } - - fprintf(out, "bind(context, %s, %s, %s);\n", key_str, mdfr.str, bind->command); - } - - end_temp(bind_temp); - } - - fprintf(out, "end_map(context);\n"); - } - - fprintf(out, "}\n"); - } - fprintf(out, "#endif\n"); - - fprintf(out, - "#if defined(CUSTOM_COMMAND_SIG)\n" - "#define LINK_PROCS(x) x\n" - "#else\n" - "#define LINK_PROCS(x)\n" - "#endif\n"); - - fprintf(out, - "struct Meta_Key_Bind{\n" - "int32_t vanilla;\n" - "uint32_t keycode;\n" - "uint32_t modifiers;\n" - "char *command;\n" - "int32_t command_len;\n" - "LINK_PROCS(Custom_Command_Function *proc;)\n" - "};\n" - "struct Meta_Sub_Map{\n" - "char *name;\n" - "int32_t name_len;\n" - "char *description;\n" - "int32_t description_len;\n" - "char *parent;\n" - "int32_t parent_len;\n" - "Meta_Key_Bind *binds;\n" - "int32_t bind_count;\n" - "};\n" - "struct Meta_Mapping{\n" - "char *name;\n" - "int32_t name_len;\n" - "char *description;\n" - "int32_t description_len;\n" - "Meta_Sub_Map *sub_maps;\n" - "int32_t sub_map_count;\n" - "LINK_PROCS(void (*fill_keys_proc)(Bind_Helper *context);)\n" - "};\n"); - - for (Mapping *mapping = mappings->first_mapping; - mapping != 0; - mapping = mapping->next){ - for (Sub_Map *sub_map = mapping->first_sub_map; - sub_map != 0; - sub_map = sub_map->next){ - if (sub_map->key_bind_count > 0){ - fprintf(out, "static Meta_Key_Bind fcoder_binds_for_%s_%s[%d] = {\n", - mapping->name, sub_map->name, sub_map->key_bind_count); - for (Key_Bind *bind = sub_map->first_key_bind; - bind != 0; - bind = bind->next){ - fprintf(out, - "{%d, %u, %u, \"%s\", %d, LINK_PROCS(%s)},\n", - bind->vanilla, bind->keycode, bind->modifiers, - bind->command, bind->command_len, - bind->command); - } - fprintf(out, "};\n"); - } - } - - fprintf(out, "static Meta_Sub_Map fcoder_submaps_for_%s[%d] = {\n", - mapping->name, mapping->sub_map_count); - for (Sub_Map *sub_map = mapping->first_sub_map; - sub_map != 0; - sub_map = sub_map->next){ - if (sub_map->parent != 0){ - fprintf(out, "{\"%s\", %d, \"%s\", %d, \"%s\", %d, fcoder_binds_for_%s_%s, %d},\n", - sub_map->name, sub_map->name_len, - sub_map->description, sub_map->description_len, - sub_map->parent, sub_map->parent_len, - mapping->name, sub_map->name, - sub_map->key_bind_count); - } - else{ - fprintf(out, "{\"%s\", %d, \"%s\", %d, 0, 0, fcoder_binds_for_%s_%s, %d},\n", - sub_map->name, sub_map->name_len, - sub_map->description, sub_map->description_len, - mapping->name, sub_map->name, - sub_map->key_bind_count); - } - } - fprintf(out, "};\n"); - } - - fprintf(out, "static Meta_Mapping fcoder_meta_maps[%d] = {\n", - mappings->mapping_count); - for (Mapping *mapping = mappings->first_mapping; - mapping != 0; - mapping = mapping->next){ - fprintf(out, "{\"%s\", %d, \"%s\", %d, fcoder_submaps_for_%s, %d, LINK_PROCS(fill_keys_%s)},\n", - mapping->name, mapping->name_len, - mapping->description, mapping->description_len, - mapping->name, - mapping->sub_map_count, - mapping->name); - } - fprintf(out, "};\n"); - - fclose(out); - } - - end_temp(temp); -} - -////////////////////////////////////////////////////////////////////////////////////////////////// - -int main(int argc, char **argv){ - META_BEGIN(); - Arena arena = fm_init_system(); - generate_custom_headers(&arena); - generate_remapping_code_and_data(&arena); - META_FINISH(); -} - -// BOTTOM -