Some progress sorting out project functions, cleaning up old stuff

master
Allen Webster 2021-01-07 00:41:04 -08:00
parent 8940b29ab1
commit da32d5f869
9 changed files with 164 additions and 136 deletions

View File

@ -4,6 +4,28 @@
// TOP
////////////////////////////////
// NOTE(allen): Config Search List
function void
def_search_normal_load_list(Arena *arena, List_String_Const_u8 *list){
Variable_Handle prj_var = vars_read_key(vars_get_root(), vars_save_string_lit("prj_config"));
String_Const_u8 prj_dir = prj_path_from_project(arena, prj_var);
if (prj_dir.size > 0){
string_list_push(arena, list, prj_dir);
}
def_search_list_add_system_path(arena, list, SystemPath_Binary);
}
function FILE*
def_search_normal_fopen(Arena *arena, char *file_name, char *opt){
Temp_Memory_Block block(arena);
List_String_Const_u8 list = {};
def_search_normal_load_list(arena, &list);
FILE *file = def_search_fopen(arena, &list, file_name, opt);
return(file);
}
////////////////////////////////
// NOTE(allen): Extension List

View File

@ -7,8 +7,6 @@
#if !defined(FCODER_CONFIG_H)
#define FCODER_CONFIG_H
#include <stdio.h>
////////////////////////////////
// NOTE(allen): Config Parser Types
@ -174,6 +172,12 @@ struct Config_Get_Result_List{
i32 count;
};
////////////////////////////////
// NOTE(allen): Config Search List
function String_Const_u8 def_search_get_full_path(Arena *arena, List_String_Const_u8 *list, String_Const_u8 file_name);
function FILE *def_search_normal_fopen(Arena *arena, char *file_name, char *opt);
////////////////////////////////
// NOTE(allen): Config Parser Functions

View File

