Correct naming scheme

master
Allen Webster 2019-06-18 15:56:09 -07:00
parent 41ac11cf98
commit ef571b7f64
18 changed files with 70 additions and 71 deletions

View File

@ -612,7 +612,7 @@ directory_cd(Application_Links *app, char *dir, i32 *len, i32 capacity, char *re
} }
} }
else{ else{
new_directory = string_u8_pushf(scratch, "%.*s/%.*s", new_directory = push_u8_stringf(scratch, "%.*s/%.*s",
string_expand(directory), string_expand(directory),
string_expand(relative_path)); string_expand(relative_path));
if (file_exists(app, (char*)new_directory.str, (i32)new_directory.size)){ if (file_exists(app, (char*)new_directory.str, (i32)new_directory.size)){

View File

@ -1270,7 +1270,7 @@ CUSTOM_DOC("Queries the user for two strings, and replaces all occurences of the
static void 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){ 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; 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; Managed_Scope view_scope = 0;
view_get_managed_scope(app, view, &view_scope); 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); String_Const_u8 file_name = push_buffer_file_name(app, scratch, buffer);
if (file_name.size > 0){ if (file_name.size > 0){
Query_Bar bar = {}; 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){ if (start_query_bar(app, &bar, 0) != 0){
b32 cancelled = false; b32 cancelled = false;
for (;!cancelled;){ 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 // Query the user
u8 name_space[4096]; u8 name_space[4096];
Query_Bar bar = {}; 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 = SCu8(name_space, (umem)0);
bar.string_capacity = sizeof(name_space); bar.string_capacity = sizeof(name_space);
if (query_user_string(app, &bar)){ 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); String_Const_u8 front = string_front_of_path(file_name);
u8 name_space[4096]; u8 name_space[4096];
Query_Bar bar = {}; 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 = SCu8(name_space, (umem)0);
bar.string_capacity = sizeof(name_space); bar.string_capacity = sizeof(name_space);
if (query_user_string(app, &bar)){ 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 // Query the user
u8 name_space[4096]; u8 name_space[4096];
Query_Bar bar = {}; 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 = SCu8(name_space, (umem)0);
bar.string_capacity = sizeof(name_space); bar.string_capacity = sizeof(name_space);
if (!query_user_string(app, &bar)) return; if (!query_user_string(app, &bar)) return;
if (bar.string.size == 0) 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); 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); i32 line = get_line_number_from_pos(app, buffer, pos);
Scratch_Block scratch(app); Scratch_Block scratch(app);
String_Const_u8 s = push_buffer_line(app, scratch, buffer, line); 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); pos = get_line_side_pos(app, buffer, line, Side_Min);
buffer_replace_range(app, buffer, make_range(pos), s); 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){ for (i32 i = 0; i < new_extensions_count; i += 1){
Temp_Memory temp = begin_temp(scratch); Temp_Memory temp = begin_temp(scratch);
String_Const_u8 new_extension = new_extensions[i]; 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)){ if (open_file(app, buffer_out, new_file_name, false, true)){
result = true; result = true;
break; break;
@ -1740,7 +1740,7 @@ CUSTOM_DOC("Reads a filename from surrounding '\"' characters and attempts to op
path = string_chop(path, 1); 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); view = get_next_view_looped_primary_panels(app, view, AccessAll);
if (view != 0){ if (view != 0){

View File

@ -44,7 +44,7 @@ global String_Const_u8 standard_build_cmd_string_array[] = {
static String_Const_u8 static String_Const_u8
push_fallback_command(Arena *arena, String_Const_u8 file_name){ 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 static String_Const_u8
@ -83,7 +83,7 @@ standard_search_and_build_from_dir(Application_Links *app, View_ID view, String_
// NOTE(allen): Build // NOTE(allen): Build
String_Const_u8 path = string_remove_last_folder(full_file_path); String_Const_u8 path = string_remove_last_folder(full_file_path);
#if OS_WINDOWS #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(path),
string_expand(cmd_string)); string_expand(cmd_string));
#elif OS_LINUX || OS_MAC #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); save_all_dirty_buffers(app);
} }
standard_build_exec_command(app, view, path, command); 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))); string_expand(full_file_path)));
} }

View File

@ -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 name = global_config.user_name;
String_Const_u8 str = {}; String_Const_u8 str = {};
if (name.size > 0){ 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{ else{
str = string_u8_pushf(scratch, "// %s: ", type_string); str = push_u8_stringf(scratch, "// %s: ", type_string);
} }
write_string(app, str); write_string(app, str);
} }

