From ef571b7f6428a01241c4edf8d3386ad2cf202668 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Tue, 18 Jun 2019 15:56:09 -0700 Subject: [PATCH] Correct naming scheme --- 4coder_api_transition_30_31.cpp | 2 +- 4coder_base_commands.cpp | 18 +++++++++--------- 4coder_build_commands.cpp | 6 +++--- 4coder_combined_write_commands.cpp | 4 ++-- 4coder_default_framework.cpp | 2 +- 4coder_default_hooks.cpp | 6 +++--- 4coder_experiments.cpp | 2 +- 4coder_fancy.cpp | 2 +- 4coder_helper.cpp | 2 +- 4coder_insertion.cpp | 2 +- 4coder_lists.cpp | 10 +++++----- 4coder_metadata_generator.cpp | 2 +- 4coder_miblo_numbers.cpp | 4 ++-- 4coder_project_commands.cpp | 26 +++++++++++++------------- 4coder_scope_commands.cpp | 14 +++++++------- 4coder_search.cpp | 18 +++++++++--------- 4coder_stringf.cpp | 18 +++++++++--------- 4ed.cpp | 3 +-- 18 files changed, 70 insertions(+), 71 deletions(-) diff --git a/4coder_api_transition_30_31.cpp b/4coder_api_transition_30_31.cpp index 0a4cee45..09d3fd38 100644 --- a/4coder_api_transition_30_31.cpp +++ b/4coder_api_transition_30_31.cpp @@ -612,7 +612,7 @@ directory_cd(Application_Links *app, char *dir, i32 *len, i32 capacity, char *re } } else{ - new_directory = string_u8_pushf(scratch, "%.*s/%.*s", + new_directory = push_u8_stringf(scratch, "%.*s/%.*s", string_expand(directory), string_expand(relative_path)); if (file_exists(app, (char*)new_directory.str, (i32)new_directory.size)){ diff --git a/4coder_base_commands.cpp b/4coder_base_commands.cpp index a238ef96..867d3aa7 100644 --- a/4coder_base_commands.cpp +++ b/4coder_base_commands.cpp @@ -1270,7 +1270,7 @@ CUSTOM_DOC("Queries the user for two strings, and replaces all occurences of the static void query_replace_base(Application_Links *app, View_ID view, Buffer_ID buffer_id, i32 pos, String_Const_u8 r, String_Const_u8 w){ i32 new_pos = 0; - buffer_seek_string_forward(app, buffer_id, pos, 0, r, &new_pos); + buffer_seek_string_forward(app, buffer_id, pos - 1, 0, r, &new_pos); Managed_Scope view_scope = 0; view_get_managed_scope(app, view, &view_scope); @@ -1469,7 +1469,7 @@ CUSTOM_DOC("Deletes the file of the current buffer if 4coder has the appropriate String_Const_u8 file_name = push_buffer_file_name(app, scratch, buffer); if (file_name.size > 0){ Query_Bar bar = {}; - bar.prompt = string_u8_pushf(scratch, "Delete '%.*s' (Y)es, (n)o", string_expand(file_name)); + bar.prompt = push_u8_stringf(scratch, "Delete '%.*s' (Y)es, (n)o", string_expand(file_name)); if (start_query_bar(app, &bar, 0) != 0){ b32 cancelled = false; for (;!cancelled;){ @@ -1513,7 +1513,7 @@ CUSTOM_DOC("Queries the user for a file name and saves the contents of the curre // Query the user u8 name_space[4096]; Query_Bar bar = {}; - bar.prompt = string_u8_pushf(scratch, "Save '%.*s' to: ", string_expand(buffer_name)); + bar.prompt = push_u8_stringf(scratch, "Save '%.*s' to: ", string_expand(buffer_name)); bar.string = SCu8(name_space, (umem)0); bar.string_capacity = sizeof(name_space); if (query_user_string(app, &bar)){ @@ -1553,7 +1553,7 @@ CUSTOM_DOC("Queries the user for a new name and renames the file of the current String_Const_u8 front = string_front_of_path(file_name); u8 name_space[4096]; Query_Bar bar = {}; - bar.prompt = string_u8_pushf(scratch, "Rename '%.*s' to: ", string_expand(front)); + bar.prompt = push_u8_stringf(scratch, "Rename '%.*s' to: ", string_expand(front)); bar.string = SCu8(name_space, (umem)0); bar.string_capacity = sizeof(name_space); if (query_user_string(app, &bar)){ @@ -1589,14 +1589,14 @@ CUSTOM_DOC("Queries the user for a name and creates a new directory with the giv // Query the user u8 name_space[4096]; Query_Bar bar = {}; - bar.prompt = string_u8_pushf(scratch, "Make directory at '%.*s': ", string_expand(hot)); + bar.prompt = push_u8_stringf(scratch, "Make directory at '%.*s': ", string_expand(hot)); bar.string = SCu8(name_space, (umem)0); bar.string_capacity = sizeof(name_space); if (!query_user_string(app, &bar)) return; if (bar.string.size == 0) return; - String_Const_u8 cmd = string_u8_pushf(scratch, "mkdir %.*s", string_expand(bar.string)); + String_Const_u8 cmd = push_u8_stringf(scratch, "mkdir %.*s", string_expand(bar.string)); exec_system_command(app, 0, buffer_identifier(0), hot, cmd, 0); } @@ -1639,7 +1639,7 @@ CUSTOM_DOC("Create a copy of the line on which the cursor sits.") i32 line = get_line_number_from_pos(app, buffer, pos); Scratch_Block scratch(app); String_Const_u8 s = push_buffer_line(app, scratch, buffer, line); - s = string_u8_pushf(scratch, "%.*s\n", string_expand(s)); + s = push_u8_stringf(scratch, "%.*s\n", string_expand(s)); pos = get_line_side_pos(app, buffer, line, Side_Min); buffer_replace_range(app, buffer, make_range(pos), s); } @@ -1701,7 +1701,7 @@ get_cpp_matching_file(Application_Links *app, Buffer_ID buffer, Buffer_ID *buffe for (i32 i = 0; i < new_extensions_count; i += 1){ Temp_Memory temp = begin_temp(scratch); String_Const_u8 new_extension = new_extensions[i]; - String_Const_u8 new_file_name = string_u8_pushf(scratch, "%.*s.%.*s", string_expand(file_without_extension), string_expand(new_extension)); + String_Const_u8 new_file_name = push_u8_stringf(scratch, "%.*s.%.*s", string_expand(file_without_extension), string_expand(new_extension)); if (open_file(app, buffer_out, new_file_name, false, true)){ result = true; break; @@ -1740,7 +1740,7 @@ CUSTOM_DOC("Reads a filename from surrounding '\"' characters and attempts to op path = string_chop(path, 1); } - String_Const_u8 new_file_name = string_u8_pushf(scratch, "%.*s/%.*s", string_expand(path), string_expand(quoted_name)); + String_Const_u8 new_file_name = push_u8_stringf(scratch, "%.*s/%.*s", string_expand(path), string_expand(quoted_name)); view = get_next_view_looped_primary_panels(app, view, AccessAll); if (view != 0){ diff --git a/4coder_build_commands.cpp b/4coder_build_commands.cpp index 4f6b066d..b7bf0035 100644 --- a/4coder_build_commands.cpp +++ b/4coder_build_commands.cpp @@ -44,7 +44,7 @@ global String_Const_u8 standard_build_cmd_string_array[] = { static String_Const_u8 push_fallback_command(Arena *arena, String_Const_u8 file_name){ - return(string_u8_pushf(arena, "echo could not find %.*s", string_expand(file_name))); + return(push_u8_stringf(arena, "echo could not find %.*s", string_expand(file_name))); } static String_Const_u8 @@ -83,7 +83,7 @@ standard_search_and_build_from_dir(Application_Links *app, View_ID view, String_ // NOTE(allen): Build String_Const_u8 path = string_remove_last_folder(full_file_path); #if OS_WINDOWS - String_Const_u8 command = string_u8_pushf(scratch, "%.*s/%.*s", + String_Const_u8 command = push_u8_stringf(scratch, "%.*s/%.*s", string_expand(path), string_expand(cmd_string)); #elif OS_LINUX || OS_MAC @@ -95,7 +95,7 @@ standard_search_and_build_from_dir(Application_Links *app, View_ID view, String_ save_all_dirty_buffers(app); } standard_build_exec_command(app, view, path, command); - print_message(app, string_u8_pushf(scratch, "Building with: %.*s\n", + print_message(app, push_u8_stringf(scratch, "Building with: %.*s\n", string_expand(full_file_path))); } diff --git a/4coder_combined_write_commands.cpp b/4coder_combined_write_commands.cpp index 57f2e038..4c73fd45 100644 --- a/4coder_combined_write_commands.cpp +++ b/4coder_combined_write_commands.cpp @@ -27,10 +27,10 @@ write_named_comment_string(Application_Links *app, char *type_string){ String_Const_u8 name = global_config.user_name; String_Const_u8 str = {}; if (name.size > 0){ - str = string_u8_pushf(scratch, "// %s(%.*s): ", type_string, string_expand(name)); + str = push_u8_stringf(scratch, "// %s(%.*s): ", type_string, string_expand(name)); } else{ - str = string_u8_pushf(scratch, "// %s: ", type_string); + str = push_u8_stringf(scratch, "// %s: ", type_string); } write_string(app, str); } diff --git a/4coder_default_framework.cpp b/4coder_default_framework.cpp index 38d488ea..4605d49b 100644 --- a/4coder_default_framework.cpp +++ b/4coder_default_framework.cpp @@ -411,7 +411,7 @@ default_4coder_initialize(Application_Links *app, char **command_line_files, i32 for (i32 i = 0; i < file_count; i += 1){ Temp_Memory temp2 = begin_temp(scratch); String_Const_u8 input_name = SCu8(command_line_files[i]); - String_Const_u8 file_name = string_u8_pushf(scratch, "%.*s/%.*s", string_expand(hot_directory), string_expand(input_name)); + String_Const_u8 file_name = push_u8_stringf(scratch, "%.*s/%.*s", string_expand(hot_directory), string_expand(input_name)); Buffer_ID ignore = 0; if (!create_buffer(app, file_name, BufferCreate_NeverNew|BufferCreate_MustAttachToFile, &ignore)){ create_buffer(app, input_name, 0, &ignore); diff --git a/4coder_default_hooks.cpp b/4coder_default_hooks.cpp index 9295879a..0a657a4d 100644 --- a/4coder_default_hooks.cpp +++ b/4coder_default_hooks.cpp @@ -1037,12 +1037,12 @@ BUFFER_NAME_RESOLVER_SIG(default_buffer_name_resolution){ uniqueifier = SCu8(start, end); if (past_the_end){ - uniqueifier = string_u8_pushf(scratch, "%.*s~%d", + uniqueifier = push_u8_stringf(scratch, "%.*s~%d", string_expand(uniqueifier), i); } } else{ - uniqueifier = string_u8_pushf(scratch, "%d", i); + uniqueifier = push_u8_stringf(scratch, "%d", i); } String_u8 builder = Su8(conflict->unique_name_in_out, @@ -1275,7 +1275,7 @@ FILE_EDIT_FINISHED_SIG(default_file_edit_finished){ OPEN_FILE_HOOK_SIG(default_end_file){ Scratch_Block scratch(app); String_Const_u8 buffer_name = push_buffer_unique_name(app, scratch, buffer_id); - String_Const_u8 str = string_u8_pushf(scratch, "Ending file: %.*s\n", + String_Const_u8 str = push_u8_stringf(scratch, "Ending file: %.*s\n", string_expand(buffer_name)); print_message(app, str); // no meaning for return diff --git a/4coder_experiments.cpp b/4coder_experiments.cpp index 569311a2..f9aa502e 100644 --- a/4coder_experiments.cpp +++ b/4coder_experiments.cpp @@ -260,7 +260,7 @@ CUSTOM_COMMAND_SIG(multi_paste){ String_Const_u8 string = {}; clipboard_index(app, 0, paste_index, scratch, &string); - String_Const_u8 insert_string = string_u8_pushf(scratch, "\n%.*s", string_expand(string)); + String_Const_u8 insert_string = push_u8_stringf(scratch, "\n%.*s", string_expand(string)); Buffer_ID buffer = 0; view_get_buffer(app, view, AccessOpen, &buffer); diff --git a/4coder_fancy.cpp b/4coder_fancy.cpp index d26350db..98b92870 100644 --- a/4coder_fancy.cpp +++ b/4coder_fancy.cpp @@ -128,7 +128,7 @@ push_fancy_string(Arena *arena, String_Const_u8 value){ static Fancy_String* push_fancy_stringfv(Arena *arena, Fancy_String_List *list, Fancy_Color fore, Fancy_Color back, char *format, va_list args){ - String_Const_u8 str = string_u8_pushfv(arena, format, args); + String_Const_u8 str = push_u8_stringf(arena, format, args); Fancy_String *result = 0; if (str.size > 0){ result = push_fancy_string(arena, list, fore, back, str); diff --git a/4coder_helper.cpp b/4coder_helper.cpp index d05c1759..4eae5d04 100644 --- a/4coder_helper.cpp +++ b/4coder_helper.cpp @@ -2116,7 +2116,7 @@ push_file_search_up_path(Application_Links *app, Arena *arena, String_Const_u8 s if (character_is_slash(string_get_character(path, path.size - 1))){ path = string_chop(path, 1); } - String_Const_u8 full_path = string_u8_pushf(arena, "%.*s/%.*s", + String_Const_u8 full_path = push_u8_stringf(arena, "%.*s/%.*s", string_expand(path), string_expand(file_name)); if (file_exists(app, full_path)){ diff --git a/4coder_insertion.cpp b/4coder_insertion.cpp index 121c7c3f..af7a8059 100644 --- a/4coder_insertion.cpp +++ b/4coder_insertion.cpp @@ -88,7 +88,7 @@ insertf(Buffer_Insertion *insertion, char *format, ...){ Temp_Memory temp = begin_temp(scratch); va_list args; va_start(args, format); - String_Const_u8 string = string_u8_pushfv(scratch, format, args); + String_Const_u8 string = push_u8_stringf(scratch, format, args); va_end(args); insert_string(insertion, string); end_temp(temp); diff --git a/4coder_lists.cpp b/4coder_lists.cpp index 30f42418..d1a235fb 100644 --- a/4coder_lists.cpp +++ b/4coder_lists.cpp @@ -552,7 +552,7 @@ generate_hot_directory_file_list(Application_Links *app, Lister *lister){ Temp_Memory temp = begin_temp(&lister->arena); String_Const_u8 hot = push_hot_directory(app, &lister->arena); if (!character_is_slash(string_get_character(hot, hot.size - 1))){ - hot = string_u8_pushf(&lister->arena, "%.*s/", string_expand(hot)); + hot = push_u8_stringf(&lister->arena, "%.*s/", string_expand(hot)); } lister_set_text_field(lister, hot); lister_set_key(lister, string_front_of_path(hot)); @@ -574,7 +574,7 @@ generate_hot_directory_file_list(Application_Links *app, Lister *lister){ info < one_past_last; info += 1){ if (!info->folder) continue; - String_Const_u8 file_name = string_u8_pushf(&lister->arena, "%.*s/", info->filename_len, info->filename); + String_Const_u8 file_name = push_u8_stringf(&lister->arena, "%.*s/", info->filename_len, info->filename); lister_add_item(lister, lister_prealloced(file_name), empty_string_prealloced, file_name.str, 0); } @@ -610,7 +610,7 @@ generate_hot_directory_file_list(Application_Links *app, Lister *lister){ case DirtyState_UnsavedChangesAndUnloadedChanges: status_flag = " *!"; break; } } - String_Const_u8 status = string_u8_pushf(&lister->arena, "%s%s", is_loaded, status_flag); + String_Const_u8 status = push_u8_stringf(&lister->arena, "%s%s", is_loaded, status_flag); lister_add_item(lister, lister_prealloced(file_name), lister_prealloced(status), file_name.str, 0); } } @@ -670,7 +670,7 @@ activate_confirm_kill(Application_Links *app, Heap *heap, View_ID view, Lister_S buffer_kill(app, buffer_id, BufferKill_AlwaysKill, 0); } else{ - String_Const_u8 str = string_u8_pushf(scratch, "Did not close '%.*s' because it did not successfully save.", + String_Const_u8 str = push_u8_stringf(scratch, "Did not close '%.*s' because it did not successfully save.", string_expand(file_name)); print_message(app, str); } @@ -795,7 +795,7 @@ activate_open_or_new__generic(Application_Links *app, View_ID view, if (character_is_slash(string_get_character(path, path.size - 1))){ path = string_chop(path, 1); } - full_file_name = string_u8_pushf(scratch, "%.*s/%.*s", string_expand(path), string_expand(file_name)); + full_file_name = push_u8_stringf(scratch, "%.*s/%.*s", string_expand(path), string_expand(file_name)); if (is_folder){ set_hot_directory(app, full_file_name); result = ListerActivation_ContinueAndRefresh; diff --git a/4coder_metadata_generator.cpp b/4coder_metadata_generator.cpp index a6361464..28e81810 100644 --- a/4coder_metadata_generator.cpp +++ b/4coder_metadata_generator.cpp @@ -319,7 +319,7 @@ require_key_identifier(Reader *reader, char *str, int32_t *opt_pos_out = 0){ if (!success){ Temp_Memory temp = begin_temp(reader->error_arena); - String_Const_char error_string = string_pushf(reader->error_arena, "expected to find '%s'", str); + String_Const_char error_string = push_stringf(reader->error_arena, "expected to find '%s'", str); error(reader, token.start, error_string.str); end_temp(temp); } diff --git a/4coder_miblo_numbers.cpp b/4coder_miblo_numbers.cpp index 29384042..5b76ca05 100644 --- a/4coder_miblo_numbers.cpp +++ b/4coder_miblo_numbers.cpp @@ -104,7 +104,7 @@ CUSTOM_DOC("Increment an integer under the cursor by one.") Miblo_Number_Info number = {}; if (get_numeric_at_cursor(app, buffer, pos, &number)){ Scratch_Block scratch(app); - String_Const_u8 str = string_u8_pushf(scratch, "%d", number.x + 1); + String_Const_u8 str = push_u8_stringf(scratch, "%d", number.x + 1); buffer_replace_range(app, buffer, number.range, str); view_set_cursor(app, view, seek_pos(number.start + (i32)str.size - 1), true); } @@ -122,7 +122,7 @@ CUSTOM_DOC("Decrement an integer under the cursor by one.") Miblo_Number_Info number = {}; if (get_numeric_at_cursor(app, buffer, pos, &number)){ Scratch_Block scratch(app); - String_Const_u8 str = string_u8_pushf(scratch, "%d", number.x - 1); + String_Const_u8 str = push_u8_stringf(scratch, "%d", number.x - 1); buffer_replace_range(app, buffer, number.range, str); view_set_cursor(app, view, seek_pos(number.start + (i32)str.size - 1), true); } diff --git a/4coder_project_commands.cpp b/4coder_project_commands.cpp index 901edaa1..a23bec13 100644 --- a/4coder_project_commands.cpp +++ b/4coder_project_commands.cpp @@ -15,7 +15,7 @@ get_pattern_array_from_string_array(Arena *arena, String_Const_u8_Array list){ array.count = list.count; array.patterns = push_array(arena, Project_File_Pattern, list.count); for (i32 i = 0; i < list.count; ++i){ - String_Const_u8 str = string_u8_pushf(arena, "*.%.*s", string_expand(list.strings[i])); + String_Const_u8 str = push_u8_stringf(arena, "*.%.*s", string_expand(list.strings[i])); array.patterns[i].absolutes = string_split_wildcards(arena, str); } return(array); @@ -107,7 +107,7 @@ open_all_files_in_directory_pattern_match__recursive(Application_Links *app, continue; } - String_Const_u8 new_path = string_u8_pushf(scratch, "%.*s%.*s/", + String_Const_u8 new_path = push_u8_stringf(scratch, "%.*s%.*s/", string_expand(path), string_expand(file_name)); open_all_files_in_directory_pattern_match__recursive(app, new_path, @@ -121,7 +121,7 @@ open_all_files_in_directory_pattern_match__recursive(Application_Links *app, continue; } - String_Const_u8 full_path = string_u8_pushf(scratch, "%.*s%.*s", + String_Const_u8 full_path = push_u8_stringf(scratch, "%.*s%.*s", string_expand(path), string_expand(file_name)); Buffer_ID ignore = 0; @@ -150,7 +150,7 @@ open_all_files_in_directory_pattern_match(Application_Links *app, Scratch_Block scratch(app); String_Const_u8 directory = dir; if (!character_is_slash(string_get_character(directory, directory.size - 1))){ - directory = string_u8_pushf(scratch, "%.*s/", string_expand(dir)); + directory = push_u8_stringf(scratch, "%.*s/", string_expand(dir)); } open_all_files_in_directory_pattern_match__recursive(app, directory, whitelist, blacklist, flags); } @@ -169,7 +169,7 @@ open_all_files_in_hot_with_extension(Application_Links *app, String_Const_u8_Arr String_Const_u8 hot = push_hot_directory(app, scratch); String_Const_u8 directory = hot; if (!character_is_slash(string_get_character(hot, hot.size - 1))){ - directory = string_u8_pushf(scratch, "%.*s/", string_expand(hot)); + directory = push_u8_stringf(scratch, "%.*s/", string_expand(hot)); } open_all_files_in_directory_with_extension(app, hot, array, flags); } @@ -227,7 +227,7 @@ parse_project__config_data__version_0(Arena *arena, String_Const_u8 file_dir, Co project->fkey_commands[j - 1] = j - 1; block_zero_struct(command); - command->name = string_u8_pushf(arena, "%d", j); + command->name = push_u8_stringf(arena, "%d", j); Config_Compound *compound = 0; if (config_compound_var(parsed, fkey_command_name, j, &compound)){ @@ -758,7 +758,7 @@ set_current_project(Application_Links *app, Project *project, Config *parsed){ // Set window title if (project->name.size > 0){ Temp_Memory temp = begin_temp(scratch); - String_Const_u8 builder = string_u8_pushf(scratch, "4coder project: %.*s", + String_Const_u8 builder = push_u8_stringf(scratch, "4coder project: %.*s", string_expand(project->name)); set_window_title(app, builder); end_temp(temp); @@ -993,21 +993,21 @@ project_is_setup(Application_Links *app, String_Const_u8 script_path, String_Con Project_Setup_Status result = {}; { Scratch_Block scratch(app); - String_Const_u8 bat_path = string_u8_pushf(scratch, "%.*s/%.*s.bat", + String_Const_u8 bat_path = push_u8_stringf(scratch, "%.*s/%.*s.bat", string_expand(script_path), string_expand(script_file)); result.bat_exists = file_exists(app, bat_path); } { Scratch_Block scratch(app); - String_Const_u8 sh_path = string_u8_pushf(scratch, "%.*s/%.*s.sh", + String_Const_u8 sh_path = push_u8_stringf(scratch, "%.*s/%.*s.sh", string_expand(script_path), string_expand(script_file)); result.sh_exists = file_exists(app, sh_path); } { Scratch_Block scratch(app); - String_Const_u8 project_path = string_u8_pushf(scratch, "%.*s/project.4coder", + String_Const_u8 project_path = push_u8_stringf(scratch, "%.*s/project.4coder", string_expand(script_path)); result.sh_exists = file_exists(app, project_path); } @@ -1085,7 +1085,7 @@ project_generate_bat_script(Arena *scratch, String_Const_u8 opts, String_Const_u od = string_mod_replace_character(od, '/', '\\'); bf = string_mod_replace_character(bf, '/', '\\'); - String_Const_u8 file_name = string_u8_pushf(scratch, "%.*s/%.*s.bat", + String_Const_u8 file_name = push_u8_stringf(scratch, "%.*s/%.*s.bat", string_expand(script_path), string_expand(script_file)); @@ -1119,7 +1119,7 @@ project_generate_sh_script(Arena *scratch, String_Const_u8 opts, String_Const_u8 String_Const_u8 od = output_dir; String_Const_u8 bf = binary_file; - String_Const_u8 file_name = string_u8_pushf(scratch, "%.*s/%.*s.sh", + String_Const_u8 file_name = push_u8_stringf(scratch, "%.*s/%.*s.sh", string_expand(script_path), string_expand(script_file)); @@ -1154,7 +1154,7 @@ project_generate_project_4coder_file(Arena *scratch, String_Const_u8 script_path String_Const_u8 bf_win = string_replace(scratch, bf, string_u8_litexpr("/"), string_u8_litexpr("\\")); - String_Const_u8 file_name = string_u8_pushf(scratch, "%.*s/project.4coder", string_expand(script_path)); + String_Const_u8 file_name = push_u8_stringf(scratch, "%.*s/project.4coder", string_expand(script_path)); FILE *out = fopen((char*)file_name.str, "wb"); if (out != 0){ diff --git a/4coder_scope_commands.cpp b/4coder_scope_commands.cpp index 674f8cce..0dbd8fc5 100644 --- a/4coder_scope_commands.cpp +++ b/4coder_scope_commands.cpp @@ -425,17 +425,17 @@ place_begin_and_end_on_own_lines(Application_Links *app, char *begin, char *end) umem max_adjustment = 0; if (min_line_blank){ - begin_str = string_u8_pushf(scratch, "\n%s", begin); + begin_str = push_u8_stringf(scratch, "\n%s", begin); min_adjustment += 1; } else{ - begin_str = string_u8_pushf(scratch, "%s\n", begin); + begin_str = push_u8_stringf(scratch, "%s\n", begin); } if (max_line_blank){ - end_str = string_u8_pushf(scratch, "%s\n", end); + end_str = push_u8_stringf(scratch, "%s\n", end); } else{ - end_str = string_u8_pushf(scratch, "\n%s", end); + end_str = push_u8_stringf(scratch, "\n%s", end); max_adjustment += 1; } @@ -464,7 +464,7 @@ place_begin_and_end_on_own_lines(Application_Links *app, char *begin, char *end) view_set_mark(app, view, seek_pos(mark_pos)); } else{ - String_Const_u8 str = string_u8_pushf(scratch, "%s\n\n%s", begin, end); + String_Const_u8 str = push_u8_stringf(scratch, "%s\n\n%s", begin, end); buffer_replace_range(app, buffer, range, str); i32 center_pos = range.min + (i32)cstring_length(begin) + 1; view_set_cursor(app, view, seek_pos(center_pos), true); @@ -755,10 +755,10 @@ CUSTOM_DOC("If a scope is currently selected, and a statement or block statement String_Const_u8 edit_str = {}; if (extra_newline){ - edit_str = string_u8_pushf(scratch, "\n%.*s\n", string_expand(string)); + edit_str = push_u8_stringf(scratch, "\n%.*s\n", string_expand(string)); } else{ - edit_str = string_u8_pushf(scratch, "%.*s\n", string_expand(string)); + edit_str = push_u8_stringf(scratch, "%.*s\n", string_expand(string)); } Buffer_Edit edits[2]; diff --git a/4coder_search.cpp b/4coder_search.cpp index 99e682da..c3935c09 100644 --- a/4coder_search.cpp +++ b/4coder_search.cpp @@ -685,15 +685,15 @@ list_type_definition__parameters(Application_Links *app, Heap *heap, String_Cons String_Const_u8 match_strings[9]; i32 i = 0; - match_strings[i++] = (string_u8_pushf(scratch, "struct %.*s{" , string_expand(str))); - match_strings[i++] = (string_u8_pushf(scratch, "struct %.*s\n{", string_expand(str))); - match_strings[i++] = (string_u8_pushf(scratch, "struct %.*s {" , string_expand(str))); - match_strings[i++] = (string_u8_pushf(scratch, "union %.*s{" , string_expand(str))); - match_strings[i++] = (string_u8_pushf(scratch, "union %.*s\n{" , string_expand(str))); - match_strings[i++] = (string_u8_pushf(scratch, "union %.*s {" , string_expand(str))); - match_strings[i++] = (string_u8_pushf(scratch, "enum %.*s{" , string_expand(str))); - match_strings[i++] = (string_u8_pushf(scratch, "enum %.*s\n{" , string_expand(str))); - match_strings[i++] = (string_u8_pushf(scratch, "enum %.*s {" , string_expand(str))); + match_strings[i++] = (push_u8_stringf(scratch, "struct %.*s{" , string_expand(str))); + match_strings[i++] = (push_u8_stringf(scratch, "struct %.*s\n{", string_expand(str))); + match_strings[i++] = (push_u8_stringf(scratch, "struct %.*s {" , string_expand(str))); + match_strings[i++] = (push_u8_stringf(scratch, "union %.*s{" , string_expand(str))); + match_strings[i++] = (push_u8_stringf(scratch, "union %.*s\n{" , string_expand(str))); + match_strings[i++] = (push_u8_stringf(scratch, "union %.*s {" , string_expand(str))); + match_strings[i++] = (push_u8_stringf(scratch, "enum %.*s{" , string_expand(str))); + match_strings[i++] = (push_u8_stringf(scratch, "enum %.*s\n{" , string_expand(str))); + match_strings[i++] = (push_u8_stringf(scratch, "enum %.*s {" , string_expand(str))); list__parameters(app, heap, match_strings, ArrayCount(match_strings), 0, default_target_view); diff --git a/4coder_stringf.cpp b/4coder_stringf.cpp index 6d50a361..13df9737 100644 --- a/4coder_stringf.cpp +++ b/4coder_stringf.cpp @@ -8,7 +8,7 @@ #include static String_Const_char -string_pushfv(Arena *arena, char *format, va_list args){ +push_stringfv(Arena *arena, char *format, va_list args){ i32 size = vsnprintf(0, 0, format, args); String_Const_char result = string_const_char_push(arena, size + 1); vsnprintf(result.str, result.size, format, args); @@ -17,29 +17,29 @@ string_pushfv(Arena *arena, char *format, va_list args){ return(result); } static String_Const_char -string_pushf(Arena *arena, char *format, ...){ +push_stringf(Arena *arena, char *format, ...){ va_list args; va_start(args, format); - String_Const_char result = string_pushfv(arena, format, args); + String_Const_char result = push_stringfv(arena, format, args); va_end(args); return(result); } static String_Const_u8 -string_u8_pushfv(Arena *arena, char *format, va_list args){ - return(SCu8(string_pushfv(arena, format, args))); +push_u8_stringfv(Arena *arena, char *format, va_list args){ + return(SCu8(push_stringfv(arena, format, args))); } static String_Const_u8 -string_u8_pushf(Arena *arena, char *format, ...){ +push_u8_stringf(Arena *arena, char *format, ...){ va_list args; va_start(args, format); - String_Const_u8 result = SCu8(string_pushfv(arena, format, args)); + String_Const_u8 result = SCu8(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 = string_pushfv(arena, format, args); + String_Const_char string = push_stringfv(arena, format, args); if (arena->alignment < sizeof(umem)){ push_align(arena, sizeof(umem)); } @@ -54,7 +54,7 @@ string_list_pushf(Arena *arena, List_String_Const_char *list, char *format, ...) } static void string_list_pushfv(Arena *arena, List_String_Const_u8 *list, char *format, va_list args){ - String_Const_u8 string = string_u8_pushfv(arena, format, args); + String_Const_u8 string = push_u8_stringfv(arena, format, args); if (arena->alignment < sizeof(umem)){ push_align(arena, sizeof(umem)); } diff --git a/4ed.cpp b/4ed.cpp index ba258738..f89bb337 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -1087,8 +1087,7 @@ App_Step_Sig(app_step){ if (system->cli_end_update(cli)){ if (file != 0){ - String_Const_u8 str = string_u8_pushf(scratch, "exited with code %d", - cli->exit); + String_Const_u8 str = push_u8_stringf(scratch, "exited with code %d", cli->exit); output_file_append(models, file, str); edited_file = true; }