@ -4,13 +4,6 @@
// TOP
#if 1
global Project current_project = {};
global Arena current_project_arena = {};
#endif
///////////////////////////////
function Match_Pattern_List
prj_pattern_list_from_extension_array(Arena *arena, String_Const_u8_Array list){
Match_Pattern_List result = {};
@ -41,10 +34,31 @@ prj_pattern_list_from_var(Arena *arena, Variable_Handle var){
return(result);
}
///////////////////////////////
function Match_Pattern_List
prj_get_standard_blacklist(Arena *arena){
String_Const_u8 dot = string_u8_litexpr(".*");
String_Const_u8_Array black_array = {};
black_array.strings = &dot;
black_array.count = 1;
return(prj_pattern_list_from_extension_array(arena, black_array));
}
function b32
prj_match_in_pattern_list(String_Const_u8 string, Match_Pattern_List list){
b32 found_match = false;
for (Match_Pattern_Node *node = list.first;
node != 0;
node = node->next){
if (string_wildcard_match(node->pattern.absolutes, string, StringMatch_Exact)){
found_match = true;
break;
}
}
return(found_match);
}
function void
close_all_files_with_extension(Application_Links *app, String_Const_u8_Array extension_array){
prj_close_files_with_ext(Application_Links *app, String_Const_u8_Array extension_array){
Scratch_Block scratch(app);
i32 buffers_to_close_max = Thousand(100);
@ -91,23 +105,17 @@ close_all_files_with_extension(Application_Links *app, String_Const_u8_Array ext
}while(do_repeat);
}
function b32
match_in_pattern_list(String_Const_u8 string, Match_Pattern_List list){
b32 found_match = false;
for (Match_Pattern_Node *node = list.first;
node != 0;
node = node->next){
if (string_wildcard_match(node->pattern.absolutes, string, StringMatch_Exact)){
found_match = true;
break;
}
}
return(found_match);
function void
prj_open_files_with_ext(Application_Links *app, String_Const_u8 dir, String_Const_u8_Array array, u32 flags){
Scratch_Block scratch(app);
Match_Pattern_List whitelist = prj_pattern_list_from_extension_array(scratch, array);
Match_Pattern_List blacklist = prj_get_standard_blacklist(scratch);
prj_open_files_pattern_filter(app, dir, whitelist, blacklist, flags);
}
function void
open_files_pattern_match__recursive(Application_Links *app, String_Const_u8 path,
Match_Pattern_List whitelist, Match_Pattern_List blacklist, u32 flags){
prj_open_files_pattern_filter__rec(Application_Links *app, String_Const_u8 path,
Match_Pattern_List whitelist, Match_Pattern_List blacklist, u32 flags){
Scratch_Block scratch(app);
ProfileScopeNamed(app, "get file list", profile_get_file_list);
@ -121,17 +129,17 @@ open_files_pattern_match__recursive(Application_Links *app, String_Const_u8 path
if ((flags & OpenAllFilesFlag_Recursive) == 0){
continue;
}
if (match_in_pattern_list(file_name, blacklist)){
if (prj_match_in_pattern_list(file_name, blacklist)){
continue;
}
String_Const_u8 new_path = push_u8_stringf(scratch, "%.*s%.*s/", string_expand(path), string_expand(file_name));
open_files_pattern_match__recursive(app, new_path, whitelist, blacklist, flags);
prj_open_files_pattern_filter__rec(app, new_path, whitelist, blacklist, flags);
}
else{
if (!match_in_pattern_list(file_name, whitelist)){
if (!prj_match_in_pattern_list(file_name, whitelist)){
continue;
}
if (match_in_pattern_list(file_name, blacklist)){
if (prj_match_in_pattern_list(file_name, blacklist)){
continue;
}
String_Const_u8 full_path = push_u8_stringf(scratch, "%.*s%.*s", string_expand(path), string_expand(file_name));
@ -140,51 +148,32 @@ open_files_pattern_match__recursive(Application_Links *app, String_Const_u8 path
}
}
// TODO(allen): dumb name
function Match_Pattern_List
get_standard_blacklist(Arena *arena){
String_Const_u8 dot = string_u8_litexpr(".*");
String_Const_u8_Array black_array = {};
black_array.strings = &dot;
black_array.count = 1;
return(prj_pattern_list_from_extension_array(arena, black_array));
}
function void
open_files_pattern_match(Application_Links *app, String_Const_u8 dir,
Match_Pattern_List whitelist, Match_Pattern_List blacklist, u32 flags){
prj_open_files_pattern_filter(Application_Links *app, String_Const_u8 dir, Match_Pattern_List whitelist, Match_Pattern_List blacklist, u32 flags){
ProfileScope(app, "open all files in directory pattern");
Scratch_Block scratch(app);
String_Const_u8 directory = dir;
if (!character_is_slash(string_get_character(directory, directory.size - 1))){
directory = push_u8_stringf(scratch, "%.*s/", string_expand(dir));
}
open_files_pattern_match__recursive(app, directory, whitelist, blacklist, flags);
prj_open_files_pattern_filter__rec(app, directory, whitelist, blacklist, flags);
}
function void
open_files_with_extension(Application_Links *app, String_Const_u8 dir, String_Const_u8_Array array, u32 flags){
Scratch_Block scratch(app);
Match_Pattern_List whitelist = prj_pattern_list_from_extension_array(scratch, array);
Match_Pattern_List blacklist = get_standard_blacklist(scratch);
open_files_pattern_match(app, dir, whitelist, blacklist, flags);
}
function void
open_all_files_in_hot_with_extension(Application_Links *app, String_Const_u8_Array array, u32 flags){
prj_open_all_files_with_ext_in_hot(Application_Links *app, String_Const_u8_Array array, u32 flags){
Scratch_Block scratch(app);
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 = push_u8_stringf(scratch, "%.*s/", string_expand(hot));
}
open_files_with_extension(app, hot, array, flags);
prj_open_files_with_ext(app, hot, array, flags);
}
///////////////////////////////
function void
parse_project__extract_pattern_list(Arena *arena, Config *parsed, char *root_variable_name, Match_Pattern_List *list_out){
prj_parse_pattern_list(Arena *arena, Config *parsed, char *root_variable_name, Match_Pattern_List *list_out){
Config_Compound *compound = 0;
if (config_compound_var(parsed, root_variable_name, 0, &compound)){
Config_Get_Result_List list = typed_string_array_reference_list(arena, parsed, compound);
@ -201,21 +190,22 @@ parse_project__extract_pattern_list(Arena *arena, Config *parsed, char *root_var
}
function Project_OS_Match_Level
parse_project__version_1__os_match(String_Const_u8 str, String_Const_u8 this_os_str){
prj_parse_v1_os_match(String_Const_u8 str, String_Const_u8 this_os_str){
Project_OS_Match_Level result = ProjectOSMatchLevel_NoMatch;
if (string_match(str, this_os_str)){
return(ProjectOSMatchLevel_ActiveMatch);
result = ProjectOSMatchLevel_ActiveMatch;
}
else if (string_match(str, string_u8_litexpr("all"))){
return(ProjectOSMatchLevel_ActiveMatch);
result = ProjectOSMatchLevel_ActiveMatch;
}
else if (string_match(str, string_u8_litexpr("default"))){
return(ProjectOSMatchLevel_PassiveMatch);
result = ProjectOSMatchLevel_PassiveMatch;
}
return(ProjectOSMatchLevel_NoMatch);
return(result);
}
function Project*
parse_project__config_data__version_1(Application_Links *app, Arena *arena, String_Const_u8 root_dir, Config *parsed){
prj_parse_from_v1_config_data(Application_Links *app, Arena *arena, String_Const_u8 root_dir, Config *parsed){
Project *project = push_array_zero(arena, Project, 1);
// Set new project directory
@ -233,10 +223,10 @@ parse_project__config_data__version_1(Application_Links *app, Arena *arena, Stri
}
// patterns
parse_project__extract_pattern_list(arena, parsed, "patterns", &project->pattern_list);
prj_parse_pattern_list(arena, parsed, "patterns", &project->pattern_list);
// blacklist_patterns
parse_project__extract_pattern_list(arena, parsed, "blacklist_patterns", &project->blacklist_pattern_list);
prj_parse_pattern_list(arena, parsed, "blacklist_patterns", &project->blacklist_pattern_list);
// load_paths
{
@ -259,7 +249,7 @@ parse_project__config_data__version_1(Application_Links *app, Arena *arena, Stri
if (config_compound_compound_member(parsed, paths_option, "paths", 0, &paths)){
String_Const_u8 str = {};
if (config_compound_string_member(parsed, paths_option, "os", 1, &str)){
Project_OS_Match_Level r = parse_project__version_1__os_match(str, string_u8_litexpr(OS_NAME));
Project_OS_Match_Level r = prj_parse_v1_os_match(str, string_u8_litexpr(OS_NAME));
if (r == ProjectOSMatchLevel_ActiveMatch){
found_match = true;
best_paths = paths;
@ -363,7 +353,7 @@ parse_project__config_data__version_1(Application_Links *app, Arena *arena, Stri
if (config_compound_string_member(parsed, cmd_option, "cmd", 0, &cmd)){
String_Const_u8 str = {};
if (config_compound_string_member(parsed, cmd_option, "os", 1, &str)){
Project_OS_Match_Level r = parse_project__version_1__os_match(str, string_u8_litexpr(OS_NAME));
Project_OS_Match_Level r = prj_parse_v1_os_match(str, string_u8_litexpr(OS_NAME));
if (r == ProjectOSMatchLevel_ActiveMatch){
can_emit_command = true;
cmd_str = cmd;
@ -785,7 +775,7 @@ CUSTOM_DOC("Closes any buffer with a filename ending with an extension configure
Scratch_Block scratch(app);
String_Const_u8 treat_as_code = def_get_config_string(scratch, vars_save_string_lit("treat_as_code"));
String_Const_u8_Array extensions = parse_extension_line_to_extension_list(app, scratch, treat_as_code);
close_all_files_with_extension(app, extensions);
prj_close_files_with_ext(app, extensions);
}
CUSTOM_COMMAND_SIG(open_all_code)
@ -794,7 +784,7 @@ CUSTOM_DOC("Open all code in the current directory. File types are determined by
Scratch_Block scratch(app);
String_Const_u8 treat_as_code = def_get_config_string(scratch, vars_save_string_lit("treat_as_code"));
String_Const_u8_Array extensions = parse_extension_line_to_extension_list(app, scratch, treat_as_code);
open_all_files_in_hot_with_extension(app, extensions, 0);
prj_open_all_files_with_ext_in_hot(app, extensions, 0);
}
CUSTOM_COMMAND_SIG(open_all_code_recursive)
@ -803,7 +793,7 @@ CUSTOM_DOC("Works as open_all_code but also runs in all subdirectories.")
Scratch_Block scratch(app);
String_Const_u8 treat_as_code = def_get_config_string(scratch, vars_save_string_lit("treat_as_code"));
String_Const_u8_Array extensions = parse_extension_line_to_extension_list(app, scratch, treat_as_code);
open_all_files_in_hot_with_extension(app, extensions, OpenAllFilesFlag_Recursive);
prj_open_all_files_with_ext_in_hot(app, extensions, OpenAllFilesFlag_Recursive);
}
///////////////////////////////
@ -841,7 +831,7 @@ CUSTOM_DOC("Looks for a project.4coder file in the current directory and tries t
case 0:
case 1:
{
Project *project = parse_project__config_data__version_1(app, scratch, project_root, config_parse);
Project *project = prj_parse_from_v1_config_data(app, scratch, project_root, config_parse);
proj_var = prj_version_1_to_version_2(app, config_parse, project);
}break;
default:
@ -870,16 +860,6 @@ CUSTOM_DOC("Looks for a project.4coder file in the current directory and tries t
}
}
// TODO(allen): this is dummy dumb dumb and don't need to be like this.
// NOTE(allen): Set the normal search list's project slot
String_Const_u8 project_dir = prj_path_from_project(scratch, proj_var);
if (current_project_arena.base_allocator == 0){
current_project_arena = make_arena_system();
}
linalloc_clear(&current_project_arena);
def_search_project_path = push_string_copy(&current_project_arena, project_dir);
// NOTE(allen): Open All Project Files
Variable_Handle load_paths_var = vars_read_key(proj_var, vars_save_string_lit("load_paths"));
Variable_Handle load_paths_os_var = vars_read_key(load_paths_var, vars_save_string_lit(OS_NAME));
@ -913,14 +893,16 @@ CUSTOM_DOC("Looks for a project.4coder file in the current directory and tries t
String_Const_u8 file_dir = path;
if (relative){
String_Const_u8 prj_dir = prj_path_from_project(scratch, proj_var);
List_String_Const_u8 file_dir_list = {};
string_list_push(scratch, &file_dir_list, project_dir);
string_list_push(scratch, &file_dir_list, prj_dir);
string_list_push_overlap(scratch, &file_dir_list, '/', path);
string_list_push_overlap(scratch, &file_dir_list, '/', SCu8());
file_dir = string_list_flatten(scratch, file_dir_list, StringFill_NullTerminate);
}
open_files_pattern_match(app, file_dir, whitelist, blacklist, flags);
prj_open_files_pattern_filter(app, file_dir, whitelist, blacklist, flags);
}
// NOTE(allen): Set Window Title

View File

@ -7,6 +7,11 @@
#if !defined(FCODER_PROJECT_COMMANDS_H)
#define FCODER_PROJECT_COMMANDS_H
// TODO(allen): finish sorting
////////////////////////////////
// NOTE(allen): * Type
enum{
OpenAllFilesFlag_Recursive = 1,
};
@ -64,7 +69,6 @@ struct Project{
Project_File_Load_Path_Array load_path_array;
Project_Command_Array command_array;
// NOTE(allen): Only used for conversion from 1 -> 2
i32 fkey_commands[16];
};
@ -92,6 +96,47 @@ struct Project_Key_Strings{
String_Const_u8 binary_file;
};
////////////////////////////////
// NOTE(allen): * Functions
function Match_Pattern_List prj_pattern_list_from_extension_array(Arena *arena, String_Const_u8_Array list);
function Match_Pattern_List prj_pattern_list_from_var(Arena *arena, Variable_Handle var);
function Match_Pattern_List prj_get_standard_blacklist(Arena *arena);
function b32 prj_match_in_pattern_list(String_Const_u8 string, Match_Pattern_List list);
function void prj_close_files_with_ext(Application_Links *app, String_Const_u8_Array extension_array);
function void prj_open_files_with_ext(Application_Links *app, String_Const_u8 dir, String_Const_u8_Array array, u32 flags);
function void prj_open_files_pattern_filter(Application_Links *app, String_Const_u8 dir, Match_Pattern_List whitelist, Match_Pattern_List blacklist, u32 flags);
function void prj_open_all_files_with_ext_in_hot(Application_Links *app, String_Const_u8_Array array, u32 flags);
////////////////////////////////
// NOTE(allen): Project Parse
function void prj_parse_pattern_list(Arena *arena, Config * parsed, char* root_variable_name, Match_Pattern_List *list_out);
function Project_OS_Match_Level prj_parse_v1_os_match(String_Const_u8 str, String_Const_u8 this_os_str);
function Project *prj_parse_from_v1_config_data(Application_Links *app, Arena *arena, String_Const_u8 root_dir, Config * parsed);
function String_Const_u8 prj_join_pattern_string(Arena *arena, List_String_Const_u8 list);
function String_Const_u8 prj_sanitize_string(Arena *arena, String_Const_u8 string);
function Variable_Handle prj_version_1_to_version_2(Application_Links *app, Config * parsed, Project *project);
function String_Const_u8 prj_path_from_project(Arena *arena, Variable_Handle project);
function void prj_exec_command(Application_Links *app, Variable_Handle cmd_var);
function Variable_Handle prj_command_from_name(Application_Links *app, String_Const_u8 cmd_name);
function void prj_exec_command_name(Application_Links *app, String_Const_u8 cmd_name);
function void prj_exec_command_fkey_index(Application_Links *app, i32 fkey_index);
function Project_Setup_Status project_is_setup(Application_Links *app, String_Const_u8 script_path, String_Const_u8 script_file);
function Project_Key_Strings project_key_strings_query_user(Application_Links *app, b32 get_script_file, b32 get_code_file, u8* script_file_space, i32 script_file_cap, u8* code_file_space, i32 code_file_cap, u8* output_dir_space, i32 output_dir_cap, u8* binary_file_space, i32 binary_file_cap);
function b32 project_generate_bat_script(Arena *scratch, String_Const_u8 opts, String_Const_u8 compiler, String_Const_u8 script_path, String_Const_u8 script_file, String_Const_u8 code_file, String_Const_u8 output_dir, String_Const_u8 binary_file);
function b32 project_generate_sh_script(Arena *scratch, String_Const_u8 opts, String_Const_u8 compiler, String_Const_u8 script_path, String_Const_u8 script_file, String_Const_u8 code_file, String_Const_u8 output_dir, String_Const_u8 binary_file);
function b32 project_generate_project_4coder_file(Arena *scratch, String_Const_u8 script_path, String_Const_u8 script_file, String_Const_u8 output_dir, String_Const_u8 binary_file);
function void project_setup_scripts__generic(Application_Links *app, b32 do_project_file, b32 do_bat_script, b32 do_sh_script);
function Variable_Handle prj_cmd_from_user(Application_Links *app, Variable_Handle prj_var, String_Const_u8 query);
function Variable_Handle get_project_command_from_user(Application_Links *app, Project *project, String_Const_u8 query);
#endif
// BOTTOM

View File

@ -24,19 +24,11 @@ def_search_list_add_system_path(Arena *arena, List_String_Const_u8 *list, System
string_list_push(arena, list, path_string);
}
function void
def_search_normal_load_list(Arena *arena, List_String_Const_u8 *list){
if (def_search_project_path.size > 0){
def_search_list_add_path(arena, list, def_search_project_path);
}
def_search_list_add_system_path(arena, list, SystemPath_Binary);
}
////////////////////////////////
// NOTE(allen): Search List Functions
function String_Const_u8
def_get_full_path(Arena *arena, List_String_Const_u8 *list, String_Const_u8 relative){
def_search_get_full_path(Arena *arena, List_String_Const_u8 *list, String_Const_u8 relative){
String_Const_u8 result = {};
Temp_Memory temp = begin_temp(arena);
@ -69,7 +61,7 @@ def_get_full_path(Arena *arena, List_String_Const_u8 *list, String_Const_u8 rela
function FILE*
def_search_fopen(Arena *arena, List_String_Const_u8 *list, char *file_name, char *opt){
Temp_Memory_Block block(arena);
String_Const_u8 full_path = def_get_full_path(arena, list, SCu8(file_name));
String_Const_u8 full_path = def_search_get_full_path(arena, list, SCu8(file_name));
FILE *file = 0;
if (full_path.size > 0){
file = fopen((char*)full_path.str, opt);
@ -77,14 +69,5 @@ def_search_fopen(Arena *arena, List_String_Const_u8 *list, char *file_name, char
return(file);
}
function FILE*
def_search_normal_fopen(Arena *arena, char *file_name, char *opt){
Temp_Memory_Block block(arena);
List_String_Const_u8 list = {};
def_search_normal_load_list(arena, &list);
FILE *file = def_search_fopen(arena, &list, file_name, opt);
return(file);
}
// BOTTOM

View File

@ -16,23 +16,13 @@
// NOTE(allen): Search List Builders
function void def_search_add_path(Arena *arena, List_String_Const_u8 *list, String_Const_u8 path);
function void def_search_add_system_path(Arena *arena, List_String_Const_u8 *list, System_Path_Code path);
global String_Const_u8 def_search_project_path = {};
function void def_search_list_add_system_path(Arena *arena, List_String_Const_u8 *list, System_Path_Code path);
function void def_search_normal_load_list(Arena *arena, List_String_Const_u8 *list);
////////////////////////////////
// NOTE(allen): Search List Functions
function String_Const_u8 def_search_get_full_path(Arena *arena, List_String_Const_u8 *list, String_Const_u8 file_name);
#if OS_LINUX
#include <stdio.h>
#endif
function FILE *def_search_fopen(Arena *arena, List_String_Const_u8 *list, char *file_name, char *opt);
function FILE *def_search_normal_fopen(Arena *arena, char *file_name, char *opt);
#endif

View File

@ -295,7 +295,7 @@ static Command_Metadata fcoder_metacmd_table[250] = {
{ 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, 782 },
{ 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, 772 },
{ 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 },
@ -371,8 +371,8 @@ static Command_Metadata fcoder_metacmd_table[250] = {
{ 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, 811 },
{ 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, 1561 },
{ 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, 801 },
{ 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 },
{ PROC_LINKS(make_directory_query, 0), false, "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1495 },
@ -414,8 +414,8 @@ static Command_Metadata fcoder_metacmd_table[250] = {
{ 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, 791 },
{ 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, 800 },
{ 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, 781 },
{ 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, 790 },
{ 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 },
@ -436,9 +436,9 @@ static Command_Metadata fcoder_metacmd_table[250] = {
{ 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, 1387 },
{ 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, 936 },
{ 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, 962 },
{ 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, 1369 },
{ 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, 918 },
{ 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, 944 },
{ 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 },
@ -477,10 +477,10 @@ static Command_Metadata fcoder_metacmd_table[250] = {
{ 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, 1307 },
{ 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, 1319 },
{ 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, 1313 },
{ 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, 1300 },
{ 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, 1289 },
{ 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, 1301 },
{ 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, 1295 },
{ 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, 1282 },
{ 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 },

View File

@ -10,6 +10,8 @@
// TOP
#include <stdio.h>
#define FPS 60
#define frame_useconds (Million(1) / FPS)
#define frame_nseconds (Billion(1) / FPS)
@ -191,14 +193,14 @@ struct Linux_Vars {
String_Const_u8 clipboard_contents;
b32 received_new_clipboard;
b32 clipboard_catch_all;
pthread_mutex_t audio_mutex;
pthread_cond_t audio_cond;
void* audio_ctx;
Audio_Mix_Sources_Function* audio_src_func;
Audio_Mix_Destination_Function* audio_dst_func;
System_Thread audio_thread;
Atom atom_TARGETS;
Atom atom_CLIPBOARD;
Atom atom_UTF8_STRING;
@ -582,25 +584,25 @@ graphics_fill_texture_sig(){
internal Face*
font_make_face(Arena* arena, Face_Description* description, f32 scale_factor) {
Face_Description local_description = *description;
String_Const_u8* name = &local_description.font.file_name;
// if description->font.file_name is a relative path, prepend the font directory.
if(string_get_character(*name, 0) != '/') {
String_Const_u8 binary = system_get_path(arena, SystemPath_Binary);
*name = push_u8_stringf(arena, "%.*sfonts/%.*s", string_expand(binary), string_expand(*name));
}
Face* result = ft__font_make_face(arena, &local_description, scale_factor);
if(!result) {
// is this fatal? 4ed.cpp:277 (caller) does not check for null.
char msg[4096];
snprintf(msg, sizeof(msg), "Unable to load font: %.*s", string_expand(*name));
system_error_box(msg);
}
return(result);
}
@ -1740,7 +1742,7 @@ main(int argc, char **argv){
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&linuxvars.memory_tracker_mutex, &attr);
pthread_mutex_init(&linuxvars.audio_mutex, &attr);
pthread_cond_init(&linuxvars.audio_cond, NULL);
@ -1786,7 +1788,7 @@ main(int argc, char **argv){
List_String_Const_u8 search_list = {};
def_search_list_add_system_path(scratch, &search_list, SystemPath_Binary);
String_Const_u8 core_path = def_get_full_path(scratch, &search_list, SCu8("4ed_app.so"));
String_Const_u8 core_path = def_search_get_full_path(scratch, &search_list, SCu8("4ed_app.so"));
if (system_load_library(scratch, core_path, &core_library)){
get_funcs = (App_Get_Functions*)system_get_proc(core_library, "app_get_functions");
if (get_funcs != 0){
@ -1861,7 +1863,7 @@ main(int argc, char **argv){
}
String_Const_u8 custom_file_name = {};
for (i32 i = 0; i < custom_file_count; i += 1){
custom_file_name = def_get_full_path(scratch, &search_list, custom_file_names[i]);
custom_file_name = def_search_get_full_path(scratch, &search_list, custom_file_names[i]);
if (custom_file_name.size > 0){
break;
}
@ -1892,9 +1894,9 @@ main(int argc, char **argv){
linux_x11_init(argc, argv, &plat_settings);
linux_keycode_init(linuxvars.dpy);
linux_epoll_init();
linuxvars.audio_thread = system_thread_launch(&linux_audio_main, NULL);
// app init
{

View File

@ -1696,7 +1696,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
List_String_Const_u8 search_list = {};
def_search_list_add_system_path(scratch, &search_list, SystemPath_Binary);
String_Const_u8 core_path = def_get_full_path(scratch, &search_list, SCu8("4ed_app.dll"));
String_Const_u8 core_path = def_search_get_full_path(scratch, &search_list, SCu8("4ed_app.dll"));
if (system_load_library(scratch, core_path, &core_library)){
get_funcs = (App_Get_Functions*)system_get_proc(core_library, "app_get_functions");
if (get_funcs != 0){
@ -1768,7 +1768,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
}
String_Const_u8 custom_file_name = {};
for (i32 i = 0; i < custom_file_count; i += 1){
custom_file_name = def_get_full_path(scratch, &search_list, custom_file_names[i]);
custom_file_name = def_search_get_full_path(scratch, &search_list, custom_file_names[i]);
if (custom_file_name.size > 0){
break;
}