diff --git a/4ed.cpp b/4ed.cpp index 78818d9c..c0db72c4 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -256,18 +256,6 @@ App_Init_Sig(app_init){ global_history_init(&models->global_history); text_layout_init(tctx, &models->text_layouts); - // NOTE(allen): clipboard setup - models->working_set.clipboard_max_size = ArrayCount(models->working_set.clipboards); - models->working_set.clipboard_size = 0; - models->working_set.clipboard_current = 0; - models->working_set.clipboard_rolling = 0; - - // TODO(allen): do(better clipboard allocation) - if (clipboard.str != 0){ - String_Const_u8 *dest = working_set_next_clipboard_string(&models->heap, &models->working_set, clipboard.size); - block_copy(dest->str, clipboard.str, clipboard.size); - } - // NOTE(allen): style setup { Scratch_Block scratch(tctx); @@ -335,7 +323,7 @@ App_Step_Sig(app_step){ Models *models = (Models*)base_ptr; Mutex_Lock file_order_lock(models->working_set.mutex); - Scratch_Block scratch(tctx, Scratch_Share); + Scratch_Block scratch(tctx); models->next_animate_delay = max_u32; models->animate_next_frame = false; @@ -346,13 +334,8 @@ App_Step_Sig(app_step){ models->input = input; // NOTE(allen): OS clipboard event handling - String_Const_u8 clipboard = input->clipboard; - if (clipboard.str != 0){ - String_Const_u8 *dest = working_set_next_clipboard_string(&models->heap, &models->working_set, clipboard.size); - dest->size = eol_convert_in((char*)dest->str, (char*)clipboard.str, (i32)clipboard.size); - if (input->clipboard_changed){ - co_send_core_event(tctx, models, CoreCode_NewClipboardContents, *dest); - } + if (input->clipboard.str != 0){ + co_send_core_event(tctx, models, CoreCode_NewClipboardContents, input->clipboard); } // NOTE(allen): reorganizing panels on screen @@ -387,7 +370,6 @@ App_Step_Sig(app_step){ system_cli_begin_update(cli); if (system_cli_update_step(cli, dest, max, &amount)){ if (file != 0 && amount > 0){ - amount = eol_in_place_convert_in(dest, amount); output_file_append(tctx, models, file, SCu8(dest, amount)); edited_file = true; } diff --git a/4ed.h b/4ed.h index 705a11e2..412e8c0a 100644 --- a/4ed.h +++ b/4ed.h @@ -32,12 +32,12 @@ struct Plat_Settings{ #define App_Read_Command_Line_Sig(name) \ void *name(Thread_Context *tctx,\ -String_Const_u8 current_directory,\ -Plat_Settings *plat_settings,\ -char ***files, \ -i32 **file_count,\ -i32 argc, \ -char **argv) + String_Const_u8 current_directory,\ + Plat_Settings *plat_settings,\ + char ***files, \ + i32 **file_count,\ + i32 argc, \ + char **argv) typedef App_Read_Command_Line_Sig(App_Read_Command_Line); @@ -48,11 +48,10 @@ struct Custom_API{ #define App_Init_Sig(name) \ void name(Thread_Context *tctx, \ -Render_Target *target, \ -void *base_ptr, \ -String_Const_u8 clipboard,\ -String_Const_u8 current_directory,\ -Custom_API api) + Render_Target *target, \ + void *base_ptr, \ + String_Const_u8 current_directory,\ + Custom_API api) typedef App_Init_Sig(App_Init); @@ -73,15 +72,14 @@ struct Application_Step_Input{ Mouse_State mouse; Input_List events; String_Const_u8 clipboard; - b32 clipboard_changed; b32 trying_to_kill; }; #define App_Step_Sig(name) Application_Step_Result \ name(Thread_Context *tctx, \ -Render_Target *target, \ -void *base_ptr, \ -Application_Step_Input *input) + Render_Target *target, \ + void *base_ptr, \ + Application_Step_Input *input) typedef App_Step_Sig(App_Step); diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index 9b668788..10539c10 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -206,35 +206,6 @@ child_process_get_state(Application_Links *app, Child_Process_ID child_process_i return(child_process_get_state(&models->child_processes, child_process_id)); } -api(custom) function b32 -clipboard_post(Application_Links *app, i32 clipboard_id, String_Const_u8 string) -{ - Models *models = (Models*)app->cmd_context; - String_Const_u8 *dest = working_set_next_clipboard_string(&models->heap, &models->working_set, (i32)string.size); - block_copy(dest->str, string.str, string.size); - system_post_clipboard(*dest); - return(true); -} - -api(custom) function i32 -clipboard_count(Application_Links *app, i32 clipboard_id) -{ - Models *models = (Models*)app->cmd_context; - return(models->working_set.clipboard_size); -} - -api(custom) function String_Const_u8 -push_clipboard_index(Application_Links *app, Arena *arena, i32 clipboard_id, i32 item_index) -{ - Models *models = (Models*)app->cmd_context; - String_Const_u8 *str = working_set_clipboard_index(&models->working_set, item_index); - String_Const_u8 result = {}; - if (str != 0){ - result = push_string_copy(arena, *str); - } - return(result); -} - api(custom) function b32 enqueue_virtual_event(Application_Links *app, Input_Event *event){ Models *models = (Models*)app->cmd_context; @@ -2767,6 +2738,40 @@ set_window_title(Application_Links *app, String_Const_u8 title) models->title_space[copy_size] = 0; } +api(custom) function void +acquire_global_frame_mutex(Application_Links *app){ + Thread_Context *tctx = app->tctx; + Thread_Context_Extra_Info *tctx_info = (Thread_Context_Extra_Info*)tctx->user_data; + if (tctx_info != 0 && tctx_info->coroutine != 0){ + Coroutine *coroutine = (Coroutine*)tctx_info->coroutine; + Assert(coroutine != 0); + Co_Out *out = (Co_Out*)coroutine->out; + out->request = CoRequest_AcquireGlobalFrameMutex; + coroutine_yield(coroutine); + } + else{ + system_acquire_global_frame_mutex(tctx); + } +} + +api(custom) function void +release_global_frame_mutex(Application_Links *app){ + Thread_Context *tctx = app->tctx; + Thread_Context_Extra_Info *tctx_info = (Thread_Context_Extra_Info*)tctx->user_data; + if (tctx_info != 0 && tctx_info->coroutine != 0){ + Coroutine *coroutine = (Coroutine*)tctx_info->coroutine; + Assert(coroutine != 0); + Co_Out *out = (Co_Out*)coroutine->out; + out->request = CoRequest_ReleaseGlobalFrameMutex; + coroutine_yield(coroutine); + } + else{ + system_release_global_frame_mutex(tctx); + } +} + +//////////////////////////////// + api(custom) function Vec2_f32 draw_string_oriented(Application_Links *app, Face_ID font_id, ARGB_Color color, String_Const_u8 str, Vec2_f32 point, u32 flags, Vec2_f32 delta) diff --git a/4ed_app_models.h b/4ed_app_models.h index 670b0c26..71ea3254 100644 --- a/4ed_app_models.h +++ b/4ed_app_models.h @@ -1,196 +1,196 @@ -/* - * Mr. 4th Dimention - Allen Webster - * - * 06.05.2016 (dd.mm.yyyy) - * - * Global app level settings definition - * - */ - -// TOP - -#if !defined(FRED_APP_MODELS_H) -#define FRED_APP_MODELS_H - -struct App_Settings{ - char *init_files[8]; - i32 init_files_count; - i32 init_files_max; - - char **custom_flags; - i32 custom_flags_count; - - i32 initial_line; - b32 lctrl_lalt_is_altgr; - - i32 font_size; - b32 use_hinting; -}; - -enum App_State{ - APP_STATE_EDIT, - APP_STATE_RESIZING, - // never below this - APP_STATE_COUNT -}; - -struct Model_View_Command_Function{ - Model_View_Command_Function *next; - Custom_Command_Function *custom_func; - View_ID view_id; -}; - -struct Model_Input_Event_Node{ - Model_Input_Event_Node *next; - Input_Event event; -}; - -struct Models{ - Arena arena_; - Arena *arena; - Heap heap; - - App_Settings settings; - App_State state; - - Face_ID global_face_id; - - Coroutine_Group coroutines; - - Child_Process_Container child_processes; - Custom_API config_api; - - Tick_Function *tick; - Render_Caller_Function *render_caller; - Delta_Rule_Function *delta_rule; - u64 delta_rule_memory_size; - - Hook_Function *buffer_viewer_update; - Custom_Command_Function *view_event_handler; - Buffer_Name_Resolver_Function *buffer_name_resolver; - Buffer_Hook_Function *begin_buffer; - Buffer_Hook_Function *end_buffer; - Buffer_Hook_Function *new_file; - Buffer_Hook_Function *save_file; - Buffer_Edit_Range_Function *buffer_edit_range; - Buffer_Region_Function *buffer_region; - Layout_Function *layout_func; - - Color_Table color_table_; - - Model_View_Command_Function *free_view_cmd_funcs; - Model_View_Command_Function *first_view_cmd_func; - Model_View_Command_Function *last_view_cmd_func; - - Arena *virtual_event_arena; - Model_Input_Event_Node *free_virtual_event; - Model_Input_Event_Node *first_virtual_event; - Model_Input_Event_Node *last_virtual_event; - - Layout layout; - Working_Set working_set; - Live_Views view_set; - Global_History global_history; - Text_Layout_Container text_layouts; - Font_Set font_set; - - Managed_ID_Set managed_id_set; - Dynamic_Workspace dynamic_workspace; - Lifetime_Allocator lifetime_allocator; - - Editing_File *message_buffer; - Editing_File *scratch_buffer; - Editing_File *log_buffer; - Editing_File *keyboard_buffer; - - Hot_Directory hot_directory; - - b8 keep_playing; - b8 hard_exit; - - b32 has_new_title; - char *title_space; - i32 title_capacity; - - Panel *resizing_intermediate_panel; - - Plat_Handle period_wakeup_timer; - i32 frame_counter; - u32 next_animate_delay; - b32 animate_next_frame; - - Profile_Global_List profile_list; - - // Last frame state - Vec2_i32 prev_p; - Panel *prev_mouse_panel; - b32 animated_last_frame; - u64 last_render_usecond_stamp; - - // Event Context - Application_Step_Input *input; - i64 current_input_sequence_number; - User_Input current_input; - b8 current_input_unhandled; - - b8 in_render_mode; - Render_Target *target; -}; - -//////////////////////////////// - -typedef i32 Dynamic_Workspace_Type; -enum{ - DynamicWorkspace_Global = 0, - DynamicWorkspace_Unassociated = 1, - DynamicWorkspace_Buffer = 2, - DynamicWorkspace_View = 3, - DynamicWorkspace_Intersected = 4, -}; - -enum Input_Types{ - Input_AnyKey, - Input_Esc, - Input_MouseMove, - Input_MouseLeftButton, - Input_MouseRightButton, - Input_MouseWheel, - Input_Count -}; - -struct Consumption_Record{ - b32 consumed; - char consumer[32]; -}; - -struct File_Init{ - String_Const_u8 name; - Editing_File **ptr; - b32 read_only; -}; - -enum Command_Line_Action{ - CLAct_Nothing, - CLAct_Ignore, - CLAct_UserFile, - CLAct_CustomDLL, - CLAct_InitialFilePosition, - CLAct_WindowSize, - CLAct_WindowMaximize, - CLAct_WindowPosition, - CLAct_WindowFullscreen, - CLAct_FontSize, - CLAct_FontUseHinting, - // - CLAct_COUNT, -}; - -enum Command_Line_Mode{ - CLMode_App, - CLMode_Custom -}; - -#endif - -// BOTTOM - +/* + * Mr. 4th Dimention - Allen Webster + * + * 06.05.2016 (dd.mm.yyyy) + * + * Global app level settings definition + * + */ + +// TOP + +#if !defined(FRED_APP_MODELS_H) +#define FRED_APP_MODELS_H + +struct App_Settings{ + char *init_files[8]; + i32 init_files_count; + i32 init_files_max; + + char **custom_flags; + i32 custom_flags_count; + + i32 initial_line; + b32 lctrl_lalt_is_altgr; + + i32 font_size; + b32 use_hinting; +}; + +enum App_State{ + APP_STATE_EDIT, + APP_STATE_RESIZING, + // never below this + APP_STATE_COUNT +}; + +struct Model_View_Command_Function{ + Model_View_Command_Function *next; + Custom_Command_Function *custom_func; + View_ID view_id; +}; + +struct Model_Input_Event_Node{ + Model_Input_Event_Node *next; + Input_Event event; +}; + +struct Models{ + Arena arena_; + Arena *arena; + Heap heap; + + App_Settings settings; + App_State state; + + Face_ID global_face_id; + + Coroutine_Group coroutines; + + Child_Process_Container child_processes; + Custom_API config_api; + + Tick_Function *tick; + Render_Caller_Function *render_caller; + Delta_Rule_Function *delta_rule; + u64 delta_rule_memory_size; + + Hook_Function *buffer_viewer_update; + Custom_Command_Function *view_event_handler; + Buffer_Name_Resolver_Function *buffer_name_resolver; + Buffer_Hook_Function *begin_buffer; + Buffer_Hook_Function *end_buffer; + Buffer_Hook_Function *new_file; + Buffer_Hook_Function *save_file; + Buffer_Edit_Range_Function *buffer_edit_range; + Buffer_Region_Function *buffer_region; + Layout_Function *layout_func; + + Color_Table color_table_; + + Model_View_Command_Function *free_view_cmd_funcs; + Model_View_Command_Function *first_view_cmd_func; + Model_View_Command_Function *last_view_cmd_func; + + Arena *virtual_event_arena; + Model_Input_Event_Node *free_virtual_event; + Model_Input_Event_Node *first_virtual_event; + Model_Input_Event_Node *last_virtual_event; + + Layout layout; + Working_Set working_set; + Live_Views view_set; + Global_History global_history; + Text_Layout_Container text_layouts; + Font_Set font_set; + + Managed_ID_Set managed_id_set; + Dynamic_Workspace dynamic_workspace; + Lifetime_Allocator lifetime_allocator; + + Editing_File *message_buffer; + Editing_File *scratch_buffer; + Editing_File *log_buffer; + Editing_File *keyboard_buffer; + + Hot_Directory hot_directory; + + b8 keep_playing; + b8 hard_exit; + + b32 has_new_title; + char *title_space; + i32 title_capacity; + + Panel *resizing_intermediate_panel; + + Plat_Handle period_wakeup_timer; + i32 frame_counter; + u32 next_animate_delay; + b32 animate_next_frame; + + Profile_Global_List profile_list; + + // Last frame state + Vec2_i32 prev_p; + Panel *prev_mouse_panel; + b32 animated_last_frame; + u64 last_render_usecond_stamp; + + // Event Context + Application_Step_Input *input; + i64 current_input_sequence_number; + User_Input current_input; + b8 current_input_unhandled; + + b8 in_render_mode; + Render_Target *target; +}; + +//////////////////////////////// + +typedef i32 Dynamic_Workspace_Type; +enum{ + DynamicWorkspace_Global = 0, + DynamicWorkspace_Unassociated = 1, + DynamicWorkspace_Buffer = 2, + DynamicWorkspace_View = 3, + DynamicWorkspace_Intersected = 4, +}; + +enum Input_Types{ + Input_AnyKey, + Input_Esc, + Input_MouseMove, + Input_MouseLeftButton, + Input_MouseRightButton, + Input_MouseWheel, + Input_Count +}; + +struct Consumption_Record{ + b32 consumed; + char consumer[32]; +}; + +struct File_Init{ + String_Const_u8 name; + Editing_File **ptr; + b32 read_only; +}; + +enum Command_Line_Action{ + CLAct_Nothing, + CLAct_Ignore, + CLAct_UserFile, + CLAct_CustomDLL, + CLAct_InitialFilePosition, + CLAct_WindowSize, + CLAct_WindowMaximize, + CLAct_WindowPosition, + CLAct_WindowFullscreen, + CLAct_FontSize, + CLAct_FontUseHinting, + // + CLAct_COUNT, +}; + +enum Command_Line_Mode{ + CLMode_App, + CLMode_Custom +}; + +#endif + +// BOTTOM + diff --git a/4ed_buffer.cpp b/4ed_buffer.cpp index 1e526935..ec9a8649 100644 --- a/4ed_buffer.cpp +++ b/4ed_buffer.cpp @@ -172,96 +172,6 @@ buffer_update_cursors_lean_r(Cursor_With_Index *sorted_positions, i32 count, ////////////////////////////////////// -internal i32 -eol_convert_in(char *dest, char *src, i32 size){ - i32 i = 0; - i32 j = 0; - i32 k = 0; - - for (; j < size && src[j] != '\r'; ++j); - block_copy(dest, src, j); - - if (j < size){ - k = 1; - ++j; - for (i = j; i < size; ++i){ - if (src[i] == '\r'){ - block_copy(dest + j - k, src + j, i - j); - ++k; - j = i+1; - } - } - block_copy(dest + j - k, src + j, i - j); - j = i - k; - } - - return(j); -} - -internal i32 -eol_in_place_convert_in(char *data, i32 size){ - i32 i = 0; - i32 j = 0; - i32 k = 0; - - for (; j < size && data[j] != '\r'; ++j); - - if (j < size){ - k = 1; - ++j; - for (i = j; i < size; ++i){ - if (data[i] == '\r'){ - block_copy(data + j - k, data + j, i - j); - ++k; - j = i+1; - } - } - block_copy(data + j - k, data + j, i - j); - j = i - k; - } - - return(j); -} - -// TODO(allen): iterative memory check? -internal b32 -eol_convert_out(char *dest, i64 max, char *src, i64 size, i64 *size_out){ - i64 j = 0; - for (i64 i = 0; i < size; ++i, ++j){ - if (src[i] == '\n'){ - dest[j] = '\r'; - ++j; - dest[j] = '\n'; - } - else{ - dest[j] = src[i]; - } - } - *size_out = j; - return(true); -} - -// TODO(allen): iterative memory check? -internal i32 -eol_in_place_convert_out(char *data, i32 size, i32 max, i32 *size_out){ - i32 result = 1; - i32 i = 0; - - for (; i < size; ++i){ - if (data[i] == '\n'){ - block_copy(data + i + 1, data + i, size - i); - data[i] = '\r'; - ++i; - ++size; - } - } - - *size_out = size; - return(result); -} - -////////////////////////////////////// - internal b32 buffer_good(Gap_Buffer *buffer){ return(buffer->data != 0); diff --git a/4ed_file.cpp b/4ed_file.cpp index c3c18d64..260d587a 100644 --- a/4ed_file.cpp +++ b/4ed_file.cpp @@ -442,8 +442,8 @@ file_relative_xy_of_pos(Thread_Context *tctx, Models *models, Editing_File *file function Rect_f32 file_padded_box_of_pos(Thread_Context *tctx, Models *models, Editing_File *file, - Layout_Function *layout_func, f32 width, Face *face, - i64 base_line, i64 pos){ + Layout_Function *layout_func, f32 width, Face *face, + i64 base_line, i64 pos){ i64 line_number = buffer_get_line_index(&file->state.buffer, pos) + 1; Layout_Item_List line = file_get_line_layout(tctx, models, file, layout_func, width, face, line_number); Rect_f32 result = layout_padded_box_of_pos(line, pos); diff --git a/4ed_file_track_general.cpp b/4ed_file_track_general.cpp deleted file mode 100644 index 3edbb7f9..00000000 --- a/4ed_file_track_general.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Mr. 4th Dimention - Allen Webster - * - * 20.08.2016 - * - * File tracking shared. - * - */ - -// TOP - -struct File_Index{ - u32 id[4]; -}; - -typedef u32 rptr32; - -#define to_ptr(b,p) ((void*)((char*)b + p)) -#define to_rptr32(b,p) ((rptr32)((char*)(p) - (char*)(b))) - -struct File_Track_Entry{ - File_Index hash; - u32 opaque[4]; -}; -global_const File_Track_Entry null_file_track_entry = {}; - -struct File_Track_Tables{ - i32 size; - u32 tracked_count; - u32 max; - rptr32 file_table; -}; - -struct DLL_Node { - DLL_Node *next; - DLL_Node *prev; -}; - -internal File_Index -zero_file_index(){ - File_Index a = {}; - return(a); -} - -internal i32 -file_hash_is_zero(File_Index a){ - return ((a.id[0] == 0) && - (a.id[1] == 0) && - (a.id[2] == 0) && - (a.id[3] == 0)); -} - -internal i32 -file_hash_is_deleted(File_Index a){ - return ((a.id[0] == 0xFFFFFFFF) && - (a.id[1] == 0xFFFFFFFF) && - (a.id[2] == 0xFFFFFFFF) && - (a.id[3] == 0xFFFFFFFF)); -} - -internal i32 -file_index_eq(File_Index a, File_Index b){ - return ((a.id[0] == b.id[0]) && - (a.id[1] == b.id[1]) && - (a.id[2] == b.id[2]) && - (a.id[3] == b.id[3])); -} - -internal void -insert_node(DLL_Node *pos, DLL_Node *node){ - node->prev = pos; - node->next = pos->next; - pos->next = node; - node->next->prev = node; -} - -internal void -remove_node(DLL_Node *node){ - node->next->prev = node->prev; - node->prev->next = node->next; -} - -internal void -init_sentinel_node(DLL_Node *node){ - node->next = node; - node->prev = node; -} - -internal DLL_Node* -allocate_node(DLL_Node *sentinel){ - DLL_Node *result = 0; - if (sentinel->next != sentinel){ - result = sentinel->next; - remove_node(result); - } - return(result); -} - -#define FILE_ENTRY_COST (sizeof(File_Track_Entry)) - - -internal i32 -tracking_system_has_space(File_Track_Tables *tables, i32 new_count){ - u32 count = tables->tracked_count; - u32 max = tables->max; - i32 result = ((count + new_count)*8 < max*7); - return(result); -} - -internal i32 -entry_is_available(File_Track_Entry *entry){ - i32 result = 0; - if (entry){ - result = - file_hash_is_zero(entry->hash) || - file_hash_is_deleted(entry->hash); - } - return (result); -} - -internal File_Track_Entry* -tracking_system_lookup_entry(File_Track_Tables *tables, File_Index key){ - u32 hash = key.id[0]; - u32 max = tables->max; - u32 index = (hash) % max; - u32 start = index; - - File_Track_Entry *entries = (File_Track_Entry*)to_ptr(tables, tables->file_table); - - File_Track_Entry* result = 0; - for (;;){ - File_Track_Entry *entry = entries + index; - - if (file_index_eq(entry->hash, key)){ - result = entry; - break; - } - else if (file_hash_is_zero(entry->hash)){ - if (result == 0){ - result = entry; - } - break; - } - else if (file_hash_is_deleted(entry->hash)){ - if (result == 0){ - result = entry; - } - } - - ++index; - if (index == max) index = 0; - if (index == start) break; - } - - return(result); -} - -internal File_Track_Entry* -get_file_entry(File_Track_Tables *tables, File_Index index){ - File_Track_Entry *entry = 0; - - File_Track_Entry *result = tracking_system_lookup_entry(tables, index); - if (result && file_index_eq(index, result->hash)){ - entry = result; - } - - return(entry); -} - -internal void -internal_free_slot(File_Track_Tables *tables, File_Track_Entry *entry){ - Assert(!entry_is_available(entry)); - - *entry = null_file_track_entry; - entry->hash.id[0] = 0xFFFFFFFF; - entry->hash.id[1] = 0xFFFFFFFF; - entry->hash.id[2] = 0xFFFFFFFF; - entry->hash.id[3] = 0xFFFFFFFF; - - --tables->tracked_count; -} - -internal i32 -enough_memory_to_init_table(i32 table_memory_size){ - i32 result = (sizeof(File_Track_Tables) + FILE_ENTRY_COST*8 <= table_memory_size); - return(result); -} - -internal void -init_table_memory(File_Track_Tables *tables, i32 table_memory_size){ - tables->size = table_memory_size; - tables->tracked_count = 0; - - i32 max_number_of_entries = (table_memory_size - sizeof(*tables)) / FILE_ENTRY_COST; - - tables->file_table = sizeof(*tables); - tables->max = max_number_of_entries; -} - -internal File_Track_Result -move_table_memory(File_Track_Tables *original_tables, - void *mem, i32 size){ - File_Track_Result result = FileTrack_Good; - - if (original_tables->size < size){ - File_Track_Tables *tables = (File_Track_Tables*)mem; - - // NOTE(allen): Initialize main data tables - { - tables->size = size; - - i32 likely_entry_size = FILE_ENTRY_COST; - i32 max_number_of_entries = (size - sizeof(*tables)) / likely_entry_size; - - tables->file_table = sizeof(*tables); - tables->max = max_number_of_entries; - } - - if (tables->max > original_tables->max){ - u32 original_max = original_tables->max; - - // NOTE(allen): Rehash the tracking table - { - File_Track_Entry *entries = (File_Track_Entry*) - to_ptr(original_tables, original_tables->file_table); - - for (u32 index = 0; index < original_max; ++index){ - File_Track_Entry *entry = entries + index; - if (!entry_is_available(entry)){ - File_Index hash = entry->hash; - File_Track_Entry *lookup = - tracking_system_lookup_entry(tables, hash); - - Assert(entry_is_available(lookup)); - *lookup = *entry; - } - } - - tables->tracked_count = original_tables->tracked_count; - } - } - else{ - result = FileTrack_MemoryTooSmall; - } - } - else{ - result = FileTrack_MemoryTooSmall; - } - - return(result); -} - -// BOTTOM - diff --git a/4ed_system_api.cpp b/4ed_system_api.cpp index 2a98bb8d..e55ef3bc 100644 --- a/4ed_system_api.cpp +++ b/4ed_system_api.cpp @@ -117,9 +117,23 @@ define_api(Arena *arena){ api_param(arena, call, "u64", "microseconds"); } + { + API_Call *call = api_call(arena, api, "get_clipboard", "String_Const_u8"); + api_param(arena, call, "Arena*", "arena"); + api_param(arena, call, "i32", "index"); + } { API_Call *call = api_call(arena, api, "post_clipboard", "void"); api_param(arena, call, "String_Const_u8", "str"); + api_param(arena, call, "i32", "index"); + } + + { + API_Call *call = api_call(arena, api, "set_clipboard_catch_all", "void"); + api_param(arena, call, "b32", "enabled"); + } + { + api_call(arena, api, "get_clipboard_catch_all", "b32"); } { @@ -174,7 +188,7 @@ define_api(Arena *arena){ } { -api_call(arena, api, "thread_get_id", "i32"); + api_call(arena, api, "thread_get_id", "i32"); } { @@ -188,7 +202,7 @@ api_call(arena, api, "thread_get_id", "i32"); } { -api_call(arena, api, "mutex_make", "System_Mutex"); + api_call(arena, api, "mutex_make", "System_Mutex"); } { @@ -207,8 +221,8 @@ api_call(arena, api, "mutex_make", "System_Mutex"); } { -api_call(arena, api, "condition_variable_make", - "System_Condition_Variable"); + api_call(arena, api, "condition_variable_make", + "System_Condition_Variable"); } { @@ -262,7 +276,7 @@ api_call(arena, api, "condition_variable_make", } { -api_call(arena, api, "is_fullscreen", "b32"); + api_call(arena, api, "is_fullscreen", "b32"); } { diff --git a/4ed_view.cpp b/4ed_view.cpp index 3a25ea21..8daeb537 100644 --- a/4ed_view.cpp +++ b/4ed_view.cpp @@ -511,7 +511,7 @@ view_current_context(View *view){ //////////////////////////////// internal Coroutine* -co_handle_request(Models *models, Coroutine *co, Co_Out *out){ +co_handle_request(Thread_Context *tctx, Models *models, Coroutine *co, Co_Out *out){ Coroutine *result = 0; switch (out->request){ case CoRequest_NewFontFace: @@ -531,6 +531,18 @@ co_handle_request(Models *models, Coroutine *co, Co_Out *out){ in.success = font_set_modify_face(&models->font_set, face_id, description); result = coroutine_run(&models->coroutines, co, &in, out); }break; + + case CoRequest_AcquireGlobalFrameMutex: + { + system_acquire_global_frame_mutex(tctx); + result = coroutine_run(&models->coroutines, co, 0, out); + }break; + + case CoRequest_ReleaseGlobalFrameMutex: + { + system_release_global_frame_mutex(tctx); + result = coroutine_run(&models->coroutines, co, 0, out); + }break; } return(result); } @@ -539,7 +551,7 @@ internal Coroutine* co_run(Thread_Context *tctx, Models *models, Coroutine *co, Co_In *in, Co_Out *out){ Coroutine *result = coroutine_run(&models->coroutines, co, in, out); for (;result != 0 && out->request != CoRequest_None;){ - result = co_handle_request(models, result, out); + result = co_handle_request(tctx, models, result, out); } return(result); } diff --git a/4ed_view.h b/4ed_view.h index 3d2c1947..2842a524 100644 --- a/4ed_view.h +++ b/4ed_view.h @@ -29,6 +29,8 @@ enum{ CoRequest_None = 0, CoRequest_NewFontFace = 1, CoRequest_ModifyFace = 2, + CoRequest_AcquireGlobalFrameMutex = 3, + CoRequest_ReleaseGlobalFrameMutex = 4, }; struct Co_Out{ diff --git a/4ed_working_set.cpp b/4ed_working_set.cpp index 7077007e..6aff179e 100644 --- a/4ed_working_set.cpp +++ b/4ed_working_set.cpp @@ -206,7 +206,19 @@ get_file_from_identifier(Working_Set *working_set, Buffer_Identifier buffer){ //////////////////////////////// +#if 0 // TODO(allen): Bring the clipboard fully to the custom side. +internal void +working_set_clipboard_clear(Heap *heap, Working_Set *working){ + String_Const_u8 *str = working->clipboards; + for (i32 i = 0; i < working->clipboard_size; i += 1, str += 1){ + heap_free(heap, str->str); + block_zero_struct(str); + } + working->clipboard_size = 0; + working->clipboard_current = 0; +} + internal String_Const_u8* working_set_next_clipboard_string(Heap *heap, Working_Set *working, u64 str_size){ i32 clipboard_current = working->clipboard_current; @@ -225,7 +237,6 @@ working_set_next_clipboard_string(Heap *heap, Working_Set *working, u64 str_size } String_Const_u8 *result = &working->clipboards[clipboard_current]; working->clipboard_current = clipboard_current; - working->clipboard_rolling = clipboard_current; if (result->str != 0){ heap_free(heap, result->str); } @@ -247,28 +258,7 @@ working_set_clipboard_index(Working_Set *working, i32 index){ } return(result); } - -internal String_Const_u8* -working_set_clipboard_head(Working_Set *working){ - String_Const_u8 *result = 0; - if (working->clipboard_size > 0){ - working->clipboard_rolling = 0; - result = working_set_clipboard_index(working, working->clipboard_rolling); - } - return(result); -} - -internal String_Const_u8* -working_set_clipboard_roll_down(Working_Set *working){ - String_Const_u8 *result = 0; - if (working->clipboard_size > 0){ - i32 clipboard_index = working->clipboard_rolling; - ++clipboard_index; - working->clipboard_rolling = clipboard_index; - result = working_set_clipboard_index(working, working->clipboard_rolling); - } - return(result); -} +#endif //////////////////////////////// diff --git a/4ed_working_set.h b/4ed_working_set.h index 3e213b2d..49f53bb9 100644 --- a/4ed_working_set.h +++ b/4ed_working_set.h @@ -34,15 +34,6 @@ struct Working_Set{ Node has_external_mod_sentinel; System_Mutex mutex; System_Thread file_change_thread; - - // TODO(allen): do(update clipboard system to exist fully in the custom layer) - // NOTE(allen): These members have nothing to do with the working set or - // the mutex that gaurds the other members. - String_Const_u8 clipboards[64]; - i32 clipboard_size; - i32 clipboard_max_size; - i32 clipboard_current; - i32 clipboard_rolling; }; #endif diff --git a/bin/4ed_build.cpp b/bin/4ed_build.cpp index f76e9880..7e054818 100644 --- a/bin/4ed_build.cpp +++ b/bin/4ed_build.cpp @@ -512,8 +512,19 @@ buildsuper(Arena *arena, char *cdir, char *file, u32 arch){ Temp_Dir temp = fm_pushdir(fm_str(arena, BUILD_DIR)); char *build_script_postfix = ""; - if (This_OS == Platform_Mac){ - build_script_postfix = "-mac"; + switch (This_OS){ + case Platform_Windows: + { + build_script_postfix = "-win"; + }break; + case Platform_Linux: + { + build_script_postfix = "-linux"; + }break; + case Platform_Mac: + { + build_script_postfix = "-mac"; + }break; } char *build_script = fm_str(arena, "custom/bin/buildsuper_", arch_names[arch], build_script_postfix, BAT); diff --git a/bin/itchio_push_win.bat b/bin/itchio_push_win.bat index ebc7fa54..9f3d09d0 100644 --- a/bin/itchio_push_win.bat +++ b/bin/itchio_push_win.bat @@ -6,7 +6,7 @@ SET fake=%1 SET maj=%2 SET min=%3 -SET vr=%fake%-%maj%-%min% +SET vr=%fake%.%maj%.%min% SET fv=%fake%-%maj%-%min% SET flags=--fix-permissions --userversion=%vr% diff --git a/custom/4coder_async_tasks.cpp b/custom/4coder_async_tasks.cpp index 4706bd88..328dbf6e 100644 --- a/custom/4coder_async_tasks.cpp +++ b/custom/4coder_async_tasks.cpp @@ -92,21 +92,17 @@ async_task_thread(void *thread_ptr){ thread->node = node; thread->task = node->task; thread->cancel_signal = false; - thread->join_signal = false; system_mutex_release(async_system->mutex); node->func(&ctx, node->data); system_mutex_acquire(async_system->mutex); - if (thread->join_signal){ - system_condition_variable_signal(async_system->join_cv); - } node->thread = 0; thread->node = 0; thread->task = 0; thread->cancel_signal = false; - thread->join_signal = false; async_free_node(async_system, node); + system_condition_variable_signal(async_system->join_cv); system_mutex_release(async_system->mutex); } } @@ -179,19 +175,42 @@ async_task_is_running(Async_System *async_system, Async_Task task){ } function b32 -async_task_is_running_or_pending(Async_System *async_system, Async_Task task){ - system_mutex_acquire(async_system->mutex); +async_task_is_running_or_pending__inner(Async_System *async_system, Async_Task task){ Async_Node *node = async_get_pending_node(async_system, task); - if (node != 0){ + if (node == 0){ node = async_get_running_node(async_system, task); } - system_mutex_release(async_system->mutex); return(node != 0); } -// TODO(allen): ensure that the job is canceled before this returns. +function b32 +async_task_is_running_or_pending(Async_System *async_system, Async_Task task){ + system_mutex_acquire(async_system->mutex); + b32 result = async_task_is_running_or_pending__inner(async_system, task); + system_mutex_release(async_system->mutex); + return(result); +} + function void -async_task_cancel(Async_System *async_system, Async_Task task){ +async_task_wait__inner(Application_Links *app, Async_System *async_system, Async_Task task){ + release_global_frame_mutex(app); + for (;async_task_is_running_or_pending__inner(async_system, task);){ + system_condition_variable_wait(async_system->join_cv, async_system->mutex); + } + acquire_global_frame_mutex(app); +} + +function void +async_task_wait(Application_Links *app, Async_System *async_system, Async_Task task){ + system_mutex_acquire(async_system->mutex); + if (async_task_is_running_or_pending__inner(async_system, task)){ + async_task_wait__inner(app, async_system, task); + } + system_mutex_release(async_system->mutex); +} + +function void +async_task_cancel(Application_Links *app, Async_System *async_system, Async_Task task){ system_mutex_acquire(async_system->mutex); Async_Node *node = async_get_pending_node(async_system, task); if (node != 0){ @@ -204,6 +223,7 @@ async_task_cancel(Async_System *async_system, Async_Task task){ if (node != 0){ b32 *cancel_signal = &node->thread->cancel_signal; atomic_write_b32(cancel_signal, true); + async_task_wait__inner(app, async_system, task); } } system_mutex_release(async_system->mutex); diff --git a/custom/4coder_async_tasks.h b/custom/4coder_async_tasks.h index 2e1af6e4..282c1f44 100644 --- a/custom/4coder_async_tasks.h +++ b/custom/4coder_async_tasks.h @@ -16,7 +16,6 @@ struct Async_Thread{ struct Async_Node *node; Async_Task task; b32 cancel_signal; - b32 join_signal; }; struct Async_Node{ diff --git a/custom/4coder_auto_indent.cpp b/custom/4coder_auto_indent.cpp index f6460cd0..7da42733 100644 --- a/custom/4coder_auto_indent.cpp +++ b/custom/4coder_auto_indent.cpp @@ -21,7 +21,7 @@ make_batch_from_indentations(Application_Links *app, Arena *arena, Buffer_ID buf if (indent_info.is_blank && HasFlag(flags, Indent_ClearLine)){ correct_indentation = 0; } - if (correct_indentation == -1){ + if (correct_indentation <= -1){ correct_indentation = indent_info.indent_pos; } @@ -166,8 +166,14 @@ get_indentation_array(Application_Links *app, Arena *arena, Buffer_ID buffer, Ra i64 *shifted_indentations = indentations - lines.first; block_fill_u64(indentations, sizeof(*indentations)*count, (u64)(-1)); +#if 0 Managed_Scope scope = buffer_get_managed_scope(app, buffer); Token_Array *tokens = scope_attachment(app, scope, attachment_tokens, Token_Array); +#endif + + Token_Array token_array = get_token_array_from_buffer(app, buffer); + Token_Array *tokens = &token_array; + i64 anchor_line = clamp_bot(1, lines.first - 1); Token *anchor_token = find_anchor_token(app, buffer, tokens, anchor_line); if (anchor_token != 0 && @@ -268,10 +274,10 @@ get_indentation_array(Application_Links *app, Arena *arena, Buffer_ID buffer, Ra //ignore_unfinished_statement = true; }break; } - } - - if (in_unfinished_statement && !ignore_unfinished_statement){ - this_indent += indent_width; + + if (in_unfinished_statement && !ignore_unfinished_statement){ + this_indent += indent_width; + } } #define EMIT(N) \ @@ -342,11 +348,11 @@ actual_indent = N; ) internal b32 auto_indent_buffer(Application_Links *app, Buffer_ID buffer, Range_i64 pos, Indent_Flag flags, i32 tab_width, i32 indent_width){ ProfileScope(app, "auto indent buffer"); - Managed_Scope scope = buffer_get_managed_scope(app, buffer); - Token_Array *tokens = scope_attachment(app, scope, attachment_tokens, Token_Array); + Token_Array token_array = get_token_array_from_buffer(app, buffer); + Token_Array *tokens = &token_array; b32 result = false; - if (tokens != 0 && tokens->tokens != 0){ + if (tokens->tokens != 0){ result = true; Scratch_Block scratch(app); diff --git a/custom/4coder_base_commands.cpp b/custom/4coder_base_commands.cpp index 6b204cb2..2ac0deb8 100644 --- a/custom/4coder_base_commands.cpp +++ b/custom/4coder_base_commands.cpp @@ -1,5 +1,5 @@ /* -4coder_base_commands.cpp - Base commands such as inserting characters, and +4coder_base_commands.cpp - Base commands such as inserting characters, and moving the cursor, which work even without the default 4coder framework. */ @@ -584,37 +584,73 @@ CUSTOM_DOC("Converts all ascii text in the range between the cursor and the mark view_set_cursor_and_preferred_x(app, view, seek_pos(range.max)); } +function void +clean_all_lines_buffer(Application_Links *app, Buffer_ID buffer){ + ProfileScope(app, "clean all lines"); + Scratch_Block scratch(app); + Batch_Edit *batch_first = 0; + Batch_Edit *batch_last = 0; + + i64 line_count = buffer_get_line_count(app, buffer); + for (i64 line_number = 1; line_number <= line_count; line_number += 1){ + i64 line_start = get_line_side_pos(app, buffer, line_number, Side_Min); + i64 line_end = get_line_side_pos(app, buffer, line_number, Side_Max); + u8 prev = buffer_get_char(app, buffer, line_end - 1); + b32 has_cr_character = false; + b32 has_tail_whitespace = false; + if (prev == '\r'){ + has_cr_character = true; + if (line_end - 2 >= line_start){ + prev = buffer_get_char(app, buffer, line_end - 2); + has_tail_whitespace = character_is_whitespace(prev); + } + } + else{ + has_tail_whitespace = character_is_whitespace(prev); + } + if (has_tail_whitespace){ + String_Const_u8 line = push_buffer_range(app, scratch, buffer, + Ii64(line_start, line_end)); + if (line.size > 0){ + i64 end_offset = line.size; + i64 i = line.size - 1; + if (has_cr_character){ + end_offset -= 1; + i -= 1; + } + i64 start_offset = 0; + for (; i >= 0; i -= 1){ + if (!character_is_whitespace(line.str[i])){ + start_offset = i + 1; + break; + } + } + + if (start_offset > 0){ + i64 start = start_offset + line_start; + i64 end = end_offset + line_start; + + Batch_Edit *batch = push_array(scratch, Batch_Edit, 1); + sll_queue_push(batch_first, batch_last, batch); + batch->edit.text = SCu8(); + batch->edit.range = Ii64(start, end); + } + } + } + } + + if (batch_first != 0){ + buffer_batch_edit(app, buffer, batch_first); + } +} + CUSTOM_COMMAND_SIG(clean_all_lines) CUSTOM_DOC("Removes trailing whitespace from all lines in the current buffer.") { ProfileScope(app, "clean all lines"); View_ID view = get_active_view(app, Access_ReadWriteVisible); Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible); - - Scratch_Block scratch(app); - Batch_Edit *batch_first = 0; - Batch_Edit *batch_last = 0; - - String_Const_u8 text = push_whole_buffer(app, scratch, buffer); - - u64 whitespace_start = 0; - for (u64 i = 0; i < text.size; i += 1){ - u8 v = string_get_character(text, i); - if (v == '\n' || i + 1 == text.size){ - if (whitespace_start < i){ - Batch_Edit *batch = push_array(scratch, Batch_Edit, 1); - sll_queue_push(batch_first, batch_last, batch); - batch->edit.text = SCu8(); - batch->edit.range = Ii64(whitespace_start, i); - } - whitespace_start = i + 1; - } - else if (!character_is_whitespace(v)){ - whitespace_start = i + 1; - } - } - - buffer_batch_edit(app, buffer, batch_first); + clean_all_lines_buffer(app, buffer); } //////////////////////////////// @@ -679,6 +715,26 @@ CUSTOM_DOC("Toggles the visibility of the FPS performance meter") show_fps_hud = !show_fps_hud; } +CUSTOM_COMMAND_SIG(set_face_size) +CUSTOM_DOC("Set face size of the face used by the current buffer.") +{ + View_ID view = get_active_view(app, Access_Always); + Buffer_ID buffer = view_get_buffer(app, view, Access_Always); + Face_ID face_id = get_face_id(app, buffer); + Face_Description description = get_face_description(app, face_id); + + Query_Bar_Group group(app); + u8 string_space[256]; + Query_Bar bar = {}; + bar.prompt = string_u8_litexpr("Face Size: "); + bar.string = SCu8(string_space, (u64)0); + bar.string_capacity = sizeof(string_space); + if (query_user_number(app, &bar, description.parameters.pt_size)){ + description.parameters.pt_size = (u32)string_to_integer(bar.string, 10); + try_modify_face(app, face_id, &description); + } +} + CUSTOM_COMMAND_SIG(increase_face_size) CUSTOM_DOC("Increase the size of the face used by the current buffer.") { @@ -701,6 +757,37 @@ CUSTOM_DOC("Decrease the size of the face used by the current buffer.") try_modify_face(app, face_id, &description); } +CUSTOM_COMMAND_SIG(set_face_size_this_buffer) +CUSTOM_DOC("Set face size of the face used by the current buffer; if any other buffers are using the same face a new face is created so that only this buffer is effected") +{ + View_ID view = get_active_view(app, Access_Always); + Buffer_ID buffer = view_get_buffer(app, view, Access_Always); + Face_ID face_id = get_face_id(app, buffer); + + b32 is_shared = false; + for (Buffer_ID buf_it = get_buffer_next(app, 0, Access_Always); + buf_it != 0; + buf_it = get_buffer_next(app, buf_it, Access_Always)){ + if (buf_it == buffer){ + continue; + } + Face_ID buf_it_face_id = get_face_id(app, buf_it); + if (buf_it_face_id == face_id){ + is_shared = true; + } + } + + if (is_shared){ + Face_Description description = get_face_description(app, face_id); + face_id = try_create_new_face(app, &description); + if (face_id != 0){ + buffer_set_face(app, buffer, face_id); + } + } + + set_face_size(app); +} + CUSTOM_COMMAND_SIG(mouse_wheel_change_face_size) CUSTOM_DOC("Reads the state of the mouse wheel and uses it to either increase or decrease the face size.") { diff --git a/custom/4coder_base_types.cpp b/custom/4coder_base_types.cpp index 6585e4e7..06d03341 100644 --- a/custom/4coder_base_types.cpp +++ b/custom/4coder_base_types.cpp @@ -158,10 +158,10 @@ make_data(void *memory, u64 size){ global_const Data zero_data = {}; -#define data_initr(m,s) {(m), (s)} -#define data_initr_struct(s) {(s), sizeof(*(s))} -#define data_initr_array(a) {(a), sizeof(a)} -#define data_initr_string(s) {(s), sizeof(s) - 1} +#define data_initr(m,s) {(u8*)(m), (s)} +#define data_initr_struct(s) {(u8*)(s), sizeof(*(s))} +#define data_initr_array(a) {(u8*)(a), sizeof(a)} +#define data_initr_string(s) {(u8*)(s), sizeof(s) - 1} //////////////////////////////// @@ -269,6 +269,23 @@ block_fill_u64(void *a, u64 size, u64 val){ #define block_match_struct(a,b) block_match((a), (b), sizeof(*(a))) #define block_match_array(a,b) block_match((a), (b), sizeof(a)) +function void +block_range_copy__inner(void *dst, void *src, Range_u64 range, i64 shift){ + block_copy((u8*)dst + range.first + shift, (u8*)src + range.first, range.max - range.min); +} + +function void +block_range_copy__inner(void *dst, void *src, Range_u64 range, i64 shift, u64 item_size){ + range.first *= item_size; + range.one_past_last *= item_size; + shift *= item_size; + block_range_copy__inner(dst, src, range, shift); +} + +#define block_range_copy(d,s,r,h) block_range_copy__inner((d),(s),Iu64(r),(i64)(h)) +#define block_range_copy_sized(d,s,r,h,i) block_range_copy__inner((d),(s),Iu64(r),(i64)(h),(i)) +#define block_range_copy_typed(d,s,r,h) block_range_copy_sized((d),(s),(r),(h),sizeof(*(d))) + function void block_copy_array_shift__inner(void *dst, void *src, u64 it_size, Range_i64 range, i64 shift){ u8 *dptr = (u8*)dst; @@ -1540,6 +1557,20 @@ unlerp(u64 a, u64 x, u64 b){ return(r); } +function Range_f32 +unlerp(f32 a, Range_f32 x, f32 b){ + x.min = unlerp(a, x.min, b); + x.max = unlerp(a, x.max, b); + return(x); +} + +function Range_f32 +lerp(f32 a, Range_f32 x, f32 b){ + x.min = lerp(a, x.min, b); + x.max = lerp(a, x.max, b); + return(x); +} + function f32 lerp(Range_f32 range, f32 t){ return(lerp(range.min, t, range.max)); @@ -1779,6 +1810,11 @@ If32(){ return(interval); } +function Range_u64 +Iu64(Range_i32 r){ + return(Iu64(r.min, r.max)); +} + global Range_i32 Ii32_neg_inf = {max_i32, min_i32}; global Range_i64 Ii64_neg_inf = {max_i64, min_i64}; global Range_u64 Iu64_neg_inf = {max_u64, 0}; @@ -2333,6 +2369,14 @@ rect_dim(Rect_i32 r){ Vec2_i32 v = {r.x1 - r.x0, r.y1 - r.y0}; return(v); } +function Range_i32 +rect_x(Rect_i32 r){ + return(Ii32(r.x0, r.x1)); +} +function Range_i32 +rect_y(Rect_i32 r){ + return(Ii32(r.y0, r.y1)); +} function i32 rect_width(Rect_i32 r){ return(r.x1 - r.x0); @@ -2346,6 +2390,14 @@ rect_dim(Rect_f32 r){ Vec2_f32 v = {r.x1 - r.x0, r.y1 - r.y0}; return(v); } +function Range_f32 +rect_x(Rect_f32 r){ + return(If32(r.x0, r.x1)); +} +function Range_f32 +rect_y(Rect_f32 r){ + return(If32(r.y0, r.y1)); +} function f32 rect_width(Rect_f32 r){ return(r.x1 - r.x0); @@ -4759,7 +4811,7 @@ string_find_first(String_Const_char str, String_Const_char needle, String_Match_ if (needle.size > 0){ i = str.size; if (str.size >= needle.size){ - i = 0; + i = 0; char c = character_to_upper(needle.str[0]); u64 one_past_last = str.size - needle.size + 1; for (;i < one_past_last; i += 1){ @@ -4783,7 +4835,7 @@ string_find_first(String_Const_u8 str, String_Const_u8 needle, String_Match_Rule if (needle.size > 0){ i = str.size; if (str.size >= needle.size){ - i = 0; + i = 0; u8 c = character_to_upper(needle.str[0]); u64 one_past_last = str.size - needle.size + 1; for (;i < one_past_last; i += 1){ @@ -4807,7 +4859,7 @@ string_find_first(String_Const_u16 str, String_Const_u16 needle, String_Match_Ru if (needle.size > 0){ i = str.size; if (str.size >= needle.size){ - i = 0; + i = 0; u16 c = character_to_upper(needle.str[0]); u64 one_past_last = str.size - needle.size + 1; for (;i < one_past_last; i += 1){ @@ -4831,7 +4883,7 @@ string_find_first(String_Const_u32 str, String_Const_u32 needle, String_Match_Ru if (needle.size > 0){ i = str.size; if (str.size >= needle.size){ - i = 0; + i = 0; u32 c = character_to_upper(needle.str[0]); u64 one_past_last = str.size - needle.size + 1; for (;i < one_past_last; i += 1){ @@ -4883,6 +4935,16 @@ string_find_first_insensitive(String_Const_u32 str, String_Const_u32 needle){ return(string_find_first(str, needle, StringMatch_CaseInsensitive)); } +function b32 +string_has_substr(String_Const_u8 str, String_Const_u8 needle, String_Match_Rule rule){ + return(string_find_first(str, needle, rule) < str.size); +} + +function b32 +string_has_substr(String_Const_u8 str, String_Const_u8 needle){ + return(string_find_first(str, needle, StringMatch_Exact) < str.size); +} + function i32 string_compare(String_Const_char a, String_Const_char b){ i32 result = 0; @@ -7043,7 +7105,7 @@ string_from_integer(Arena *arena, u64 x, u32 radix){ function b32 string_is_integer(String_Const_u8 string, u32 radix){ b32 is_integer = false; - if (radix <= 16){ + if (string.size > 0 && radix <= 16){ is_integer = true; for (u64 i = 0; i < string.size; i += 1){ if (string.str[i] < 128){ diff --git a/custom/4coder_base_types.h b/custom/4coder_base_types.h index 31f29195..78ee4ea7 100644 --- a/custom/4coder_base_types.h +++ b/custom/4coder_base_types.h @@ -320,6 +320,11 @@ global_const f32 epsilon_f32 = 5.96046448e-8f; global_const f32 pi_f32 = 3.14159265359f; global_const f32 half_pi_f32 = 1.5707963267f; +global_const f64 max_f64 = 1.79769313486231e+308; +global_const f64 min_f64 = -max_f64; +global_const f64 smallest_positive_f64 = 4.94065645841247e-324; +global_const f64 epsilon_f64 = 1.11022302462515650e-16; + #define clamp_signed_to_i8(x) (i8)(clamp((i64)i8_min, (i64)(x), (i64)i8_max)) #define clamp_signed_to_i16(x) (i16)(clamp((i64)i16_min, (i64)(x), (i64)i16_max)) #define clamp_signed_to_i32(x) (i32)(clamp((i64)i32_min, (i64)(x), (i64)i32_max)) @@ -522,8 +527,8 @@ union SNode{ #define zdll_remove_back_NP_(f,l,next,prev) ((f==l)?(f=l=0):(l->prev->next=0,l=l->prev)) #define zdll_remove_NP_(f,l,n,next,prev) \ ((l==n)?(zdll_remove_back_NP_(f,l,next,prev)) \ -:(f==n)?(zdll_remove_back_NP_(l,f,prev,next)) \ -: (dll_remove_NP_(n,n,next,prev))) + :(f==n)?(zdll_remove_back_NP_(l,f,prev,next)) \ + : (dll_remove_NP_(n,n,next,prev))) #define zdll_push_back(f,l,n) zdll_push_back_NP_((f),(l),(n),next,prev) #define zdll_push_front(f,l,n) zdll_push_back_NP_((l),(f),(n),prev,next) @@ -804,19 +809,19 @@ typedef u32 ARGB_Color; struct i8_Array{ i8 *vals; - i32 coint; + i32 count; }; struct i16_Array{ i16 *vals; - i32 coint; + i32 count; }; struct i32_Array{ i32 *vals; - i32 coint; + i32 count; }; struct i64_Array{ i64 *vals; - i32 coint; + i32 count; }; struct u8_Array{ diff --git a/custom/4coder_clipboard.cpp b/custom/4coder_clipboard.cpp index 8b562253..e8b88838 100644 --- a/custom/4coder_clipboard.cpp +++ b/custom/4coder_clipboard.cpp @@ -4,18 +4,106 @@ // TOP +CUSTOM_COMMAND_SIG(clipboard_record_clip) +CUSTOM_DOC("In response to a new clipboard contents events, saves the new clip onto the clipboard history") +{ + User_Input in = get_current_input(app); + if (in.event.kind == InputEventKind_Core && + in.event.core.code == CoreCode_NewClipboardContents){ + clipboard_post_internal_only(0, in.event.core.string); + } +} + +//////////////////////////////// + function b32 clipboard_post_buffer_range(Application_Links *app, i32 clipboard_index, Buffer_ID buffer, Range_i64 range){ b32 success = false; Scratch_Block scratch(app); String_Const_u8 string = push_buffer_range(app, scratch, buffer, range); if (string.size > 0){ - clipboard_post(app, clipboard_index, string); + clipboard_post(clipboard_index, string); success = true; } return(success); } +function void +clipboard_update_history_from_system(Application_Links *app, i32 clipboard_id){ + Scratch_Block scratch(app); + String_Const_u8 string = system_get_clipboard(scratch, clipboard_id); + if (string.str != 0){ + clipboard_post_internal_only(clipboard_id, string); + } +} + +global List_String_Const_u8 clipboard_collection_list = {}; + +function void +clipboard_collection_render(Application_Links *app, Frame_Info frame_info, View_ID view){ + Scratch_Block scratch(app); + Rect_f32 region = draw_background_and_margin(app, view); + Vec2_f32 mid_p = (region.p1 + region.p0)*0.5f; + + Fancy_Block message = {}; + Fancy_Line *line = push_fancy_line(scratch, &message); + push_fancy_string(scratch, line, fcolor_id(defcolor_pop2), + string_u8_litexpr("Collecting all clipboard events ")); + push_fancy_string(scratch, line, fcolor_id(defcolor_pop1), + string_u8_litexpr("press [escape] to stop")); + + for (Node_String_Const_u8 *node = clipboard_collection_list.first; + node != 0; + node = node->next){ + line = push_fancy_line(scratch, &message); + push_fancy_string(scratch, line, fcolor_id(defcolor_text_default), node->string); + } + + Face_ID face_id = get_face_id(app, 0); + Vec2_f32 dim = get_fancy_block_dim(app, face_id, &message); + Vec2_f32 half_dim = dim*0.5f; + draw_fancy_block(app, face_id, fcolor_zero(), &message, mid_p - half_dim); +} + +CUSTOM_UI_COMMAND_SIG(begin_clipboard_collection_mode) +CUSTOM_DOC("Allows the user to copy multiple strings from other applications before switching to 4coder and pasting them all.") +{ + local_persist b32 in_clipboard_collection_mode = false; + if (!in_clipboard_collection_mode){ + in_clipboard_collection_mode = true; + system_set_clipboard_catch_all(true); + + Scratch_Block scratch(app); + block_zero_struct(&clipboard_collection_list); + + View_ID view = get_this_ctx_view(app, Access_Always); + View_Context ctx = view_current_context(app, view); + ctx.render_caller = clipboard_collection_render; + ctx.hides_buffer = true; + View_Context_Block ctx_block(app, view, &ctx); + + for (;;){ + User_Input in = get_next_input(app, EventPropertyGroup_Any, EventProperty_Escape); + if (in.abort){ + break; + } + if (in.event.kind == InputEventKind_KeyStroke && in.event.key.code == KeyCode_Escape){ + break; + } + if (in.event.kind == InputEventKind_Core && + in.event.core.code == CoreCode_NewClipboardContents){ + String_Const_u8 stable_clip = clipboard_post_internal_only(0, in.event.core.string); + string_list_push(scratch, &clipboard_collection_list, stable_clip); + } + } + + block_zero_struct(&clipboard_collection_list); + + system_set_clipboard_catch_all(false); + in_clipboard_collection_mode = false; + } +} + CUSTOM_COMMAND_SIG(copy) CUSTOM_DOC("Copy the text in the range from the cursor to the mark onto the clipboard.") { @@ -39,7 +127,8 @@ CUSTOM_DOC("Cut the text in the range from the cursor to the mark onto the clipb CUSTOM_COMMAND_SIG(paste) CUSTOM_DOC("At the cursor, insert the text at the top of the clipboard.") { - i32 count = clipboard_count(app, 0); + clipboard_update_history_from_system(app, 0); + i32 count = clipboard_count(0); if (count > 0){ View_ID view = get_active_view(app, Access_ReadWriteVisible); if_view_has_highlighted_range_delete_range(app, view); @@ -53,7 +142,7 @@ CUSTOM_DOC("At the cursor, insert the text at the top of the clipboard.") Scratch_Block scratch(app); - String_Const_u8 string = push_clipboard_index(app, scratch, 0, *paste_index); + String_Const_u8 string = push_clipboard_index(scratch, 0, *paste_index); if (string.size > 0){ Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible); @@ -74,7 +163,7 @@ CUSTOM_DOC("If the previous command was paste or paste_next, replaces the paste { Scratch_Block scratch(app); - i32 count = clipboard_count(app, 0); + i32 count = clipboard_count(0); if (count > 0){ View_ID view = get_active_view(app, Access_ReadWriteVisible); Managed_Scope scope = view_get_managed_scope(app, view); @@ -90,7 +179,7 @@ CUSTOM_DOC("If the previous command was paste or paste_next, replaces the paste i32 paste_index = (*paste_index_ptr) + 1; *paste_index_ptr = paste_index; - String_Const_u8 string = push_clipboard_index(app, scratch, 0, paste_index); + String_Const_u8 string = push_clipboard_index(scratch, 0, paste_index); Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible); @@ -124,12 +213,18 @@ CUSTOM_DOC("Paste the next item on the clipboard and run auto-indent on the newl auto_indent_range(app); } +CUSTOM_COMMAND_SIG(clear_clipboard) +CUSTOM_DOC("Clears the history of the clipboard") +{ + clipboard_clear(0); +} + //////////////////////////////// CUSTOM_COMMAND_SIG(multi_paste){ Scratch_Block scratch(app); - i32 count = clipboard_count(app, 0); + i32 count = clipboard_count(0); if (count > 0){ View_ID view = get_active_view(app, Access_ReadWriteVisible); Managed_Scope scope = view_get_managed_scope(app, view); @@ -143,7 +238,7 @@ CUSTOM_COMMAND_SIG(multi_paste){ i32 paste_index = (*paste_index_ptr) + 1; *paste_index_ptr = paste_index; - String_Const_u8 string = push_clipboard_index(app, scratch, 0, paste_index); + String_Const_u8 string = push_clipboard_index(scratch, 0, paste_index); String_Const_u8 insert_string = push_u8_stringf(scratch, "\n%.*s", string_expand(string)); @@ -174,7 +269,7 @@ multi_paste_range(Application_Links *app, View_ID view, Range_i64 range, i32 pas i64 total_size = 0; for (i32 paste_index = 0; paste_index < paste_count; ++paste_index){ Temp_Memory temp = begin_temp(scratch); - String_Const_u8 string = push_clipboard_index(app, scratch, 0, paste_index); + String_Const_u8 string = push_clipboard_index(scratch, 0, paste_index); total_size += string.size + 1; end_temp(temp); } @@ -195,7 +290,7 @@ multi_paste_range(Application_Links *app, View_ID view, Range_i64 range, i32 pas if (paste_index != first){ string_list_push(scratch, &list, SCu8("\n", 1)); } - String_Const_u8 string = push_clipboard_index(app, scratch, 0, paste_index); + String_Const_u8 string = push_clipboard_index(scratch, 0, paste_index); if (string.size > 0){ string_list_push(scratch, &list, string); } @@ -266,15 +361,19 @@ multi_paste_interactive_up_down(Application_Links *app, i32 paste_count, i32 cli } } -CUSTOM_COMMAND_SIG(multi_paste_interactive){ - i32 clip_count = clipboard_count(app, 0); +CUSTOM_COMMAND_SIG(multi_paste_interactive) +CUSTOM_DOC("Paste multiple lines from the clipboard history, controlled with arrow keys") +{ + i32 clip_count = clipboard_count(0); if (clip_count > 0){ multi_paste_interactive_up_down(app, 1, clip_count); } } -CUSTOM_COMMAND_SIG(multi_paste_interactive_quick){ - i32 clip_count = clipboard_count(app, 0); +CUSTOM_COMMAND_SIG(multi_paste_interactive_quick) +CUSTOM_DOC("Paste multiple lines from the clipboard history, controlled by inputing the number of lines to paste") +{ + i32 clip_count = clipboard_count(0); if (clip_count > 0){ u8 string_space[256]; Query_Bar_Group group(app); @@ -292,5 +391,26 @@ CUSTOM_COMMAND_SIG(multi_paste_interactive_quick){ } } +//////////////////////////////// + +#if FCODER_TRANSITION_TO < 4001004 +function void +clipboard_clear(Application_Links *app, i32 clipboard_id){ + clipboard_clear(clipboard_id); +} +function b32 +clipboard_post(Application_Links *app, i32 clipboard_id, String_Const_u8 string){ + return(clipboard_post(clipboard_id, string)); +} +function i32 +clipboard_count(Application_Links *app, i32 clipboard_id){ + return(clipboard_count(clipboard_id)); +} +function String_Const_u8 +push_clipboard_index(Application_Links *app, Arena *arena, i32 clipboard_id, i32 item_index){ + return(push_clipboard_index(arena, clipboard_id, item_index)); +} +#endif + // BOTTOM diff --git a/custom/4coder_clipboard.h b/custom/4coder_clipboard.h new file mode 100644 index 00000000..d6301354 --- /dev/null +++ b/custom/4coder_clipboard.h @@ -0,0 +1,21 @@ +/* +4coder_clipboard.cpp - Copy paste commands and clipboard related setup. +*/ + +// TOP + +#ifndef FCODER_CLIPBOARD_H +#define FCODER_CLIPBOARD_H + +struct Clipboard{ + Arena arena; + Heap heap; + String_Const_u8 *clips; + u32 clip_index; + u32 clip_capacity; +}; + +#endif //4CODER_CLIPBOARD_H + +// BOTTOM + diff --git a/custom/4coder_code_index.cpp b/custom/4coder_code_index.cpp index defb7a3c..38726373 100644 --- a/custom/4coder_code_index.cpp +++ b/custom/4coder_code_index.cpp @@ -794,26 +794,26 @@ layout_token_pair(Token_Array *tokens, i64 pos){ } function f32 -layout_index_x_shift(Application_Links *app, Layout_Reflex *reflex, Code_Index_Nest *nest, i64 pos, f32 space_advance, b32 *unresolved_dependence){ +layout_index_x_shift(Application_Links *app, Layout_Reflex *reflex, Code_Index_Nest *nest, i64 pos, f32 regular_indent, b32 *unresolved_dependence){ f32 result = 0.f; if (nest != 0){ switch (nest->kind){ case CodeIndexNest_Scope: case CodeIndexNest_Preprocessor: { - result = layout_index_x_shift(app, reflex, nest->parent, pos, space_advance, unresolved_dependence); + result = layout_index_x_shift(app, reflex, nest->parent, pos, regular_indent, unresolved_dependence); if (nest->open.min < pos && nest->open.max <= pos && (!nest->is_closed || pos < nest->close.min)){ - result += 4.f*space_advance; + result += regular_indent; } }break; case CodeIndexNest_Statement: { - result = layout_index_x_shift(app, reflex, nest->parent, pos, space_advance, unresolved_dependence); + result = layout_index_x_shift(app, reflex, nest->parent, pos, regular_indent, unresolved_dependence); if (nest->open.min < pos && nest->open.max <= pos && (!nest->is_closed || pos < nest->close.min)){ - result += 4.f*space_advance; + result += regular_indent; } }break; @@ -828,25 +828,25 @@ layout_index_x_shift(Application_Links *app, Layout_Reflex *reflex, Code_Index_N } function f32 -layout_index_x_shift(Application_Links *app, Layout_Reflex *reflex, Code_Index_Nest *nest, i64 pos, f32 space_advance){ +layout_index_x_shift(Application_Links *app, Layout_Reflex *reflex, Code_Index_Nest *nest, i64 pos, f32 regular_indent){ b32 ignore; - return(layout_index_x_shift(app, reflex, nest, pos, space_advance, &ignore)); + return(layout_index_x_shift(app, reflex, nest, pos, regular_indent, &ignore)); } function f32 -layout_index_x_shift(Application_Links *app, Layout_Reflex *reflex, Code_Index_File *file, i64 pos, f32 space_advance, b32 *unresolved_dependence){ +layout_index_x_shift(Application_Links *app, Layout_Reflex *reflex, Code_Index_File *file, i64 pos, f32 regular_indent, b32 *unresolved_dependence){ f32 indent = 0; Code_Index_Nest *nest = code_index_get_nest(file, pos); if (nest != 0){ - indent = layout_index_x_shift(app, reflex, nest, pos, space_advance, unresolved_dependence); + indent = layout_index_x_shift(app, reflex, nest, pos, regular_indent, unresolved_dependence); } return(indent); } function f32 -layout_index_x_shift(Application_Links *app, Layout_Reflex *reflex, Code_Index_File *file, i64 pos, f32 space_advance){ +layout_index_x_shift(Application_Links *app, Layout_Reflex *reflex, Code_Index_File *file, i64 pos, f32 regular_indent){ b32 ignore; - return(layout_index_x_shift(app, reflex, file, pos, space_advance, &ignore)); + return(layout_index_x_shift(app, reflex, file, pos, regular_indent, &ignore)); } function void @@ -861,7 +861,7 @@ layout_index__emit_chunk(LefRig_TopBot_Layout_Vars *pos_vars, Face_ID face, Aren else{ lr_tb_write_byte(pos_vars, face, arena, list, index, *ptr); } - } + } ptr += consume.inc; } } @@ -882,8 +882,8 @@ function Layout_Item_List layout_index__inner(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_i64 range, Face_ID face, f32 width, Code_Index_File *file, Layout_Wrap_Kind kind){ Scratch_Block scratch(app); - Managed_Scope scope = buffer_get_managed_scope(app, buffer); - Token_Array *tokens_ptr = scope_attachment(app, scope, attachment_tokens, Token_Array); + Token_Array tokens = get_token_array_from_buffer(app, buffer); + Token_Array *tokens_ptr = &tokens; Layout_Item_List list = get_empty_item_list(range); String_Const_u8 text = push_buffer_range(app, scratch, buffer, range); @@ -892,6 +892,7 @@ layout_index__inner(Application_Links *app, Arena *arena, Buffer_ID buffer, Rang Face_Metrics metrics = get_face_metrics(app, face); LefRig_TopBot_Layout_Vars pos_vars = get_lr_tb_layout_vars(&advance_map, &metrics, width); + f32 regular_indent = metrics.space_advance*global_config.virtual_whitespace_regular_indent; f32 wrap_align_x = width - metrics.normal_advance; Layout_Reflex reflex = get_layout_reflex(&list, buffer, width, face); @@ -916,14 +917,14 @@ layout_index__inner(Application_Links *app, Arena *arena, Buffer_ID buffer, Rang start: if (ptr == end_ptr){ i64 index = layout_index_from_ptr(ptr, text.str, range.first); - f32 shift = layout_index_x_shift(app, &reflex, file, index, metrics.space_advance); + f32 shift = layout_index_x_shift(app, &reflex, file, index, regular_indent); lr_tb_advance_x_without_item(&pos_vars, shift); goto finish; } if (!character_is_whitespace(*ptr)){ i64 index = layout_index_from_ptr(ptr, text.str, range.first); - f32 shift = layout_index_x_shift(app, &reflex, file, index, metrics.space_advance); + f32 shift = layout_index_x_shift(app, &reflex, file, index, regular_indent); lr_tb_advance_x_without_item(&pos_vars, shift); goto consuming_non_whitespace; } @@ -934,14 +935,18 @@ layout_index__inner(Application_Links *app, Arena *arena, Buffer_ID buffer, Rang pending_wrap_ptr = ptr; word_ptr = ptr; i64 index = layout_index_from_ptr(ptr, text.str, range.first); - f32 shift = layout_index_x_shift(app, &reflex, file, index, metrics.space_advance); + f32 shift = layout_index_x_shift(app, &reflex, file, index, regular_indent); lr_tb_advance_x_without_item(&pos_vars, shift); goto consuming_non_whitespace; } - if (*ptr == '\n'){ + if (*ptr == '\r'){ + i64 index = layout_index_from_ptr(ptr, text.str, range.first); + newline_layout_consume_CR(&newline_vars, index); + } + else if (*ptr == '\n'){ pending_wrap_ptr = ptr; i64 index = layout_index_from_ptr(ptr, text.str, range.first); - f32 shift = layout_index_x_shift(app, &reflex, file, index, metrics.space_advance); + f32 shift = layout_index_x_shift(app, &reflex, file, index, regular_indent); lr_tb_advance_x_without_item(&pos_vars, shift); goto consuming_normal_whitespace; } @@ -950,7 +955,7 @@ layout_index__inner(Application_Links *app, Arena *arena, Buffer_ID buffer, Rang if (ptr == end_ptr){ pending_wrap_ptr = ptr; i64 index = layout_index_from_ptr(ptr - 1, text.str, range.first); - f32 shift = layout_index_x_shift(app, &reflex, file, index, metrics.space_advance); + f32 shift = layout_index_x_shift(app, &reflex, file, index, regular_indent); lr_tb_advance_x_without_item(&pos_vars, shift); goto finish; } @@ -991,7 +996,7 @@ layout_index__inner(Application_Links *app, Arena *arena, Buffer_ID buffer, Rang lr_tb_next_line(&pos_vars); #if 0 - f32 shift = layout_index_x_shift(app, &reflex, file, index, metrics.space_advance); + f32 shift = layout_index_x_shift(app, &reflex, file, index, regular_indent); lr_tb_advance_x_without_item(&pos_vars, shift); #endif @@ -1010,7 +1015,7 @@ layout_index__inner(Application_Links *app, Arena *arena, Buffer_ID buffer, Rang i64 index = layout_index_from_ptr(new_wrap_ptr, text.str, range.first); Code_Index_Nest *new_wrap_nest = code_index_get_nest(file, index); b32 invalid_wrap_x = false; - f32 new_wrap_x = layout_index_x_shift(app, &reflex, new_wrap_nest, index, metrics.space_advance, &invalid_wrap_x); + f32 new_wrap_x = layout_index_x_shift(app, &reflex, new_wrap_nest, index, regular_indent, &invalid_wrap_x); if (invalid_wrap_x){ new_wrap_x = max_f32; } @@ -1076,7 +1081,7 @@ layout_index__inner(Application_Links *app, Arena *arena, Buffer_ID buffer, Rang pending_wrap_ptr = new_wrap_ptr; pending_wrap_paren_nest_count = new_wrap_paren_nest_count; - pending_wrap_x = layout_index_x_shift(app, &reflex, new_wrap_nest, index, metrics.space_advance); + pending_wrap_x = layout_index_x_shift(app, &reflex, new_wrap_nest, index, regular_indent); pending_wrap_paren_nest_count = new_wrap_paren_nest_count; pending_wrap_token_score = new_wrap_token_score; pending_wrap_accumulated_w = 0.f; @@ -1169,7 +1174,7 @@ layout_virt_indent_index_generic(Application_Links *app, Arena *arena, Buffer_ID } CUSTOM_COMMAND_SIG(toggle_virtual_whitespace) -CUSTOM_DOC("Toggles the current buffer's virtual whitespace status.") +CUSTOM_DOC("Toggles virtual whitespace for all files.") { global_config.enable_virtual_whitespace = !global_config.enable_virtual_whitespace; @@ -1181,1181 +1186,3 @@ CUSTOM_DOC("Toggles the current buffer's virtual whitespace status.") } // BOTTOM - -#if 0 -======= -/* -4coder_code_index.cpp - Generic code indexing system for layout, definition jumps, etc. -*/ - -// TOP - -global Code_Index global_code_index = {}; - -function void -code_index_init(void){ - global_code_index.mutex = system_mutex_make(); - global_code_index.node_arena = make_arena_system(KB(4)); - global_code_index.buffer_to_index_file = make_table_u64_u64(global_code_index.node_arena.base_allocator, 500); -} - -function Code_Index_File_Storage* -code_index__alloc_storage(void){ - Code_Index_File_Storage *result = global_code_index.free_storage; - if (result == 0){ - result = push_array_zero(&global_code_index.node_arena, Code_Index_File_Storage, 1); - } - else{ - sll_stack_pop(global_code_index.free_storage); - } - zdll_push_back(global_code_index.storage_first, global_code_index.storage_last, result); - global_code_index.storage_count += 1; - return(result); -} - -function void -code_index__free_storage(Code_Index_File_Storage *storage){ - zdll_remove(global_code_index.storage_first, global_code_index.storage_last, storage); - global_code_index.storage_count -= 1; - sll_stack_push(global_code_index.free_storage, storage); -} - -function void -code_index_push_nest(Code_Index_Nest_List *list, Code_Index_Nest *nest){ - sll_queue_push(list->first, list->last, nest); - list->count += 1; -} - -function Code_Index_Nest_Ptr_Array -code_index_nest_ptr_array_from_list(Arena *arena, Code_Index_Nest_List *list){ - Code_Index_Nest_Ptr_Array array = {}; - array.ptrs = push_array_zero(arena, Code_Index_Nest*, list->count); - array.count = list->count; - i32 counter = 0; - for (Code_Index_Nest *node = list->first; - node != 0; - node = node->next){ - array.ptrs[counter] = node; - counter += 1; - } - return(array); -} - -function Code_Index_Note_Ptr_Array -code_index_note_ptr_array_from_list(Arena *arena, Code_Index_Note_List *list){ - Code_Index_Note_Ptr_Array array = {}; - array.ptrs = push_array_zero(arena, Code_Index_Note*, list->count); - array.count = list->count; - i32 counter = 0; - for (Code_Index_Note *node = list->first; - node != 0; - node = node->next){ - array.ptrs[counter] = node; - counter += 1; - } - return(array); -} - -function void -code_index_lock(void){ - system_mutex_acquire(global_code_index.mutex); -} - -function void -code_index_unlock(void){ - system_mutex_release(global_code_index.mutex); -} - -function void -code_index_set_file(Buffer_ID buffer, Arena arena, Code_Index_File *index){ - Code_Index_File_Storage *storage = 0; - Table_Lookup lookup = table_lookup(&global_code_index.buffer_to_index_file, buffer); - if (lookup.found_match){ - u64 val = 0; - table_read(&global_code_index.buffer_to_index_file, lookup, &val); - storage = (Code_Index_File_Storage*)IntAsPtr(val); - linalloc_clear(&storage->arena); - } - else{ - storage = code_index__alloc_storage(); - table_insert(&global_code_index.buffer_to_index_file, buffer, (u64)PtrAsInt(storage)); - } - storage->arena = arena; - storage->file = index; -} - -function void -code_index_erase_file(Buffer_ID buffer){ - Table_Lookup lookup = table_lookup(&global_code_index.buffer_to_index_file, buffer); - if (lookup.found_match){ - u64 val = 0; - table_read(&global_code_index.buffer_to_index_file, lookup, &val); - Code_Index_File_Storage *storage = (Code_Index_File_Storage*)IntAsPtr(val); - linalloc_clear(&storage->arena); - table_erase(&global_code_index.buffer_to_index_file, lookup); - code_index__free_storage(storage); - } -} - -function Code_Index_File* -code_index_get_file(Buffer_ID buffer){ - Code_Index_File *result = 0; - Table_Lookup lookup = table_lookup(&global_code_index.buffer_to_index_file, buffer); - if (lookup.found_match){ - u64 val = 0; - table_read(&global_code_index.buffer_to_index_file, lookup, &val); - Code_Index_File_Storage *storage = (Code_Index_File_Storage*)IntAsPtr(val); - result = storage->file; - } - return(result); -} - -function Code_Index_Nest* -code_index_get_nest(Code_Index_Nest_Ptr_Array *array, i64 pos){ - Code_Index_Nest *result = 0; - i32 count = array->count; - Code_Index_Nest **nest_ptrs = array->ptrs; - for (i32 i = 0; i < count; i += 1){ - Code_Index_Nest *nest = nest_ptrs[i]; - if (nest->open.max <= pos && pos <= nest->close.min){ - Code_Index_Nest *sub_nest = - code_index_get_nest(&nest->nest_array, pos); - if (sub_nest != 0){ - result = sub_nest; - } - else{ - result = nest; - } - break; - } - } - return(result); -} - -function Code_Index_Nest* -code_index_get_nest(Code_Index_Nest *nest, i64 pos){ - return(code_index_get_nest(&nest->nest_array, pos)); -} - -function Code_Index_Nest* -code_index_get_nest(Code_Index_File *file, i64 pos){ - return(code_index_get_nest(&file->nest_array, pos)); -} - -function void -index_shift(i64 *ptr, Range_i64 old_range, u64 new_size){ - i64 i = *ptr; - if (old_range.min <= i && i < old_range.max){ - *ptr = old_range.first; - } - else if (old_range.max <= i){ - *ptr = i + new_size - (old_range.max - old_range.min); - } -} - -function void -code_index_shift(Code_Index_Nest_Ptr_Array *array, - Range_i64 old_range, u64 new_size){ - i32 count = array->count; - Code_Index_Nest **nest_ptr = array->ptrs; - for (i32 i = 0; i < count; i += 1, nest_ptr += 1){ - Code_Index_Nest *nest = *nest_ptr; - index_shift(&nest->open.min, old_range, new_size); - index_shift(&nest->open.max, old_range, new_size); - if (nest->is_closed){ - index_shift(&nest->close.min, old_range, new_size); - index_shift(&nest->close.max, old_range, new_size); - } - code_index_shift(&nest->nest_array, old_range, new_size); - } -} - -function void -code_index_shift(Code_Index_File *file, Range_i64 old_range, u64 new_size){ - code_index_shift(&file->nest_array, old_range, new_size); -} - -//////////////////////////////// - -function void -generic_parse_inc(Generic_Parse_State *state){ - if (!token_it_inc_all(&state->it)){ - state->finished = true; - } -} - -function void -generic_parse_skip_soft_tokens(Code_Index_File *index, Generic_Parse_State *state){ - Token *token = token_it_read(&state->it); - for (;token != 0 && !state->finished;){ - if (state->in_preprocessor && !HasFlag(token->flags, TokenBaseFlag_PreprocessorBody)){ - break; - } - if (token->kind == TokenBaseKind_Comment){ - state->handle_comment(state->app, state->arena, index, token, state->contents); - } - else if (token->kind == TokenBaseKind_Whitespace){ - Range_i64 range = Ii64(token); - u8 *ptr = state->contents.str + range.one_past_last - 1; - for (i64 i = range.one_past_last - 1; - i >= range.first; - i -= 1, ptr -= 1){ - if (*ptr == '\n'){ - state->prev_line_start = ptr + 1; - break; - } - } - } - else{ - break; - } - generic_parse_inc(state); - token = token_it_read(&state->it); - } -} - -function void -generic_parse_init(Application_Links *app, Arena *arena, String_Const_u8 contents, Token_Array *tokens, Generic_Parse_Comment_Function *handle_comment, Generic_Parse_State *state){ - state->app = app; - state->arena = arena; - state->contents = contents; - state->it = token_iterator(0, tokens); - state->handle_comment = handle_comment; - state->prev_line_start = contents.str; -} - -//////////////////////////////// - -#if 0 -// NOTE(allen): grammar syntax -(X) = X -X Y = X and then Y -X? = zero or one X -$X = check for X but dont consume // NOTE(yuval): Removed apostrophe as it was causing a warning when compiling with gcc -[X] = zero or more Xs -X | Y = either X or Y -* = anything that does not match previous options in a X | Y | ... chain -* - X = anything that does not match X or previous options in a Y | Z | ... chain - = a token of type X -"X" = literally the string "X" -X{Y} = X with flag Y - -// NOTE(allen): grammar of code index parse -file: [preprocessor | scope | parens | function | type | * - ] -preprocessor: [scope | parens | stmnt]{pp-body} -scope: [preprocessor | scope | parens | * - ] -paren: [preprocessor | scope | parens | * - ] -stmnt-close-pattern: | | | | | -stmnt: [type | * - stmnt-close-pattern] stmnt-close-pattern -type: struct | union | enum | typedef -struct: "struct" $(";" | "{") -union: "union" $(";" | "{") -enum: "enum" $(";" | "{") -typedef: "typedef" [* - ( (";" | "("))] $(";" | "(") -function: >"(" [* - ("(" | ")" | "{" | "}" | ";")] ")" ("{" | ";") - -#endif - -//////////////////////////////// - -function Code_Index_Note* -index_new_note(Code_Index_File *index, Generic_Parse_State *state, Range_i64 range, Code_Index_Note_Kind kind, Code_Index_Nest *parent){ - Code_Index_Note *result = push_array(state->arena, Code_Index_Note, 1); - sll_queue_push(index->note_list.first, index->note_list.last, result); - index->note_list.count += 1; - result->note_kind = kind; - result->pos = range; - result->text = push_string_copy(state->arena, string_substring(state->contents, range)); - result->file = index; - result->parent = parent; - return(result); -} - -function void -cpp_parse_type_structure(Code_Index_File *index, Generic_Parse_State *state, Code_Index_Nest *parent){ - generic_parse_inc(state); - generic_parse_skip_soft_tokens(index, state); - if (state->finished){ - return; - } - Token *token = token_it_read(&state->it); - if (token != 0 && token->kind == TokenBaseKind_Identifier){ - generic_parse_inc(state); - generic_parse_skip_soft_tokens(index, state); - Token *peek = token_it_read(&state->it); - if (peek != 0 && peek->kind == TokenBaseKind_StatementClose || - peek->kind == TokenBaseKind_ScopeOpen){ - index_new_note(index, state, Ii64(token), CodeIndexNote_Type, parent); - } - } -} - -function void -cpp_parse_type_def(Code_Index_File *index, Generic_Parse_State *state, Code_Index_Nest *parent){ - generic_parse_inc(state); - generic_parse_skip_soft_tokens(index, state); - for (;;){ - b32 did_advance = false; - Token *token = token_it_read(&state->it); - if (token == 0 || state->finished){ - break; - } - if (token->kind == TokenBaseKind_Identifier){ - generic_parse_inc(state); - generic_parse_skip_soft_tokens(index, state); - did_advance = true; - Token *peek = token_it_read(&state->it); - if (peek != 0 && peek->kind == TokenBaseKind_StatementClose || - peek->kind == TokenBaseKind_ParentheticalOpen){ - index_new_note(index, state, Ii64(token), CodeIndexNote_Type, parent); - break; - } - } - else if (token->kind == TokenBaseKind_StatementClose || - token->kind == TokenBaseKind_ScopeOpen || - token->kind == TokenBaseKind_ScopeClose || - token->kind == TokenBaseKind_ScopeOpen || - token->kind == TokenBaseKind_ScopeClose){ - break; - } - else if (token->kind == TokenBaseKind_Keyword){ - String_Const_u8 lexeme = string_substring(state->contents, Ii64(token)); - if (string_match(lexeme, string_u8_litexpr("struct")) || - string_match(lexeme, string_u8_litexpr("union")) || - string_match(lexeme, string_u8_litexpr("enum"))){ - break; - } - } - if (!did_advance){ - generic_parse_inc(state); - generic_parse_skip_soft_tokens(index, state); - } - } -} - -function void -cpp_parse_function(Code_Index_File *index, Generic_Parse_State *state, Code_Index_Nest *parent){ - Token *token = token_it_read(&state->it); - generic_parse_inc(state); - generic_parse_skip_soft_tokens(index, state); - if (state->finished){ - return; - } - Token *peek = token_it_read(&state->it); - Token *reset_point = peek; - if (peek != 0 && peek->sub_kind == TokenCppKind_ParenOp){ - b32 at_paren_close = false; - for (; peek != 0;){ - generic_parse_inc(state); - generic_parse_skip_soft_tokens(index, state); - peek = token_it_read(&state->it); - if (peek == 0 || state->finished){ - break; - } - - if (peek->kind == TokenBaseKind_ParentheticalOpen || - peek->kind == TokenBaseKind_ScopeOpen || - peek->kind == TokenBaseKind_ScopeClose || - peek->kind == TokenBaseKind_StatementClose){ - break; - } - if (peek->kind == TokenBaseKind_ParentheticalClose){ - at_paren_close = true; - break; - } - } - - if (at_paren_close){ - generic_parse_inc(state); - generic_parse_skip_soft_tokens(index, state); - peek = token_it_read(&state->it); - if (peek != 0 && - peek->kind == TokenBaseKind_ScopeOpen || - peek->kind == TokenBaseKind_StatementClose){ - index_new_note(index, state, Ii64(token), CodeIndexNote_Function, parent); - } - } - } - state->it = token_iterator(state->it.user_id, state->it.tokens, state->it.count, reset_point); -} - -function Code_Index_Nest* -generic_parse_statement(Code_Index_File *index, Generic_Parse_State *state); - -function Code_Index_Nest* -generic_parse_preprocessor(Code_Index_File *index, Generic_Parse_State *state); - -function Code_Index_Nest* -generic_parse_scope(Code_Index_File *index, Generic_Parse_State *state); - -function Code_Index_Nest* -generic_parse_paren(Code_Index_File *index, Generic_Parse_State *state); - -function Code_Index_Nest* -generic_parse_statement(Code_Index_File *index, Generic_Parse_State *state){ - Token *token = token_it_read(&state->it); - Code_Index_Nest *result = push_array_zero(state->arena, Code_Index_Nest, 1); - result->kind = CodeIndexNest_Statement; - result->open = Ii64(token->pos); - result->close = Ii64(max_i64); - result->file = index; - - state->in_statement = true; - - for (;;){ - generic_parse_skip_soft_tokens(index, state); - token = token_it_read(&state->it); - if (token == 0 || state->finished){ - break; - } - - if (state->in_preprocessor){ - if (!HasFlag(token->flags, TokenBaseFlag_PreprocessorBody) || - token->kind == TokenBaseKind_Preprocessor){ - result->is_closed = true; - result->close = Ii64(token->pos); - break; - } - } - else{ - if (token->kind == TokenBaseKind_Preprocessor){ - result->is_closed = true; - result->close = Ii64(token->pos); - break; - } - } - - if (token->kind == TokenBaseKind_ScopeOpen || - token->kind == TokenBaseKind_ScopeClose || - token->kind == TokenBaseKind_ParentheticalOpen){ - result->is_closed = true; - result->close = Ii64(token->pos); - break; - } - - if (token->kind == TokenBaseKind_StatementClose){ - result->is_closed = true; - result->close = Ii64(token); - generic_parse_inc(state); - break; - } - - generic_parse_inc(state); - } - - state->in_statement = false; - - return(result); -} - -function Code_Index_Nest* -generic_parse_preprocessor(Code_Index_File *index, Generic_Parse_State *state){ - Token *token = token_it_read(&state->it); - Code_Index_Nest *result = push_array_zero(state->arena, Code_Index_Nest, 1); - result->kind = CodeIndexNest_Preprocessor; - result->open = Ii64(token->pos); - result->close = Ii64(max_i64); - result->file = index; - - state->in_preprocessor = true; - - b32 potential_macro = false; - if (state->do_cpp_parse){ - if (token->sub_kind == TokenCppKind_PPDefine){ - potential_macro = true; - } - } - - generic_parse_inc(state); - for (;;){ - generic_parse_skip_soft_tokens(index, state); - token = token_it_read(&state->it); - if (token == 0 || state->finished){ - break; - } - - if (!HasFlag(token->flags, TokenBaseFlag_PreprocessorBody) || - token->kind == TokenBaseKind_Preprocessor){ - result->is_closed = true; - result->close = Ii64(token->pos); - break; - } - - if (state->do_cpp_parse && potential_macro){ - if (token->sub_kind == TokenCppKind_Identifier){ - index_new_note(index, state, Ii64(token), CodeIndexNote_Macro, result); - } - potential_macro = false; - } - - if (token->kind == TokenBaseKind_ScopeOpen){ - Code_Index_Nest *nest = generic_parse_scope(index, state); - nest->parent = result; - code_index_push_nest(&result->nest_list, nest); - continue; - } - - if (token->kind == TokenBaseKind_ParentheticalOpen){ - Code_Index_Nest *nest = generic_parse_paren(index, state); - nest->parent = result; - code_index_push_nest(&result->nest_list, nest); - continue; - } - - generic_parse_inc(state); - } - - result->nest_array = code_index_nest_ptr_array_from_list(state->arena, &result->nest_list); - - state->in_preprocessor = false; - - return(result); -} - -function Code_Index_Nest* -generic_parse_scope(Code_Index_File *index, Generic_Parse_State *state){ - Token *token = token_it_read(&state->it); - Code_Index_Nest *result = push_array_zero(state->arena, Code_Index_Nest, 1); - result->kind = CodeIndexNest_Scope; - result->open = Ii64(token); - result->close = Ii64(max_i64); - result->file = index; - - state->scope_counter += 1; - - generic_parse_inc(state); - for (;;){ - generic_parse_skip_soft_tokens(index, state); - token = token_it_read(&state->it); - if (token == 0 || state->finished){ - break; - } - - if (state->in_preprocessor){ - if (!HasFlag(token->flags, TokenBaseFlag_PreprocessorBody) || - token->kind == TokenBaseKind_Preprocessor){ - break; - } - } - else{ - if (token->kind == TokenBaseKind_Preprocessor){ - Code_Index_Nest *nest = generic_parse_preprocessor(index, state); - code_index_push_nest(&index->nest_list, nest); - continue; - } - } - - if (token->kind == TokenBaseKind_ScopeClose){ - result->is_closed = true; - result->close = Ii64(token); - generic_parse_inc(state); - break; - } - - if (token->kind == TokenBaseKind_ScopeOpen){ - Code_Index_Nest *nest = generic_parse_scope(index, state); - nest->parent = result; - code_index_push_nest(&result->nest_list, nest); - continue; - } - - if (token->kind == TokenBaseKind_ParentheticalOpen){ - Code_Index_Nest *nest = generic_parse_paren(index, state); - nest->parent = result; - code_index_push_nest(&result->nest_list, nest); - continue; - } - - if (token->kind == TokenBaseKind_ParentheticalClose){ - generic_parse_inc(state); - continue; - } - - { - Code_Index_Nest *nest = generic_parse_statement(index, state); - nest->parent = result; - code_index_push_nest(&result->nest_list, nest); - } - } - - result->nest_array = code_index_nest_ptr_array_from_list(state->arena, &result->nest_list); - - state->scope_counter -= 1; - - return(result); -} - -function Code_Index_Nest* -generic_parse_paren(Code_Index_File *index, Generic_Parse_State *state){ - Token *token = token_it_read(&state->it); - Code_Index_Nest *result = push_array_zero(state->arena, Code_Index_Nest, 1); - result->kind = CodeIndexNest_Paren; - result->open = Ii64(token); - result->close = Ii64(max_i64); - result->file = index; - - i64 manifested_characters_on_line = 0; - { - u8 *ptr = state->prev_line_start; - u8 *end_ptr = state->contents.str + token->pos; - // NOTE(allen): Initial whitespace - for (;ptr < end_ptr; ptr += 1){ - if (!character_is_whitespace(*ptr)){ - break; - } - } - // NOTE(allen): Manifested characters - manifested_characters_on_line = (i64)(end_ptr - ptr) + token->size; - } - - state->paren_counter += 1; - - generic_parse_inc(state); - for (;;){ - generic_parse_skip_soft_tokens(index, state); - token = token_it_read(&state->it); - if (token == 0 || state->finished){ - break; - } - - if (state->in_preprocessor){ - if (!HasFlag(token->flags, TokenBaseFlag_PreprocessorBody) || - token->kind == TokenBaseKind_Preprocessor){ - break; - } - } - else{ - if (token->kind == TokenBaseKind_Preprocessor){ - Code_Index_Nest *nest = generic_parse_preprocessor(index, state); - code_index_push_nest(&index->nest_list, nest); - continue; - } - } - - if (token->kind == TokenBaseKind_ParentheticalClose){ - result->is_closed = true; - result->close = Ii64(token); - generic_parse_inc(state); - break; - } - - if (token->kind == TokenBaseKind_ScopeClose){ - break; - } - - if (token->kind == TokenBaseKind_ScopeOpen){ - Code_Index_Nest *nest = generic_parse_scope(index, state); - nest->parent = result; - code_index_push_nest(&result->nest_list, nest); - continue; - } - - if (token->kind == TokenBaseKind_ParentheticalOpen){ - Code_Index_Nest *nest = generic_parse_paren(index, state); - nest->parent = result; - code_index_push_nest(&result->nest_list, nest); - continue; - } - - generic_parse_inc(state); - } - - result->nest_array = code_index_nest_ptr_array_from_list(state->arena, &result->nest_list); - - state->paren_counter -= 1; - - return(result); -} - -function b32 -generic_parse_full_input_breaks(Code_Index_File *index, Generic_Parse_State *state, i32 limit){ - b32 result = false; - - i64 first_index = token_it_index(&state->it); - i64 one_past_last_index = first_index + limit; - for (;;){ - generic_parse_skip_soft_tokens(index, state); - Token *token = token_it_read(&state->it); - - if (token == 0 || state->finished){ - result = true; - break; - } - - if (token->kind == TokenBaseKind_Preprocessor){ - Code_Index_Nest *nest = generic_parse_preprocessor(index, state); - code_index_push_nest(&index->nest_list, nest); - } - else if (token->kind == TokenBaseKind_ScopeOpen){ - Code_Index_Nest *nest = generic_parse_scope(index, state); - code_index_push_nest(&index->nest_list, nest); - } - else if (token->kind == TokenBaseKind_ParentheticalOpen){ - Code_Index_Nest *nest = generic_parse_paren(index, state); - code_index_push_nest(&index->nest_list, nest); - } - else if (state->do_cpp_parse){ - if (token->sub_kind == TokenCppKind_Struct || - token->sub_kind == TokenCppKind_Union || - token->sub_kind == TokenCppKind_Enum){ - cpp_parse_type_structure(index, state, 0); - } - else if (token->sub_kind == TokenCppKind_Typedef){ - cpp_parse_type_def(index, state, 0); - } - else if (token->sub_kind == TokenCppKind_Identifier){ - cpp_parse_function(index, state, 0); - } - else{ - generic_parse_inc(state); - } - } - else{ - generic_parse_inc(state); - } - - i64 index = token_it_index(&state->it); - if (index >= one_past_last_index){ - token = token_it_read(&state->it); - if (token == 0){ - result = true; - } - break; - } - } - - if (result){ - index->nest_array = code_index_nest_ptr_array_from_list(state->arena, &index->nest_list); - index->note_array = code_index_note_ptr_array_from_list(state->arena, &index->note_list); - } - - return(result); -} - -//////////////////////////////// - -function void -default_comment_index(Application_Links *app, Arena *arena, Code_Index_File *index, Token *token, String_Const_u8 contents){ - -} - -function void -generic_parse_init(Application_Links *app, Arena *arena, String_Const_u8 contents, Token_Array *tokens, Generic_Parse_State *state){ - generic_parse_init(app, arena, contents, tokens, default_comment_index, state); -} - -//////////////////////////////// - -function Token_Pair -layout_token_pair(Token_Array *tokens, i64 pos){ - Token_Pair result = {}; - Token_Iterator_Array it = token_iterator_pos(0, tokens, pos); - Token *b = token_it_read(&it); - if (b != 0){ - if (b->kind == TokenBaseKind_Whitespace){ - token_it_inc_non_whitespace(&it); - b = token_it_read(&it); - } - } - token_it_dec_non_whitespace(&it); - Token *a = token_it_read(&it); - if (a != 0){ - result.a = *a; - } - if (b != 0){ - result.b = *b; - } - return(result); -} - -function f32 -layout_index_x_shift(Application_Links *app, Layout_Reflex *reflex, Code_Index_Nest *nest, i64 pos, f32 space_advance, b32 *unresolved_dependence){ - f32 result = 0.f; - if (nest != 0){ - switch (nest->kind){ - case CodeIndexNest_Scope: - case CodeIndexNest_Preprocessor: - { - result = layout_index_x_shift(app, reflex, nest->parent, pos, space_advance, unresolved_dependence); - if (nest->open.min < pos && nest->open.max <= pos && - (!nest->is_closed || pos < nest->close.min)){ - result += 4.f*space_advance; - } - }break; - - case CodeIndexNest_Statement: - { - result = layout_index_x_shift(app, reflex, nest->parent, pos, space_advance, unresolved_dependence); - if (nest->open.min < pos && nest->open.max <= pos && - (!nest->is_closed || pos < nest->close.min)){ - result += 4.f*space_advance; - } - }break; - - case CodeIndexNest_Paren: - { - Rect_f32 box = layout_reflex_get_rect(app, reflex, nest->open.max - 1, unresolved_dependence); - result = box.x1; - }break; - } - } - return(result); -} - -function f32 -layout_index_x_shift(Application_Links *app, Layout_Reflex *reflex, Code_Index_Nest *nest, i64 pos, f32 space_advance){ - b32 ignore; - return(layout_index_x_shift(app, reflex, nest, pos, space_advance, &ignore)); -} - -function f32 -layout_index_x_shift(Application_Links *app, Layout_Reflex *reflex, Code_Index_File *file, i64 pos, f32 space_advance, b32 *unresolved_dependence){ - f32 indent = 0; - Code_Index_Nest *nest = code_index_get_nest(file, pos); - if (nest != 0){ - indent = layout_index_x_shift(app, reflex, nest, pos, space_advance, unresolved_dependence); - } - return(indent); -} - -function f32 -layout_index_x_shift(Application_Links *app, Layout_Reflex *reflex, Code_Index_File *file, i64 pos, f32 space_advance){ - b32 ignore; - return(layout_index_x_shift(app, reflex, file, pos, space_advance, &ignore)); -} - -function void -layout_index__emit_chunk(LefRig_TopBot_Layout_Vars *pos_vars, Face_ID face, Arena *arena, u8 *text_str, i64 range_first, u8 *ptr, u8 *end, Layout_Item_List *list){ - for (;ptr < end;){ - Character_Consume_Result consume = utf8_consume(ptr, (u64)(end - ptr)); - if (consume.codepoint != '\r'){ - i64 index = layout_index_from_ptr(ptr, text_str, range_first); - if (consume.codepoint != max_u32){ - lr_tb_write(pos_vars, face, arena, list, index, consume.codepoint); - } - else{ - lr_tb_write_byte(pos_vars, face, arena, list, index, *ptr); - } - } - ptr += consume.inc; - } -} - -function i32 -layout_token_score_wrap_token(Token_Pair *pair, Token_Cpp_Kind kind){ - i32 result = 0; - if (pair->a.sub_kind != kind && pair->b.sub_kind == kind){ - result -= 1; - } - else if (pair->a.sub_kind == kind && pair->b.sub_kind != kind){ - result += 1; - } - return(result); -} - -function Layout_Item_List -layout_index__inner(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_i64 range, Face_ID face, f32 width, Code_Index_File *file, Layout_Wrap_Kind kind){ - Scratch_Block scratch(app); - - Managed_Scope scope = buffer_get_managed_scope(app, buffer); - Token_Array *tokens_ptr = scope_attachment(app, scope, attachment_tokens, Token_Array); - - Layout_Item_List list = get_empty_item_list(range); - String_Const_u8 text = push_buffer_range(app, scratch, buffer, range); - - Face_Advance_Map advance_map = get_face_advance_map(app, face); - Face_Metrics metrics = get_face_metrics(app, face); - LefRig_TopBot_Layout_Vars pos_vars = get_lr_tb_layout_vars(&advance_map, &metrics, width); - - f32 wrap_align_x = width - metrics.normal_advance; - - Layout_Reflex reflex = get_layout_reflex(&list, buffer, width, face); - - if (text.size == 0){ - lr_tb_write_blank(&pos_vars, face, arena, &list, range.start); - } - else{ - b32 first_of_the_line = true; - Newline_Layout_Vars newline_vars = get_newline_layout_vars(); - - u8 *ptr = text.str; - u8 *end_ptr = ptr + text.size; - u8 *word_ptr = ptr; - - u8 *pending_wrap_ptr = ptr; - f32 pending_wrap_x = 0.f; - i32 pending_wrap_paren_nest_count = 0; - i32 pending_wrap_token_score = 0; - f32 pending_wrap_accumulated_w = 0.f; - - start: - if (ptr == end_ptr){ - i64 index = layout_index_from_ptr(ptr, text.str, range.first); - f32 shift = layout_index_x_shift(app, &reflex, file, index, metrics.space_advance); - lr_tb_advance_x_without_item(&pos_vars, shift); - goto finish; - } - - if (!character_is_whitespace(*ptr)){ - i64 index = layout_index_from_ptr(ptr, text.str, range.first); - f32 shift = layout_index_x_shift(app, &reflex, file, index, metrics.space_advance); - lr_tb_advance_x_without_item(&pos_vars, shift); - goto consuming_non_whitespace; - } - - { - for (;ptr < end_ptr; ptr += 1){ - if (!character_is_whitespace(*ptr)){ - pending_wrap_ptr = ptr; - word_ptr = ptr; - i64 index = layout_index_from_ptr(ptr, text.str, range.first); - f32 shift = layout_index_x_shift(app, &reflex, file, index, metrics.space_advance); - lr_tb_advance_x_without_item(&pos_vars, shift); - goto consuming_non_whitespace; - } - if (*ptr == '\n'){ - pending_wrap_ptr = ptr; - i64 index = layout_index_from_ptr(ptr, text.str, range.first); - f32 shift = layout_index_x_shift(app, &reflex, file, index, metrics.space_advance); - lr_tb_advance_x_without_item(&pos_vars, shift); - goto consuming_normal_whitespace; - } - } - - if (ptr == end_ptr){ - pending_wrap_ptr = ptr; - i64 index = layout_index_from_ptr(ptr - 1, text.str, range.first); - f32 shift = layout_index_x_shift(app, &reflex, file, index, metrics.space_advance); - lr_tb_advance_x_without_item(&pos_vars, shift); - goto finish; - } - } - - consuming_non_whitespace: - { - for (;ptr <= end_ptr; ptr += 1){ - if (ptr == end_ptr || character_is_whitespace(*ptr)){ - break; - } - } - - // NOTE(allen): measure this word - newline_layout_consume_default(&newline_vars); - String_Const_u8 word = SCu8(word_ptr, ptr); - u8 *word_end = ptr; - { - f32 word_advance = 0.f; - ptr = word.str; - for (;ptr < word_end;){ - Character_Consume_Result consume = utf8_consume(ptr, (u64)(word_end - ptr)); - if (consume.codepoint != max_u32){ - word_advance += lr_tb_advance(&pos_vars, face, consume.codepoint); - } - else{ - word_advance += lr_tb_advance_byte(&pos_vars); - } - ptr += consume.inc; - } - pending_wrap_accumulated_w += word_advance; - } - - if (!first_of_the_line && (kind == Layout_Wrapped) && lr_tb_crosses_width(&pos_vars, pending_wrap_accumulated_w)){ - i64 index = layout_index_from_ptr(pending_wrap_ptr, text.str, range.first); - lr_tb_align_rightward(&pos_vars, wrap_align_x); - lr_tb_write_ghost(&pos_vars, face, arena, &list, index, '\\'); - - lr_tb_next_line(&pos_vars); -#if 0 - f32 shift = layout_index_x_shift(app, &reflex, file, index, metrics.space_advance); - lr_tb_advance_x_without_item(&pos_vars, shift); -#endif - - ptr = pending_wrap_ptr; - pending_wrap_accumulated_w = 0.f; - first_of_the_line = true; - goto start; - } - } - - consuming_normal_whitespace: - for (; ptr < end_ptr; ptr += 1){ - if (!character_is_whitespace(*ptr)){ - u8 *new_wrap_ptr = ptr; - - i64 index = layout_index_from_ptr(new_wrap_ptr, text.str, range.first); - Code_Index_Nest *new_wrap_nest = code_index_get_nest(file, index); - b32 invalid_wrap_x = false; - f32 new_wrap_x = layout_index_x_shift(app, &reflex, new_wrap_nest, index, metrics.space_advance, &invalid_wrap_x); - if (invalid_wrap_x){ - new_wrap_x = max_f32; - } - - i32 new_wrap_paren_nest_count = 0; - for (Code_Index_Nest *nest = new_wrap_nest; - nest != 0; - nest = nest->parent){ - if (nest->kind == CodeIndexNest_Paren){ - new_wrap_paren_nest_count += 1; - } - } - - Token_Pair new_wrap_token_pair = layout_token_pair(tokens_ptr, index); - - // TODO(allen): pull out the token scoring part and make it replacable for other - // language's token based wrap scoring needs. - i32 token_score = 0; - if (new_wrap_token_pair.a.kind == TokenBaseKind_Keyword){ - if (new_wrap_token_pair.b.kind == TokenBaseKind_ParentheticalOpen || - new_wrap_token_pair.b.kind == TokenBaseKind_Keyword){ - token_score -= 2; - } - } - token_score += layout_token_score_wrap_token(&new_wrap_token_pair, TokenCppKind_Eq); - token_score += layout_token_score_wrap_token(&new_wrap_token_pair, TokenCppKind_PlusEq); - token_score += layout_token_score_wrap_token(&new_wrap_token_pair, TokenCppKind_MinusEq); - token_score += layout_token_score_wrap_token(&new_wrap_token_pair, TokenCppKind_StarEq); - token_score += layout_token_score_wrap_token(&new_wrap_token_pair, TokenCppKind_DivEq); - token_score += layout_token_score_wrap_token(&new_wrap_token_pair, TokenCppKind_ModEq); - token_score += layout_token_score_wrap_token(&new_wrap_token_pair, TokenCppKind_LeftLeftEq); - token_score += layout_token_score_wrap_token(&new_wrap_token_pair, TokenCppKind_RightRightEq); - token_score += layout_token_score_wrap_token(&new_wrap_token_pair, TokenCppKind_Comma); - token_score += layout_token_score_wrap_token(&new_wrap_token_pair, TokenCppKind_AndAnd); - token_score += layout_token_score_wrap_token(&new_wrap_token_pair, TokenCppKind_OrOr); - token_score += layout_token_score_wrap_token(&new_wrap_token_pair, TokenCppKind_Ternary); - token_score += layout_token_score_wrap_token(&new_wrap_token_pair, TokenCppKind_Colon); - token_score += layout_token_score_wrap_token(&new_wrap_token_pair, TokenCppKind_Semicolon); - - i32 new_wrap_token_score = token_score; - - b32 new_wrap_ptr_is_better = false; - if (first_of_the_line){ - new_wrap_ptr_is_better = true; - } - else{ - if (new_wrap_token_score > pending_wrap_token_score){ - new_wrap_ptr_is_better = true; - } - else if (new_wrap_token_score == pending_wrap_token_score){ - f32 new_score = new_wrap_paren_nest_count*10.f + new_wrap_x; - f32 old_score = pending_wrap_paren_nest_count*10.f + pending_wrap_x + metrics.normal_advance*4.f + pending_wrap_accumulated_w*0.5f; - - if (new_score < old_score){ - new_wrap_ptr_is_better = true; - } - } - } - - if (new_wrap_ptr_is_better){ - layout_index__emit_chunk(&pos_vars, face, arena, text.str, range.first, pending_wrap_ptr, new_wrap_ptr, &list); - first_of_the_line = false; - - pending_wrap_ptr = new_wrap_ptr; - pending_wrap_paren_nest_count = new_wrap_paren_nest_count; - pending_wrap_x = layout_index_x_shift(app, &reflex, new_wrap_nest, index, metrics.space_advance); - pending_wrap_paren_nest_count = new_wrap_paren_nest_count; - pending_wrap_token_score = new_wrap_token_score; - pending_wrap_accumulated_w = 0.f; - } - - word_ptr = ptr; - goto consuming_non_whitespace; - } - - i64 index = layout_index_from_ptr(ptr, text.str, range.first); - switch (*ptr){ - default: - { - newline_layout_consume_default(&newline_vars); - pending_wrap_accumulated_w += lr_tb_advance(&pos_vars, face, *ptr); - }break; - - case '\r': - { - newline_layout_consume_CR(&newline_vars, index); - }break; - - case '\n': - { - layout_index__emit_chunk(&pos_vars, face, arena, text.str, range.first, pending_wrap_ptr, ptr, &list); - pending_wrap_ptr = ptr + 1; - pending_wrap_accumulated_w = 0.f; - - u64 newline_index = newline_layout_consume_LF(&newline_vars, index); - lr_tb_write_blank(&pos_vars, face, arena, &list, newline_index); - lr_tb_next_line(&pos_vars); - first_of_the_line = true; - ptr += 1; - goto start; - }break; - } - } - - finish: - if (newline_layout_consume_finish(&newline_vars)){ - layout_index__emit_chunk(&pos_vars, face, arena, text.str, range.first, pending_wrap_ptr, ptr, &list); - i64 index = layout_index_from_ptr(ptr, text.str, range.first); - lr_tb_write_blank(&pos_vars, face, arena, &list, index); - } - } - - layout_item_list_finish(&list, -pos_vars.line_to_text_shift); - - return(list); -} - -function Layout_Item_List -layout_virt_indent_index(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_i64 range, Face_ID face, f32 width, Layout_Wrap_Kind kind){ - Layout_Item_List result = {}; - - if (global_config.enable_virtual_whitespace){ - code_index_lock(); - Code_Index_File *file = code_index_get_file(buffer); - if (file != 0){ - result = layout_index__inner(app, arena, buffer, range, face, width, file, kind); - } - code_index_unlock(); - if (file == 0){ - result = layout_virt_indent_literal(app, arena, buffer, range, face, width, kind); - } - } - else{ - result = layout_basic(app, arena, buffer, range, face, width, kind); - } - - return(result); -} - -function Layout_Item_List -layout_virt_indent_index_unwrapped(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_i64 range, Face_ID face, f32 width){ - return(layout_virt_indent_index(app, arena, buffer, range, face, width, Layout_Unwrapped)); -} - -function Layout_Item_List -layout_virt_indent_index_wrapped(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_i64 range, Face_ID face, f32 width){ - return(layout_virt_indent_index(app, arena, buffer, range, face, width, Layout_Wrapped)); -} - -function Layout_Item_List -layout_virt_indent_index_generic(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_i64 range, Face_ID face, f32 width){ - Managed_Scope scope = buffer_get_managed_scope(app, buffer); - b32 *wrap_lines_ptr = scope_attachment(app, scope, buffer_wrap_lines, b32); - b32 wrap_lines = (wrap_lines_ptr != 0 && *wrap_lines_ptr); - return(layout_virt_indent_index(app, arena, buffer, range, face, width, wrap_lines?Layout_Wrapped:Layout_Unwrapped)); -} - -CUSTOM_COMMAND_SIG(toggle_virtual_whitespace) -CUSTOM_DOC("Toggles the current buffer's virtual whitespace status.") -{ - global_config.enable_virtual_whitespace = !global_config.enable_virtual_whitespace; - - for (Buffer_ID buffer = get_buffer_next(app, 0, Access_Always); - buffer != 0; - buffer = get_buffer_next(app, buffer, Access_Always)){ - buffer_clear_layout_cache(app, buffer); - } -} - -// BOTTOM - ->>>>>>> yuval_macos_platform_layer -#endif diff --git a/custom/4coder_combined_write_commands.cpp b/custom/4coder_combined_write_commands.cpp index b86117af..a9a03747 100644 --- a/custom/4coder_combined_write_commands.cpp +++ b/custom/4coder_combined_write_commands.cpp @@ -94,7 +94,7 @@ CUSTOM_DOC("At the cursor, insert a '// NOTE' comment, includes user name if it CUSTOM_COMMAND_SIG(write_block) CUSTOM_DOC("At the cursor, insert a block comment.") { - write_string(app, string_u8_litexpr("/* */")); + place_begin_and_end_on_own_lines(app, "/* ", " */"); } CUSTOM_COMMAND_SIG(write_zero_struct) diff --git a/custom/4coder_config.cpp b/custom/4coder_config.cpp index 753b09d6..aef8a748 100644 --- a/custom/4coder_config.cpp +++ b/custom/4coder_config.cpp @@ -1143,7 +1143,7 @@ function i32 typed_array_get_count(Config *parsed, Config_Compound *compound, Config_RValue_Type type){ i32 count = 0; for (i32 i = 0;; ++i){ - Config_Iteration_Step_Result result = typed_array_iteration_step(parsed, compound, type, i); + Config_Iteration_Step_Result result = typed_array_iteration_step(parsed, compound, type, i); if (result.step == Iteration_Skip){ continue; } @@ -1242,6 +1242,8 @@ config_init_default(Config_Data *config){ config->automatically_save_changes_on_build = true; config->automatically_load_project = false; + config->virtual_whitespace_regular_indent = 4; + config->indent_with_tabs = false; config->indent_width = 4; @@ -1307,6 +1309,8 @@ config_parse__data(Application_Links *app, Arena *arena, String_Const_u8 file_na config_bool_var(parsed, "automatically_save_changes_on_build", 0, &config->automatically_save_changes_on_build); config_bool_var(parsed, "automatically_load_project", 0, &config->automatically_load_project); + config_int_var(parsed, "virtual_whitespace_regular_indent", 0, &config->virtual_whitespace_regular_indent); + config_bool_var(parsed, "indent_with_tabs", 0, &config->indent_with_tabs); config_int_var(parsed, "indent_width", 0, &config->indent_width); @@ -1550,6 +1554,7 @@ load_config_and_apply(Application_Links *app, Arena *out_arena, Config_Data *con config_feedback_bool(scratch, &list, "show_line_number_margins", config->show_line_number_margins); config_feedback_bool(scratch, &list, "enable_virtual_whitespace", config->enable_virtual_whitespace); + config_feedback_int(scratch, &list, "virtual_whitespace_regular_indent", config->virtual_whitespace_regular_indent); config_feedback_bool(scratch, &list, "enable_code_wrapping", config->enable_code_wrapping); config_feedback_bool(scratch, &list, "automatically_indent_text_on_save", config->automatically_indent_text_on_save); config_feedback_bool(scratch, &list, "automatically_save_changes_on_build", config->automatically_save_changes_on_build); @@ -1634,15 +1639,31 @@ CUSTOM_DOC("Parse the current buffer as a theme file and add the theme to the th String_Const_u8 error_text = config_stringize_errors(app, scratch, config); print_message(app, error_text); - String_Const_u8 name = string_front_of_path(file_name); - if (string_match(string_postfix(name, 7), string_u8_litexpr(".4coder"))){ - name = string_chop(name, 7); + u64 problem_score = 0; + if (color_table.count < defcolor_line_numbers_text){ + problem_score = defcolor_line_numbers_text - color_table.count; + } + for (u32 i = 0; i < color_table.count; i += 1){ + if (color_table.arrays[i].count == 0){ + problem_score += 1; + } } - save_theme(color_table, name); - Color_Table_Node *node = global_theme_list.last; - if (node != 0 && string_match(node->name, name)){ - active_color_table = node->table; + if (error_text.size > 0 || problem_score >= 10){ + String_Const_u8 string = push_u8_stringf(scratch, "There appears to be a problem parsing %.*s; no theme change applied\n", string_expand(file_name)); + print_message(app, string); + } + else{ + String_Const_u8 name = string_front_of_path(file_name); + if (string_match(string_postfix(name, 7), string_u8_litexpr(".4coder"))){ + name = string_chop(name, 7); + } + save_theme(color_table, name); + + Color_Table_Node *node = global_theme_list.last; + if (node != 0 && string_match(node->name, name)){ + active_color_table = node->table; + } } } } diff --git a/custom/4coder_config.h b/custom/4coder_config.h index a418b4dd..9ce7b76b 100644 --- a/custom/4coder_config.h +++ b/custom/4coder_config.h @@ -208,6 +208,8 @@ struct Config_Data{ b8 automatically_save_changes_on_build; b8 automatically_load_project; + i32 virtual_whitespace_regular_indent; + b8 indent_with_tabs; i32 indent_width; diff --git a/custom/4coder_default_bindings.cpp b/custom/4coder_default_bindings.cpp index a2c2866c..60f80683 100644 --- a/custom/4coder_default_bindings.cpp +++ b/custom/4coder_default_bindings.cpp @@ -18,13 +18,7 @@ custom_layer_init(Application_Links *app){ Thread_Context *tctx = get_thread_context(app); // NOTE(allen): setup for default framework - async_task_handler_init(app, &global_async_system); - code_index_init(); - buffer_modified_set_init(); - Profile_Global_List *list = get_core_profile_list(app); - ProfileThreadName(tctx, list, string_u8_litexpr("main")); - initialize_managed_id_metadata(app); - set_default_color_scheme(app); + default_framework_init(app); // NOTE(allen): default hooks and command maps set_all_default_hooks(app); diff --git a/custom/4coder_default_framework.cpp b/custom/4coder_default_framework.cpp index 07e019f4..dc5daa24 100644 --- a/custom/4coder_default_framework.cpp +++ b/custom/4coder_default_framework.cpp @@ -496,28 +496,21 @@ CUSTOM_DOC("Clear the theme list") function void default_4coder_initialize(Application_Links *app, String_Const_u8_Array file_names, i32 override_font_size, b32 override_hinting){ - Thread_Context *tctx = get_thread_context(app); - heap_init(&global_heap, tctx->allocator); - #define M \ -"Welcome to " VERSION "\n" \ -"If you're new to 4coder there is a built in tutorial\n" \ -"Use the key combination [ X Alt ] (on mac [ X Control ])\n" \ -"Type in 'hms_demo_tutorial' and press enter\n" \ -"\n" \ -"Direct bug reports and feature requests to https://github.com/4coder-editor/4coder/issues\n" \ -"\n" \ -"Other questions and discussion can be directed to editor@4coder.net or 4coder.handmade.network\n" \ -"\n" \ -"The change log can be found in CHANGES.txt\n" \ -"\n" - print_message(app, string_u8_litexpr(M)); + "Welcome to " VERSION "\n" \ + "If you're new to 4coder there is a built in tutorial\n" \ + "Use the key combination [ X Alt ] (on mac [ X Control ])\n" \ + "Type in 'hms_demo_tutorial' and press enter\n" \ + "\n" \ + "Direct bug reports and feature requests to https://github.com/4coder-editor/4coder/issues\n" \ + "\n" \ + "Other questions and discussion can be directed to editor@4coder.net or 4coder.handmade.network\n" \ + "\n" \ + "The change log can be found in CHANGES.txt\n" \ + "\n" + print_message(app, string_u8_litexpr(M)); #undef M -#if 0 - load_folder_of_themes_into_live_set(app, &global_part, "themes"); -#endif - global_config_arena = reserve_arena(app); load_config_and_apply(app, global_config_arena, &global_config, override_font_size, override_hinting); // open command line files @@ -534,8 +527,6 @@ default_4coder_initialize(Application_Links *app, String_Const_u8_Array file_nam create_buffer(app, input_name, 0); } } - - fade_range_arena = make_arena_system(KB(8)); } function void @@ -791,5 +782,128 @@ paint_fade_ranges(Application_Links *app, Text_Layout_ID layout, Buffer_ID buffe } } +//////////////////////////////// + +function void +clipboard_init_empty(Clipboard *clipboard, u32 history_depth){ + history_depth = clamp_bot(1, history_depth); + heap_init(&clipboard->heap, &clipboard->arena); + clipboard->clip_index = 0; + clipboard->clip_capacity = history_depth; + clipboard->clips = push_array_zero(&clipboard->arena, String_Const_u8, history_depth); +} + +function void +clipboard_init(Base_Allocator *allocator, u32 history_depth, Clipboard *clipboard_out){ + u64 memsize = sizeof(String_Const_u8)*history_depth; + memsize = round_up_u64(memsize, KB(4)); + clipboard_out->arena = make_arena(allocator, memsize, 8); + clipboard_init_empty(clipboard_out, history_depth); +} + +function void +clipboard_clear(Clipboard *clipboard){ + linalloc_clear(&clipboard->arena); + clipboard_init_empty(clipboard, clipboard->clip_capacity); +} + +function String_Const_u8 +clipboard_post_internal_only(Clipboard *clipboard, String_Const_u8 string){ + u32 rolled_index = clipboard->clip_index%clipboard->clip_capacity; + clipboard->clip_index += 1; + String_Const_u8 *slot = &clipboard->clips[rolled_index]; + if (slot->str != 0){ + if (slot->size < string.size || + (slot->size - string.size) > KB(1)){ + heap_free(&clipboard->heap, slot->str); + goto alloc_new; + } + } + else{ + alloc_new:; + u8 *new_buf = (u8*)heap_allocate(&clipboard->heap, string.size); + slot->str = new_buf; + } + block_copy(slot->str, string.str, string.size); + slot->size = string.size; + return(*slot); +} + +function u32 +clipboard_count(Clipboard *clipboard){ + u32 result = clipboard->clip_index; + result = clamp_top(result, clipboard->clip_capacity); + return(result); +} + +function String_Const_u8 +get_clipboard_index(Clipboard *clipboard, u32 item_index){ + String_Const_u8 result = {}; + u32 top = Min(clipboard->clip_index, clipboard->clip_capacity); + if (top > 0){ + item_index = item_index%top; + i32 array_index = ((clipboard->clip_index - 1) - item_index)%top; + result = clipboard->clips[array_index]; + } + return(result); +} + +function String_Const_u8 +push_clipboard_index(Arena *arena, Clipboard *clipboard, i32 item_index){ + String_Const_u8 result = get_clipboard_index(clipboard, item_index); + result = push_string_copy(arena, result); + return(result); +} + +//////////////////////////////// + +function void +clipboard_clear(i32 clipboard_id){ + clipboard_clear(&clipboard0); +} + +function String_Const_u8 +clipboard_post_internal_only(i32 clipboard_id, String_Const_u8 string){ + return(clipboard_post_internal_only(&clipboard0, string)); +} + +function b32 +clipboard_post(i32 clipboard_id, String_Const_u8 string){ + clipboard_post_internal_only(clipboard_id, string); + system_post_clipboard(string, clipboard_id); + return(true); +} + +function i32 +clipboard_count(i32 clipboard_id){ + return(clipboard_count(&clipboard0)); +} + +function String_Const_u8 +push_clipboard_index(Arena *arena, i32 clipboard_id, i32 item_index){ + return(push_clipboard_index(arena, &clipboard0, item_index)); +} + +//////////////////////////////// + +function void +initialize_managed_id_metadata(Application_Links *app); + +function void +default_framework_init(Application_Links *app){ + Thread_Context *tctx = get_thread_context(app); + async_task_handler_init(app, &global_async_system); + clipboard_init(get_base_allocator_system(), /*history_depth*/ 64, &clipboard0); + code_index_init(); + buffer_modified_set_init(); + Profile_Global_List *list = get_core_profile_list(app); + ProfileThreadName(tctx, list, string_u8_litexpr("main")); + initialize_managed_id_metadata(app); + set_default_color_scheme(app); + heap_init(&global_heap, tctx->allocator); + global_config_arena = reserve_arena(app); + fade_range_arena = make_arena_system(KB(8)); +} + // BOTTOM diff --git a/custom/4coder_default_framework_variables.cpp b/custom/4coder_default_framework_variables.cpp index eebdbfb6..3ba58805 100644 --- a/custom/4coder_default_framework_variables.cpp +++ b/custom/4coder_default_framework_variables.cpp @@ -98,5 +98,9 @@ global Fade_Range_List view_fade_ranges = {}; global Arena fade_range_arena = {}; global Fade_Range *free_fade_ranges = 0; +//////////////////////////////// + +global Clipboard clipboard0 = {}; + // BOTTOM diff --git a/custom/4coder_default_hooks.cpp b/custom/4coder_default_hooks.cpp index 2444afe1..16d8f335 100644 --- a/custom/4coder_default_hooks.cpp +++ b/custom/4coder_default_hooks.cpp @@ -150,26 +150,19 @@ CUSTOM_DOC("Input consumption loop for default view behavior") } function void -default_tick(Application_Links *app, Frame_Info frame_info){ +code_index_update_tick(Application_Links *app){ Scratch_Block scratch(app); - for (Buffer_Modified_Node *node = global_buffer_modified_set.first; node != 0; node = node->next){ Temp_Memory_Block temp(scratch); Buffer_ID buffer_id = node->buffer; - Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); - String_Const_u8 contents = push_whole_buffer(app, scratch, buffer_id); - Token_Array *tokens_ptr = scope_attachment(app, scope, attachment_tokens, Token_Array); - if (tokens_ptr == 0){ + Token_Array tokens = get_token_array_from_buffer(app, buffer_id); + if (tokens.count == 0){ continue; } - if (tokens_ptr->count == 0){ - continue; - } - Token_Array tokens = *tokens_ptr; Arena arena = make_arena_system(KB(16)); Code_Index_File *index = push_array_zero(&arena, Code_Index_File, 1); @@ -178,7 +171,8 @@ default_tick(Application_Links *app, Frame_Info frame_info){ Generic_Parse_State state = {}; generic_parse_init(app, &arena, contents, &tokens, &state); // TODO(allen): Actually determine this in a fair way. - // Maybe switch to an enum. + // Maybe switch to an enum? + // Actually probably a pointer to a struct that defines the language. state.do_cpp_parse = true; generic_parse_full_input_breaks(index, &state, max_i32); @@ -189,7 +183,11 @@ default_tick(Application_Links *app, Frame_Info frame_info){ } buffer_modified_set_clear(); - +} + +function void +default_tick(Application_Links *app, Frame_Info frame_info){ + code_index_update_tick(app); if (tick_all_fade_ranges(frame_info.animation_dt)){ animate_in_n_milliseconds(app, 0); } @@ -288,6 +286,13 @@ default_render_buffer(Application_Links *app, View_ID view_id, Face_ID face_id, b32 is_active_view = (active_view == view_id); Rect_f32 prev_clip = draw_set_clip(app, rect); + Range_i64 visible_range = text_layout_get_visible_range(app, text_layout_id); + + // NOTE(allen): Cursor shape + Face_Metrics metrics = get_face_metrics(app, face_id); + f32 cursor_roundness = (metrics.normal_advance*0.5f)*0.9f; + f32 mark_thickness = 2.f; + // NOTE(allen): Token colorizing Token_Array token_array = get_token_array_from_buffer(app, buffer); if (token_array.tokens != 0){ @@ -304,7 +309,6 @@ default_render_buffer(Application_Links *app, View_ID view_id, Face_ID face_id, } } else{ - Range_i64 visible_range = text_layout_get_visible_range(app, text_layout_id); paint_text_color_fcolor(app, text_layout_id, visible_range, fcolor_id(defcolor_text_default)); } @@ -349,10 +353,17 @@ default_render_buffer(Application_Links *app, View_ID view_id, Face_ID face_id, fcolor_id(defcolor_highlight_cursor_line)); } - // NOTE(allen): Cursor shape - Face_Metrics metrics = get_face_metrics(app, face_id); - f32 cursor_roundness = (metrics.normal_advance*0.5f)*0.9f; - f32 mark_thickness = 2.f; + // NOTE(allen): Whitespace highlight + b64 show_whitespace = false; + view_get_setting(app, view_id, ViewSetting_ShowWhitespace, &show_whitespace); + if (show_whitespace){ + if (token_array.tokens == 0){ + draw_whitespace_highlight(app, buffer, text_layout_id, cursor_roundness); + } + else{ + draw_whitespace_highlight(app, text_layout_id, &token_array, cursor_roundness); + } + } // NOTE(allen): Cursor switch (fcoder_mode){ @@ -375,6 +386,24 @@ default_render_buffer(Application_Links *app, View_ID view_id, Face_ID face_id, draw_set_clip(app, prev_clip); } +function Rect_f32 +default_draw_query_bars(Application_Links *app, Rect_f32 region, View_ID view_id, Face_ID face_id){ + Face_Metrics face_metrics = get_face_metrics(app, face_id); + f32 line_height = face_metrics.line_height; + + Query_Bar *space[32]; + Query_Bar_Ptr_Array query_bars = {}; + query_bars.ptrs = space; + if (get_active_query_bars(app, view_id, ArrayCount(space), &query_bars)){ + for (i32 i = 0; i < query_bars.count; i += 1){ + Rect_f32_Pair pair = layout_query_bar_on_top(region, line_height, 1); + draw_query_bar(app, query_bars.ptrs[i], face_id, pair.min); + region = pair.max; + } + } + return(region); +} + function void default_render_caller(Application_Links *app, Frame_Info frame_info, View_ID view_id){ ProfileScope(app, "default render caller"); @@ -411,18 +440,7 @@ default_render_caller(Application_Links *app, Frame_Info frame_info, View_ID vie } // NOTE(allen): query bars - { - Query_Bar *space[32]; - Query_Bar_Ptr_Array query_bars = {}; - query_bars.ptrs = space; - if (get_active_query_bars(app, view_id, ArrayCount(space), &query_bars)){ - for (i32 i = 0; i < query_bars.count; i += 1){ - Rect_f32_Pair pair = layout_query_bar_on_top(region, line_height, 1); - draw_query_bar(app, query_bars.ptrs[i], face_id, pair.min); - region = pair.max; - } - } - } + region = default_draw_query_bars(app, region, view_id, face_id); // NOTE(allen): FPS hud if (show_fps_hud){ @@ -600,13 +618,12 @@ parse_async__inner(Async_Context *actx, Buffer_ID buffer_id, } if (!canceled){ - Thread_Context *tctx = get_thread_context(app); - system_acquire_global_frame_mutex(tctx); + acquire_global_frame_mutex(app); code_index_lock(); code_index_set_file(buffer_id, arena, index); code_index_unlock(); buffer_clear_layout_cache(app, buffer_id); - system_release_global_frame_mutex(tctx); + release_global_frame_mutex(app); } else{ linalloc_clear(&arena); @@ -617,16 +634,15 @@ function void do_full_lex_async__inner(Async_Context *actx, Buffer_ID buffer_id){ Application_Links *app = actx->app; ProfileScope(app, "async lex"); - Thread_Context *tctx = get_thread_context(app); - Scratch_Block scratch(tctx); + Scratch_Block scratch(app); String_Const_u8 contents = {}; { ProfileBlock(app, "async lex contents (before mutex)"); - system_acquire_global_frame_mutex(tctx); + acquire_global_frame_mutex(app); ProfileBlock(app, "async lex contents (after mutex)"); contents = push_whole_buffer(app, scratch, buffer_id); - system_release_global_frame_mutex(tctx); + release_global_frame_mutex(app); } i32 limit_factor = 10000; @@ -649,13 +665,12 @@ do_full_lex_async__inner(Async_Context *actx, Buffer_ID buffer_id){ if (!canceled){ ProfileBlock(app, "async lex save results (before mutex)"); - system_acquire_global_frame_mutex(tctx); + acquire_global_frame_mutex(app); ProfileBlock(app, "async lex save results (after mutex)"); Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); if (scope != 0){ Base_Allocator *allocator = managed_scope_allocator(app, scope); - Token_Array *tokens_ptr = scope_attachment(app, scope, attachment_tokens, - Token_Array); + Token_Array *tokens_ptr = scope_attachment(app, scope, attachment_tokens, Token_Array); base_free(allocator, tokens_ptr->tokens); Token_Array tokens = {}; tokens.tokens = base_array(allocator, Token, list.total_count); @@ -665,7 +680,7 @@ do_full_lex_async__inner(Async_Context *actx, Buffer_ID buffer_id){ block_copy_struct(tokens_ptr, &tokens); } buffer_mark_as_modified(buffer_id); - system_release_global_frame_mutex(tctx); + release_global_frame_mutex(app); } } @@ -677,132 +692,6 @@ do_full_lex_async(Async_Context *actx, Data data){ } } -#if 0 -function void -do_full_lex_and_parse_async__inner(Async_Context *actx, Buffer_ID buffer_id){ - Application_Links *app = actx->app; - ProfileScope(app, "async lex"); - Thread_Context *tctx = get_thread_context(app); - Scratch_Block scratch(tctx); - - String_Const_u8 contents = {}; - { - ProfileBlock(app, "async lex contents (before mutex)"); - system_acquire_global_frame_mutex(tctx); - ProfileBlock(app, "async lex contents (after mutex)"); - - Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); - if (scope != 0){ - Base_Allocator *allocator = managed_scope_allocator(app, scope); - Token_Array *tokens_ptr = scope_attachment(app, scope, attachment_tokens, - Token_Array); - base_free(allocator, tokens_ptr->tokens); - block_zero_struct(tokens_ptr); - } - - contents = push_whole_buffer(app, scratch, buffer_id); - system_release_global_frame_mutex(tctx); - } - - i32 limit_factor = 10000; - - Token_List list = {}; - b32 canceled = false; - - { - Lex_State_Cpp state = {}; - lex_full_input_cpp_init(&state, contents); - for (;;){ - ProfileBlock(app, "async lex block"); - if (lex_full_input_cpp_breaks(scratch, &list, &state, limit_factor)){ - break; - } - if (async_check_canceled(actx)){ - canceled = true; - break; - } - } - } - - Token_Array tokens = {}; - if (!canceled){ - ProfileBlock(app, "async lex save results (before mutex)"); - system_acquire_global_frame_mutex(tctx); - ProfileBlock(app, "async lex save results (after mutex)"); - Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); - if (scope != 0){ - Base_Allocator *allocator = managed_scope_allocator(app, scope); - Token_Array *tokens_ptr = scope_attachment(app, scope, attachment_tokens, - Token_Array); - base_free(allocator, tokens_ptr->tokens); - tokens.tokens = base_array(allocator, Token, list.total_count); - tokens.count = list.total_count; - tokens.max = list.total_count; - token_fill_memory_from_list(tokens.tokens, &list); - block_copy_struct(tokens_ptr, &tokens); - } - system_release_global_frame_mutex(tctx); - } - - if (tokens.count > 0){ - parse_async__inner(actx, buffer_id, contents, &tokens, limit_factor); - } -} - -function void -do_full_lex_and_parse_async(Async_Context *actx, Data data){ - if (data.size == sizeof(Buffer_ID)){ - Buffer_ID buffer = *(Buffer_ID*)data.data; - do_full_lex_and_parse_async__inner(actx, buffer); - } -} -#endif - -#if 0 -function void -do_parse_async__inner(Async_Context *actx, Buffer_ID buffer_id){ - Application_Links *app = actx->app; - ProfileScope(app, "async lex"); - Thread_Context *tctx = get_thread_context(app); - Scratch_Block scratch(tctx); - - String_Const_u8 contents = {}; - Token_Array tokens = {}; - { - ProfileBlock(app, "async parse contents (before mutex)"); - system_acquire_global_frame_mutex(tctx); - ProfileBlock(app, "async parse contents (after mutex)"); - - Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); - if (scope != 0){ - Token_Array *tokens_ptr = scope_attachment(app, scope, attachment_tokens, - Token_Array); - tokens.count = tokens_ptr->count; - tokens.tokens = push_array_write(scratch, Token, tokens.count, tokens_ptr->tokens); - if (tokens.count > 0){ - contents = push_whole_buffer(app, scratch, buffer_id); - } - } - - system_release_global_frame_mutex(tctx); - } - - i32 limit_factor = 10000; - - if (tokens.count > 0){ - parse_async__inner(actx, buffer_id, contents, &tokens, limit_factor); - } -} - -function void -do_parse_async(Async_Context *actx, Data data){ - if (data.size == sizeof(Buffer_ID)){ - Buffer_ID buffer = *(Buffer_ID*)data.data; - do_parse_async__inner(actx, buffer); - } -} -#endif - BUFFER_HOOK_SIG(default_begin_buffer){ ProfileScope(app, "begin buffer"); @@ -816,7 +705,7 @@ BUFFER_HOOK_SIG(default_begin_buffer){ for (i32 i = 0; i < extensions.count; ++i){ if (string_match(ext, extensions.strings[i])){ - if (string_match(ext, string_u8_litexpr("cpp")) || + if (string_match(ext, string_u8_litexpr("cpp")) || string_match(ext, string_u8_litexpr("h")) || string_match(ext, string_u8_litexpr("c")) || string_match(ext, string_u8_litexpr("hpp")) || @@ -824,7 +713,7 @@ BUFFER_HOOK_SIG(default_begin_buffer){ treat_as_code = true; } -#if 0 +#if 0 treat_as_code = true; if (string_match(ext, string_u8_litexpr("cs"))){ @@ -848,7 +737,7 @@ BUFFER_HOOK_SIG(default_begin_buffer){ parse_context_id = parse_context_language_rust; } - if (string_match(ext, string_u8_litexpr("cpp")) || + if (string_match(ext, string_u8_litexpr("cpp")) || string_match(ext, string_u8_litexpr("h")) || string_match(ext, string_u8_litexpr("c")) || string_match(ext, string_u8_litexpr("hpp")) || @@ -892,11 +781,9 @@ BUFFER_HOOK_SIG(default_begin_buffer){ // NOTE(allen): Decide buffer settings b32 wrap_lines = true; - b32 use_virtual_whitespace = false; b32 use_lexer = false; if (treat_as_code){ wrap_lines = global_config.enable_code_wrapping; - use_virtual_whitespace = global_config.enable_virtual_whitespace; use_lexer = true; } @@ -916,16 +803,16 @@ BUFFER_HOOK_SIG(default_begin_buffer){ *wrap_lines_ptr = wrap_lines; } - if (use_virtual_whitespace){ - if (use_lexer){ - buffer_set_layout(app, buffer_id, layout_virt_indent_index_generic); - } - else{ - buffer_set_layout(app, buffer_id, layout_virt_indent_literal_generic); - } + if (use_lexer){ + buffer_set_layout(app, buffer_id, layout_virt_indent_index_generic); } else{ - buffer_set_layout(app, buffer_id, layout_generic); + if (treat_as_code){ + buffer_set_layout(app, buffer_id, layout_virt_indent_literal_generic); + } + else{ + buffer_set_layout(app, buffer_id, layout_generic); + } } // no meaning for return @@ -944,17 +831,20 @@ BUFFER_HOOK_SIG(default_new_file){ u8 c[2] = {}; u64 c_size = 1; u8 ch = file_name.str[i]; - if (ch == '.'){ - c[0] = '_'; - } - else if (ch >= 'A' && ch <= 'Z'){ + if ('A' <= ch && ch <= 'Z'){ c_size = 2; c[0] = '_'; c[1] = ch; } - else if (ch >= 'a' && ch <= 'z'){ + else if ('0' <= ch && ch <= '9'){ + c[0] = ch; + } + else if ('a' <= ch && ch <= 'z'){ c[0] = ch - ('a' - 'A'); } + else{ + c[0] = '_'; + } String_Const_u8 part = push_string_copy(scratch, SCu8(c, c_size)); string_list_push(scratch, &guard_list, part); } @@ -977,8 +867,10 @@ BUFFER_HOOK_SIG(default_new_file){ BUFFER_HOOK_SIG(default_file_save){ // buffer_id ProfileScope(app, "default file save"); + b32 is_virtual = global_config.enable_virtual_whitespace; - if (global_config.automatically_indent_text_on_save && is_virtual){ + if (global_config.automatically_indent_text_on_save && is_virtual){ + clean_all_lines_buffer(app, buffer_id); auto_indent_buffer(app, buffer_id, buffer_range(app, buffer_id)); } @@ -1027,7 +919,7 @@ BUFFER_EDIT_RANGE_SIG(default_buffer_edit_range){ b32 do_full_relex = false; if (async_task_is_running_or_pending(&global_async_system, *lex_task_ptr)){ - async_task_cancel(&global_async_system, *lex_task_ptr); + async_task_cancel(app, &global_async_system, *lex_task_ptr); buffer_unmark_as_modified(buffer_id); do_full_relex = true; *lex_task_ptr = 0; @@ -1113,7 +1005,7 @@ BUFFER_HOOK_SIG(default_end_buffer){ Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); Async_Task *lex_task_ptr = scope_attachment(app, scope, buffer_lex_task, Async_Task); if (lex_task_ptr != 0){ - async_task_cancel(&global_async_system, *lex_task_ptr); + async_task_cancel(app, &global_async_system, *lex_task_ptr); } buffer_unmark_as_modified(buffer_id); code_index_lock(); diff --git a/custom/4coder_default_include.cpp b/custom/4coder_default_include.cpp index 063567c6..0e13797d 100644 --- a/custom/4coder_default_include.cpp +++ b/custom/4coder_default_include.cpp @@ -7,6 +7,10 @@ #if !defined(FCODER_DEFAULT_INCLUDE_CPP) #define FCODER_DEFAULT_INCLUDE_CPP +#if !defined(FCODER_TRANSITION_TO) +#define FCODER_TRANSITION_TO 0 +#endif + #include "4coder_base_types.h" #include "4coder_version.h" #include "4coder_table.h" @@ -33,6 +37,7 @@ #include "4coder_insertion.h" #include "4coder_command_map.h" #include "4coder_lister_base.h" +#include "4coder_clipboard.h" #include "4coder_default_framework.h" #include "4coder_config.h" #include "4coder_auto_indent.h" @@ -74,12 +79,14 @@ #include "4coder_async_tasks.cpp" #include "4coder_string_match.cpp" #include "4coder_buffer_seek_constructors.cpp" - #include "4coder_token.cpp" -#include "generated/lexer_cpp.cpp" #include "4coder_command_map.cpp" + +#include "generated/lexer_cpp.cpp" + #include "4coder_default_map.cpp" #include "4coder_mac_map.cpp" + #include "4coder_default_framework_variables.cpp" #include "4coder_default_colors.cpp" #include "4coder_helper.cpp" @@ -91,6 +98,7 @@ #include "4coder_font_helper.cpp" #include "4coder_config.cpp" #include "4coder_default_framework.cpp" +#include "4coder_clipboard.cpp" #include "4coder_lister_base.cpp" #include "4coder_base_commands.cpp" #include "4coder_insertion.cpp" @@ -103,7 +111,6 @@ #include "4coder_jump_lister.cpp" #include "4coder_code_index_listers.cpp" #include "4coder_log_parser.cpp" -#include "4coder_clipboard.cpp" #include "4coder_keyboard_macro.cpp" #include "4coder_cli_command.cpp" #include "4coder_build_commands.cpp" diff --git a/custom/4coder_default_map.cpp b/custom/4coder_default_map.cpp index 1717a299..e39b732a 100644 --- a/custom/4coder_default_map.cpp +++ b/custom/4coder_default_map.cpp @@ -12,6 +12,7 @@ setup_default_mapping(Mapping *mapping, i64 global_id, i64 file_id, i64 code_id) SelectMap(global_id); BindCore(default_startup, CoreCode_Startup); BindCore(default_try_exit, CoreCode_TryExit); + BindCore(clipboard_record_clip, CoreCode_NewClipboardContents); Bind(keyboard_macro_start_recording , KeyCode_U, KeyCode_Control); Bind(keyboard_macro_finish_recording, KeyCode_U, KeyCode_Control, KeyCode_Shift); Bind(keyboard_macro_replay, KeyCode_U, KeyCode_Alt); @@ -35,7 +36,7 @@ setup_default_mapping(Mapping *mapping, i64 global_id, i64 file_id, i64 code_id) Bind(execute_previous_cli, KeyCode_Z, KeyCode_Alt, KeyCode_Shift); Bind(command_lister, KeyCode_X, KeyCode_Alt); Bind(project_command_lister, KeyCode_X, KeyCode_Alt, KeyCode_Shift); - Bind(list_all_functions_current_buffer, KeyCode_I, KeyCode_Control, KeyCode_Shift); + Bind(list_all_functions_current_buffer_lister, KeyCode_I, KeyCode_Control, KeyCode_Shift); Bind(project_fkey_command, KeyCode_F1); Bind(project_fkey_command, KeyCode_F2); Bind(project_fkey_command, KeyCode_F3); diff --git a/custom/4coder_draw.cpp b/custom/4coder_draw.cpp index 4121ae13..b6e2ad16 100644 --- a/custom/4coder_draw.cpp +++ b/custom/4coder_draw.cpp @@ -261,25 +261,45 @@ layout_fps_hud_on_bottom(Rect_f32 rect, f32 line_height){ } function Rect_f32 -draw_background_and_margin(Application_Links *app, View_ID view, ARGB_Color margin, ARGB_Color back){ +draw_background_and_margin(Application_Links *app, View_ID view, ARGB_Color margin, ARGB_Color back, f32 width){ Rect_f32 view_rect = view_get_screen_rect(app, view); - Rect_f32 inner = rect_inner(view_rect, 3.f); + Rect_f32 inner = rect_inner(view_rect, width); draw_rectangle(app, inner, 0.f, back); - draw_margin(app, view_rect, inner, margin); + if (width > 0.f){ + draw_margin(app, view_rect, inner, margin); + } return(inner); } +function Rect_f32 +draw_background_and_margin(Application_Links *app, View_ID view, ARGB_Color margin, ARGB_Color back){ + return(draw_background_and_margin(app, view, margin, back, 3.f)); +} + +function Rect_f32 +draw_background_and_margin(Application_Links *app, View_ID view, FColor margin, FColor back, f32 width){ + ARGB_Color margin_argb = fcolor_resolve(margin); + ARGB_Color back_argb = fcolor_resolve(back); + return(draw_background_and_margin(app, view, margin_argb, back_argb, width)); +} + function Rect_f32 draw_background_and_margin(Application_Links *app, View_ID view, FColor margin, FColor back){ ARGB_Color margin_argb = fcolor_resolve(margin); ARGB_Color back_argb = fcolor_resolve(back); - return(draw_background_and_margin(app, view, margin_argb, back_argb)); + return(draw_background_and_margin(app, view, margin_argb, back_argb, 3.f)); +} + +function Rect_f32 +draw_background_and_margin(Application_Links *app, View_ID view, b32 is_active_view, f32 width){ + FColor margin_color = get_panel_margin_color(is_active_view?UIHighlight_Active:UIHighlight_None); + return(draw_background_and_margin(app, view, margin_color, fcolor_id(defcolor_back), width)); } function Rect_f32 draw_background_and_margin(Application_Links *app, View_ID view, b32 is_active_view){ FColor margin_color = get_panel_margin_color(is_active_view?UIHighlight_Active:UIHighlight_None); - return(draw_background_and_margin(app, view, margin_color, fcolor_id(defcolor_back))); + return(draw_background_and_margin(app, view, margin_color, fcolor_id(defcolor_back), 3.f)); } function Rect_f32 @@ -456,7 +476,7 @@ get_token_color_cpp(Token token){ color = defcolor_preproc; }break; case TokenBaseKind_Keyword: - { + { color = defcolor_keyword; }break; case TokenBaseKind_Comment: @@ -520,6 +540,51 @@ draw_cpp_token_colors(Application_Links *app, Text_Layout_ID text_layout_id, Tok } } +function void +draw_whitespace_highlight(Application_Links *app, Text_Layout_ID text_layout_id, Token_Array *array, f32 roundness){ + Range_i64 visible_range = text_layout_get_visible_range(app, text_layout_id); + i64 first_index = token_index_from_pos(array, visible_range.first); + Token_Iterator_Array it = token_iterator_index(0, array, first_index); + for (;;){ + Token *token = token_it_read(&it); + if (token->pos >= visible_range.one_past_last){ + break; + } + if (token->kind == TokenBaseKind_Whitespace){ + Range_i64 range = Ii64(token); + draw_character_block(app, text_layout_id, range, roundness, + fcolor_id(defcolor_highlight_white)); + } + if (!token_it_inc_all(&it)){ + break; + } + } +} + +function void +draw_whitespace_highlight(Application_Links *app, Buffer_ID buffer, Text_Layout_ID text_layout_id, f32 roundness){ + Range_i64 visible_range = text_layout_get_visible_range(app, text_layout_id); + for (i64 i = visible_range.first; i < visible_range.one_past_last;){ + u8 c = buffer_get_char(app, buffer, i); + if (character_is_whitespace(c)){ + i64 s = i; + i += 1; + for (; i < visible_range.one_past_last; i += 1){ + c = buffer_get_char(app, buffer, i); + if (!character_is_whitespace(c)){ + break; + } + } + Range_i64 range = Ii64(s, i); + draw_character_block(app, text_layout_id, range, roundness, + fcolor_id(defcolor_highlight_white)); + } + else{ + i += 1; + } + } +} + function void draw_comment_highlights(Application_Links *app, Buffer_ID buffer, Text_Layout_ID text_layout_id, Token_Array *array, Comment_Highlight_Pair *pairs, i32 pair_count){ diff --git a/custom/4coder_function_list.cpp b/custom/4coder_function_list.cpp index 80ac51d8..a14a2358 100644 --- a/custom/4coder_function_list.cpp +++ b/custom/4coder_function_list.cpp @@ -274,7 +274,7 @@ CUSTOM_DOC("Creates a jump list of lines of the current buffer that appear to de } } -CUSTOM_COMMAND_SIG(list_all_functions_current_buffer_lister) +CUSTOM_UI_COMMAND_SIG(list_all_functions_current_buffer_lister) CUSTOM_DOC("Creates a lister of locations that look like function definitions and declarations in the buffer.") { Heap *heap = &global_heap; @@ -286,8 +286,7 @@ CUSTOM_DOC("Creates a lister of locations that look like function definitions an buffer = view_get_buffer(app, view, Access_Always); Marker_List *list = get_or_make_list_for_buffer(app, heap, buffer); if (list != 0){ - Jump_Lister_Result jump = get_jump_index_from_user(app, list, - "Function:"); + Jump_Lister_Result jump = get_jump_index_from_user(app, list, "Function:"); jump_to_jump_lister_result(app, view, list, &jump); } } @@ -299,7 +298,7 @@ CUSTOM_DOC("Creates a jump list of lines from all buffers that appear to define list_all_functions(app, 0); } -CUSTOM_COMMAND_SIG(list_all_functions_all_buffers_lister) +CUSTOM_UI_COMMAND_SIG(list_all_functions_all_buffers_lister) CUSTOM_DOC("Creates a lister of locations that look like function definitions and declarations all buffers.") { Heap *heap = &global_heap; diff --git a/custom/4coder_helper.cpp b/custom/4coder_helper.cpp index c4246f52..986397e2 100644 --- a/custom/4coder_helper.cpp +++ b/custom/4coder_helper.cpp @@ -5,7 +5,6 @@ // TOP #define scope_attachment(app,S,I,T) ((T*)managed_scope_get_attachment((app), (S), (I), sizeof(T))) - #define set_custom_hook(app,ID,F) set_custom_hook((app),(ID),(Void_Func*)(F)) //////////////////////////////// @@ -14,6 +13,10 @@ internal Token_Array get_token_array_from_buffer(Application_Links *app, Buffer_ID buffer){ Token_Array result = {}; Managed_Scope scope = buffer_get_managed_scope(app, buffer); + Async_Task *lex_task_ptr = scope_attachment(app, scope, buffer_lex_task, Async_Task); + if (lex_task_ptr != 0){ + async_task_wait(app, &global_async_system, *lex_task_ptr); + } Token_Array *ptr = scope_attachment(app, scope, attachment_tokens, Token_Array); if (ptr != 0){ result = *ptr; @@ -609,318 +612,318 @@ boundary_token(Application_Links *app, Buffer_ID buffer, Side side, Scan_Directi }break; case Scan_Backward: - { - result = 0; + { + result = 0; if (tokens.count > 0){ - Token_Iterator_Array it = token_iterator_pos(0, &tokens, pos); - Token *token = token_it_read(&it); - if (token->kind == TokenBaseKind_Whitespace){ - token_it_dec_non_whitespace(&it); - token = token_it_read(&it); - } + Token_Iterator_Array it = token_iterator_pos(0, &tokens, pos); + Token *token = token_it_read(&it); +if (token->kind == TokenBaseKind_Whitespace){ + token_it_dec_non_whitespace(&it); +token = token_it_read(&it); + } if (token != 0){ - if (side == Side_Min){ - if (token->pos >= pos){ - token_it_dec_non_whitespace(&it); - token = token_it_read(&it); - } + if (side == Side_Min){ + if (token->pos >= pos){ + token_it_dec_non_whitespace(&it); +token = token_it_read(&it); + } result = token->pos; - } + } else{ - if (token->pos + token->size >= pos){ - token_it_dec_non_whitespace(&it); - token = token_it_read(&it); - } + if (token->pos + token->size >= pos){ + token_it_dec_non_whitespace(&it); +token = token_it_read(&it); + } result = token->pos + token->size; + } } } - } - }break; - } - } - return(result); + }break; + } + } + return(result); } -internal i64 + internal i64 boundary_line(Application_Links *app, Buffer_ID buffer, Side side, Scan_Direction direction, i64 pos){ - i64 line_number = get_line_number_from_pos(app, buffer, pos); - i64 new_pos = get_line_side_pos(app, buffer, line_number, side); - if (direction == Scan_Backward && new_pos >= pos){ - if (line_number > 1){ - new_pos = get_line_side_pos(app, buffer, line_number - 1, side); - } + i64 line_number = get_line_number_from_pos(app, buffer, pos); + i64 new_pos = get_line_side_pos(app, buffer, line_number, side); + if (direction == Scan_Backward && new_pos >= pos){ + if (line_number > 1){ + new_pos = get_line_side_pos(app, buffer, line_number - 1, side); + } else{ - new_pos = 0; + new_pos = 0; + } + } + else if (direction == Scan_Forward && new_pos <= pos){ + new_pos = get_line_side_pos(app, buffer, line_number + 1, side); + if (new_pos <= pos){ + new_pos = (i32)buffer_get_size(app, buffer); + } } - } - else if (direction == Scan_Forward && new_pos <= pos){ - new_pos = get_line_side_pos(app, buffer, line_number + 1, side); - if (new_pos <= pos){ - new_pos = (i32)buffer_get_size(app, buffer); - } - } return(new_pos); } - -//////////////////////////////// + + //////////////////////////////// // TODO(allen): these need a little more rewrite internal void seek_string_forward(Application_Links *app, Buffer_ID buffer, i64 pos, i64 end, String_Const_u8 needle, i64 *result){ - if (end == 0){ - end = (i32)buffer_get_size(app, buffer); - } + if (end == 0){ + end = (i32)buffer_get_size(app, buffer); + } String_Match match = {}; - match.range.first = pos; - for (;;){ +match.range.first = pos; + for (;;){ match = buffer_seek_string(app, buffer, needle, Scan_Forward, (i32)match.range.first); - if (HasFlag(match.flags, StringMatch_CaseSensitive) || - match.buffer != buffer || match.range.first >= end) break; - } + if (HasFlag(match.flags, StringMatch_CaseSensitive) || + match.buffer != buffer || match.range.first >= end) break; + } if (match.range.first < end && match.buffer == buffer){ - *result = match.range.first; - } - else{ - *result = buffer_get_size(app, buffer); - } + *result = match.range.first; } - -internal void + else{ + *result = buffer_get_size(app, buffer); + } + } + + internal void seek_string_backward(Application_Links *app, Buffer_ID buffer, i64 pos, i64 min, String_Const_u8 needle, i64 *result){ - String_Match match = {}; + String_Match match = {}; match.range.first = pos; - for (;;){ - match = buffer_seek_string(app, buffer, needle, Scan_Backward, match.range.first); - if (HasFlag(match.flags, StringMatch_CaseSensitive) || - match.buffer != buffer || match.range.first < min) break; - } + for (;;){ + match = buffer_seek_string(app, buffer, needle, Scan_Backward, match.range.first); + if (HasFlag(match.flags, StringMatch_CaseSensitive) || + match.buffer != buffer || match.range.first < min) break; + } if (match.range.first >= min && match.buffer == buffer){ - *result = match.range.first; - } - else{ - *result = -1; - } + *result = match.range.first; } - -internal void + else{ + *result = -1; + } + } + + internal void seek_string_insensitive_forward(Application_Links *app, Buffer_ID buffer, i64 pos, i64 end, String_Const_u8 needle, i64 *result){ - if (end == 0){ - end = (i32)buffer_get_size(app, buffer); - } - String_Match match = buffer_seek_string(app, buffer, needle, Scan_Forward, pos); - if (match.range.first < end && match.buffer == buffer){ - *result = match.range.first; - } - else{ - *result = buffer_get_size(app, buffer); - } -} + if (end == 0){ + end = (i32)buffer_get_size(app, buffer); + } + String_Match match = buffer_seek_string(app, buffer, needle, Scan_Forward, pos); + if (match.range.first < end && match.buffer == buffer){ + *result = match.range.first; + } + else{ + *result = buffer_get_size(app, buffer); + } + } -internal void + internal void seek_string_insensitive_backward(Application_Links *app, Buffer_ID buffer, i64 pos, i64 min, String_Const_u8 needle, i64 *result){ - String_Match match = buffer_seek_string(app, buffer, needle, Scan_Backward, pos); - if (match.range.first >= min && match.buffer == buffer){ - *result = match.range.first; + String_Match match = buffer_seek_string(app, buffer, needle, Scan_Backward, pos); + if (match.range.first >= min && match.buffer == buffer){ + *result = match.range.first; + } + else{ + *result = -1; } - else{ - *result = -1; } -} - -internal void -seek_string(Application_Links *app, Buffer_ID buffer_id, i64 pos, i64 end, i64 min, String_Const_u8 str, i64 *result, Buffer_Seek_String_Flags flags){ - switch (flags & 3){ - case 0: - { - seek_string_forward(app, buffer_id, pos, end, str, result); - }break; + + internal void + seek_string(Application_Links *app, Buffer_ID buffer_id, i64 pos, i64 end, i64 min, String_Const_u8 str, i64 *result, Buffer_Seek_String_Flags flags){ + switch (flags & 3){ + case 0: + { + seek_string_forward(app, buffer_id, pos, end, str, result); + }break; case BufferSeekString_Backward: + { + seek_string_backward(app, buffer_id, pos, min, str, result); +}break; + + case BufferSeekString_CaseInsensitive: { - seek_string_backward(app, buffer_id, pos, min, str, result); - }break; - - case BufferSeekString_CaseInsensitive: + seek_string_insensitive_forward(app, buffer_id, pos, end, str, result); + }break; + + case BufferSeekString_Backward|BufferSeekString_CaseInsensitive: { - seek_string_insensitive_forward(app, buffer_id, pos, end, str, result); - }break; - - case BufferSeekString_Backward|BufferSeekString_CaseInsensitive: - { - seek_string_insensitive_backward(app, buffer_id, pos, min, str, result); - }break; - } -} - -//////////////////////////////// - + seek_string_insensitive_backward(app, buffer_id, pos, min, str, result); + }break; + } + } + + //////////////////////////////// + internal Range_i64 get_line_range_from_pos_range(Application_Links *app, Buffer_ID buffer, Range_i64 pos_range){ - Range_i64 line_range = {}; - line_range.first = get_line_number_from_pos(app, buffer, pos_range.first); - if (line_range.first != 0){ - line_range.end = get_line_number_from_pos(app, buffer, pos_range.one_past_last); - if (line_range.end == 0){ - line_range.first = 0; - } - } - return(line_range); -} - -// NOTE(allen): The end of the returned range does not include the terminating newline character of + Range_i64 line_range = {}; + line_range.first = get_line_number_from_pos(app, buffer, pos_range.first); + if (line_range.first != 0){ + line_range.end = get_line_number_from_pos(app, buffer, pos_range.one_past_last); +if (line_range.end == 0){ + line_range.first = 0; + } + } + return(line_range); + } + + // NOTE(allen): The end of the returned range does not include the terminating newline character of // the last line. internal Range_i64 get_pos_range_from_line_range(Application_Links *app, Buffer_ID buffer, Range_i64 line_range){ - Range_i64 pos_range = {}; - if (is_valid_line_range(app, buffer, line_range)){ - pos_range.first = get_line_start_pos(app, buffer, line_range.first); - pos_range.one_past_last = get_line_end_pos(app, buffer, line_range.end); - } + Range_i64 pos_range = {}; + if (is_valid_line_range(app, buffer, line_range)){ + pos_range.first = get_line_start_pos(app, buffer, line_range.first); +pos_range.one_past_last = get_line_end_pos(app, buffer, line_range.end); + } return(pos_range); -} - -internal Range_i64 -enclose_boundary(Application_Links *app, Buffer_ID buffer, Range_i64 range, - Boundary_Function *func){ - i64 new_min = func(app, buffer, Side_Min, Scan_Backward, range.min + 1); - i64 new_min_check = func(app, buffer, Side_Max, Scan_Backward, range.min + 1); - if (new_min_check <= new_min && new_min < range.min){ - range.min = new_min; } - i64 new_max = func(app, buffer, Side_Max, Scan_Forward, range.max - 1); - i64 new_max_check = func(app, buffer, Side_Min, Scan_Forward, range.max); - if (new_max_check >= new_max && new_max > range.max){ - range.max = new_max; - } - return(range); -} - -internal Range_i64 -left_enclose_boundary(Application_Links *app, Buffer_ID buffer, Range_i64 range, - Boundary_Function *func){ - i64 new_min = func(app, buffer, Side_Min, Scan_Backward, range.min + 1); - i64 new_min_check = func(app, buffer, Side_Max, Scan_Backward, range.min + 1); - if (new_min_check <= new_min && new_min < range.min){ - range.min = new_min; - } - return(range); -} - -internal Range_i64 -right_enclose_boundary(Application_Links *app, Buffer_ID buffer, Range_i64 range, - Boundary_Function *func){ - i64 new_max = func(app, buffer, Side_Max, Scan_Forward, range.max - 1); - i64 new_max_check = func(app, buffer, Side_Min, Scan_Forward, range.max - 1); - if (new_max_check >= new_max && new_max > range.max){ - range.max = new_max; - } - return(range); -} - -internal Range_i64 -enclose_non_whitespace(Application_Links *app, Buffer_ID buffer, Range_i64 range){ - return(enclose_boundary(app, buffer, range, boundary_non_whitespace)); -} -internal Range_i64 + + internal Range_i64 + enclose_boundary(Application_Links *app, Buffer_ID buffer, Range_i64 range, +Boundary_Function *func){ + i64 new_min = func(app, buffer, Side_Min, Scan_Backward, range.min + 1); + i64 new_min_check = func(app, buffer, Side_Max, Scan_Backward, range.min + 1); + if (new_min_check <= new_min && new_min < range.min){ + range.min = new_min; + } + i64 new_max = func(app, buffer, Side_Max, Scan_Forward, range.max - 1); + i64 new_max_check = func(app, buffer, Side_Min, Scan_Forward, range.max); + if (new_max_check >= new_max && new_max > range.max){ + range.max = new_max; + } + return(range); + } + + internal Range_i64 + left_enclose_boundary(Application_Links *app, Buffer_ID buffer, Range_i64 range, +Boundary_Function *func){ + i64 new_min = func(app, buffer, Side_Min, Scan_Backward, range.min + 1); + i64 new_min_check = func(app, buffer, Side_Max, Scan_Backward, range.min + 1); + if (new_min_check <= new_min && new_min < range.min){ + range.min = new_min; + } + return(range); + } + + internal Range_i64 + right_enclose_boundary(Application_Links *app, Buffer_ID buffer, Range_i64 range, +Boundary_Function *func){ + i64 new_max = func(app, buffer, Side_Max, Scan_Forward, range.max - 1); + i64 new_max_check = func(app, buffer, Side_Min, Scan_Forward, range.max - 1); +if (new_max_check >= new_max && new_max > range.max){ + range.max = new_max; + } + return(range); + } + + internal Range_i64 + enclose_non_whitespace(Application_Links *app, Buffer_ID buffer, Range_i64 range){ +return(enclose_boundary(app, buffer, range, boundary_non_whitespace)); + } + internal Range_i64 enclose_pos_non_whitespace(Application_Links *app, Buffer_ID buffer, i64 pos){ - return(enclose_boundary(app, buffer, Ii64(pos), boundary_non_whitespace)); + return(enclose_boundary(app, buffer, Ii64(pos), boundary_non_whitespace)); } internal Range_i64 -enclose_tokens(Application_Links *app, Buffer_ID buffer, Range_i64 range){ - return(enclose_boundary(app, buffer, range, boundary_token)); -} -internal Range_i64 -enclose_pos_tokens(Application_Links *app, Buffer_ID buffer, i64 pos){ - return(enclose_boundary(app, buffer, Ii64(pos), boundary_token)); + enclose_tokens(Application_Links *app, Buffer_ID buffer, Range_i64 range){ + return(enclose_boundary(app, buffer, range, boundary_token)); + } + internal Range_i64 + enclose_pos_tokens(Application_Links *app, Buffer_ID buffer, i64 pos){ +return(enclose_boundary(app, buffer, Ii64(pos), boundary_token)); + } + + internal Range_i64 + enclose_base10(Application_Links *app, Buffer_ID buffer, Range_i64 range){ + return(enclose_boundary(app, buffer, range, boundary_base10)); + } + internal Range_i64 + enclose_pos_base10(Application_Links *app, Buffer_ID buffer, i64 pos){ +return(enclose_boundary(app, buffer, Ii64(pos), boundary_base10)); + } + + internal Range_i64 + enclose_base16(Application_Links *app, Buffer_ID buffer, Range_i64 range){ + return(enclose_boundary(app, buffer, range, boundary_base16)); + } + internal Range_i64 + enclose_pos_base16(Application_Links *app, Buffer_ID buffer, i64 pos){ +return(enclose_boundary(app, buffer, Ii64(pos), boundary_base16)); + } + + internal Range_i64 + enclose_base10_colon(Application_Links *app, Buffer_ID buffer, Range_i64 range){ + return(enclose_boundary(app, buffer, range, boundary_base10_colon)); + } + internal Range_i64 + enclose_pos_base10_colon(Application_Links *app, Buffer_ID buffer, i64 pos){ + return(enclose_boundary(app, buffer, Ii64(pos), boundary_base10_colon)); } internal Range_i64 -enclose_base10(Application_Links *app, Buffer_ID buffer, Range_i64 range){ - return(enclose_boundary(app, buffer, range, boundary_base10)); -} -internal Range_i64 -enclose_pos_base10(Application_Links *app, Buffer_ID buffer, i64 pos){ - return(enclose_boundary(app, buffer, Ii64(pos), boundary_base10)); + enclose_alpha_numeric(Application_Links *app, Buffer_ID buffer, Range_i64 range){ + return(enclose_boundary(app, buffer, range, boundary_alpha_numeric)); + } + internal Range_i64 + enclose_pos_alpha_numeric(Application_Links *app, Buffer_ID buffer, i64 pos){ + return(enclose_boundary(app, buffer, Ii64(pos), boundary_alpha_numeric)); } internal Range_i64 -enclose_base16(Application_Links *app, Buffer_ID buffer, Range_i64 range){ - return(enclose_boundary(app, buffer, range, boundary_base16)); + enclose_alpha_numeric_unicode(Application_Links *app, Buffer_ID buffer, Range_i64 range){ + return(enclose_boundary(app, buffer, range, boundary_alpha_numeric_unicode)); } -internal Range_i64 -enclose_pos_base16(Application_Links *app, Buffer_ID buffer, i64 pos){ - return(enclose_boundary(app, buffer, Ii64(pos), boundary_base16)); -} - -internal Range_i64 -enclose_base10_colon(Application_Links *app, Buffer_ID buffer, Range_i64 range){ - return(enclose_boundary(app, buffer, range, boundary_base10_colon)); -} -internal Range_i64 -enclose_pos_base10_colon(Application_Links *app, Buffer_ID buffer, i64 pos){ - return(enclose_boundary(app, buffer, Ii64(pos), boundary_base10_colon)); -} - -internal Range_i64 -enclose_alpha_numeric(Application_Links *app, Buffer_ID buffer, Range_i64 range){ - return(enclose_boundary(app, buffer, range, boundary_alpha_numeric)); -} -internal Range_i64 -enclose_pos_alpha_numeric(Application_Links *app, Buffer_ID buffer, i64 pos){ - return(enclose_boundary(app, buffer, Ii64(pos), boundary_alpha_numeric)); -} - -internal Range_i64 -enclose_alpha_numeric_unicode(Application_Links *app, Buffer_ID buffer, Range_i64 range){ - return(enclose_boundary(app, buffer, range, boundary_alpha_numeric_unicode)); -} -internal Range_i64 -enclose_pos_alpha_numeric_unicode(Application_Links *app, Buffer_ID buffer, i64 pos){ - return(enclose_boundary(app, buffer, Ii64(pos), boundary_alpha_numeric_unicode)); -} - -internal Range_i64 -enclose_alpha_numeric_underscore(Application_Links *app, Buffer_ID buffer, Range_i64 range){ - return(enclose_boundary(app, buffer, range, boundary_alpha_numeric_underscore)); -} -internal Range_i64 -enclose_pos_alpha_numeric_underscore(Application_Links *app, Buffer_ID buffer, i64 pos){ - return(enclose_boundary(app, buffer, Ii64(pos), boundary_alpha_numeric_underscore)); -} -internal Range_i64 -right_enclose_alpha_numeric_underscore(Application_Links *app, Buffer_ID buffer, - Range_i64 range){ - return(right_enclose_boundary(app, buffer, range, boundary_alpha_numeric_underscore)); -} - + internal Range_i64 + enclose_pos_alpha_numeric_unicode(Application_Links *app, Buffer_ID buffer, i64 pos){ + return(enclose_boundary(app, buffer, Ii64(pos), boundary_alpha_numeric_unicode)); + } + + internal Range_i64 + enclose_alpha_numeric_underscore(Application_Links *app, Buffer_ID buffer, Range_i64 range){ + return(enclose_boundary(app, buffer, range, boundary_alpha_numeric_underscore)); + } + internal Range_i64 + enclose_pos_alpha_numeric_underscore(Application_Links *app, Buffer_ID buffer, i64 pos){ + return(enclose_boundary(app, buffer, Ii64(pos), boundary_alpha_numeric_underscore)); + } + internal Range_i64 + right_enclose_alpha_numeric_underscore(Application_Links *app, Buffer_ID buffer, + Range_i64 range){ + return(right_enclose_boundary(app, buffer, range, boundary_alpha_numeric_underscore)); + } + internal Range_i64 enclose_alpha_numeric_underscore_utf8(Application_Links *app, Buffer_ID buffer, Range_i64 range){ - return(enclose_boundary(app, buffer, range, boundary_alpha_numeric_underscore_utf8)); +return(enclose_boundary(app, buffer, range, boundary_alpha_numeric_underscore_utf8)); } internal Range_i64 -enclose_pos_alpha_numeric_underscore_utf8(Application_Links *app, Buffer_ID buffer, i64 pos){ - return(enclose_boundary(app, buffer, Ii64(pos), boundary_alpha_numeric_underscore_utf8)); -} -internal Range_i64 -right_enclose_alpha_numeric_underscore_utf8(Application_Links *app, Buffer_ID buffer, - Range_i64 range){ - return(right_enclose_boundary(app, buffer, range, boundary_alpha_numeric_underscore_utf8)); -} + enclose_pos_alpha_numeric_underscore_utf8(Application_Links *app, Buffer_ID buffer, i64 pos){ +return(enclose_boundary(app, buffer, Ii64(pos), boundary_alpha_numeric_underscore_utf8)); + } + internal Range_i64 + right_enclose_alpha_numeric_underscore_utf8(Application_Links *app, Buffer_ID buffer, + Range_i64 range){ +return(right_enclose_boundary(app, buffer, range, boundary_alpha_numeric_underscore_utf8)); + } -internal Range_i64 + internal Range_i64 enclose_alpha_numeric_camel(Application_Links *app, Buffer_ID buffer, Range_i64 range){ - return(enclose_boundary(app, buffer, range, boundary_alpha_numeric_camel)); +return(enclose_boundary(app, buffer, range, boundary_alpha_numeric_camel)); } internal Range_i64 enclose_pos_alpha_numeric_camel(Application_Links *app, Buffer_ID buffer, i64 pos){ - return(enclose_boundary(app, buffer, Ii64(pos), boundary_alpha_numeric_camel)); +return(enclose_boundary(app, buffer, Ii64(pos), boundary_alpha_numeric_camel)); } internal Range_i64 enclose_pos_inside_quotes(Application_Links *app, Buffer_ID buffer, i64 pos){ - return(enclose_boundary(app, buffer, Ii64(pos), boundary_inside_quotes)); + return(enclose_boundary(app, buffer, Ii64(pos), boundary_inside_quotes)); } internal Range_i64 @@ -929,1530 +932,1544 @@ enclose_whole_lines(Application_Links *app, Buffer_ID buffer, Range_i64 range){ } internal Range_i64 enclose_pos_whole_lines(Application_Links *app, Buffer_ID buffer, i64 pos){ - return(enclose_boundary(app, buffer, Ii64(pos), boundary_line)); -} - -//////////////////////////////// - -internal Range_i64 -get_snipe_range(Application_Links *app, Boundary_Function_List funcs, Buffer_ID buffer, i64 pos, Scan_Direction direction){ - Range_i64 result = {}; - i64 buffer_size = buffer_get_size(app, buffer); + return(enclose_boundary(app, buffer, Ii64(pos), boundary_line)); + } + + //////////////////////////////// + + internal Range_i64 + get_snipe_range(Application_Links *app, Boundary_Function_List funcs, Buffer_ID buffer, i64 pos, Scan_Direction direction){ + Range_i64 result = {}; + i64 buffer_size = buffer_get_size(app, buffer); i64 pos0 = pos; i64 pos1 = scan(app, funcs, buffer, direction, pos0); - if (0 <= pos1 && pos1 <= buffer_size){ - i64 pos2 = scan(app, funcs, buffer, flip_direction(direction), pos1); - if (0 <= pos2 && pos2 <= buffer_size){ - if (direction == Scan_Backward){ - pos2 = clamp_bot(pos2, pos0); - } - else{ - pos2 = clamp_top(pos2, pos0); - } - result = Ii64(pos1, pos2); - } +if (0 <= pos1 && pos1 <= buffer_size){ +i64 pos2 = scan(app, funcs, buffer, flip_direction(direction), pos1); + if (0 <= pos2 && pos2 <= buffer_size){ +if (direction == Scan_Backward){ + pos2 = clamp_bot(pos2, pos0); + } +else{ + pos2 = clamp_top(pos2, pos0); } - return(result); -} - -internal Range_i64 -get_snipe_range(Application_Links *app, Boundary_Function *func, Buffer_ID buffer, i64 pos, Scan_Direction direction){ - Scratch_Block scratch(app); - return(get_snipe_range(app, push_boundary_list(scratch, func), buffer, pos, direction)); -} - -//////////////////////////////// + result = Ii64(pos1, pos2); + } + } + return(result); + } + + internal Range_i64 + get_snipe_range(Application_Links *app, Boundary_Function *func, Buffer_ID buffer, i64 pos, Scan_Direction direction){ + Scratch_Block scratch(app); + return(get_snipe_range(app, push_boundary_list(scratch, func), buffer, pos, direction)); + } + + //////////////////////////////// internal String_Const_u8 push_buffer_range(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_i64 range){ - String_Const_u8 result = {}; - i64 length = range_size(range); + String_Const_u8 result = {}; + i64 length = range_size(range); if (length > 0){ - Temp_Memory restore_point = begin_temp(arena); - u8 *memory = push_array(arena, u8, length); - if (buffer_read_range(app, buffer, range, memory)){ - result = SCu8(memory, length); - } - else{ - end_temp(restore_point); - } - } - return(result); + Temp_Memory restore_point = begin_temp(arena); + u8 *memory = push_array(arena, u8, length); + if (buffer_read_range(app, buffer, range, memory)){ + result = SCu8(memory, length); + } + else{ + end_temp(restore_point); +} +} +return(result); } internal String_Const_u8 -push_token_lexeme(Application_Links *app, Arena *arena, Buffer_ID buffer, Token *token){ - return(push_buffer_range(app, arena, buffer, Ii64(token))); + push_token_lexeme(Application_Links *app, Arena *arena, Buffer_ID buffer, Token *token){ + return(push_buffer_range(app, arena, buffer, Ii64(token))); + } + + internal String_Const_u8 + push_buffer_line(Application_Links *app, Arena *arena, Buffer_ID buffer, i64 line_number){ + return(push_buffer_range(app, arena, buffer, get_line_pos_range(app, buffer, line_number))); } internal String_Const_u8 -push_buffer_line(Application_Links *app, Arena *arena, Buffer_ID buffer, i64 line_number){ - return(push_buffer_range(app, arena, buffer, get_line_pos_range(app, buffer, line_number))); -} - -internal String_Const_u8 -push_whole_buffer(Application_Links *app, Arena *arena, Buffer_ID buffer){ + push_whole_buffer(Application_Links *app, Arena *arena, Buffer_ID buffer){ return(push_buffer_range(app, arena, buffer, buffer_range(app, buffer))); -} - -internal String_Const_u8 -push_view_range_string(Application_Links *app, Arena *arena, View_ID view){ - Buffer_ID buffer = view_get_buffer(app, view, Access_ReadVisible); + } + + internal String_Const_u8 + push_view_range_string(Application_Links *app, Arena *arena, View_ID view){ + Buffer_ID buffer = view_get_buffer(app, view, Access_ReadVisible); return(push_buffer_range(app, arena, buffer, get_view_range(app, view))); -} + } -internal String_Const_u8 -push_view_range_string(Application_Links *app, Arena *arena){ - View_ID view = get_active_view(app, Access_Always); - return(push_view_range_string(app, arena, view)); + internal String_Const_u8 + push_view_range_string(Application_Links *app, Arena *arena){ + View_ID view = get_active_view(app, Access_Always); +return(push_view_range_string(app, arena, view)); } internal String_Const_u8 push_enclose_range_at_pos(Application_Links *app, Arena *arena, Buffer_ID buffer, i64 pos, Enclose_Function *enclose){ - Range_i64 range = enclose(app, buffer, Ii64(pos)); + Range_i64 range = enclose(app, buffer, Ii64(pos)); return(push_buffer_range(app, arena, buffer, range)); -} + } //////////////////////////////// - -internal String_Const_u8 -token_it_lexeme(Application_Links *app, Arena *arena, Token_Iterator_Array *it){ - String_Const_u8 result = {}; - Token *token = token_it_read(it); - if (token != 0){ + + internal String_Const_u8 + token_it_lexeme(Application_Links *app, Arena *arena, Token_Iterator_Array *it){ + String_Const_u8 result = {}; + Token *token = token_it_read(it); +if (token != 0){ result = push_token_lexeme(app, arena, (Buffer_ID)it->user_id, token); - } - return(result); + } +return(result); } internal b32 token_it_check_and_get_lexeme(Application_Links *app, Arena *arena, Token_Iterator_Array *it, Token_Base_Kind kind, String_Const_u8 *lexeme_out){ - Token *token = token_it_read(it); + Token *token = token_it_read(it); b32 result = {}; if (token != 0 && token->kind == kind){ - result = true; - *lexeme_out = push_token_lexeme(app, arena, (Buffer_ID)it->user_id, token); + result = true; + *lexeme_out = push_token_lexeme(app, arena, (Buffer_ID)it->user_id, token); } - return(result); -} +return(result); + } -internal String_Const_u8 -token_it_lexeme(Application_Links *app, Arena *arena, Token_Iterator_List *it){ + internal String_Const_u8 + token_it_lexeme(Application_Links *app, Arena *arena, Token_Iterator_List *it){ String_Const_u8 result = {}; Token *token = token_it_read(it); - if (token != 0){ - result = push_token_lexeme(app, arena, (Buffer_ID)it->user_id, token); - } - return(result); +if (token != 0){ +result = push_token_lexeme(app, arena, (Buffer_ID)it->user_id, token); } - -internal b32 -token_it_check_and_get_lexeme(Application_Links *app, Arena *arena, Token_Iterator_List *it, Token_Base_Kind kind, String_Const_u8 *lexeme_out){ +return(result); + } + + internal b32 + token_it_check_and_get_lexeme(Application_Links *app, Arena *arena, Token_Iterator_List *it, Token_Base_Kind kind, String_Const_u8 *lexeme_out){ Token *token = token_it_read(it); b32 result = {}; if (token != 0 && token->kind == kind){ - result = true; - *lexeme_out = push_token_lexeme(app, arena, (Buffer_ID)it->user_id, token); - } - return(result); -} - -//////////////////////////////// - -internal b32 + result = true; + *lexeme_out = push_token_lexeme(app, arena, (Buffer_ID)it->user_id, token); + } + return(result); + } + + //////////////////////////////// + + internal b32 buffer_has_name_with_star(Application_Links *app, Buffer_ID buffer){ - Scratch_Block scratch(app); - String_Const_u8 str = push_buffer_unique_name(app, scratch, buffer); - return(str.size > 0 && str.str[0] == '*'); -} - -internal u8 -buffer_get_char(Application_Links *app, Buffer_ID buffer_id, i64 pos){ - i64 buffer_size = buffer_get_size(app, buffer_id); - u8 result = ' '; - if (0 <= pos && pos < buffer_size){ - buffer_read_range(app, buffer_id, Ii64(pos, pos + 1), &result); + Scratch_Block scratch(app); +String_Const_u8 str = push_buffer_unique_name(app, scratch, buffer); + return(str.size > 0 && str.str[0] == '*'); } - return(result); + + internal u8 + buffer_get_char(Application_Links *app, Buffer_ID buffer_id, i64 pos){ + i64 buffer_size = buffer_get_size(app, buffer_id); + u8 result = ' '; + if (0 <= pos && pos < buffer_size){ + buffer_read_range(app, buffer_id, Ii64(pos, pos + 1), &result); + } + return(result); } internal b32 -line_is_valid_and_blank(Application_Links *app, Buffer_ID buffer, i64 line_number){ - b32 result = false; - if (is_valid_line(app, buffer, line_number)){ - Scratch_Block scratch(app); - String_Const_u8 line = push_buffer_line(app, scratch, buffer, line_number); - result = true; - for (u64 i = 0; i < line.size; i += 1){ - if (!character_is_whitespace(line.str[i])){ - result = false; - break; - } - } - } - return(result); + line_is_valid_and_blank(Application_Links *app, Buffer_ID buffer, i64 line_number){ +b32 result = false; +if (is_valid_line(app, buffer, line_number)){ +Scratch_Block scratch(app); + String_Const_u8 line = push_buffer_line(app, scratch, buffer, line_number); + result = true; + for (u64 i = 0; i < line.size; i += 1){ + if (!character_is_whitespace(line.str[i])){ + result = false; + break; } + } + } + return(result); + } -//////////////////////////////// - -internal i64 -get_pos_past_lead_whitespace_from_line_number(Application_Links *app, Buffer_ID buffer, i64 line_number){ + //////////////////////////////// + + internal i64 + get_pos_past_lead_whitespace_from_line_number(Application_Links *app, Buffer_ID buffer, i64 line_number){ Scratch_Block scratch(app); Range_i64 line_range = get_line_pos_range(app, buffer, line_number); - String_Const_u8 line = push_buffer_range(app, scratch, buffer, line_range); - i64 result = line_range.end; - for (u64 i = 0; i < line.size; i += 1){ - if (!character_is_whitespace(line.str[i])){ - result = line_range.start + i; - break; +String_Const_u8 line = push_buffer_range(app, scratch, buffer, line_range); + i64 result = line_range.end; + for (u64 i = 0; i < line.size; i += 1){ + if (!character_is_whitespace(line.str[i])){ + result = line_range.start + i; +break; } - } - return(result); -} + } + return(result); + } + + internal i64 + get_pos_past_lead_whitespace(Application_Links *app, Buffer_ID buffer, i64 pos){ + i64 line_number = get_line_number_from_pos(app, buffer, pos); +i64 result = get_pos_past_lead_whitespace_from_line_number(app, buffer, line_number); +result = clamp_bot(pos, result); + return(result); + } -internal i64 -get_pos_past_lead_whitespace(Application_Links *app, Buffer_ID buffer, i64 pos){ - i64 line_number = get_line_number_from_pos(app, buffer, pos); - i64 result = get_pos_past_lead_whitespace_from_line_number(app, buffer, line_number); - result = clamp_bot(pos, result); - return(result); -} + internal void + move_past_lead_whitespace(Application_Links *app, View_ID view, Buffer_ID buffer){ + i64 pos = view_get_cursor_pos(app, view); + i64 new_pos = get_pos_past_lead_whitespace(app, buffer, pos); +view_set_cursor_and_preferred_x(app, view, seek_pos(new_pos)); + } -internal void -move_past_lead_whitespace(Application_Links *app, View_ID view, Buffer_ID buffer){ - i64 pos = view_get_cursor_pos(app, view); - i64 new_pos = get_pos_past_lead_whitespace(app, buffer, pos); - view_set_cursor_and_preferred_x(app, view, seek_pos(new_pos)); -} - -internal void -move_past_lead_whitespace(Application_Links *app, View_ID view){ - Buffer_ID buffer = view_get_buffer(app, view, Access_ReadVisible); + internal void + move_past_lead_whitespace(Application_Links *app, View_ID view){ +Buffer_ID buffer = view_get_buffer(app, view, Access_ReadVisible); move_past_lead_whitespace(app, view, buffer); -} + } internal b32 line_is_blank(Application_Links *app, Buffer_ID buffer, i64 line_number){ - Scratch_Block scratch(app); - String_Const_u8 line = push_buffer_line(app, scratch, buffer, line_number); - b32 is_blank = true; - for (u64 i = 0; i < line.size; i += 1){ - if (!character_is_whitespace(line.str[i])){ - is_blank = false; - break; - } + Scratch_Block scratch(app); + String_Const_u8 line = push_buffer_line(app, scratch, buffer, line_number); + b32 is_blank = true; +for (u64 i = 0; i < line.size; i += 1){ + if (!character_is_whitespace(line.str[i])){ + is_blank = false; + break; + } + } + return(is_blank); } - return(is_blank); -} - -internal i64 + + internal i64 get_line_number_of__whitespace_status_line(Application_Links *app, Buffer_ID buffer, Scan_Direction direction, i64 line_number_start, b32 get_blank_line){ - i64 line_count = buffer_get_line_count(app, buffer); - i64 line_number = line_number_start + direction; - for (;1 <= line_number && line_number <= line_count; line_number += direction){ - b32 is_blank = line_is_blank(app, buffer, line_number); - if (is_blank == get_blank_line){ - break; - } +i64 line_count = buffer_get_line_count(app, buffer); + i64 line_number = line_number_start + direction; + for (;1 <= line_number && line_number <= line_count; line_number += direction){ +b32 is_blank = line_is_blank(app, buffer, line_number); +if (is_blank == get_blank_line){ + break; + } } line_number = clamp(1, line_number, line_count); - return(line_number); + return(line_number); + } + + internal i64 + get_line_number_of_non_blank_line(Application_Links *app, Buffer_ID buffer, Scan_Direction direction, i64 line_number_start){ + return(get_line_number_of__whitespace_status_line(app, buffer, direction, line_number_start, false)); } internal i64 -get_line_number_of_non_blank_line(Application_Links *app, Buffer_ID buffer, Scan_Direction direction, i64 line_number_start){ - return(get_line_number_of__whitespace_status_line(app, buffer, direction, line_number_start, false)); -} - -internal i64 -get_line_number_of_blank_line(Application_Links *app, Buffer_ID buffer, Scan_Direction direction, i64 line_number_start){ - return(get_line_number_of__whitespace_status_line(app, buffer, direction, line_number_start, true)); -} - -internal i64 -get_pos_of_blank_line(Application_Links *app, Buffer_ID buffer, Scan_Direction direction, i64 pos_start){ - i64 line_number_start = get_line_number_from_pos(app, buffer, pos_start); - i64 blank_line = get_line_number_of_blank_line(app, buffer, direction, line_number_start); - i64 pos = get_line_start_pos(app, buffer, blank_line); + get_line_number_of_blank_line(Application_Links *app, Buffer_ID buffer, Scan_Direction direction, i64 line_number_start){ + return(get_line_number_of__whitespace_status_line(app, buffer, direction, line_number_start, true)); + } + + internal i64 + get_pos_of_blank_line(Application_Links *app, Buffer_ID buffer, Scan_Direction direction, i64 pos_start){ + i64 line_number_start = get_line_number_from_pos(app, buffer, pos_start); + i64 blank_line = get_line_number_of_blank_line(app, buffer, direction, line_number_start); + i64 pos = get_line_start_pos(app, buffer, blank_line); return(pos); } -internal i64 -get_line_number_of_blank_line_grouped(Application_Links *app, Buffer_ID buffer, Scan_Direction direction, i64 line_number_start){ - i64 line_number = line_number_start; + internal i64 + get_line_number_of_blank_line_grouped(Application_Links *app, Buffer_ID buffer, Scan_Direction direction, i64 line_number_start){ + i64 line_number = line_number_start; if (line_is_blank(app, buffer, line_number)){ - line_number = get_line_number_of_non_blank_line(app, buffer, direction, line_number); - } + line_number = get_line_number_of_non_blank_line(app, buffer, direction, line_number); + } line_number = get_line_number_of_blank_line(app, buffer, direction, line_number); return(line_number); -} - -internal i64 -get_pos_of_blank_line_grouped(Application_Links *app, Buffer_ID buffer, Scan_Direction direction, i64 pos_start){ - i64 line_number_start = get_line_number_from_pos(app, buffer, pos_start); - i64 blank_line = get_line_number_of_blank_line_grouped(app, buffer, direction, line_number_start); - i64 pos = get_line_start_pos(app, buffer, blank_line); - return(pos); -} - -internal Indent_Info -get_indent_info_range(Application_Links *app, Buffer_ID buffer, Range_i64 range, i32 tab_width){ - Scratch_Block scratch(app); - String_Const_u8 s = push_buffer_range(app, scratch, buffer, range); + } - i32 tab_additional_width = tab_width - 1; + internal i64 + get_pos_of_blank_line_grouped(Application_Links *app, Buffer_ID buffer, Scan_Direction direction, i64 pos_start){ +i64 line_number_start = get_line_number_from_pos(app, buffer, pos_start); + i64 blank_line = get_line_number_of_blank_line_grouped(app, buffer, direction, line_number_start); + i64 pos = get_line_start_pos(app, buffer, blank_line); + return(pos); + } - Indent_Info info = {}; - info.first_char_pos = range.end; + internal Indent_Info + get_indent_info_range(Application_Links *app, Buffer_ID buffer, Range_i64 range, i32 tab_width){ + Scratch_Block scratch(app); + String_Const_u8 s = push_buffer_range(app, scratch, buffer, range); + + Indent_Info info = {}; +info.first_char_pos = range.end; info.is_blank = true; info.all_space = true; - for (u64 i = 0; i < s.size; i += 1){ - u8 c = s.str[i]; - if (!character_is_whitespace(c)){ - info.is_blank = false; - info.all_space = false; - info.first_char_pos = range.start + (i64)i; - break; - } - if (c != ' '){ - info.all_space = false; - } - if (c == '\t'){ - info.indent_pos += tab_additional_width; - } - info.indent_pos += 1; + + for (u64 i = 0; i < s.size; i += 1){ + u8 c = s.str[i]; + if (!character_is_whitespace(c)){ + info.is_blank = false; + info.all_space = false; +info.first_char_pos = range.start + (i64)i; + break; } + if (c == ' '){ + info.indent_pos += 1; + } + else{ +info.all_space = false; +} +if (c == '\t'){ + info.indent_pos += tab_width; + } + } return(info); -} - -internal Indent_Info -get_indent_info_line_number_and_start(Application_Links *app, Buffer_ID buffer, i64 line_number, i64 line_start, i32 tab_width){ + } + + internal Indent_Info + get_indent_info_line_number_and_start(Application_Links *app, Buffer_ID buffer, i64 line_number, i64 line_start, i32 tab_width){ i64 end = get_line_side_pos(app, buffer, line_number, Side_Max); - return(get_indent_info_range(app, buffer, Ii64(line_start, end), tab_width)); +return(get_indent_info_range(app, buffer, Ii64(line_start, end), tab_width)); + } + + //////////////////////////////// + + internal History_Group + history_group_begin(Application_Links *app, Buffer_ID buffer){ + History_Group group = {}; + group.app = app; + group.buffer = buffer; + group.first = buffer_history_get_current_state_index(app, buffer); + group.first += 1; + return(group); + } + + internal void + history_group_end(History_Group group){ + History_Record_Index last = buffer_history_get_current_state_index(group.app, group.buffer); + if (group.first < last){ + buffer_history_merge_record_range(group.app, group.buffer, group.first, last, RecordMergeFlag_StateInRange_MoveStateForward); } - -//////////////////////////////// - -internal History_Group -history_group_begin(Application_Links *app, Buffer_ID buffer){ - History_Group group = {}; - group.app = app; - group.buffer = buffer; - group.first = buffer_history_get_current_state_index(app, buffer); - group.first += 1; - return(group); -} - -internal void -history_group_end(History_Group group){ - History_Record_Index last = buffer_history_get_current_state_index(group.app, group.buffer); - if (group.first < last){ - buffer_history_merge_record_range(group.app, group.buffer, group.first, last, RecordMergeFlag_StateInRange_MoveStateForward); - } } //////////////////////////////// internal void -replace_in_range(Application_Links *app, Buffer_ID buffer, Range_i64 range, String_Const_u8 needle, String_Const_u8 string){ + replace_in_range(Application_Links *app, Buffer_ID buffer, Range_i64 range, String_Const_u8 needle, String_Const_u8 string){ // TODO(allen): rewrite History_Group group = history_group_begin(app, buffer); i64 pos = range.min - 1; i64 new_pos = 0; - seek_string_forward(app, buffer, pos, range.end, needle, &new_pos); - i64 shift = replace_range_shift(needle.size, string.size); - for (; new_pos + (i64)needle.size <= range.end;){ - Range_i64 needle_range = Ii64(new_pos, new_pos + (i32)needle.size); - buffer_replace_range(app, buffer, needle_range, string); - range.end += shift; - pos = new_pos + (i32)string.size - 1; - seek_string_forward(app, buffer, pos, range.end, needle, &new_pos); - } - history_group_end(group); + seek_string_forward(app, buffer, pos, range.end, needle, &new_pos); + i64 shift = replace_range_shift(needle.size, string.size); + for (; new_pos + (i64)needle.size <= range.end;){ + Range_i64 needle_range = Ii64(new_pos, new_pos + (i32)needle.size); + buffer_replace_range(app, buffer, needle_range, string); + range.end += shift; +pos = new_pos + (i32)string.size - 1; + seek_string_forward(app, buffer, pos, range.end, needle, &new_pos); + } + history_group_end(group); } - -internal Range_i64 -swap_lines(Application_Links *app, Buffer_ID buffer, i64 line_1, i64 line_2){ - Range_i64 result = {}; - i64 line_count = buffer_get_line_count(app, buffer); - if (1 <= line_1 && line_2 <= line_count){ - Range_i64 range_1 = get_line_pos_range(app, buffer, line_1); - Range_i64 range_2 = get_line_pos_range(app, buffer, line_2); - - Scratch_Block scratch(app); - - String_Const_u8 text_1 = push_buffer_range(app, scratch, buffer, range_1); + + internal Range_i64 + swap_lines(Application_Links *app, Buffer_ID buffer, i64 line_1, i64 line_2){ +Range_i64 result = {}; +i64 line_count = buffer_get_line_count(app, buffer); + if (1 <= line_1 && line_2 <= line_count){ + Range_i64 range_1 = get_line_pos_range(app, buffer, line_1); + Range_i64 range_2 = get_line_pos_range(app, buffer, line_2); + + Scratch_Block scratch(app); + + String_Const_u8 text_1 = push_buffer_range(app, scratch, buffer, range_1); String_Const_u8 text_2 = push_buffer_range(app, scratch, buffer, range_2); History_Group group = history_group_begin(app, buffer); - buffer_replace_range(app, buffer, range_2, text_1); - buffer_replace_range(app, buffer, range_1, text_2); - history_group_end(group); - - i64 shift = replace_range_shift(range_1, text_2.size); - result.min = range_1.min; - result.max = range_2.min + shift; - } - return(result); -} + buffer_replace_range(app, buffer, range_2, text_1); +buffer_replace_range(app, buffer, range_1, text_2); + history_group_end(group); -internal i64 -move_line(Application_Links *app, Buffer_ID buffer, i64 line_number, Scan_Direction direction){ - i64 line_1 = 0; - i64 line_2 = 0; - if (direction == Scan_Forward){ - line_1 = line_number; - line_2 = line_number + 1; - } - else{ - line_1 = line_number - 1; - line_2 = line_number; - } - Range_i64 line_starts = swap_lines(app, buffer, line_1, line_2); - i64 result = 0; - if (line_starts.min < line_starts.max){ - if (direction == Scan_Forward){ - result = line_starts.max; +i64 shift = replace_range_shift(range_1, text_2.size); + result.min = range_1.min; +result.max = range_2.min + shift; + } + return(result); +} + + internal i64 + move_line(Application_Links *app, Buffer_ID buffer, i64 line_number, Scan_Direction direction){ + i64 line_1 = 0; + i64 line_2 = 0; + if (direction == Scan_Forward){ + line_1 = line_number; +line_2 = line_number + 1; } else{ - result = line_starts.min; + line_1 = line_number - 1; + line_2 = line_number; + } + Range_i64 line_starts = swap_lines(app, buffer, line_1, line_2); + i64 result = 0; + if (line_starts.min < line_starts.max){ + if (direction == Scan_Forward){ + result = line_starts.max; } - } - else{ + else{ + result = line_starts.min; + } + } + else{ result = get_line_side_pos(app, buffer, line_number, Side_Min); - } - return(result); -} - -internal void -clear_buffer(Application_Links *app, Buffer_ID buffer){ - buffer_replace_range(app, buffer, buffer_range(app, buffer), string_u8_litexpr("")); -} - -//////////////////////////////// - -internal String_Match_List -find_all_matches_all_buffers(Application_Links *app, Arena *arena, String_Const_u8_Array match_patterns, String_Match_Flag must_have_flags, String_Match_Flag must_not_have_flags){ - String_Match_List all_matches = {}; - for (Buffer_ID buffer = get_buffer_next(app, 0, Access_Always); - buffer != 0; - buffer = get_buffer_next(app, buffer, Access_Always)){ - String_Match_List buffer_matches = {}; - for (i32 i = 0; i < match_patterns.count; i += 1){ - Range_i64 range = buffer_range(app, buffer); - String_Match_List pattern_matches = buffer_find_all_matches(app, arena, buffer, i, range, match_patterns.vals[i], - &character_predicate_alpha_numeric_underscore_utf8, Scan_Forward); - string_match_list_filter_flags(&pattern_matches, must_have_flags, must_not_have_flags); - if (pattern_matches.count > 0){ - if (buffer_matches.count == 0){ - buffer_matches = pattern_matches; - } - else{ - buffer_matches = string_match_list_merge_front_to_back(&buffer_matches, &pattern_matches); - } - } } - all_matches = string_match_list_join(&all_matches, &buffer_matches); - } - return(all_matches); -} + return(result); + } + + internal void + clear_buffer(Application_Links *app, Buffer_ID buffer){ + buffer_replace_range(app, buffer, buffer_range(app, buffer), string_u8_litexpr("")); + } + + //////////////////////////////// -internal String_Match_List -find_all_matches_all_buffers(Application_Links *app, Arena *arena, String_Const_u8 pattern, String_Match_Flag must_have_flags, String_Match_Flag must_not_have_flags){ - String_Const_u8_Array array = {&pattern, 1}; - return(find_all_matches_all_buffers(app, arena, array, must_have_flags, must_not_have_flags)); + internal String_Match_List + find_all_matches_all_buffers(Application_Links *app, Arena *arena, String_Const_u8_Array match_patterns, String_Match_Flag must_have_flags, String_Match_Flag must_not_have_flags){ + String_Match_List all_matches = {}; +for (Buffer_ID buffer = get_buffer_next(app, 0, Access_Always); + buffer != 0; + buffer = get_buffer_next(app, buffer, Access_Always)){ +String_Match_List buffer_matches = {}; + for (i32 i = 0; i < match_patterns.count; i += 1){ + Range_i64 range = buffer_range(app, buffer); + String_Match_List pattern_matches = buffer_find_all_matches(app, arena, buffer, i, range, match_patterns.vals[i], + &character_predicate_alpha_numeric_underscore_utf8, Scan_Forward); + string_match_list_filter_flags(&pattern_matches, must_have_flags, must_not_have_flags); +if (pattern_matches.count > 0){ +if (buffer_matches.count == 0){ + buffer_matches = pattern_matches; + } + else{ +buffer_matches = string_match_list_merge_front_to_back(&buffer_matches, &pattern_matches); } +} +} +all_matches = string_match_list_join(&all_matches, &buffer_matches); + } + return(all_matches); + } + + internal String_Match_List + find_all_matches_all_buffers(Application_Links *app, Arena *arena, String_Const_u8 pattern, String_Match_Flag must_have_flags, String_Match_Flag must_not_have_flags){ + String_Const_u8_Array array = {&pattern, 1}; + return(find_all_matches_all_buffers(app, arena, array, must_have_flags, must_not_have_flags)); + } //////////////////////////////// - -internal b32 -is_modified(User_Input *input){ - return(is_modified(&input->event)); -} - -internal String_Const_u8 -to_writable(User_Input *in){ - return(to_writable(&in->event)); -} - -internal b32 -has_modifier(User_Input *in, Key_Code key_code){ - b32 result = false; - Input_Modifier_Set *mods = get_modifiers(&in->event); - if (mods != 0){ - result = has_modifier(mods, key_code); - } - return(result); -} - -internal b32 -match_key_code(User_Input *in, Key_Code key_code){ + + internal b32 + is_modified(User_Input *input){ + return(is_modified(&input->event)); + } + + internal String_Const_u8 + to_writable(User_Input *in){ + return(to_writable(&in->event)); + } + + internal b32 + has_modifier(User_Input *in, Key_Code key_code){ + b32 result = false; + Input_Modifier_Set *mods = get_modifiers(&in->event); + if (mods != 0){ + result = has_modifier(mods, key_code); + } + return(result); + } + + internal b32 + match_key_code(User_Input *in, Key_Code key_code){ return(match_key_code(&in->event, key_code)); -} - + } + internal b32 match_core_code(User_Input *in, Key_Code core_code){ - return(match_core_code(&in->event, core_code)); +return(match_core_code(&in->event, core_code)); } internal String_Const_u8 backspace_utf8(String_Const_u8 string){ - if (string.size > 0){ - u64 i = string.size - 1; - for (; i > 0; --i){ - if (string.str[i] <= 0x7F || string.str[i] >= 0xC0){ - break; - } - } - string.size = i; + if (string.size > 0){ +u64 i = string.size - 1; + for (; i > 0; --i){ + if (string.str[i] <= 0x7F || string.str[i] >= 0xC0){ + break; + } + } + string.size = i; } return(string); -} - -//////////////////////////////// - + } + + //////////////////////////////// + Query_Bar_Group::Query_Bar_Group(Application_Links *app){ - this->app = app; + this->app = app; this->view = get_active_view(app, Access_Always); } Query_Bar_Group::Query_Bar_Group(Application_Links *app, View_ID view){ - this->app = app; - this->view = view; + this->app = app; + this->view = view; } Query_Bar_Group::~Query_Bar_Group(){ - clear_all_query_bars(this->app, this->view); -} - -internal b32 -query_user_general(Application_Links *app, Query_Bar *bar, b32 force_number){ - // NOTE(allen|a3.4.4): It will not cause an *error* if we continue on after failing to. - // start a query bar, but it will be unusual behavior from the point of view of the - // user, if this command starts intercepting input even though no prompt is shown. - // This will only happen if you have a lot of bars open already or if the current view - // doesn't support query bars. - if (start_query_bar(app, bar, 0) == 0){ - return(false); +clear_all_query_bars(this->app, this->view); } + internal b32 + query_user_general(Application_Links *app, Query_Bar *bar, b32 force_number, String_Const_u8 init_string){ +// NOTE(allen|a3.4.4): It will not cause an *error* if we continue on after failing to. +// start a query bar, but it will be unusual behavior from the point of view of the + // user, if this command starts intercepting input even though no prompt is shown. +// This will only happen if you have a lot of bars open already or if the current view + // doesn't support query bars. + if (start_query_bar(app, bar, 0) == 0){ + return(false); + } + + if (init_string.size > 0){ + String_u8 string = Su8(bar->string.str, bar->string.size, bar->string_capacity); + string_append(&string, init_string); + bar->string.size = string.string.size; + } + b32 success = true; for (;;){ - // NOTE(allen|a3.4.4): This call will block until the user does one of the input - // types specified in the flags. The first set of flags are inputs you'd like to - // intercept that you don't want to abort on. The second set are inputs that - // you'd like to cause the command to abort. If an event satisfies both flags, it - // is treated as an abort. - User_Input in = get_next_input(app, EventPropertyGroup_AnyKeyboardEvent, - EventProperty_Escape|EventProperty_MouseButton); - - // NOTE(allen|a3.4.4): The responsible thing to do on abort is to end the command - // without waiting on get_next_input again. - if (in.abort){ - success = false; - break; + // NOTE(allen|a3.4.4): This call will block until the user does one of the input +// types specified in the flags. The first set of flags are inputs you'd like to + // intercept that you don't want to abort on. The second set are inputs that + // you'd like to cause the command to abort. If an event satisfies both flags, it +// is treated as an abort. + User_Input in = get_next_input(app, EventPropertyGroup_AnyKeyboardEvent, + EventProperty_Escape|EventProperty_MouseButton); + + // NOTE(allen|a3.4.4): The responsible thing to do on abort is to end the command + // without waiting on get_next_input again. +if (in.abort){ +success = false; + break; + } + + Scratch_Block scratch(app); + b32 good_insert = false; +String_Const_u8 insert_string = to_writable(&in); + if (insert_string.str != 0 && insert_string.size > 0){ + insert_string = string_replace(scratch, insert_string, + string_u8_litexpr("\n"), + string_u8_litexpr("")); + insert_string = string_replace(scratch, insert_string, + string_u8_litexpr("\t"), + string_u8_litexpr("")); + if (force_number){ +if (string_is_integer(insert_string, 10)){ + good_insert = true; } - - Scratch_Block scratch(app); - b32 good_insert = false; - String_Const_u8 insert_string = to_writable(&in); - if (insert_string.str != 0 && insert_string.size > 0){ - insert_string = string_replace(scratch, insert_string, - string_u8_litexpr("\n"), - string_u8_litexpr("")); - insert_string = string_replace(scratch, insert_string, - string_u8_litexpr("\t"), - string_u8_litexpr("")); - if (force_number){ - if (string_is_integer(insert_string, 10)){ - good_insert = true; - } - } - else{ - good_insert = true; - } } - - // NOTE(allen|a3.4.4): All we have to do to update the query bar is edit our + else{ + good_insert = true; + } +} + +// NOTE(allen|a3.4.4): All we have to do to update the query bar is edit our // local Query_Bar struct! This is handy because it means our Query_Bar - // is always correct for typical use without extra work updating the bar. + // is always correct for typical use without extra work updating the bar. if (in.event.kind == InputEventKind_KeyStroke && - (in.event.key.code == KeyCode_Return || in.event.key.code == KeyCode_Tab)){ - break; - } - else if (in.event.kind == InputEventKind_KeyStroke && - in.event.key.code == KeyCode_Backspace){ - bar->string = backspace_utf8(bar->string); + (in.event.key.code == KeyCode_Return || in.event.key.code == KeyCode_Tab)){ + break; + } + else if (in.event.kind == InputEventKind_KeyStroke && + in.event.key.code == KeyCode_Backspace){ + bar->string = backspace_utf8(bar->string); } else if (good_insert){ String_u8 string = Su8(bar->string.str, bar->string.size, bar->string_capacity); - string_append(&string, insert_string); - bar->string = string.string; + string_append(&string, insert_string); + bar->string.size = string.string.size; + } + else{ + leave_current_input_unhandled(app); + } + } + + return(success); + } + + internal b32 + query_user_string(Application_Links *app, Query_Bar *bar){ + return(query_user_general(app, bar, false, string_u8_empty)); + } + + internal b32 + query_user_number(Application_Links *app, Query_Bar *bar){ +return(query_user_general(app, bar, true, string_u8_empty)); } - else{ - leave_current_input_unhandled(app); - } - } - - return(success); -} - -internal b32 -query_user_string(Application_Links *app, Query_Bar *bar){ - return(query_user_general(app, bar, false)); -} - -internal b32 -query_user_number(Application_Links *app, Query_Bar *bar){ - return(query_user_general(app, bar, true)); -} - -//////////////////////////////// - -internal Buffer_Identifier -buffer_identifier(char *str, i32 len){ - Buffer_Identifier identifier; - identifier.name = str; - identifier.name_len = len; - identifier.id = 0; - return(identifier); -} - -internal Buffer_Identifier -buffer_identifier(String_Const_u8 str){ - return(buffer_identifier((char*)str.str, (i32)str.size)); -} - -internal Buffer_Identifier -buffer_identifier(Buffer_ID id){ + + internal b32 + query_user_number(Application_Links *app, Query_Bar *bar, i32 x){ + Scratch_Block scratch(app); + String_Const_u8 string = push_u8_stringf(scratch, "%d", x); + return(query_user_general(app, bar, true, string)); + } + + //////////////////////////////// + + internal Buffer_Identifier + buffer_identifier(char *str, i32 len){ + Buffer_Identifier identifier; + identifier.name = str; + identifier.name_len = len; + identifier.id = 0; + return(identifier); + } + + internal Buffer_Identifier + buffer_identifier(String_Const_u8 str){ + return(buffer_identifier((char*)str.str, (i32)str.size)); + } + + internal Buffer_Identifier + buffer_identifier(Buffer_ID id){ Buffer_Identifier identifier; identifier.name = 0; - identifier.name_len = 0; - identifier.id = id; - return(identifier); -} - -internal Buffer_ID -buffer_identifier_to_id(Application_Links *app, Buffer_Identifier identifier){ - Buffer_ID id = 0; - if (identifier.id != 0){ - id = identifier.id; +identifier.name_len = 0; +identifier.id = id; +return(identifier); + } + + internal Buffer_ID + buffer_identifier_to_id(Application_Links *app, Buffer_Identifier identifier){ +Buffer_ID id = 0; + if (identifier.id != 0){ +id = identifier.id; } else{ - String_Const_u8 name = SCu8(identifier.name, identifier.name_len); - id = get_buffer_by_name(app, name, Access_Always); - if (id == 0){ - id = get_buffer_by_file_name(app, name, Access_Always); - } + String_Const_u8 name = SCu8(identifier.name, identifier.name_len); + id = get_buffer_by_name(app, name, Access_Always); + if (id == 0){ + id = get_buffer_by_file_name(app, name, Access_Always); + } } return(id); -} - -internal Buffer_ID -buffer_identifier_to_id_create_out_buffer(Application_Links *app, Buffer_Identifier buffer_id){ + } + + internal Buffer_ID + buffer_identifier_to_id_create_out_buffer(Application_Links *app, Buffer_Identifier buffer_id){ Buffer_ID result = 0; if (buffer_id.name != 0 && buffer_id.name_len > 0){ - String_Const_u8 buffer_name = SCu8(buffer_id.name, buffer_id.name_len); - Buffer_ID buffer_attach_id = get_buffer_by_name(app, buffer_name, Access_Always); - if (buffer_attach_id != 0){ - result = buffer_attach_id; - } - else{ - buffer_attach_id = create_buffer(app, buffer_name, BufferCreate_AlwaysNew|BufferCreate_NeverAttachToFile); - if (buffer_attach_id != 0){ - buffer_set_setting(app, buffer_attach_id, BufferSetting_ReadOnly, true); - buffer_set_setting(app, buffer_attach_id, BufferSetting_Unimportant, true); - result = buffer_attach_id; - } - } - } - else{ - result = buffer_id.id; + String_Const_u8 buffer_name = SCu8(buffer_id.name, buffer_id.name_len); + Buffer_ID buffer_attach_id = get_buffer_by_name(app, buffer_name, Access_Always); + if (buffer_attach_id != 0){ + result = buffer_attach_id; + } +else{ +buffer_attach_id = create_buffer(app, buffer_name, BufferCreate_AlwaysNew|BufferCreate_NeverAttachToFile); +if (buffer_attach_id != 0){ +buffer_set_setting(app, buffer_attach_id, BufferSetting_ReadOnly, true); + buffer_set_setting(app, buffer_attach_id, BufferSetting_Unimportant, true); + result = buffer_attach_id; +} +} +} +else{ +result = buffer_id.id; } return(result); -} - -//////////////////////////////// - -function void + } + + //////////////////////////////// + + function void place_begin_and_end_on_own_lines(Application_Links *app, char *begin, char *end){ - View_ID view = get_active_view(app, Access_ReadWriteVisible); - Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible); + View_ID view = get_active_view(app, Access_ReadWriteVisible); + Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible); + + Range_i64 range = get_view_range(app, view); + Range_i64 lines = get_line_range_from_pos_range(app, buffer, range); + range = get_pos_range_from_line_range(app, buffer, lines); + +Scratch_Block scratch(app); + + b32 min_line_blank = line_is_valid_and_blank(app, buffer, lines.min); + b32 max_line_blank = line_is_valid_and_blank(app, buffer, lines.max); - Range_i64 range = get_view_range(app, view); - Range_i64 lines = get_line_range_from_pos_range(app, buffer, range); - range = get_pos_range_from_line_range(app, buffer, lines); - - Scratch_Block scratch(app); - - b32 min_line_blank = line_is_valid_and_blank(app, buffer, lines.min); - b32 max_line_blank = line_is_valid_and_blank(app, buffer, lines.max); - - if ((lines.min < lines.max) || (!min_line_blank)){ + if ((lines.min < lines.max) || (!min_line_blank)){ String_Const_u8 begin_str = {}; String_Const_u8 end_str = {}; - - i64 min_adjustment = 0; - i64 max_adjustment = 0; - + + i64 min_adjustment = 0; + i64 max_adjustment = 0; + if (min_line_blank){ begin_str = push_u8_stringf(scratch, "\n%s", begin); - min_adjustment += 1; - } - else{ - begin_str = push_u8_stringf(scratch, "%s\n", begin); - } - if (max_line_blank){ - end_str = push_u8_stringf(scratch, "%s\n", end); - } - else{ - end_str = push_u8_stringf(scratch, "\n%s", end); - max_adjustment += 1; - } - - max_adjustment += begin_str.size; - Range_i64 new_pos = Ii64(range.min + min_adjustment, range.max + max_adjustment); - - History_Group group = history_group_begin(app, buffer); - buffer_replace_range(app, buffer, Ii64(range.min), begin_str); - buffer_replace_range(app, buffer, Ii64(range.max + begin_str.size), end_str); - history_group_end(group); - - set_view_range(app, view, new_pos); - } + min_adjustment += 1; + } + else{ + begin_str = push_u8_stringf(scratch, "%s\n", begin); + } + if (max_line_blank){ +end_str = push_u8_stringf(scratch, "%s\n", end); + } + else{ + end_str = push_u8_stringf(scratch, "\n%s", end); + max_adjustment += 1; +} + +max_adjustment += begin_str.size; +Range_i64 new_pos = Ii64(range.min + min_adjustment, range.max + max_adjustment); + + History_Group group = history_group_begin(app, buffer); + buffer_replace_range(app, buffer, Ii64(range.min), begin_str); + buffer_replace_range(app, buffer, Ii64(range.max + begin_str.size), end_str); + history_group_end(group); + + set_view_range(app, view, new_pos); + } else{ - String_Const_u8 str = push_u8_stringf(scratch, "%s\n\n%s", begin, end); - buffer_replace_range(app, buffer, range, str); - i64 center_pos = range.min + cstring_length(begin) + 1; - view_set_cursor_and_preferred_x(app, view, seek_pos(center_pos)); - view_set_mark(app, view, seek_pos(center_pos)); + String_Const_u8 str = push_u8_stringf(scratch, "%s\n\n%s", begin, end); + buffer_replace_range(app, buffer, range, str); + i64 center_pos = range.min + cstring_length(begin) + 1; + view_set_cursor_and_preferred_x(app, view, seek_pos(center_pos)); + view_set_mark(app, view, seek_pos(center_pos)); } -} + } -//////////////////////////////// - -function Face_ID -get_view_face_id(Application_Links *app, View_ID view){ - Buffer_ID buffer = view_get_buffer(app, view, Access_Always); - return(get_face_id(app, buffer)); -} - -function Face_Metrics -get_view_face_metrics(Application_Links *app, View_ID view){ - Face_ID face = get_view_face_id(app, view); - return(get_face_metrics(app, face)); -} - -function f32 -get_view_line_height(Application_Links *app, View_ID view){ - Face_Metrics metrics = get_view_face_metrics(app, view); - return(metrics.line_height); -} + //////////////////////////////// + + function Face_ID + get_view_face_id(Application_Links *app, View_ID view){ + Buffer_ID buffer = view_get_buffer(app, view, Access_Always); + return(get_face_id(app, buffer)); + } + + function Face_Metrics + get_view_face_metrics(Application_Links *app, View_ID view){ + Face_ID face = get_view_face_id(app, view); + return(get_face_metrics(app, face)); + } + + function f32 + get_view_line_height(Application_Links *app, View_ID view){ + Face_Metrics metrics = get_view_face_metrics(app, view); + return(metrics.line_height); + } internal View_ID -open_view(Application_Links *app, View_ID view_location, View_Split_Position position){ - View_ID result = 0; - if (view_location != 0 && view_exists(app, view_location)){ - Panel_ID panel_id = view_get_panel(app, view_location); + open_view(Application_Links *app, View_ID view_location, View_Split_Position position){ + View_ID result = 0; + if (view_location != 0 && view_exists(app, view_location)){ + Panel_ID panel_id = view_get_panel(app, view_location); if (panel_id != 0){ - Dimension split = (position == ViewSplit_Left || - position == ViewSplit_Right)?Dimension_X:Dimension_Y; - Side side = (position == ViewSplit_Left || - position == ViewSplit_Top)?Side_Min:Side_Max; + Dimension split = (position == ViewSplit_Left || + position == ViewSplit_Right)?Dimension_X:Dimension_Y; + Side side = (position == ViewSplit_Left || + position == ViewSplit_Top)?Side_Min:Side_Max; if (panel_split(app, panel_id, split)){ - Panel_ID new_panel_id = panel_get_child(app, panel_id, side); - if (new_panel_id != 0){ - View_ID new_view_id = panel_get_view(app, new_panel_id, - Access_Always); - if (new_view_id != 0){ - result = new_view_id; - } - } - } - } + Panel_ID new_panel_id = panel_get_child(app, panel_id, side); + if (new_panel_id != 0){ +View_ID new_view_id = panel_get_view(app, new_panel_id, + Access_Always); + if (new_view_id != 0){ + result = new_view_id; } - return(result); + } +} +} +} +return(result); } internal View_ID get_first_view_with_buffer(Application_Links *app, Buffer_ID buffer_id){ - View_ID result = {}; - if (buffer_id != 0){ - for (View_ID test = get_view_next(app, 0, Access_Always); - test != 0; - test = get_view_next(app, test, Access_Always)){ - Buffer_ID test_buffer = view_get_buffer(app, test, Access_Always); - if (test_buffer == buffer_id){ - result = test; - break; - } + View_ID result = {}; + if (buffer_id != 0){ +for (View_ID test = get_view_next(app, 0, Access_Always); +test != 0; + test = get_view_next(app, test, Access_Always)){ + Buffer_ID test_buffer = view_get_buffer(app, test, Access_Always); + if (test_buffer == buffer_id){ + result = test; + break; } - } - return(result); -} - -internal b32 + } + } + return(result); + } + + internal b32 open_file(Application_Links *app, Buffer_ID *buffer_out, String_Const_u8 file_name, b32 background, b32 never_new){ b32 result = false; - Buffer_ID buffer = get_buffer_by_name(app, file_name, Access_ReadVisible); - b32 exists = buffer_exists(app, buffer); - if (!exists){ - Buffer_Create_Flag flags = 0; - if (background){ - flags |= BufferCreate_Background; - } - if (never_new){ - flags |= BufferCreate_NeverNew; - } - buffer = create_buffer(app, file_name, flags); - exists = buffer_exists(app, buffer); - } - if (exists){ - if (buffer_out != 0){ +Buffer_ID buffer = get_buffer_by_name(app, file_name, Access_ReadVisible); + b32 exists = buffer_exists(app, buffer); + if (!exists){ + Buffer_Create_Flag flags = 0; + if (background){ + flags |= BufferCreate_Background; + } + if (never_new){ + flags |= BufferCreate_NeverNew; + } + buffer = create_buffer(app, file_name, flags); + exists = buffer_exists(app, buffer); + } + if (exists){ + if (buffer_out != 0){ *buffer_out = buffer; + } + result = true; } - result = true; - } return(result); -} + } internal b32 view_open_file(Application_Links *app, View_ID view, String_Const_u8 file_name, b32 never_new){ - b32 result = false; - if (view != 0){ - Buffer_ID buffer = 0; - if (open_file(app, &buffer, file_name, false, never_new)){ - view_set_buffer(app, view, buffer, 0); - result = true; + b32 result = false; + if (view != 0){ + Buffer_ID buffer = 0; + if (open_file(app, &buffer, file_name, false, never_new)){ + view_set_buffer(app, view, buffer, 0); + result = true; } - } - return(result); +} + return(result); } internal void view_disable_highlight_range(Application_Links *app, View_ID view){ - Managed_Scope scope = view_get_managed_scope(app, view); - Managed_Object *highlight = scope_attachment(app, scope, view_highlight_range, Managed_Object); - if (*highlight != 0){ - managed_object_free(app, *highlight); - } - managed_scope_attachment_erase(app, scope, view_highlight_range); - managed_scope_attachment_erase(app, scope, view_highlight_buffer); -} - -internal void -view_set_highlight_range(Application_Links *app, View_ID view, Range_i64 range){ + Managed_Scope scope = view_get_managed_scope(app, view); + Managed_Object *highlight = scope_attachment(app, scope, view_highlight_range, Managed_Object); + if (*highlight != 0){ + managed_object_free(app, *highlight); + } + managed_scope_attachment_erase(app, scope, view_highlight_range); +managed_scope_attachment_erase(app, scope, view_highlight_buffer); + } + + internal void + view_set_highlight_range(Application_Links *app, View_ID view, Range_i64 range){ view_disable_highlight_range(app, view); Buffer_ID buffer = view_get_buffer(app, view, Access_Always); - Managed_Scope scope = view_get_managed_scope(app, view); - Managed_Object *highlight = scope_attachment(app, scope, view_highlight_range, Managed_Object); - *highlight = alloc_buffer_markers_on_buffer(app, buffer, 2, &scope); - Marker markers[2] = {}; - markers[0].pos = range.min; - markers[1].pos = range.max; - managed_object_store_data(app, *highlight, 0, 2, markers); - Buffer_ID *highlight_buffer = scope_attachment(app, scope, view_highlight_buffer, Buffer_ID); + Managed_Scope scope = view_get_managed_scope(app, view); + Managed_Object *highlight = scope_attachment(app, scope, view_highlight_range, Managed_Object); + *highlight = alloc_buffer_markers_on_buffer(app, buffer, 2, &scope); +Marker markers[2] = {}; +markers[0].pos = range.min; + markers[1].pos = range.max; + managed_object_store_data(app, *highlight, 0, 2, markers); + Buffer_ID *highlight_buffer = scope_attachment(app, scope, view_highlight_buffer, Buffer_ID); *highlight_buffer = buffer; } - -function void -view_look_at_region(Application_Links *app, View_ID view, i64 major_pos, i64 minor_pos){ - Range_i64 range = Ii64(major_pos, minor_pos); - b32 bottom_major = false; - if (major_pos == range.max){ - bottom_major = true; - } - Buffer_Cursor top = view_compute_cursor(app, view, seek_pos(range.min)); + function void + view_look_at_region(Application_Links *app, View_ID view, i64 major_pos, i64 minor_pos){ + Range_i64 range = Ii64(major_pos, minor_pos); + b32 bottom_major = false; + if (major_pos == range.max){ + bottom_major = true; +} + +Buffer_Cursor top = view_compute_cursor(app, view, seek_pos(range.min)); if (top.line > 0){ - Buffer_Cursor bottom = view_compute_cursor(app, view, seek_pos(range.max)); - if (bottom.line > 0){ - Rect_f32 region = view_get_buffer_region(app, view); - f32 view_height = rect_height(region); - f32 skirt_height = view_height*.1f; - Range_f32 acceptable_y = If32(skirt_height, view_height*.9f); - - f32 target_height = view_line_y_difference(app, view, bottom.line + 1, top.line); - - f32 line_height = get_view_line_height(app, view); - if (target_height + 2*line_height > view_height){ - i64 major_line = bottom.line; - if (range.min == major_pos){ - major_line = top.line; + Buffer_Cursor bottom = view_compute_cursor(app, view, seek_pos(range.max)); + if (bottom.line > 0){ + Rect_f32 region = view_get_buffer_region(app, view); + f32 view_height = rect_height(region); +f32 skirt_height = view_height*.1f; + Range_f32 acceptable_y = If32(skirt_height, view_height*.9f); + + f32 target_height = view_line_y_difference(app, view, bottom.line + 1, top.line); + +f32 line_height = get_view_line_height(app, view); + if (target_height + 2*line_height > view_height){ + i64 major_line = bottom.line; + if (range.min == major_pos){ + major_line = top.line; + } + + Buffer_Scroll scroll = view_get_buffer_scroll(app, view); + scroll.target.line_number = major_line; + scroll.target.pixel_shift.y = -skirt_height; + view_set_buffer_scroll(app, view, scroll, SetBufferScroll_SnapCursorIntoView); + } +else{ + Buffer_Scroll scroll = view_get_buffer_scroll(app, view); + Vec2_f32 top_p = view_relative_xy_of_pos(app, view, scroll.position.line_number, range.min); + top_p -= scroll.position.pixel_shift; +if (top_p.y < acceptable_y.min){ + scroll.target.line_number = top.line; + scroll.target.pixel_shift.y = -skirt_height; + view_set_buffer_scroll(app, view, scroll, SetBufferScroll_NoCursorChange); + } + else{ + Vec2_f32 bot_p = view_relative_xy_of_pos(app, view, scroll.position.line_number, range.max); + bot_p -= scroll.position.pixel_shift; + if (bot_p.y > acceptable_y.max){ + scroll.target.line_number = bottom.line; + scroll.target.pixel_shift.y = skirt_height - view_height; + view_set_buffer_scroll(app, view, scroll, SetBufferScroll_NoCursorChange); + } + } + } +} + } + } + + function void + view_look_at_region(Application_Links *app, View_ID view, Range_i64 range){ + view_look_at_region(app, view, range.min, range.max); + } + + //////////////////////////////// + + function Buffer_ID + get_buffer_next_looped(Application_Links *app, Buffer_ID buffer, Access_Flag access){ + buffer = get_buffer_next(app, buffer, access); + if (buffer == 0){ +buffer = get_buffer_next(app, 0, access); + } + return(buffer); } - Buffer_Scroll scroll = view_get_buffer_scroll(app, view); - scroll.target.line_number = major_line; - scroll.target.pixel_shift.y = -skirt_height; - view_set_buffer_scroll(app, view, scroll, SetBufferScroll_SnapCursorIntoView); - } - else{ - Buffer_Scroll scroll = view_get_buffer_scroll(app, view); - Vec2_f32 top_p = view_relative_xy_of_pos(app, view, scroll.position.line_number, range.min); - top_p -= scroll.position.pixel_shift; - if (top_p.y < acceptable_y.min){ - scroll.target.line_number = top.line; - scroll.target.pixel_shift.y = -skirt_height; - view_set_buffer_scroll(app, view, scroll, SetBufferScroll_NoCursorChange); - } - else{ - Vec2_f32 bot_p = view_relative_xy_of_pos(app, view, scroll.position.line_number, range.max); - bot_p -= scroll.position.pixel_shift; - if (bot_p.y > acceptable_y.max){ - scroll.target.line_number = bottom.line; - scroll.target.pixel_shift.y = skirt_height - view_height; - view_set_buffer_scroll(app, view, scroll, SetBufferScroll_NoCursorChange); + //////////////////////////////// + + internal View_ID + get_next_view_looped_all_panels(Application_Links *app, View_ID view_id, Access_Flag access){ +view_id = get_view_next(app, view_id, access); + if (view_id == 0){ + view_id = get_view_next(app, 0, access); +} + return(view_id); } + + internal View_ID + get_prev_view_looped_all_panels(Application_Links *app, View_ID view_id, Access_Flag access){ + view_id = get_view_prev(app, view_id, access); + if (view_id == 0){ + view_id = get_view_prev(app, 0, access); + } + return(view_id); + } + + //////////////////////////////// + + internal Buffer_Kill_Result + try_buffer_kill(Application_Links *app, Buffer_ID buffer, View_ID gui_view_id, Buffer_Kill_Flag flags){ + Buffer_Kill_Result result = buffer_kill(app, buffer, flags); + if (result == BufferKillResult_Dirty){ + if (do_buffer_kill_user_check(app, buffer, gui_view_id)){ + result = buffer_kill(app, buffer, BufferKill_AlwaysKill); +} } + return(result); } - } - } -} - -function void -view_look_at_region(Application_Links *app, View_ID view, Range_i64 range){ - view_look_at_region(app, view, range.min, range.max); -} - -//////////////////////////////// - -function Buffer_ID -get_buffer_next_looped(Application_Links *app, Buffer_ID buffer, Access_Flag access){ - buffer = get_buffer_next(app, buffer, access); - if (buffer == 0){ - buffer = get_buffer_next(app, 0, access); - } - return(buffer); -} - -//////////////////////////////// - -internal View_ID -get_next_view_looped_all_panels(Application_Links *app, View_ID view_id, Access_Flag access){ - view_id = get_view_next(app, view_id, access); - if (view_id == 0){ - view_id = get_view_next(app, 0, access); - } - return(view_id); -} - -internal View_ID -get_prev_view_looped_all_panels(Application_Links *app, View_ID view_id, Access_Flag access){ - view_id = get_view_prev(app, view_id, access); - if (view_id == 0){ - view_id = get_view_prev(app, 0, access); - } - return(view_id); -} - -//////////////////////////////// - -internal Buffer_Kill_Result -try_buffer_kill(Application_Links *app, Buffer_ID buffer, View_ID gui_view_id, Buffer_Kill_Flag flags){ - Buffer_Kill_Result result = buffer_kill(app, buffer, flags); - if (result == BufferKillResult_Dirty){ - if (do_buffer_kill_user_check(app, buffer, gui_view_id)){ - result = buffer_kill(app, buffer, BufferKill_AlwaysKill); - } - } - return(result); -} - -//////////////////////////////// - -internal String_Const_u8 + + //////////////////////////////// + + internal String_Const_u8 get_query_string(Application_Links *app, char *query_str, u8 *string_space, i32 space_size){ - Query_Bar_Group group(app); - Query_Bar bar = {}; - bar.prompt = SCu8((u8*)query_str); - bar.string = SCu8(string_space, (u64)0); - bar.string_capacity = space_size; - if (!query_user_string(app, &bar)){ - bar.string.size = 0; + Query_Bar_Group group(app); +Query_Bar bar = {}; +bar.prompt = SCu8((u8*)query_str); +bar.string = SCu8(string_space, (u64)0); +bar.string_capacity = space_size; +if (!query_user_string(app, &bar)){ + bar.string.size = 0; + } + return(bar.string); } - return(bar.string); -} internal Token* -get_token_from_pos(Application_Links *app, Token_Array *array, u64 pos){ - Token *result = 0; + get_token_from_pos(Application_Links *app, Token_Array *array, u64 pos){ + Token *result = 0; if (array->count > 0){ - i64 index = token_index_from_pos(array, pos); - result = array->tokens + index; - } - return(result); + i64 index = token_index_from_pos(array, pos); +result = array->tokens + index; +} +return(result); } internal Token* get_token_from_pos(Application_Links *app, Buffer_ID buffer, u64 pos){ - Token_Array array = get_token_array_from_buffer(app, buffer); - return(get_token_from_pos(app, &array, pos)); + Token_Array array = get_token_array_from_buffer(app, buffer); +return(get_token_from_pos(app, &array, pos)); } internal String_Const_u8 -push_token_or_word_under_pos(Application_Links *app, Arena *arena, Buffer_ID buffer, u64 pos){ - String_Const_u8 result = {}; - Token *token = get_token_from_pos(app, buffer, pos); - if (token != 0 && token->size > 0 && token->kind != TokenBaseKind_Whitespace){ - Range_i64 range = Ii64(token); - result = push_buffer_range(app, arena, buffer, range); - } - return(result); + push_token_or_word_under_pos(Application_Links *app, Arena *arena, Buffer_ID buffer, u64 pos){ + String_Const_u8 result = {}; +Token *token = get_token_from_pos(app, buffer, pos); +if (token != 0 && token->size > 0 && token->kind != TokenBaseKind_Whitespace){ + Range_i64 range = Ii64(token); + result = push_buffer_range(app, arena, buffer, range); + } + return(result); } - -internal String_Const_u8 -push_token_or_word_under_active_cursor(Application_Links *app, Arena *arena){ - View_ID view = get_active_view(app, Access_Always); - Buffer_ID buffer = view_get_buffer(app, view, Access_Always); - i64 pos = view_get_cursor_pos(app, view); - return(push_token_or_word_under_pos(app, arena, buffer, pos)); -} - -//////////////////////////////// - -internal b32 + + internal String_Const_u8 + push_token_or_word_under_active_cursor(Application_Links *app, Arena *arena){ + View_ID view = get_active_view(app, Access_Always); + Buffer_ID buffer = view_get_buffer(app, view, Access_Always); + i64 pos = view_get_cursor_pos(app, view); +return(push_token_or_word_under_pos(app, arena, buffer, pos)); + } + + //////////////////////////////// + + internal b32 file_exists(Application_Links *app, String_Const_u8 file_name){ Scratch_Block scratch(app); - File_Attributes attributes = system_quick_file_attributes(scratch, file_name); - return(attributes.last_write_time > 0); -} + File_Attributes attributes = system_quick_file_attributes(scratch, file_name); +return(attributes.last_write_time > 0); + } -internal b32 -file_exists_and_is_file(Application_Links *app, String_Const_u8 file_name){ - Scratch_Block scratch(app); - File_Attributes attributes = system_quick_file_attributes(scratch, file_name); + internal b32 + file_exists_and_is_file(Application_Links *app, String_Const_u8 file_name){ + Scratch_Block scratch(app); +File_Attributes attributes = system_quick_file_attributes(scratch, file_name); return(attributes.last_write_time > 0 && !HasFlag(attributes.flags, FileAttribute_IsDirectory)); -} - -internal b32 -file_exists_and_is_folder(Application_Links *app, String_Const_u8 file_name){ + } + + internal b32 + file_exists_and_is_folder(Application_Links *app, String_Const_u8 file_name){ Scratch_Block scratch(app); - File_Attributes attributes = system_quick_file_attributes(scratch, file_name); +File_Attributes attributes = system_quick_file_attributes(scratch, file_name); return(attributes.last_write_time > 0 && HasFlag(attributes.flags, FileAttribute_IsDirectory)); -} + } internal Data -dump_file_handle(Arena *arena, FILE *file){ - Data result = {}; - if (file != 0){ - fseek(file, 0, SEEK_END); + dump_file_handle(Arena *arena, FILE *file){ +Data result = {}; + if (file != 0){ + fseek(file, 0, SEEK_END); u64 size = ftell(file); - char *mem = push_array(arena, char, size); - if (mem != 0){ - fseek(file, 0, SEEK_SET); - fread(mem, 1, (size_t)size, file); - result = make_data(mem, size); - } - } + char *mem = push_array(arena, char, size); + if (mem != 0){ + fseek(file, 0, SEEK_SET); + fread(mem, 1, (size_t)size, file); + result = make_data(mem, size); + } + } return(result); -} - + } + internal String_Const_u8 push_file_search_up_path(Application_Links *app, Arena *arena, String_Const_u8 start_path, String_Const_u8 file_name){ - String_Const_u8 result = {}; - String_Const_u8 path = start_path; - for (;path.size > 0;){ - Temp_Memory temp = begin_temp(arena); - if (character_is_slash(string_get_character(path, path.size - 1))){ - path = string_chop(path, 1); - } - String_Const_u8 full_path = push_u8_stringf(arena, "%.*s/%.*s", - string_expand(path), - string_expand(file_name)); - if (file_exists(app, full_path)){ - result = full_path; - break; - } - path = string_remove_last_folder(path); - end_temp(temp); +String_Const_u8 result = {}; +String_Const_u8 path = start_path; +for (;path.size > 0;){ + Temp_Memory temp = begin_temp(arena); + if (character_is_slash(string_get_character(path, path.size - 1))){ + path = string_chop(path, 1); } - return(result); -} - -internal FILE* -open_file_try_current_path_then_binary_path(Application_Links *app, char *file_name){ - FILE *file = fopen(file_name, "rb"); + String_Const_u8 full_path = push_u8_stringf(arena, "%.*s/%.*s", + string_expand(path), +string_expand(file_name)); + if (file_exists(app, full_path)){ + result = full_path; + break; + } + path = string_remove_last_folder(path); + end_temp(temp); + } + return(result); + } + + internal FILE* + open_file_try_current_path_then_binary_path(Application_Links *app, char *file_name){ + FILE *file = fopen(file_name, "rb"); if (file == 0){ - Scratch_Block scratch(app); - List_String_Const_u8 list = {}; - string_list_push(scratch, &list, system_get_path(scratch, SystemPath_Binary)); - string_list_push_overlap(scratch, &list, '/', SCu8(file_name)); - String_Const_u8 str = string_list_flatten(scratch, list, StringFill_NullTerminate); - file = fopen((char*)str.str, "rb"); - } - return(file); +Scratch_Block scratch(app); + List_String_Const_u8 list = {}; + string_list_push(scratch, &list, system_get_path(scratch, SystemPath_Binary)); + string_list_push_overlap(scratch, &list, '/', SCu8(file_name)); + String_Const_u8 str = string_list_flatten(scratch, list, StringFill_NullTerminate); +file = fopen((char*)str.str, "rb"); +} +return(file); } internal FILE* open_file(Arena *scratch, String_Const_u8 name){ - Temp_Memory temp = begin_temp(scratch); - String_Const_u8 name_copy = push_string_copy(scratch, name); - FILE *file = fopen((char*)name_copy.str, "rb"); - end_temp(temp); - return(file); -} - -internal File_Name_Data -dump_file(Arena *arena, String_Const_u8 file_name){ - File_Name_Data result = {}; - FILE *file = open_file(arena, file_name); - if (file != 0){ - result.file_name = file_name; - result.data = dump_file_handle(arena, file); - fclose(file); +Temp_Memory temp = begin_temp(scratch); + String_Const_u8 name_copy = push_string_copy(scratch, name); + FILE *file = fopen((char*)name_copy.str, "rb"); + end_temp(temp); + return(file); + } + + internal File_Name_Data + dump_file(Arena *arena, String_Const_u8 file_name){ +File_Name_Data result = {}; + FILE *file = open_file(arena, file_name); +if (file != 0){ + result.file_name = file_name; + result.data = dump_file_handle(arena, file); +fclose(file); + } +return(result); } - return(result); + + internal File_Name_Data + dump_file_search_up_path(Application_Links *app, Arena *arena, String_Const_u8 path, String_Const_u8 file_name){ + File_Name_Data result = {}; + String_Const_u8 full_path = push_file_search_up_path(app, arena, path, file_name); + if (full_path.size > 0){ + result = dump_file(arena, full_path); } - -internal File_Name_Data -dump_file_search_up_path(Application_Links *app, Arena *arena, String_Const_u8 path, String_Const_u8 file_name){ - File_Name_Data result = {}; - String_Const_u8 full_path = push_file_search_up_path(app, arena, path, file_name); - if (full_path.size > 0){ - result = dump_file(arena, full_path); - } - return(result); +return(result); } internal void sort_pairs_by_key__quick(Sort_Pair_i32 *pairs, i32 first, i32 one_past_last){ - i32 dif = one_past_last - first; + i32 dif = one_past_last - first; if (dif >= 2){ - i32 pivot = one_past_last - 1; + i32 pivot = one_past_last - 1; Sort_Pair_i32 pivot_pair = pairs[pivot]; i32 j = first; - b32 interleave = false; + b32 interleave = false; for (i32 i = first; i < pivot; i += 1){ - Sort_Pair_i32 pair = pairs[i]; - if (pair.key < pivot_pair.key){ - pairs[i] = pairs[j]; - pairs[j] = pair; - j += 1; - } - else if (pair.key == pivot_pair.key){ - if (interleave){ - pairs[i] = pairs[j]; - pairs[j] = pair; - j += 1; - } - interleave = !interleave; - } + Sort_Pair_i32 pair = pairs[i]; + if (pair.key < pivot_pair.key){ + pairs[i] = pairs[j]; + pairs[j] = pair; + j += 1; +} + else if (pair.key == pivot_pair.key){ + if (interleave){ + pairs[i] = pairs[j]; + pairs[j] = pair; + j += 1; + } + interleave = !interleave; + } } pairs[pivot] = pairs[j]; pairs[j] = pivot_pair; sort_pairs_by_key__quick(pairs, first, j); - sort_pairs_by_key__quick(pairs, j + 1, one_past_last); - } -} + sort_pairs_by_key__quick(pairs, j + 1, one_past_last); + } + } + + internal void + sort_pairs_by_key(Sort_Pair_i32 *pairs, i32 count){ + sort_pairs_by_key__quick(pairs, 0, count); + } -internal void -sort_pairs_by_key(Sort_Pair_i32 *pairs, i32 count){ - sort_pairs_by_key__quick(pairs, 0, count); -} - -internal Range_i32_Array -get_ranges_of_duplicate_keys(Arena *arena, i32 *keys, i32 stride, i32 count){ - Range_i32_Array result = {}; - result.ranges = push_array(arena, Range_i32, count); - u8 *ptr = (u8*)keys; - i32 start_i = 0; + internal Range_i32_Array + get_ranges_of_duplicate_keys(Arena *arena, i32 *keys, i32 stride, i32 count){ + Range_i32_Array result = {}; + result.ranges = push_array(arena, Range_i32, count); +u8 *ptr = (u8*)keys; + i32 start_i = 0; for (i32 i = 1; i <= count; i += 1){ - b32 is_end = false; - if (i == count){ - is_end = true; - } + b32 is_end = false; + if (i == count){ + is_end = true; + } else if (*(i32*)(ptr + i*stride) != *(i32*)(ptr + start_i*stride)){ - is_end = true; - } + is_end = true; + } if (is_end){ - Range_i32 *new_range = &result.ranges[result.count++]; - new_range->first = start_i; - new_range->one_past_last = i; - start_i = i; - } - } - pop_array(arena, Range_i32, count - result.count); + Range_i32 *new_range = &result.ranges[result.count++]; + new_range->first = start_i; +new_range->one_past_last = i; + start_i = i; + } + } + pop_array(arena, Range_i32, count - result.count); return(result); -} - -internal void -no_mark_snap_to_cursor(Application_Links *app, Managed_Scope view_scope){ + } + + internal void + no_mark_snap_to_cursor(Application_Links *app, Managed_Scope view_scope){ b32 *snap_to_cursor = scope_attachment(app, view_scope, view_snap_mark_to_cursor, b32); - *snap_to_cursor = false; + *snap_to_cursor = false; + } + + internal void + no_mark_snap_to_cursor(Application_Links *app, View_ID view_id){ + Managed_Scope scope = view_get_managed_scope(app, view_id); + no_mark_snap_to_cursor(app, scope); + } + + internal void + no_mark_snap_to_cursor_if_shift(Application_Links *app, View_ID view_id){ + Scratch_Block scratch(app); + Input_Modifier_Set mods = system_get_keyboard_modifiers(scratch); + if (has_modifier(&mods, KeyCode_Shift)){ +no_mark_snap_to_cursor(app, view_id); + } + } + + internal b32 + view_has_highlighted_range(Application_Links *app, View_ID view){ +b32 result = false; + if (fcoder_mode == FCoderMode_NotepadLike){ + i64 pos = view_get_cursor_pos(app, view); +i64 mark = view_get_mark_pos(app, view); +result = (pos != mark); } - -internal void -no_mark_snap_to_cursor(Application_Links *app, View_ID view_id){ - Managed_Scope scope = view_get_managed_scope(app, view_id); - no_mark_snap_to_cursor(app, scope); -} - -internal void -no_mark_snap_to_cursor_if_shift(Application_Links *app, View_ID view_id){ - Scratch_Block scratch(app); - Input_Modifier_Set mods = system_get_keyboard_modifiers(scratch); - if (has_modifier(&mods, KeyCode_Shift)){ - no_mark_snap_to_cursor(app, view_id); - } +return(result); } internal b32 -view_has_highlighted_range(Application_Links *app, View_ID view){ - b32 result = false; - if (fcoder_mode == FCoderMode_NotepadLike){ - i64 pos = view_get_cursor_pos(app, view); - i64 mark = view_get_mark_pos(app, view); - result = (pos != mark); - } - return(result); -} - -internal b32 -if_view_has_highlighted_range_delete_range(Application_Links *app, View_ID view_id){ - b32 result = false; + if_view_has_highlighted_range_delete_range(Application_Links *app, View_ID view_id){ + b32 result = false; if (view_has_highlighted_range(app, view_id)){ - Range_i64 range = get_view_range(app, view_id); + Range_i64 range = get_view_range(app, view_id); Buffer_ID buffer = view_get_buffer(app, view_id, Access_ReadWriteVisible); buffer_replace_range(app, buffer, range, string_u8_litexpr("")); - result = true; - } - return(result); -} + result = true; + } + return(result); + } -internal void -begin_notepad_mode(Application_Links *app){ - fcoder_mode = FCoderMode_NotepadLike; - for (View_ID view = get_view_next(app, 0, Access_Always); - view != 0; - view = get_view_next(app, view, Access_Always)){ - i64 pos = view_get_cursor_pos(app, view); - view_set_mark(app, view, seek_pos(pos)); - } + internal void + begin_notepad_mode(Application_Links *app){ + fcoder_mode = FCoderMode_NotepadLike; +for (View_ID view = get_view_next(app, 0, Access_Always); + view != 0; +view = get_view_next(app, view, Access_Always)){ + i64 pos = view_get_cursor_pos(app, view); + view_set_mark(app, view, seek_pos(pos)); +} } //////////////////////////////// -internal void + internal void seek_pos_of_textual_line(Application_Links *app, Side side){ - View_ID view = get_active_view(app, Access_ReadVisible); + View_ID view = get_active_view(app, Access_ReadVisible); Buffer_ID buffer = view_get_buffer(app, view, Access_ReadVisible); i64 pos = view_get_cursor_pos(app, view); - i64 new_pos = get_line_side_pos_from_pos(app, buffer, pos, side); +i64 new_pos = get_line_side_pos_from_pos(app, buffer, pos, side); view_set_cursor_and_preferred_x(app, view, seek_pos(new_pos)); - no_mark_snap_to_cursor_if_shift(app, view); -} + no_mark_snap_to_cursor_if_shift(app, view); + } internal void seek_pos_of_visual_line(Application_Links *app, Side side){ - View_ID view = get_active_view(app, Access_ReadVisible); + View_ID view = get_active_view(app, Access_ReadVisible); i64 pos = view_get_cursor_pos(app, view); Buffer_Cursor cursor = view_compute_cursor(app, view, seek_pos(pos)); - Vec2_f32 p = view_relative_xy_of_pos(app, view, cursor.line, pos); - p.x = (side == Side_Min)?(0.f):(max_f32); - i64 new_pos = view_pos_at_relative_xy(app, view, cursor.line, p); - view_set_cursor_and_preferred_x(app, view, seek_pos(new_pos)); - no_mark_snap_to_cursor_if_shift(app, view); -} - -CUSTOM_COMMAND_SIG(seek_beginning_of_textual_line) -CUSTOM_DOC("Seeks the cursor to the beginning of the line across all text.") + Vec2_f32 p = view_relative_xy_of_pos(app, view, cursor.line, pos); + p.x = (side == Side_Min)?(0.f):(max_f32); +i64 new_pos = view_pos_at_relative_xy(app, view, cursor.line, p); + view_set_cursor_and_preferred_x(app, view, seek_pos(new_pos)); + no_mark_snap_to_cursor_if_shift(app, view); + } + + CUSTOM_COMMAND_SIG(seek_beginning_of_textual_line) + CUSTOM_DOC("Seeks the cursor to the beginning of the line across all text.") { seek_pos_of_textual_line(app, Side_Min); -} + } -CUSTOM_COMMAND_SIG(seek_end_of_textual_line) + CUSTOM_COMMAND_SIG(seek_end_of_textual_line) CUSTOM_DOC("Seeks the cursor to the end of the line across all text.") -{ - seek_pos_of_textual_line(app, Side_Max); -} - -CUSTOM_COMMAND_SIG(seek_beginning_of_line) -CUSTOM_DOC("Seeks the cursor to the beginning of the visual line.") + { + seek_pos_of_textual_line(app, Side_Max); + } + + CUSTOM_COMMAND_SIG(seek_beginning_of_line) + CUSTOM_DOC("Seeks the cursor to the beginning of the visual line.") { seek_pos_of_visual_line(app, Side_Min); -} - -CUSTOM_COMMAND_SIG(seek_end_of_line) -CUSTOM_DOC("Seeks the cursor to the end of the visual line.") -{ - seek_pos_of_visual_line(app, Side_Max); -} - -CUSTOM_COMMAND_SIG(goto_beginning_of_file) -CUSTOM_DOC("Sets the cursor to the beginning of the file.") -{ - View_ID view = get_active_view(app, Access_ReadVisible); - view_set_cursor_and_preferred_x(app, view, seek_pos(0)); - no_mark_snap_to_cursor_if_shift(app, view); -} - -CUSTOM_COMMAND_SIG(goto_end_of_file) -CUSTOM_DOC("Sets the cursor to the end of the file.") -{ - View_ID view = get_active_view(app, Access_ReadVisible); - Buffer_ID buffer_id = view_get_buffer(app, view, Access_ReadVisible); - i32 size = (i32)buffer_get_size(app, buffer_id); - view_set_cursor_and_preferred_x(app, view, seek_pos(size)); - no_mark_snap_to_cursor_if_shift(app, view); -} - -//////////////////////////////// - -internal b32 -view_set_split(Application_Links *app, View_ID view, View_Split_Kind kind, f32 t){ - b32 result = false; - if (view != 0){ - Panel_ID panel_id = view_get_panel(app, view); - if (panel_id != 0){ - Panel_ID parent_panel_id = panel_get_parent(app, panel_id); - if (parent_panel_id != 0){ - Panel_ID min_child_id = panel_get_child(app, parent_panel_id, Side_Min); - if (min_child_id != 0){ - b32 panel_is_min = (min_child_id == panel_id); - Panel_Split_Kind panel_kind = ((kind == ViewSplitKind_Ratio)? - (panel_is_min?PanelSplitKind_Ratio_Min:PanelSplitKind_Ratio_Max): - (panel_is_min?PanelSplitKind_FixedPixels_Min:PanelSplitKind_FixedPixels_Max)); - result = panel_set_split(app, parent_panel_id, panel_kind, t); - } - } } + + CUSTOM_COMMAND_SIG(seek_end_of_line) + CUSTOM_DOC("Seeks the cursor to the end of the visual line.") + { + seek_pos_of_visual_line(app, Side_Max); + } + + CUSTOM_COMMAND_SIG(goto_beginning_of_file) + CUSTOM_DOC("Sets the cursor to the beginning of the file.") +{ +View_ID view = get_active_view(app, Access_ReadVisible); +view_set_cursor_and_preferred_x(app, view, seek_pos(0)); + no_mark_snap_to_cursor_if_shift(app, view); + } + + CUSTOM_COMMAND_SIG(goto_end_of_file) + CUSTOM_DOC("Sets the cursor to the end of the file.") + { + View_ID view = get_active_view(app, Access_ReadVisible); + Buffer_ID buffer_id = view_get_buffer(app, view, Access_ReadVisible); + i32 size = (i32)buffer_get_size(app, buffer_id); + view_set_cursor_and_preferred_x(app, view, seek_pos(size)); +no_mark_snap_to_cursor_if_shift(app, view); + } + + //////////////////////////////// + + internal b32 +view_set_split(Application_Links *app, View_ID view, View_Split_Kind kind, f32 t){ + b32 result = false; + if (view != 0){ + Panel_ID panel_id = view_get_panel(app, view); + if (panel_id != 0){ + Panel_ID parent_panel_id = panel_get_parent(app, panel_id); +if (parent_panel_id != 0){ + Panel_ID min_child_id = panel_get_child(app, parent_panel_id, Side_Min); + if (min_child_id != 0){ + b32 panel_is_min = (min_child_id == panel_id); +Panel_Split_Kind panel_kind = ((kind == ViewSplitKind_Ratio)? + (panel_is_min?PanelSplitKind_Ratio_Min:PanelSplitKind_Ratio_Max): +(panel_is_min?PanelSplitKind_FixedPixels_Min:PanelSplitKind_FixedPixels_Max)); + result = panel_set_split(app, parent_panel_id, panel_kind, t); + } +} +} +} +return(result); + } + +internal b32 + view_set_split_proportion(Application_Links *app, View_ID view, f32 t){ +return(view_set_split(app, view, ViewSplitKind_Ratio, t)); } - return(result); -} - -internal b32 -view_set_split_proportion(Application_Links *app, View_ID view, f32 t){ - return(view_set_split(app, view, ViewSplitKind_Ratio, t)); -} - -internal b32 + + internal b32 view_set_split_pixel_size(Application_Links *app, View_ID view, i32 t){ return(view_set_split(app, view, ViewSplitKind_FixedPixels, (f32)t)); -} - -//////////////////////////////// + } + + //////////////////////////////// internal Record_Info get_single_record(Application_Links *app, Buffer_ID buffer_id, History_Record_Index index){ - Record_Info record = buffer_history_get_record_info(app, buffer_id, index); - if (record.error == RecordError_NoError && record.kind == RecordKind_Group){ - record = buffer_history_get_group_sub_record(app, buffer_id, index, record.group_count - 1); +Record_Info record = buffer_history_get_record_info(app, buffer_id, index); + if (record.error == RecordError_NoError && record.kind == RecordKind_Group){ + record = buffer_history_get_group_sub_record(app, buffer_id, index, record.group_count - 1); } return(record); -} - -//////////////////////////////// - -function Nest_Delimiter_Kind -get_nest_delimiter_kind(Token_Base_Kind kind, Find_Nest_Flag flags){ + } + + //////////////////////////////// + + function Nest_Delimiter_Kind + get_nest_delimiter_kind(Token_Base_Kind kind, Find_Nest_Flag flags){ Nest_Delimiter_Kind result = NestDelim_None; switch (kind){ - case TokenBaseKind_ScopeOpen: - { - if (HasFlag(flags, FindNest_Scope)){ - result = NestDelim_Open; - } - }break; - case TokenBaseKind_ScopeClose: - { - if (HasFlag(flags, FindNest_Scope)){ - result = NestDelim_Close; - } - }break; - case TokenBaseKind_ParentheticalOpen: - { - if (HasFlag(flags, FindNest_Paren)){ - result = NestDelim_Open; - } - }break; - case TokenBaseKind_ParentheticalClose: - { - if (HasFlag(flags, FindNest_Paren)){ - result = NestDelim_Close; - } - }break; + case TokenBaseKind_ScopeOpen: + { + if (HasFlag(flags, FindNest_Scope)){ + result = NestDelim_Open; } - return(result); + }break; +case TokenBaseKind_ScopeClose: +{ +if (HasFlag(flags, FindNest_Scope)){ +result = NestDelim_Close; +} +}break; +case TokenBaseKind_ParentheticalOpen: +{ +if (HasFlag(flags, FindNest_Paren)){ +result = NestDelim_Open; +} +}break; +case TokenBaseKind_ParentheticalClose: +{ +if (HasFlag(flags, FindNest_Paren)){ +result = NestDelim_Close; +} +}break; +} +return(result); } function b32 find_nest_side(Application_Links *app, Buffer_ID buffer, i64 pos, - Find_Nest_Flag flags, Scan_Direction scan, Nest_Delimiter_Kind delim, - Range_i64 *out){ - b32 result = false; - - b32 balanced = HasFlag(flags, FindNest_Balanced); +Find_Nest_Flag flags, Scan_Direction scan, Nest_Delimiter_Kind delim, +Range_i64 *out){ +b32 result = false; + + b32 balanced = HasFlag(flags, FindNest_Balanced); if (balanced){ - if ((delim == NestDelim_Open && scan == Scan_Forward) || - (delim == NestDelim_Close && scan == Scan_Backward)){ - balanced = false; - } + if ((delim == NestDelim_Open && scan == Scan_Forward) || + (delim == NestDelim_Close && scan == Scan_Backward)){ + balanced = false; } +} Managed_Scope scope = buffer_get_managed_scope(app, buffer); Token_Array *tokens = scope_attachment(app, scope, attachment_tokens, Token_Array); - if (tokens != 0 && tokens->count > 0){ - Token_Iterator_Array it = token_iterator_pos(0, tokens, pos); - i32 level = 0; - for (;;){ - Token *token = token_it_read(&it); - Nest_Delimiter_Kind token_delim = get_nest_delimiter_kind(token->kind, flags); - - if (level == 0 && token_delim == delim){ - *out = Ii64_size(token->pos, token->size); - result = true; - break; - } - - if (balanced && token_delim != NestDelim_None){ - level += (token_delim == delim)?-1:1; - } - - b32 good = false; - if (scan == Scan_Forward){ - good = token_it_inc(&it); - } - else{ - good = token_it_dec(&it); - } - if (!good){ - break; - } - } - } - - return(result); +if (tokens != 0 && tokens->count > 0){ +Token_Iterator_Array it = token_iterator_pos(0, tokens, pos); +i32 level = 0; +for (;;){ +Token *token = token_it_read(&it); +Nest_Delimiter_Kind token_delim = get_nest_delimiter_kind(token->kind, flags); + +if (level == 0 && token_delim == delim){ +*out = Ii64_size(token->pos, token->size); +result = true; +break; } -function b32 +if (balanced && token_delim != NestDelim_None){ +level += (token_delim == delim)?-1:1; +} + +b32 good = false; +if (scan == Scan_Forward){ +good = token_it_inc(&it); + } +else{ +good = token_it_dec(&it); + } +if (!good){ + break; + } + } + } + + return(result); +} + + function b32 find_nest_side(Application_Links *app, Buffer_ID buffer, i64 pos, - Find_Nest_Flag flags, Scan_Direction scan, Nest_Delimiter_Kind delim, - i64 *out){ - Range_i64 range = {}; - b32 result = find_nest_side(app, buffer, pos, flags, scan, delim, &range); - if (result){ - if (HasFlag(flags, FindNest_EndOfToken)){ - *out = range.end; +Find_Nest_Flag flags, Scan_Direction scan, Nest_Delimiter_Kind delim, + i64 *out){ +Range_i64 range = {}; + b32 result = find_nest_side(app, buffer, pos, flags, scan, delim, &range); +if (result){ + if (HasFlag(flags, FindNest_EndOfToken)){ + *out = range.end; + } + else{ + *out = range.start; + } } - else{ - *out = range.start; - } - } - return(result); -} - -function b32 -find_surrounding_nest(Application_Links *app, Buffer_ID buffer, i64 pos, - Find_Nest_Flag flags, Range_i64 *out){ - b32 result = false; - Range_i64 range = {}; - if (find_nest_side(app, buffer, pos - 1, flags|FindNest_Balanced, - Scan_Backward, NestDelim_Open, &range.start) && - find_nest_side(app, buffer, pos, flags|FindNest_Balanced|FindNest_EndOfToken, - Scan_Forward, NestDelim_Close, &range.end)){ - *out = range; - result = true; - } - return(result); -} - -function void -select_scope(Application_Links *app, View_ID view, Range_i64 range){ - view_set_cursor_and_preferred_x(app, view, seek_pos(range.first)); - view_set_mark(app, view, seek_pos(range.end)); + return(result); + } + + function b32 + find_surrounding_nest(Application_Links *app, Buffer_ID buffer, i64 pos, + Find_Nest_Flag flags, Range_i64 *out){ +b32 result = false; + Range_i64 range = {}; + if (find_nest_side(app, buffer, pos - 1, flags|FindNest_Balanced, +Scan_Backward, NestDelim_Open, &range.start) && + find_nest_side(app, buffer, pos, flags|FindNest_Balanced|FindNest_EndOfToken, + Scan_Forward, NestDelim_Close, &range.end)){ + *out = range; + result = true; + } + return(result); + } + + function void + select_scope(Application_Links *app, View_ID view, Range_i64 range){ + view_set_cursor_and_preferred_x(app, view, seek_pos(range.first)); + view_set_mark(app, view, seek_pos(range.end)); view_look_at_region(app, view, range.first, range.end); no_mark_snap_to_cursor(app, view); -} + } + + //////////////////////////////// -//////////////////////////////// - -function Line_Ending_Kind + function Line_Ending_Kind guess_line_ending_kind_from_buffer(Application_Links *app, Buffer_ID buffer){ - u64 size = buffer_get_size(app, buffer); - size = clamp_top(size, KB(8)); - Scratch_Block scratch(app); - String_Const_u8 string = push_buffer_range(app, scratch, buffer, Ii64(0, size)); - return(string_guess_line_ending_kind(string)); -} - -//////////////////////////////// - -function i32 -get_command_id(Custom_Command_Function *func){ - i32 result = -1; - for (i32 i = 0; i < ArrayCount(fcoder_metacmd_table); i += 1){ - if (func == fcoder_metacmd_table[i].proc){ - result = i; + u64 size = buffer_get_size(app, buffer); + size = clamp_top(size, KB(8)); + Scratch_Block scratch(app); + String_Const_u8 string = push_buffer_range(app, scratch, buffer, Ii64(0, size)); + return(string_guess_line_ending_kind(string)); + } + + //////////////////////////////// + + function i32 + get_command_id(Custom_Command_Function *func){ + i32 result = -1; + for (i32 i = 0; i < ArrayCount(fcoder_metacmd_table); i += 1){ + if (func == fcoder_metacmd_table[i].proc){ +result = i; break; - } + } + } + return(result); + } + + function Command_Metadata* + get_command_metadata(Custom_Command_Function *func){ +Command_Metadata *result = 0; + i32 id = get_command_id(func); + if (id >= 0){ + result = &fcoder_metacmd_table[id]; + } + return(result); + } + + //////////////////////////////// + + // TODO(allen): REWRITE THIS EXACTLY HOW YOU WANT IT --- start --- + + internal Child_Process_Set_Target_Flags + flags_system_command(Command_Line_Interface_Flag flags){ + Child_Process_Set_Target_Flags set_buffer_flags = 0; + if (!HasFlag(flags, CLI_OverlapWithConflict)){ + set_buffer_flags |= ChildProcessSet_FailIfBufferAlreadyAttachedToAProcess; } - return(result); +if (HasFlag(flags, CLI_CursorAtEnd)){ + set_buffer_flags |= ChildProcessSet_CursorAtEnd; } - -function Command_Metadata* -get_command_metadata(Custom_Command_Function *func){ - Command_Metadata *result = 0; - i32 id = get_command_id(func); - if (id >= 0){ - result = &fcoder_metacmd_table[id]; +return(set_buffer_flags); } - return(result); -} - -//////////////////////////////// - -// TODO(allen): REWRITE THIS EXACTLY HOW YOU WANT IT --- start --- - -internal Child_Process_Set_Target_Flags -flags_system_command(Command_Line_Interface_Flag flags){ - Child_Process_Set_Target_Flags set_buffer_flags = 0; - if (!HasFlag(flags, CLI_OverlapWithConflict)){ - set_buffer_flags |= ChildProcessSet_FailIfBufferAlreadyAttachedToAProcess; - } - if (HasFlag(flags, CLI_CursorAtEnd)){ - set_buffer_flags |= ChildProcessSet_CursorAtEnd; - } - return(set_buffer_flags); -} - -internal b32 -set_buffer_system_command(Application_Links *app, Child_Process_ID process, Buffer_ID buffer, Command_Line_Interface_Flag flags){ - b32 result = false; - Child_Process_Set_Target_Flags set_buffer_flags = flags_system_command(flags); - if (child_process_set_target_buffer(app, process, buffer, set_buffer_flags)){ - clear_buffer(app, buffer); + + internal b32 + set_buffer_system_command(Application_Links *app, Child_Process_ID process, Buffer_ID buffer, Command_Line_Interface_Flag flags){ + b32 result = false; +Child_Process_Set_Target_Flags set_buffer_flags = flags_system_command(flags); + if (child_process_set_target_buffer(app, process, buffer, set_buffer_flags)){ + clear_buffer(app, buffer); if (HasFlag(flags, CLI_SendEndSignal)){ - buffer_send_end_signal(app, buffer); - } - result = true; - } - return(result); + buffer_send_end_signal(app, buffer); + } +result = true; +} +return(result); } internal b32 exec_system_command(Application_Links *app, View_ID view, Buffer_Identifier buffer_id, - String_Const_u8 path, String_Const_u8 command, Command_Line_Interface_Flag flags){ + String_Const_u8 path, String_Const_u8 command, Command_Line_Interface_Flag flags){ b32 result = false; - Child_Process_ID child_process_id = create_child_process(app, path, command); - if (child_process_id != 0){ - result = true; - Buffer_ID buffer_attach_id = buffer_identifier_to_id_create_out_buffer(app, buffer_id); - if (buffer_attach_id != 0){ - if (set_buffer_system_command(app, child_process_id, buffer_attach_id, flags)){ - if (view != 0){ - view_set_buffer(app, view, buffer_attach_id, 0); - view_set_cursor(app, view, seek_pos(0)); - } - } - } - } - return(result); -} +Child_Process_ID child_process_id = create_child_process(app, path, command); + if (child_process_id != 0){ +result = true; +Buffer_ID buffer_attach_id = buffer_identifier_to_id_create_out_buffer(app, buffer_id); + if (buffer_attach_id != 0){ + if (set_buffer_system_command(app, child_process_id, buffer_attach_id, flags)){ + if (view != 0){ + view_set_buffer(app, view, buffer_attach_id, 0); + view_set_cursor(app, view, seek_pos(0)); + } + } + } + } + return(result); + } -// TODO(allen): --- end --- + // TODO(allen): --- end --- // BOTTOM diff --git a/custom/4coder_layout_rule.cpp b/custom/4coder_layout_rule.cpp index ce9e5aec..d83e3836 100644 --- a/custom/4coder_layout_rule.cpp +++ b/custom/4coder_layout_rule.cpp @@ -17,6 +17,7 @@ get_layout_reflex(Layout_Item_List *list, Buffer_ID buffer, f32 width, Face_ID f function Rect_f32 layout_reflex_get_rect(Application_Links *app, Layout_Reflex *reflex, i64 pos, b32 *unresolved_dependence){ Rect_f32 rect = {}; + pos = clamp_bot(0, pos); if (range_contains(reflex->list->input_index_range, pos)){ if (range_contains(reflex->list->manifested_index_range, pos)){ rect = layout_box_of_pos(*reflex->list, pos); diff --git a/custom/4coder_mac_map.cpp b/custom/4coder_mac_map.cpp index f21d5dd2..171b22a6 100644 --- a/custom/4coder_mac_map.cpp +++ b/custom/4coder_mac_map.cpp @@ -12,6 +12,7 @@ setup_mac_mapping(Mapping *mapping, i64 global_id, i64 file_id, i64 code_id){ SelectMap(global_id); BindCore(default_startup, CoreCode_Startup); BindCore(default_try_exit, CoreCode_TryExit); + BindCore(clipboard_record_clip, CoreCode_NewClipboardContents); Bind(keyboard_macro_start_recording , KeyCode_U, KeyCode_Command); Bind(keyboard_macro_finish_recording, KeyCode_U, KeyCode_Command, KeyCode_Shift); Bind(keyboard_macro_replay, KeyCode_U, KeyCode_Control); diff --git a/custom/4coder_project_commands.cpp b/custom/4coder_project_commands.cpp index 8ead13f6..bb1f5460 100644 --- a/custom/4coder_project_commands.cpp +++ b/custom/4coder_project_commands.cpp @@ -507,7 +507,8 @@ project_deep_copy__pattern_array(Arena *arena, Project_File_Pattern_Array *src_a for (Node_String_Const_u8 *node = src->absolutes.first; node != 0; node = node->next){ - string_list_push(arena, &dst->absolutes, node->string); + String_Const_u8 string = push_string_copy(arena, node->string); + string_list_push(arena, &dst->absolutes, string); } } } diff --git a/custom/4coder_stringf.cpp b/custom/4coder_stringf.cpp index 6e839fbf..e593fa8c 100644 --- a/custom/4coder_stringf.cpp +++ b/custom/4coder_stringf.cpp @@ -10,45 +10,45 @@ #include #include -static String_Const_char +static String_Const_u8 push_stringfv(Arena *arena, char *format, va_list args){ va_list args2; va_copy(args2, args); i32 size = vsnprintf(0, 0, format, args); - String_Const_char result = string_const_char_push(arena, size + 1); - vsnprintf(result.str, (size_t)result.size, format, args2); + String_Const_u8 result = string_const_u8_push(arena, size + 1); + vsnprintf((char*)result.str, (size_t)result.size, format, args2); result.size -= 1; result.str[result.size] = 0; return(result); } -static String_Const_char +static String_Const_u8 push_stringf(Arena *arena, char *format, ...){ va_list args; va_start(args, format); - String_Const_char result = push_stringfv(arena, format, args); + String_Const_u8 result = push_stringfv(arena, format, args); va_end(args); return(result); } -static String_Const_u8 +static String_Const_u8 push_u8_stringfv(Arena *arena, char *format, va_list args){ - return(SCu8(push_stringfv(arena, format, args))); + return(push_stringfv(arena, format, args)); } static String_Const_u8 push_u8_stringf(Arena *arena, char *format, ...){ va_list args; va_start(args, format); - String_Const_u8 result = SCu8(push_stringfv(arena, format, args)); + String_Const_u8 result = push_stringfv(arena, format, args); va_end(args); return(result); } static void string_list_pushfv(Arena *arena, List_String_Const_char *list, char *format, va_list args){ - String_Const_char string = push_stringfv(arena, format, args); + String_Const_u8 string = push_stringfv(arena, format, args); if (arena->alignment < sizeof(u64)){ push_align(arena, sizeof(u64)); } - string_list_push(arena, list, string); + string_list_push(arena, list, SCchar(string)); } static void string_list_pushf(Arena *arena, List_String_Const_char *list, char *format, ...){ diff --git a/custom/4coder_version.h b/custom/4coder_version.h index 7b6ac772..c918764c 100644 --- a/custom/4coder_version.h +++ b/custom/4coder_version.h @@ -1,6 +1,6 @@ #define MAJOR 4 #define MINOR 1 -#define PATCH 2 +#define PATCH 3 // string #define VN__(a,b,c) #a "." #b "." #c diff --git a/custom/bin/buildsuper_x64.sh b/custom/bin/buildsuper_x64-linux.sh old mode 100755 new mode 100644 similarity index 92% rename from custom/bin/buildsuper_x64.sh rename to custom/bin/buildsuper_x64-linux.sh index 6b49d4ab..988b4c43 --- a/custom/bin/buildsuper_x64.sh +++ b/custom/bin/buildsuper_x64-linux.sh @@ -14,7 +14,7 @@ if [ -z "$SOURCE" ]; then SOURCE="$(readlink -f "$CODE_HOME/4coder_default_bindings.cpp")" fi -opts="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-writable-strings -g" +opts="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-writable-strings -g -DOS_LINUX=1 -DOS_WINDOWS=0 -DOS_MAC=1" arch=-m64 preproc_file=4coder_command_metadata.i diff --git a/custom/bin/buildsuper_x64-mac.sh b/custom/bin/buildsuper_x64-mac.sh index 7113ed24..f18a1466 100755 --- a/custom/bin/buildsuper_x64-mac.sh +++ b/custom/bin/buildsuper_x64-mac.sh @@ -15,7 +15,7 @@ if [ -z "$SOURCE" ]; then fi # NOTE(yuval): Removed -Wno-writable-strings as it is the same as -Wno-write-strings -opts="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-missing-declarations -Wno-logical-op-parentheses -g" +opts="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-missing-declarations -Wno-logical-op-parentheses -g -DOS_MAC=1 -DOS_WINDOWS=0 -DOS_LINUX=0" arch=-m64 preproc_file=4coder_command_metadata.i diff --git a/custom/bin/buildsuper_x64.bat b/custom/bin/buildsuper_x64-win.bat similarity index 88% rename from custom/bin/buildsuper_x64.bat rename to custom/bin/buildsuper_x64-win.bat index 57d69fcb..8ed77e52 100644 --- a/custom/bin/buildsuper_x64.bat +++ b/custom/bin/buildsuper_x64-win.bat @@ -10,7 +10,7 @@ REM 1. preprocess the build target REM 2. build the metadata generator REM 3. run the metadata generator on the result from (1) REM 4. build the build target -REM 5. cleanup after the metadata generator +REM 5. cleanup after the metadata generator REM All output files are generated in the current directory when the script is run set location=%cd% @@ -31,9 +31,13 @@ set release=/O2 /Zi set mode=%debug% if "%2" == "release" (set mode=%release%) +set binname=%3 +if "%binname%" == "" set binname="custom_4coder" + set opts=/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /wd4457 /WX set opts=%opts% /GR- /nologo /FC set opts=%opts% -I%custom_root% +set opts=%opts% /D OS_WINDOWS=1 /D OS_LINUX=0 /D OS_MAC=0 set opts=%opts% %mode% set preproc_file=4coder_command_metadata.i @@ -46,7 +50,7 @@ call cl %opts% %meta_opts% %target% call cl %opts% "%custom_root%\4coder_metadata_generator.cpp" /Femetadata_generator metadata_generator -R "%custom_root%" "%cd%\%preproc_file%" -call cl %opts% %target% /Fecustom_4coder %build_dll% +call cl %opts% %target% /Fe%binname% %build_dll% REM file spammation preventation del metadata_generator* diff --git a/custom/bin/buildsuper_x86.sh b/custom/bin/buildsuper_x86-linux.sh old mode 100755 new mode 100644 similarity index 94% rename from custom/bin/buildsuper_x86.sh rename to custom/bin/buildsuper_x86-linux.sh index 46d0ab6e..18d247aa --- a/custom/bin/buildsuper_x86.sh +++ b/custom/bin/buildsuper_x86-linux.sh @@ -35,7 +35,7 @@ done PHYS_DIR=`pwd -P` SOURCE=$PHYS_DIR/$TARGET_FILE -opts="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-writable-strings -g" +opts="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-writable-strings -g -DOS_LINUX=1 -DOS_WINDOWS=0 -DOS_MAC=1" arch=-m32 cd "$REAL_PWD" diff --git a/custom/bin/buildsuper_x86-mac.sh b/custom/bin/buildsuper_x86-mac.sh deleted file mode 100755 index fbdb4b2c..00000000 --- a/custom/bin/buildsuper_x86-mac.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# If any command errors, stop the script -set -e - -# Store the real CWD -ME="$(realpath "$0")" -LOCATION="$(dirname "$ME")" -CODE_HOME="$(dirname "$LOCATION")" - -# Find the most reasonable candidate build file -SOURCE="$1" -if [ -z "$SOURCE" ]; then - SOURCE="$(readlink -f "$CODE_HOME/4coder_default_bindings.cpp")" -fi - -# NOTE(yuval): Removed -Wno-writable-strings as it is the same as -Wno-write-strings -opts="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-missing-declarations -Wno-logical-op-parentheses -g" -arch=-m32 - -preproc_file=4coder_command_metadata.i -meta_macros="-DMETA_PASS" -clang++ -I"$CODE_HOME" $meta_macros $arch $opts $debug -std=gnu++0x "$SOURCE" -E -o $preproc_file -clang++ -I"$CODE_HOME" $opts $debug -std=gnu++0x "$CODE_HOME/4coder_metadata_generator.cpp" -o "$CODE_HOME/metadata_generator" -"$CODE_HOME/metadata_generator" -R "$CODE_HOME" "$PWD/$preproc_file" - -clang++ -I"$CODE_HOME" $arch $opts $debug -std=c++11 "$SOURCE" -shared -o custom_4coder.so -fPIC - -rm "$CODE_HOME/metadata_generator" -rm $preproc_file diff --git a/custom/bin/buildsuper_x86.bat b/custom/bin/buildsuper_x86-win.bat similarity index 91% rename from custom/bin/buildsuper_x86.bat rename to custom/bin/buildsuper_x86-win.bat index ff76ead7..6232b9f2 100644 --- a/custom/bin/buildsuper_x86.bat +++ b/custom/bin/buildsuper_x86-win.bat @@ -10,7 +10,7 @@ REM 1. preprocess the build target REM 2. build the metadata generator REM 3. run the metadata generator on the result from (1) REM 4. build the build target -REM 5. cleanup after the metadata generator +REM 5. cleanup after the metadata generator REM All output files are generated in the current directory when the script is run set location=%cd% @@ -31,9 +31,13 @@ set release=/O2 /Zi set mode=%debug% if "%2" == "release" (set mode=%release%) +set binname=%3 +if "%binname%" == "" set binname="custom_4coder" + set opts=/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /wd4457 /WX set opts=%opts% /GR- /nologo /FC set opts=%opts% -I%custom_root% +set opts=%opts% /D OS_WINDOWS=1 /D OS_LINUX=0 /D OS_MAC=0 set opts=%opts% %mode% set preproc_file=4coder_command_metadata.i diff --git a/custom/generated/command_metadata.h b/custom/generated/command_metadata.h index f4843974..33fa492a 100644 --- a/custom/generated/command_metadata.h +++ b/custom/generated/command_metadata.h @@ -2,7 +2,7 @@ #define command_id(c) (fcoder_metacmd_ID_##c) #define command_metadata(c) (&fcoder_metacmd_table[command_id(c)]) #define command_metadata_by_id(id) (&fcoder_metacmd_table[id]) -#define command_one_past_last_id 231 +#define command_one_past_last_id 238 #if defined(CUSTOM_COMMAND_SIG) #define PROC_LINKS(x,y) x #else @@ -16,6 +16,7 @@ CUSTOM_COMMAND_SIG(auto_indent_whole_file); CUSTOM_COMMAND_SIG(backspace_alpha_numeric_boundary); CUSTOM_COMMAND_SIG(backspace_char); CUSTOM_COMMAND_SIG(basic_change_active_panel); +CUSTOM_COMMAND_SIG(begin_clipboard_collection_mode); CUSTOM_COMMAND_SIG(build_in_build_panel); CUSTOM_COMMAND_SIG(build_search); CUSTOM_COMMAND_SIG(center_view); @@ -24,10 +25,12 @@ CUSTOM_COMMAND_SIG(change_active_panel_backwards); CUSTOM_COMMAND_SIG(change_to_build_panel); CUSTOM_COMMAND_SIG(clean_all_lines); CUSTOM_COMMAND_SIG(clear_all_themes); +CUSTOM_COMMAND_SIG(clear_clipboard); CUSTOM_COMMAND_SIG(click_set_cursor); CUSTOM_COMMAND_SIG(click_set_cursor_and_mark); CUSTOM_COMMAND_SIG(click_set_cursor_if_lbutton); CUSTOM_COMMAND_SIG(click_set_mark); +CUSTOM_COMMAND_SIG(clipboard_record_clip); CUSTOM_COMMAND_SIG(close_all_code); CUSTOM_COMMAND_SIG(close_build_panel); CUSTOM_COMMAND_SIG(close_panel); @@ -136,6 +139,8 @@ CUSTOM_COMMAND_SIG(move_up_10); CUSTOM_COMMAND_SIG(move_up_to_blank_line); CUSTOM_COMMAND_SIG(move_up_to_blank_line_end); CUSTOM_COMMAND_SIG(move_up_to_blank_line_skip_whitespace); +CUSTOM_COMMAND_SIG(multi_paste_interactive); +CUSTOM_COMMAND_SIG(multi_paste_interactive_quick); CUSTOM_COMMAND_SIG(open_all_code); CUSTOM_COMMAND_SIG(open_all_code_recursive); CUSTOM_COMMAND_SIG(open_file_in_quotes); @@ -192,6 +197,8 @@ CUSTOM_COMMAND_SIG(set_eol_mode_from_contents); CUSTOM_COMMAND_SIG(set_eol_mode_to_binary); CUSTOM_COMMAND_SIG(set_eol_mode_to_crlf); CUSTOM_COMMAND_SIG(set_eol_mode_to_lf); +CUSTOM_COMMAND_SIG(set_face_size); +CUSTOM_COMMAND_SIG(set_face_size_this_buffer); CUSTOM_COMMAND_SIG(set_mark); CUSTOM_COMMAND_SIG(set_mode_to_notepad_like); CUSTOM_COMMAND_SIG(set_mode_to_original); @@ -252,238 +259,245 @@ char *source_name; i32 source_name_len; i32 line_number; }; -static Command_Metadata fcoder_metacmd_table[231] = { -{ PROC_LINKS(allow_mouse, 0), false, "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 409 }, -{ PROC_LINKS(auto_indent_line_at_cursor, 0), false, "auto_indent_line_at_cursor", 26, "Auto-indents the line on which the cursor sits.", 47, "c:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 407 }, -{ PROC_LINKS(auto_indent_range, 0), false, "auto_indent_range", 17, "Auto-indents the range between the cursor and the mark.", 55, "c:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 417 }, -{ PROC_LINKS(auto_indent_whole_file, 0), false, "auto_indent_whole_file", 22, "Audo-indents the entire current buffer.", 39, "c:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 398 }, -{ PROC_LINKS(backspace_alpha_numeric_boundary, 0), false, "backspace_alpha_numeric_boundary", 32, "Delete characters between the cursor position and the first alphanumeric boundary to the left.", 94, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 165 }, -{ PROC_LINKS(backspace_char, 0), false, "backspace_char", 14, "Deletes the character to the left of the cursor.", 48, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 96 }, -{ PROC_LINKS(basic_change_active_panel, 0), false, "basic_change_active_panel", 25, "Change the currently active panel, moving to the panel with the next highest view_id. Will not skipe the build panel if it is open.", 132, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 622 }, -{ PROC_LINKS(build_in_build_panel, 0), false, "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "c:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 159 }, -{ PROC_LINKS(build_search, 0), false, "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "c:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 122 }, -{ PROC_LINKS(center_view, 0), false, "center_view", 11, "Centers the view vertically on the line on which the cursor sits.", 65, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 208 }, -{ PROC_LINKS(change_active_panel, 0), false, "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 284 }, -{ PROC_LINKS(change_active_panel_backwards, 0), false, "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 290 }, -{ PROC_LINKS(change_to_build_panel, 0), false, "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "c:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 180 }, -{ PROC_LINKS(clean_all_lines, 0), false, "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 587 }, -{ PROC_LINKS(clear_all_themes, 0), false, "clear_all_themes", 16, "Clear the theme list", 20, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 480 }, -{ PROC_LINKS(click_set_cursor, 0), false, "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 244 }, -{ PROC_LINKS(click_set_cursor_and_mark, 0), false, "click_set_cursor_and_mark", 25, "Sets the cursor position and mark to the mouse position.", 56, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 234 }, -{ PROC_LINKS(click_set_cursor_if_lbutton, 0), false, "click_set_cursor_if_lbutton", 27, "If the mouse left button is pressed, sets the cursor position to the mouse position.", 84, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 254 }, -{ PROC_LINKS(click_set_mark, 0), false, "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 266 }, -{ PROC_LINKS(close_all_code, 0), false, "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 842 }, -{ PROC_LINKS(close_build_panel, 0), false, "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "c:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 174 }, -{ PROC_LINKS(close_panel, 0), false, "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 630 }, -{ PROC_LINKS(command_documentation, 0), true, "command_documentation", 21, "Prompts the user to select a command then loads a doc buffer for that item", 74, "c:\\4ed\\code\\custom\\4coder_docs.cpp", 34, 190 }, -{ PROC_LINKS(command_lister, 0), true, "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 761 }, -{ PROC_LINKS(comment_line, 0), false, "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 125 }, -{ PROC_LINKS(comment_line_toggle, 0), false, "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 149 }, -{ PROC_LINKS(copy, 0), false, "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "c:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 19 }, -{ PROC_LINKS(cursor_mark_swap, 0), false, "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 135 }, -{ PROC_LINKS(custom_api_documentation, 0), true, "custom_api_documentation", 24, "Prompts the user to select a Custom API item then loads a doc buffer for that item", 82, "c:\\4ed\\code\\custom\\4coder_docs.cpp", 34, 175 }, -{ PROC_LINKS(cut, 0), false, "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "c:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 28 }, -{ PROC_LINKS(decrease_face_size, 0), false, "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 693 }, -{ PROC_LINKS(default_file_externally_modified, 0), false, "default_file_externally_modified", 32, "Notes the external modification of attached files by printing a message.", 72, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1804 }, -{ PROC_LINKS(default_startup, 0), false, "default_startup", 15, "Default command for responding to a startup event", 49, "c:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 7 }, -{ PROC_LINKS(default_try_exit, 0), false, "default_try_exit", 16, "Default command for responding to a try-exit event", 50, "c:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 23 }, -{ PROC_LINKS(default_view_input_handler, 0), false, "default_view_input_handler", 26, "Input consumption loop for default view behavior", 48, "c:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 51 }, -{ PROC_LINKS(delete_alpha_numeric_boundary, 0), false, "delete_alpha_numeric_boundary", 29, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 173 }, -{ PROC_LINKS(delete_char, 0), false, "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 79 }, -{ PROC_LINKS(delete_current_scope, 0), false, "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 112 }, -{ PROC_LINKS(delete_file_query, 0), false, "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1230 }, -{ PROC_LINKS(delete_line, 0), false, "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1402 }, -{ PROC_LINKS(delete_range, 0), false, "delete_range", 12, "Deletes the text in the range between the cursor and the mark.", 62, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 145 }, -{ PROC_LINKS(duplicate_line, 0), false, "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1388 }, -{ PROC_LINKS(execute_any_cli, 0), false, "execute_any_cli", 15, "Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.", 133, "c:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 22 }, -{ PROC_LINKS(execute_previous_cli, 0), false, "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "c:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 7 }, -{ PROC_LINKS(exit_4coder, 0), false, "exit_4coder", 11, "Attempts to close 4coder.", 25, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 749 }, -{ PROC_LINKS(goto_beginning_of_file, 0), false, "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "c:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2184 }, -{ PROC_LINKS(goto_end_of_file, 0), false, "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "c:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2192 }, -{ PROC_LINKS(goto_first_jump, 0), false, "goto_first_jump", 15, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 525 }, -{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), false, "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 542 }, -{ PROC_LINKS(goto_jump_at_cursor, 0), false, "goto_jump_at_cursor", 19, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 348 }, -{ PROC_LINKS(goto_jump_at_cursor_same_panel, 0), false, "goto_jump_at_cursor_same_panel", 30, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list.", 167, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 375 }, -{ PROC_LINKS(goto_line, 0), false, "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 757 }, -{ PROC_LINKS(goto_next_jump, 0), false, "goto_next_jump", 14, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 464 }, -{ PROC_LINKS(goto_next_jump_no_skips, 0), false, "goto_next_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 494 }, -{ PROC_LINKS(goto_prev_jump, 0), false, "goto_prev_jump", 14, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 481 }, -{ PROC_LINKS(goto_prev_jump_no_skips, 0), false, "goto_prev_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 511 }, -{ PROC_LINKS(hide_filebar, 0), false, "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 660 }, -{ PROC_LINKS(hide_scrollbar, 0), false, "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 646 }, -{ PROC_LINKS(hms_demo_tutorial, 0), false, "hms_demo_tutorial", 17, "Tutorial for built in 4coder bindings and features.", 51, "c:\\4ed\\code\\custom\\4coder_tutorial.cpp", 38, 869 }, -{ PROC_LINKS(if0_off, 0), false, "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 70 }, -{ PROC_LINKS(if_read_only_goto_position, 0), false, "if_read_only_goto_position", 26, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 564 }, -{ PROC_LINKS(if_read_only_goto_position_same_panel, 0), false, "if_read_only_goto_position_same_panel", 37, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "c:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 581 }, -{ PROC_LINKS(increase_face_size, 0), false, "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 682 }, -{ PROC_LINKS(interactive_kill_buffer, 0), true, "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 520 }, -{ PROC_LINKS(interactive_new, 0), true, "interactive_new", 15, "Interactively creates a new file.", 33, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 661 }, -{ PROC_LINKS(interactive_open, 0), true, "interactive_open", 16, "Interactively opens a file.", 27, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 715 }, -{ PROC_LINKS(interactive_open_or_new, 0), true, "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 612 }, -{ PROC_LINKS(interactive_switch_buffer, 0), true, "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 510 }, -{ PROC_LINKS(jump_to_definition, 0), true, "jump_to_definition", 18, "List all definitions in the code index and jump to one chosen by the user.", 74, "c:\\4ed\\code\\custom\\4coder_code_index_listers.cpp", 48, 12 }, -{ PROC_LINKS(keyboard_macro_finish_recording, 0), false, "keyboard_macro_finish_recording", 31, "Stop macro recording, do nothing if macro recording is not already started", 74, "c:\\4ed\\code\\custom\\4coder_keyboard_macro.cpp", 44, 54 }, -{ PROC_LINKS(keyboard_macro_replay, 0), false, "keyboard_macro_replay", 21, "Replay the most recently recorded keyboard macro", 48, "c:\\4ed\\code\\custom\\4coder_keyboard_macro.cpp", 44, 77 }, -{ PROC_LINKS(keyboard_macro_start_recording, 0), false, "keyboard_macro_start_recording", 30, "Start macro recording, do nothing if macro recording is already started", 71, "c:\\4ed\\code\\custom\\4coder_keyboard_macro.cpp", 44, 41 }, -{ PROC_LINKS(kill_buffer, 0), false, "kill_buffer", 11, "Kills the current buffer.", 25, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1548 }, -{ PROC_LINKS(kill_tutorial, 0), false, "kill_tutorial", 13, "If there is an active tutorial, kill it.", 40, "c:\\4ed\\code\\custom\\4coder_tutorial.cpp", 38, 9 }, -{ PROC_LINKS(left_adjust_view, 0), false, "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 222 }, -{ PROC_LINKS(list_all_functions_all_buffers, 0), false, "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "c:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 296 }, -{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), false, "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "c:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 302 }, -{ PROC_LINKS(list_all_functions_current_buffer, 0), false, "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "c:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 267 }, -{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), false, "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "c:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 277 }, -{ PROC_LINKS(list_all_locations, 0), false, "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 165 }, -{ PROC_LINKS(list_all_locations_case_insensitive, 0), false, "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 177 }, -{ PROC_LINKS(list_all_locations_of_identifier, 0), false, "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 189 }, -{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), false, "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 195 }, -{ PROC_LINKS(list_all_locations_of_selection, 0), false, "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 201 }, -{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), false, "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 207 }, -{ PROC_LINKS(list_all_locations_of_type_definition, 0), false, "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 213 }, -{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), false, "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 221 }, -{ PROC_LINKS(list_all_substring_locations, 0), false, "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 171 }, -{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), false, "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 183 }, -{ PROC_LINKS(load_project, 0), false, "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 862 }, -{ PROC_LINKS(load_theme_current_buffer, 0), false, "load_theme_current_buffer", 25, "Parse the current buffer as a theme file and add the theme to the theme list. If the buffer has a .4coder postfix in it's name, it is removed when the name is saved.", 165, "c:\\4ed\\code\\custom\\4coder_config.cpp", 36, 1622 }, -{ PROC_LINKS(load_themes_default_folder, 0), false, "load_themes_default_folder", 26, "Loads all the theme files in the default theme folder.", 54, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 457 }, -{ PROC_LINKS(load_themes_hot_directory, 0), false, "load_themes_hot_directory", 25, "Loads all the theme files in the current hot directory.", 55, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 469 }, -{ PROC_LINKS(make_directory_query, 0), false, "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1342 }, -{ PROC_LINKS(miblo_decrement_basic, 0), false, "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "c:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 44 }, -{ PROC_LINKS(miblo_decrement_time_stamp, 0), false, "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "c:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 237 }, -{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), false, "miblo_decrement_time_stamp_minute", 33, "Decrement a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "c:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 249 }, -{ PROC_LINKS(miblo_increment_basic, 0), false, "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "c:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 29 }, -{ PROC_LINKS(miblo_increment_time_stamp, 0), false, "miblo_increment_time_stamp", 26, "Increment a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "c:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 231 }, -{ PROC_LINKS(miblo_increment_time_stamp_minute, 0), false, "miblo_increment_time_stamp_minute", 33, "Increment a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "c:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 243 }, -{ PROC_LINKS(mouse_wheel_change_face_size, 0), false, "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 704 }, -{ PROC_LINKS(mouse_wheel_scroll, 0), false, "mouse_wheel_scroll", 18, "Reads the scroll wheel value from the mouse state and scrolls accordingly.", 74, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 276 }, -{ PROC_LINKS(move_down, 0), false, "move_down", 9, "Moves the cursor down one line.", 31, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 347 }, -{ PROC_LINKS(move_down_10, 0), false, "move_down_10", 12, "Moves the cursor down ten lines.", 32, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 359 }, -{ PROC_LINKS(move_down_textual, 0), false, "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 365 }, -{ PROC_LINKS(move_down_to_blank_line, 0), false, "move_down_to_blank_line", 23, "Seeks the cursor down to the next blank line.", 45, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 418 }, -{ PROC_LINKS(move_down_to_blank_line_end, 0), false, "move_down_to_blank_line_end", 27, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 442 }, -{ PROC_LINKS(move_down_to_blank_line_skip_whitespace, 0), false, "move_down_to_blank_line_skip_whitespace", 39, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 430 }, -{ PROC_LINKS(move_left, 0), false, "move_left", 9, "Moves the cursor one character to the left.", 43, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 448 }, -{ PROC_LINKS(move_left_alpha_numeric_boundary, 0), false, "move_left_alpha_numeric_boundary", 32, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 525 }, -{ PROC_LINKS(move_left_alpha_numeric_or_camel_boundary, 0), false, "move_left_alpha_numeric_or_camel_boundary", 41, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 539 }, -{ PROC_LINKS(move_left_token_boundary, 0), false, "move_left_token_boundary", 24, "Seek left for the next beginning of a token.", 44, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 497 }, -{ PROC_LINKS(move_left_whitespace_boundary, 0), false, "move_left_whitespace_boundary", 29, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 482 }, -{ PROC_LINKS(move_left_whitespace_or_token_boundary, 0), false, "move_left_whitespace_or_token_boundary", 38, "Seek left for the next end of a token or boundary between whitespace and non-whitespace.", 88, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 511 }, -{ PROC_LINKS(move_line_down, 0), false, "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1382 }, -{ PROC_LINKS(move_line_up, 0), false, "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1376 }, -{ PROC_LINKS(move_right, 0), false, "move_right", 10, "Moves the cursor one character to the right.", 44, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 456 }, -{ PROC_LINKS(move_right_alpha_numeric_boundary, 0), false, "move_right_alpha_numeric_boundary", 33, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 518 }, -{ PROC_LINKS(move_right_alpha_numeric_or_camel_boundary, 0), false, "move_right_alpha_numeric_or_camel_boundary", 42, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 532 }, -{ PROC_LINKS(move_right_token_boundary, 0), false, "move_right_token_boundary", 25, "Seek right for the next end of a token.", 39, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 490 }, -{ PROC_LINKS(move_right_whitespace_boundary, 0), false, "move_right_whitespace_boundary", 30, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 474 }, -{ PROC_LINKS(move_right_whitespace_or_token_boundary, 0), false, "move_right_whitespace_or_token_boundary", 39, "Seek right for the next end of a token or boundary between whitespace and non-whitespace.", 89, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 504 }, -{ PROC_LINKS(move_up, 0), false, "move_up", 7, "Moves the cursor up one line.", 29, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 341 }, -{ PROC_LINKS(move_up_10, 0), false, "move_up_10", 10, "Moves the cursor up ten lines.", 30, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 353 }, -{ PROC_LINKS(move_up_to_blank_line, 0), false, "move_up_to_blank_line", 21, "Seeks the cursor up to the next blank line.", 43, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 412 }, -{ PROC_LINKS(move_up_to_blank_line_end, 0), false, "move_up_to_blank_line_end", 25, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 436 }, -{ PROC_LINKS(move_up_to_blank_line_skip_whitespace, 0), false, "move_up_to_blank_line_skip_whitespace", 37, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 424 }, -{ PROC_LINKS(open_all_code, 0), false, "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 848 }, -{ PROC_LINKS(open_all_code_recursive, 0), false, "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 854 }, -{ PROC_LINKS(open_file_in_quotes, 0), false, "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1467 }, -{ PROC_LINKS(open_in_other, 0), false, "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1798 }, -{ PROC_LINKS(open_long_braces, 0), false, "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 46 }, -{ PROC_LINKS(open_long_braces_break, 0), false, "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 62 }, -{ PROC_LINKS(open_long_braces_semicolon, 0), false, "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 54 }, -{ PROC_LINKS(open_matching_file_cpp, 0), false, "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1499 }, -{ PROC_LINKS(open_panel_hsplit, 0), false, "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 310 }, -{ PROC_LINKS(open_panel_vsplit, 0), false, "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 300 }, -{ PROC_LINKS(page_down, 0), false, "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 383 }, -{ PROC_LINKS(page_up, 0), false, "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 375 }, -{ PROC_LINKS(paste, 0), false, "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "c:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 39 }, -{ PROC_LINKS(paste_and_indent, 0), false, "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "c:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 113 }, -{ PROC_LINKS(paste_next, 0), false, "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "c:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 72 }, -{ PROC_LINKS(paste_next_and_indent, 0), false, "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "c:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 120 }, -{ PROC_LINKS(place_in_scope, 0), false, "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 106 }, -{ PROC_LINKS(profile_clear, 0), false, "profile_clear", 13, "Clear all profiling information from 4coder's self profiler.", 60, "c:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 226 }, -{ PROC_LINKS(profile_disable, 0), false, "profile_disable", 15, "Prevent 4coder's self profiler from gathering new profiling information.", 72, "c:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 219 }, -{ PROC_LINKS(profile_enable, 0), false, "profile_enable", 14, "Allow 4coder's self profiler to gather new profiling information.", 65, "c:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 212 }, -{ PROC_LINKS(profile_inspect, 0), true, "profile_inspect", 15, "Inspect all currently collected profiling information in 4coder's self profiler.", 80, "c:\\4ed\\code\\custom\\4coder_profile_inspect.cpp", 45, 886 }, -{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1289 }, -{ PROC_LINKS(project_fkey_command, 0), false, "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 870 }, -{ PROC_LINKS(project_go_to_root_directory, 0), false, "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 896 }, -{ PROC_LINKS(query_replace, 0), false, "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1158 }, -{ PROC_LINKS(query_replace_identifier, 0), false, "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1179 }, -{ PROC_LINKS(query_replace_selection, 0), false, "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1195 }, -{ PROC_LINKS(redo, 0), false, "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1637 }, -{ PROC_LINKS(redo_all_buffers, 0), false, "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1722 }, -{ PROC_LINKS(rename_file_query, 0), false, "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1307 }, -{ PROC_LINKS(reopen, 0), false, "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1566 }, -{ PROC_LINKS(replace_in_all_buffers, 0), false, "replace_in_all_buffers", 22, "Queries the user for a needle and string. Replaces all occurences of needle with string in all editable buffers.", 112, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1068 }, -{ PROC_LINKS(replace_in_buffer, 0), false, "replace_in_buffer", 17, "Queries the user for a needle and string. Replaces all occurences of needle with string in the active buffer.", 109, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1059 }, -{ PROC_LINKS(replace_in_range, 0), false, "replace_in_range", 16, "Queries the user for a needle and string. Replaces all occurences of needle with string in the range between cursor and the mark in the active buffer.", 150, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1050 }, -{ PROC_LINKS(reverse_search, 0), false, "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 991 }, -{ PROC_LINKS(reverse_search_identifier, 0), false, "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1003 }, -{ PROC_LINKS(save, 0), false, "save", 4, "Saves the current buffer.", 25, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1556 }, -{ PROC_LINKS(save_all_dirty_buffers, 0), false, "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 382 }, -{ PROC_LINKS(save_to_query, 0), false, "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1274 }, -{ PROC_LINKS(search, 0), false, "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 985 }, -{ PROC_LINKS(search_identifier, 0), false, "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 997 }, -{ PROC_LINKS(seek_beginning_of_line, 0), false, "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "c:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2172 }, -{ PROC_LINKS(seek_beginning_of_textual_line, 0), false, "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "c:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2160 }, -{ PROC_LINKS(seek_end_of_line, 0), false, "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "c:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2178 }, -{ PROC_LINKS(seek_end_of_textual_line, 0), false, "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "c:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2166 }, -{ PROC_LINKS(select_all, 0), false, "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 548 }, -{ PROC_LINKS(select_next_scope_absolute, 0), false, "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 57 }, -{ PROC_LINKS(select_next_scope_after_current, 0), false, "select_next_scope_after_current", 31, "If a scope is selected, find first scope that starts after the selected scope. Otherwise find the first scope that starts after the cursor.", 139, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 66 }, -{ PROC_LINKS(select_prev_scope_absolute, 0), false, "select_prev_scope_absolute", 26, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 82 }, -{ PROC_LINKS(select_prev_top_most_scope, 0), false, "select_prev_top_most_scope", 26, "Finds the first scope that starts before the cursor, then finds the top most scope that contains that scope.", 108, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 99 }, -{ PROC_LINKS(select_surrounding_scope, 0), false, "select_surrounding_scope", 24, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 27 }, -{ PROC_LINKS(select_surrounding_scope_maximal, 0), false, "select_surrounding_scope_maximal", 32, "Selects the top-most scope that surrounds the cursor.", 53, "c:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 39 }, -{ PROC_LINKS(set_eol_mode_from_contents, 0), false, "set_eol_mode_from_contents", 26, "Sets the buffer's line ending mode to match the contents of the buffer.", 71, "c:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 125 }, -{ PROC_LINKS(set_eol_mode_to_binary, 0), false, "set_eol_mode_to_binary", 22, "Puts the buffer in bin line ending mode.", 40, "c:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 112 }, -{ PROC_LINKS(set_eol_mode_to_crlf, 0), false, "set_eol_mode_to_crlf", 20, "Puts the buffer in crlf line ending mode.", 41, "c:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 86 }, -{ PROC_LINKS(set_eol_mode_to_lf, 0), false, "set_eol_mode_to_lf", 18, "Puts the buffer in lf line ending mode.", 39, "c:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 99 }, -{ PROC_LINKS(set_mark, 0), false, "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 126 }, -{ PROC_LINKS(set_mode_to_notepad_like, 0), false, "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 427 }, -{ PROC_LINKS(set_mode_to_original, 0), false, "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 421 }, -{ PROC_LINKS(setup_build_bat, 0), false, "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1237 }, -{ PROC_LINKS(setup_build_bat_and_sh, 0), false, "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1249 }, -{ PROC_LINKS(setup_build_sh, 0), false, "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1243 }, -{ PROC_LINKS(setup_new_project, 0), false, "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "c:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1230 }, -{ PROC_LINKS(show_filebar, 0), false, "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 653 }, -{ PROC_LINKS(show_scrollbar, 0), false, "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 639 }, -{ PROC_LINKS(show_the_log_graph, 0), true, "show_the_log_graph", 18, "Parses *log* and displays the 'log graph' UI", 44, "c:\\4ed\\code\\custom\\4coder_log_parser.cpp", 40, 994 }, -{ PROC_LINKS(snipe_backward_whitespace_or_token_boundary, 0), false, "snipe_backward_whitespace_or_token_boundary", 43, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 190 }, -{ PROC_LINKS(snipe_forward_whitespace_or_token_boundary, 0), false, "snipe_forward_whitespace_or_token_boundary", 42, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 198 }, -{ PROC_LINKS(snippet_lister, 0), true, "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 237 }, -{ PROC_LINKS(suppress_mouse, 0), false, "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 403 }, -{ PROC_LINKS(swap_panels, 0), false, "swap_panels", 11, "Swaps the active panel with it's sibling.", 41, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1524 }, -{ PROC_LINKS(test_double_backspace, 0), false, "test_double_backspace", 21, "Made for testing purposes (I should have deleted this if you are reading it let me know)", 88, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 115 }, -{ PROC_LINKS(theme_lister, 0), true, "theme_lister", 12, "Opens an interactive list of all registered themes.", 51, "c:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 785 }, -{ PROC_LINKS(to_lowercase, 0), false, "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 574 }, -{ PROC_LINKS(to_uppercase, 0), false, "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 561 }, -{ PROC_LINKS(toggle_filebar, 0), false, "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 667 }, -{ PROC_LINKS(toggle_fps_meter, 0), false, "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 676 }, -{ PROC_LINKS(toggle_fullscreen, 0), false, "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 451 }, -{ PROC_LINKS(toggle_highlight_enclosing_scopes, 0), false, "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 439 }, -{ PROC_LINKS(toggle_highlight_line_at_cursor, 0), false, "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 433 }, -{ PROC_LINKS(toggle_line_numbers, 0), false, "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 730 }, -{ PROC_LINKS(toggle_line_wrap, 0), false, "toggle_line_wrap", 16, "Toggles the line wrap setting on this buffer.", 45, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 736 }, -{ PROC_LINKS(toggle_mouse, 0), false, "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 415 }, -{ PROC_LINKS(toggle_paren_matching_helper, 0), false, "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "c:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 445 }, -{ PROC_LINKS(toggle_show_whitespace, 0), false, "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 721 }, -{ PROC_LINKS(toggle_virtual_whitespace, 0), false, "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "c:\\4ed\\code\\custom\\4coder_code_index.cpp", 40, 1170 }, -{ PROC_LINKS(tutorial_maximize, 0), false, "tutorial_maximize", 17, "Expand the tutorial window", 26, "c:\\4ed\\code\\custom\\4coder_tutorial.cpp", 38, 20 }, -{ PROC_LINKS(tutorial_minimize, 0), false, "tutorial_minimize", 17, "Shrink the tutorial window", 26, "c:\\4ed\\code\\custom\\4coder_tutorial.cpp", 38, 34 }, -{ PROC_LINKS(uncomment_line, 0), false, "uncomment_line", 14, "If present, delete '//' at the beginning of the line after leading whitespace.", 78, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 137 }, -{ PROC_LINKS(undo, 0), false, "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1624 }, -{ PROC_LINKS(undo_all_buffers, 0), false, "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1651 }, -{ PROC_LINKS(view_buffer_other_panel, 0), false, "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1512 }, -{ PROC_LINKS(view_jump_list_with_lister, 0), false, "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "c:\\4ed\\code\\custom\\4coder_jump_lister.cpp", 41, 59 }, -{ PROC_LINKS(word_complete, 0), false, "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 395 }, -{ PROC_LINKS(word_complete_drop_down, 0), false, "word_complete_drop_down", 23, "Word complete with drop down menu.", 34, "c:\\4ed\\code\\custom\\4coder_search.cpp", 36, 642 }, -{ PROC_LINKS(write_block, 0), false, "write_block", 11, "At the cursor, insert a block comment.", 38, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 94 }, -{ PROC_LINKS(write_hack, 0), false, "write_hack", 10, "At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.", 99, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 82 }, -{ PROC_LINKS(write_note, 0), false, "write_note", 10, "At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.", 99, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 88 }, -{ PROC_LINKS(write_space, 0), false, "write_space", 11, "Inserts a space.", 16, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 67 }, -{ PROC_LINKS(write_text_and_auto_indent, 0), false, "write_text_and_auto_indent", 26, "Inserts text and auto-indents the line on which the cursor sits if any of the text contains 'layout punctuation' such as ;:{}()[]# and new lines.", 145, "c:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 427 }, -{ PROC_LINKS(write_text_input, 0), false, "write_text_input", 16, "Inserts whatever text was used to trigger this command.", 55, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 59 }, -{ PROC_LINKS(write_todo, 0), false, "write_todo", 10, "At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder.", 99, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 76 }, -{ PROC_LINKS(write_underscore, 0), false, "write_underscore", 16, "Inserts an underscore.", 22, "c:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 73 }, -{ PROC_LINKS(write_zero_struct, 0), false, "write_zero_struct", 17, "At the cursor, insert a ' = {};'.", 33, "c:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 100 }, +static Command_Metadata fcoder_metacmd_table[238] = { +{ PROC_LINKS(allow_mouse, 0), false, "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 409 }, +{ PROC_LINKS(auto_indent_line_at_cursor, 0), false, "auto_indent_line_at_cursor", 26, "Auto-indents the line on which the cursor sits.", 47, "W:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 413 }, +{ PROC_LINKS(auto_indent_range, 0), false, "auto_indent_range", 17, "Auto-indents the range between the cursor and the mark.", 55, "W:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 423 }, +{ PROC_LINKS(auto_indent_whole_file, 0), false, "auto_indent_whole_file", 22, "Audo-indents the entire current buffer.", 39, "W:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 404 }, +{ PROC_LINKS(backspace_alpha_numeric_boundary, 0), false, "backspace_alpha_numeric_boundary", 32, "Delete characters between the cursor position and the first alphanumeric boundary to the left.", 94, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 165 }, +{ PROC_LINKS(backspace_char, 0), false, "backspace_char", 14, "Deletes the character to the left of the cursor.", 48, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 96 }, +{ PROC_LINKS(basic_change_active_panel, 0), false, "basic_change_active_panel", 25, "Change the currently active panel, moving to the panel with the next highest view_id. Will not skipe the build panel if it is open.", 132, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 658 }, +{ PROC_LINKS(begin_clipboard_collection_mode, 0), true, "begin_clipboard_collection_mode", 31, "Allows the user to copy multiple strings from other applications before switching to 4coder and pasting them all.", 113, "W:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 68 }, +{ PROC_LINKS(build_in_build_panel, 0), false, "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "W:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 159 }, +{ PROC_LINKS(build_search, 0), false, "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "W:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 122 }, +{ PROC_LINKS(center_view, 0), false, "center_view", 11, "Centers the view vertically on the line on which the cursor sits.", 65, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 208 }, +{ PROC_LINKS(change_active_panel, 0), false, "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 284 }, +{ PROC_LINKS(change_active_panel_backwards, 0), false, "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 290 }, +{ PROC_LINKS(change_to_build_panel, 0), false, "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "W:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 180 }, +{ PROC_LINKS(clean_all_lines, 0), false, "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 647 }, +{ PROC_LINKS(clear_all_themes, 0), false, "clear_all_themes", 16, "Clear the theme list", 20, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 480 }, +{ PROC_LINKS(clear_clipboard, 0), false, "clear_clipboard", 15, "Clears the history of the clipboard", 35, "W:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 216 }, +{ PROC_LINKS(click_set_cursor, 0), false, "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 244 }, +{ PROC_LINKS(click_set_cursor_and_mark, 0), false, "click_set_cursor_and_mark", 25, "Sets the cursor position and mark to the mouse position.", 56, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 234 }, +{ PROC_LINKS(click_set_cursor_if_lbutton, 0), false, "click_set_cursor_if_lbutton", 27, "If the mouse left button is pressed, sets the cursor position to the mouse position.", 84, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 254 }, +{ PROC_LINKS(click_set_mark, 0), false, "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 266 }, +{ PROC_LINKS(clipboard_record_clip, 0), false, "clipboard_record_clip", 21, "In response to a new clipboard contents events, saves the new clip onto the clipboard history", 93, "W:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 7 }, +{ PROC_LINKS(close_all_code, 0), false, "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 843 }, +{ PROC_LINKS(close_build_panel, 0), false, "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "W:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 174 }, +{ PROC_LINKS(close_panel, 0), false, "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 666 }, +{ PROC_LINKS(command_documentation, 0), true, "command_documentation", 21, "Prompts the user to select a command then loads a doc buffer for that item", 74, "W:\\4ed\\code\\custom\\4coder_docs.cpp", 34, 190 }, +{ PROC_LINKS(command_lister, 0), true, "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "W:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 761 }, +{ PROC_LINKS(comment_line, 0), false, "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "W:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 125 }, +{ PROC_LINKS(comment_line_toggle, 0), false, "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "W:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 149 }, +{ PROC_LINKS(copy, 0), false, "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "W:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 107 }, +{ PROC_LINKS(cursor_mark_swap, 0), false, "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 135 }, +{ PROC_LINKS(custom_api_documentation, 0), true, "custom_api_documentation", 24, "Prompts the user to select a Custom API item then loads a doc buffer for that item", 82, "W:\\4ed\\code\\custom\\4coder_docs.cpp", 34, 175 }, +{ PROC_LINKS(cut, 0), false, "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "W:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 116 }, +{ PROC_LINKS(decrease_face_size, 0), false, "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 749 }, +{ PROC_LINKS(default_file_externally_modified, 0), false, "default_file_externally_modified", 32, "Notes the external modification of attached files by printing a message.", 72, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1891 }, +{ PROC_LINKS(default_startup, 0), false, "default_startup", 15, "Default command for responding to a startup event", 49, "W:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 7 }, +{ PROC_LINKS(default_try_exit, 0), false, "default_try_exit", 16, "Default command for responding to a try-exit event", 50, "W:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 23 }, +{ PROC_LINKS(default_view_input_handler, 0), false, "default_view_input_handler", 26, "Input consumption loop for default view behavior", 48, "W:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 51 }, +{ PROC_LINKS(delete_alpha_numeric_boundary, 0), false, "delete_alpha_numeric_boundary", 29, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 173 }, +{ PROC_LINKS(delete_char, 0), false, "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 79 }, +{ PROC_LINKS(delete_current_scope, 0), false, "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "W:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 112 }, +{ PROC_LINKS(delete_file_query, 0), false, "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1317 }, +{ PROC_LINKS(delete_line, 0), false, "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1489 }, +{ PROC_LINKS(delete_range, 0), false, "delete_range", 12, "Deletes the text in the range between the cursor and the mark.", 62, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 145 }, +{ PROC_LINKS(duplicate_line, 0), false, "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1475 }, +{ PROC_LINKS(execute_any_cli, 0), false, "execute_any_cli", 15, "Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.", 133, "W:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 22 }, +{ PROC_LINKS(execute_previous_cli, 0), false, "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "W:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 7 }, +{ PROC_LINKS(exit_4coder, 0), false, "exit_4coder", 11, "Attempts to close 4coder.", 25, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 836 }, +{ PROC_LINKS(goto_beginning_of_file, 0), false, "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2201 }, +{ PROC_LINKS(goto_end_of_file, 0), false, "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2209 }, +{ PROC_LINKS(goto_first_jump, 0), false, "goto_first_jump", 15, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 525 }, +{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), false, "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 542 }, +{ PROC_LINKS(goto_jump_at_cursor, 0), false, "goto_jump_at_cursor", 19, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 348 }, +{ PROC_LINKS(goto_jump_at_cursor_same_panel, 0), false, "goto_jump_at_cursor_same_panel", 30, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list.", 167, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 375 }, +{ PROC_LINKS(goto_line, 0), false, "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 844 }, +{ PROC_LINKS(goto_next_jump, 0), false, "goto_next_jump", 14, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 464 }, +{ PROC_LINKS(goto_next_jump_no_skips, 0), false, "goto_next_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 494 }, +{ PROC_LINKS(goto_prev_jump, 0), false, "goto_prev_jump", 14, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 481 }, +{ PROC_LINKS(goto_prev_jump_no_skips, 0), false, "goto_prev_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 511 }, +{ PROC_LINKS(hide_filebar, 0), false, "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 696 }, +{ PROC_LINKS(hide_scrollbar, 0), false, "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 682 }, +{ PROC_LINKS(hms_demo_tutorial, 0), false, "hms_demo_tutorial", 17, "Tutorial for built in 4coder bindings and features.", 51, "W:\\4ed\\code\\custom\\4coder_tutorial.cpp", 38, 869 }, +{ PROC_LINKS(if0_off, 0), false, "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "W:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 70 }, +{ PROC_LINKS(if_read_only_goto_position, 0), false, "if_read_only_goto_position", 26, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 564 }, +{ PROC_LINKS(if_read_only_goto_position_same_panel, 0), false, "if_read_only_goto_position_same_panel", 37, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 581 }, +{ PROC_LINKS(increase_face_size, 0), false, "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 738 }, +{ PROC_LINKS(interactive_kill_buffer, 0), true, "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "W:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 520 }, +{ PROC_LINKS(interactive_new, 0), true, "interactive_new", 15, "Interactively creates a new file.", 33, "W:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 661 }, +{ PROC_LINKS(interactive_open, 0), true, "interactive_open", 16, "Interactively opens a file.", 27, "W:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 715 }, +{ PROC_LINKS(interactive_open_or_new, 0), true, "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "W:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 612 }, +{ PROC_LINKS(interactive_switch_buffer, 0), true, "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "W:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 510 }, +{ PROC_LINKS(jump_to_definition, 0), true, "jump_to_definition", 18, "List all definitions in the code index and jump to one chosen by the user.", 74, "W:\\4ed\\code\\custom\\4coder_code_index_listers.cpp", 48, 12 }, +{ PROC_LINKS(keyboard_macro_finish_recording, 0), false, "keyboard_macro_finish_recording", 31, "Stop macro recording, do nothing if macro recording is not already started", 74, "W:\\4ed\\code\\custom\\4coder_keyboard_macro.cpp", 44, 54 }, +{ PROC_LINKS(keyboard_macro_replay, 0), false, "keyboard_macro_replay", 21, "Replay the most recently recorded keyboard macro", 48, "W:\\4ed\\code\\custom\\4coder_keyboard_macro.cpp", 44, 77 }, +{ PROC_LINKS(keyboard_macro_start_recording, 0), false, "keyboard_macro_start_recording", 30, "Start macro recording, do nothing if macro recording is already started", 71, "W:\\4ed\\code\\custom\\4coder_keyboard_macro.cpp", 44, 41 }, +{ PROC_LINKS(kill_buffer, 0), false, "kill_buffer", 11, "Kills the current buffer.", 25, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1635 }, +{ PROC_LINKS(kill_tutorial, 0), false, "kill_tutorial", 13, "If there is an active tutorial, kill it.", 40, "W:\\4ed\\code\\custom\\4coder_tutorial.cpp", 38, 9 }, +{ PROC_LINKS(left_adjust_view, 0), false, "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 222 }, +{ PROC_LINKS(list_all_functions_all_buffers, 0), false, "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "W:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 295 }, +{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), true, "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "W:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 301 }, +{ PROC_LINKS(list_all_functions_current_buffer, 0), false, "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "W:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 267 }, +{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), true, "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "W:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 277 }, +{ PROC_LINKS(list_all_locations, 0), false, "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 165 }, +{ PROC_LINKS(list_all_locations_case_insensitive, 0), false, "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 177 }, +{ PROC_LINKS(list_all_locations_of_identifier, 0), false, "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 189 }, +{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), false, "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 195 }, +{ PROC_LINKS(list_all_locations_of_selection, 0), false, "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 201 }, +{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), false, "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 207 }, +{ PROC_LINKS(list_all_locations_of_type_definition, 0), false, "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 213 }, +{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), false, "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 221 }, +{ PROC_LINKS(list_all_substring_locations, 0), false, "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 171 }, +{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), false, "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 183 }, +{ PROC_LINKS(load_project, 0), false, "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 863 }, +{ PROC_LINKS(load_theme_current_buffer, 0), false, "load_theme_current_buffer", 25, "Parse the current buffer as a theme file and add the theme to the theme list. If the buffer has a .4coder postfix in it's name, it is removed when the name is saved.", 165, "W:\\4ed\\code\\custom\\4coder_config.cpp", 36, 1627 }, +{ PROC_LINKS(load_themes_default_folder, 0), false, "load_themes_default_folder", 26, "Loads all the theme files in the default theme folder.", 54, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 457 }, +{ PROC_LINKS(load_themes_hot_directory, 0), false, "load_themes_hot_directory", 25, "Loads all the theme files in the current hot directory.", 55, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 469 }, +{ PROC_LINKS(make_directory_query, 0), false, "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1429 }, +{ PROC_LINKS(miblo_decrement_basic, 0), false, "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "W:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 44 }, +{ PROC_LINKS(miblo_decrement_time_stamp, 0), false, "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "W:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 237 }, +{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), false, "miblo_decrement_time_stamp_minute", 33, "Decrement a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "W:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 249 }, +{ PROC_LINKS(miblo_increment_basic, 0), false, "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "W:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 29 }, +{ PROC_LINKS(miblo_increment_time_stamp, 0), false, "miblo_increment_time_stamp", 26, "Increment a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "W:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 231 }, +{ PROC_LINKS(miblo_increment_time_stamp_minute, 0), false, "miblo_increment_time_stamp_minute", 33, "Increment a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "W:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 243 }, +{ PROC_LINKS(mouse_wheel_change_face_size, 0), false, "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 791 }, +{ PROC_LINKS(mouse_wheel_scroll, 0), false, "mouse_wheel_scroll", 18, "Reads the scroll wheel value from the mouse state and scrolls accordingly.", 74, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 276 }, +{ PROC_LINKS(move_down, 0), false, "move_down", 9, "Moves the cursor down one line.", 31, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 347 }, +{ PROC_LINKS(move_down_10, 0), false, "move_down_10", 12, "Moves the cursor down ten lines.", 32, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 359 }, +{ PROC_LINKS(move_down_textual, 0), false, "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 365 }, +{ PROC_LINKS(move_down_to_blank_line, 0), false, "move_down_to_blank_line", 23, "Seeks the cursor down to the next blank line.", 45, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 418 }, +{ PROC_LINKS(move_down_to_blank_line_end, 0), false, "move_down_to_blank_line_end", 27, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 442 }, +{ PROC_LINKS(move_down_to_blank_line_skip_whitespace, 0), false, "move_down_to_blank_line_skip_whitespace", 39, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 430 }, +{ PROC_LINKS(move_left, 0), false, "move_left", 9, "Moves the cursor one character to the left.", 43, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 448 }, +{ PROC_LINKS(move_left_alpha_numeric_boundary, 0), false, "move_left_alpha_numeric_boundary", 32, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 525 }, +{ PROC_LINKS(move_left_alpha_numeric_or_camel_boundary, 0), false, "move_left_alpha_numeric_or_camel_boundary", 41, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 539 }, +{ PROC_LINKS(move_left_token_boundary, 0), false, "move_left_token_boundary", 24, "Seek left for the next beginning of a token.", 44, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 497 }, +{ PROC_LINKS(move_left_whitespace_boundary, 0), false, "move_left_whitespace_boundary", 29, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 482 }, +{ PROC_LINKS(move_left_whitespace_or_token_boundary, 0), false, "move_left_whitespace_or_token_boundary", 38, "Seek left for the next end of a token or boundary between whitespace and non-whitespace.", 88, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 511 }, +{ PROC_LINKS(move_line_down, 0), false, "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1469 }, +{ PROC_LINKS(move_line_up, 0), false, "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1463 }, +{ PROC_LINKS(move_right, 0), false, "move_right", 10, "Moves the cursor one character to the right.", 44, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 456 }, +{ PROC_LINKS(move_right_alpha_numeric_boundary, 0), false, "move_right_alpha_numeric_boundary", 33, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 518 }, +{ PROC_LINKS(move_right_alpha_numeric_or_camel_boundary, 0), false, "move_right_alpha_numeric_or_camel_boundary", 42, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 532 }, +{ PROC_LINKS(move_right_token_boundary, 0), false, "move_right_token_boundary", 25, "Seek right for the next end of a token.", 39, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 490 }, +{ PROC_LINKS(move_right_whitespace_boundary, 0), false, "move_right_whitespace_boundary", 30, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 474 }, +{ PROC_LINKS(move_right_whitespace_or_token_boundary, 0), false, "move_right_whitespace_or_token_boundary", 39, "Seek right for the next end of a token or boundary between whitespace and non-whitespace.", 89, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 504 }, +{ PROC_LINKS(move_up, 0), false, "move_up", 7, "Moves the cursor up one line.", 29, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 341 }, +{ PROC_LINKS(move_up_10, 0), false, "move_up_10", 10, "Moves the cursor up ten lines.", 30, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 353 }, +{ PROC_LINKS(move_up_to_blank_line, 0), false, "move_up_to_blank_line", 21, "Seeks the cursor up to the next blank line.", 43, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 412 }, +{ PROC_LINKS(move_up_to_blank_line_end, 0), false, "move_up_to_blank_line_end", 25, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 436 }, +{ PROC_LINKS(move_up_to_blank_line_skip_whitespace, 0), false, "move_up_to_blank_line_skip_whitespace", 37, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 424 }, +{ PROC_LINKS(multi_paste_interactive, 0), false, "multi_paste_interactive", 23, "Paste multiple lines from the clipboard history, controlled with arrow keys", 75, "W:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 364 }, +{ PROC_LINKS(multi_paste_interactive_quick, 0), false, "multi_paste_interactive_quick", 29, "Paste multiple lines from the clipboard history, controlled by inputing the number of lines to paste", 100, "W:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 373 }, +{ PROC_LINKS(open_all_code, 0), false, "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 849 }, +{ PROC_LINKS(open_all_code_recursive, 0), false, "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 855 }, +{ PROC_LINKS(open_file_in_quotes, 0), false, "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1554 }, +{ PROC_LINKS(open_in_other, 0), false, "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1885 }, +{ PROC_LINKS(open_long_braces, 0), false, "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "W:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 46 }, +{ PROC_LINKS(open_long_braces_break, 0), false, "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "W:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 62 }, +{ PROC_LINKS(open_long_braces_semicolon, 0), false, "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "W:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 54 }, +{ PROC_LINKS(open_matching_file_cpp, 0), false, "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1586 }, +{ PROC_LINKS(open_panel_hsplit, 0), false, "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 310 }, +{ PROC_LINKS(open_panel_vsplit, 0), false, "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 300 }, +{ PROC_LINKS(page_down, 0), false, "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 383 }, +{ PROC_LINKS(page_up, 0), false, "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 375 }, +{ PROC_LINKS(paste, 0), false, "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "W:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 127 }, +{ PROC_LINKS(paste_and_indent, 0), false, "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "W:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 202 }, +{ PROC_LINKS(paste_next, 0), false, "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "W:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 161 }, +{ PROC_LINKS(paste_next_and_indent, 0), false, "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "W:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 209 }, +{ PROC_LINKS(place_in_scope, 0), false, "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "W:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 106 }, +{ PROC_LINKS(profile_clear, 0), false, "profile_clear", 13, "Clear all profiling information from 4coder's self profiler.", 60, "W:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 226 }, +{ PROC_LINKS(profile_disable, 0), false, "profile_disable", 15, "Prevent 4coder's self profiler from gathering new profiling information.", 72, "W:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 219 }, +{ PROC_LINKS(profile_enable, 0), false, "profile_enable", 14, "Allow 4coder's self profiler to gather new profiling information.", 65, "W:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 212 }, +{ PROC_LINKS(profile_inspect, 0), true, "profile_inspect", 15, "Inspect all currently collected profiling information in 4coder's self profiler.", 80, "W:\\4ed\\code\\custom\\4coder_profile_inspect.cpp", 45, 886 }, +{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1290 }, +{ PROC_LINKS(project_fkey_command, 0), false, "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 871 }, +{ PROC_LINKS(project_go_to_root_directory, 0), false, "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 897 }, +{ PROC_LINKS(query_replace, 0), false, "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1245 }, +{ PROC_LINKS(query_replace_identifier, 0), false, "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1266 }, +{ PROC_LINKS(query_replace_selection, 0), false, "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1282 }, +{ PROC_LINKS(redo, 0), false, "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1724 }, +{ PROC_LINKS(redo_all_buffers, 0), false, "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1809 }, +{ PROC_LINKS(rename_file_query, 0), false, "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1394 }, +{ PROC_LINKS(reopen, 0), false, "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1653 }, +{ PROC_LINKS(replace_in_all_buffers, 0), false, "replace_in_all_buffers", 22, "Queries the user for a needle and string. Replaces all occurences of needle with string in all editable buffers.", 112, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1155 }, +{ PROC_LINKS(replace_in_buffer, 0), false, "replace_in_buffer", 17, "Queries the user for a needle and string. Replaces all occurences of needle with string in the active buffer.", 109, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1146 }, +{ PROC_LINKS(replace_in_range, 0), false, "replace_in_range", 16, "Queries the user for a needle and string. Replaces all occurences of needle with string in the range between cursor and the mark in the active buffer.", 150, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1137 }, +{ PROC_LINKS(reverse_search, 0), false, "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1078 }, +{ PROC_LINKS(reverse_search_identifier, 0), false, "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1090 }, +{ PROC_LINKS(save, 0), false, "save", 4, "Saves the current buffer.", 25, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1643 }, +{ PROC_LINKS(save_all_dirty_buffers, 0), false, "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 382 }, +{ PROC_LINKS(save_to_query, 0), false, "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1361 }, +{ PROC_LINKS(search, 0), false, "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1072 }, +{ PROC_LINKS(search_identifier, 0), false, "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1084 }, +{ PROC_LINKS(seek_beginning_of_line, 0), false, "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2189 }, +{ PROC_LINKS(seek_beginning_of_textual_line, 0), false, "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2177 }, +{ PROC_LINKS(seek_end_of_line, 0), false, "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2195 }, +{ PROC_LINKS(seek_end_of_textual_line, 0), false, "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "W:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2183 }, +{ PROC_LINKS(select_all, 0), false, "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 548 }, +{ PROC_LINKS(select_next_scope_absolute, 0), false, "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "W:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 57 }, +{ PROC_LINKS(select_next_scope_after_current, 0), false, "select_next_scope_after_current", 31, "If a scope is selected, find first scope that starts after the selected scope. Otherwise find the first scope that starts after the cursor.", 139, "W:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 66 }, +{ PROC_LINKS(select_prev_scope_absolute, 0), false, "select_prev_scope_absolute", 26, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "W:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 82 }, +{ PROC_LINKS(select_prev_top_most_scope, 0), false, "select_prev_top_most_scope", 26, "Finds the first scope that starts before the cursor, then finds the top most scope that contains that scope.", 108, "W:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 99 }, +{ PROC_LINKS(select_surrounding_scope, 0), false, "select_surrounding_scope", 24, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "W:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 27 }, +{ PROC_LINKS(select_surrounding_scope_maximal, 0), false, "select_surrounding_scope_maximal", 32, "Selects the top-most scope that surrounds the cursor.", 53, "W:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 39 }, +{ PROC_LINKS(set_eol_mode_from_contents, 0), false, "set_eol_mode_from_contents", 26, "Sets the buffer's line ending mode to match the contents of the buffer.", 71, "W:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 125 }, +{ PROC_LINKS(set_eol_mode_to_binary, 0), false, "set_eol_mode_to_binary", 22, "Puts the buffer in bin line ending mode.", 40, "W:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 112 }, +{ PROC_LINKS(set_eol_mode_to_crlf, 0), false, "set_eol_mode_to_crlf", 20, "Puts the buffer in crlf line ending mode.", 41, "W:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 86 }, +{ PROC_LINKS(set_eol_mode_to_lf, 0), false, "set_eol_mode_to_lf", 18, "Puts the buffer in lf line ending mode.", 39, "W:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 99 }, +{ PROC_LINKS(set_face_size, 0), false, "set_face_size", 13, "Set face size of the face used by the current buffer.", 53, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 718 }, +{ PROC_LINKS(set_face_size_this_buffer, 0), false, "set_face_size_this_buffer", 25, "Set face size of the face used by the current buffer; if any other buffers are using the same face a new face is created so that only this buffer is effected", 157, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 760 }, +{ PROC_LINKS(set_mark, 0), false, "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 126 }, +{ PROC_LINKS(set_mode_to_notepad_like, 0), false, "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 427 }, +{ PROC_LINKS(set_mode_to_original, 0), false, "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 421 }, +{ PROC_LINKS(setup_build_bat, 0), false, "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1238 }, +{ PROC_LINKS(setup_build_bat_and_sh, 0), false, "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1250 }, +{ PROC_LINKS(setup_build_sh, 0), false, "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1244 }, +{ PROC_LINKS(setup_new_project, 0), false, "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1231 }, +{ PROC_LINKS(show_filebar, 0), false, "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 689 }, +{ PROC_LINKS(show_scrollbar, 0), false, "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 675 }, +{ PROC_LINKS(show_the_log_graph, 0), true, "show_the_log_graph", 18, "Parses *log* and displays the 'log graph' UI", 44, "W:\\4ed\\code\\custom\\4coder_log_parser.cpp", 40, 994 }, +{ PROC_LINKS(snipe_backward_whitespace_or_token_boundary, 0), false, "snipe_backward_whitespace_or_token_boundary", 43, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 190 }, +{ PROC_LINKS(snipe_forward_whitespace_or_token_boundary, 0), false, "snipe_forward_whitespace_or_token_boundary", 42, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 198 }, +{ PROC_LINKS(snippet_lister, 0), true, "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "W:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 237 }, +{ PROC_LINKS(suppress_mouse, 0), false, "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 403 }, +{ PROC_LINKS(swap_panels, 0), false, "swap_panels", 11, "Swaps the active panel with it's sibling.", 41, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1611 }, +{ PROC_LINKS(test_double_backspace, 0), false, "test_double_backspace", 21, "Made for testing purposes (I should have deleted this if you are reading it let me know)", 88, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 115 }, +{ PROC_LINKS(theme_lister, 0), true, "theme_lister", 12, "Opens an interactive list of all registered themes.", 51, "W:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 785 }, +{ PROC_LINKS(to_lowercase, 0), false, "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 574 }, +{ PROC_LINKS(to_uppercase, 0), false, "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 561 }, +{ PROC_LINKS(toggle_filebar, 0), false, "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 703 }, +{ PROC_LINKS(toggle_fps_meter, 0), false, "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 712 }, +{ PROC_LINKS(toggle_fullscreen, 0), false, "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 451 }, +{ PROC_LINKS(toggle_highlight_enclosing_scopes, 0), false, "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 439 }, +{ PROC_LINKS(toggle_highlight_line_at_cursor, 0), false, "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 433 }, +{ PROC_LINKS(toggle_line_numbers, 0), false, "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 817 }, +{ PROC_LINKS(toggle_line_wrap, 0), false, "toggle_line_wrap", 16, "Toggles the line wrap setting on this buffer.", 45, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 823 }, +{ PROC_LINKS(toggle_mouse, 0), false, "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 415 }, +{ PROC_LINKS(toggle_paren_matching_helper, 0), false, "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 445 }, +{ PROC_LINKS(toggle_show_whitespace, 0), false, "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 808 }, +{ PROC_LINKS(toggle_virtual_whitespace, 0), false, "toggle_virtual_whitespace", 25, "Toggles virtual whitespace for all files.", 41, "W:\\4ed\\code\\custom\\4coder_code_index.cpp", 40, 1175 }, +{ PROC_LINKS(tutorial_maximize, 0), false, "tutorial_maximize", 17, "Expand the tutorial window", 26, "W:\\4ed\\code\\custom\\4coder_tutorial.cpp", 38, 20 }, +{ PROC_LINKS(tutorial_minimize, 0), false, "tutorial_minimize", 17, "Shrink the tutorial window", 26, "W:\\4ed\\code\\custom\\4coder_tutorial.cpp", 38, 34 }, +{ PROC_LINKS(uncomment_line, 0), false, "uncomment_line", 14, "If present, delete '//' at the beginning of the line after leading whitespace.", 78, "W:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 137 }, +{ PROC_LINKS(undo, 0), false, "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1711 }, +{ PROC_LINKS(undo_all_buffers, 0), false, "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1738 }, +{ PROC_LINKS(view_buffer_other_panel, 0), false, "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1599 }, +{ PROC_LINKS(view_jump_list_with_lister, 0), false, "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "W:\\4ed\\code\\custom\\4coder_jump_lister.cpp", 41, 59 }, +{ PROC_LINKS(word_complete, 0), false, "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 395 }, +{ PROC_LINKS(word_complete_drop_down, 0), false, "word_complete_drop_down", 23, "Word complete with drop down menu.", 34, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 642 }, +{ PROC_LINKS(write_block, 0), false, "write_block", 11, "At the cursor, insert a block comment.", 38, "W:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 94 }, +{ PROC_LINKS(write_hack, 0), false, "write_hack", 10, "At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.", 99, "W:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 82 }, +{ PROC_LINKS(write_note, 0), false, "write_note", 10, "At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.", 99, "W:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 88 }, +{ PROC_LINKS(write_space, 0), false, "write_space", 11, "Inserts a space.", 16, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 67 }, +{ PROC_LINKS(write_text_and_auto_indent, 0), false, "write_text_and_auto_indent", 26, "Inserts text and auto-indents the line on which the cursor sits if any of the text contains 'layout punctuation' such as ;:{}()[]# and new lines.", 145, "W:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 433 }, +{ PROC_LINKS(write_text_input, 0), false, "write_text_input", 16, "Inserts whatever text was used to trigger this command.", 55, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 59 }, +{ PROC_LINKS(write_todo, 0), false, "write_todo", 10, "At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder.", 99, "W:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 76 }, +{ PROC_LINKS(write_underscore, 0), false, "write_underscore", 16, "Inserts an underscore.", 22, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 73 }, +{ PROC_LINKS(write_zero_struct, 0), false, "write_zero_struct", 17, "At the cursor, insert a ' = {};'.", 33, "W:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 100 }, }; static i32 fcoder_metacmd_ID_allow_mouse = 0; static i32 fcoder_metacmd_ID_auto_indent_line_at_cursor = 1; @@ -492,228 +506,235 @@ static i32 fcoder_metacmd_ID_auto_indent_whole_file = 3; static i32 fcoder_metacmd_ID_backspace_alpha_numeric_boundary = 4; static i32 fcoder_metacmd_ID_backspace_char = 5; static i32 fcoder_metacmd_ID_basic_change_active_panel = 6; -static i32 fcoder_metacmd_ID_build_in_build_panel = 7; -static i32 fcoder_metacmd_ID_build_search = 8; -static i32 fcoder_metacmd_ID_center_view = 9; -static i32 fcoder_metacmd_ID_change_active_panel = 10; -static i32 fcoder_metacmd_ID_change_active_panel_backwards = 11; -static i32 fcoder_metacmd_ID_change_to_build_panel = 12; -static i32 fcoder_metacmd_ID_clean_all_lines = 13; -static i32 fcoder_metacmd_ID_clear_all_themes = 14; -static i32 fcoder_metacmd_ID_click_set_cursor = 15; -static i32 fcoder_metacmd_ID_click_set_cursor_and_mark = 16; -static i32 fcoder_metacmd_ID_click_set_cursor_if_lbutton = 17; -static i32 fcoder_metacmd_ID_click_set_mark = 18; -static i32 fcoder_metacmd_ID_close_all_code = 19; -static i32 fcoder_metacmd_ID_close_build_panel = 20; -static i32 fcoder_metacmd_ID_close_panel = 21; -static i32 fcoder_metacmd_ID_command_documentation = 22; -static i32 fcoder_metacmd_ID_command_lister = 23; -static i32 fcoder_metacmd_ID_comment_line = 24; -static i32 fcoder_metacmd_ID_comment_line_toggle = 25; -static i32 fcoder_metacmd_ID_copy = 26; -static i32 fcoder_metacmd_ID_cursor_mark_swap = 27; -static i32 fcoder_metacmd_ID_custom_api_documentation = 28; -static i32 fcoder_metacmd_ID_cut = 29; -static i32 fcoder_metacmd_ID_decrease_face_size = 30; -static i32 fcoder_metacmd_ID_default_file_externally_modified = 31; -static i32 fcoder_metacmd_ID_default_startup = 32; -static i32 fcoder_metacmd_ID_default_try_exit = 33; -static i32 fcoder_metacmd_ID_default_view_input_handler = 34; -static i32 fcoder_metacmd_ID_delete_alpha_numeric_boundary = 35; -static i32 fcoder_metacmd_ID_delete_char = 36; -static i32 fcoder_metacmd_ID_delete_current_scope = 37; -static i32 fcoder_metacmd_ID_delete_file_query = 38; -static i32 fcoder_metacmd_ID_delete_line = 39; -static i32 fcoder_metacmd_ID_delete_range = 40; -static i32 fcoder_metacmd_ID_duplicate_line = 41; -static i32 fcoder_metacmd_ID_execute_any_cli = 42; -static i32 fcoder_metacmd_ID_execute_previous_cli = 43; -static i32 fcoder_metacmd_ID_exit_4coder = 44; -static i32 fcoder_metacmd_ID_goto_beginning_of_file = 45; -static i32 fcoder_metacmd_ID_goto_end_of_file = 46; -static i32 fcoder_metacmd_ID_goto_first_jump = 47; -static i32 fcoder_metacmd_ID_goto_first_jump_same_panel_sticky = 48; -static i32 fcoder_metacmd_ID_goto_jump_at_cursor = 49; -static i32 fcoder_metacmd_ID_goto_jump_at_cursor_same_panel = 50; -static i32 fcoder_metacmd_ID_goto_line = 51; -static i32 fcoder_metacmd_ID_goto_next_jump = 52; -static i32 fcoder_metacmd_ID_goto_next_jump_no_skips = 53; -static i32 fcoder_metacmd_ID_goto_prev_jump = 54; -static i32 fcoder_metacmd_ID_goto_prev_jump_no_skips = 55; -static i32 fcoder_metacmd_ID_hide_filebar = 56; -static i32 fcoder_metacmd_ID_hide_scrollbar = 57; -static i32 fcoder_metacmd_ID_hms_demo_tutorial = 58; -static i32 fcoder_metacmd_ID_if0_off = 59; -static i32 fcoder_metacmd_ID_if_read_only_goto_position = 60; -static i32 fcoder_metacmd_ID_if_read_only_goto_position_same_panel = 61; -static i32 fcoder_metacmd_ID_increase_face_size = 62; -static i32 fcoder_metacmd_ID_interactive_kill_buffer = 63; -static i32 fcoder_metacmd_ID_interactive_new = 64; -static i32 fcoder_metacmd_ID_interactive_open = 65; -static i32 fcoder_metacmd_ID_interactive_open_or_new = 66; -static i32 fcoder_metacmd_ID_interactive_switch_buffer = 67; -static i32 fcoder_metacmd_ID_jump_to_definition = 68; -static i32 fcoder_metacmd_ID_keyboard_macro_finish_recording = 69; -static i32 fcoder_metacmd_ID_keyboard_macro_replay = 70; -static i32 fcoder_metacmd_ID_keyboard_macro_start_recording = 71; -static i32 fcoder_metacmd_ID_kill_buffer = 72; -static i32 fcoder_metacmd_ID_kill_tutorial = 73; -static i32 fcoder_metacmd_ID_left_adjust_view = 74; -static i32 fcoder_metacmd_ID_list_all_functions_all_buffers = 75; -static i32 fcoder_metacmd_ID_list_all_functions_all_buffers_lister = 76; -static i32 fcoder_metacmd_ID_list_all_functions_current_buffer = 77; -static i32 fcoder_metacmd_ID_list_all_functions_current_buffer_lister = 78; -static i32 fcoder_metacmd_ID_list_all_locations = 79; -static i32 fcoder_metacmd_ID_list_all_locations_case_insensitive = 80; -static i32 fcoder_metacmd_ID_list_all_locations_of_identifier = 81; -static i32 fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 82; -static i32 fcoder_metacmd_ID_list_all_locations_of_selection = 83; -static i32 fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 84; -static i32 fcoder_metacmd_ID_list_all_locations_of_type_definition = 85; -static i32 fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 86; -static i32 fcoder_metacmd_ID_list_all_substring_locations = 87; -static i32 fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 88; -static i32 fcoder_metacmd_ID_load_project = 89; -static i32 fcoder_metacmd_ID_load_theme_current_buffer = 90; -static i32 fcoder_metacmd_ID_load_themes_default_folder = 91; -static i32 fcoder_metacmd_ID_load_themes_hot_directory = 92; -static i32 fcoder_metacmd_ID_make_directory_query = 93; -static i32 fcoder_metacmd_ID_miblo_decrement_basic = 94; -static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp = 95; -static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp_minute = 96; -static i32 fcoder_metacmd_ID_miblo_increment_basic = 97; -static i32 fcoder_metacmd_ID_miblo_increment_time_stamp = 98; -static i32 fcoder_metacmd_ID_miblo_increment_time_stamp_minute = 99; -static i32 fcoder_metacmd_ID_mouse_wheel_change_face_size = 100; -static i32 fcoder_metacmd_ID_mouse_wheel_scroll = 101; -static i32 fcoder_metacmd_ID_move_down = 102; -static i32 fcoder_metacmd_ID_move_down_10 = 103; -static i32 fcoder_metacmd_ID_move_down_textual = 104; -static i32 fcoder_metacmd_ID_move_down_to_blank_line = 105; -static i32 fcoder_metacmd_ID_move_down_to_blank_line_end = 106; -static i32 fcoder_metacmd_ID_move_down_to_blank_line_skip_whitespace = 107; -static i32 fcoder_metacmd_ID_move_left = 108; -static i32 fcoder_metacmd_ID_move_left_alpha_numeric_boundary = 109; -static i32 fcoder_metacmd_ID_move_left_alpha_numeric_or_camel_boundary = 110; -static i32 fcoder_metacmd_ID_move_left_token_boundary = 111; -static i32 fcoder_metacmd_ID_move_left_whitespace_boundary = 112; -static i32 fcoder_metacmd_ID_move_left_whitespace_or_token_boundary = 113; -static i32 fcoder_metacmd_ID_move_line_down = 114; -static i32 fcoder_metacmd_ID_move_line_up = 115; -static i32 fcoder_metacmd_ID_move_right = 116; -static i32 fcoder_metacmd_ID_move_right_alpha_numeric_boundary = 117; -static i32 fcoder_metacmd_ID_move_right_alpha_numeric_or_camel_boundary = 118; -static i32 fcoder_metacmd_ID_move_right_token_boundary = 119; -static i32 fcoder_metacmd_ID_move_right_whitespace_boundary = 120; -static i32 fcoder_metacmd_ID_move_right_whitespace_or_token_boundary = 121; -static i32 fcoder_metacmd_ID_move_up = 122; -static i32 fcoder_metacmd_ID_move_up_10 = 123; -static i32 fcoder_metacmd_ID_move_up_to_blank_line = 124; -static i32 fcoder_metacmd_ID_move_up_to_blank_line_end = 125; -static i32 fcoder_metacmd_ID_move_up_to_blank_line_skip_whitespace = 126; -static i32 fcoder_metacmd_ID_open_all_code = 127; -static i32 fcoder_metacmd_ID_open_all_code_recursive = 128; -static i32 fcoder_metacmd_ID_open_file_in_quotes = 129; -static i32 fcoder_metacmd_ID_open_in_other = 130; -static i32 fcoder_metacmd_ID_open_long_braces = 131; -static i32 fcoder_metacmd_ID_open_long_braces_break = 132; -static i32 fcoder_metacmd_ID_open_long_braces_semicolon = 133; -static i32 fcoder_metacmd_ID_open_matching_file_cpp = 134; -static i32 fcoder_metacmd_ID_open_panel_hsplit = 135; -static i32 fcoder_metacmd_ID_open_panel_vsplit = 136; -static i32 fcoder_metacmd_ID_page_down = 137; -static i32 fcoder_metacmd_ID_page_up = 138; -static i32 fcoder_metacmd_ID_paste = 139; -static i32 fcoder_metacmd_ID_paste_and_indent = 140; -static i32 fcoder_metacmd_ID_paste_next = 141; -static i32 fcoder_metacmd_ID_paste_next_and_indent = 142; -static i32 fcoder_metacmd_ID_place_in_scope = 143; -static i32 fcoder_metacmd_ID_profile_clear = 144; -static i32 fcoder_metacmd_ID_profile_disable = 145; -static i32 fcoder_metacmd_ID_profile_enable = 146; -static i32 fcoder_metacmd_ID_profile_inspect = 147; -static i32 fcoder_metacmd_ID_project_command_lister = 148; -static i32 fcoder_metacmd_ID_project_fkey_command = 149; -static i32 fcoder_metacmd_ID_project_go_to_root_directory = 150; -static i32 fcoder_metacmd_ID_query_replace = 151; -static i32 fcoder_metacmd_ID_query_replace_identifier = 152; -static i32 fcoder_metacmd_ID_query_replace_selection = 153; -static i32 fcoder_metacmd_ID_redo = 154; -static i32 fcoder_metacmd_ID_redo_all_buffers = 155; -static i32 fcoder_metacmd_ID_rename_file_query = 156; -static i32 fcoder_metacmd_ID_reopen = 157; -static i32 fcoder_metacmd_ID_replace_in_all_buffers = 158; -static i32 fcoder_metacmd_ID_replace_in_buffer = 159; -static i32 fcoder_metacmd_ID_replace_in_range = 160; -static i32 fcoder_metacmd_ID_reverse_search = 161; -static i32 fcoder_metacmd_ID_reverse_search_identifier = 162; -static i32 fcoder_metacmd_ID_save = 163; -static i32 fcoder_metacmd_ID_save_all_dirty_buffers = 164; -static i32 fcoder_metacmd_ID_save_to_query = 165; -static i32 fcoder_metacmd_ID_search = 166; -static i32 fcoder_metacmd_ID_search_identifier = 167; -static i32 fcoder_metacmd_ID_seek_beginning_of_line = 168; -static i32 fcoder_metacmd_ID_seek_beginning_of_textual_line = 169; -static i32 fcoder_metacmd_ID_seek_end_of_line = 170; -static i32 fcoder_metacmd_ID_seek_end_of_textual_line = 171; -static i32 fcoder_metacmd_ID_select_all = 172; -static i32 fcoder_metacmd_ID_select_next_scope_absolute = 173; -static i32 fcoder_metacmd_ID_select_next_scope_after_current = 174; -static i32 fcoder_metacmd_ID_select_prev_scope_absolute = 175; -static i32 fcoder_metacmd_ID_select_prev_top_most_scope = 176; -static i32 fcoder_metacmd_ID_select_surrounding_scope = 177; -static i32 fcoder_metacmd_ID_select_surrounding_scope_maximal = 178; -static i32 fcoder_metacmd_ID_set_eol_mode_from_contents = 179; -static i32 fcoder_metacmd_ID_set_eol_mode_to_binary = 180; -static i32 fcoder_metacmd_ID_set_eol_mode_to_crlf = 181; -static i32 fcoder_metacmd_ID_set_eol_mode_to_lf = 182; -static i32 fcoder_metacmd_ID_set_mark = 183; -static i32 fcoder_metacmd_ID_set_mode_to_notepad_like = 184; -static i32 fcoder_metacmd_ID_set_mode_to_original = 185; -static i32 fcoder_metacmd_ID_setup_build_bat = 186; -static i32 fcoder_metacmd_ID_setup_build_bat_and_sh = 187; -static i32 fcoder_metacmd_ID_setup_build_sh = 188; -static i32 fcoder_metacmd_ID_setup_new_project = 189; -static i32 fcoder_metacmd_ID_show_filebar = 190; -static i32 fcoder_metacmd_ID_show_scrollbar = 191; -static i32 fcoder_metacmd_ID_show_the_log_graph = 192; -static i32 fcoder_metacmd_ID_snipe_backward_whitespace_or_token_boundary = 193; -static i32 fcoder_metacmd_ID_snipe_forward_whitespace_or_token_boundary = 194; -static i32 fcoder_metacmd_ID_snippet_lister = 195; -static i32 fcoder_metacmd_ID_suppress_mouse = 196; -static i32 fcoder_metacmd_ID_swap_panels = 197; -static i32 fcoder_metacmd_ID_test_double_backspace = 198; -static i32 fcoder_metacmd_ID_theme_lister = 199; -static i32 fcoder_metacmd_ID_to_lowercase = 200; -static i32 fcoder_metacmd_ID_to_uppercase = 201; -static i32 fcoder_metacmd_ID_toggle_filebar = 202; -static i32 fcoder_metacmd_ID_toggle_fps_meter = 203; -static i32 fcoder_metacmd_ID_toggle_fullscreen = 204; -static i32 fcoder_metacmd_ID_toggle_highlight_enclosing_scopes = 205; -static i32 fcoder_metacmd_ID_toggle_highlight_line_at_cursor = 206; -static i32 fcoder_metacmd_ID_toggle_line_numbers = 207; -static i32 fcoder_metacmd_ID_toggle_line_wrap = 208; -static i32 fcoder_metacmd_ID_toggle_mouse = 209; -static i32 fcoder_metacmd_ID_toggle_paren_matching_helper = 210; -static i32 fcoder_metacmd_ID_toggle_show_whitespace = 211; -static i32 fcoder_metacmd_ID_toggle_virtual_whitespace = 212; -static i32 fcoder_metacmd_ID_tutorial_maximize = 213; -static i32 fcoder_metacmd_ID_tutorial_minimize = 214; -static i32 fcoder_metacmd_ID_uncomment_line = 215; -static i32 fcoder_metacmd_ID_undo = 216; -static i32 fcoder_metacmd_ID_undo_all_buffers = 217; -static i32 fcoder_metacmd_ID_view_buffer_other_panel = 218; -static i32 fcoder_metacmd_ID_view_jump_list_with_lister = 219; -static i32 fcoder_metacmd_ID_word_complete = 220; -static i32 fcoder_metacmd_ID_word_complete_drop_down = 221; -static i32 fcoder_metacmd_ID_write_block = 222; -static i32 fcoder_metacmd_ID_write_hack = 223; -static i32 fcoder_metacmd_ID_write_note = 224; -static i32 fcoder_metacmd_ID_write_space = 225; -static i32 fcoder_metacmd_ID_write_text_and_auto_indent = 226; -static i32 fcoder_metacmd_ID_write_text_input = 227; -static i32 fcoder_metacmd_ID_write_todo = 228; -static i32 fcoder_metacmd_ID_write_underscore = 229; -static i32 fcoder_metacmd_ID_write_zero_struct = 230; +static i32 fcoder_metacmd_ID_begin_clipboard_collection_mode = 7; +static i32 fcoder_metacmd_ID_build_in_build_panel = 8; +static i32 fcoder_metacmd_ID_build_search = 9; +static i32 fcoder_metacmd_ID_center_view = 10; +static i32 fcoder_metacmd_ID_change_active_panel = 11; +static i32 fcoder_metacmd_ID_change_active_panel_backwards = 12; +static i32 fcoder_metacmd_ID_change_to_build_panel = 13; +static i32 fcoder_metacmd_ID_clean_all_lines = 14; +static i32 fcoder_metacmd_ID_clear_all_themes = 15; +static i32 fcoder_metacmd_ID_clear_clipboard = 16; +static i32 fcoder_metacmd_ID_click_set_cursor = 17; +static i32 fcoder_metacmd_ID_click_set_cursor_and_mark = 18; +static i32 fcoder_metacmd_ID_click_set_cursor_if_lbutton = 19; +static i32 fcoder_metacmd_ID_click_set_mark = 20; +static i32 fcoder_metacmd_ID_clipboard_record_clip = 21; +static i32 fcoder_metacmd_ID_close_all_code = 22; +static i32 fcoder_metacmd_ID_close_build_panel = 23; +static i32 fcoder_metacmd_ID_close_panel = 24; +static i32 fcoder_metacmd_ID_command_documentation = 25; +static i32 fcoder_metacmd_ID_command_lister = 26; +static i32 fcoder_metacmd_ID_comment_line = 27; +static i32 fcoder_metacmd_ID_comment_line_toggle = 28; +static i32 fcoder_metacmd_ID_copy = 29; +static i32 fcoder_metacmd_ID_cursor_mark_swap = 30; +static i32 fcoder_metacmd_ID_custom_api_documentation = 31; +static i32 fcoder_metacmd_ID_cut = 32; +static i32 fcoder_metacmd_ID_decrease_face_size = 33; +static i32 fcoder_metacmd_ID_default_file_externally_modified = 34; +static i32 fcoder_metacmd_ID_default_startup = 35; +static i32 fcoder_metacmd_ID_default_try_exit = 36; +static i32 fcoder_metacmd_ID_default_view_input_handler = 37; +static i32 fcoder_metacmd_ID_delete_alpha_numeric_boundary = 38; +static i32 fcoder_metacmd_ID_delete_char = 39; +static i32 fcoder_metacmd_ID_delete_current_scope = 40; +static i32 fcoder_metacmd_ID_delete_file_query = 41; +static i32 fcoder_metacmd_ID_delete_line = 42; +static i32 fcoder_metacmd_ID_delete_range = 43; +static i32 fcoder_metacmd_ID_duplicate_line = 44; +static i32 fcoder_metacmd_ID_execute_any_cli = 45; +static i32 fcoder_metacmd_ID_execute_previous_cli = 46; +static i32 fcoder_metacmd_ID_exit_4coder = 47; +static i32 fcoder_metacmd_ID_goto_beginning_of_file = 48; +static i32 fcoder_metacmd_ID_goto_end_of_file = 49; +static i32 fcoder_metacmd_ID_goto_first_jump = 50; +static i32 fcoder_metacmd_ID_goto_first_jump_same_panel_sticky = 51; +static i32 fcoder_metacmd_ID_goto_jump_at_cursor = 52; +static i32 fcoder_metacmd_ID_goto_jump_at_cursor_same_panel = 53; +static i32 fcoder_metacmd_ID_goto_line = 54; +static i32 fcoder_metacmd_ID_goto_next_jump = 55; +static i32 fcoder_metacmd_ID_goto_next_jump_no_skips = 56; +static i32 fcoder_metacmd_ID_goto_prev_jump = 57; +static i32 fcoder_metacmd_ID_goto_prev_jump_no_skips = 58; +static i32 fcoder_metacmd_ID_hide_filebar = 59; +static i32 fcoder_metacmd_ID_hide_scrollbar = 60; +static i32 fcoder_metacmd_ID_hms_demo_tutorial = 61; +static i32 fcoder_metacmd_ID_if0_off = 62; +static i32 fcoder_metacmd_ID_if_read_only_goto_position = 63; +static i32 fcoder_metacmd_ID_if_read_only_goto_position_same_panel = 64; +static i32 fcoder_metacmd_ID_increase_face_size = 65; +static i32 fcoder_metacmd_ID_interactive_kill_buffer = 66; +static i32 fcoder_metacmd_ID_interactive_new = 67; +static i32 fcoder_metacmd_ID_interactive_open = 68; +static i32 fcoder_metacmd_ID_interactive_open_or_new = 69; +static i32 fcoder_metacmd_ID_interactive_switch_buffer = 70; +static i32 fcoder_metacmd_ID_jump_to_definition = 71; +static i32 fcoder_metacmd_ID_keyboard_macro_finish_recording = 72; +static i32 fcoder_metacmd_ID_keyboard_macro_replay = 73; +static i32 fcoder_metacmd_ID_keyboard_macro_start_recording = 74; +static i32 fcoder_metacmd_ID_kill_buffer = 75; +static i32 fcoder_metacmd_ID_kill_tutorial = 76; +static i32 fcoder_metacmd_ID_left_adjust_view = 77; +static i32 fcoder_metacmd_ID_list_all_functions_all_buffers = 78; +static i32 fcoder_metacmd_ID_list_all_functions_all_buffers_lister = 79; +static i32 fcoder_metacmd_ID_list_all_functions_current_buffer = 80; +static i32 fcoder_metacmd_ID_list_all_functions_current_buffer_lister = 81; +static i32 fcoder_metacmd_ID_list_all_locations = 82; +static i32 fcoder_metacmd_ID_list_all_locations_case_insensitive = 83; +static i32 fcoder_metacmd_ID_list_all_locations_of_identifier = 84; +static i32 fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 85; +static i32 fcoder_metacmd_ID_list_all_locations_of_selection = 86; +static i32 fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 87; +static i32 fcoder_metacmd_ID_list_all_locations_of_type_definition = 88; +static i32 fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 89; +static i32 fcoder_metacmd_ID_list_all_substring_locations = 90; +static i32 fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 91; +static i32 fcoder_metacmd_ID_load_project = 92; +static i32 fcoder_metacmd_ID_load_theme_current_buffer = 93; +static i32 fcoder_metacmd_ID_load_themes_default_folder = 94; +static i32 fcoder_metacmd_ID_load_themes_hot_directory = 95; +static i32 fcoder_metacmd_ID_make_directory_query = 96; +static i32 fcoder_metacmd_ID_miblo_decrement_basic = 97; +static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp = 98; +static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp_minute = 99; +static i32 fcoder_metacmd_ID_miblo_increment_basic = 100; +static i32 fcoder_metacmd_ID_miblo_increment_time_stamp = 101; +static i32 fcoder_metacmd_ID_miblo_increment_time_stamp_minute = 102; +static i32 fcoder_metacmd_ID_mouse_wheel_change_face_size = 103; +static i32 fcoder_metacmd_ID_mouse_wheel_scroll = 104; +static i32 fcoder_metacmd_ID_move_down = 105; +static i32 fcoder_metacmd_ID_move_down_10 = 106; +static i32 fcoder_metacmd_ID_move_down_textual = 107; +static i32 fcoder_metacmd_ID_move_down_to_blank_line = 108; +static i32 fcoder_metacmd_ID_move_down_to_blank_line_end = 109; +static i32 fcoder_metacmd_ID_move_down_to_blank_line_skip_whitespace = 110; +static i32 fcoder_metacmd_ID_move_left = 111; +static i32 fcoder_metacmd_ID_move_left_alpha_numeric_boundary = 112; +static i32 fcoder_metacmd_ID_move_left_alpha_numeric_or_camel_boundary = 113; +static i32 fcoder_metacmd_ID_move_left_token_boundary = 114; +static i32 fcoder_metacmd_ID_move_left_whitespace_boundary = 115; +static i32 fcoder_metacmd_ID_move_left_whitespace_or_token_boundary = 116; +static i32 fcoder_metacmd_ID_move_line_down = 117; +static i32 fcoder_metacmd_ID_move_line_up = 118; +static i32 fcoder_metacmd_ID_move_right = 119; +static i32 fcoder_metacmd_ID_move_right_alpha_numeric_boundary = 120; +static i32 fcoder_metacmd_ID_move_right_alpha_numeric_or_camel_boundary = 121; +static i32 fcoder_metacmd_ID_move_right_token_boundary = 122; +static i32 fcoder_metacmd_ID_move_right_whitespace_boundary = 123; +static i32 fcoder_metacmd_ID_move_right_whitespace_or_token_boundary = 124; +static i32 fcoder_metacmd_ID_move_up = 125; +static i32 fcoder_metacmd_ID_move_up_10 = 126; +static i32 fcoder_metacmd_ID_move_up_to_blank_line = 127; +static i32 fcoder_metacmd_ID_move_up_to_blank_line_end = 128; +static i32 fcoder_metacmd_ID_move_up_to_blank_line_skip_whitespace = 129; +static i32 fcoder_metacmd_ID_multi_paste_interactive = 130; +static i32 fcoder_metacmd_ID_multi_paste_interactive_quick = 131; +static i32 fcoder_metacmd_ID_open_all_code = 132; +static i32 fcoder_metacmd_ID_open_all_code_recursive = 133; +static i32 fcoder_metacmd_ID_open_file_in_quotes = 134; +static i32 fcoder_metacmd_ID_open_in_other = 135; +static i32 fcoder_metacmd_ID_open_long_braces = 136; +static i32 fcoder_metacmd_ID_open_long_braces_break = 137; +static i32 fcoder_metacmd_ID_open_long_braces_semicolon = 138; +static i32 fcoder_metacmd_ID_open_matching_file_cpp = 139; +static i32 fcoder_metacmd_ID_open_panel_hsplit = 140; +static i32 fcoder_metacmd_ID_open_panel_vsplit = 141; +static i32 fcoder_metacmd_ID_page_down = 142; +static i32 fcoder_metacmd_ID_page_up = 143; +static i32 fcoder_metacmd_ID_paste = 144; +static i32 fcoder_metacmd_ID_paste_and_indent = 145; +static i32 fcoder_metacmd_ID_paste_next = 146; +static i32 fcoder_metacmd_ID_paste_next_and_indent = 147; +static i32 fcoder_metacmd_ID_place_in_scope = 148; +static i32 fcoder_metacmd_ID_profile_clear = 149; +static i32 fcoder_metacmd_ID_profile_disable = 150; +static i32 fcoder_metacmd_ID_profile_enable = 151; +static i32 fcoder_metacmd_ID_profile_inspect = 152; +static i32 fcoder_metacmd_ID_project_command_lister = 153; +static i32 fcoder_metacmd_ID_project_fkey_command = 154; +static i32 fcoder_metacmd_ID_project_go_to_root_directory = 155; +static i32 fcoder_metacmd_ID_query_replace = 156; +static i32 fcoder_metacmd_ID_query_replace_identifier = 157; +static i32 fcoder_metacmd_ID_query_replace_selection = 158; +static i32 fcoder_metacmd_ID_redo = 159; +static i32 fcoder_metacmd_ID_redo_all_buffers = 160; +static i32 fcoder_metacmd_ID_rename_file_query = 161; +static i32 fcoder_metacmd_ID_reopen = 162; +static i32 fcoder_metacmd_ID_replace_in_all_buffers = 163; +static i32 fcoder_metacmd_ID_replace_in_buffer = 164; +static i32 fcoder_metacmd_ID_replace_in_range = 165; +static i32 fcoder_metacmd_ID_reverse_search = 166; +static i32 fcoder_metacmd_ID_reverse_search_identifier = 167; +static i32 fcoder_metacmd_ID_save = 168; +static i32 fcoder_metacmd_ID_save_all_dirty_buffers = 169; +static i32 fcoder_metacmd_ID_save_to_query = 170; +static i32 fcoder_metacmd_ID_search = 171; +static i32 fcoder_metacmd_ID_search_identifier = 172; +static i32 fcoder_metacmd_ID_seek_beginning_of_line = 173; +static i32 fcoder_metacmd_ID_seek_beginning_of_textual_line = 174; +static i32 fcoder_metacmd_ID_seek_end_of_line = 175; +static i32 fcoder_metacmd_ID_seek_end_of_textual_line = 176; +static i32 fcoder_metacmd_ID_select_all = 177; +static i32 fcoder_metacmd_ID_select_next_scope_absolute = 178; +static i32 fcoder_metacmd_ID_select_next_scope_after_current = 179; +static i32 fcoder_metacmd_ID_select_prev_scope_absolute = 180; +static i32 fcoder_metacmd_ID_select_prev_top_most_scope = 181; +static i32 fcoder_metacmd_ID_select_surrounding_scope = 182; +static i32 fcoder_metacmd_ID_select_surrounding_scope_maximal = 183; +static i32 fcoder_metacmd_ID_set_eol_mode_from_contents = 184; +static i32 fcoder_metacmd_ID_set_eol_mode_to_binary = 185; +static i32 fcoder_metacmd_ID_set_eol_mode_to_crlf = 186; +static i32 fcoder_metacmd_ID_set_eol_mode_to_lf = 187; +static i32 fcoder_metacmd_ID_set_face_size = 188; +static i32 fcoder_metacmd_ID_set_face_size_this_buffer = 189; +static i32 fcoder_metacmd_ID_set_mark = 190; +static i32 fcoder_metacmd_ID_set_mode_to_notepad_like = 191; +static i32 fcoder_metacmd_ID_set_mode_to_original = 192; +static i32 fcoder_metacmd_ID_setup_build_bat = 193; +static i32 fcoder_metacmd_ID_setup_build_bat_and_sh = 194; +static i32 fcoder_metacmd_ID_setup_build_sh = 195; +static i32 fcoder_metacmd_ID_setup_new_project = 196; +static i32 fcoder_metacmd_ID_show_filebar = 197; +static i32 fcoder_metacmd_ID_show_scrollbar = 198; +static i32 fcoder_metacmd_ID_show_the_log_graph = 199; +static i32 fcoder_metacmd_ID_snipe_backward_whitespace_or_token_boundary = 200; +static i32 fcoder_metacmd_ID_snipe_forward_whitespace_or_token_boundary = 201; +static i32 fcoder_metacmd_ID_snippet_lister = 202; +static i32 fcoder_metacmd_ID_suppress_mouse = 203; +static i32 fcoder_metacmd_ID_swap_panels = 204; +static i32 fcoder_metacmd_ID_test_double_backspace = 205; +static i32 fcoder_metacmd_ID_theme_lister = 206; +static i32 fcoder_metacmd_ID_to_lowercase = 207; +static i32 fcoder_metacmd_ID_to_uppercase = 208; +static i32 fcoder_metacmd_ID_toggle_filebar = 209; +static i32 fcoder_metacmd_ID_toggle_fps_meter = 210; +static i32 fcoder_metacmd_ID_toggle_fullscreen = 211; +static i32 fcoder_metacmd_ID_toggle_highlight_enclosing_scopes = 212; +static i32 fcoder_metacmd_ID_toggle_highlight_line_at_cursor = 213; +static i32 fcoder_metacmd_ID_toggle_line_numbers = 214; +static i32 fcoder_metacmd_ID_toggle_line_wrap = 215; +static i32 fcoder_metacmd_ID_toggle_mouse = 216; +static i32 fcoder_metacmd_ID_toggle_paren_matching_helper = 217; +static i32 fcoder_metacmd_ID_toggle_show_whitespace = 218; +static i32 fcoder_metacmd_ID_toggle_virtual_whitespace = 219; +static i32 fcoder_metacmd_ID_tutorial_maximize = 220; +static i32 fcoder_metacmd_ID_tutorial_minimize = 221; +static i32 fcoder_metacmd_ID_uncomment_line = 222; +static i32 fcoder_metacmd_ID_undo = 223; +static i32 fcoder_metacmd_ID_undo_all_buffers = 224; +static i32 fcoder_metacmd_ID_view_buffer_other_panel = 225; +static i32 fcoder_metacmd_ID_view_jump_list_with_lister = 226; +static i32 fcoder_metacmd_ID_word_complete = 227; +static i32 fcoder_metacmd_ID_word_complete_drop_down = 228; +static i32 fcoder_metacmd_ID_write_block = 229; +static i32 fcoder_metacmd_ID_write_hack = 230; +static i32 fcoder_metacmd_ID_write_note = 231; +static i32 fcoder_metacmd_ID_write_space = 232; +static i32 fcoder_metacmd_ID_write_text_and_auto_indent = 233; +static i32 fcoder_metacmd_ID_write_text_input = 234; +static i32 fcoder_metacmd_ID_write_todo = 235; +static i32 fcoder_metacmd_ID_write_underscore = 236; +static i32 fcoder_metacmd_ID_write_zero_struct = 237; #endif diff --git a/custom/generated/custom_api.cpp b/custom/generated/custom_api.cpp index 653783c8..1435f471 100644 --- a/custom/generated/custom_api.cpp +++ b/custom/generated/custom_api.cpp @@ -8,9 +8,6 @@ vtable->child_process_set_target_buffer = child_process_set_target_buffer; vtable->buffer_get_attached_child_process = buffer_get_attached_child_process; vtable->child_process_get_attached_buffer = child_process_get_attached_buffer; vtable->child_process_get_state = child_process_get_state; -vtable->clipboard_post = clipboard_post; -vtable->clipboard_count = clipboard_count; -vtable->push_clipboard_index = push_clipboard_index; vtable->enqueue_virtual_event = enqueue_virtual_event; vtable->get_buffer_count = get_buffer_count; vtable->get_buffer_next = get_buffer_next; @@ -157,6 +154,8 @@ vtable->set_hot_directory = set_hot_directory; vtable->send_exit_signal = send_exit_signal; vtable->hard_exit = hard_exit; vtable->set_window_title = set_window_title; +vtable->acquire_global_frame_mutex = acquire_global_frame_mutex; +vtable->release_global_frame_mutex = release_global_frame_mutex; vtable->draw_string_oriented = draw_string_oriented; vtable->get_string_advance = get_string_advance; vtable->draw_rectangle = draw_rectangle; @@ -189,9 +188,6 @@ child_process_set_target_buffer = vtable->child_process_set_target_buffer; buffer_get_attached_child_process = vtable->buffer_get_attached_child_process; child_process_get_attached_buffer = vtable->child_process_get_attached_buffer; child_process_get_state = vtable->child_process_get_state; -clipboard_post = vtable->clipboard_post; -clipboard_count = vtable->clipboard_count; -push_clipboard_index = vtable->push_clipboard_index; enqueue_virtual_event = vtable->enqueue_virtual_event; get_buffer_count = vtable->get_buffer_count; get_buffer_next = vtable->get_buffer_next; @@ -338,6 +334,8 @@ set_hot_directory = vtable->set_hot_directory; send_exit_signal = vtable->send_exit_signal; hard_exit = vtable->hard_exit; set_window_title = vtable->set_window_title; +acquire_global_frame_mutex = vtable->acquire_global_frame_mutex; +release_global_frame_mutex = vtable->release_global_frame_mutex; draw_string_oriented = vtable->draw_string_oriented; get_string_advance = vtable->get_string_advance; draw_rectangle = vtable->draw_rectangle; diff --git a/custom/generated/custom_api.h b/custom/generated/custom_api.h index 7e65493a..3526d681 100644 --- a/custom/generated/custom_api.h +++ b/custom/generated/custom_api.h @@ -6,9 +6,6 @@ #define custom_buffer_get_attached_child_process_sig() Child_Process_ID custom_buffer_get_attached_child_process(Application_Links* app, Buffer_ID buffer_id) #define custom_child_process_get_attached_buffer_sig() Buffer_ID custom_child_process_get_attached_buffer(Application_Links* app, Child_Process_ID child_process_id) #define custom_child_process_get_state_sig() Process_State custom_child_process_get_state(Application_Links* app, Child_Process_ID child_process_id) -#define custom_clipboard_post_sig() b32 custom_clipboard_post(Application_Links* app, i32 clipboard_id, String_Const_u8 string) -#define custom_clipboard_count_sig() i32 custom_clipboard_count(Application_Links* app, i32 clipboard_id) -#define custom_push_clipboard_index_sig() String_Const_u8 custom_push_clipboard_index(Application_Links* app, Arena* arena, i32 clipboard_id, i32 item_index) #define custom_enqueue_virtual_event_sig() b32 custom_enqueue_virtual_event(Application_Links* app, Input_Event* event) #define custom_get_buffer_count_sig() i32 custom_get_buffer_count(Application_Links* app) #define custom_get_buffer_next_sig() Buffer_ID custom_get_buffer_next(Application_Links* app, Buffer_ID buffer_id, Access_Flag access) @@ -155,6 +152,8 @@ #define custom_send_exit_signal_sig() void custom_send_exit_signal(Application_Links* app) #define custom_hard_exit_sig() void custom_hard_exit(Application_Links* app) #define custom_set_window_title_sig() void custom_set_window_title(Application_Links* app, String_Const_u8 title) +#define custom_acquire_global_frame_mutex_sig() void custom_acquire_global_frame_mutex(Application_Links* app) +#define custom_release_global_frame_mutex_sig() void custom_release_global_frame_mutex(Application_Links* app) #define custom_draw_string_oriented_sig() Vec2_f32 custom_draw_string_oriented(Application_Links* app, Face_ID font_id, ARGB_Color color, String_Const_u8 str, Vec2_f32 point, u32 flags, Vec2_f32 delta) #define custom_get_string_advance_sig() f32 custom_get_string_advance(Application_Links* app, Face_ID font_id, String_Const_u8 str) #define custom_draw_rectangle_sig() void custom_draw_rectangle(Application_Links* app, Rect_f32 rect, f32 roundness, ARGB_Color color) @@ -183,9 +182,6 @@ typedef b32 custom_child_process_set_target_buffer_type(Application_Links* app, typedef Child_Process_ID custom_buffer_get_attached_child_process_type(Application_Links* app, Buffer_ID buffer_id); typedef Buffer_ID custom_child_process_get_attached_buffer_type(Application_Links* app, Child_Process_ID child_process_id); typedef Process_State custom_child_process_get_state_type(Application_Links* app, Child_Process_ID child_process_id); -typedef b32 custom_clipboard_post_type(Application_Links* app, i32 clipboard_id, String_Const_u8 string); -typedef i32 custom_clipboard_count_type(Application_Links* app, i32 clipboard_id); -typedef String_Const_u8 custom_push_clipboard_index_type(Application_Links* app, Arena* arena, i32 clipboard_id, i32 item_index); typedef b32 custom_enqueue_virtual_event_type(Application_Links* app, Input_Event* event); typedef i32 custom_get_buffer_count_type(Application_Links* app); typedef Buffer_ID custom_get_buffer_next_type(Application_Links* app, Buffer_ID buffer_id, Access_Flag access); @@ -332,6 +328,8 @@ typedef void custom_set_hot_directory_type(Application_Links* app, String_Const_ typedef void custom_send_exit_signal_type(Application_Links* app); typedef void custom_hard_exit_type(Application_Links* app); typedef void custom_set_window_title_type(Application_Links* app, String_Const_u8 title); +typedef void custom_acquire_global_frame_mutex_type(Application_Links* app); +typedef void custom_release_global_frame_mutex_type(Application_Links* app); typedef Vec2_f32 custom_draw_string_oriented_type(Application_Links* app, Face_ID font_id, ARGB_Color color, String_Const_u8 str, Vec2_f32 point, u32 flags, Vec2_f32 delta); typedef f32 custom_get_string_advance_type(Application_Links* app, Face_ID font_id, String_Const_u8 str); typedef void custom_draw_rectangle_type(Application_Links* app, Rect_f32 rect, f32 roundness, ARGB_Color color); @@ -361,9 +359,6 @@ custom_child_process_set_target_buffer_type *child_process_set_target_buffer; custom_buffer_get_attached_child_process_type *buffer_get_attached_child_process; custom_child_process_get_attached_buffer_type *child_process_get_attached_buffer; custom_child_process_get_state_type *child_process_get_state; -custom_clipboard_post_type *clipboard_post; -custom_clipboard_count_type *clipboard_count; -custom_push_clipboard_index_type *push_clipboard_index; custom_enqueue_virtual_event_type *enqueue_virtual_event; custom_get_buffer_count_type *get_buffer_count; custom_get_buffer_next_type *get_buffer_next; @@ -510,6 +505,8 @@ custom_set_hot_directory_type *set_hot_directory; custom_send_exit_signal_type *send_exit_signal; custom_hard_exit_type *hard_exit; custom_set_window_title_type *set_window_title; +custom_acquire_global_frame_mutex_type *acquire_global_frame_mutex; +custom_release_global_frame_mutex_type *release_global_frame_mutex; custom_draw_string_oriented_type *draw_string_oriented; custom_get_string_advance_type *get_string_advance; custom_draw_rectangle_type *draw_rectangle; @@ -540,9 +537,6 @@ internal b32 child_process_set_target_buffer(Application_Links* app, Child_Proce internal Child_Process_ID buffer_get_attached_child_process(Application_Links* app, Buffer_ID buffer_id); internal Buffer_ID child_process_get_attached_buffer(Application_Links* app, Child_Process_ID child_process_id); internal Process_State child_process_get_state(Application_Links* app, Child_Process_ID child_process_id); -internal b32 clipboard_post(Application_Links* app, i32 clipboard_id, String_Const_u8 string); -internal i32 clipboard_count(Application_Links* app, i32 clipboard_id); -internal String_Const_u8 push_clipboard_index(Application_Links* app, Arena* arena, i32 clipboard_id, i32 item_index); internal b32 enqueue_virtual_event(Application_Links* app, Input_Event* event); internal i32 get_buffer_count(Application_Links* app); internal Buffer_ID get_buffer_next(Application_Links* app, Buffer_ID buffer_id, Access_Flag access); @@ -689,6 +683,8 @@ internal void set_hot_directory(Application_Links* app, String_Const_u8 string); internal void send_exit_signal(Application_Links* app); internal void hard_exit(Application_Links* app); internal void set_window_title(Application_Links* app, String_Const_u8 title); +internal void acquire_global_frame_mutex(Application_Links* app); +internal void release_global_frame_mutex(Application_Links* app); internal Vec2_f32 draw_string_oriented(Application_Links* app, Face_ID font_id, ARGB_Color color, String_Const_u8 str, Vec2_f32 point, u32 flags, Vec2_f32 delta); internal f32 get_string_advance(Application_Links* app, Face_ID font_id, String_Const_u8 str); internal void draw_rectangle(Application_Links* app, Rect_f32 rect, f32 roundness, ARGB_Color color); @@ -719,9 +715,6 @@ global custom_child_process_set_target_buffer_type *child_process_set_target_buf global custom_buffer_get_attached_child_process_type *buffer_get_attached_child_process = 0; global custom_child_process_get_attached_buffer_type *child_process_get_attached_buffer = 0; global custom_child_process_get_state_type *child_process_get_state = 0; -global custom_clipboard_post_type *clipboard_post = 0; -global custom_clipboard_count_type *clipboard_count = 0; -global custom_push_clipboard_index_type *push_clipboard_index = 0; global custom_enqueue_virtual_event_type *enqueue_virtual_event = 0; global custom_get_buffer_count_type *get_buffer_count = 0; global custom_get_buffer_next_type *get_buffer_next = 0; @@ -868,6 +861,8 @@ global custom_set_hot_directory_type *set_hot_directory = 0; global custom_send_exit_signal_type *send_exit_signal = 0; global custom_hard_exit_type *hard_exit = 0; global custom_set_window_title_type *set_window_title = 0; +global custom_acquire_global_frame_mutex_type *acquire_global_frame_mutex = 0; +global custom_release_global_frame_mutex_type *release_global_frame_mutex = 0; global custom_draw_string_oriented_type *draw_string_oriented = 0; global custom_get_string_advance_type *get_string_advance = 0; global custom_draw_rectangle_type *draw_rectangle = 0; diff --git a/custom/generated/custom_api_constructor.cpp b/custom/generated/custom_api_constructor.cpp index 2520a502..8a8fac48 100644 --- a/custom/generated/custom_api_constructor.cpp +++ b/custom/generated/custom_api_constructor.cpp @@ -44,7 +44,12 @@ api_param(arena, call, "Application_Links*", "app"); api_param(arena, call, "Child_Process_ID", "child_process_id"); } { -API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("clipboard_post"), string_u8_litexpr("b32"), string_u8_litexpr("")); +API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("clipboard_clear"), string_u8_litexpr("b32"), string_u8_litexpr("")); +api_param(arena, call, "Application_Links*", "app"); +api_param(arena, call, "i32", "clipboard_id"); +} +{ +API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("clipboard_post_internal_only"), string_u8_litexpr("b32"), string_u8_litexpr("")); api_param(arena, call, "Application_Links*", "app"); api_param(arena, call, "i32", "clipboard_id"); api_param(arena, call, "String_Const_u8", "string"); @@ -557,14 +562,6 @@ api_param(arena, call, "Buffer_ID", "buffer_id"); api_param(arena, call, "Set_Buffer_Flag", "flags"); } { -API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("view_post_fade"), string_u8_litexpr("b32"), string_u8_litexpr("")); -api_param(arena, call, "Application_Links*", "app"); -api_param(arena, call, "View_ID", "view_id"); -api_param(arena, call, "f32", "seconds"); -api_param(arena, call, "Range_i64", "range"); -api_param(arena, call, "ARGB_Color", "color"); -} -{ API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("view_push_context"), string_u8_litexpr("b32"), string_u8_litexpr("")); api_param(arena, call, "Application_Links*", "app"); api_param(arena, call, "View_ID", "view_id"); @@ -992,6 +989,14 @@ api_param(arena, call, "Range_i64", "range"); api_param(arena, call, "ARGB_Color", "color"); } { +API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("paint_text_color_blend"), string_u8_litexpr("void"), string_u8_litexpr("")); +api_param(arena, call, "Application_Links*", "app"); +api_param(arena, call, "Text_Layout_ID", "layout_id"); +api_param(arena, call, "Range_i64", "range"); +api_param(arena, call, "ARGB_Color", "color"); +api_param(arena, call, "f32", "blend"); +} +{ API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("text_layout_free"), string_u8_litexpr("b32"), string_u8_litexpr("")); api_param(arena, call, "Application_Links*", "app"); api_param(arena, call, "Text_Layout_ID", "text_layout_id"); diff --git a/custom/generated/custom_api_master_list.h b/custom/generated/custom_api_master_list.h index 60e06631..d73628f7 100644 --- a/custom/generated/custom_api_master_list.h +++ b/custom/generated/custom_api_master_list.h @@ -6,9 +6,6 @@ api(custom) function b32 child_process_set_target_buffer(Application_Links* app, api(custom) function Child_Process_ID buffer_get_attached_child_process(Application_Links* app, Buffer_ID buffer_id); api(custom) function Buffer_ID child_process_get_attached_buffer(Application_Links* app, Child_Process_ID child_process_id); api(custom) function Process_State child_process_get_state(Application_Links* app, Child_Process_ID child_process_id); -api(custom) function b32 clipboard_post(Application_Links* app, i32 clipboard_id, String_Const_u8 string); -api(custom) function i32 clipboard_count(Application_Links* app, i32 clipboard_id); -api(custom) function String_Const_u8 push_clipboard_index(Application_Links* app, Arena* arena, i32 clipboard_id, i32 item_index); api(custom) function b32 enqueue_virtual_event(Application_Links* app, Input_Event* event); api(custom) function i32 get_buffer_count(Application_Links* app); api(custom) function Buffer_ID get_buffer_next(Application_Links* app, Buffer_ID buffer_id, Access_Flag access); @@ -155,6 +152,8 @@ api(custom) function void set_hot_directory(Application_Links* app, String_Const api(custom) function void send_exit_signal(Application_Links* app); api(custom) function void hard_exit(Application_Links* app); api(custom) function void set_window_title(Application_Links* app, String_Const_u8 title); +api(custom) function void acquire_global_frame_mutex(Application_Links* app); +api(custom) function void release_global_frame_mutex(Application_Links* app); api(custom) function Vec2_f32 draw_string_oriented(Application_Links* app, Face_ID font_id, ARGB_Color color, String_Const_u8 str, Vec2_f32 point, u32 flags, Vec2_f32 delta); api(custom) function f32 get_string_advance(Application_Links* app, Face_ID font_id, String_Const_u8 str); api(custom) function void draw_rectangle(Application_Links* app, Rect_f32 rect, f32 roundness, ARGB_Color color); diff --git a/custom/generated/lexer_cpp.cpp b/custom/generated/lexer_cpp.cpp index 213d6ac5..5c62f12e 100644 --- a/custom/generated/lexer_cpp.cpp +++ b/custom/generated/lexer_cpp.cpp @@ -43,453 +43,447 @@ lexeme_table_lookup(u64 *hash_array, String_Const_u8 *key_array, } #endif -u64 cpp_main_keys_hash_array[124] = { -0x26092f2f0215ece3,0x0000000000000000,0x5ce5a2eda58b1f23,0xb2d6c5c6769fa3a3, -0xb9ddf454bfe26d23,0x0000000000000000,0xcd0f6cfa687dd553,0x0000000000000000, -0x0000000000000000,0x5ce5a2e0c5100279,0x5ce5a2ede7babb3d,0x0000000000000000, -0x0000000000000000,0x6f6d951cb7cb582d,0x0e10b5f7624a6565,0xf889fe35be4428e3, -0x6f6d951cb404483f,0x26092f2f02f1c5ef,0x0000000000000000,0xe2b3ddb2fb5b2e6b, -0x0000000000000000,0x6f6d951cb4ea937d,0x0000000000000000,0x0000000000000000, -0x0000000000000000,0x0e10b1af23a24eb5,0x5ce5a2f3706ea43f,0x0000000000000000, -0xb2d6ca88b991d451,0xe2b3ddb2fb5a20a9,0x0000000000000000,0x26092f2f02d33cab, -0x0000000000000000,0x0000000000000000,0x5ce5a2e66f839a73,0x0000000000000000, -0x5ce5a2eda5890521,0x0000000000000000,0x6f6d951cb4228ddb,0x6f6d951cba73c8ab, -0xb9ddf454bfe26e41,0xd50b424c05eec7e9,0x8557f78510d2bb43,0x0000000000000000, -0x0000000000000000,0x26092f2f020b132d,0x0000000000000000,0x0000000000000000, -0xe2b3ddb2fb5bc1c9,0x0000000000000000,0x8ef935ae0949ace3,0x0000000000000000, -0x0000000000000000,0x0000000000000000,0x0000000000000000,0x26092f2f02d2781b, -0x26092f2f02e7a15d,0xb2d6c74182f6a66d,0x0000000000000000,0x0000000000000000, -0x0000000000000000,0x0000000000000000,0x0000000000000000,0x26092f2f02e78453, -0xe2b3ddb2fb5bd5b5,0xb2d6c74182f6a7e9,0x0000000000000000,0x0000000000000000, -0xb2d6c6c7361150b5,0x5ce5a2e0b306cde5,0x0000000000000000,0x0000000000000000, -0x0000000000000000,0x0000000000000000,0x5ce5a2e7e5c24db3,0x26092f2f0216583b, -0x0e101bb85ac205ad,0x6f6d951cacb1aa35,0x0000000000000000,0x0000000000000000, -0x0000000000000000,0x5ce5a2e197faf9d9,0xe2b3ddb2fb5baba1,0x6f6d951cba402e7b, -0x26092f2f02e1d2eb,0x0000000000000000,0x73a9345f7aa71363,0x0000000000000000, -0x0e10b66610117f15,0x0000000000000000,0xe95e136b18f58763,0x0e10078c941fcafb, -0x0000000000000000,0x0000000000000000,0x5ce5a2f37530abf3,0xb2d6c68c37b0f1f7, -0x5ce5a2e7e4364fe9,0x5ce5a2f37536698d,0x0000000000000000,0x0000000000000000, -0x5ce5a2e049adcf39,0x0000000000000000,0x0000000000000000,0x0e100efea5987c03, -0x6f6d951c847de2fb,0x0e106caf9da9bbbd,0x0e109bd9232f3723,0x0000000000000000, -0x6f6d951c86ec6929,0x0000000000000000,0x0000000000000000,0x0e114d6868e6156b, -0x6f6d951c8f3e1899,0x0e105b1fdc2b41ad,0xb2d6c5dc5a9a53e5,0x0000000000000000, -0x0000000000000000,0x0000000000000000,0x26092f2f0212aa4b,0x0000000000000000, -0x0000000000000000,0x0000000000000000,0x5ce5a2f37ca36a8b,0xcd1ba7f6b56d6ce3, +u64 cpp_main_keys_hash_array[121] = { +0x0000000000000000,0x0000000000000000,0x0000000000000000,0x8349fa730393363b, +0x0000000000000000,0x8349fa730aae0099,0x60ea26a19b756e79,0x0000000000000000, +0xb93f1a8b9f2a32a5,0x0000000000000000,0x70176a7f513b6149,0x83cfadc08adce95d, +0x0000000000000000,0xef2944a1e021a185,0x33d534df660dd7d1,0xef2944a1e020e4ef, +0x4925ce049db84f37,0x0000000000000000,0xef2944a1e0217bb9,0x0000000000000000, +0x83cfadc025927fad,0x9c990ba137331a7b,0x0000000000000000,0xd0ee94c41229223b, +0x83cfadc218c1af4b,0x83cfadc05860fa51,0x33d534df65d0b7a1,0x8349fa73053a0c29, +0x0000000000000000,0x33d534df666c18fb,0x1af8d017f84db43f,0x0000000000000000, +0x0000000000000000,0x1af8d017f84db719,0x0000000000000000,0x0000000000000000, +0x33d534df66190e59,0x49275265b1018d2d,0x0000000000000000,0x0000000000000000, +0x33d534df6630873d,0x4925e70b40952c2b,0x8349fa731f0043ad,0x0000000000000000, +0xef2944a1e026c143,0x83cfadc027d6a375,0x49240a553feb1893,0x0000000000000000, +0x0000000000000000,0x9c99072ffa085123,0x83cfadc17d987a33,0x49274937cc2c73ab, +0x9c9907648aae4125,0x492415929b88fb15,0x0000000000000000,0x0000000000000000, +0x0000000000000000,0x83cfadc226c3a251,0x8349fa731f1a8b89,0x492739e1687c7c73, +0x0000000000000000,0x0000000000000000,0x492760d5d9233623,0x83cfadc100295e99, +0x83cfadc3f0d53289,0x8349fa731f0596e9,0x0000000000000000,0x0000000000000000, +0x8349fa7336b0ba93,0x9c99074f559d0e07,0x8349fa73039058ed,0x0000000000000000, +0x0000000000000000,0x8349fa73365331d3,0x9c990ba137331761,0x31d873deecc74ec9, +0x83cfadc05d3daf09,0x0000000000000000,0x0000000000000000,0x9c99064c8ae8c92f, +0x0000000000000000,0x0000000000000000,0x33d534df6605b333,0x0000000000000000, +0x33d534df6772a0a9,0x4925b9bfb359db75,0x0000000000000000,0x0000000000000000, +0x0000000000000000,0xb03d472d14c4eec9,0x0000000000000000,0x0000000000000000, +0x0000000000000000,0x0000000000000000,0xd3a2eb0b8808f565,0xef2944a1e0216207, +0x83cfadc024f06dbb,0x83cfadc1887f2993,0x0000000000000000,0x0000000000000000, +0x0000000000000000,0x0000000000000000,0x0000000000000000,0x0000000000000000, +0x33d534df666c8233,0x0000000000000000,0x0000000000000000,0x49274be6eb62115b, +0x0000000000000000,0x8349fa733124f7c9,0x0000000000000000,0x83cfadc101f1a3f7, +0x33d534df6605923b,0x33d534df6638d32b,0x0000000000000000,0x0000000000000000, +0x0000000000000000,0x83cfadc06ebf6037,0x0000000000000000,0x9c99070bb0253d6d, +0x64fb60a931f3c149, }; -u8 cpp_main_keys_key_array_0[] = {0x74,0x72,0x75,0x65,}; -u8 cpp_main_keys_key_array_2[] = {0x73,0x69,0x67,0x6e,0x65,0x64,}; -u8 cpp_main_keys_key_array_3[] = {0x76,0x69,0x72,0x74,0x75,0x61,0x6c,}; -u8 cpp_main_keys_key_array_4[] = {0x64,0x6f,}; -u8 cpp_main_keys_key_array_6[] = {0x70,0x72,0x6f,0x74,0x65,0x63,0x74,0x65,0x64,}; -u8 cpp_main_keys_key_array_9[] = {0x64,0x6f,0x75,0x62,0x6c,0x65,}; -u8 cpp_main_keys_key_array_10[] = {0x70,0x75,0x62,0x6c,0x69,0x63,}; -u8 cpp_main_keys_key_array_13[] = {0x63,0x6c,0x61,0x73,0x73,}; -u8 cpp_main_keys_key_array_14[] = {0x74,0x65,0x6d,0x70,0x6c,0x61,0x74,0x65,}; -u8 cpp_main_keys_key_array_15[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,}; -u8 cpp_main_keys_key_array_16[] = {0x63,0x61,0x74,0x63,0x68,}; -u8 cpp_main_keys_key_array_17[] = {0x67,0x6f,0x74,0x6f,}; -u8 cpp_main_keys_key_array_19[] = {0x61,0x73,0x6d,}; -u8 cpp_main_keys_key_array_21[] = {0x62,0x72,0x65,0x61,0x6b,}; -u8 cpp_main_keys_key_array_25[] = {0x76,0x6f,0x6c,0x61,0x74,0x69,0x6c,0x65,}; -u8 cpp_main_keys_key_array_26[] = {0x73,0x77,0x69,0x74,0x63,0x68,}; -u8 cpp_main_keys_key_array_28[] = {0x74,0x79,0x70,0x65,0x64,0x65,0x66,}; -u8 cpp_main_keys_key_array_29[] = {0x74,0x72,0x79,}; -u8 cpp_main_keys_key_array_31[] = {0x65,0x6c,0x73,0x65,}; -u8 cpp_main_keys_key_array_34[] = {0x72,0x65,0x74,0x75,0x72,0x6e,}; -u8 cpp_main_keys_key_array_36[] = {0x73,0x69,0x7a,0x65,0x6f,0x66,}; -u8 cpp_main_keys_key_array_38[] = {0x63,0x6f,0x6e,0x73,0x74,}; -u8 cpp_main_keys_key_array_39[] = {0x66,0x61,0x6c,0x73,0x65,}; -u8 cpp_main_keys_key_array_40[] = {0x69,0x66,}; -u8 cpp_main_keys_key_array_41[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x61,0x73,0x73,0x65,0x72,0x74,}; -u8 cpp_main_keys_key_array_42[] = {0x74,0x68,0x72,0x65,0x61,0x64,0x5f,0x6c,0x6f,0x63,0x61,0x6c,}; -u8 cpp_main_keys_key_array_45[] = {0x74,0x68,0x69,0x73,}; -u8 cpp_main_keys_key_array_48[] = {0x69,0x6e,0x74,}; -u8 cpp_main_keys_key_array_50[] = {0x64,0x79,0x6e,0x61,0x6d,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,}; -u8 cpp_main_keys_key_array_55[] = {0x65,0x6e,0x75,0x6d,}; -u8 cpp_main_keys_key_array_56[] = {0x63,0x68,0x61,0x72,}; -u8 cpp_main_keys_key_array_57[] = {0x61,0x6c,0x69,0x67,0x6e,0x61,0x73,}; -u8 cpp_main_keys_key_array_63[] = {0x63,0x61,0x73,0x65,}; -u8 cpp_main_keys_key_array_64[] = {0x66,0x6f,0x72,}; -u8 cpp_main_keys_key_array_65[] = {0x61,0x6c,0x69,0x67,0x6e,0x6f,0x66,}; -u8 cpp_main_keys_key_array_68[] = {0x64,0x65,0x66,0x61,0x75,0x6c,0x74,}; -u8 cpp_main_keys_key_array_69[] = {0x64,0x65,0x6c,0x65,0x74,0x65,}; -u8 cpp_main_keys_key_array_74[] = {0x65,0x78,0x74,0x65,0x72,0x6e,}; -u8 cpp_main_keys_key_array_75[] = {0x6c,0x6f,0x6e,0x67,}; -u8 cpp_main_keys_key_array_76[] = {0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,}; -u8 cpp_main_keys_key_array_77[] = {0x77,0x68,0x69,0x6c,0x65,}; -u8 cpp_main_keys_key_array_81[] = {0x69,0x6e,0x6c,0x69,0x6e,0x65,}; -u8 cpp_main_keys_key_array_82[] = {0x6e,0x65,0x77,}; -u8 cpp_main_keys_key_array_83[] = {0x66,0x6c,0x6f,0x61,0x74,}; -u8 cpp_main_keys_key_array_84[] = {0x62,0x6f,0x6f,0x6c,}; -u8 cpp_main_keys_key_array_86[] = {0x63,0x6f,0x6e,0x73,0x74,0x5f,0x63,0x61,0x73,0x74,}; -u8 cpp_main_keys_key_array_88[] = {0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,}; -u8 cpp_main_keys_key_array_90[] = {0x72,0x65,0x69,0x6e,0x74,0x65,0x72,0x70,0x72,0x65,0x74,0x5f,0x63,0x61,0x73,0x74,}; -u8 cpp_main_keys_key_array_91[] = {0x65,0x78,0x70,0x6c,0x69,0x63,0x69,0x74,}; -u8 cpp_main_keys_key_array_94[] = {0x73,0x74,0x72,0x75,0x63,0x74,}; -u8 cpp_main_keys_key_array_95[] = {0x6e,0x75,0x6c,0x6c,0x70,0x74,0x72,}; -u8 cpp_main_keys_key_array_96[] = {0x65,0x78,0x70,0x6f,0x72,0x74,}; -u8 cpp_main_keys_key_array_97[] = {0x73,0x74,0x61,0x74,0x69,0x63,}; -u8 cpp_main_keys_key_array_100[] = {0x66,0x72,0x69,0x65,0x6e,0x64,}; -u8 cpp_main_keys_key_array_103[] = {0x63,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,}; -u8 cpp_main_keys_key_array_104[] = {0x75,0x73,0x69,0x6e,0x67,}; -u8 cpp_main_keys_key_array_105[] = {0x64,0x65,0x63,0x6c,0x74,0x79,0x70,0x65,}; -u8 cpp_main_keys_key_array_106[] = {0x75,0x6e,0x73,0x69,0x67,0x6e,0x65,0x64,}; -u8 cpp_main_keys_key_array_108[] = {0x73,0x68,0x6f,0x72,0x74,}; -u8 cpp_main_keys_key_array_111[] = {0x74,0x79,0x70,0x65,0x6e,0x61,0x6d,0x65,}; -u8 cpp_main_keys_key_array_112[] = {0x75,0x6e,0x69,0x6f,0x6e,}; -u8 cpp_main_keys_key_array_113[] = {0x6e,0x6f,0x65,0x78,0x63,0x65,0x70,0x74,}; -u8 cpp_main_keys_key_array_114[] = {0x70,0x72,0x69,0x76,0x61,0x74,0x65,}; -u8 cpp_main_keys_key_array_118[] = {0x76,0x6f,0x69,0x64,}; -u8 cpp_main_keys_key_array_122[] = {0x74,0x79,0x70,0x65,0x69,0x64,}; -u8 cpp_main_keys_key_array_123[] = {0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,}; -String_Const_u8 cpp_main_keys_key_array[124] = { -{cpp_main_keys_key_array_0, 4}, -{0, 0}, -{cpp_main_keys_key_array_2, 6}, -{cpp_main_keys_key_array_3, 7}, -{cpp_main_keys_key_array_4, 2}, -{0, 0}, -{cpp_main_keys_key_array_6, 9}, -{0, 0}, -{0, 0}, -{cpp_main_keys_key_array_9, 6}, -{cpp_main_keys_key_array_10, 6}, -{0, 0}, -{0, 0}, -{cpp_main_keys_key_array_13, 5}, -{cpp_main_keys_key_array_14, 8}, -{cpp_main_keys_key_array_15, 11}, -{cpp_main_keys_key_array_16, 5}, -{cpp_main_keys_key_array_17, 4}, -{0, 0}, -{cpp_main_keys_key_array_19, 3}, -{0, 0}, -{cpp_main_keys_key_array_21, 5}, +u8 cpp_main_keys_key_array_3[] = {0x66,0x61,0x6c,0x73,0x65,}; +u8 cpp_main_keys_key_array_5[] = {0x73,0x68,0x6f,0x72,0x74,}; +u8 cpp_main_keys_key_array_6[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x61,0x73,0x73,0x65,0x72,0x74,}; +u8 cpp_main_keys_key_array_8[] = {0x74,0x68,0x72,0x65,0x61,0x64,0x5f,0x6c,0x6f,0x63,0x61,0x6c,}; +u8 cpp_main_keys_key_array_10[] = {0x64,0x79,0x6e,0x61,0x6d,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,}; +u8 cpp_main_keys_key_array_11[] = {0x74,0x79,0x70,0x65,0x69,0x64,}; +u8 cpp_main_keys_key_array_13[] = {0x6e,0x65,0x77,}; +u8 cpp_main_keys_key_array_14[] = {0x62,0x6f,0x6f,0x6c,}; +u8 cpp_main_keys_key_array_15[] = {0x74,0x72,0x79,}; +u8 cpp_main_keys_key_array_16[] = {0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,}; +u8 cpp_main_keys_key_array_18[] = {0x69,0x6e,0x74,}; +u8 cpp_main_keys_key_array_20[] = {0x73,0x77,0x69,0x74,0x63,0x68,}; +u8 cpp_main_keys_key_array_21[] = {0x61,0x6c,0x69,0x67,0x6e,0x6f,0x66,}; +u8 cpp_main_keys_key_array_23[] = {0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,}; +u8 cpp_main_keys_key_array_24[] = {0x69,0x6e,0x6c,0x69,0x6e,0x65,}; +u8 cpp_main_keys_key_array_25[] = {0x73,0x74,0x61,0x74,0x69,0x63,}; +u8 cpp_main_keys_key_array_26[] = {0x74,0x68,0x69,0x73,}; +u8 cpp_main_keys_key_array_27[] = {0x62,0x72,0x65,0x61,0x6b,}; +u8 cpp_main_keys_key_array_29[] = {0x63,0x61,0x73,0x65,}; +u8 cpp_main_keys_key_array_30[] = {0x69,0x66,}; +u8 cpp_main_keys_key_array_33[] = {0x64,0x6f,}; +u8 cpp_main_keys_key_array_36[] = {0x67,0x6f,0x74,0x6f,}; +u8 cpp_main_keys_key_array_37[] = {0x65,0x78,0x70,0x6c,0x69,0x63,0x69,0x74,}; +u8 cpp_main_keys_key_array_40[] = {0x76,0x6f,0x69,0x64,}; +u8 cpp_main_keys_key_array_41[] = {0x63,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,}; +u8 cpp_main_keys_key_array_42[] = {0x63,0x61,0x74,0x63,0x68,}; +u8 cpp_main_keys_key_array_44[] = {0x61,0x73,0x6d,}; +u8 cpp_main_keys_key_array_45[] = {0x73,0x69,0x67,0x6e,0x65,0x64,}; +u8 cpp_main_keys_key_array_46[] = {0x76,0x6f,0x6c,0x61,0x74,0x69,0x6c,0x65,}; +u8 cpp_main_keys_key_array_49[] = {0x70,0x72,0x69,0x76,0x61,0x74,0x65,}; +u8 cpp_main_keys_key_array_50[] = {0x64,0x6f,0x75,0x62,0x6c,0x65,}; +u8 cpp_main_keys_key_array_51[] = {0x74,0x79,0x70,0x65,0x6e,0x61,0x6d,0x65,}; +u8 cpp_main_keys_key_array_52[] = {0x76,0x69,0x72,0x74,0x75,0x61,0x6c,}; +u8 cpp_main_keys_key_array_53[] = {0x6e,0x6f,0x65,0x78,0x63,0x65,0x70,0x74,}; +u8 cpp_main_keys_key_array_57[] = {0x70,0x75,0x62,0x6c,0x69,0x63,}; +u8 cpp_main_keys_key_array_58[] = {0x63,0x6c,0x61,0x73,0x73,}; +u8 cpp_main_keys_key_array_59[] = {0x64,0x65,0x63,0x6c,0x74,0x79,0x70,0x65,}; +u8 cpp_main_keys_key_array_62[] = {0x74,0x65,0x6d,0x70,0x6c,0x61,0x74,0x65,}; +u8 cpp_main_keys_key_array_63[] = {0x65,0x78,0x70,0x6f,0x72,0x74,}; +u8 cpp_main_keys_key_array_64[] = {0x66,0x72,0x69,0x65,0x6e,0x64,}; +u8 cpp_main_keys_key_array_65[] = {0x63,0x6f,0x6e,0x73,0x74,}; +u8 cpp_main_keys_key_array_68[] = {0x77,0x68,0x69,0x6c,0x65,}; +u8 cpp_main_keys_key_array_69[] = {0x74,0x79,0x70,0x65,0x64,0x65,0x66,}; +u8 cpp_main_keys_key_array_70[] = {0x66,0x6c,0x6f,0x61,0x74,}; +u8 cpp_main_keys_key_array_73[] = {0x75,0x6e,0x69,0x6f,0x6e,}; +u8 cpp_main_keys_key_array_74[] = {0x61,0x6c,0x69,0x67,0x6e,0x61,0x73,}; +u8 cpp_main_keys_key_array_75[] = {0x72,0x65,0x69,0x6e,0x74,0x65,0x72,0x70,0x72,0x65,0x74,0x5f,0x63,0x61,0x73,0x74,}; +u8 cpp_main_keys_key_array_76[] = {0x73,0x74,0x72,0x75,0x63,0x74,}; +u8 cpp_main_keys_key_array_79[] = {0x6e,0x75,0x6c,0x6c,0x70,0x74,0x72,}; +u8 cpp_main_keys_key_array_82[] = {0x65,0x6e,0x75,0x6d,}; +u8 cpp_main_keys_key_array_84[] = {0x6c,0x6f,0x6e,0x67,}; +u8 cpp_main_keys_key_array_85[] = {0x75,0x6e,0x73,0x69,0x67,0x6e,0x65,0x64,}; +u8 cpp_main_keys_key_array_89[] = {0x63,0x6f,0x6e,0x73,0x74,0x5f,0x63,0x61,0x73,0x74,}; +u8 cpp_main_keys_key_array_94[] = {0x70,0x72,0x6f,0x74,0x65,0x63,0x74,0x65,0x64,}; +u8 cpp_main_keys_key_array_95[] = {0x66,0x6f,0x72,}; +u8 cpp_main_keys_key_array_96[] = {0x73,0x69,0x7a,0x65,0x6f,0x66,}; +u8 cpp_main_keys_key_array_97[] = {0x64,0x65,0x6c,0x65,0x74,0x65,}; +u8 cpp_main_keys_key_array_104[] = {0x63,0x68,0x61,0x72,}; +u8 cpp_main_keys_key_array_107[] = {0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,}; +u8 cpp_main_keys_key_array_109[] = {0x75,0x73,0x69,0x6e,0x67,}; +u8 cpp_main_keys_key_array_111[] = {0x65,0x78,0x74,0x65,0x72,0x6e,}; +u8 cpp_main_keys_key_array_112[] = {0x65,0x6c,0x73,0x65,}; +u8 cpp_main_keys_key_array_113[] = {0x74,0x72,0x75,0x65,}; +u8 cpp_main_keys_key_array_117[] = {0x72,0x65,0x74,0x75,0x72,0x6e,}; +u8 cpp_main_keys_key_array_119[] = {0x64,0x65,0x66,0x61,0x75,0x6c,0x74,}; +u8 cpp_main_keys_key_array_120[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,}; +String_Const_u8 cpp_main_keys_key_array[121] = { {0, 0}, {0, 0}, {0, 0}, -{cpp_main_keys_key_array_25, 8}, -{cpp_main_keys_key_array_26, 6}, +{cpp_main_keys_key_array_3, 5}, {0, 0}, -{cpp_main_keys_key_array_28, 7}, -{cpp_main_keys_key_array_29, 3}, +{cpp_main_keys_key_array_5, 5}, +{cpp_main_keys_key_array_6, 13}, {0, 0}, -{cpp_main_keys_key_array_31, 4}, +{cpp_main_keys_key_array_8, 12}, +{0, 0}, +{cpp_main_keys_key_array_10, 12}, +{cpp_main_keys_key_array_11, 6}, +{0, 0}, +{cpp_main_keys_key_array_13, 3}, +{cpp_main_keys_key_array_14, 4}, +{cpp_main_keys_key_array_15, 3}, +{cpp_main_keys_key_array_16, 8}, +{0, 0}, +{cpp_main_keys_key_array_18, 3}, +{0, 0}, +{cpp_main_keys_key_array_20, 6}, +{cpp_main_keys_key_array_21, 7}, +{0, 0}, +{cpp_main_keys_key_array_23, 9}, +{cpp_main_keys_key_array_24, 6}, +{cpp_main_keys_key_array_25, 6}, +{cpp_main_keys_key_array_26, 4}, +{cpp_main_keys_key_array_27, 5}, +{0, 0}, +{cpp_main_keys_key_array_29, 4}, +{cpp_main_keys_key_array_30, 2}, {0, 0}, {0, 0}, -{cpp_main_keys_key_array_34, 6}, -{0, 0}, -{cpp_main_keys_key_array_36, 6}, -{0, 0}, -{cpp_main_keys_key_array_38, 5}, -{cpp_main_keys_key_array_39, 5}, -{cpp_main_keys_key_array_40, 2}, -{cpp_main_keys_key_array_41, 13}, -{cpp_main_keys_key_array_42, 12}, +{cpp_main_keys_key_array_33, 2}, {0, 0}, {0, 0}, -{cpp_main_keys_key_array_45, 4}, +{cpp_main_keys_key_array_36, 4}, +{cpp_main_keys_key_array_37, 8}, {0, 0}, {0, 0}, -{cpp_main_keys_key_array_48, 3}, +{cpp_main_keys_key_array_40, 4}, +{cpp_main_keys_key_array_41, 8}, +{cpp_main_keys_key_array_42, 5}, {0, 0}, -{cpp_main_keys_key_array_50, 12}, +{cpp_main_keys_key_array_44, 3}, +{cpp_main_keys_key_array_45, 6}, +{cpp_main_keys_key_array_46, 8}, +{0, 0}, +{0, 0}, +{cpp_main_keys_key_array_49, 7}, +{cpp_main_keys_key_array_50, 6}, +{cpp_main_keys_key_array_51, 8}, +{cpp_main_keys_key_array_52, 7}, +{cpp_main_keys_key_array_53, 8}, {0, 0}, {0, 0}, {0, 0}, -{0, 0}, -{cpp_main_keys_key_array_55, 4}, -{cpp_main_keys_key_array_56, 4}, -{cpp_main_keys_key_array_57, 7}, +{cpp_main_keys_key_array_57, 6}, +{cpp_main_keys_key_array_58, 5}, +{cpp_main_keys_key_array_59, 8}, {0, 0}, {0, 0}, +{cpp_main_keys_key_array_62, 8}, +{cpp_main_keys_key_array_63, 6}, +{cpp_main_keys_key_array_64, 6}, +{cpp_main_keys_key_array_65, 5}, {0, 0}, {0, 0}, -{0, 0}, -{cpp_main_keys_key_array_63, 4}, -{cpp_main_keys_key_array_64, 3}, -{cpp_main_keys_key_array_65, 7}, +{cpp_main_keys_key_array_68, 5}, +{cpp_main_keys_key_array_69, 7}, +{cpp_main_keys_key_array_70, 5}, {0, 0}, {0, 0}, -{cpp_main_keys_key_array_68, 7}, -{cpp_main_keys_key_array_69, 6}, +{cpp_main_keys_key_array_73, 5}, +{cpp_main_keys_key_array_74, 7}, +{cpp_main_keys_key_array_75, 16}, +{cpp_main_keys_key_array_76, 6}, {0, 0}, {0, 0}, +{cpp_main_keys_key_array_79, 7}, {0, 0}, {0, 0}, -{cpp_main_keys_key_array_74, 6}, -{cpp_main_keys_key_array_75, 4}, -{cpp_main_keys_key_array_76, 8}, -{cpp_main_keys_key_array_77, 5}, +{cpp_main_keys_key_array_82, 4}, {0, 0}, -{0, 0}, -{0, 0}, -{cpp_main_keys_key_array_81, 6}, -{cpp_main_keys_key_array_82, 3}, -{cpp_main_keys_key_array_83, 5}, {cpp_main_keys_key_array_84, 4}, -{0, 0}, -{cpp_main_keys_key_array_86, 10}, -{0, 0}, -{cpp_main_keys_key_array_88, 8}, -{0, 0}, -{cpp_main_keys_key_array_90, 16}, -{cpp_main_keys_key_array_91, 8}, +{cpp_main_keys_key_array_85, 8}, {0, 0}, {0, 0}, -{cpp_main_keys_key_array_94, 6}, -{cpp_main_keys_key_array_95, 7}, +{0, 0}, +{cpp_main_keys_key_array_89, 10}, +{0, 0}, +{0, 0}, +{0, 0}, +{0, 0}, +{cpp_main_keys_key_array_94, 9}, +{cpp_main_keys_key_array_95, 3}, {cpp_main_keys_key_array_96, 6}, {cpp_main_keys_key_array_97, 6}, {0, 0}, {0, 0}, -{cpp_main_keys_key_array_100, 6}, -{0, 0}, -{0, 0}, -{cpp_main_keys_key_array_103, 8}, -{cpp_main_keys_key_array_104, 5}, -{cpp_main_keys_key_array_105, 8}, -{cpp_main_keys_key_array_106, 8}, -{0, 0}, -{cpp_main_keys_key_array_108, 5}, -{0, 0}, -{0, 0}, -{cpp_main_keys_key_array_111, 8}, -{cpp_main_keys_key_array_112, 5}, -{cpp_main_keys_key_array_113, 8}, -{cpp_main_keys_key_array_114, 7}, {0, 0}, {0, 0}, {0, 0}, -{cpp_main_keys_key_array_118, 4}, +{0, 0}, +{cpp_main_keys_key_array_104, 4}, +{0, 0}, +{0, 0}, +{cpp_main_keys_key_array_107, 8}, +{0, 0}, +{cpp_main_keys_key_array_109, 5}, +{0, 0}, +{cpp_main_keys_key_array_111, 6}, +{cpp_main_keys_key_array_112, 4}, +{cpp_main_keys_key_array_113, 4}, {0, 0}, {0, 0}, {0, 0}, -{cpp_main_keys_key_array_122, 6}, -{cpp_main_keys_key_array_123, 9}, +{cpp_main_keys_key_array_117, 6}, +{0, 0}, +{cpp_main_keys_key_array_119, 7}, +{cpp_main_keys_key_array_120, 11}, }; -Lexeme_Table_Value cpp_main_keys_value_array[124] = { -{8, TokenCppKind_LiteralTrue}, -{0, 0}, -{4, TokenCppKind_Signed}, -{4, TokenCppKind_Virtual}, -{4, TokenCppKind_Do}, -{0, 0}, -{4, TokenCppKind_Protected}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Double}, -{4, TokenCppKind_Public}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Class}, -{4, TokenCppKind_Template}, -{4, TokenCppKind_StaticCast}, -{4, TokenCppKind_Catch}, -{4, TokenCppKind_Goto}, -{0, 0}, -{4, TokenCppKind_Asm}, -{0, 0}, -{4, TokenCppKind_Break}, +Lexeme_Table_Value cpp_main_keys_value_array[121] = { {0, 0}, {0, 0}, {0, 0}, -{4, TokenCppKind_Volatile}, -{4, TokenCppKind_Switch}, -{0, 0}, -{4, TokenCppKind_Typedef}, -{4, TokenCppKind_Try}, -{0, 0}, -{4, TokenCppKind_Else}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Return}, -{0, 0}, -{4, TokenCppKind_SizeOf}, -{0, 0}, -{4, TokenCppKind_Const}, {8, TokenCppKind_LiteralFalse}, -{4, TokenCppKind_If}, +{0, 0}, +{4, TokenCppKind_Short}, {4, TokenCppKind_StaticAssert}, +{0, 0}, {4, TokenCppKind_ThreadLocal}, {0, 0}, +{4, TokenCppKind_DynamicCast}, +{4, TokenCppKind_TypeID}, {0, 0}, -{4, TokenCppKind_This}, -{0, 0}, +{4, TokenCppKind_New}, +{4, TokenCppKind_Bool}, +{4, TokenCppKind_Try}, +{4, TokenCppKind_Operator}, {0, 0}, {4, TokenCppKind_Int}, {0, 0}, -{4, TokenCppKind_DynamicCast}, +{4, TokenCppKind_Switch}, +{4, TokenCppKind_AlignOf}, +{0, 0}, +{4, TokenCppKind_Namespace}, +{4, TokenCppKind_Inline}, +{4, TokenCppKind_Static}, +{4, TokenCppKind_This}, +{4, TokenCppKind_Break}, +{0, 0}, +{4, TokenCppKind_Case}, +{4, TokenCppKind_If}, {0, 0}, {0, 0}, +{4, TokenCppKind_Do}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Goto}, +{4, TokenCppKind_Explicit}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Void}, +{4, TokenCppKind_Continue}, +{4, TokenCppKind_Catch}, +{0, 0}, +{4, TokenCppKind_Asm}, +{4, TokenCppKind_Signed}, +{4, TokenCppKind_Volatile}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Private}, +{4, TokenCppKind_Double}, +{4, TokenCppKind_Typename}, +{4, TokenCppKind_Virtual}, +{4, TokenCppKind_NoExcept}, +{0, 0}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Public}, +{4, TokenCppKind_Class}, +{4, TokenCppKind_DeclType}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Template}, +{4, TokenCppKind_Export}, +{4, TokenCppKind_Friend}, +{4, TokenCppKind_Const}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_While}, +{4, TokenCppKind_Typedef}, +{4, TokenCppKind_Float}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Union}, +{4, TokenCppKind_AlignAs}, +{4, TokenCppKind_ReinterpretCast}, +{4, TokenCppKind_Struct}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_NullPtr}, {0, 0}, {0, 0}, {4, TokenCppKind_Enum}, -{4, TokenCppKind_Char}, -{4, TokenCppKind_AlignAs}, +{0, 0}, +{4, TokenCppKind_Long}, +{4, TokenCppKind_Unsigned}, +{0, 0}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_ConstCast}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, -{0, 0}, -{4, TokenCppKind_Case}, +{4, TokenCppKind_Protected}, {4, TokenCppKind_For}, -{4, TokenCppKind_AlignOf}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Default}, +{4, TokenCppKind_SizeOf}, {4, TokenCppKind_Delete}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, -{4, TokenCppKind_Extern}, -{4, TokenCppKind_Long}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Char}, +{0, 0}, +{0, 0}, {4, TokenCppKind_Register}, -{4, TokenCppKind_While}, {0, 0}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Inline}, -{4, TokenCppKind_New}, -{4, TokenCppKind_Float}, -{4, TokenCppKind_Bool}, -{0, 0}, -{4, TokenCppKind_ConstCast}, -{0, 0}, -{4, TokenCppKind_Operator}, -{0, 0}, -{4, TokenCppKind_ReinterpretCast}, -{4, TokenCppKind_Explicit}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Struct}, -{4, TokenCppKind_NullPtr}, -{4, TokenCppKind_Export}, -{4, TokenCppKind_Static}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Friend}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Continue}, {4, TokenCppKind_Using}, -{4, TokenCppKind_DeclType}, -{4, TokenCppKind_Unsigned}, {0, 0}, -{4, TokenCppKind_Short}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Typename}, -{4, TokenCppKind_Union}, -{4, TokenCppKind_NoExcept}, -{4, TokenCppKind_Private}, +{4, TokenCppKind_Extern}, +{4, TokenCppKind_Else}, +{8, TokenCppKind_LiteralTrue}, {0, 0}, {0, 0}, {0, 0}, -{4, TokenCppKind_Void}, +{4, TokenCppKind_Return}, {0, 0}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_TypeID}, -{4, TokenCppKind_Namespace}, +{4, TokenCppKind_Default}, +{4, TokenCppKind_StaticCast}, }; -i32 cpp_main_keys_slot_count = 124; -u64 cpp_main_keys_seed = 0x8546da5e0b8a4494; +i32 cpp_main_keys_slot_count = 121; +u64 cpp_main_keys_seed = 0xbe799f2fde8371d5; u64 cpp_pp_directives_hash_array[25] = { -0xa9c93e3b092cb44d,0x0000000000000000,0x0dd88216be8f0f45,0x0000000000000000, -0x0dd88216bc8af78d,0x92a889595c683c55,0xdab9e300145b906f,0x92a889577e972a4b, -0x0000000000000000,0x0dd88216bb8053ff,0x0000000000000000,0x0dd88216bd573601, -0x0000000000000000,0xdab9e300142a071d,0x0000000000000000,0xa9c93ef34054fce1, -0x0dd88216a4783a45,0xdab9e300145b9a25,0x92a889595b4a2105,0x0000000000000000, -0x86d1d427e10cd86d,0x0000000000000000,0x92a889590753d01d,0x0000000000000000, -0x0000000000000000, +0x0000000000000000,0x7374aea13484b05f,0x0000000000000000,0x13df0688ba346a0b, +0x13df0688baa01c5b,0x0000000000000000,0x7608ddc2856c80e7,0x7608ddb7913d492b, +0xa00a5f761251a671,0x7374abedc5e7bf23,0x0000000000000000,0x7608ddb7b08326a7, +0x0000000000000000,0x0000000000000000,0x13df0688bc2f3331,0x0000000000000000, +0x7608ddc8a5840d1d,0x13df068884fd102b,0x0000000000000000,0xc7e053324abe568b, +0xa00a5f761208b767,0x0000000000000000,0x0000000000000000,0xa00a5f761251cfeb, +0x13df0688bc39ad2b, }; -u8 cpp_pp_directives_key_array_0[] = {0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,}; -u8 cpp_pp_directives_key_array_2[] = {0x69,0x66,0x64,0x65,0x66,}; -u8 cpp_pp_directives_key_array_4[] = {0x65,0x6e,0x64,0x69,0x66,}; -u8 cpp_pp_directives_key_array_5[] = {0x69,0x66,0x6e,0x64,0x65,0x66,}; -u8 cpp_pp_directives_key_array_6[] = {0x65,0x6c,0x73,0x65,}; -u8 cpp_pp_directives_key_array_7[] = {0x70,0x72,0x61,0x67,0x6d,0x61,}; -u8 cpp_pp_directives_key_array_9[] = {0x75,0x73,0x69,0x6e,0x67,}; -u8 cpp_pp_directives_key_array_11[] = {0x65,0x72,0x72,0x6f,0x72,}; -u8 cpp_pp_directives_key_array_13[] = {0x6c,0x69,0x6e,0x65,}; -u8 cpp_pp_directives_key_array_15[] = {0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,}; -u8 cpp_pp_directives_key_array_16[] = {0x75,0x6e,0x64,0x65,0x66,}; -u8 cpp_pp_directives_key_array_17[] = {0x65,0x6c,0x69,0x66,}; -u8 cpp_pp_directives_key_array_18[] = {0x69,0x6d,0x70,0x6f,0x72,0x74,}; -u8 cpp_pp_directives_key_array_20[] = {0x69,0x66,}; -u8 cpp_pp_directives_key_array_22[] = {0x64,0x65,0x66,0x69,0x6e,0x65,}; +u8 cpp_pp_directives_key_array_1[] = {0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,}; +u8 cpp_pp_directives_key_array_3[] = {0x65,0x6e,0x64,0x69,0x66,}; +u8 cpp_pp_directives_key_array_4[] = {0x65,0x72,0x72,0x6f,0x72,}; +u8 cpp_pp_directives_key_array_6[] = {0x64,0x65,0x66,0x69,0x6e,0x65,}; +u8 cpp_pp_directives_key_array_7[] = {0x69,0x66,0x6e,0x64,0x65,0x66,}; +u8 cpp_pp_directives_key_array_8[] = {0x65,0x6c,0x73,0x65,}; +u8 cpp_pp_directives_key_array_9[] = {0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,}; +u8 cpp_pp_directives_key_array_11[] = {0x69,0x6d,0x70,0x6f,0x72,0x74,}; +u8 cpp_pp_directives_key_array_14[] = {0x75,0x73,0x69,0x6e,0x67,}; +u8 cpp_pp_directives_key_array_16[] = {0x70,0x72,0x61,0x67,0x6d,0x61,}; +u8 cpp_pp_directives_key_array_17[] = {0x69,0x66,0x64,0x65,0x66,}; +u8 cpp_pp_directives_key_array_19[] = {0x69,0x66,}; +u8 cpp_pp_directives_key_array_20[] = {0x6c,0x69,0x6e,0x65,}; +u8 cpp_pp_directives_key_array_23[] = {0x65,0x6c,0x69,0x66,}; +u8 cpp_pp_directives_key_array_24[] = {0x75,0x6e,0x64,0x65,0x66,}; String_Const_u8 cpp_pp_directives_key_array[25] = { -{cpp_pp_directives_key_array_0, 7}, {0, 0}, -{cpp_pp_directives_key_array_2, 5}, +{cpp_pp_directives_key_array_1, 7}, {0, 0}, +{cpp_pp_directives_key_array_3, 5}, {cpp_pp_directives_key_array_4, 5}, -{cpp_pp_directives_key_array_5, 6}, -{cpp_pp_directives_key_array_6, 4}, +{0, 0}, +{cpp_pp_directives_key_array_6, 6}, {cpp_pp_directives_key_array_7, 6}, +{cpp_pp_directives_key_array_8, 4}, +{cpp_pp_directives_key_array_9, 7}, {0, 0}, -{cpp_pp_directives_key_array_9, 5}, -{0, 0}, -{cpp_pp_directives_key_array_11, 5}, -{0, 0}, -{cpp_pp_directives_key_array_13, 4}, -{0, 0}, -{cpp_pp_directives_key_array_15, 7}, -{cpp_pp_directives_key_array_16, 5}, -{cpp_pp_directives_key_array_17, 4}, -{cpp_pp_directives_key_array_18, 6}, -{0, 0}, -{cpp_pp_directives_key_array_20, 2}, -{0, 0}, -{cpp_pp_directives_key_array_22, 6}, +{cpp_pp_directives_key_array_11, 6}, {0, 0}, {0, 0}, +{cpp_pp_directives_key_array_14, 5}, +{0, 0}, +{cpp_pp_directives_key_array_16, 6}, +{cpp_pp_directives_key_array_17, 5}, +{0, 0}, +{cpp_pp_directives_key_array_19, 2}, +{cpp_pp_directives_key_array_20, 4}, +{0, 0}, +{0, 0}, +{cpp_pp_directives_key_array_23, 4}, +{cpp_pp_directives_key_array_24, 5}, }; Lexeme_Table_Value cpp_pp_directives_value_array[25] = { -{5, TokenCppKind_PPVersion}, {0, 0}, -{5, TokenCppKind_PPIfDef}, +{5, TokenCppKind_PPInclude}, {0, 0}, {5, TokenCppKind_PPEndIf}, +{5, TokenCppKind_PPError}, +{0, 0}, +{5, TokenCppKind_PPDefine}, {5, TokenCppKind_PPIfNDef}, {5, TokenCppKind_PPElse}, -{5, TokenCppKind_PPPragma}, +{5, TokenCppKind_PPVersion}, +{0, 0}, +{5, TokenCppKind_PPImport}, +{0, 0}, {0, 0}, {5, TokenCppKind_PPUsing}, {0, 0}, -{5, TokenCppKind_PPError}, -{0, 0}, -{5, TokenCppKind_PPLine}, -{0, 0}, -{5, TokenCppKind_PPInclude}, -{5, TokenCppKind_PPUndef}, -{5, TokenCppKind_PPElIf}, -{5, TokenCppKind_PPImport}, +{5, TokenCppKind_PPPragma}, +{5, TokenCppKind_PPIfDef}, {0, 0}, {5, TokenCppKind_PPIf}, -{0, 0}, -{5, TokenCppKind_PPDefine}, +{5, TokenCppKind_PPLine}, {0, 0}, {0, 0}, +{5, TokenCppKind_PPElIf}, +{5, TokenCppKind_PPUndef}, }; i32 cpp_pp_directives_slot_count = 25; -u64 cpp_pp_directives_seed = 0x6e8a1011f7d8dd90; +u64 cpp_pp_directives_seed = 0xd17159c86f8daa32; u64 cpp_pp_keys_hash_array[2] = { -0x56dd32803fcaa4ab,0x0000000000000000, +0x0000000000000000,0x11c2628dcdcd8d85, }; -u8 cpp_pp_keys_key_array_0[] = {0x64,0x65,0x66,0x69,0x6e,0x65,0x64,}; +u8 cpp_pp_keys_key_array_1[] = {0x64,0x65,0x66,0x69,0x6e,0x65,0x64,}; String_Const_u8 cpp_pp_keys_key_array[2] = { -{cpp_pp_keys_key_array_0, 7}, {0, 0}, +{cpp_pp_keys_key_array_1, 7}, }; Lexeme_Table_Value cpp_pp_keys_value_array[2] = { -{4, TokenCppKind_PPDefined}, {0, 0}, +{4, TokenCppKind_PPDefined}, }; i32 cpp_pp_keys_slot_count = 2; -u64 cpp_pp_keys_seed = 0xbb7907ea1860ef2c; +u64 cpp_pp_keys_seed = 0x965fd683eb991685; struct Lex_State_Cpp{ u32 flags_ZF0; u32 flags_KF0; @@ -560,10 +554,10 @@ token.kind = 2; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -643,10 +637,10 @@ token.kind = 13; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -665,10 +659,10 @@ token.kind = 14; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -697,10 +691,10 @@ token.kind = 15; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -750,10 +744,10 @@ token.kind = 15; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -791,10 +785,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -830,10 +824,10 @@ token.kind = 13; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -857,10 +851,10 @@ token.kind = 14; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -879,10 +873,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -907,10 +901,10 @@ token.kind = 11; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -934,10 +928,10 @@ token.kind = 12; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -956,10 +950,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1038,10 +1032,10 @@ token.kind = 6; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1088,10 +1082,10 @@ token.kind = 1; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1151,10 +1145,10 @@ token.kind = 10; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1196,10 +1190,10 @@ token.kind = 1; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1218,10 +1212,10 @@ token.kind = 1; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1263,10 +1257,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1285,10 +1279,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1341,10 +1335,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1373,10 +1367,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1418,10 +1412,10 @@ token.kind = 8; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1494,10 +1488,10 @@ token.kind = 8; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1577,10 +1571,10 @@ token.kind = 9; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1610,10 +1604,10 @@ token.kind = 9; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1632,10 +1626,10 @@ token.kind = 9; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1677,10 +1671,10 @@ token.kind = 9; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1710,10 +1704,10 @@ token.kind = 9; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1732,10 +1726,10 @@ token.kind = 9; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1777,10 +1771,10 @@ token.kind = 9; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1805,10 +1799,10 @@ token.kind = 9; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1827,10 +1821,10 @@ token.kind = 9; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1872,10 +1866,10 @@ token.kind = 9; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1900,10 +1894,10 @@ token.kind = 9; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1922,10 +1916,10 @@ token.kind = 9; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -1967,10 +1961,10 @@ token.kind = 2; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2020,10 +2014,10 @@ token.kind = 8; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2088,10 +2082,10 @@ token.kind = 8; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2175,10 +2169,10 @@ token.kind = 8; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2250,10 +2244,10 @@ token.kind = 8; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2287,10 +2281,10 @@ token.kind = 8; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2352,10 +2346,10 @@ token.kind = 8; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2384,10 +2378,10 @@ token.kind = 8; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2449,10 +2443,10 @@ token.kind = 8; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2481,10 +2475,10 @@ token.kind = 8; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2551,10 +2545,10 @@ token.kind = 8; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2583,10 +2577,10 @@ token.kind = 8; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2648,10 +2642,10 @@ token.kind = 8; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2680,10 +2674,10 @@ token.kind = 8; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2725,10 +2719,10 @@ token.kind = 2; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2824,10 +2818,10 @@ state.flags_KF0 |= 0x2; } token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2882,10 +2876,10 @@ token.kind = 2; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2918,10 +2912,10 @@ token.kind = 10; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2963,10 +2957,10 @@ token.kind = 2; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -2999,10 +2993,10 @@ token.kind = 10; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -3171,10 +3165,10 @@ token.kind = 2; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -3214,10 +3208,10 @@ token.kind = 10; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -3260,10 +3254,10 @@ token.kind = 10; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -3637,10 +3631,10 @@ token.kind = 2; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -3768,10 +3762,10 @@ token.kind = 10; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -3895,10 +3889,10 @@ token.kind = 3; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -3945,10 +3939,10 @@ token.kind = 3; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -3990,10 +3984,10 @@ token.kind = 15; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4012,10 +4006,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4057,10 +4051,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4079,10 +4073,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4101,10 +4095,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4146,10 +4140,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4168,10 +4162,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4190,10 +4184,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4240,10 +4234,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4262,10 +4256,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4307,10 +4301,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4362,10 +4356,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4384,10 +4378,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4434,10 +4428,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4456,10 +4450,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4501,10 +4495,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4523,10 +4517,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4568,10 +4562,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4590,10 +4584,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4635,10 +4629,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4657,10 +4651,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4702,10 +4696,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4724,10 +4718,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4769,10 +4763,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4791,10 +4785,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4836,10 +4830,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4858,10 +4852,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4903,10 +4897,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4925,10 +4919,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4970,10 +4964,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -4992,10 +4986,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -5037,10 +5031,10 @@ token.kind = 15; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -5059,10 +5053,10 @@ token.kind = 15; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -5104,10 +5098,10 @@ token.kind = 2; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root @@ -5126,10 +5120,10 @@ token.kind = 7; }while(0); token_list_push(arena, list, &token); emit_counter += 1; +state.emit_ptr = state.ptr; if (emit_counter == max){ goto end; } -state.emit_ptr = state.ptr; } state.flags_ZF0 = 0; goto state_label_1; // root diff --git a/custom/generated/system_api.cpp b/custom/generated/system_api.cpp index 155bee65..990f8768 100644 --- a/custom/generated/system_api.cpp +++ b/custom/generated/system_api.cpp @@ -18,7 +18,10 @@ vtable->wake_up_timer_release = system_wake_up_timer_release; vtable->wake_up_timer_set = system_wake_up_timer_set; vtable->signal_step = system_signal_step; vtable->sleep = system_sleep; +vtable->get_clipboard = system_get_clipboard; vtable->post_clipboard = system_post_clipboard; +vtable->set_clipboard_catch_all = system_set_clipboard_catch_all; +vtable->get_clipboard_catch_all = system_get_clipboard_catch_all; vtable->cli_call = system_cli_call; vtable->cli_begin_update = system_cli_begin_update; vtable->cli_update_step = system_cli_update_step; @@ -69,7 +72,10 @@ system_wake_up_timer_release = vtable->wake_up_timer_release; system_wake_up_timer_set = vtable->wake_up_timer_set; system_signal_step = vtable->signal_step; system_sleep = vtable->sleep; +system_get_clipboard = vtable->get_clipboard; system_post_clipboard = vtable->post_clipboard; +system_set_clipboard_catch_all = vtable->set_clipboard_catch_all; +system_get_clipboard_catch_all = vtable->get_clipboard_catch_all; system_cli_call = vtable->cli_call; system_cli_begin_update = vtable->cli_begin_update; system_cli_update_step = vtable->cli_update_step; diff --git a/custom/generated/system_api.h b/custom/generated/system_api.h index f67a518f..c01eabd1 100644 --- a/custom/generated/system_api.h +++ b/custom/generated/system_api.h @@ -16,7 +16,10 @@ #define system_wake_up_timer_set_sig() void system_wake_up_timer_set(Plat_Handle handle, u32 time_milliseconds) #define system_signal_step_sig() void system_signal_step(u32 code) #define system_sleep_sig() void system_sleep(u64 microseconds) -#define system_post_clipboard_sig() void system_post_clipboard(String_Const_u8 str) +#define system_get_clipboard_sig() String_Const_u8 system_get_clipboard(Arena* arena, i32 index) +#define system_post_clipboard_sig() void system_post_clipboard(String_Const_u8 str, i32 index) +#define system_set_clipboard_catch_all_sig() void system_set_clipboard_catch_all(b32 enabled) +#define system_get_clipboard_catch_all_sig() b32 system_get_clipboard_catch_all(void) #define system_cli_call_sig() b32 system_cli_call(Arena* scratch, char* path, char* script, CLI_Handles* cli_out) #define system_cli_begin_update_sig() void system_cli_begin_update(CLI_Handles* cli) #define system_cli_update_step_sig() b32 system_cli_update_step(CLI_Handles* cli, char* dest, u32 max, u32* amount) @@ -63,7 +66,10 @@ typedef void system_wake_up_timer_release_type(Plat_Handle handle); typedef void system_wake_up_timer_set_type(Plat_Handle handle, u32 time_milliseconds); typedef void system_signal_step_type(u32 code); typedef void system_sleep_type(u64 microseconds); -typedef void system_post_clipboard_type(String_Const_u8 str); +typedef String_Const_u8 system_get_clipboard_type(Arena* arena, i32 index); +typedef void system_post_clipboard_type(String_Const_u8 str, i32 index); +typedef void system_set_clipboard_catch_all_type(b32 enabled); +typedef b32 system_get_clipboard_catch_all_type(void); typedef b32 system_cli_call_type(Arena* scratch, char* path, char* script, CLI_Handles* cli_out); typedef void system_cli_begin_update_type(CLI_Handles* cli); typedef b32 system_cli_update_step_type(CLI_Handles* cli, char* dest, u32 max, u32* amount); @@ -93,53 +99,56 @@ typedef b32 system_set_fullscreen_type(b32 full_screen); typedef b32 system_is_fullscreen_type(void); typedef Input_Modifier_Set system_get_keyboard_modifiers_type(Arena* arena); struct API_VTable_system{ - system_get_path_type *get_path; - system_get_canonical_type *get_canonical; - system_get_file_list_type *get_file_list; - system_quick_file_attributes_type *quick_file_attributes; - system_load_handle_type *load_handle; - system_load_attributes_type *load_attributes; - system_load_file_type *load_file; - system_load_close_type *load_close; - system_save_file_type *save_file; - system_load_library_type *load_library; - system_release_library_type *release_library; - system_get_proc_type *get_proc; - system_now_time_type *now_time; - system_wake_up_timer_create_type *wake_up_timer_create; - system_wake_up_timer_release_type *wake_up_timer_release; - system_wake_up_timer_set_type *wake_up_timer_set; - system_signal_step_type *signal_step; - system_sleep_type *sleep; - system_post_clipboard_type *post_clipboard; - system_cli_call_type *cli_call; - system_cli_begin_update_type *cli_begin_update; - system_cli_update_step_type *cli_update_step; - system_cli_end_update_type *cli_end_update; - system_open_color_picker_type *open_color_picker; - system_get_screen_scale_factor_type *get_screen_scale_factor; - system_thread_launch_type *thread_launch; - system_thread_join_type *thread_join; - system_thread_free_type *thread_free; - system_thread_get_id_type *thread_get_id; - system_acquire_global_frame_mutex_type *acquire_global_frame_mutex; - system_release_global_frame_mutex_type *release_global_frame_mutex; - system_mutex_make_type *mutex_make; - system_mutex_acquire_type *mutex_acquire; - system_mutex_release_type *mutex_release; - system_mutex_free_type *mutex_free; - system_condition_variable_make_type *condition_variable_make; - system_condition_variable_wait_type *condition_variable_wait; - system_condition_variable_signal_type *condition_variable_signal; - system_condition_variable_free_type *condition_variable_free; - system_memory_allocate_type *memory_allocate; - system_memory_set_protection_type *memory_set_protection; - system_memory_free_type *memory_free; - system_memory_annotation_type *memory_annotation; - system_show_mouse_cursor_type *show_mouse_cursor; - system_set_fullscreen_type *set_fullscreen; - system_is_fullscreen_type *is_fullscreen; - system_get_keyboard_modifiers_type *get_keyboard_modifiers; +system_get_path_type *get_path; +system_get_canonical_type *get_canonical; +system_get_file_list_type *get_file_list; +system_quick_file_attributes_type *quick_file_attributes; +system_load_handle_type *load_handle; +system_load_attributes_type *load_attributes; +system_load_file_type *load_file; +system_load_close_type *load_close; +system_save_file_type *save_file; +system_load_library_type *load_library; +system_release_library_type *release_library; +system_get_proc_type *get_proc; +system_now_time_type *now_time; +system_wake_up_timer_create_type *wake_up_timer_create; +system_wake_up_timer_release_type *wake_up_timer_release; +system_wake_up_timer_set_type *wake_up_timer_set; +system_signal_step_type *signal_step; +system_sleep_type *sleep; +system_get_clipboard_type *get_clipboard; +system_post_clipboard_type *post_clipboard; +system_set_clipboard_catch_all_type *set_clipboard_catch_all; +system_get_clipboard_catch_all_type *get_clipboard_catch_all; +system_cli_call_type *cli_call; +system_cli_begin_update_type *cli_begin_update; +system_cli_update_step_type *cli_update_step; +system_cli_end_update_type *cli_end_update; +system_open_color_picker_type *open_color_picker; +system_get_screen_scale_factor_type *get_screen_scale_factor; +system_thread_launch_type *thread_launch; +system_thread_join_type *thread_join; +system_thread_free_type *thread_free; +system_thread_get_id_type *thread_get_id; +system_acquire_global_frame_mutex_type *acquire_global_frame_mutex; +system_release_global_frame_mutex_type *release_global_frame_mutex; +system_mutex_make_type *mutex_make; +system_mutex_acquire_type *mutex_acquire; +system_mutex_release_type *mutex_release; +system_mutex_free_type *mutex_free; +system_condition_variable_make_type *condition_variable_make; +system_condition_variable_wait_type *condition_variable_wait; +system_condition_variable_signal_type *condition_variable_signal; +system_condition_variable_free_type *condition_variable_free; +system_memory_allocate_type *memory_allocate; +system_memory_set_protection_type *memory_set_protection; +system_memory_free_type *memory_free; +system_memory_annotation_type *memory_annotation; +system_show_mouse_cursor_type *show_mouse_cursor; +system_set_fullscreen_type *set_fullscreen; +system_is_fullscreen_type *is_fullscreen; +system_get_keyboard_modifiers_type *get_keyboard_modifiers; }; #if defined(STATIC_LINK_API) internal String_Const_u8 system_get_path(Arena* arena, System_Path_Code path_code); @@ -160,7 +169,10 @@ internal void system_wake_up_timer_release(Plat_Handle handle); internal void system_wake_up_timer_set(Plat_Handle handle, u32 time_milliseconds); internal void system_signal_step(u32 code); internal void system_sleep(u64 microseconds); -internal void system_post_clipboard(String_Const_u8 str); +internal String_Const_u8 system_get_clipboard(Arena* arena, i32 index); +internal void system_post_clipboard(String_Const_u8 str, i32 index); +internal void system_set_clipboard_catch_all(b32 enabled); +internal b32 system_get_clipboard_catch_all(void); internal b32 system_cli_call(Arena* scratch, char* path, char* script, CLI_Handles* cli_out); internal void system_cli_begin_update(CLI_Handles* cli); internal b32 system_cli_update_step(CLI_Handles* cli, char* dest, u32 max, u32* amount); @@ -209,7 +221,10 @@ global system_wake_up_timer_release_type *system_wake_up_timer_release = 0; global system_wake_up_timer_set_type *system_wake_up_timer_set = 0; global system_signal_step_type *system_signal_step = 0; global system_sleep_type *system_sleep = 0; +global system_get_clipboard_type *system_get_clipboard = 0; global system_post_clipboard_type *system_post_clipboard = 0; +global system_set_clipboard_catch_all_type *system_set_clipboard_catch_all = 0; +global system_get_clipboard_catch_all_type *system_get_clipboard_catch_all = 0; global system_cli_call_type *system_cli_call = 0; global system_cli_begin_update_type *system_cli_begin_update = 0; global system_cli_update_step_type *system_cli_update_step = 0; diff --git a/custom/generated/system_api_constructor.cpp b/custom/generated/system_api_constructor.cpp index 530774fe..9f6c558f 100644 --- a/custom/generated/system_api_constructor.cpp +++ b/custom/generated/system_api_constructor.cpp @@ -88,8 +88,22 @@ API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("sleep" api_param(arena, call, "u64", "microseconds"); } { +API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("get_clipboard"), string_u8_litexpr("String_Const_u8"), string_u8_litexpr("")); +api_param(arena, call, "Arena*", "arena"); +api_param(arena, call, "i32", "index"); +} +{ API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("post_clipboard"), string_u8_litexpr("void"), string_u8_litexpr("")); api_param(arena, call, "String_Const_u8", "str"); +api_param(arena, call, "i32", "index"); +} +{ +API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("set_clipboard_catch_all"), string_u8_litexpr("void"), string_u8_litexpr("")); +api_param(arena, call, "b32", "enabled"); +} +{ +API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("get_clipboard_catch_all"), string_u8_litexpr("b32"), string_u8_litexpr("")); +(void)call; } { API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("cli_call"), string_u8_litexpr("b32"), string_u8_litexpr("")); diff --git a/custom/generated/system_api_master_list.h b/custom/generated/system_api_master_list.h index 5e49a84d..997234f4 100644 --- a/custom/generated/system_api_master_list.h +++ b/custom/generated/system_api_master_list.h @@ -16,7 +16,10 @@ api(system) function void wake_up_timer_release(Plat_Handle handle); api(system) function void wake_up_timer_set(Plat_Handle handle, u32 time_milliseconds); api(system) function void signal_step(u32 code); api(system) function void sleep(u64 microseconds); -api(system) function void post_clipboard(String_Const_u8 str); +api(system) function String_Const_u8 get_clipboard(Arena* arena, i32 index); +api(system) function void post_clipboard(String_Const_u8 str, i32 index); +api(system) function void set_clipboard_catch_all(b32 enabled); +api(system) function b32 get_clipboard_catch_all(void); api(system) function b32 cli_call(Arena* scratch, char* path, char* script, CLI_Handles* cli_out); api(system) function void cli_begin_update(CLI_Handles* cli); api(system) function b32 cli_update_step(CLI_Handles* cli, char* dest, u32 max, u32* amount); diff --git a/custom/lexer_generator/4coder_lex_gen_main.cpp b/custom/lexer_generator/4coder_lex_gen_main.cpp index ec02a67b..086715b2 100644 --- a/custom/lexer_generator/4coder_lex_gen_main.cpp +++ b/custom/lexer_generator/4coder_lex_gen_main.cpp @@ -3531,12 +3531,12 @@ gen_SLOW_action_list__cont_flow(Arena *scratch, Token_Kind_Set tokens, Flag_Set fprintf(out, "token_list_push(arena, list, &token);\n"); fprintf(out, "emit_counter += 1;\n"); + fprintf(out, "state.emit_ptr = state.ptr;\n"); if (context != ActionContext_EndOfFile){ fprintf(out, "if (emit_counter == max){\n"); fprintf(out, "goto end;\n"); fprintf(out, "}\n"); } - fprintf(out, "state.emit_ptr = state.ptr;\n"); fprintf(out, "}\n"); }break; } diff --git a/docs/4ed_doc_custom_api_global.cpp b/docs/4ed_doc_custom_api_global.cpp index 3071886d..b2f9c763 100644 --- a/docs/4ed_doc_custom_api_global.cpp +++ b/docs/4ed_doc_custom_api_global.cpp @@ -171,8 +171,8 @@ doc_custom_api__global(Arena *arena, API_Definition *api_def, Doc_Cluster *clust //////////////////////////////// - if (begin_doc_call(arena, cluster, api_def, "clipboard_post", &func)){ - doc_function_brief(arena, &func, "Post a string to 4coder internal clipboard and the system clipboard"); + if (begin_doc_call(arena, cluster, api_def, "clipboard_post_internal_only", &func)){ + doc_function_brief(arena, &func, "Post a string to 4coder's internal list clipboard history; the string is not posted to the system's clipboard with this call"); // params Doc_Block *params = doc_function_begin_params(arena, &func); diff --git a/platform_mac/mac_4ed_functions.mm b/platform_mac/mac_4ed_functions.mm index 677af480..135a8f10 100644 --- a/platform_mac/mac_4ed_functions.mm +++ b/platform_mac/mac_4ed_functions.mm @@ -9,44 +9,44 @@ function system_get_path_sig(){ String_Const_u8 result = {}; - + switch (path_code){ case SystemPath_CurrentDirectory: { char *working_dir = getcwd(NULL, 0); u64 working_dir_length = cstring_length(working_dir); - + // TODO(yuval): Maybe use push_string_copy instead u8 *out = push_array(arena, u8, working_dir_length); block_copy(out, working_dir, working_dir_length); - + free(working_dir); - + result = SCu8(out, working_dir_length); } break; - + case SystemPath_Binary: { local_persist b32 has_stashed_4ed_path = false; if (!has_stashed_4ed_path){ local_const u32 binary_path_capacity = PATH_MAX; u8 *memory = (u8*)system_memory_allocate(binary_path_capacity, file_name_line_number_lit_u8); - + pid_t pid = getpid(); i32 size = proc_pidpath(pid, memory, binary_path_capacity); Assert(size < binary_path_capacity); - + mac_vars.binary_path = SCu8(memory, size); mac_vars.binary_path = string_remove_last_folder(mac_vars.binary_path); mac_vars.binary_path.str[mac_vars.binary_path.size] = 0; - + has_stashed_4ed_path = true; } - + result = push_string_copy(arena, mac_vars.binary_path); } break; } - + return(result); } @@ -54,14 +54,14 @@ function system_get_canonical_sig(){ NSString *path_ns_str = [[NSString alloc] initWithBytes:name.data length:name.size encoding:NSUTF8StringEncoding]; - + NSString *standardized_path_ns_str = [path_ns_str stringByStandardizingPath]; String_Const_u8 standardized_path = SCu8((u8*)[standardized_path_ns_str UTF8String],[standardized_path_ns_str lengthOfBytesUsingEncoding:NSUTF8StringEncoding]); - + String_Const_u8 result = push_string_copy(arena, standardized_path); - + [path_ns_str release]; - + return(result); } @@ -72,107 +72,107 @@ mac_get_file_attributes(struct stat file_stat) { File_Attributes result; result.size = file_stat.st_size; result.last_write_time = file_stat.st_mtimespec.tv_sec; - + result.flags = 0; if (S_ISDIR(file_stat.st_mode)) { result.flags |= FileAttribute_IsDirectory; } - + return(result); } function inline File_Attributes mac_file_attributes_from_path(char *path) { File_Attributes result = {}; - + struct stat file_stat; if (stat(path, &file_stat) == 0){ result = mac_get_file_attributes(file_stat); } - + return(result); } function inline File_Attributes mac_file_attributes_from_fd(i32 fd) { File_Attributes result = {}; - + struct stat file_stat; if (fstat(fd, &file_stat) == 0){ result = mac_get_file_attributes(file_stat); } - + return(result); } function system_get_file_list_sig(){ File_List result = {}; - + u8 *c_directory = push_array(arena, u8, directory.size + 1); block_copy(c_directory, directory.str, directory.size); c_directory[directory.size] = 0; - + DIR *dir = opendir((char*)c_directory); if (dir){ File_Info* first = 0; File_Info* last = 0; i32 count = 0; - + for (struct dirent *entry = readdir(dir); entry; entry = readdir(dir)){ char *c_file_name = entry->d_name; String_Const_u8 file_name = SCu8(c_file_name); - + if (string_match(file_name, string_u8_litexpr(".")) || string_match(file_name, string_u8_litexpr(".."))){ continue; } - + File_Info *info = push_array(arena, File_Info, 1); sll_queue_push(first, last, info); count += 1; - + info->file_name = push_string_copy(arena, file_name); - + // NOTE(yuval): Get file attributes { Temp_Memory temp = begin_temp(arena); - + b32 append_slash = false; u64 file_path_size = directory.size + file_name.size; if (string_get_character(directory, directory.size - 1) != '/'){ append_slash = true; file_path_size += 1; } - + char *file_path = push_array(arena, char, file_path_size + 1); char *file_path_at = file_path; - + block_copy(file_path_at, directory.str, directory.size); file_path_at += directory.size; - + if (append_slash){ *file_path_at = '/'; file_path_at += 1; } - + block_copy(file_path_at, file_name.str, file_name.size); file_path_at += file_name.size; - + *file_path_at = 0; - + info->attributes = mac_file_attributes_from_path(file_path); - + end_temp(temp); } } - + closedir(dir); - + result.infos = push_array(arena, File_Info*, count); result.count = count; - + i32 index = 0; for (File_Info *node = first; node != 0; @@ -181,22 +181,22 @@ system_get_file_list_sig(){ index += 1; } } - + return(result); } function system_quick_file_attributes_sig(){ Temp_Memory temp = begin_temp(scratch); - + char *c_file_name = push_array(scratch, char, file_name.size + 1); block_copy(c_file_name, file_name.str, file_name.size); c_file_name[file_name.size] = 0; - + File_Attributes result = mac_file_attributes_from_path(c_file_name); - + end_temp(temp); - + return(result); } @@ -215,13 +215,13 @@ mac_to_fd(Plat_Handle handle){ function system_load_handle_sig(){ b32 result = false; - + i32 fd = open(file_name, O_RDONLY); if ((fd != -1) && (fd != 0)) { *out = mac_to_plat_handle(fd); result = true; } - + return(result); } @@ -229,14 +229,14 @@ function system_load_attributes_sig(){ i32 fd = mac_to_fd(handle); File_Attributes result = mac_file_attributes_from_fd(fd); - + return(result); } function system_load_file_sig(){ i32 fd = mac_to_fd(handle); - + do{ ssize_t bytes_read = read(fd, buffer, size); if (bytes_read == -1){ @@ -249,7 +249,7 @@ system_load_file_sig(){ buffer += bytes_read; } } while (size > 0); - + b32 result = (size == 0); return(result); } @@ -257,20 +257,20 @@ system_load_file_sig(){ function system_load_close_sig(){ b32 result = true; - + i32 fd = mac_to_fd(handle); if (close(fd) == -1){ // NOTE(yuval): An error occured while close the file descriptor result = false; } - + return(result); } function system_save_file_sig(){ File_Attributes result = {}; - + i32 fd = open(file_name, O_WRONLY | O_TRUNC | O_CREAT, 00640); if (fd != -1) { do{ @@ -285,14 +285,14 @@ system_save_file_sig(){ data.str += bytes_written; } } while (data.size > 0); - + if (data.size == 0) { result = mac_file_attributes_from_fd(fd); } - + close(fd); } - + return(result); } @@ -313,27 +313,27 @@ mac_to_dl_handle(System_Library system_lib){ function system_load_library_sig(){ b32 result = false; - + void *lib = 0; - + // NOTE(yuval): Open library handle { Temp_Memory temp = begin_temp(scratch); - + char *c_file_name = push_array(scratch, char, file_name.size + 1); block_copy(c_file_name, file_name.str, file_name.size); c_file_name[file_name.size] = 0; - + lib = dlopen(c_file_name, RTLD_LAZY | RTLD_GLOBAL); - + end_temp(temp); } - + if (lib){ *out = mac_to_system_library(lib); result = true; } - + return(result); } @@ -341,7 +341,7 @@ function system_release_library_sig(){ void *lib = mac_to_dl_handle(handle); i32 rc = dlclose(lib); - + b32 result = (rc == 0); return(result); } @@ -350,7 +350,7 @@ function system_get_proc_sig(){ void *lib = mac_to_dl_handle(handle); Void_Func *result = (Void_Func*)dlsym(lib, proc_name); - + return(result); } @@ -359,12 +359,12 @@ system_get_proc_sig(){ function system_now_time_sig(){ u64 now = mach_absolute_time(); - + // NOTE(yuval): Now time nanoseconds conversion f64 now_nano = (f64)((f64)now * ((f64)mac_vars.timebase_info.numer / (f64)mac_vars.timebase_info.denom)); - + // NOTE(yuval): Conversion to useconds u64 result = (u64)(now_nano * 1.0E-3); return(result); @@ -374,9 +374,9 @@ function system_wake_up_timer_create_sig(){ Mac_Object *object = mac_alloc_object(MacObjectKind_Timer); dll_insert(&mac_vars.timer_objects, &object->node); - + object->timer = nil; - + Plat_Handle result = mac_to_plat_handle(object); return(result); } @@ -412,7 +412,7 @@ system_signal_step_sig(){ target:mac_vars.view selector:@selector(request_display) userInfo:nil repeats:NO]; - + mac_vars.step_requested = true; } #else @@ -433,7 +433,7 @@ system_sleep_sig(){ u64 abs_sleep_time = (u64)((f64)nanoseconds * ((f64)mac_vars.timebase_info.denom / (f64)mac_vars.timebase_info.numer)); - + u64 now = mach_absolute_time(); mach_wait_until(now + abs_sleep_time); } @@ -448,7 +448,7 @@ system_post_clipboard_sig(){ } else{ linalloc_clear(arena); } - + mac_vars.clip_post.str = push_array(arena, u8, str.size + 1); if (mac_vars.clip_post.str != 0){ block_copy(mac_vars.clip_post.str, str.str, str.size); @@ -464,50 +464,50 @@ system_post_clipboard_sig(){ function system_cli_call_sig(){ b32 result = false; - + int pipe_fds[2]; if (pipe(pipe_fds) == -1){ perror("system_cli_call: pipe"); return(false); } - + pid_t child_pid = fork(); if (child_pid == -1){ perror("system_cli_call: fork"); return(false); } - + enum { PIPE_FD_READ, PIPE_FD_WRITE }; - + if (child_pid == 0){ // NOTE(yuval): Child Process close(pipe_fds[PIPE_FD_READ]); dup2(pipe_fds[PIPE_FD_WRITE], STDOUT_FILENO); dup2(pipe_fds[PIPE_FD_WRITE], STDERR_FILENO); - + if (chdir(path) == -1){ perror("system_cli_call: chdir"); exit(1); } - + char* argv[] = {"sh", "-c", script, 0}; - + if (execv("/bin/sh", argv) == -1){ perror("system_cli_call: execv"); } - + exit(1); } else{ // NOTE(yuval): Parent Process close(pipe_fds[PIPE_FD_WRITE]); - + *(pid_t*)&cli_out->proc = child_pid; *(int*)&cli_out->out_read = pipe_fds[PIPE_FD_READ]; *(int*)&cli_out->out_write = pipe_fds[PIPE_FD_WRITE]; - + mac_vars.running_cli += 1; } - + return(true); } @@ -519,16 +519,16 @@ system_cli_begin_update_sig(){ function system_cli_update_step_sig(){ int pipe_read_fd = *(int*)&cli->out_read; - + fd_set fds; FD_ZERO(&fds); FD_SET(pipe_read_fd, &fds); - + struct timeval tv = {}; - + size_t space_left = max; char* ptr = dest; - + while (space_left > 0 && (select(pipe_read_fd + 1, &fds, NULL, NULL, &tv) == 1)){ ssize_t num = read(pipe_read_fd, ptr, space_left); if (num == -1){ @@ -541,9 +541,9 @@ system_cli_update_step_sig(){ space_left -= num; } } - + *amount = (ptr - dest); - + b32 result = ((ptr - dest) > 0); return(result); } @@ -551,21 +551,21 @@ system_cli_update_step_sig(){ function system_cli_end_update_sig(){ b32 close_me = false; - + pid_t pid = *(pid_t*)&cli->proc; - + int status; if (pid && (waitpid(pid, &status, WNOHANG) > 0)){ cli->exit = WEXITSTATUS(status); - + close(*(int*)&cli->out_read); close(*(int*)&cli->out_write); - + mac_vars.running_cli -= 1; - + close_me = true; } - + return(close_me); } @@ -589,16 +589,16 @@ mac_thread_wrapper(void *ptr){ Mac_Object *object = (Mac_Object*)ptr; Thread_Function *proc = object->thread.proc; void *object_ptr = object->thread.ptr; - + pthread_mutex_lock(&mac_vars.thread_launch_mutex); { mac_vars.waiting_for_launch = false; pthread_cond_signal(&mac_vars.thread_launch_cv); } pthread_mutex_unlock(&mac_vars.thread_launch_mutex); - + proc(object_ptr); - + return(0); } @@ -607,18 +607,18 @@ system_thread_launch_sig(){ Mac_Object *object = mac_alloc_object(MacObjectKind_Thread); object->thread.proc = proc; object->thread.ptr = ptr; - + pthread_mutex_lock(&mac_vars.thread_launch_mutex); { mac_vars.waiting_for_launch = true; pthread_create(&object->thread.thread, 0, mac_thread_wrapper, object); - + while (mac_vars.waiting_for_launch){ pthread_cond_wait(&mac_vars.thread_launch_cv, &mac_vars.thread_launch_mutex); } } pthread_mutex_unlock(&mac_vars.thread_launch_mutex); - + System_Thread result = mac_to_plat_handle(object); return(result); } @@ -650,7 +650,7 @@ function system_mutex_make_sig(){ Mac_Object *object = mac_alloc_object(MacObjectKind_Mutex); mac_init_recursive_mutex(&object->mutex); - + System_Mutex result = mac_to_plat_handle(object); return(result); } @@ -682,14 +682,16 @@ system_mutex_free_sig(){ function system_acquire_global_frame_mutex_sig(){ - if (tctx->kind == ThreadKind_AsyncTasks){ + if (tctx->kind == ThreadKind_AsyncTasks || + tctx->kind == ThreadKind_MainCoroutine){ system_mutex_acquire(mac_vars.global_frame_mutex); } } function system_release_global_frame_mutex_sig(){ - if (tctx->kind == ThreadKind_AsyncTasks){ + if (tctx->kind == ThreadKind_AsyncTasks || + tctx->kind == ThreadKind_MainCoroutine){ system_mutex_release(mac_vars.global_frame_mutex); } } @@ -698,7 +700,7 @@ function system_condition_variable_make_sig(){ Mac_Object *object = mac_alloc_object(MacObjectKind_CV); pthread_cond_init(&object->cv, 0); - + System_Condition_Variable result = mac_to_plat_handle(object); return(result); } @@ -754,19 +756,19 @@ mac_memory_allocate_extended(void *base, u64 size, String_Const_u8 location){ u64 adjusted_size = size + ALLOCATION_SIZE_ADJUSTMENT; void *memory = mmap(base, adjusted_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); Assert(memory != MAP_FAILED); - + Memory_Annotation_Tracker_Node *node = (Memory_Annotation_Tracker_Node*)memory; - + pthread_mutex_lock(&memory_tracker_mutex); { zdll_push_back(memory_tracker.first, memory_tracker.last, node); memory_tracker.count += 1; } pthread_mutex_unlock(&memory_tracker_mutex); - + node->location = location; node->size = size; - + void* result = (node + 1); return(result); } @@ -775,14 +777,14 @@ function void mac_memory_free_extended(void *ptr){ Memory_Annotation_Tracker_Node *node = (Memory_Annotation_Tracker_Node*)ptr; node -= 1; - + pthread_mutex_lock(&memory_tracker_mutex); { zdll_remove(memory_tracker.first, memory_tracker.last, node); memory_tracker.count -= 1; } pthread_mutex_unlock(&memory_tracker_mutex); - + munmap(node, node->size + ALLOCATION_SIZE_ADJUSTMENT); } @@ -795,35 +797,35 @@ system_memory_allocate_sig(){ function system_memory_set_protection_sig(){ b32 result = true; - + int protect = 0; switch (flags & 0x7){ case 0: { protect = PROT_NONE; } break; - + case MemProtect_Read: { protect = PROT_READ; } break; - + case MemProtect_Write: case MemProtect_Read | MemProtect_Write: { protect = PROT_READ | PROT_WRITE; } break; - + case MemProtect_Execute: { protect = PROT_EXEC; } break; - + case MemProtect_Execute | MemProtect_Read: { protect = PROT_READ | PROT_EXEC; } break; - + // NOTE(inso): some W^X protection things might be unhappy about this one case MemProtect_Execute | MemProtect_Write: case MemProtect_Execute | MemProtect_Write | MemProtect_Read: @@ -831,14 +833,14 @@ system_memory_set_protection_sig(){ protect = PROT_READ | PROT_WRITE | PROT_EXEC; } break; } - + Memory_Annotation_Tracker_Node *node = (Memory_Annotation_Tracker_Node*)ptr; node -= 1; - + if(mprotect(node, size, protect) == -1){ result = false; } - + return(result); } @@ -850,7 +852,7 @@ system_memory_free_sig(){ function system_memory_annotation_sig(){ Memory_Annotation result = {}; - + pthread_mutex_lock(&memory_tracker_mutex); { for (Memory_Annotation_Tracker_Node *node = memory_tracker.first; @@ -859,15 +861,15 @@ system_memory_annotation_sig(){ Memory_Annotation_Node *r_node = push_array(arena, Memory_Annotation_Node, 1); sll_queue_push(result.first, result.last, r_node); result.count += 1; - + r_node->location = node->location; r_node->address = node + 1; r_node->size = node->size; } - + } pthread_mutex_unlock(&memory_tracker_mutex); - + return(result); } @@ -882,7 +884,7 @@ function system_set_fullscreen_sig(){ // NOTE(yuval): Read comment in system_set_fullscreen_sig in win32_4ed.cpp mac_vars.do_toggle = (mac_vars.full_screen != full_screen); - + b32 success = true; return(success); } diff --git a/platform_win32/win32_4ed.cpp b/platform_win32/win32_4ed.cpp index c83fe429..cccda51a 100644 --- a/platform_win32/win32_4ed.cpp +++ b/platform_win32/win32_4ed.cpp @@ -165,10 +165,10 @@ struct Win32_Vars{ String_Const_u8 binary_path; - Arena *clipboard_arena; - String_Const_u8 clipboard_contents; - b32 next_clipboard_is_self; + b8 clip_catch_all; + b8 next_clipboard_is_self; DWORD clipboard_sequence; + Plat_Handle clip_wakeup_timer; Arena clip_post_arena; String_Const_u8 clip_post; @@ -351,6 +351,51 @@ system_get_keyboard_modifiers_sig(){ // Clipboard // +internal String_Const_u8 +win32_read_clipboard_contents(Thread_Context *tctx, Arena *arena){ + Scratch_Block scratch(tctx); + + String_Const_u8 result = {}; + + b32 has_text = false; + b32 has_unicode = IsClipboardFormatAvailable(CF_UNICODETEXT); + if (!has_unicode){ + has_text = IsClipboardFormatAvailable(CF_TEXT); + } + b32 can_read = has_unicode || has_text; + + if (can_read){ + if (OpenClipboard(win32vars.window_handle)){ + if (has_unicode){ + HANDLE clip_data = GetClipboardData(CF_UNICODETEXT); + if (clip_data != 0){ + u16 *clip_16_ptr = (u16*)GlobalLock(clip_data); + if (clip_16_ptr != 0){ + String_Const_u16 clip_16 = SCu16(clip_16_ptr); + result = string_u8_from_string_u16(arena, clip_16, StringFill_NullTerminate).string; + } + } + GlobalUnlock(clip_data); + } + else{ + HANDLE clip_data = GetClipboardData(CF_TEXT); + if (clip_data != 0){ + char *clip_ascii_ptr = (char*)GlobalLock(clip_data); + if (clip_ascii_ptr != 0){ + String_Const_char clip_ascii = SCchar(clip_ascii_ptr); + result = string_u8_from_string_char(arena, clip_ascii, StringFill_NullTerminate).string; + } + } + GlobalUnlock(clip_data); + } + + CloseClipboard(); + } + } + + return(result); +} + internal void win32_post_clipboard(Arena *scratch, char *text, i32 len){ if (OpenClipboard(win32vars.window_handle)){ @@ -370,6 +415,27 @@ win32_post_clipboard(Arena *scratch, char *text, i32 len){ } } +internal +system_get_clipboard_sig(){ + String_Const_u8 result = {}; + DWORD new_number = GetClipboardSequenceNumber(); + if (new_number != win32vars.clipboard_sequence){ + win32vars.clipboard_sequence = new_number; + if (win32vars.next_clipboard_is_self){ + win32vars.next_clipboard_is_self = false; + } + else{ + for (i32 R = 0; R < 8; ++R){ + result = win32_read_clipboard_contents(win32vars.tctx, arena); + if (result.str == 0){ + break; + } + } + } + } + return(result); +} + internal system_post_clipboard_sig(){ Arena *arena = &win32vars.clip_post_arena; @@ -390,60 +456,15 @@ system_post_clipboard_sig(){ } } -internal b32 -win32_read_clipboard_contents(Arena *scratch){ - Temp_Memory temp = begin_temp(scratch); - - b32 result = false; - - b32 has_text = false; - b32 has_unicode = IsClipboardFormatAvailable(CF_UNICODETEXT); - if (!has_unicode){ - has_text = IsClipboardFormatAvailable(CF_TEXT); - } - b32 can_read = has_unicode || has_text; - - if (can_read){ - if (OpenClipboard(win32vars.window_handle)){ - result = true; - String_u8 contents = {}; - Arena *clip_arena = win32vars.clipboard_arena; - if (has_unicode){ - HANDLE clip_data = GetClipboardData(CF_UNICODETEXT); - if (clip_data != 0){ - u16 *clip_16_ptr = (u16*)GlobalLock(clip_data); - if (clip_16_ptr != 0){ - linalloc_clear(clip_arena); - String_Const_u16 clip_16 = SCu16(clip_16_ptr); - contents = string_u8_from_string_u16(clip_arena, clip_16, StringFill_NullTerminate); - } - } - GlobalUnlock(clip_data); - } - else{ - HANDLE clip_data = GetClipboardData(CF_TEXT); - if (clip_data != 0){ - char *clip_ascii_ptr = (char*)GlobalLock(clip_data); - if (clip_ascii_ptr != 0){ - linalloc_clear(clip_arena); - String_Const_char clip_ascii = SCchar(clip_ascii_ptr); - contents = string_u8_from_string_char(clip_arena, clip_ascii, StringFill_NullTerminate); - } - } - GlobalUnlock(clip_data); - } - - win32vars.clipboard_contents = contents.string; - - CloseClipboard(); - } - } - - end_temp(temp); - - return(result); +internal +system_set_clipboard_catch_all_sig(){ + win32vars.clip_catch_all = enabled?true:false; } +internal +system_get_clipboard_catch_all_sig(){ + return(win32vars.clip_catch_all); +} // // Command Line Exectuion @@ -899,16 +920,24 @@ system_mutex_release_sig(){ } } +global i32 global_frame_mutex_state_ticker = 0; + internal system_acquire_global_frame_mutex_sig(){ - if (tctx->kind == ThreadKind_AsyncTasks){ + if (tctx->kind == ThreadKind_AsyncTasks || + tctx->kind == ThreadKind_Main){ system_mutex_acquire(win32vars.global_frame_mutex); + Assert(global_frame_mutex_state_ticker == 0); + global_frame_mutex_state_ticker = 1; } } internal system_release_global_frame_mutex_sig(){ - if (tctx->kind == ThreadKind_AsyncTasks){ + if (tctx->kind == ThreadKind_AsyncTasks || + tctx->kind == ThreadKind_Main){ + Assert(global_frame_mutex_state_ticker == 1); + global_frame_mutex_state_ticker = 0; system_mutex_release(win32vars.global_frame_mutex); } } @@ -1200,9 +1229,11 @@ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ case WM_CLIPBOARDUPDATE: { - win32vars.got_useful_event = true; - LogEventLit(win32vars.log_string(M), scratch, 0, 0, system_thread_get_id(), - "new clipboard contents"); + if (win32vars.clip_catch_all){ + win32vars.got_useful_event = true; + LogEventLit(win32vars.log_string(M), scratch, 0, 0, system_thread_get_id(), + "new clipboard contents"); + } }break; case WM_CLOSE: @@ -1417,9 +1448,9 @@ win32_gl_create_window(HWND *wnd_out, HGLRC *context_out, DWORD style, RECT rect /*0*/WGL_CONTEXT_MAJOR_VERSION_ARB, 3, /*2*/WGL_CONTEXT_MINOR_VERSION_ARB, 2, /*4*/WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB - #if GL_DEBUG_MODE +#if GL_DEBUG_MODE |WGL_CONTEXT_DEBUG_BIT_ARB - #endif +#endif , /*6*/WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, /*8*/0 @@ -1652,24 +1683,17 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS win32_output_error_string(scratch, ErrorString_UseLog); } - win32vars.clipboard_arena = reserve_arena(win32vars.tctx); - + win32vars.clip_wakeup_timer = system_wake_up_timer_create(); win32vars.clipboard_sequence = GetClipboardSequenceNumber(); if (win32vars.clipboard_sequence == 0){ Scratch_Block scratch(win32vars.tctx, Scratch_Share); win32_post_clipboard(scratch, "", 0); - win32vars.clipboard_sequence = GetClipboardSequenceNumber(); win32vars.next_clipboard_is_self = 0; - if (win32vars.clipboard_sequence == 0){ OutputDebugStringA("Failure while initializing clipboard\n"); } } - else{ - Scratch_Block scratch(win32vars.tctx, Scratch_Share); - win32_read_clipboard_contents(scratch); - } win32_keycode_init(); @@ -1696,7 +1720,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS Scratch_Block scratch(win32vars.tctx, Scratch_Share); String_Const_u8 curdir = system_get_path(scratch, SystemPath_CurrentDirectory); curdir = string_mod_replace_character(curdir, '\\', '/'); - app.init(win32vars.tctx, &target, base_ptr, win32vars.clipboard_contents, curdir, custom); + app.init(win32vars.tctx, &target, base_ptr, curdir, custom); } // @@ -1716,7 +1740,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS ShowWindow(win32vars.window_handle, SW_SHOW); win32vars.global_frame_mutex = system_mutex_make(); - system_mutex_acquire(win32vars.global_frame_mutex); + system_acquire_global_frame_mutex(win32vars.tctx); u64 timer_start = system_now_time(); MSG msg; @@ -1737,7 +1761,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS // NOTE(allen): while we're doing this (and possibly sleeping) // we can let async processes get there time in. - system_mutex_release(win32vars.global_frame_mutex); + system_release_global_frame_mutex(win32vars.tctx); b32 get_more_messages = true; do{ @@ -1814,7 +1838,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS } }while (get_more_messages); - system_mutex_acquire(win32vars.global_frame_mutex); + system_acquire_global_frame_mutex(win32vars.tctx); } // NOTE(allen): Mouse Out of Window Detection @@ -1835,6 +1859,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS // TODO(allen): CROSS REFERENCE WITH LINUX SPECIAL CODE "TIC898989" Win32_Input_Chunk input_chunk = win32vars.input_chunk; + Scratch_Block scratch(win32vars.tctx); Application_Step_Input input = {}; input.first_step = win32vars.first; @@ -1864,39 +1889,15 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS } // NOTE(allen): Frame Clipboard Input - block_zero_struct(&win32vars.clipboard_contents); - input.clipboard_changed = false; - if (win32vars.clipboard_sequence != 0){ - DWORD new_number = GetClipboardSequenceNumber(); - if (new_number != win32vars.clipboard_sequence){ - if (win32vars.next_clipboard_is_self){ - win32vars.next_clipboard_is_self = false; - } - else{ - for (i32 R = 0; R < 4; ++R){ - Scratch_Block scratch(win32vars.tctx, Scratch_Share); - if (win32_read_clipboard_contents(scratch)){ - input.clipboard_changed = true; - break; - } - } - } - win32vars.clipboard_sequence = new_number; - } + if (win32vars.clip_catch_all){ + input.clipboard = system_get_clipboard(scratch, 0); } - input.clipboard = win32vars.clipboard_contents; win32vars.clip_post.size = 0; // NOTE(allen): Application Core Update - Application_Step_Result result = {}; - if (app.step != 0){ - result = app.step(win32vars.tctx, &target, base_ptr, &input); - } - else{ - //LOG("app.step == 0 -- skipping\n"); - } + Application_Step_Result result = app.step(win32vars.tctx, &target, base_ptr, &input); // NOTE(allen): Finish the Loop if (result.perform_kill){ @@ -1905,13 +1906,11 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS // NOTE(allen): Post New Clipboard Content if (win32vars.clip_post.size > 0){ - Scratch_Block scratch(win32vars.tctx, Scratch_Share); win32_post_clipboard(scratch, (char*)win32vars.clip_post.str, (i32)win32vars.clip_post.size); } // NOTE(allen): Switch to New Title if (result.has_new_title){ - Scratch_Block scratch(win32vars.tctx, Scratch_Share); SetWindowText_utf8(scratch, win32vars.window_handle, (u8*)result.title_string); } @@ -1959,9 +1958,12 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS if (result.animating){ system_schedule_step(0); } + else if (win32vars.clip_catch_all){ + system_wake_up_timer_set(win32vars.clip_wakeup_timer, 250); + } // NOTE(allen): sleep a bit to cool off :) - system_mutex_release(win32vars.global_frame_mutex); + system_release_global_frame_mutex(win32vars.tctx); u64 timer_end = system_now_time(); u64 end_target = timer_start + frame_useconds; @@ -1975,7 +1977,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS } timer_start = system_now_time(); - system_mutex_acquire(win32vars.global_frame_mutex); + system_acquire_global_frame_mutex(win32vars.tctx); win32vars.first = false; } diff --git a/ship_files/changes.txt b/ship_files/changes.txt index 2c0837b8..18c6edad 100644 --- a/ship_files/changes.txt +++ b/ship_files/changes.txt @@ -1,8 +1,23 @@ +4.1.4 + + MAJOR: The clipboard history is now a fully custom layer implemented system. Users maintaining a customization layer should try to update their call sites to the old clipboard API. #define FCODER_TRANSITION_TO 4001004 to disable the transitional function wrappers when you are ready to make the transition. + + buildsuper scripts now all come with '-win' '-linux' '-mac' postfixes and pass their OS identifier macro on the build line + + clipboard is only read when the requests to, or when the collect-all mode is started via the command 'begin_clipboard_collection_mode' + + 'clear_clipboard' command + + in config.4coder the variable virtual_whitespace_regular_indent determines the number of space-widths to use as the regular indentation in a virtual whitespace layout + + show whitespace mode implemented in 'default_render_buffer' + + `set_face_size` and `set_face_size_this_buffer` commands + + Fix: tabs are measured with the correct amount of width for the user's settings + + Fix: virtual whitespace toggling works when the config initially diabled virtual whitespace + + Fix: never miss the most recent post to the clipboard on windows + + Fix: command `load_theme_current_buffer` gaurds against destroying the active color palette when bad files are loaded + + Fix: project deep copy routine copies strings in the whitelist and blacklist pattern arrays + 4.1.3 + Unkillable buffer setting + UI elements in listers and buttons can have different highlight backgrounds + command 'load_theme_current_buffer' for loading the current file as a theme and setting it as the theme + + command 'write_block' for writing a block comment uses mark and cursor range to insert block comment ends + Fix: search and replace never exits early + Fix: optimized builds of the custom layer display the dirty * on the file bar correclty + Fix: can merge "backwards" strings in the history correctly @@ -12,6 +27,14 @@ + Fix: the margin colors for panels are determined by the margins in theme files + Fix: when a file is deleted outside of 4coder, the '!' dirty status is added to the buffer + Fix: on mac file changes outside of 4coder are detected and do not stall the UI + + Fix: in virtual whitespace layouts blank lines correctly mark carriage return characters before newline characters + + Fix: auto-indentation leaves the carriage return in CRLF line endings in place and does not count them as indentation + + Fix: lexer emit pointer advances correctly when the output buffer becomes full + + Fix: when include gaurds are inserted into new header files, the generated name isn't killed by numbers or underscores + + Fix: base library function string_is_integer returns false on empty string + + Fix: preprocessor directives after incomplete statements are aligned to zero by auto-indent + + Fix: command 'list_all_functions_current_buffer_lister' and command 'list_all_functions_all_buffers_lister' are marked as UI commands and thus do not infinite loop when they set the buffer + + Improvement: optimization in clean_all_lines command, handles CRLF line endings 4.1.2 + Cursor color changes when recording macro if the theme provides a second cursor color diff --git a/ship_files/config.4coder b/ship_files/config.4coder index cbf71c6b..77c9fcfa 100644 --- a/ship_files/config.4coder +++ b/ship_files/config.4coder @@ -24,6 +24,7 @@ show_line_number_margins = false; // Code Wrapping treat_as_code = ".cpp.c.hpp.h.cc.cs.java.rs.glsl.m.mm"; enable_virtual_whitespace = true; +virtual_whitespace_regular_indent = 4; enable_code_wrapping = true; // This only applies to code files in code-wrapping mode. diff --git a/ship_files_super/project.4coder b/ship_files_super/project.4coder index 261a97f0..fc2bd712 100644 --- a/ship_files_super/project.4coder +++ b/ship_files_super/project.4coder @@ -15,32 +15,32 @@ patterns = { blacklist_patterns = { ".*", }; -load_paths_only = { +load_paths_custom = { {"."}, }; load_paths = { - { load_paths_only, .os = "win" }, - { load_paths_only, .os = "linux"}, - { load_paths_only, .os = "mac" }, + { load_paths_custom, .os = "win" }, + { load_paths_custom, .os = "linux"}, + { load_paths_custom, .os = "mac" }, }; -build_super_x64_win32 = "custom\\bin\\buildsuper_x64.bat"; -build_super_x86_win32 = "custom\\bin\\buildsuper_x86.bat"; -build_super_x64_unix = "custom/bin/buildsuper_x64.sh"; -build_super_x86_unix = "custom/bin/buildsuper_x86.sh"; +build_super_x64_win32 = "custom\\bin\\buildsuper_x64-win.bat"; +build_super_x86_win32 = "custom\\bin\\buildsuper_x86-win.bat"; +build_super_x64_linux = "custom/bin/buildsuper_x64-linux.sh"; +build_super_x86_linux = "custom/bin/buildsuper_x86-linux.sh"; +build_super_x64_mac = "custom/bin/buildsuper_x64-mac.sh"; command_list = { { .name = "build super x64", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cmd = { {build_super_x64_win32, .os ="win" }, - {build_super_x64_unix , .os ="linux"}, - {build_super_x64_unix , .os ="mac" }, }, }, + {build_super_x64_linux , .os ="linux"}, + {build_super_x64_mac , .os ="mac" }, }, }, { .name = "build super x86", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cmd = { {build_super_x86_win32, .os ="win" }, - {build_super_x86_unix, .os ="linux" }, - {build_super_x86_unix, .os ="mac" }, }, }, + {build_super_x86_linux, .os ="linux" }, }, }, { .name = "build C++ lexer generator", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true,