View File

@ -411,7 +411,7 @@ default_4coder_initialize(Application_Links *app, char **command_line_files, i32
for (i32 i = 0; i < file_count; i += 1){ for (i32 i = 0; i < file_count; i += 1){
Temp_Memory temp2 = begin_temp(scratch); Temp_Memory temp2 = begin_temp(scratch);
String_Const_u8 input_name = SCu8(command_line_files[i]); 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; Buffer_ID ignore = 0;
if (!create_buffer(app, file_name, BufferCreate_NeverNew|BufferCreate_MustAttachToFile, &ignore)){ if (!create_buffer(app, file_name, BufferCreate_NeverNew|BufferCreate_MustAttachToFile, &ignore)){
create_buffer(app, input_name, 0, &ignore); create_buffer(app, input_name, 0, &ignore);

View File

@ -1037,12 +1037,12 @@ BUFFER_NAME_RESOLVER_SIG(default_buffer_name_resolution){
uniqueifier = SCu8(start, end); uniqueifier = SCu8(start, end);
if (past_the_end){ if (past_the_end){
uniqueifier = string_u8_pushf(scratch, "%.*s~%d", uniqueifier = push_u8_stringf(scratch, "%.*s~%d",
string_expand(uniqueifier), i); string_expand(uniqueifier), i);
} }
} }
else{ else{
uniqueifier = string_u8_pushf(scratch, "%d", i); uniqueifier = push_u8_stringf(scratch, "%d", i);
} }
String_u8 builder = Su8(conflict->unique_name_in_out, 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){ OPEN_FILE_HOOK_SIG(default_end_file){
Scratch_Block scratch(app); Scratch_Block scratch(app);
String_Const_u8 buffer_name = push_buffer_unique_name(app, scratch, buffer_id); 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)); string_expand(buffer_name));
print_message(app, str); print_message(app, str);
// no meaning for return // no meaning for return

View File

@ -260,7 +260,7 @@ CUSTOM_COMMAND_SIG(multi_paste){
String_Const_u8 string = {}; String_Const_u8 string = {};
clipboard_index(app, 0, paste_index, scratch, &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; Buffer_ID buffer = 0;
view_get_buffer(app, view, AccessOpen, &buffer); view_get_buffer(app, view, AccessOpen, &buffer);

View File

@ -128,7 +128,7 @@ push_fancy_string(Arena *arena, String_Const_u8 value){
static Fancy_String* static Fancy_String*
push_fancy_stringfv(Arena *arena, Fancy_String_List *list, Fancy_Color fore, Fancy_Color back, char *format, va_list args){ 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; Fancy_String *result = 0;
if (str.size > 0){ if (str.size > 0){
result = push_fancy_string(arena, list, fore, back, str); result = push_fancy_string(arena, list, fore, back, str);

View File

@ -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))){ if (character_is_slash(string_get_character(path, path.size - 1))){
path = string_chop(path, 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(path),
string_expand(file_name)); string_expand(file_name));
if (file_exists(app, full_path)){ if (file_exists(app, full_path)){

View File

@ -88,7 +88,7 @@ insertf(Buffer_Insertion *insertion, char *format, ...){
Temp_Memory temp = begin_temp(scratch); Temp_Memory temp = begin_temp(scratch);
va_list args; va_list args;
va_start(args, format); 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); va_end(args);
insert_string(insertion, string); insert_string(insertion, string);
end_temp(temp); end_temp(temp);

View File

@ -552,7 +552,7 @@ generate_hot_directory_file_list(Application_Links *app, Lister *lister){
Temp_Memory temp = begin_temp(&lister->arena); Temp_Memory temp = begin_temp(&lister->arena);
String_Const_u8 hot = push_hot_directory(app, &lister->arena); String_Const_u8 hot = push_hot_directory(app, &lister->arena);
if (!character_is_slash(string_get_character(hot, hot.size - 1))){ 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_text_field(lister, hot);
lister_set_key(lister, string_front_of_path(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 < one_past_last;
info += 1){ info += 1){
if (!info->folder) continue; 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); 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; 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); 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); buffer_kill(app, buffer_id, BufferKill_AlwaysKill, 0);
} }
else{ 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)); string_expand(file_name));
print_message(app, str); 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))){ if (character_is_slash(string_get_character(path, path.size - 1))){
path = string_chop(path, 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){ if (is_folder){
set_hot_directory(app, full_file_name); set_hot_directory(app, full_file_name);
result = ListerActivation_ContinueAndRefresh; result = ListerActivation_ContinueAndRefresh;

View File

@ -319,7 +319,7 @@ require_key_identifier(Reader *reader, char *str, int32_t *opt_pos_out = 0){
if (!success){ if (!success){
Temp_Memory temp = begin_temp(reader->error_arena); 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); error(reader, token.start, error_string.str);
end_temp(temp); end_temp(temp);
} }

View File

@ -104,7 +104,7 @@ CUSTOM_DOC("Increment an integer under the cursor by one.")
Miblo_Number_Info number = {}; Miblo_Number_Info number = {};
if (get_numeric_at_cursor(app, buffer, pos, &number)){ if (get_numeric_at_cursor(app, buffer, pos, &number)){
Scratch_Block scratch(app); 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); buffer_replace_range(app, buffer, number.range, str);
view_set_cursor(app, view, seek_pos(number.start + (i32)str.size - 1), true); 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 = {}; Miblo_Number_Info number = {};
if (get_numeric_at_cursor(app, buffer, pos, &number)){ if (get_numeric_at_cursor(app, buffer, pos, &number)){
Scratch_Block scratch(app); 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); buffer_replace_range(app, buffer, number.range, str);
view_set_cursor(app, view, seek_pos(number.start + (i32)str.size - 1), true); view_set_cursor(app, view, seek_pos(number.start + (i32)str.size - 1), true);
} }

View File

@ -15,7 +15,7 @@ get_pattern_array_from_string_array(Arena *arena, String_Const_u8_Array list){
array.count = list.count; array.count = list.count;
array.patterns = push_array(arena, Project_File_Pattern, list.count); array.patterns = push_array(arena, Project_File_Pattern, list.count);
for (i32 i = 0; i < list.count; ++i){ 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); array.patterns[i].absolutes = string_split_wildcards(arena, str);
} }
return(array); return(array);
@ -107,7 +107,7 @@ open_all_files_in_directory_pattern_match__recursive(Application_Links *app,
continue; 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(path),
string_expand(file_name)); string_expand(file_name));
open_all_files_in_directory_pattern_match__recursive(app, new_path, 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; 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(path),
string_expand(file_name)); string_expand(file_name));
Buffer_ID ignore = 0; Buffer_ID ignore = 0;
@ -150,7 +150,7 @@ open_all_files_in_directory_pattern_match(Application_Links *app,
Scratch_Block scratch(app); Scratch_Block scratch(app);
String_Const_u8 directory = dir; String_Const_u8 directory = dir;
if (!character_is_slash(string_get_character(directory, directory.size - 1))){ 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); 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 hot = push_hot_directory(app, scratch);
String_Const_u8 directory = hot; String_Const_u8 directory = hot;
if (!character_is_slash(string_get_character(hot, hot.size - 1))){ 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); 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; project->fkey_commands[j - 1] = j - 1;
block_zero_struct(command); block_zero_struct(command);
command->name = string_u8_pushf(arena, "%d", j); command->name = push_u8_stringf(arena, "%d", j);
Config_Compound *compound = 0; Config_Compound *compound = 0;
if (config_compound_var(parsed, fkey_command_name, j, &compound)){ 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 // Set window title
if (project->name.size > 0){ if (project->name.size > 0){
Temp_Memory temp = begin_temp(scratch); 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)); string_expand(project->name));
set_window_title(app, builder); set_window_title(app, builder);
end_temp(temp); end_temp(temp);
@ -993,21 +993,21 @@ project_is_setup(Application_Links *app, String_Const_u8 script_path, String_Con
Project_Setup_Status result = {}; Project_Setup_Status result = {};
{ {
Scratch_Block scratch(app); 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_path),
string_expand(script_file)); string_expand(script_file));
result.bat_exists = file_exists(app, bat_path); result.bat_exists = file_exists(app, bat_path);
} }
{ {
Scratch_Block scratch(app); 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_path),
string_expand(script_file)); string_expand(script_file));
result.sh_exists = file_exists(app, sh_path); result.sh_exists = file_exists(app, sh_path);
} }
{ {
Scratch_Block scratch(app); 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)); string_expand(script_path));
result.sh_exists = file_exists(app, project_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, '/', '\\'); od = string_mod_replace_character(od, '/', '\\');
bf = string_mod_replace_character(bf, '/', '\\'); 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_path),
string_expand(script_file)); 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 od = output_dir;
String_Const_u8 bf = binary_file; 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_path),
string_expand(script_file)); 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_Const_u8 bf_win = string_replace(scratch, bf,
string_u8_litexpr("/"), string_u8_litexpr("\\")); 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"); FILE *out = fopen((char*)file_name.str, "wb");
if (out != 0){ if (out != 0){

View File

@ -425,17 +425,17 @@ place_begin_and_end_on_own_lines(Application_Links *app, char *begin, char *end)
umem max_adjustment = 0; umem max_adjustment = 0;
if (min_line_blank){ 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; min_adjustment += 1;
} }
else{ else{
begin_str = string_u8_pushf(scratch, "%s\n", begin); begin_str = push_u8_stringf(scratch, "%s\n", begin);
} }
if (max_line_blank){ if (max_line_blank){
end_str = string_u8_pushf(scratch, "%s\n", end); end_str = push_u8_stringf(scratch, "%s\n", end);
} }
else{ else{
end_str = string_u8_pushf(scratch, "\n%s", end); end_str = push_u8_stringf(scratch, "\n%s", end);
max_adjustment += 1; 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)); view_set_mark(app, view, seek_pos(mark_pos));
} }
else{ 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); buffer_replace_range(app, buffer, range, str);
i32 center_pos = range.min + (i32)cstring_length(begin) + 1; i32 center_pos = range.min + (i32)cstring_length(begin) + 1;
view_set_cursor(app, view, seek_pos(center_pos), true); 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 = {}; String_Const_u8 edit_str = {};
if (extra_newline){ 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{ 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]; Buffer_Edit edits[2];

View File

@ -685,15 +685,15 @@ list_type_definition__parameters(Application_Links *app, Heap *heap, String_Cons
String_Const_u8 match_strings[9]; String_Const_u8 match_strings[9];
i32 i = 0; i32 i = 0;
match_strings[i++] = (string_u8_pushf(scratch, "struct %.*s{" , string_expand(str))); match_strings[i++] = (push_u8_stringf(scratch, "struct %.*s{" , string_expand(str)));
match_strings[i++] = (string_u8_pushf(scratch, "struct %.*s\n{", string_expand(str))); match_strings[i++] = (push_u8_stringf(scratch, "struct %.*s\n{", string_expand(str)));
match_strings[i++] = (string_u8_pushf(scratch, "struct %.*s {" , string_expand(str))); match_strings[i++] = (push_u8_stringf(scratch, "struct %.*s {" , string_expand(str)));
match_strings[i++] = (string_u8_pushf(scratch, "union %.*s{" , string_expand(str))); match_strings[i++] = (push_u8_stringf(scratch, "union %.*s{" , string_expand(str)));
match_strings[i++] = (string_u8_pushf(scratch, "union %.*s\n{" , string_expand(str))); match_strings[i++] = (push_u8_stringf(scratch, "union %.*s\n{" , string_expand(str)));
match_strings[i++] = (string_u8_pushf(scratch, "union %.*s {" , string_expand(str))); match_strings[i++] = (push_u8_stringf(scratch, "union %.*s {" , string_expand(str)));
match_strings[i++] = (string_u8_pushf(scratch, "enum %.*s{" , string_expand(str))); match_strings[i++] = (push_u8_stringf(scratch, "enum %.*s{" , string_expand(str)));
match_strings[i++] = (string_u8_pushf(scratch, "enum %.*s\n{" , string_expand(str))); match_strings[i++] = (push_u8_stringf(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, "enum %.*s {" , string_expand(str)));
list__parameters(app, heap, match_strings, ArrayCount(match_strings), 0, default_target_view); list__parameters(app, heap, match_strings, ArrayCount(match_strings), 0, default_target_view);

View File

@ -8,7 +8,7 @@
#include <stdio.h> #include <stdio.h>
static String_Const_char 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); i32 size = vsnprintf(0, 0, format, args);
String_Const_char result = string_const_char_push(arena, size + 1); String_Const_char result = string_const_char_push(arena, size + 1);
vsnprintf(result.str, result.size, format, args); vsnprintf(result.str, result.size, format, args);
@ -17,29 +17,29 @@ string_pushfv(Arena *arena, char *format, va_list args){
return(result); return(result);
} }
static String_Const_char static String_Const_char
string_pushf(Arena *arena, char *format, ...){ push_stringf(Arena *arena, char *format, ...){
va_list args; va_list args;
va_start(args, format); 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); va_end(args);
return(result); return(result);
} }
static String_Const_u8 static String_Const_u8
string_u8_pushfv(Arena *arena, char *format, va_list args){ push_u8_stringfv(Arena *arena, char *format, va_list args){
return(SCu8(string_pushfv(arena, format, args))); return(SCu8(push_stringfv(arena, format, args)));
} }
static String_Const_u8 static String_Const_u8
string_u8_pushf(Arena *arena, char *format, ...){ push_u8_stringf(Arena *arena, char *format, ...){
va_list args; va_list args;
va_start(args, format); 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); va_end(args);
return(result); return(result);
} }
static void static void
string_list_pushfv(Arena *arena, List_String_Const_char *list, char *format, va_list args){ 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)){ if (arena->alignment < sizeof(umem)){
push_align(arena, 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 static void
string_list_pushfv(Arena *arena, List_String_Const_u8 *list, char *format, va_list args){ 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)){ if (arena->alignment < sizeof(umem)){
push_align(arena, sizeof(umem)); push_align(arena, sizeof(umem));
} }

View File

@ -1087,8 +1087,7 @@ App_Step_Sig(app_step){
if (system->cli_end_update(cli)){ if (system->cli_end_update(cli)){
if (file != 0){ if (file != 0){
String_Const_u8 str = string_u8_pushf(scratch, "exited with code %d", String_Const_u8 str = push_u8_stringf(scratch, "exited with code %d", cli->exit);
cli->exit);
output_file_append(models, file, str); output_file_append(models, file, str);
edited_file = true; edited_file = true;
} }