diff --git a/4coder_auto_indent.cpp b/4coder_auto_indent.cpp index 86565e28..de0677b6 100644 --- a/4coder_auto_indent.cpp +++ b/4coder_auto_indent.cpp @@ -421,7 +421,7 @@ get_indent_lines_whole_tokens(Application_Links *app, Buffer_ID buffer, Token_Ar for (;line_start > 1;){ i64 line_start_pos = get_line_start_pos(app, buffer, line_start); - Token *token = get_first_token_from_pos(tokens, line_start_pos); + Token *token = token_from_pos(&tokens, line_start_pos); if (token != 0 && token->pos < line_start_pos){ line_start = get_line_number_from_pos(app, buffer, token->pos); } @@ -434,7 +434,7 @@ get_indent_lines_whole_tokens(Application_Links *app, Buffer_ID buffer, Token_Ar for (;line_end < line_count;){ i64 next_line_start_pos = get_line_start_pos(app, buffer, line_end + 1); - Token *token = get_first_token_from_pos(tokens, next_line_start_pos); + Token *token = token_from_pos(&tokens, next_line_start_pos); if (token != 0 && token->pos < next_line_start_pos){ line_end = get_line_number_from_pos(app, buffer, token->pos + token->size); } diff --git a/4coder_base_commands.cpp b/4coder_base_commands.cpp index 8cf15168..673939d0 100644 --- a/4coder_base_commands.cpp +++ b/4coder_base_commands.cpp @@ -692,51 +692,12 @@ CUSTOM_DOC("Toggles the visibility status of the current view's filebar.") view_set_setting(app, view, ViewSetting_ShowFileBar, !value); } -CUSTOM_COMMAND_SIG(toggle_line_wrap) -CUSTOM_DOC("Toggles the current buffer's line wrapping status.") -{ - NotImplemented; -#if 0 - View_ID view = get_active_view(app, AccessProtected); - Buffer_ID buffer = view_get_buffer(app, view, AccessProtected); - b32 wrapped; - buffer_get_setting(app, buffer, BufferSetting_WrapLine, &wrapped); - buffer_set_setting(app, buffer, BufferSetting_WrapLine, !wrapped); -#endif -} - CUSTOM_COMMAND_SIG(toggle_fps_meter) CUSTOM_DOC("Toggles the visibility of the FPS performance meter") { show_fps_hud = !show_fps_hud; } -CUSTOM_COMMAND_SIG(increase_line_wrap) -CUSTOM_DOC("Increases the current buffer's width for line wrapping.") -{ - NotImplemented; -#if 0 - View_ID view = get_active_view(app, AccessProtected); - Buffer_ID buffer = view_get_buffer(app, view, AccessProtected); - i32 wrap = 0; - buffer_get_setting(app, buffer, BufferSetting_WrapPosition, &wrap); - buffer_set_setting(app, buffer, BufferSetting_WrapPosition, wrap + 10); -#endif -} - -CUSTOM_COMMAND_SIG(decrease_line_wrap) -CUSTOM_DOC("Decrases the current buffer's width for line wrapping.") -{ - NotImplemented; -#if 0 - View_ID view = get_active_view(app, AccessProtected); - Buffer_ID buffer = view_get_buffer(app, view, AccessProtected); - i32 wrap = 0; - buffer_get_setting(app, buffer, BufferSetting_WrapPosition, &wrap); - buffer_set_setting(app, buffer, BufferSetting_WrapPosition, wrap - 10); -#endif -} - CUSTOM_COMMAND_SIG(increase_face_size) CUSTOM_DOC("Increase the size of the face used by the current buffer.") { diff --git a/4coder_experiments.cpp b/4coder_experiments.cpp index c4e197c6..9472fb21 100644 --- a/4coder_experiments.cpp +++ b/4coder_experiments.cpp @@ -4,6 +4,8 @@ // TOP +// TODO(allen): move all out of experimental + #include "4coder_default_include.cpp" #include "4coder_miblo_numbers.cpp" @@ -183,339 +185,6 @@ CUSTOM_COMMAND_SIG(multi_paste_interactive_quick){ } } -// NOTE(allen): Some basic code manipulation ideas. - -CUSTOM_COMMAND_SIG(rename_parameter) -CUSTOM_DOC("If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.") -{ - NotImplemented; -#if 0 - View_ID view = get_active_view(app, AccessOpen); - Buffer_ID buffer = view_get_buffer(app, view, AccessOpen); - i64 cursor_pos = view_get_cursor_pos(app, view); - - Arena *scratch = context_get_arena(app); - Temp_Memory temp = begin_temp(scratch); - - Cpp_Get_Token_Result result = {}; - if (get_token_from_pos(app, buffer, cursor_pos, &result)){ - if (!result.in_whitespace_after_token){ - static const i32 stream_space_size = 512; - Token stream_space[stream_space_size]; - Stream_Tokens_DEP stream = {}; - - if (init_stream_tokens(&stream, app, buffer, result.token_index, stream_space, stream_space_size)){ - i32 token_index = result.token_index; - Token token = stream.tokens[token_index]; - - if (token.type == CPP_TOKEN_IDENTIFIER){ - Token original_token = token; - String_Const_u8 old_lexeme = push_token_lexeme(app, scratch, buffer, token); - - i32 proc_body_found = 0; - b32 still_looping = 0; - - ++token_index; - do{ - for (; token_index < stream.end; ++token_index){ - Token *token_ptr = stream.tokens + token_index; - switch (token_ptr->type){ - case CPP_TOKEN_BRACE_OPEN: - { - proc_body_found = 1; - goto doublebreak; - }break; - - case CPP_TOKEN_BRACE_CLOSE: - case CPP_TOKEN_PARENTHESE_OPEN: - { - goto doublebreak; - }break; - } - } - still_looping = forward_stream_tokens(&stream); - }while(still_looping); - doublebreak:; - - if (proc_body_found){ - - u8 with_space[1024]; - Query_Bar with = {}; - with.prompt = string_u8_litexpr("New Name: "); - with.string = SCu8(with_space, (umem)0); - with.string_capacity = sizeof(with_space); - if (!query_user_string(app, &with)) return; - - String_Const_u8 replace_string = with.string; - - // TODO(allen): fix this up to work with arena better - i32 edit_max = Thousand(100); - Buffer_Edit *edits = push_array(scratch, Buffer_Edit, edit_max); - i32 edit_count = 0; - - if (edit_max >= 1){ - Buffer_Edit edit = {}; - edit.str_start = 0; - edit.len = (i32)replace_string.size; - edit.start = original_token.start; - edit.end = original_token.start + original_token.size; - - edits[edit_count] = edit; - edit_count += 1; - } - - i32 nesting_level = 0; - i32 closed_correctly = 0; - ++token_index; - still_looping = 0; - do{ - for (; token_index < stream.end; ++token_index){ - Token *token_ptr = stream.tokens + token_index; - switch (token_ptr->type){ - case CPP_TOKEN_IDENTIFIER: - { - if (token_ptr->size == old_lexeme.size){ - String_Const_u8 other_lexeme = push_token_lexeme(app, scratch, buffer, *token_ptr); - if (string_match(old_lexeme, other_lexeme)){ - Buffer_Edit edit = {}; - edit.str_start = 0; - edit.len = (i32)replace_string.size; - edit.start = token_ptr->start; - edit.end = token_ptr->start + token_ptr->size; - if (edit_count < edit_max){ - edits[edit_count] = edit; - edit_count += 1; - } - else{ - goto doublebreak2; - } - } - } - }break; - - case CPP_TOKEN_BRACE_OPEN: - { - ++nesting_level; - }break; - - case CPP_TOKEN_BRACE_CLOSE: - { - if (nesting_level == 0){ - closed_correctly = 1; - goto doublebreak2; - } - else{ - --nesting_level; - } - }break; - } - } - still_looping = forward_stream_tokens(&stream); - }while(still_looping); - doublebreak2:; - - if (closed_correctly){ - buffer_batch_edit(app, buffer, (char*)replace_string.str, edits, edit_count); - } - } - } - } - } - } - - end_temp(temp); -#endif -} - -typedef u32 Write_Explicit_Enum_Values_Mode; -enum{ - WriteExplicitEnumValues_Integers, - WriteExplicitEnumValues_Flags, -}; - -static void -write_explicit_enum_values_parameters(Application_Links *app, Write_Explicit_Enum_Values_Mode mode){ - NotImplemented; -#if 0 - View_ID view = get_active_view(app, AccessOpen); - Buffer_ID buffer = view_get_buffer(app, view, AccessOpen); - - i64 pos = view_get_cursor_pos(app, view); - - Arena *scratch = context_get_arena(app); - Temp_Memory temp = begin_temp(scratch); - - Cpp_Get_Token_Result result = {}; - if (get_token_from_pos(app, buffer, pos, &result)){ - if (!result.in_whitespace_after_token){ - Token stream_space[32]; - Stream_Tokens_DEP stream = {}; - - if (init_stream_tokens(&stream, app, buffer, result.token_index, stream_space, 32)){ - i32 token_index = result.token_index; - Token token = stream.tokens[token_index]; - - if (token.type == CPP_TOKEN_BRACE_OPEN){ - ++token_index; - - i32 seeker_index = token_index; - Stream_Tokens_DEP seek_stream = begin_temp_stream_token(&stream); - - b32 closed_correctly = false; - b32 still_looping = false; - do{ - for (; seeker_index < stream.end; ++seeker_index){ - Token *token_seeker = stream.tokens + seeker_index; - switch (token_seeker->type){ - case CPP_TOKEN_BRACE_CLOSE: - closed_correctly = true; - goto finished_seek; - - case CPP_TOKEN_BRACE_OPEN: - goto finished_seek; - } - } - still_looping = forward_stream_tokens(&stream); - }while(still_looping); - finished_seek:; - end_temp_stream_token(&stream, seek_stream); - - if (closed_correctly){ - i32 count_estimate = 1 + (seeker_index - token_index)/2; - - i32 edit_count = 0; - Buffer_Edit *edits = push_array(scratch, Buffer_Edit, count_estimate); - - List_String_Const_char list = {}; - - closed_correctly = false; - still_looping = false; - u32 value = 0; - if (mode == WriteExplicitEnumValues_Flags){ - value = 1; - } - - do{ - for (;token_index < stream.end; ++token_index){ - Token *token_ptr = stream.tokens + token_index; - switch (token_ptr->type){ - case CPP_TOKEN_IDENTIFIER: - { - i32 edit_start = token_ptr->start + token_ptr->size; - i32 edit_stop = edit_start; - - i32 edit_is_good = 0; - ++token_index; - do{ - for (; token_index < stream.end; ++token_index){ - token_ptr = stream.tokens + token_index; - switch (token_ptr->type){ - case CPP_TOKEN_COMMA: - { - edit_stop = token_ptr->start; - edit_is_good = 1; - goto good_edit; - }break; - - case CPP_TOKEN_BRACE_CLOSE: - { - edit_stop = token_ptr->start; - closed_correctly = 1; - edit_is_good = 1; - goto good_edit; - }break; - } - } - still_looping = forward_stream_tokens(&stream); - }while(still_looping); - - good_edit:; - if (edit_is_good){ - i32 str_pos = (i32)(list.total_size); - - string_list_pushf(scratch, &list, " = %d", value); - if (closed_correctly){ - string_list_push_lit(scratch, &list, "\n"); - } - - switch (mode){ - case WriteExplicitEnumValues_Integers: - { - ++value; - }break; - case WriteExplicitEnumValues_Flags: - { - if (value < (1 << 31)){ - value <<= 1; - } - }break; - } - - i32 str_size = (i32)(list.total_size) - str_pos; - - Buffer_Edit edit; - edit.str_start = str_pos; - edit.len = str_size; - edit.start = edit_start; - edit.end = edit_stop; - - Assert(edit_count < count_estimate); - edits[edit_count] = edit; - ++edit_count; - } - if (!edit_is_good || closed_correctly){ - goto finished; - } - }break; - - case CPP_TOKEN_BRACE_CLOSE: - { - closed_correctly = 1; - goto finished; - }break; - } - } - - still_looping = forward_stream_tokens(&stream); - }while(still_looping); - - finished:; - if (closed_correctly){ - String_Const_char text = string_list_flatten(scratch, list); - buffer_batch_edit(app, buffer, text.str, edits, edit_count); - } - } - } - } - } - } - - end_temp(temp); -#endif -} - -CUSTOM_COMMAND_SIG(write_explicit_enum_values) -CUSTOM_DOC("If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in sequentially starting from zero. Existing values are overwritten.") -{ - write_explicit_enum_values_parameters(app, WriteExplicitEnumValues_Integers); -} - -CUSTOM_COMMAND_SIG(write_explicit_enum_flags) -CUSTOM_DOC("If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in to give each a unique power of 2 value, starting from 1. Existing values are overwritten.") -{ - write_explicit_enum_values_parameters(app, WriteExplicitEnumValues_Flags); -} - -// -// Rename All -// - -struct Replace_Target{ - Replace_Target *next; - Buffer_ID buffer_id; - i32 start_pos; -}; - extern "C" i32 get_bindings(void *data, i32 size){ Bind_Helper context_ = begin_bind_helper(data, size); @@ -559,12 +228,6 @@ get_bindings(void *data, i32 size){ bind(context, 'A', MDFR_CTRL, replace_in_all_buffers); end_map(context); - begin_map(context, default_code_map); - bind(context, key_insert, MDFR_CTRL, write_explicit_enum_values); - bind(context, key_insert, MDFR_CTRL|MDFR_SHIFT, write_explicit_enum_flags); - bind(context, 'p', MDFR_ALT, rename_parameter); - end_map(context); - return(end_bind_helper(context)); } diff --git a/4coder_function_list.cpp b/4coder_function_list.cpp index d4065964..548db724 100644 --- a/4coder_function_list.cpp +++ b/4coder_function_list.cpp @@ -9,24 +9,23 @@ // through. Once I build a real parser this should become almost just as easy as // iterating tokens is now. // +// NOTE(allen|b4.1.0): This routine assumes C++ sub_kinds in the tokens of the buffer. static Get_Positions_Results -get_function_positions(Application_Links *app, Buffer_ID buffer, i32 first_token_index, Function_Positions *positions_array, i32 positions_max){ +get_function_positions(Application_Links *app, Buffer_ID buffer, i64 first_token_index, Function_Positions *positions_array, i64 positions_max){ Get_Positions_Results result = {}; - NotImplemented; -#if 0 - Token_Range token_range = buffer_get_token_range(app, buffer); - if (token_range.first != 0){ - Token_Iterator token_it = make_token_iterator(token_range, first_token_index); + Token_Array array = get_token_array_from_buffer(app, buffer); + if (array.tokens != 0){ + Token_Iterator_Array it = token_iterator_index(buffer, &array, first_token_index); i32 nest_level = 0; i32 paren_nest_level = 0; - Token *first_paren = 0; - i32 first_paren_index = 0; - i32 first_paren_position = 0; - i32 last_paren_index = 0; + Token_Iterator_Array first_paren_it = {}; + i64 first_paren_index = 0; + i64 first_paren_position = 0; + i64 last_paren_index = 0; // Look for the next token at global scope that might need to be printed. mode1: @@ -35,82 +34,88 @@ get_function_positions(Application_Links *app, Buffer_ID buffer, i32 first_token first_paren_index = 0; first_paren_position = 0; last_paren_index = 0; - for (Token *token = token_iterator_current(&token_it); - token != 0; - token = token_iterator_goto_next(&token_it)){ - if (!(token->flags & CPP_TFLAG_PP_BODY)){ - switch (token->type){ - case CPP_TOKEN_BRACE_OPEN: + for (;;){ + Token *token = token_it_read(&it); + if (!HasFlag(token->flags, TokenBaseFlag_PreprocessorBody)){ + switch (token->sub_kind){ + case TokenCppKind_BraceOp: { ++nest_level; }break; - case CPP_TOKEN_BRACE_CLOSE: + case TokenCppKind_BraceCl: { if (nest_level > 0){ --nest_level; } }break; - case CPP_TOKEN_PARENTHESE_OPEN: + case TokenCppKind_ParenOp: { if (nest_level == 0){ - first_paren = token; - first_paren_index = token_iterator_current_index(&token_it); - first_paren_position = token->start; + first_paren_it = it; + first_paren_index = token_it_index(&it); + first_paren_position = token->pos; goto paren_mode1; } }break; } } + if (!token_it_inc(&it)){ + goto end; + } } - goto end; // Look for a closing parenthese to mark the end of a function signature. paren_mode1: paren_nest_level = 0; - for (Token *token = token_iterator_current(&token_it); - token != 0; - token = token_iterator_goto_next(&token_it)){ - if (!(token->flags & CPP_TFLAG_PP_BODY)){ - switch (token->type){ - case CPP_TOKEN_PARENTHESE_OPEN: + for (;;){ + Token *token = token_it_read(&it); + if (!HasFlag(token->flags, TokenBaseFlag_PreprocessorBody)){ + switch (token->sub_kind){ + case TokenCppKind_ParenOp: { ++paren_nest_level; }break; - case CPP_TOKEN_PARENTHESE_CLOSE: + case TokenCppKind_ParenCl: { --paren_nest_level; if (paren_nest_level == 0){ - last_paren_index = token_iterator_current_index(&token_it); + last_paren_index = token_it_index(&it); goto paren_mode2; } }break; } } + if (!token_it_inc(&it)){ + goto end; + } } - goto end; // Look backwards from an open parenthese to find the start of a function signature. paren_mode2: { - Token *restore_point = token_iterator_current(&token_it); - - token_iterator_set(&token_it, first_paren); - i32 signature_start_index = 0; - for (Token *token = token_iterator_current(&token_it); - token != 0; - token = token_iterator_goto_prev(&token_it)){ - if ((token->flags & CPP_TFLAG_PP_BODY) || (token->flags & CPP_TFLAG_PP_DIRECTIVE) || - token->type == CPP_TOKEN_BRACE_CLOSE || token->type == CPP_TOKEN_SEMICOLON || token->type == CPP_TOKEN_PARENTHESE_CLOSE){ - token_iterator_goto_next(&token_it); - signature_start_index = token_iterator_current_index(&token_it); - if (signature_start_index == -1){ + Token_Iterator_Array restore_point = it; + it = first_paren_it; + i64 signature_start_index = 0; + for (;;){ + Token *token = token_it_read(&it); + if (HasFlag(token->flags, TokenBaseFlag_PreprocessorBody) || + token->sub_kind == TokenCppKind_BraceCl || + token->sub_kind == TokenCppKind_Semicolon || + token->sub_kind == TokenCppKind_ParenCl){ + if (!token_it_inc(&it)){ signature_start_index = first_paren_index; } + else{ + signature_start_index = token_it_index(&it); + } goto paren_mode2_done; } + if (!token_it_dec(&it)){ + break; + } } // When this loop ends by going all the way back to the beginning set the @@ -119,16 +124,16 @@ get_function_positions(Application_Links *app, Buffer_ID buffer, i32 first_token paren_mode2_done:; { - Function_Positions positions; + Function_Positions positions = {}; positions.sig_start_index = signature_start_index; positions.sig_end_index = last_paren_index; positions.open_paren_pos = first_paren_position; positions_array[result.positions_count++] = positions; } - token_iterator_set(&token_it, restore_point); + it = restore_point; if (result.positions_count >= positions_max){ - result.next_token_index = token_iterator_current_index(&token_it); + result.next_token_index = token_it_index(&it); result.still_looping = true; goto end; } @@ -136,52 +141,44 @@ get_function_positions(Application_Links *app, Buffer_ID buffer, i32 first_token goto mode1; } end:; - } -#endif return(result); } static void -print_positions_buffered(Application_Links *app, Buffer_Insertion *out, Buffer_ID buffer, Function_Positions *positions_array, i32 positions_count){ - NotImplemented; -#if 0 - Arena *scratch = context_get_arena(app); - Temp_Memory temp = begin_temp(scratch); +print_positions_buffered(Application_Links *app, Buffer_Insertion *out, Buffer_ID buffer, Function_Positions *positions_array, i64 positions_count){ + Scratch_Block scratch(app); String_Const_u8 buffer_name = push_buffer_unique_name(app, scratch, buffer); for (i32 i = 0; i < positions_count; ++i){ Function_Positions *positions = &positions_array[i]; - i32 start_index = positions->sig_start_index; - i32 end_index = positions->sig_end_index; + i64 start_index = positions->sig_start_index; + i64 end_index = positions->sig_end_index; i64 open_paren_pos = positions->open_paren_pos; i64 line_number = get_line_number_from_pos(app, buffer, open_paren_pos); Assert(end_index > start_index); - Token_Range token_range = buffer_get_token_range(app, buffer); - if (token_range.first != 0){ + Token_Array array = get_token_array_from_buffer(app, buffer); + if (array.tokens != 0){ insertf(out, "%.*s:%lld: ", string_expand(buffer_name), line_number); Token prev_token = {}; - Token_Iterator token_it = make_token_iterator(token_range, start_index); - for (Token *token = token_iterator_current(&token_it); - token != 0 && token_iterator_current_index(&token_it) <= end_index; - token = token_iterator_goto_next_raw(&token_it)){ - if ((token->flags & CPP_TFLAG_PP_BODY) == 0 && token->type != CPP_TOKEN_COMMENT){ - if ((prev_token.type == CPP_TOKEN_IDENTIFIER || - prev_token.type == CPP_TOKEN_STAR || - prev_token.type == CPP_TOKEN_COMMA || - (prev_token.flags & CPP_TFLAG_IS_KEYWORD) != 0 - ) && - !(token->type == CPP_TOKEN_PARENTHESE_OPEN || - token->type == CPP_TOKEN_PARENTHESE_CLOSE || - token->type == CPP_TOKEN_COMMA - ) - ){ + Token_Iterator_Array it = token_iterator_index(buffer, &array, start_index); + for (;;){ + Token *token = token_it_read(&it); + if (!HasFlag(token->flags, TokenBaseFlag_PreprocessorBody) && + token->kind != TokenBaseKind_Comment){ + if ((prev_token.sub_kind == TokenCppKind_Identifier || + prev_token.sub_kind == TokenCppKind_Star || + prev_token.sub_kind == TokenCppKind_Comma || + prev_token.kind == TokenBaseKind_Keyword) && + !(token->sub_kind == TokenCppKind_ParenOp || + token->sub_kind == TokenCppKind_ParenCl || + token->sub_kind == TokenCppKind_Comma)){ insertc(out, ' '); } @@ -192,21 +189,22 @@ print_positions_buffered(Application_Links *app, Buffer_Insertion *out, Buffer_I prev_token = *token; } + if (!token_it_inc(&it)){ + break; + } + i64 index = token_it_index(&it); + if (index > end_index){ + break; + } } insertc(out, '\n'); } } - - end_temp(temp); -#endif } static void list_all_functions(Application_Links *app, Buffer_ID optional_target_buffer){ - - NotImplemented; -#if 0 // TODO(allen): Use create or switch to buffer and clear here? String_Const_u8 decls_name = string_u8_litexpr("*decls*"); Buffer_ID decls_buffer = get_buffer_by_name(app, decls_name, AccessAll); @@ -214,18 +212,17 @@ list_all_functions(Application_Links *app, Buffer_ID optional_target_buffer){ decls_buffer = create_buffer(app, decls_name, BufferCreate_AlwaysNew); buffer_set_setting(app, decls_buffer, BufferSetting_Unimportant, true); buffer_set_setting(app, decls_buffer, BufferSetting_ReadOnly, true); - buffer_set_setting(app, decls_buffer, BufferSetting_WrapLine, false); + //buffer_set_setting(app, decls_buffer, BufferSetting_WrapLine, false); } else{ clear_buffer(app, decls_buffer); buffer_send_end_signal(app, decls_buffer); } - Arena *scratch = context_get_arena(app); - Temp_Memory temp = begin_temp(scratch); + Scratch_Block scratch(app); - // TODO(allen): rewrite get_function_positions to allocate on arena - i32 positions_max = (4<<10)/sizeof(Function_Positions); + // TODO(allen): rewrite get_function_positions to allocate on arena + i32 positions_max = KB(4)/sizeof(Function_Positions); Function_Positions *positions_array = push_array(scratch, Function_Positions, positions_max); Cursor insertion_cursor = make_cursor(push_array(scratch, u8, KB(256)), KB(256)); @@ -239,13 +236,14 @@ list_all_functions(Application_Links *app, Buffer_ID optional_target_buffer){ buffer = optional_target_buffer; } - if (buffer_tokens_are_ready(app, buffer)){ - i32 token_index = 0; + Token_Array array = get_token_array_from_buffer(app, buffer); + if (array.tokens != 0){ + i64 token_index = 0; b32 still_looping = false; do{ Get_Positions_Results get_positions_results = get_function_positions(app, buffer, token_index, positions_array, positions_max); - i32 positions_count = get_positions_results.positions_count; + i64 positions_count = get_positions_results.positions_count; token_index = get_positions_results.next_token_index; still_looping = get_positions_results.still_looping; @@ -256,9 +254,6 @@ list_all_functions(Application_Links *app, Buffer_ID optional_target_buffer){ break; } } - else{ - continue; - } } end_buffer_insertion(&out); @@ -267,10 +262,6 @@ list_all_functions(Application_Links *app, Buffer_ID optional_target_buffer){ view_set_buffer(app, view, decls_buffer, 0); lock_jump_buffer(app, decls_name); - - end_temp(temp); -#endif - } CUSTOM_COMMAND_SIG(list_all_functions_current_buffer) diff --git a/4coder_function_list.h b/4coder_function_list.h index 95c698e7..bbd05de3 100644 --- a/4coder_function_list.h +++ b/4coder_function_list.h @@ -8,14 +8,14 @@ #define FCODER_FUNCTION_LIST_H struct Function_Positions{ - i32 sig_start_index; - i32 sig_end_index; - i32 open_paren_pos; + i64 sig_start_index; + i64 sig_end_index; + i64 open_paren_pos; }; struct Get_Positions_Results{ - i32 positions_count; - i32 next_token_index; + i64 positions_count; + i64 next_token_index; b32 still_looping; }; diff --git a/4coder_generated/command_metadata.h b/4coder_generated/command_metadata.h index 42e0d733..c8bea52d 100644 --- a/4coder_generated/command_metadata.h +++ b/4coder_generated/command_metadata.h @@ -2,14 +2,14 @@ #define command_id(c) (fcoder_metacmd_ID_##c) #define command_metadata(c) (&fcoder_metacmd_table[command_id(c)]) #define command_metadata_by_id(id) (&fcoder_metacmd_table[id]) -#define command_one_past_last_id 232 +#define command_one_past_last_id 226 #if defined(CUSTOM_COMMAND_SIG) #define PROC_LINKS(x,y) x #else #define PROC_LINKS(x,y) y #endif #if defined(CUSTOM_COMMAND_SIG) -CUSTOM_COMMAND_SIG(write_explicit_enum_flags); +CUSTOM_COMMAND_SIG(miblo_decrement_time_stamp_minute); CUSTOM_COMMAND_SIG(seek_beginning_of_textual_line); CUSTOM_COMMAND_SIG(seek_end_of_textual_line); CUSTOM_COMMAND_SIG(seek_beginning_of_line); @@ -84,10 +84,7 @@ CUSTOM_COMMAND_SIG(hide_scrollbar); CUSTOM_COMMAND_SIG(show_filebar); CUSTOM_COMMAND_SIG(hide_filebar); CUSTOM_COMMAND_SIG(toggle_filebar); -CUSTOM_COMMAND_SIG(toggle_line_wrap); CUSTOM_COMMAND_SIG(toggle_fps_meter); -CUSTOM_COMMAND_SIG(increase_line_wrap); -CUSTOM_COMMAND_SIG(decrease_line_wrap); CUSTOM_COMMAND_SIG(increase_face_size); CUSTOM_COMMAND_SIG(decrease_face_size); CUSTOM_COMMAND_SIG(mouse_wheel_change_face_size); @@ -238,9 +235,6 @@ CUSTOM_COMMAND_SIG(miblo_decrement_basic); CUSTOM_COMMAND_SIG(miblo_increment_time_stamp); CUSTOM_COMMAND_SIG(miblo_decrement_time_stamp); CUSTOM_COMMAND_SIG(miblo_increment_time_stamp_minute); -CUSTOM_COMMAND_SIG(miblo_decrement_time_stamp_minute); -CUSTOM_COMMAND_SIG(rename_parameter); -CUSTOM_COMMAND_SIG(write_explicit_enum_values); #endif struct Command_Metadata{ PROC_LINKS(Custom_Command_Function, void) *proc; @@ -252,8 +246,8 @@ char *source_name; i32 source_name_len; i32 line_number; }; -static Command_Metadata fcoder_metacmd_table[232] = { -{ PROC_LINKS(write_explicit_enum_flags, 0), "write_explicit_enum_flags", 25, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in to give each a unique power of 2 value, starting from 1. Existing values are overwritten.", 194, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 503 }, +static Command_Metadata fcoder_metacmd_table[226] = { +{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), "miblo_decrement_time_stamp_minute", 33, "Decrement a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 249 }, { PROC_LINKS(seek_beginning_of_textual_line, 0), "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "w:\\4ed\\code\\4coder_seek.cpp", 27, 29 }, { PROC_LINKS(seek_end_of_textual_line, 0), "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "w:\\4ed\\code\\4coder_seek.cpp", 27, 35 }, { PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "w:\\4ed\\code\\4coder_seek.cpp", 27, 41 }, @@ -328,51 +322,48 @@ static Command_Metadata fcoder_metacmd_table[232] = { { PROC_LINKS(show_filebar, 0), "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 672 }, { PROC_LINKS(hide_filebar, 0), "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 679 }, { PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 686 }, -{ PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 695 }, -{ PROC_LINKS(toggle_fps_meter, 0), "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 708 }, -{ PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 714 }, -{ PROC_LINKS(decrease_line_wrap, 0), "decrease_line_wrap", 18, "Decrases the current buffer's width for line wrapping.", 54, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 727 }, -{ PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 740 }, -{ PROC_LINKS(decrease_face_size, 0), "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 751 }, -{ PROC_LINKS(mouse_wheel_change_face_size, 0), "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 762 }, -{ PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 779 }, -{ PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 789 }, -{ PROC_LINKS(toggle_line_numbers, 0), "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 798 }, -{ PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 804 }, -{ PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 812 }, -{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 820 }, -{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 828 }, -{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1039 }, -{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1045 }, -{ PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1051 }, -{ PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1062 }, -{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for a needle and string. Replaces all occurences of needle with string in the range between cursor and the mark in the active buffer.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1113 }, -{ PROC_LINKS(replace_in_buffer, 0), "replace_in_buffer", 17, "Queries the user for a needle and string. Replaces all occurences of needle with string in the active buffer.", 109, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1122 }, -{ PROC_LINKS(replace_in_all_buffers, 0), "replace_in_all_buffers", 22, "Queries the user for a needle and string. Replaces all occurences of needle with string in all editable buffers.", 112, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1131 }, -{ PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1219 }, -{ PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1239 }, -{ PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1255 }, -{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1290 }, -{ PROC_LINKS(delete_file_query, 0), "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1315 }, -{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1353 }, -{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1388 }, -{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1428 }, -{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1461 }, -{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1467 }, -{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1473 }, -{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1487 }, -{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1552 }, -{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1584 }, -{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1597 }, -{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1609 }, -{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1645 }, -{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1653 }, -{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1665 }, -{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1723 }, -{ PROC_LINKS(redo, 0), "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1736 }, -{ PROC_LINKS(undo_all_buffers, 0), "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1750 }, -{ PROC_LINKS(redo_all_buffers, 0), "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1824 }, -{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1927 }, +{ PROC_LINKS(toggle_fps_meter, 0), "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 695 }, +{ PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 701 }, +{ PROC_LINKS(decrease_face_size, 0), "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 712 }, +{ PROC_LINKS(mouse_wheel_change_face_size, 0), "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 723 }, +{ PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 740 }, +{ PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 750 }, +{ PROC_LINKS(toggle_line_numbers, 0), "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 759 }, +{ PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 765 }, +{ PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 773 }, +{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 781 }, +{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 789 }, +{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1000 }, +{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1006 }, +{ PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1012 }, +{ PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1023 }, +{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for a needle and string. Replaces all occurences of needle with string in the range between cursor and the mark in the active buffer.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1074 }, +{ PROC_LINKS(replace_in_buffer, 0), "replace_in_buffer", 17, "Queries the user for a needle and string. Replaces all occurences of needle with string in the active buffer.", 109, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1083 }, +{ PROC_LINKS(replace_in_all_buffers, 0), "replace_in_all_buffers", 22, "Queries the user for a needle and string. Replaces all occurences of needle with string in all editable buffers.", 112, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1092 }, +{ PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1180 }, +{ PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1200 }, +{ PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1216 }, +{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1251 }, +{ PROC_LINKS(delete_file_query, 0), "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1276 }, +{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1314 }, +{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1349 }, +{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1389 }, +{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1422 }, +{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1428 }, +{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1434 }, +{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1448 }, +{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1513 }, +{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1545 }, +{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1558 }, +{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1570 }, +{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1606 }, +{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1614 }, +{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1626 }, +{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1684 }, +{ PROC_LINKS(redo, 0), "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1697 }, +{ PROC_LINKS(undo_all_buffers, 0), "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1711 }, +{ PROC_LINKS(redo_all_buffers, 0), "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1785 }, +{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1888 }, { PROC_LINKS(lister__quit, 0), "lister__quit", 12, "A lister mode command that quits the list without executing any actions.", 72, "w:\\4ed\\code\\4coder_lists.cpp", 28, 8 }, { PROC_LINKS(lister__activate, 0), "lister__activate", 16, "A lister mode command that activates the list's action on the highlighted item.", 79, "w:\\4ed\\code\\4coder_lists.cpp", 28, 15 }, { PROC_LINKS(lister__write_character, 0), "lister__write_character", 23, "A lister mode command that dispatches to the lister's write character handler.", 78, "w:\\4ed\\code\\4coder_lists.cpp", 28, 30 }, @@ -452,15 +443,15 @@ static Command_Metadata fcoder_metacmd_table[232] = { { PROC_LINKS(setup_build_sh, 0), "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1319 }, { PROC_LINKS(setup_build_bat_and_sh, 0), "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1325 }, { PROC_LINKS(project_command_lister, 0), "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1340 }, -{ PROC_LINKS(list_all_functions_current_buffer, 0), "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 276 }, -{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 286 }, -{ PROC_LINKS(list_all_functions_all_buffers, 0), "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 298 }, -{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 304 }, -{ PROC_LINKS(select_surrounding_scope, 0), "select_surrounding_scope", 24, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 348 }, -{ PROC_LINKS(select_next_scope_absolute, 0), "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 363 }, -{ PROC_LINKS(select_prev_scope_absolute, 0), "select_prev_scope_absolute", 26, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 382 }, -{ PROC_LINKS(place_in_scope, 0), "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 456 }, -{ PROC_LINKS(delete_current_scope, 0), "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 462 }, +{ PROC_LINKS(list_all_functions_current_buffer, 0), "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 267 }, +{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 277 }, +{ PROC_LINKS(list_all_functions_all_buffers, 0), "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 289 }, +{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 295 }, +{ PROC_LINKS(select_surrounding_scope, 0), "select_surrounding_scope", 24, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 319 }, +{ PROC_LINKS(select_next_scope_absolute, 0), "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 334 }, +{ PROC_LINKS(select_prev_scope_absolute, 0), "select_prev_scope_absolute", 26, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 353 }, +{ PROC_LINKS(place_in_scope, 0), "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 427 }, +{ PROC_LINKS(delete_current_scope, 0), "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 433 }, { PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 46 }, { PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 54 }, { PROC_LINKS(open_long_braces_break, 0), "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 62 }, @@ -482,11 +473,8 @@ static Command_Metadata fcoder_metacmd_table[232] = { { PROC_LINKS(miblo_increment_time_stamp, 0), "miblo_increment_time_stamp", 26, "Increment a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 231 }, { PROC_LINKS(miblo_decrement_time_stamp, 0), "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 237 }, { PROC_LINKS(miblo_increment_time_stamp_minute, 0), "miblo_increment_time_stamp_minute", 33, "Increment a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 243 }, -{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), "miblo_decrement_time_stamp_minute", 33, "Decrement a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 249 }, -{ PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 188 }, -{ PROC_LINKS(write_explicit_enum_values, 0), "write_explicit_enum_values", 26, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in sequentially starting from zero. Existing values are overwritten.", 170, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 497 }, }; -static i32 fcoder_metacmd_ID_write_explicit_enum_flags = 0; +static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp_minute = 0; static i32 fcoder_metacmd_ID_seek_beginning_of_textual_line = 1; static i32 fcoder_metacmd_ID_seek_end_of_textual_line = 2; static i32 fcoder_metacmd_ID_seek_beginning_of_line = 3; @@ -561,161 +549,155 @@ static i32 fcoder_metacmd_ID_hide_scrollbar = 71; static i32 fcoder_metacmd_ID_show_filebar = 72; static i32 fcoder_metacmd_ID_hide_filebar = 73; static i32 fcoder_metacmd_ID_toggle_filebar = 74; -static i32 fcoder_metacmd_ID_toggle_line_wrap = 75; -static i32 fcoder_metacmd_ID_toggle_fps_meter = 76; -static i32 fcoder_metacmd_ID_increase_line_wrap = 77; -static i32 fcoder_metacmd_ID_decrease_line_wrap = 78; -static i32 fcoder_metacmd_ID_increase_face_size = 79; -static i32 fcoder_metacmd_ID_decrease_face_size = 80; -static i32 fcoder_metacmd_ID_mouse_wheel_change_face_size = 81; -static i32 fcoder_metacmd_ID_toggle_virtual_whitespace = 82; -static i32 fcoder_metacmd_ID_toggle_show_whitespace = 83; -static i32 fcoder_metacmd_ID_toggle_line_numbers = 84; -static i32 fcoder_metacmd_ID_eol_dosify = 85; -static i32 fcoder_metacmd_ID_eol_nixify = 86; -static i32 fcoder_metacmd_ID_exit_4coder = 87; -static i32 fcoder_metacmd_ID_goto_line = 88; -static i32 fcoder_metacmd_ID_search = 89; -static i32 fcoder_metacmd_ID_reverse_search = 90; -static i32 fcoder_metacmd_ID_search_identifier = 91; -static i32 fcoder_metacmd_ID_reverse_search_identifier = 92; -static i32 fcoder_metacmd_ID_replace_in_range = 93; -static i32 fcoder_metacmd_ID_replace_in_buffer = 94; -static i32 fcoder_metacmd_ID_replace_in_all_buffers = 95; -static i32 fcoder_metacmd_ID_query_replace = 96; -static i32 fcoder_metacmd_ID_query_replace_identifier = 97; -static i32 fcoder_metacmd_ID_query_replace_selection = 98; -static i32 fcoder_metacmd_ID_save_all_dirty_buffers = 99; -static i32 fcoder_metacmd_ID_delete_file_query = 100; -static i32 fcoder_metacmd_ID_save_to_query = 101; -static i32 fcoder_metacmd_ID_rename_file_query = 102; -static i32 fcoder_metacmd_ID_make_directory_query = 103; -static i32 fcoder_metacmd_ID_move_line_up = 104; -static i32 fcoder_metacmd_ID_move_line_down = 105; -static i32 fcoder_metacmd_ID_duplicate_line = 106; -static i32 fcoder_metacmd_ID_delete_line = 107; -static i32 fcoder_metacmd_ID_open_file_in_quotes = 108; -static i32 fcoder_metacmd_ID_open_matching_file_cpp = 109; -static i32 fcoder_metacmd_ID_view_buffer_other_panel = 110; -static i32 fcoder_metacmd_ID_swap_buffers_between_panels = 111; -static i32 fcoder_metacmd_ID_kill_buffer = 112; -static i32 fcoder_metacmd_ID_save = 113; -static i32 fcoder_metacmd_ID_reopen = 114; -static i32 fcoder_metacmd_ID_undo = 115; -static i32 fcoder_metacmd_ID_redo = 116; -static i32 fcoder_metacmd_ID_undo_all_buffers = 117; -static i32 fcoder_metacmd_ID_redo_all_buffers = 118; -static i32 fcoder_metacmd_ID_open_in_other = 119; -static i32 fcoder_metacmd_ID_lister__quit = 120; -static i32 fcoder_metacmd_ID_lister__activate = 121; -static i32 fcoder_metacmd_ID_lister__write_character = 122; -static i32 fcoder_metacmd_ID_lister__backspace_text_field = 123; -static i32 fcoder_metacmd_ID_lister__move_up = 124; -static i32 fcoder_metacmd_ID_lister__move_down = 125; -static i32 fcoder_metacmd_ID_lister__wheel_scroll = 126; -static i32 fcoder_metacmd_ID_lister__mouse_press = 127; -static i32 fcoder_metacmd_ID_lister__mouse_release = 128; -static i32 fcoder_metacmd_ID_lister__repaint = 129; -static i32 fcoder_metacmd_ID_lister__write_character__default = 130; -static i32 fcoder_metacmd_ID_lister__backspace_text_field__default = 131; -static i32 fcoder_metacmd_ID_lister__move_up__default = 132; -static i32 fcoder_metacmd_ID_lister__move_down__default = 133; -static i32 fcoder_metacmd_ID_lister__write_character__file_path = 134; -static i32 fcoder_metacmd_ID_lister__backspace_text_field__file_path = 135; -static i32 fcoder_metacmd_ID_lister__write_character__fixed_list = 136; -static i32 fcoder_metacmd_ID_interactive_switch_buffer = 137; -static i32 fcoder_metacmd_ID_interactive_kill_buffer = 138; -static i32 fcoder_metacmd_ID_interactive_open_or_new = 139; -static i32 fcoder_metacmd_ID_interactive_new = 140; -static i32 fcoder_metacmd_ID_interactive_open = 141; -static i32 fcoder_metacmd_ID_command_lister = 142; -static i32 fcoder_metacmd_ID_auto_tab_whole_file = 143; -static i32 fcoder_metacmd_ID_auto_tab_line_at_cursor = 144; -static i32 fcoder_metacmd_ID_auto_tab_range = 145; -static i32 fcoder_metacmd_ID_write_and_auto_tab = 146; -static i32 fcoder_metacmd_ID_list_all_locations = 147; -static i32 fcoder_metacmd_ID_list_all_substring_locations = 148; -static i32 fcoder_metacmd_ID_list_all_locations_case_insensitive = 149; -static i32 fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 150; -static i32 fcoder_metacmd_ID_list_all_locations_of_identifier = 151; -static i32 fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 152; -static i32 fcoder_metacmd_ID_list_all_locations_of_selection = 153; -static i32 fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 154; -static i32 fcoder_metacmd_ID_list_all_locations_of_type_definition = 155; -static i32 fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 156; -static i32 fcoder_metacmd_ID_word_complete = 157; -static i32 fcoder_metacmd_ID_goto_jump_at_cursor = 158; -static i32 fcoder_metacmd_ID_goto_jump_at_cursor_same_panel = 159; -static i32 fcoder_metacmd_ID_goto_next_jump = 160; -static i32 fcoder_metacmd_ID_goto_prev_jump = 161; -static i32 fcoder_metacmd_ID_goto_next_jump_no_skips = 162; -static i32 fcoder_metacmd_ID_goto_prev_jump_no_skips = 163; -static i32 fcoder_metacmd_ID_goto_first_jump = 164; -static i32 fcoder_metacmd_ID_goto_first_jump_same_panel_sticky = 165; -static i32 fcoder_metacmd_ID_newline_or_goto_position = 166; -static i32 fcoder_metacmd_ID_newline_or_goto_position_same_panel = 167; -static i32 fcoder_metacmd_ID_view_jump_list_with_lister = 168; -static i32 fcoder_metacmd_ID_log_graph__escape = 169; -static i32 fcoder_metacmd_ID_log_graph__scroll_wheel = 170; -static i32 fcoder_metacmd_ID_log_graph__page_up = 171; -static i32 fcoder_metacmd_ID_log_graph__page_down = 172; -static i32 fcoder_metacmd_ID_log_graph__click_select_event = 173; -static i32 fcoder_metacmd_ID_log_graph__click_jump_to_event_source = 174; -static i32 fcoder_metacmd_ID_show_the_log_graph = 175; -static i32 fcoder_metacmd_ID_copy = 176; -static i32 fcoder_metacmd_ID_cut = 177; -static i32 fcoder_metacmd_ID_paste = 178; -static i32 fcoder_metacmd_ID_paste_next = 179; -static i32 fcoder_metacmd_ID_paste_and_indent = 180; -static i32 fcoder_metacmd_ID_paste_next_and_indent = 181; -static i32 fcoder_metacmd_ID_execute_previous_cli = 182; -static i32 fcoder_metacmd_ID_execute_any_cli = 183; -static i32 fcoder_metacmd_ID_build_search = 184; -static i32 fcoder_metacmd_ID_build_in_build_panel = 185; -static i32 fcoder_metacmd_ID_close_build_panel = 186; -static i32 fcoder_metacmd_ID_change_to_build_panel = 187; -static i32 fcoder_metacmd_ID_close_all_code = 188; -static i32 fcoder_metacmd_ID_open_all_code = 189; -static i32 fcoder_metacmd_ID_open_all_code_recursive = 190; -static i32 fcoder_metacmd_ID_load_project = 191; -static i32 fcoder_metacmd_ID_project_fkey_command = 192; -static i32 fcoder_metacmd_ID_project_go_to_root_directory = 193; -static i32 fcoder_metacmd_ID_setup_new_project = 194; -static i32 fcoder_metacmd_ID_setup_build_bat = 195; -static i32 fcoder_metacmd_ID_setup_build_sh = 196; -static i32 fcoder_metacmd_ID_setup_build_bat_and_sh = 197; -static i32 fcoder_metacmd_ID_project_command_lister = 198; -static i32 fcoder_metacmd_ID_list_all_functions_current_buffer = 199; -static i32 fcoder_metacmd_ID_list_all_functions_current_buffer_lister = 200; -static i32 fcoder_metacmd_ID_list_all_functions_all_buffers = 201; -static i32 fcoder_metacmd_ID_list_all_functions_all_buffers_lister = 202; -static i32 fcoder_metacmd_ID_select_surrounding_scope = 203; -static i32 fcoder_metacmd_ID_select_next_scope_absolute = 204; -static i32 fcoder_metacmd_ID_select_prev_scope_absolute = 205; -static i32 fcoder_metacmd_ID_place_in_scope = 206; -static i32 fcoder_metacmd_ID_delete_current_scope = 207; -static i32 fcoder_metacmd_ID_open_long_braces = 208; -static i32 fcoder_metacmd_ID_open_long_braces_semicolon = 209; -static i32 fcoder_metacmd_ID_open_long_braces_break = 210; -static i32 fcoder_metacmd_ID_if0_off = 211; -static i32 fcoder_metacmd_ID_write_todo = 212; -static i32 fcoder_metacmd_ID_write_hack = 213; -static i32 fcoder_metacmd_ID_write_note = 214; -static i32 fcoder_metacmd_ID_write_block = 215; -static i32 fcoder_metacmd_ID_write_zero_struct = 216; -static i32 fcoder_metacmd_ID_comment_line = 217; -static i32 fcoder_metacmd_ID_uncomment_line = 218; -static i32 fcoder_metacmd_ID_comment_line_toggle = 219; -static i32 fcoder_metacmd_ID_snippet_lister = 220; -static i32 fcoder_metacmd_ID_set_bindings_choose = 221; -static i32 fcoder_metacmd_ID_set_bindings_default = 222; -static i32 fcoder_metacmd_ID_set_bindings_mac_default = 223; -static i32 fcoder_metacmd_ID_miblo_increment_basic = 224; -static i32 fcoder_metacmd_ID_miblo_decrement_basic = 225; -static i32 fcoder_metacmd_ID_miblo_increment_time_stamp = 226; -static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp = 227; -static i32 fcoder_metacmd_ID_miblo_increment_time_stamp_minute = 228; -static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp_minute = 229; -static i32 fcoder_metacmd_ID_rename_parameter = 230; -static i32 fcoder_metacmd_ID_write_explicit_enum_values = 231; +static i32 fcoder_metacmd_ID_toggle_fps_meter = 75; +static i32 fcoder_metacmd_ID_increase_face_size = 76; +static i32 fcoder_metacmd_ID_decrease_face_size = 77; +static i32 fcoder_metacmd_ID_mouse_wheel_change_face_size = 78; +static i32 fcoder_metacmd_ID_toggle_virtual_whitespace = 79; +static i32 fcoder_metacmd_ID_toggle_show_whitespace = 80; +static i32 fcoder_metacmd_ID_toggle_line_numbers = 81; +static i32 fcoder_metacmd_ID_eol_dosify = 82; +static i32 fcoder_metacmd_ID_eol_nixify = 83; +static i32 fcoder_metacmd_ID_exit_4coder = 84; +static i32 fcoder_metacmd_ID_goto_line = 85; +static i32 fcoder_metacmd_ID_search = 86; +static i32 fcoder_metacmd_ID_reverse_search = 87; +static i32 fcoder_metacmd_ID_search_identifier = 88; +static i32 fcoder_metacmd_ID_reverse_search_identifier = 89; +static i32 fcoder_metacmd_ID_replace_in_range = 90; +static i32 fcoder_metacmd_ID_replace_in_buffer = 91; +static i32 fcoder_metacmd_ID_replace_in_all_buffers = 92; +static i32 fcoder_metacmd_ID_query_replace = 93; +static i32 fcoder_metacmd_ID_query_replace_identifier = 94; +static i32 fcoder_metacmd_ID_query_replace_selection = 95; +static i32 fcoder_metacmd_ID_save_all_dirty_buffers = 96; +static i32 fcoder_metacmd_ID_delete_file_query = 97; +static i32 fcoder_metacmd_ID_save_to_query = 98; +static i32 fcoder_metacmd_ID_rename_file_query = 99; +static i32 fcoder_metacmd_ID_make_directory_query = 100; +static i32 fcoder_metacmd_ID_move_line_up = 101; +static i32 fcoder_metacmd_ID_move_line_down = 102; +static i32 fcoder_metacmd_ID_duplicate_line = 103; +static i32 fcoder_metacmd_ID_delete_line = 104; +static i32 fcoder_metacmd_ID_open_file_in_quotes = 105; +static i32 fcoder_metacmd_ID_open_matching_file_cpp = 106; +static i32 fcoder_metacmd_ID_view_buffer_other_panel = 107; +static i32 fcoder_metacmd_ID_swap_buffers_between_panels = 108; +static i32 fcoder_metacmd_ID_kill_buffer = 109; +static i32 fcoder_metacmd_ID_save = 110; +static i32 fcoder_metacmd_ID_reopen = 111; +static i32 fcoder_metacmd_ID_undo = 112; +static i32 fcoder_metacmd_ID_redo = 113; +static i32 fcoder_metacmd_ID_undo_all_buffers = 114; +static i32 fcoder_metacmd_ID_redo_all_buffers = 115; +static i32 fcoder_metacmd_ID_open_in_other = 116; +static i32 fcoder_metacmd_ID_lister__quit = 117; +static i32 fcoder_metacmd_ID_lister__activate = 118; +static i32 fcoder_metacmd_ID_lister__write_character = 119; +static i32 fcoder_metacmd_ID_lister__backspace_text_field = 120; +static i32 fcoder_metacmd_ID_lister__move_up = 121; +static i32 fcoder_metacmd_ID_lister__move_down = 122; +static i32 fcoder_metacmd_ID_lister__wheel_scroll = 123; +static i32 fcoder_metacmd_ID_lister__mouse_press = 124; +static i32 fcoder_metacmd_ID_lister__mouse_release = 125; +static i32 fcoder_metacmd_ID_lister__repaint = 126; +static i32 fcoder_metacmd_ID_lister__write_character__default = 127; +static i32 fcoder_metacmd_ID_lister__backspace_text_field__default = 128; +static i32 fcoder_metacmd_ID_lister__move_up__default = 129; +static i32 fcoder_metacmd_ID_lister__move_down__default = 130; +static i32 fcoder_metacmd_ID_lister__write_character__file_path = 131; +static i32 fcoder_metacmd_ID_lister__backspace_text_field__file_path = 132; +static i32 fcoder_metacmd_ID_lister__write_character__fixed_list = 133; +static i32 fcoder_metacmd_ID_interactive_switch_buffer = 134; +static i32 fcoder_metacmd_ID_interactive_kill_buffer = 135; +static i32 fcoder_metacmd_ID_interactive_open_or_new = 136; +static i32 fcoder_metacmd_ID_interactive_new = 137; +static i32 fcoder_metacmd_ID_interactive_open = 138; +static i32 fcoder_metacmd_ID_command_lister = 139; +static i32 fcoder_metacmd_ID_auto_tab_whole_file = 140; +static i32 fcoder_metacmd_ID_auto_tab_line_at_cursor = 141; +static i32 fcoder_metacmd_ID_auto_tab_range = 142; +static i32 fcoder_metacmd_ID_write_and_auto_tab = 143; +static i32 fcoder_metacmd_ID_list_all_locations = 144; +static i32 fcoder_metacmd_ID_list_all_substring_locations = 145; +static i32 fcoder_metacmd_ID_list_all_locations_case_insensitive = 146; +static i32 fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 147; +static i32 fcoder_metacmd_ID_list_all_locations_of_identifier = 148; +static i32 fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 149; +static i32 fcoder_metacmd_ID_list_all_locations_of_selection = 150; +static i32 fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 151; +static i32 fcoder_metacmd_ID_list_all_locations_of_type_definition = 152; +static i32 fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 153; +static i32 fcoder_metacmd_ID_word_complete = 154; +static i32 fcoder_metacmd_ID_goto_jump_at_cursor = 155; +static i32 fcoder_metacmd_ID_goto_jump_at_cursor_same_panel = 156; +static i32 fcoder_metacmd_ID_goto_next_jump = 157; +static i32 fcoder_metacmd_ID_goto_prev_jump = 158; +static i32 fcoder_metacmd_ID_goto_next_jump_no_skips = 159; +static i32 fcoder_metacmd_ID_goto_prev_jump_no_skips = 160; +static i32 fcoder_metacmd_ID_goto_first_jump = 161; +static i32 fcoder_metacmd_ID_goto_first_jump_same_panel_sticky = 162; +static i32 fcoder_metacmd_ID_newline_or_goto_position = 163; +static i32 fcoder_metacmd_ID_newline_or_goto_position_same_panel = 164; +static i32 fcoder_metacmd_ID_view_jump_list_with_lister = 165; +static i32 fcoder_metacmd_ID_log_graph__escape = 166; +static i32 fcoder_metacmd_ID_log_graph__scroll_wheel = 167; +static i32 fcoder_metacmd_ID_log_graph__page_up = 168; +static i32 fcoder_metacmd_ID_log_graph__page_down = 169; +static i32 fcoder_metacmd_ID_log_graph__click_select_event = 170; +static i32 fcoder_metacmd_ID_log_graph__click_jump_to_event_source = 171; +static i32 fcoder_metacmd_ID_show_the_log_graph = 172; +static i32 fcoder_metacmd_ID_copy = 173; +static i32 fcoder_metacmd_ID_cut = 174; +static i32 fcoder_metacmd_ID_paste = 175; +static i32 fcoder_metacmd_ID_paste_next = 176; +static i32 fcoder_metacmd_ID_paste_and_indent = 177; +static i32 fcoder_metacmd_ID_paste_next_and_indent = 178; +static i32 fcoder_metacmd_ID_execute_previous_cli = 179; +static i32 fcoder_metacmd_ID_execute_any_cli = 180; +static i32 fcoder_metacmd_ID_build_search = 181; +static i32 fcoder_metacmd_ID_build_in_build_panel = 182; +static i32 fcoder_metacmd_ID_close_build_panel = 183; +static i32 fcoder_metacmd_ID_change_to_build_panel = 184; +static i32 fcoder_metacmd_ID_close_all_code = 185; +static i32 fcoder_metacmd_ID_open_all_code = 186; +static i32 fcoder_metacmd_ID_open_all_code_recursive = 187; +static i32 fcoder_metacmd_ID_load_project = 188; +static i32 fcoder_metacmd_ID_project_fkey_command = 189; +static i32 fcoder_metacmd_ID_project_go_to_root_directory = 190; +static i32 fcoder_metacmd_ID_setup_new_project = 191; +static i32 fcoder_metacmd_ID_setup_build_bat = 192; +static i32 fcoder_metacmd_ID_setup_build_sh = 193; +static i32 fcoder_metacmd_ID_setup_build_bat_and_sh = 194; +static i32 fcoder_metacmd_ID_project_command_lister = 195; +static i32 fcoder_metacmd_ID_list_all_functions_current_buffer = 196; +static i32 fcoder_metacmd_ID_list_all_functions_current_buffer_lister = 197; +static i32 fcoder_metacmd_ID_list_all_functions_all_buffers = 198; +static i32 fcoder_metacmd_ID_list_all_functions_all_buffers_lister = 199; +static i32 fcoder_metacmd_ID_select_surrounding_scope = 200; +static i32 fcoder_metacmd_ID_select_next_scope_absolute = 201; +static i32 fcoder_metacmd_ID_select_prev_scope_absolute = 202; +static i32 fcoder_metacmd_ID_place_in_scope = 203; +static i32 fcoder_metacmd_ID_delete_current_scope = 204; +static i32 fcoder_metacmd_ID_open_long_braces = 205; +static i32 fcoder_metacmd_ID_open_long_braces_semicolon = 206; +static i32 fcoder_metacmd_ID_open_long_braces_break = 207; +static i32 fcoder_metacmd_ID_if0_off = 208; +static i32 fcoder_metacmd_ID_write_todo = 209; +static i32 fcoder_metacmd_ID_write_hack = 210; +static i32 fcoder_metacmd_ID_write_note = 211; +static i32 fcoder_metacmd_ID_write_block = 212; +static i32 fcoder_metacmd_ID_write_zero_struct = 213; +static i32 fcoder_metacmd_ID_comment_line = 214; +static i32 fcoder_metacmd_ID_uncomment_line = 215; +static i32 fcoder_metacmd_ID_comment_line_toggle = 216; +static i32 fcoder_metacmd_ID_snippet_lister = 217; +static i32 fcoder_metacmd_ID_set_bindings_choose = 218; +static i32 fcoder_metacmd_ID_set_bindings_default = 219; +static i32 fcoder_metacmd_ID_set_bindings_mac_default = 220; +static i32 fcoder_metacmd_ID_miblo_increment_basic = 221; +static i32 fcoder_metacmd_ID_miblo_decrement_basic = 222; +static i32 fcoder_metacmd_ID_miblo_increment_time_stamp = 223; +static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp = 224; +static i32 fcoder_metacmd_ID_miblo_increment_time_stamp_minute = 225; #endif diff --git a/4coder_helper.cpp b/4coder_helper.cpp index 18937f14..0ff63e6f 100644 --- a/4coder_helper.cpp +++ b/4coder_helper.cpp @@ -292,6 +292,19 @@ get_key_code(char *buffer){ //////////////////////////////// +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); + Token_Array *ptr = scope_attachment(app, scope, attachment_tokens, Token_Array); + if (ptr != 0){ + result = *ptr; + } + return(result); +} + +//////////////////////////////// + internal Buffer_Seek seek_location(ID_Line_Column_Jump_Location location){ return(seek_line_col(location.line, location.column)); @@ -601,27 +614,10 @@ get_line_end_pos_from_pos(Application_Links *app, Buffer_ID buffer, i64 pos){ return(get_line_side_pos_from_pos(app, buffer, pos, Side_Max)); } -internal Token* -get_first_token_from_pos(Token_Array tokens, i64 pos){ - NotImplemented; - Token *result = 0; -#if 0 - Get_Token_Result get_token = cpp_get_token(tokens, (i32)pos); - if (get_token.in_whitespace_after_token){ - get_token.token_index += 1; - } - Token *result = 0; - if (get_token.token_index < tokens.count){ - result = tokens.tokens + get_token.token_index; - } -#endif - return(result); -} - internal Token* get_first_token_from_line(Application_Links *app, Buffer_ID buffer, Token_Array tokens, i64 line){ i64 line_start = get_line_start_pos(app, buffer, line); - return(get_first_token_from_pos(tokens, line_start)); + return(token_from_pos(&tokens, line_start)); } //////////////////////////////// @@ -801,31 +797,29 @@ boundary_inside_quotes(Application_Links *app, Buffer_ID buffer, Side side, Scan internal i64 boundary_token(Application_Links *app, Buffer_ID buffer, Side side, Scan_Direction direction, i64 pos){ i64 result = boundary_non_whitespace(app, buffer, side, direction, pos); - NotImplemented; -#if 0 - if (!buffer_tokens_are_ready(app, buffer)){ + Token_Array tokens = get_token_array_from_buffer(app, buffer); + if (tokens.tokens == 0){ result = boundary_non_whitespace(app, buffer, side, direction, pos); } else{ - Token_Array tokens = buffer_get_token_array(app, buffer); switch (direction){ case Scan_Forward: { - i32 buffer_size = (i32)buffer_get_size(app, buffer); + i64 buffer_size = buffer_get_size(app, buffer); if (tokens.count > 0){ - Token *token = get_first_token_from_pos(tokens, pos); + Token *token = token_from_pos(&tokens, pos); if (token != 0){ if (side == Side_Max){ - result = token->start + token->size; + result = token->pos + token->size; } else{ - if (token->start > pos){ - result = token->start; + if (token->pos > pos){ + result = token->pos; } else{ token += 1; if (token < tokens.tokens + tokens.count){ - result = token->start; + result = token->pos; } else{ result = buffer_size; @@ -845,20 +839,20 @@ boundary_token(Application_Links *app, Buffer_ID buffer, Side side, Scan_Directi case Scan_Backward: { if (tokens.count > 0){ - Token *token = get_first_token_from_pos(tokens, pos); + Token *token = token_from_pos(&tokens, pos); if (side == Side_Min){ if (token == 0){ token = tokens.tokens + tokens.count - 1; - result = token->start; + result = token->pos; } else{ - if (token->start < pos){ - result = token->start; + if (token->pos < pos){ + result = token->pos; } else{ token -= 1; if (token >= tokens.tokens){ - result = token->start; + result = token->pos; } else{ result = 0; @@ -869,15 +863,15 @@ boundary_token(Application_Links *app, Buffer_ID buffer, Side side, Scan_Directi else{ if (token == 0){ token = tokens.tokens + tokens.count - 1; - result = token->start + token->size; + result = token->pos + token->size; } else{ token -= 1; - if (token >= tokens.tokens && token->start + token->size == pos){ + if (token >= tokens.tokens && token->pos + token->size == pos){ token -= 1; } if (token >= tokens.tokens){ - result = token->start + token->size; + result = token->pos + token->size; } else{ result = 0; @@ -891,7 +885,6 @@ boundary_token(Application_Links *app, Buffer_ID buffer, Side side, Scan_Directi }break; } } -#endif return(result); } @@ -1874,19 +1867,6 @@ try_buffer_kill(Application_Links *app, Buffer_ID buffer, View_ID gui_view_id, B //////////////////////////////// -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); - Token_Array *ptr = scope_attachment(app, scope, attachment_tokens, Token_Array); - if (ptr != 0){ - result = *ptr; - } - return(result); -} - -//////////////////////////////// - internal String_Const_u8 get_query_string(Application_Links *app, char *query_str, u8 *string_space, i32 space_size){ Query_Bar bar; diff --git a/4coder_scope_commands.cpp b/4coder_scope_commands.cpp index 8ab99ba0..a695c9bd 100644 --- a/4coder_scope_commands.cpp +++ b/4coder_scope_commands.cpp @@ -37,245 +37,216 @@ find_scope_get_token_type(Find_Scope_Flag flags, Token_Base_Kind kind){ static b32 find_scope_top(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 flags, i64 *end_pos_out){ b32 success = false; - NotImplemented; -#if 0 - Cpp_Get_Token_Result get_result = {}; - i32 position = 0; - if (get_token_from_pos(app, buffer, start_pos, &get_result)){ - i32 token_index = get_result.token_index; + Token_Array array = get_token_array_from_buffer(app, buffer); + if (array.tokens != 0){ + i64 position = 0; + i64 token_index = token_index_from_pos(&array, start_pos); + Token_Iterator_Array it = token_iterator_index(buffer, &array, token_index); + b32 good_status = true; if (HasFlag(flags, FindScope_Parent)){ - --token_index; - if (get_result.in_whitespace_after_token){ - ++token_index; - } + good_status = token_it_dec(&it); } - if (token_index >= 0){ - Token_Range token_range = buffer_get_token_range(app, buffer); - if (token_range.first != 0){ - Token_Iterator token_it = make_token_iterator(token_range, token_index); - i32 nest_level = 0; - for (Token *token = token_iterator_current(&token_it); - token != 0; - token = token_iterator_goto_prev(&token_it)){ - Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->type); - switch (type){ - case FindScopeTokenType_Open: - { - if (nest_level == 0){ - success = true; - position = token->start; - if (flags & FindScope_EndOfToken){ - position += token->size; - } - goto finished; - } - else{ - --nest_level; - } - }break; - case FindScopeTokenType_Close: - { - ++nest_level; - }break; + i32 nest_level = 0; + for (;good_status;){ + Token *token = token_it_read(&it); + Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->kind); + switch (type){ + case FindScopeTokenType_Open: + { + if (nest_level == 0){ + success = true; + position = token->pos; + if (HasFlag(flags, FindScope_EndOfToken)){ + position += token->size; + } + goto finished; } - } + else{ + --nest_level; + } + }break; + case FindScopeTokenType_Close: + { + ++nest_level; + }break; } + good_status = token_it_dec(&it); } + finished:; + *end_pos_out = start_pos; } - finished:; - *end_pos_out = position; -#endif return(success); } static b32 find_scope_bottom(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 flags, i64 *end_pos_out){ b32 success = false; -#if 0 - Cpp_Get_Token_Result get_result = {}; - i32 position = 0; - if (get_token_from_pos(app, buffer, start_pos, &get_result)){ - i32 token_index = get_result.token_index + 1; + Token_Array array = get_token_array_from_buffer(app, buffer); + if (array.tokens != 0){ + i64 position = 0; + i64 token_index = token_index_from_pos(&array, start_pos); + Token_Iterator_Array it = token_iterator_index(buffer, &array, token_index); + token_it_inc(&it); if (HasFlag(flags, FindScope_Parent)){ - --token_index; - if (get_result.in_whitespace_after_token){ - ++token_index; - } + token_it_dec(&it); } - if (token_index >= 0){ - Token_Range token_range = buffer_get_token_range(app, buffer); - if (token_range.first != 0){ - Token_Iterator token_it = make_token_iterator(token_range, token_index); - i32 nest_level = 0; - for (Token *token = token_iterator_current(&token_it); - token != 0; - token = token_iterator_goto_next(&token_it)){ - Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->type); - switch (type){ - case FindScopeTokenType_Open: - { - ++nest_level; - }break; - case FindScopeTokenType_Close: - { - if (nest_level == 0){ - success = true; - position = token->start; - if (flags & FindScope_EndOfToken){ - position += token->size; - } - goto finished; - } - else{ - --nest_level; - } - }break; + b32 good_status = true; + i32 nest_level = 0; + for (;good_status;){ + Token *token = token_it_read(&it); + Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->kind); + switch (type){ + case FindScopeTokenType_Open: + { + ++nest_level; + }break; + case FindScopeTokenType_Close: + { + if (nest_level == 0){ + success = true; + position = token->pos; + if (HasFlag(flags, FindScope_EndOfToken)){ + position += token->size; + } + goto finished; } - } + else{ + --nest_level; + } + }break; } + good_status = token_it_inc(&it); } + finished:; + *end_pos_out = start_pos; } - finished:; - *end_pos_out = position; -#endif return(success); } static b32 find_next_scope(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 flags, i64 *end_pos_out){ b32 success = false; - NotImplemented; -#if 0 - Cpp_Get_Token_Result get_result = {}; - i64 position = 0; - if (get_token_from_pos(app, buffer, start_pos, &get_result)){ - i32 token_index = get_result.token_index + 1; - if (token_index >= 0){ - Token_Range token_range = buffer_get_token_range(app, buffer); - if (token_range.first != 0){ - Token_Iterator token_it = make_token_iterator(token_range, token_index); - if (HasFlag(flags, FindScope_NextSibling)){ - i32 nest_level = 1; - for (Token *token = token_iterator_current(&token_it); - token != 0; - token = token_iterator_goto_next(&token_it)){ - Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->type); - switch (type){ - case FindScopeTokenType_Open: - { - if (nest_level == 0){ - success = 1; - position = token->start; - if (flags & FindScope_EndOfToken){ - position += token->size; - } - goto finished; - } - else{ - ++nest_level; - } - }break; - case FindScopeTokenType_Close: - { - --nest_level; - if (nest_level == -1){ - position = start_pos; - goto finished; - } - }break; - } - } - } - else{ - for (Token *token = token_iterator_current(&token_it); - token != 0; - token = token_iterator_goto_next(&token_it)){ - Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->type); - if (type == FindScopeTokenType_Open){ - success = 1; - position = token->start; - if (flags & FindScope_EndOfToken){ + Token_Array array = get_token_array_from_buffer(app, buffer); + if (array.tokens != 0){ + i64 position = 0; + i64 token_index = token_index_from_pos(&array, start_pos); + Token_Iterator_Array it = token_iterator_index(buffer, &array, token_index); + token_it_inc(&it); + if (HasFlag(flags, FindScope_NextSibling)){ + b32 good_status = true; + i32 nest_level = 1; + for (;good_status;){ + Token *token = token_it_read(&it); + Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->kind); + switch (type){ + case FindScopeTokenType_Open: + { + if (nest_level == 0){ + success = true; + position = token->pos; + if (HasFlag(flags, FindScope_EndOfToken)){ position += token->size; } goto finished; } - } + else{ + ++nest_level; + } + }break; + case FindScopeTokenType_Close: + { + --nest_level; + if (nest_level == -1){ + position = start_pos; + goto finished; + } + }break; } + good_status = token_it_inc(&it); } } + else{ + b32 good_status = true; + for (;good_status;){ + Token *token = token_it_read(&it); + Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->kind); + if (type == FindScopeTokenType_Open){ + success = true; + position = token->pos; + if (flags & FindScope_EndOfToken){ + position += token->size; + } + goto finished; + } + good_status = token_it_inc(&it); + } + } + finished:; + *end_pos_out = start_pos; } - finished:; - *end_pos_out = position; -#endif return(success); } static b32 find_prev_scope(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 flags, i64 *end_pos_out){ b32 success = false; - NotImplemented; -#if 0 - Cpp_Get_Token_Result get_result = {}; - i64 position = 0; - if (get_token_from_pos(app, buffer, start_pos, &get_result)){ - i32 token_index = get_result.token_index - 1; - if (token_index >= 0){ - Token_Range token_range = buffer_get_token_range(app, buffer); - if (token_range.first != 0){ - Token_Iterator token_it = make_token_iterator(token_range, token_index); - if (flags & FindScope_NextSibling){ - i32 nest_level = -1; - for (Token *token = token_iterator_current(&token_it); - token != 0; - token = token_iterator_goto_prev(&token_it)){ - Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->type); - switch (type){ - case FindScopeTokenType_Open: - { - if (nest_level == -1){ - position = start_pos; - goto finished; - } - else if (nest_level == 0){ - success = true; - position = token->start; - if (flags & FindScope_EndOfToken){ - position += token->size; - } - goto finished; - } - else{ - --nest_level; - } - }break; - case FindScopeTokenType_Close: - { - ++nest_level; - }break; + Token_Array array = get_token_array_from_buffer(app, buffer); + if (array.tokens != 0){ + i64 position = 0; + i64 token_index = token_index_from_pos(&array, start_pos); + Token_Iterator_Array it = token_iterator_index(buffer, &array, token_index); + if (HasFlag(flags, FindScope_NextSibling)){ + b32 status_good = token_it_dec(&it); + i32 nest_level = -1; + for (;status_good;){ + Token *token = token_it_read(&it); + Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->kind); + switch (type){ + case FindScopeTokenType_Open: + { + if (nest_level == -1){ + position = start_pos; + goto finished; } - } - } - else{ - for (Token *token = token_iterator_current(&token_it); - token != 0; - token = token_iterator_goto_prev(&token_it)){ - Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->type); - if (type == FindScopeTokenType_Open){ + else if (nest_level == 0){ success = true; - position = token->start; - if (flags & FindScope_EndOfToken){ + position = token->pos; + if (HasFlag(flags, FindScope_EndOfToken)){ position += token->size; } goto finished; } - } + else{ + --nest_level; + } + }break; + case FindScopeTokenType_Close: + { + ++nest_level; + }break; } + status_good = token_it_dec(&it); } } + else{ + b32 status_good = token_it_dec(&it); + for (;status_good;){ + Token *token = token_it_read(&it); + Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->kind); + if (type == FindScopeTokenType_Open){ + success = true; + position = token->pos; + if (HasFlag(flags, FindScope_EndOfToken)){ + position += token->size; + } + goto finished; + } + status_good = token_it_dec(&it); + } + } + finished:; + *end_pos_out = position; } - finished:; - *end_pos_out = position; -#endif return(success); } diff --git a/4coder_table.cpp b/4coder_table.cpp index a946cee0..82173b5a 100644 --- a/4coder_table.cpp +++ b/4coder_table.cpp @@ -330,6 +330,8 @@ internal void table_clear(Table_u32_u16 *table){ block_zero_dynamic_array(table->keys, table->slot_count); block_zero_dynamic_array(table->vals, table->slot_count); + table->used_count = 0; + table->dirty_count = 0; } //////////////////////////////// @@ -487,8 +489,11 @@ table_erase(Table_Data_u64 *table, Data key){ internal void table_clear(Table_Data_u64 *table){ + block_zero_dynamic_array(table->hashes, table->slot_count); block_zero_dynamic_array(table->keys, table->slot_count); block_zero_dynamic_array(table->vals, table->slot_count); + table->used_count = 0; + table->dirty_count = 0; } //////////////////////////////// @@ -649,6 +654,8 @@ internal void table_clear(Table_u64_Data *table){ block_zero_dynamic_array(table->keys, table->slot_count); block_zero_dynamic_array(table->vals, table->slot_count); + table->used_count = 0; + table->dirty_count = 0; } //////////////////////////////// @@ -801,8 +808,11 @@ table_erase(Table_Data_Data *table, Data key){ internal void table_clear(Table_Data_Data *table){ + block_zero_dynamic_array(table->hashes, table->slot_count); block_zero_dynamic_array(table->keys, table->slot_count); block_zero_dynamic_array(table->vals, table->slot_count); + table->used_count = 0; + table->dirty_count = 0; } // BOTTOM diff --git a/4coder_token.cpp b/4coder_token.cpp index 3c79ac1a..c467a268 100644 --- a/4coder_token.cpp +++ b/4coder_token.cpp @@ -81,6 +81,18 @@ token_index_from_pos(Token_Array *tokens, u64 pos){ return(token_index_from_pos(tokens->tokens, tokens->count, pos)); } +internal Token* +token_from_pos(Token *tokens, i64 count, i64 pos){ + i64 index = token_index_from_pos(tokens, count, pos); + return(tokens + index); +} + +internal Token* +token_from_pos(Token_Array *tokens, u64 pos){ + i64 index = token_index_from_pos(tokens, pos); + return(tokens->tokens + index); +} + //////////////////////////////// internal Token_Iterator_Array @@ -96,8 +108,8 @@ token_iterator_index(u64 user_id, Token *tokens, i64 count, i64 token_index){ } internal Token_Iterator_Array -token_iterator_index(u64 user_id, Token_Array tokens, i64 token_index){ - return(token_iterator_index(user_id, tokens.tokens, tokens.count, token_index)); +token_iterator_index(u64 user_id, Token_Array *tokens, i64 token_index){ + return(token_iterator_index(user_id, tokens->tokens, tokens->count, token_index)); } internal Token_Iterator_Array @@ -106,8 +118,8 @@ token_iterator(u64 user_id, Token *tokens, i64 count, Token *token){ } internal Token_Iterator_Array -token_iterator(u64 user_id, Token_Array tokens, Token *token){ - return(token_iterator_index(user_id, tokens.tokens, tokens.count, (i64)(token - tokens.tokens))); +token_iterator(u64 user_id, Token_Array *tokens, Token *token){ + return(token_iterator_index(user_id, tokens->tokens, tokens->count, (i64)(token - tokens->tokens))); } internal Token_Iterator_Array @@ -116,8 +128,8 @@ token_iterator(u64 user_id, Token *tokens, i64 count){ } internal Token_Iterator_Array -token_iterator(u64 user_id, Token_Array tokens){ - return(token_iterator_index(user_id, tokens.tokens, tokens.count, 0)); +token_iterator(u64 user_id, Token_Array *tokens){ + return(token_iterator_index(user_id, tokens->tokens, tokens->count, 0)); } internal Token_Iterator_Array @@ -127,9 +139,9 @@ token_iterator_pos(u64 user_id, Token *tokens, i64 count, i64 pos){ } internal Token_Iterator_Array -token_iterator_pos(u64 user_id, Token_Array tokens, i64 pos){ - i64 index = token_index_from_pos(tokens.tokens, tokens.count, pos); - return(token_iterator_index(user_id, tokens.tokens, tokens.count, index)); +token_iterator_pos(u64 user_id, Token_Array *tokens, i64 pos){ + i64 index = token_index_from_pos(tokens->tokens, tokens->count, pos); + return(token_iterator_index(user_id, tokens->tokens, tokens->count, index)); } internal Token* diff --git a/4ed_buffer.cpp b/4ed_buffer.cpp index b8152b48..0ab77569 100644 --- a/4ed_buffer.cpp +++ b/4ed_buffer.cpp @@ -435,8 +435,8 @@ buffer_remeasure_starts(Arena *scratch, Gap_Buffer *buffer, Interval_i64 old_lin for (i64 i = old_line_indexes.one_past_last; i < old_line_start_count; i += 1, line_start_ptr += 1){ *line_start_ptr += text_shift; } - block_copy_dynamic_array(buffer->line_starts + old_line_indexes.one_past_last, - buffer->line_starts + new_line_indexes_opl, + block_copy_dynamic_array(buffer->line_starts + new_line_indexes_opl, + buffer->line_starts + old_line_indexes.one_past_last, buffer->line_start_count - old_line_indexes.one_past_last); i64 first_pos = buffer->line_starts[old_line_indexes.first]; diff --git a/4ed_file.h b/4ed_file.h index 2b2e976d..3141728c 100644 --- a/4ed_file.h +++ b/4ed_file.h @@ -24,7 +24,7 @@ struct File_Edit_Positions{ i64 cursor_pos; }; -// TODO(allen): do(replace Text_Effect with markers over time) +// TODO(allen): do(replace Text_Effect with IM rendering over time) struct Text_Effect{ i64 start; i64 end;