Add load paths to project stringize
parent
edded66424
commit
a4e634b0e5
|
@ -187,11 +187,30 @@ function void
|
|||
prj_stringize_project(Application_Links *app, Arena *arena, Variable_Handle project, String8List *out){
|
||||
Scratch_Block scratch(app, arena);
|
||||
|
||||
u64 version = vars_u64_from_var(app, vars_read_key(project, vars_save_string_lit("version")));
|
||||
// NOTE(allen): String IDs
|
||||
String_ID version_id = vars_save_string_lit("version");
|
||||
String_ID project_name_id = vars_save_string_lit("project_name");
|
||||
String_ID patterns_id = vars_save_string_lit("patterns");
|
||||
String_ID blacklist_patterns_id = vars_save_string_lit("blacklist_patterns");
|
||||
String_ID load_paths_id = vars_save_string_lit("load_paths");
|
||||
|
||||
String_ID path_id = vars_save_string_lit("path");
|
||||
String_ID relative_id = vars_save_string_lit("relative");
|
||||
String_ID recursive_id = vars_save_string_lit("recursive");
|
||||
|
||||
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];
|
||||
for (i32 i = 0; i < os_string_count; i += 1){
|
||||
os_string_ids[i] = vars_save_string(os_strings[i]);
|
||||
}
|
||||
|
||||
// NOTE(allen): Stringizing
|
||||
u64 version = vars_u64_from_var(app, vars_read_key(project, version_id));
|
||||
version = clamp_bot(2, version);
|
||||
string_list_pushf(arena, out, "version(%llu);\n", version);
|
||||
|
||||
String8 project_name = vars_string_from_var(scratch, vars_read_key(project, vars_save_string_lit("project_name")));
|
||||
String8 project_name = vars_string_from_var(scratch, vars_read_key(project, project_name_id));
|
||||
if (project_name.size > 0){
|
||||
// TODO(allen): escape project_name
|
||||
string_list_pushf(arena, out, "project_name = \"%.*s\";\n", string_expand(project_name));
|
||||
|
@ -199,17 +218,47 @@ prj_stringize_project(Application_Links *app, Arena *arena, Variable_Handle proj
|
|||
|
||||
string_list_push(arena, out, str8_lit("\n"));
|
||||
|
||||
Variable_Handle patterns = vars_read_key(project, vars_save_string_lit("patterns"));
|
||||
Variable_Handle patterns = vars_read_key(project, patterns_id);
|
||||
if (!vars_is_nil(patterns)){
|
||||
prj_stringize__string_list(app, arena, str8_lit("patterns"), patterns, out);
|
||||
}
|
||||
|
||||
Variable_Handle blacklist_patterns = vars_read_key(project, vars_save_string_lit("blacklist_patterns"));
|
||||
Variable_Handle blacklist_patterns = vars_read_key(project, blacklist_patterns_id);
|
||||
if (!vars_is_nil(blacklist_patterns)){
|
||||
prj_stringize__string_list(app, arena, str8_lit("blacklist_patterns"), blacklist_patterns, out);
|
||||
}
|
||||
|
||||
string_list_push(arena, out, str8_lit("\n"));
|
||||
|
||||
Variable_Handle load_paths = vars_read_key(project, load_paths_id);
|
||||
if (!vars_is_nil(load_paths)){
|
||||
string_list_push(arena, out, str8_lit("load_paths = {\n"));
|
||||
for (i32 i = 0; i < os_string_count; i += 1){
|
||||
Variable_Handle os_paths = vars_read_key(load_paths, os_string_ids[i]);
|
||||
if (!vars_is_nil(os_paths)){
|
||||
String8 os_string = os_strings[i];
|
||||
string_list_pushf(arena, out, ".%.*s = {\n", string_expand(os_string));
|
||||
for (Vars_Children(child, os_paths)){
|
||||
Variable_Handle path_var = vars_read_key(child, path_id);
|
||||
Variable_Handle recursive_var = vars_read_key(child, recursive_id);
|
||||
Variable_Handle relative_var = vars_read_key(child, relative_id);
|
||||
|
||||
String8 path_string = vars_string_from_var(scratch, path_var);
|
||||
b32 recursive = vars_b32_from_var(recursive_var);
|
||||
b32 relative = vars_b32_from_var(relative_var);
|
||||
|
||||
string_list_push(arena, out, str8_lit("{ "));
|
||||
string_list_pushf(arena, out, ".path = \"%.*s\", ", string_expand(path_string));
|
||||
string_list_pushf(arena, out, ".recursive = %s, ", (recursive?"true":"false"));
|
||||
string_list_pushf(arena, out, ".relative = %s, ", (relative?"true":"false"));
|
||||
string_list_push(arena, out, str8_lit("},\n"));
|
||||
}
|
||||
string_list_push(arena, out, str8_lit("},\n"));
|
||||
}
|
||||
}
|
||||
string_list_push(arena, out, str8_lit("};\n"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function Prj_Setup_Status
|
||||
|
|
|
@ -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, 675 },
|
||||
{ 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, 724 },
|
||||
{ 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, 702 },
|
||||
{ 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, 751 },
|
||||
{ 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, 684 },
|
||||
{ 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, 693 },
|
||||
{ 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, 733 },
|
||||
{ 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, 742 },
|
||||
{ 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, 882 },
|
||||
{ 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, 820 },
|
||||
{ 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, 846 },
|
||||
{ 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, 892 },
|
||||
{ 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, 931 },
|
||||
{ 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, 869 },
|
||||
{ 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, 895 },
|
||||
{ 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, 941 },
|
||||
{ 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, 864 },
|
||||
{ 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, 876 },
|
||||
{ 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, 870 },
|
||||
{ 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, 857 },
|
||||
{ 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, 913 },
|
||||
{ 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, 925 },
|
||||
{ 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, 919 },
|
||||
{ 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, 906 },
|
||||
{ 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 },
|
||||
|
|
Loading…
Reference in New Issue