Setup default load path for files

master
Allen Webster 2020-11-23 22:27:33 -08:00
parent 0486e92577
commit 9bda1cf991
16 changed files with 117 additions and 57 deletions

View File

@ -59,7 +59,7 @@ main(int argc, char **argv){
printf("error: could not open input file: '%s'\n", file_name); printf("error: could not open input file: '%s'\n", file_name);
continue; continue;
} }
String_Const_u8 text = file_load_all(&arena, file); String_Const_u8 text = data_from_file(&arena, file);
fclose(file); fclose(file);
if (text.size > 0){ if (text.size > 0){
api_parse_source_add_to_list(&arena, SCu8(file_name), text, &master_list); api_parse_source_add_to_list(&arena, SCu8(file_name), text, &master_list);
@ -72,7 +72,7 @@ main(int argc, char **argv){
printf("error: could not open input file: '%s'\n", file_name); printf("error: could not open input file: '%s'\n", file_name);
continue; continue;
} }
String_Const_u8 text = file_load_all(&arena, file); String_Const_u8 text = data_from_file(&arena, file);
fclose(file); fclose(file);
if (text.size > 0){ if (text.size > 0){
api_parse_source_add_to_list(&arena, SCu8(file_name), text, &remote_list); api_parse_source_add_to_list(&arena, SCu8(file_name), text, &remote_list);

View File

@ -46,7 +46,7 @@ main(int argc, char **argv){
continue; continue;
} }
String_Const_u8 text = file_load_all(&arena, file); String_Const_u8 text = data_from_file(&arena, file);
fclose(file); fclose(file);
if (text.size > 0){ if (text.size > 0){

View File

@ -248,23 +248,18 @@ audio_clip_from_wav_data(String_Const_u8 data){
return(Result); return(Result);
} }
#include <stdlib.h>
function Audio_Clip function Audio_Clip
audio_clip_from_wav_file_name(char *file_name){ audio_clip_from_wav_FILE(Arena *arena, FILE *file){
String_Const_u8 data = {}; String_Const_u8 data = data_from_file(arena, file);
FILE *file = fopen(file_name, "rb");
if (file != 0){
fseek(file, 0, SEEK_END);
data.size = ftell(file);
data.str = (u8*)malloc(data.size);
if (data.str != 0 && data.size > 0){
fseek(file, 0, SEEK_SET);
fread(data.str, data.size, 1, file);
}
fclose(file);
}
Audio_Clip result = audio_clip_from_wav_data(data); Audio_Clip result = audio_clip_from_wav_data(data);
return(result); return(result);
} }
function Audio_Clip
audio_clip_from_wav_file_name(Arena *arena, char *file_name){
String_Const_u8 data = {};
FILE *file = fopen(file_name, "rb");
Audio_Clip result = audio_clip_from_wav_FILE(arena, file);
fclose(file);
return(result);
}

View File

@ -50,6 +50,7 @@ function void def_audio_mix_destination(i16 *dst, f32 *src, u32 sample_count);
// NOTE(allen): Loading Clip // NOTE(allen): Loading Clip
function Audio_Clip audio_clip_from_wav_data(String_Const_u8 data); function Audio_Clip audio_clip_from_wav_data(String_Const_u8 data);
function Audio_Clip audio_clip_from_wav_file_name(char *file_name); function Audio_Clip audio_clip_from_wav_FILE(Arena *arena, FILE *file);
function Audio_Clip audio_clip_from_wav_file_name(Arena *arena, char *file_name);
#endif //4CODER_AUDIO_H #endif //4CODER_AUDIO_H

View File

@ -1014,6 +1014,7 @@ default_framework_init(Application_Links *app){
initialize_managed_id_metadata(app); initialize_managed_id_metadata(app);
set_default_color_scheme(app); set_default_color_scheme(app);
heap_init(&global_heap, tctx->allocator); heap_init(&global_heap, tctx->allocator);
global_permanent_arena = make_arena_system();
global_config_arena = make_arena_system(); global_config_arena = make_arena_system();
fade_range_arena = make_arena_system(KB(8)); fade_range_arena = make_arena_system(KB(8));
} }

View File

@ -80,6 +80,7 @@ global i32 fcoder_mode = FCoderMode_Original;
global ID_Pos_Jump_Location prev_location = {}; global ID_Pos_Jump_Location prev_location = {};
global Arena global_permanent_arena = {};
global Arena global_config_arena = {}; global Arena global_config_arena = {};
global Config_Data global_config = {}; global Config_Data global_config = {};

View File

@ -22,7 +22,10 @@ CUSTOM_DOC("Default command for responding to a startup event")
{ {
def_audio_init(); def_audio_init();
Audio_Clip test_clip = audio_clip_from_wav_file_name("W:\\4ed\\audio_test\\raygun_zap.wav"); Scratch_Block scratch(app);
FILE *file = def_search_normal_fopen(scratch, "audio_test/raygun_zap.wav", "rb");
Audio_Clip test_clip = audio_clip_from_wav_FILE(&global_permanent_arena, file);
fclose(file);
local_persist Audio_Control test_control = {}; local_persist Audio_Control test_control = {};
test_control.channel_volume[0] = 1.f; test_control.channel_volume[0] = 1.f;

View File

@ -11,6 +11,9 @@
#define FCODER_TRANSITION_TO 0 #define FCODER_TRANSITION_TO 0
#endif #endif
#include <stdio.h>
#include <stdlib.h>
#include "4coder_base_types.h" #include "4coder_base_types.h"
#include "4coder_version.h" #include "4coder_version.h"
#include "4coder_table.h" #include "4coder_table.h"
@ -57,6 +60,7 @@
#include "4coder_log_parser.h" #include "4coder_log_parser.h"
#include "4coder_profile_inspect.h" #include "4coder_profile_inspect.h"
#include "4coder_tutorial.h" #include "4coder_tutorial.h"
#include "4coder_search_list.h"
//////////////////////////////// ////////////////////////////////
@ -66,6 +70,8 @@
#include "4coder_system_allocator.cpp" #include "4coder_system_allocator.cpp"
#include "generated/lexer_cpp.h" #include "generated/lexer_cpp.h"
#include "4coder_file.cpp"
#define DYNAMIC_LINK_API #define DYNAMIC_LINK_API
#include "generated/custom_api.cpp" #include "generated/custom_api.cpp"
#define DYNAMIC_LINK_API #define DYNAMIC_LINK_API
@ -131,6 +137,7 @@
#include "4coder_docs.cpp" #include "4coder_docs.cpp"
#include "4coder_variables.cpp" #include "4coder_variables.cpp"
#include "4coder_audio.cpp" #include "4coder_audio.cpp"
#include "4coder_search_list.cpp"
#include "4coder_examples.cpp" #include "4coder_examples.cpp"

View File

@ -214,10 +214,11 @@ CUSTOM_COMMAND_SIG(music_start)
CUSTOM_DOC("Starts the music.") CUSTOM_DOC("Starts the music.")
{ {
local_persist Audio_Clip the_music_clip = {}; local_persist Audio_Clip the_music_clip = {};
local_persist b32 initialized = false; if (the_music_clip.sample_count == 0){
if (!initialized){ Scratch_Block scratch(app);
initialized = true; FILE *file = def_search_normal_fopen(scratch, "audio_test/chtulthu.wav", "rb");
the_music_clip = audio_clip_from_wav_file_name("W:\\4ed\\audio_test\\chtulthu.wav"); the_music_clip = audio_clip_from_wav_FILE(&global_permanent_arena, file);
fclose(file);
} }
if (!def_audio_is_playing(&the_music_control)){ if (!def_audio_is_playing(&the_music_control)){
@ -238,10 +239,11 @@ CUSTOM_COMMAND_SIG(hit_sfx)
CUSTOM_DOC("Play the hit sound effect") CUSTOM_DOC("Play the hit sound effect")
{ {
local_persist Audio_Clip the_hit_clip = {}; local_persist Audio_Clip the_hit_clip = {};
local_persist b32 initialized = false; if (the_hit_clip.sample_count == 0){
if (!initialized){ Scratch_Block scratch(app);
initialized = true; FILE *file = def_search_normal_fopen(scratch, "audio_test/hit.wav", "rb");
the_hit_clip = audio_clip_from_wav_file_name("W:\\4ed\\audio_test\\hit.wav"); the_hit_clip = audio_clip_from_wav_FILE(&global_permanent_arena, file);
fclose(file);
} }
local_persist u32 index = 0; local_persist u32 index = 0;

View File

@ -12,14 +12,17 @@
#include <stdio.h> #include <stdio.h>
function String_Const_u8 function String_Const_u8
file_load_all(Arena *arena, FILE *file){ data_from_file(Arena *arena, FILE *file){
fseek(file, 0, SEEK_END); String_Const_u8 result = {};
u64 size = ftell(file); if (file != 0){
fseek(file, 0, SEEK_SET); fseek(file, 0, SEEK_END);
u8 *buffer = push_array(arena, u8, size + 1); result.size = ftell(file);
fread(buffer, 1, size, file); fseek(file, 0, SEEK_SET);
buffer[size] = 0; result.str = push_array(arena, u8, result.size + 1);
return(SCu8(buffer, size)); fread(result.str, 1, result.size, file);
result.str[result.size] = 0;
}
return(result);
} }
// BOTTOM // BOTTOM

View File

@ -642,6 +642,9 @@ set_current_project(Application_Links *app, Project *project, Config *parsed){
print_feedback = true; print_feedback = true;
// NOTE(allen): Set the normal search list's project slot
def_search_project_path = current_project.dir;
// Open all project files // Open all project files
for (i32 i = 0; i < current_project.load_path_array.count; ++i){ for (i32 i = 0; i < current_project.load_path_array.count; ++i){
Project_File_Load_Path *load_path = &current_project.load_path_array.paths[i]; Project_File_Load_Path *load_path = &current_project.load_path_array.paths[i];

View File

@ -10,7 +10,7 @@
// TOP // TOP
//////////////////////////////// ////////////////////////////////
// NOTE(allen): Search List Functions // NOTE(allen): Search List Builders
function void function void
def_search_list_add_path(Arena *arena, List_String_Const_u8 *list, String_Const_u8 path){ def_search_list_add_path(Arena *arena, List_String_Const_u8 *list, String_Const_u8 path){
@ -24,6 +24,17 @@ def_search_list_add_system_path(Arena *arena, List_String_Const_u8 *list, System
string_list_push(arena, list, path_string); 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 function String_Const_u8
def_get_full_path(Arena *arena, List_String_Const_u8 *list, String_Const_u8 relative){ def_get_full_path(Arena *arena, List_String_Const_u8 *list, String_Const_u8 relative){
String_Const_u8 result = {}; String_Const_u8 result = {};
@ -55,5 +66,25 @@ def_get_full_path(Arena *arena, List_String_Const_u8 *list, String_Const_u8 rela
return(result); return(result);
} }
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));
FILE *file = 0;
if (full_path.size > 0){
file = fopen((char*)full_path.str, opt);
}
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 // BOTTOM

View File

@ -12,13 +12,23 @@
#if !defined(FRED_SEARCH_LIST_H) #if !defined(FRED_SEARCH_LIST_H)
#define FRED_SEARCH_LIST_H #define FRED_SEARCH_LIST_H
////////////////////////////////
// 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_normal_load_list(Arena *arena, List_String_Const_u8 *list);
//////////////////////////////// ////////////////////////////////
// NOTE(allen): Search List Functions // NOTE(allen): Search List Functions
function void def_search_list_add_path(Arena *arena, List_String_Const_u8 *list, String_Const_u8 path); function String_Const_u8 def_search_get_full_path(Arena *arena, List_String_Const_u8 *list, String_Const_u8 file_name);
function void def_search_list_add_system_path(Arena *arena, List_String_Const_u8 *list, System_Path_Code path);
function String_Const_u8 def_get_full_path(Arena *arena, List_String_Const_u8 *list, String_Const_u8 file_name); 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 #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_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(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(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, 844 }, { 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, 847 },
{ 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, 174 }, { 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, 174 },
{ 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(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 }, { 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 },
@ -309,8 +309,8 @@ static Command_Metadata fcoder_metacmd_table[250] = {
{ PROC_LINKS(decrease_face_size, 0), false, "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 757 }, { PROC_LINKS(decrease_face_size, 0), false, "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 757 },
{ PROC_LINKS(default_file_externally_modified, 0), false, "default_file_externally_modified", 32, "Notes the external modification of attached files by printing a message.", 72, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2062 }, { PROC_LINKS(default_file_externally_modified, 0), false, "default_file_externally_modified", 32, "Notes the external modification of attached files by printing a message.", 72, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2062 },
{ PROC_LINKS(default_startup, 0), false, "default_startup", 15, "Default command for responding to a startup event", 49, "W:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 7 }, { PROC_LINKS(default_startup, 0), false, "default_startup", 15, "Default command for responding to a startup event", 49, "W:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 7 },
{ PROC_LINKS(default_try_exit, 0), false, "default_try_exit", 16, "Default command for responding to a try-exit event", 50, "W:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 34 }, { PROC_LINKS(default_try_exit, 0), false, "default_try_exit", 16, "Default command for responding to a try-exit event", 50, "W:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 37 },
{ PROC_LINKS(default_view_input_handler, 0), false, "default_view_input_handler", 26, "Input consumption loop for default view behavior", 48, "W:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 78 }, { PROC_LINKS(default_view_input_handler, 0), false, "default_view_input_handler", 26, "Input consumption loop for default view behavior", 48, "W:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 81 },
{ PROC_LINKS(delete_alpha_numeric_boundary, 0), false, "delete_alpha_numeric_boundary", 29, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 161 }, { PROC_LINKS(delete_alpha_numeric_boundary, 0), false, "delete_alpha_numeric_boundary", 29, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 161 },
{ PROC_LINKS(delete_char, 0), false, "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 79 }, { PROC_LINKS(delete_char, 0), false, "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 79 },
{ PROC_LINKS(delete_current_scope, 0), false, "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "W:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 112 }, { PROC_LINKS(delete_current_scope, 0), false, "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "W:\\4ed\\code\\custom\\4coder_scope_commands.cpp", 44, 112 },
@ -337,7 +337,7 @@ static Command_Metadata fcoder_metacmd_table[250] = {
{ PROC_LINKS(goto_prev_jump_no_skips, 0), false, "goto_prev_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 511 }, { PROC_LINKS(goto_prev_jump_no_skips, 0), false, "goto_prev_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 511 },
{ PROC_LINKS(hide_filebar, 0), false, "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 704 }, { PROC_LINKS(hide_filebar, 0), false, "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 704 },
{ PROC_LINKS(hide_scrollbar, 0), false, "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 690 }, { PROC_LINKS(hide_scrollbar, 0), false, "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "W:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 690 },
{ PROC_LINKS(hit_sfx, 0), false, "hit_sfx", 7, "Play the hit sound effect", 25, "W:\\4ed\\code\\custom\\4coder_examples.cpp", 38, 237 }, { PROC_LINKS(hit_sfx, 0), false, "hit_sfx", 7, "Play the hit sound effect", 25, "W:\\4ed\\code\\custom\\4coder_examples.cpp", 38, 238 },
{ PROC_LINKS(hms_demo_tutorial, 0), false, "hms_demo_tutorial", 17, "Tutorial for built in 4coder bindings and features.", 51, "W:\\4ed\\code\\custom\\4coder_tutorial.cpp", 38, 869 }, { PROC_LINKS(hms_demo_tutorial, 0), false, "hms_demo_tutorial", 17, "Tutorial for built in 4coder bindings and features.", 51, "W:\\4ed\\code\\custom\\4coder_tutorial.cpp", 38, 869 },
{ PROC_LINKS(if0_off, 0), false, "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "W:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 70 }, { PROC_LINKS(if0_off, 0), false, "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "W:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 70 },
{ PROC_LINKS(if_read_only_goto_position, 0), false, "if_read_only_goto_position", 26, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 564 }, { PROC_LINKS(if_read_only_goto_position, 0), false, "if_read_only_goto_position", 26, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "W:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 564 },
@ -371,7 +371,7 @@ 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_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, 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(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, 864 }, { 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, 867 },
{ 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, 1667 }, { 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, 1667 },
{ 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, 533 }, { 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, 533 },
{ 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, 545 }, { 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, 545 },
@ -413,9 +413,9 @@ static Command_Metadata fcoder_metacmd_table[250] = {
{ PROC_LINKS(multi_paste_interactive, 0), false, "multi_paste_interactive", 23, "Paste multiple lines from the clipboard history, controlled with arrow keys", 75, "W:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 371 }, { PROC_LINKS(multi_paste_interactive, 0), false, "multi_paste_interactive", 23, "Paste multiple lines from the clipboard history, controlled with arrow keys", 75, "W:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 371 },
{ 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(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_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, 231 }, { 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, 850 }, { 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, 853 },
{ 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, 856 }, { 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, 859 },
{ 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, 1574 }, { 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, 1574 },
{ 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, 2056 }, { 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, 2056 },
{ 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 }, { 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_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_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(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, 1290 }, { 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, 1293 },
{ 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, 872 }, { 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, 875 },
{ 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, 898 }, { 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, 901 },
{ 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, 1280 }, { 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, 1280 },
{ 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, 1301 }, { 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, 1301 },
{ 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, 1317 }, { 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, 1317 },
@ -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_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, 503 }, { 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, 503 },
{ 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, 497 }, { 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, 497 },
{ 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, 1239 }, { 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, 1242 },
{ 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, 1251 }, { 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, 1254 },
{ 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, 1245 }, { 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, 1248 },
{ 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, 1232 }, { 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, 1235 },
{ 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_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_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, 993 }, { 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, 993 },

View File

@ -51,7 +51,7 @@ int main(void){
} }
printf("documenting %s\n", file_name.str); printf("documenting %s\n", file_name.str);
String_Const_u8 text = file_load_all(&arena, file); String_Const_u8 text = data_from_file(&arena, file);
fclose(file); fclose(file);
API_Definition_List def_list = {}; API_Definition_List def_list = {};

View File

@ -12,6 +12,8 @@
#define FPS 60 #define FPS 60
#define frame_useconds (1000000 / FPS) #define frame_useconds (1000000 / FPS)
#include <stdio.h>
#include "4coder_base_types.h" #include "4coder_base_types.h"
#include "4coder_version.h" #include "4coder_version.h"
#include "4coder_events.h" #include "4coder_events.h"
@ -1751,6 +1753,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
List_String_Const_u8 search_list = {}; List_String_Const_u8 search_list = {};
def_search_list_add_system_path(scratch, &search_list, SystemPath_CurrentDirectory); def_search_list_add_system_path(scratch, &search_list, SystemPath_CurrentDirectory);
def_search_list_add_system_path(scratch, &search_list, SystemPath_Binary); def_search_list_add_system_path(scratch, &search_list, SystemPath_Binary);
String_Const_u8 custom_file_names[2] = {}; String_Const_u8 custom_file_names[2] = {};
i32 custom_file_count = 1; i32 custom_file_count = 1;
if (plat_settings.custom_dll != 0){ if (plat_settings.custom_dll != 0){