Project reprint fully up and running; 4coder project converted to v2
parent
cc326a2a2d
commit
46f0d9904f
|
@ -251,88 +251,6 @@ prj_v1_parse_from_config(Application_Links *app, Arena *arena, String8 dir, Conf
|
|||
return(project);
|
||||
}
|
||||
|
||||
#if 0
|
||||
function void
|
||||
project_v1_deep_copy__pattern_list(Arena *arena, Prj_Pattern_List *src_list, Prj_Pattern_List *dst_list){
|
||||
for (Prj_Pattern_Node *src_node = src_list->first;
|
||||
src_node != 0;
|
||||
src_node = src_node->next){
|
||||
Prj_Pattern_Node *dst_node = push_array(arena, Prj_Pattern_Node, 1);
|
||||
sll_queue_push(dst_list->first, dst_list->last, dst_node);
|
||||
dst_list->count += 1;
|
||||
|
||||
for (String8Node *node = src_node->pattern.absolutes.first;
|
||||
node != 0;
|
||||
node = node->next){
|
||||
String8 string = push_string_copy(arena, node->string);
|
||||
string_list_push(arena, &dst_node->pattern.absolutes, string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Prj
|
||||
project_v1_deep_copy__inner(Arena *arena, Prj *project){
|
||||
Prj result = {};
|
||||
result.dir = push_string_copy(arena, project->dir);
|
||||
result.name = push_string_copy(arena, project->name);
|
||||
project_deep_copy__pattern_list(arena, &project->pattern_list, &result.pattern_list);
|
||||
project_deep_copy__pattern_list(arena, &project->blacklist_pattern_list, &result.blacklist_pattern_list);
|
||||
|
||||
{
|
||||
i32 path_count = project->load_path_array.count;
|
||||
result.load_path_array.paths = push_array(arena, Prj_File_Load_Path, path_count);
|
||||
result.load_path_array.count = path_count;
|
||||
|
||||
Prj_File_Load_Path *dst = result.load_path_array.paths;
|
||||
Prj_File_Load_Path *src = project->load_path_array.paths;
|
||||
for (i32 i = 0; i < path_count; ++i, ++dst, ++src){
|
||||
dst->path = push_string_copy(arena, src->path);
|
||||
dst->recursive = src->recursive;
|
||||
dst->relative = src->relative;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
i32 command_count = project->command_array.count;
|
||||
result.command_array.commands = push_array_zero(arena, Prj_Command, command_count);
|
||||
result.command_array.count = command_count;
|
||||
|
||||
Prj_Command *dst = result.command_array.commands;
|
||||
Prj_Command *src = project->command_array.commands;
|
||||
for (i32 i = 0; i < command_count; ++i, ++dst, ++src){
|
||||
if (src->name.str != 0){
|
||||
dst->name = push_string_copy(arena, src->name);
|
||||
}
|
||||
if (src->cmd.str != 0){
|
||||
dst->cmd = push_string_copy(arena, src->cmd);
|
||||
}
|
||||
if (src->out.str != 0){
|
||||
dst->out = push_string_copy(arena, src->out);
|
||||
}
|
||||
dst->footer_panel = src->footer_panel;
|
||||
dst->save_dirty_files = src->save_dirty_files;
|
||||
dst->cursor_at_end = src->cursor_at_end;
|
||||
}
|
||||
}
|
||||
|
||||
block_copy_array(result.fkey_commands, project->fkey_commands);
|
||||
|
||||
result.loaded = true;
|
||||
return(result);
|
||||
}
|
||||
|
||||
function Prj
|
||||
project_v1_deep_copy(Arena *arena, Prj *project){
|
||||
Temp_Memory restore_point = begin_temp(arena);
|
||||
Prj result = project_deep_copy__inner(arena, project);
|
||||
if (!result.loaded){
|
||||
end_temp(restore_point);
|
||||
block_zero_struct(&result);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
#endif
|
||||
|
||||
// NOTE(allen): string list join ("flatten") doesn't really work... :(
|
||||
function String8
|
||||
prj_v1_join_pattern_string(Arena *arena, String8List list){
|
||||
|
@ -492,7 +410,7 @@ prj_v1_to_v2(Application_Links *app, String8 dir, Config *parsed){
|
|||
Prj_V1_Command *cmd = project->command_array.commands + cmd_index;
|
||||
if (cmd->name.size > 0){
|
||||
String8 cmd_name = prj_v1_sanitize_string(scratch, cmd->name);
|
||||
String_ID key = vars_save_string(push_stringf(scratch, "%d", i));
|
||||
String_ID key = vars_save_string(push_stringf(scratch, "F%d", i + 1));
|
||||
String_ID val = vars_save_string(cmd_name);
|
||||
vars_new_variable(fkeys_var, key, val);
|
||||
}
|
||||
|
|
|
@ -204,6 +204,8 @@ prj_stringize_project(Application_Links *app, Arena *arena, Variable_Handle proj
|
|||
String_ID save_dirty_files_id = vars_save_string_lit("save_dirty_files");
|
||||
String_ID cursor_at_end_id = vars_save_string_lit("cursor_at_end");
|
||||
|
||||
String_ID fkey_command_id = vars_save_string_lit("fkey_command");
|
||||
|
||||
String8 os_strings[] = { str8_lit("win"), str8_lit("linux"), str8_lit("mac"), };
|
||||
local_const i32 os_string_count = ArrayCount(os_strings);
|
||||
String_ID os_string_ids[os_string_count];
|
||||
|
@ -311,6 +313,23 @@ prj_stringize_project(Application_Links *app, Arena *arena, Variable_Handle proj
|
|||
string_list_push(arena, out, str8_lit("},\n"));
|
||||
}
|
||||
string_list_push(arena, out, str8_lit("};\n"));
|
||||
|
||||
string_list_push(arena, out, str8_lit("\n"));
|
||||
}
|
||||
|
||||
|
||||
// NOTE(allen): FKey Command
|
||||
Variable_Handle fkey_commands = vars_read_key(project, fkey_command_id);
|
||||
if (!vars_is_nil(fkey_commands)){
|
||||
string_list_push(arena, out, str8_lit("fkey_command = {\n"));
|
||||
for (Vars_Children(child, fkey_commands)){
|
||||
String8 key = vars_key_from_var(scratch, child);
|
||||
String8 name = vars_string_from_var(scratch, child);
|
||||
string_list_pushf(arena, out, ".%.*s = \"%.*s\",\n", string_expand(key), string_expand(name));
|
||||
}
|
||||
string_list_push(arena, out, str8_lit("};\n"));
|
||||
|
||||
string_list_push(arena, out, str8_lit("\n"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -463,8 +482,10 @@ prj_generate_project(Arena *scratch, String8 script_path, String8 script_file, S
|
|||
fprintf(out, " .mac = \"%.*s/%.*s\", },\n", string_expand(od), string_expand(bf));
|
||||
fprintf(out, "};\n");
|
||||
|
||||
fprintf(out, "fkey_command[1] = \"build\";\n");
|
||||
fprintf(out, "fkey_command[2] = \"run\";\n");
|
||||
fprintf(out, "fkey_command = {\n");
|
||||
fprintf(out, ".F1 = \"run\";\n");
|
||||
fprintf(out, ".F2 = \"run\";\n");
|
||||
fprintf(out, "};\n");
|
||||
|
||||
fclose(out);
|
||||
success = true;
|
||||
|
@ -716,10 +737,8 @@ prj_exec_command_fkey_index(Application_Links *app, i32 fkey_index){
|
|||
// can be continued.
|
||||
Variable_Handle fkeys = def_get_config_var(vars_save_string_lit("fkey_command"));
|
||||
|
||||
// TODO(allen): Ideally I could just pass fkey_index right to vars_read_key
|
||||
// in a case like this.
|
||||
Scratch_Block scratch(app);
|
||||
String8 fkey_index_str = push_stringf(scratch, "%d", fkey_index);
|
||||
String8 fkey_index_str = push_stringf(scratch, "F%d", fkey_index + 1);
|
||||
String_ID fkey_index_id = vars_save_string(fkey_index_str);
|
||||
Variable_Handle cmd_name_var = vars_read_key(fkeys, fkey_index_id);
|
||||
String8 cmd_name = vars_string_from_var(scratch, cmd_name_var);
|
||||
|
|
|
@ -296,7 +296,7 @@ static Command_Metadata fcoder_metacmd_table[251] = {
|
|||
{ PROC_LINKS(click_set_cursor_if_lbutton, 0), false, "click_set_cursor_if_lbutton", 27, "If the mouse left button is pressed, sets the cursor position to the mouse position.", 84, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 243 },
|
||||
{ PROC_LINKS(click_set_mark, 0), false, "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 256 },
|
||||
{ PROC_LINKS(clipboard_record_clip, 0), false, "clipboard_record_clip", 21, "In response to a new clipboard contents events, saves the new clip onto the clipboard history", 93, "W:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 7 },
|
||||
{ PROC_LINKS(close_all_code, 0), false, "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 777 },
|
||||
{ PROC_LINKS(close_all_code, 0), false, "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 796 },
|
||||
{ PROC_LINKS(close_build_panel, 0), false, "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "W:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 175 },
|
||||
{ PROC_LINKS(close_panel, 0), false, "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 674 },
|
||||
{ PROC_LINKS(command_documentation, 0), true, "command_documentation", 21, "Prompts the user to select a command then loads a doc buffer for that item", 74, "W:\\4ed\\code\\custom\\4coder_docs.cpp", 34, 190 },
|
||||
|
@ -372,7 +372,7 @@ static Command_Metadata fcoder_metacmd_table[251] = {
|
|||
{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), false, "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 224 },
|
||||
{ PROC_LINKS(list_all_substring_locations, 0), false, "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 174 },
|
||||
{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), false, "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "W:\\4ed\\code\\custom\\4coder_search.cpp", 36, 186 },
|
||||
{ PROC_LINKS(load_project, 0), false, "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 804 },
|
||||
{ PROC_LINKS(load_project, 0), false, "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 823 },
|
||||
{ PROC_LINKS(load_theme_current_buffer, 0), false, "load_theme_current_buffer", 25, "Parse the current buffer as a theme file and add the theme to the theme list. If the buffer has a .4coder postfix in it's name, it is removed when the name is saved.", 165, "W:\\4ed\\code\\custom\\4coder_config.cpp", 36, 1583 },
|
||||
{ PROC_LINKS(load_themes_default_folder, 0), false, "load_themes_default_folder", 26, "Loads all the theme files in the default theme folder.", 54, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 535 },
|
||||
{ PROC_LINKS(load_themes_hot_directory, 0), false, "load_themes_hot_directory", 25, "Loads all the theme files in the current hot directory.", 55, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 547 },
|
||||
|
@ -415,8 +415,8 @@ static Command_Metadata fcoder_metacmd_table[251] = {
|
|||
{ PROC_LINKS(multi_paste_interactive_quick, 0), false, "multi_paste_interactive_quick", 29, "Paste multiple lines from the clipboard history, controlled by inputing the number of lines to paste", 100, "W:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 380 },
|
||||
{ PROC_LINKS(music_start, 0), false, "music_start", 11, "Starts the music.", 17, "W:\\4ed\\code\\custom\\4coder_examples.cpp", 38, 213 },
|
||||
{ PROC_LINKS(music_stop, 0), false, "music_stop", 10, "Stops the music.", 16, "W:\\4ed\\code\\custom\\4coder_examples.cpp", 38, 232 },
|
||||
{ PROC_LINKS(open_all_code, 0), false, "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 786 },
|
||||
{ PROC_LINKS(open_all_code_recursive, 0), false, "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 795 },
|
||||
{ PROC_LINKS(open_all_code, 0), false, "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 805 },
|
||||
{ PROC_LINKS(open_all_code_recursive, 0), false, "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 814 },
|
||||
{ PROC_LINKS(open_file_in_quotes, 0), false, "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1576 },
|
||||
{ PROC_LINKS(open_in_other, 0), false, "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2059 },
|
||||
{ PROC_LINKS(open_long_braces, 0), false, "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "W:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 46 },
|
||||
|
@ -437,10 +437,10 @@ static Command_Metadata fcoder_metacmd_table[251] = {
|
|||
{ PROC_LINKS(profile_disable, 0), false, "profile_disable", 15, "Prevent 4coder's self profiler from gathering new profiling information.", 72, "W:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 219 },
|
||||
{ PROC_LINKS(profile_enable, 0), false, "profile_enable", 14, "Allow 4coder's self profiler to gather new profiling information.", 65, "W:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 212 },
|
||||
{ PROC_LINKS(profile_inspect, 0), true, "profile_inspect", 15, "Inspect all currently collected profiling information in 4coder's self profiler.", 80, "W:\\4ed\\code\\custom\\4coder_profile_inspect.cpp", 45, 886 },
|
||||
{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 984 },
|
||||
{ PROC_LINKS(project_fkey_command, 0), false, "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 922 },
|
||||
{ PROC_LINKS(project_go_to_root_directory, 0), false, "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 948 },
|
||||
{ PROC_LINKS(project_reprint, 0), false, "project_reprint", 15, "Prints the current project to the file it was loaded from; prints in the most recent project file version", 105, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 994 },
|
||||
{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1003 },
|
||||
{ PROC_LINKS(project_fkey_command, 0), false, "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 941 },
|
||||
{ PROC_LINKS(project_go_to_root_directory, 0), false, "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 967 },
|
||||
{ PROC_LINKS(project_reprint, 0), false, "project_reprint", 15, "Prints the current project to the file it was loaded from; prints in the most recent project file version", 105, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1013 },
|
||||
{ PROC_LINKS(query_replace, 0), false, "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1282 },
|
||||
{ PROC_LINKS(query_replace_identifier, 0), false, "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1303 },
|
||||
{ PROC_LINKS(query_replace_selection, 0), false, "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1319 },
|
||||
|
@ -479,10 +479,10 @@ static Command_Metadata fcoder_metacmd_table[251] = {
|
|||
{ PROC_LINKS(set_mark, 0), false, "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 115 },
|
||||
{ PROC_LINKS(set_mode_to_notepad_like, 0), false, "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 499 },
|
||||
{ PROC_LINKS(set_mode_to_original, 0), false, "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "W:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 493 },
|
||||
{ PROC_LINKS(setup_build_bat, 0), false, "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 966 },
|
||||
{ PROC_LINKS(setup_build_bat_and_sh, 0), false, "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 978 },
|
||||
{ PROC_LINKS(setup_build_sh, 0), false, "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 972 },
|
||||
{ PROC_LINKS(setup_new_project, 0), false, "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 959 },
|
||||
{ PROC_LINKS(setup_build_bat, 0), false, "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 985 },
|
||||
{ PROC_LINKS(setup_build_bat_and_sh, 0), false, "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 997 },
|
||||
{ PROC_LINKS(setup_build_sh, 0), false, "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 991 },
|
||||
{ PROC_LINKS(setup_new_project, 0), false, "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "W:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 978 },
|
||||
{ PROC_LINKS(show_filebar, 0), false, "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 697 },
|
||||
{ PROC_LINKS(show_scrollbar, 0), false, "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 683 },
|
||||
{ PROC_LINKS(show_the_log_graph, 0), true, "show_the_log_graph", 18, "Parses *log* and displays the 'log graph' UI", 44, "W:\\4ed\\code\\custom\\4coder_log_parser.cpp", 40, 991 },
|
||||
|
|
|
@ -129,3 +129,13 @@ commands = {
|
|||
.cursor_at_end = false,
|
||||
},
|
||||
};
|
||||
|
||||
fkey_command = {
|
||||
.F1 = "build_x64",
|
||||
.F3 = "build_site_render",
|
||||
.F4 = "run_one_time",
|
||||
.F5 = "build_C___lexer_generator",
|
||||
.F6 = "build_token_tester",
|
||||
.F11 = "package",
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue