Fully upgraded project system, still needs a few rounds of revision though

This commit is contained in:
Allen Webster 2018-05-26 00:49:37 -07:00
parent 70160d16dc
commit 3c2a71d7c3
9 changed files with 1178 additions and 392 deletions

View File

@ -531,7 +531,10 @@ config_evaluate_rvalue(Config *config, Config_Assignment *assignment, Config_RVa
Config_RValue_Type type, void *out){
bool32 success = false;
if (r != 0 && !assignment->visited){
if (r->type == ConfigRValueType_LValue){
if (type == ConfigRValueType_NoType){
success = true;
}
else if (r->type == ConfigRValueType_LValue){
assignment->visited = true;
Config_LValue *l = r->lvalue;
success = config_var(config, l->identifier, l->index, type, out);
@ -539,31 +542,33 @@ config_evaluate_rvalue(Config *config, Config_Assignment *assignment, Config_RVa
}
else if (r->type == type){
success = true;
switch (type){
case ConfigRValueType_Boolean:
{
*(bool32*)out = r->boolean;
}break;
if (out != 0){
switch (type){
case ConfigRValueType_Boolean:
{
*(bool32*)out = r->boolean;
}break;
case ConfigRValueType_Integer:
{
*(int32_t*)out = r->integer;
}break;
case ConfigRValueType_Integer:
{
*(int32_t*)out = r->integer;
}break;
case ConfigRValueType_String:
{
*(String*)out = r->string;
}break;
case ConfigRValueType_String:
{
*(String*)out = r->string;
}break;
case ConfigRValueType_Character:
{
*(char*)out = r->character;
}break;
case ConfigRValueType_Character:
{
*(char*)out = r->character;
}break;
case ConfigRValueType_Compound:
{
*(Config_Compound**)out = r->compound;
}break;
case ConfigRValueType_Compound:
{
*(Config_Compound**)out = r->compound;
}break;
}
}
}
}
@ -580,87 +585,6 @@ config_var(Config *config, String var_name, int32_t subscript, Config_RValue_Typ
return(success);
}
static bool32
config_bool_var(Config *config, String var_name, int32_t subscript, bool32 *var_out){
return(config_var(config, var_name, subscript, ConfigRValueType_Boolean, var_out));
}
static bool32
config_bool_var(Config *config, char *var_name, int32_t subscript, bool32 *var_out){
return(config_var(config, make_string_slowly(var_name), subscript, ConfigRValueType_Boolean, var_out));
}
static bool32
config_int_var(Config *config, String var_name, int32_t subscript, int32_t *var_out){
return(config_var(config, var_name, subscript, ConfigRValueType_Integer, var_out));
}
static bool32
config_int_var(Config *config, char *var_name, int32_t subscript, int32_t *var_out){
return(config_var(config, make_string_slowly(var_name), subscript, ConfigRValueType_Integer, var_out));
}
static bool32
config_uint_var(Config *config, String var_name, int32_t subscript, uint32_t *var_out){
return(config_var(config, var_name, subscript, ConfigRValueType_Integer, var_out));
}
static bool32
config_uint_var(Config *config, char *var_name, int32_t subscript, uint32_t *var_out){
return(config_var(config, make_string_slowly(var_name), subscript, ConfigRValueType_Integer, var_out));
}
static bool32
config_string_var(Config *config, String var_name, int32_t subscript, String *var_out){
return(config_var(config, var_name, subscript, ConfigRValueType_String, var_out));
}
static bool32
config_string_var(Config *config, char *var_name, int32_t subscript, String *var_out){
return(config_var(config, make_string_slowly(var_name), subscript, ConfigRValueType_String, var_out));
}
static bool32
config_placed_string_var(Config *config, String var_name, int32_t subscript,
String *var_out, char *space, int32_t space_size){
*var_out = make_string_cap(space, 0, space_size);
String str = {0};
bool32 result = config_string_var(config, var_name, subscript, &str);
if (result){
copy(var_out, str);
}
return(result);
}
static bool32
config_placed_string_var(Config *config, char *var_name, int32_t subscript,
String *var_out, char *space, int32_t space_size){
return(config_placed_string_var(config, make_string_slowly(var_name), subscript,
var_out, space, space_size));
}
#define config_fixed_string_var(c,v,s,o,a) config_placed_string_var((c),(v),(s),(o),(a),sizeof(a))
static bool32
config_char_var(Config *config, String var_name, int32_t subscript, char *var_out){
return(config_var(config, var_name, subscript, ConfigRValueType_Character, var_out));
}
static bool32
config_char_var(Config *config, char *var_name, int32_t subscript, char *var_out){
return(config_var(config, make_string_slowly(var_name), subscript, ConfigRValueType_Character, var_out));
}
static bool32
config_compound_var(Config *config, String var_name, int32_t subscript, Config_Compound **var_out){
return(config_var(config, var_name, subscript, ConfigRValueType_Compound, var_out));
}
static bool32
config_compound_var(Config *config, char *var_name, int32_t subscript, Config_Compound **var_out){
return(config_var(config, make_string_slowly(var_name), subscript, ConfigRValueType_Compound, var_out));
}
static bool32
config_compound_member(Config *config, Config_Compound *compound, String var_name, int32_t index,
Config_RValue_Type type, void *var_out){
@ -698,81 +622,314 @@ config_compound_member(Config *config, Config_Compound *compound, String var_nam
if (element_matches_query){
Config_Assignment dummy_assignment = {0};
success = config_evaluate_rvalue(config, &dummy_assignment, element->r, type, var_out);
break;
}
}
return(success);
}
static Iteration_Step_Result
typed_array_iteration_step(Config *parsed, Config_Compound *compound, Config_RValue_Type type,
int32_t index, void *var_out);
static int32_t
typed_array_get_count(Config *parsed, Config_Compound *compound, Config_RValue_Type type);
#define config_fixed_string_var(c,v,s,o,a) config_placed_string_var((c),(v),(s),(o),(a),sizeof(a))
////////////////////////////////
static bool32
config_compound_bool_member(Config *config, Config_Compound *compound,
String var_name, int32_t index, bool32 *var_out){
return(config_compound_member(config, compound, var_name, index, ConfigRValueType_Boolean, var_out));
config_has_var(Config *config, String var_name, int32_t subscript){
bool32 result = config_var(config, var_name, subscript, ConfigRValueType_NoType, 0);
return(result);
}
static bool32
config_has_var(Config *config, char *var_name, int32_t subscript){
String var_name_str = make_string_slowly(var_name);
bool32 result = config_var(config, var_name_str, subscript, ConfigRValueType_NoType, 0);
return(result);
}
static bool32
config_bool_var(Config *config, String var_name, int32_t subscript, bool32* var_out){
bool32 result = config_var(config, var_name, subscript, ConfigRValueType_Boolean, var_out);
return(result);
}
static bool32
config_bool_var(Config *config, char *var_name, int32_t subscript, bool32* var_out){
String var_name_str = make_string_slowly(var_name);
bool32 result = config_var(config, var_name_str, subscript, ConfigRValueType_Boolean, var_out);
return(result);
}
static bool32
config_int_var(Config *config, String var_name, int32_t subscript, int32_t* var_out){
bool32 result = config_var(config, var_name, subscript, ConfigRValueType_Integer, var_out);
return(result);
}
static bool32
config_int_var(Config *config, char *var_name, int32_t subscript, int32_t* var_out){
String var_name_str = make_string_slowly(var_name);
bool32 result = config_var(config, var_name_str, subscript, ConfigRValueType_Integer, var_out);
return(result);
}
static bool32
config_uint_var(Config *config, String var_name, int32_t subscript, uint32_t* var_out){
bool32 result = config_var(config, var_name, subscript, ConfigRValueType_Integer, var_out);
return(result);
}
static bool32
config_uint_var(Config *config, char *var_name, int32_t subscript, uint32_t* var_out){
String var_name_str = make_string_slowly(var_name);
bool32 result = config_var(config, var_name_str, subscript, ConfigRValueType_Integer, var_out);
return(result);
}
static bool32
config_string_var(Config *config, String var_name, int32_t subscript, String* var_out){
bool32 result = config_var(config, var_name, subscript, ConfigRValueType_String, var_out);
return(result);
}
static bool32
config_string_var(Config *config, char *var_name, int32_t subscript, String* var_out){
String var_name_str = make_string_slowly(var_name);
bool32 result = config_var(config, var_name_str, subscript, ConfigRValueType_String, var_out);
return(result);
}
static bool32
config_placed_string_var(Config *config, String var_name, int32_t subscript, String* var_out, char *space, int32_t space_size){
bool32 result = config_var(config, var_name, subscript, ConfigRValueType_String, var_out);
if (result){
String str = *var_out;
*var_out = make_string_cap(space, 0, space_size);
copy(var_out, str);
}
return(result);
}
static bool32
config_placed_string_var(Config *config, char *var_name, int32_t subscript, String* var_out, char *space, int32_t space_size){
String var_name_str = make_string_slowly(var_name);
bool32 result = config_var(config, var_name_str, subscript, ConfigRValueType_String, var_out);
if (result){
String str = *var_out;
*var_out = make_string_cap(space, 0, space_size);
copy(var_out, str);
}
return(result);
}
static bool32
config_char_var(Config *config, String var_name, int32_t subscript, char* var_out){
bool32 result = config_var(config, var_name, subscript, ConfigRValueType_Character, var_out);
return(result);
}
static bool32
config_char_var(Config *config, char *var_name, int32_t subscript, char* var_out){
String var_name_str = make_string_slowly(var_name);
bool32 result = config_var(config, var_name_str, subscript, ConfigRValueType_Character, var_out);
return(result);
}
static bool32
config_compound_var(Config *config, String var_name, int32_t subscript, Config_Compound** var_out){
bool32 result = config_var(config, var_name, subscript, ConfigRValueType_Compound, var_out);
return(result);
}
static bool32
config_compound_var(Config *config, char *var_name, int32_t subscript, Config_Compound** var_out){
String var_name_str = make_string_slowly(var_name);
bool32 result = config_var(config, var_name_str, subscript, ConfigRValueType_Compound, var_out);
return(result);
}
static bool32
config_compound_has_member(Config *config, Config_Compound *compound,
String var_name, int32_t index){
bool32 result = config_compound_member(config, compound, var_name, index,
ConfigRValueType_NoType, 0);
return(result);
}
static bool32
config_compound_has_member(Config *config, Config_Compound *compound,
char *var_name, int32_t index){
String var_name_str = make_string_slowly(var_name);
bool32 result = config_compound_member(config, compound, var_name_str, index,
ConfigRValueType_NoType, 0);
return(result);
}
static bool32
config_compound_bool_member(Config *config, Config_Compound *compound,
char *var_name, int32_t index, bool32 *var_out){
return(config_compound_member(config, compound, make_string_slowly(var_name), index, ConfigRValueType_Boolean, var_out));
String var_name, int32_t index, bool32* var_out){
bool32 result = config_compound_member(config, compound, var_name, index,
ConfigRValueType_Boolean, var_out);
return(result);
}
static bool32
config_compound_bool_member(Config *config, Config_Compound *compound,
char *var_name, int32_t index, bool32* var_out){
String var_name_str = make_string_slowly(var_name);
bool32 result = config_compound_member(config, compound, var_name_str, index,
ConfigRValueType_Boolean, var_out);
return(result);
}
static bool32
config_compound_int_member(Config *config, Config_Compound *compound,
String var_name, int32_t index, int32_t *var_out){
return(config_compound_member(config, compound, var_name, index, ConfigRValueType_Integer, var_out));
String var_name, int32_t index, int32_t* var_out){
bool32 result = config_compound_member(config, compound, var_name, index,
ConfigRValueType_Integer, var_out);
return(result);
}
static bool32
config_compound_int_member(Config *config, Config_Compound *compound,
char *var_name, int32_t index, int32_t *var_out){
return(config_compound_member(config, compound, make_string_slowly(var_name), index, ConfigRValueType_Integer, var_out));
char *var_name, int32_t index, int32_t* var_out){
String var_name_str = make_string_slowly(var_name);
bool32 result = config_compound_member(config, compound, var_name_str, index,
ConfigRValueType_Integer, var_out);
return(result);
}
static bool32
config_compound_uint_member(Config *config, Config_Compound *compound,
String var_name, int32_t index, uint32_t *var_out){
return(config_compound_member(config, compound, var_name, index, ConfigRValueType_Integer, var_out));
String var_name, int32_t index, uint32_t* var_out){
bool32 result = config_compound_member(config, compound, var_name, index,
ConfigRValueType_Integer, var_out);
return(result);
}
static bool32
config_compound_uint_member(Config *config, Config_Compound *compound,
char *var_name, int32_t index, uint32_t *var_out){
return(config_compound_member(config, compound, make_string_slowly(var_name), index, ConfigRValueType_Integer, var_out));
char *var_name, int32_t index, uint32_t* var_out){
String var_name_str = make_string_slowly(var_name);
bool32 result = config_compound_member(config, compound, var_name_str, index,
ConfigRValueType_Integer, var_out);
return(result);
}
static bool32
config_compound_string_member(Config *config, Config_Compound *compound,
String var_name, int32_t index, String *var_out){
return(config_compound_member(config, compound, var_name, index, ConfigRValueType_String, var_out));
String var_name, int32_t index, String* var_out){
bool32 result = config_compound_member(config, compound, var_name, index,
ConfigRValueType_String, var_out);
return(result);
}
static bool32
config_compound_string_member(Config *config, Config_Compound *compound,
char *var_name, int32_t index, String *var_out){
return(config_compound_member(config, compound, make_string_slowly(var_name), index, ConfigRValueType_String, var_out));
char *var_name, int32_t index, String* var_out){
String var_name_str = make_string_slowly(var_name);
bool32 result = config_compound_member(config, compound, var_name_str, index,
ConfigRValueType_String, var_out);
return(result);
}
static bool32
config_compound_placed_string_member(Config *config, Config_Compound *compound,
String var_name, int32_t index, String* var_out, char *space, int32_t space_size){
bool32 result = config_compound_member(config, compound, var_name, index,
ConfigRValueType_String, var_out);
if (result){
String str = *var_out;
*var_out = make_string_cap(space, 0, space_size);
copy(var_out, str);
}
return(result);
}
static bool32
config_compound_placed_string_member(Config *config, Config_Compound *compound,
char *var_name, int32_t index, String* var_out, char *space, int32_t space_size){
String var_name_str = make_string_slowly(var_name);
bool32 result = config_compound_member(config, compound, var_name_str, index,
ConfigRValueType_String, var_out);
if (result){
String str = *var_out;
*var_out = make_string_cap(space, 0, space_size);
copy(var_out, str);
}
return(result);
}
static bool32
config_compound_char_member(Config *config, Config_Compound *compound,
String var_name, int32_t index, char *var_out){
return(config_compound_member(config, compound, var_name, index, ConfigRValueType_Character, var_out));
String var_name, int32_t index, char* var_out){
bool32 result = config_compound_member(config, compound, var_name, index,
ConfigRValueType_Character, var_out);
return(result);
}
static bool32
config_compound_char_member(Config *config, Config_Compound *compound,
char *var_name, int32_t index, char *var_out){
return(config_compound_member(config, compound, make_string_slowly(var_name), index, ConfigRValueType_Character, var_out));
char *var_name, int32_t index, char* var_out){
String var_name_str = make_string_slowly(var_name);
bool32 result = config_compound_member(config, compound, var_name_str, index,
ConfigRValueType_Character, var_out);
return(result);
}
static bool32
config_compound_compound_member(Config *config, Config_Compound *compound,
String var_name, int32_t index, Config_Compound **var_out){
return(config_compound_member(config, compound, var_name, index, ConfigRValueType_Compound, var_out));
String var_name, int32_t index, Config_Compound** var_out){
bool32 result = config_compound_member(config, compound, var_name, index,
ConfigRValueType_Compound, var_out);
return(result);
}
static bool32
config_compound_compound_member(Config *config, Config_Compound *compound,
char *var_name, int32_t index, Config_Compound **var_out){
return(config_compound_member(config, compound, make_string_slowly(var_name), index, ConfigRValueType_Compound, var_out));
char *var_name, int32_t index, Config_Compound** var_out){
String var_name_str = make_string_slowly(var_name);
bool32 result = config_compound_member(config, compound, var_name_str, index,
ConfigRValueType_Compound, var_out);
return(result);
}
////////////////////////////////
static Iteration_Step_Result
typed_array_iteration_step(Config *parsed, Config_Compound *compound, Config_RValue_Type type,
int32_t index, void *var_out){
Iteration_Step_Result result = Iteration_Good;
if (!config_compound_member(parsed, compound, make_lit_string("~"), index, type, var_out)){
if (config_compound_has_member(parsed, compound, "~", index)){
result = Iteration_Skip;
}
else{
result = Iteration_Quit;
}
}
return(result);
}
static int32_t
typed_array_get_count(Config *parsed, Config_Compound *compound, Config_RValue_Type type){
int32_t count = 0;
for (int32_t i = 0;; ++i){
Iteration_Step_Result step_result = typed_array_iteration_step(parsed, compound, type, i, 0);
if (step_result == Iteration_Skip){
continue;
}
else if (step_result == Iteration_Quit){
break;
}
count += 1;
}
return(count);
}
////////////////////////////////
@ -894,23 +1051,23 @@ config_parse__data(Partition *arena, String file_name, String data, Config_Data
config_int_var(parsed, "default_min_base_width", 0, &config->default_min_base_width);
config_fixed_string_var(parsed, "default_theme_name", 0,
&config->default_theme_name, config->default_theme_name_space);
&config->default_theme_name, config->default_theme_name_space);
config_fixed_string_var(parsed, "default_font_name", 0,
&config->default_font_name, config->default_font_name_space);
&config->default_font_name, config->default_font_name_space);
config_fixed_string_var(parsed, "user_name", 0,
&config->user_name, config->user_name_space);
&config->user_name, config->user_name_space);
config_fixed_string_var(parsed, "default_compiler_bat", 0,
&config->default_compiler_bat, config->default_compiler_bat_space);
&config->default_compiler_bat, config->default_compiler_bat_space);
config_fixed_string_var(parsed, "default_flags_bat", 0,
&config->default_flags_bat, config->default_flags_bat_space);
&config->default_flags_bat, config->default_flags_bat_space);
config_fixed_string_var(parsed, "default_compiler_sh", 0,
&config->default_compiler_sh, config->default_compiler_sh_space);
&config->default_compiler_sh, config->default_compiler_sh_space);
config_fixed_string_var(parsed, "default_flags_sh", 0,
&config->default_flags_sh, config->default_flags_sh_space);
&config->default_flags_sh, config->default_flags_sh_space);
config_fixed_string_var(parsed, "mapping", 0,
&config->current_mapping, config->current_mapping_space);
&config->current_mapping, config->current_mapping_space);
String str;
if (config_string_var(parsed, "treat_as_code", 0, &str)){
@ -997,7 +1154,7 @@ theme_parse__file_handle(Partition *arena, String file_name, FILE *file, Theme_D
String data = dump_file_handle(arena, file);
Config *parsed = 0;
if (data.str != 0){
parsed = theme_parse__data(arena, file_name, data, theme);
parsed = theme_parse__data(arena, file_name, data, theme);
}
return(parsed);
}

View File

@ -27,9 +27,9 @@ struct Config_Error{
struct Config_Parser{
Cpp_Token *start;
Cpp_Token *token;
Cpp_Token *end;
Cpp_Token *end;
String file_name;
String file_name;
String data;
Partition *arena;
@ -37,7 +37,7 @@ Cpp_Token *end;
Config_Error *first_error;
Config_Error *last_error;
int32_t count_error;
};
};
struct Config_LValue{
String identifier;
@ -53,7 +53,10 @@ enum{
ConfigRValueType_String = 4,
ConfigRValueType_Character = 5,
ConfigRValueType_Compound = 6,
ConfigRValueType_COUNT = 7,
ConfigRValueType_NoType = 7,
};
enum{
ConfigRValueType_COUNT = ConfigRValueType_NoType,
};
struct Config_Compound{
@ -148,19 +151,19 @@ struct Config_Data{
bool32 enable_code_wrapping;
bool32 automatically_adjust_wrapping;
bool32 automatically_indent_text_on_save;
bool32 automatically_indent_text_on_save;
bool32 automatically_save_changes_on_build;
bool32 automatically_load_project;
bool32 lalt_lctrl_is_altgr;
char default_theme_name_space[256];
String default_theme_name;
char default_theme_name_space[256];
String default_theme_name;
char default_font_name_space[256];
String default_font_name;
char default_font_name_space[256];
String default_font_name;
char user_name_space[256];
String user_name;
char user_name_space[256];
String user_name;
char default_compiler_bat_space[256];
String default_compiler_bat;
@ -178,7 +181,7 @@ struct Config_Data{
String current_mapping;
Extension_List code_exts;
};
};
struct Theme_Data{
char space[128];

View File

@ -229,7 +229,7 @@ static Command_Metadata fcoder_metacmd_table[193] = {
{ PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 368 },
{ PROC_LINKS(click_set_cursor, 0), "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 174 },
{ PROC_LINKS(click_set_mark, 0), "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 187 },
{ PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 380 },
{ PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 879 },
{ PROC_LINKS(close_build_panel, 0), "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "C:\\work\\4ed\\code\\4coder_build_commands.cpp", 46, 205 },
{ PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 441 },
{ PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "C:\\work\\4ed\\code\\4coder_clipboard.cpp", 41, 26 },
@ -295,7 +295,7 @@ static Command_Metadata fcoder_metacmd_table[193] = {
{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), "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, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 800 },
{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 747 },
{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), "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, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 759 },
{ PROC_LINKS(load_project, 0), "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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 403 },
{ PROC_LINKS(load_project, 0), "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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 902 },
{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1101 },
{ PROC_LINKS(miblo_decrement_basic, 0), "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "C:\\work\\4ed\\code\\4coder_miblo_numbers.cpp", 45, 110 },
{ PROC_LINKS(miblo_decrement_time_stamp, 0), "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "C:\\work\\4ed\\code\\4coder_miblo_numbers.cpp", 45, 383 },
@ -317,8 +317,8 @@ static Command_Metadata fcoder_metacmd_table[193] = {
{ PROC_LINKS(newline_or_goto_position_same_panel_direct, 0), "newline_or_goto_position_same_panel_direct", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "C:\\work\\4ed\\code\\4coder_jump_direct.cpp", 43, 116 },
{ PROC_LINKS(newline_or_goto_position_same_panel_sticky, 0), "newline_or_goto_position_same_panel_sticky", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 571 },
{ PROC_LINKS(newline_or_goto_position_sticky, 0), "newline_or_goto_position_sticky", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 556 },
{ PROC_LINKS(open_all_code, 0), "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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 387 },
{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 394 },
{ PROC_LINKS(open_all_code, 0), "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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 886 },
{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 893 },
{ PROC_LINKS(open_color_tweaker, 0), "open_color_tweaker", 18, "Opens the 4coder colors and fonts selector menu.", 48, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1457 },
{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1320 },
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Switches to the next active panel and begins an open file dialogue.", 67, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1465 },
@ -335,8 +335,8 @@ static Command_Metadata fcoder_metacmd_table[193] = {
{ PROC_LINKS(paste_next, 0), "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "C:\\work\\4ed\\code\\4coder_clipboard.cpp", 41, 84 },
{ PROC_LINKS(paste_next_and_indent, 0), "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "C:\\work\\4ed\\code\\4coder_clipboard.cpp", 41, 135 },
{ PROC_LINKS(place_in_scope, 0), "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 481 },
{ PROC_LINKS(project_fkey_command, 0), "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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 410 },
{ PROC_LINKS(project_go_to_root_directory, 0), "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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 435 },
{ PROC_LINKS(project_fkey_command, 0), "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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 909 },
{ PROC_LINKS(project_go_to_root_directory, 0), "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, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 934 },
{ PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 893 },
{ PROC_LINKS(query_replace_identifier, 0), "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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 913 },
{ PROC_LINKS(query_replace_selection, 0), "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, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 931 },
@ -378,7 +378,7 @@ static Command_Metadata fcoder_metacmd_table[193] = {
{ PROC_LINKS(set_bindings_default, 0), "set_bindings_default", 20, "Remap keybindings using the 'default' mapping rule.", 51, "C:\\work\\4ed\\code\\4coder_remapping_commands.cpp", 50, 61 },
{ PROC_LINKS(set_bindings_mac_default, 0), "set_bindings_mac_default", 24, "Remap keybindings using the 'mac-default' mapping rule.", 55, "C:\\work\\4ed\\code\\4coder_remapping_commands.cpp", 50, 75 },
{ PROC_LINKS(set_mark, 0), "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 86 },
{ PROC_LINKS(setup_new_project, 0), "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 482 },
{ PROC_LINKS(setup_new_project, 0), "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 982 },
{ PROC_LINKS(show_filebar, 0), "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 464 },
{ PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 450 },
{ PROC_LINKS(snipe_token_or_word, 0), "snipe_token_or_word", 19, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "C:\\work\\4ed\\code\\4coder_seek.cpp", 36, 1259 },

View File

@ -1121,10 +1121,10 @@ lexer_keywords_default_init(Partition *arena, Cpp_Keyword_Table *kw_out, Cpp_Key
void *kw_mem = push_array(arena, char, (i32_4tech)kw_size);
void *pp_mem = push_array(arena, char, (i32_4tech)pp_size);
if (kw_mem != 0 && pp_mem != 0){
*kw_out = cpp_make_table_default(CPP_TABLE_KEYWORDS, kw_mem, kw_size);
*pp_out = cpp_make_table_default(CPP_TABLE_PREPROCESSOR_DIRECTIVES, pp_mem, pp_size);
*kw_out = cpp_make_table_default(CPP_TABLE_KEYWORDS, kw_mem, kw_size);
*pp_out = cpp_make_table_default(CPP_TABLE_PREPROCESSOR_DIRECTIVES, pp_mem, pp_size);
success = true;
}
}
return(success);
}
@ -1191,8 +1191,8 @@ open_file_try_current_path_then_binary_path(Application_Links *app, char *file_n
append(&str, "/");
append(&str, file_name);
if (terminate_with_null(&str)){
file = fopen(str.str, "rb");
}
file = fopen(str.str, "rb");
}
}
return(file);
}
@ -1232,7 +1232,7 @@ dump_file(Partition *arena, String file_name){
FILE *file = open_file(arena, file_name);
if (file != 0){
result.file_name = file_name;
result.data = dump_file_handle(arena, file);
result.data = dump_file_handle(arena, file);
fclose(file);
}
return(result);
@ -1251,5 +1251,29 @@ dump_file_search_up_path(Partition *arena, String path, String file_name){
return(result);
}
static String
push_string(Partition *arena, int32_t cap){
char *mem = push_array(arena, char, cap);
String result = {0};
if (mem != 0){
result = make_string_cap(mem, 0, cap);
}
return(result);
}
static String
push_string_copy(Partition *arena, String str){
String result = {0};
if (str.str != 0){
result = push_string(arena, str.size + 1);
push_align(arena, 8);
if (result.str != 0){
copy(&result, str);
terminate_with_null(&result);
}
}
return(result);
}
// BOTTOM

File diff suppressed because it is too large Load Diff

View File

@ -15,23 +15,65 @@ enum{
///////////////////////////////
struct Fkey_Command{
char command[128];
char out[128];
bool32 use_build_panel;
bool32 save_dirty_buffers;
typedef int32_t Iteration_Step_Result;
enum{
Iteration_Good = 0,
Iteration_Skip = 1,
Iteration_Quit = 2,
};
///////////////////////////////
struct Project_Command{
String name;
String cmd;
String out;
bool32 footer_panel;
bool32 save_dirty_files;
};
struct Project_Command_Array{
Project_Command *commands;
int32_t count;
};
struct Project_File_Load_Path{
String path;
bool32 recursive;
bool32 relative;
};
struct Project_File_Load_Path_Array{
Project_File_Load_Path *paths;
int32_t count;
};
struct Project_File_Pattern{
Absolutes absolutes;
};
struct Project_File_Pattern_Array{
Project_File_Pattern *patterns;
int32_t count;
};
struct Project{
char dir_space[256];
char *dir;
int32_t dir_len;
Extension_List extension_list;
Fkey_Command fkey_commands[16];
bool32 open_recursively;
bool32 loaded;
String dir;
String name;
Project_File_Pattern_Array pattern_array;
Project_File_Pattern_Array blacklist_pattern_array;
Project_File_Load_Path_Array load_path_array;
Project_Command_Array command_array;
int32_t fkey_commands[16];
};
struct Project_Parse_Result{
Config *parsed;
Project *project;
};
///////////////////////////////

View File

@ -614,7 +614,7 @@ buffered_print_match_jump_line(Application_Links *app, Partition *part, Temp_Mem
static void
list__parameters(Application_Links *app, General_Memory *general, Partition *scratch,
String *strings, int32_t count, Search_Range_Flag match_flags){
String *strings, int32_t count, Search_Range_Flag match_flags){
// Open the search buffer
String search_name = make_lit_string("*search*");
Buffer_Summary search_buffer = get_buffer_by_name(app, search_name.str, search_name.size, AccessAll);
@ -674,7 +674,7 @@ list_single__parameters(Application_Links *app, General_Memory *general, Partiti
static void
list_query__parameters(Application_Links *app, General_Memory *general, Partition *scratch,
bool32 substrings, bool32 case_insensitive){
bool32 substrings, bool32 case_insensitive){
char space[1024];
String str = get_query_string(app, "List Locations For: ", space, sizeof(space));
if (str.str != 0){
@ -685,7 +685,7 @@ list_query__parameters(Application_Links *app, General_Memory *general, Partitio
static void
list_identifier__parameters(Application_Links *app, General_Memory *general, Partition *scratch,
bool32 substrings, bool32 case_insensitive){
bool32 substrings, bool32 case_insensitive){
View_Summary view = get_active_view(app, AccessProtected);
Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected);
if (!buffer.exists) return;
@ -699,7 +699,7 @@ list_identifier__parameters(Application_Links *app, General_Memory *general, Par
static void
list_selected_range__parameters(Application_Links *app, General_Memory *general, Partition *scratch,
bool32 substrings, bool32 case_insensitive){
bool32 substrings, bool32 case_insensitive){
View_Summary view = get_active_view(app, AccessProtected);
Temp_Memory temp = begin_temp_memory(scratch);
String str = get_string_in_view_range(app, scratch, &view);
@ -724,7 +724,7 @@ list_type_definition__parameters(Application_Links *app, General_Memory *general
match_strings[5] = build_string(scratch, "enum " , str, "\n{");
list__parameters(app, general, scratch,
match_strings, ArrayCount(match_strings), 0);
match_strings, ArrayCount(match_strings), 0);
end_temp_memory(temp);
@ -748,13 +748,13 @@ CUSTOM_COMMAND_SIG(list_all_substring_locations)
CUSTOM_DOC("Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.")
{
list_query__parameters(app, &global_general, &global_part, true, false);
}
}
CUSTOM_COMMAND_SIG(list_all_locations_case_insensitive)
CUSTOM_DOC("Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.")
{
list_query__parameters(app, &global_general, &global_part, false, true);
}
}
CUSTOM_COMMAND_SIG(list_all_substring_locations_case_insensitive)
CUSTOM_DOC("Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.")
@ -793,8 +793,8 @@ CUSTOM_DOC("Queries user for string, lists all locations of strings that appear
String str = get_query_string(app, "List Definitions For: ", space, sizeof(space));
if (str.str != 0){
change_active_panel(app);
list_type_definition__parameters(app, &global_general, &global_part, str);
}
list_type_definition__parameters(app, &global_general, &global_part, str);
}
}
CUSTOM_COMMAND_SIG(list_all_locations_of_type_definition_of_identifier)

28
my_bindings.cpp Normal file
View File

@ -0,0 +1,28 @@
/*
New File
*/
#include "4coder_default_include.cpp"
extern "C" int32_t
get_bindings(void *data, int32_t size){
Bind_Helper context_ = begin_bind_helper(data, size);
Bind_Helper *context = &context_;
set_all_default_hooks(context);
default_keys(context);
begin_map(context, mapid_global);
bind(context, 'M', MDFR_ALT, goto_prev_jump_no_skips_sticky);
bind(context, 'N', MDFR_ALT, goto_first_jump_sticky);
end_map(context);
begin_map(context, mapid_file);
end_map(context);
begin_map(context, default_code_map);
end_map(context);
int32_t result = end_bind_helper(context);
return(result);
}

View File

@ -1,34 +1,66 @@
extensions = ".c.cpp.h.m.bat.sh.4coder.txt";
open_recursively = true;
version(1);
project_name = "4coder";
patterns = {
"*.c",
"*.cpp",
"*.h",
"*.m",
"*.bat",
"*.sh",
"*.4coder",
"*.txt",
};
blacklist_patterns = {
".*",
};
load_paths_only = { {"."}, };
load_paths = {
{load_paths_only, .os = "win"},
{load_paths_only, .os = "linux"},
{load_paths_only, .os = "mac"},
};
build_x86_win32 = "echo build: x86 & build.bat /DDEV_BUILD_X86";
build_x86_linux = "echo build: x86 & ./build.sh -DDEV_BUILD_X86";
build_x86_mac = "echo build: x86 & ./build.sh -DDEV_BUILD_X86";
fkey_command_win[1] = {"echo build: x64 & build.bat", "*compilation*" , .footer_panel = true , .save_dirty_files = true };
fkey_command_win[2] = {"build_site.bat" , "*site*" , .footer_panel = false, .save_dirty_files = true };
fkey_command_win[3] = {"build_string.bat" , "*compilation*" , .footer_panel = true , .save_dirty_files = true };
fkey_command_win[4] = {build_x86_win32 , "*compilation*" , .footer_panel = true, .save_dirty_files = true };
fkey_command_win[5] = {"build_metadata.bat" , "*compilation*" , .footer_panel = true , .save_dirty_files = true };
fkey_command_win[6] = {"run_regression_tests.bat" , "*test*" , .footer_panel = false, .save_dirty_files = true };
fkey_command_win[7] = {"build_tests.bat" , "*compilation*" , .footer_panel = true , .save_dirty_files = true };
fkey_command_win[8] = {"generate_tests.bat" , "*compilation*" , .footer_panel = true , .save_dirty_files = true };
fkey_command_win[12] = {"package.bat" , "*package*" , .footer_panel = false, .save_dirty_files = true };
command_list = {
{ .name = "build x64",
.out = "*compilation*", .footer_panel = true, .save_dirty_files = true,
.cmd = { {"echo build: x64 & build.bat" , .os = "win" },
{"echo build: x64 & ./build.sh", .os = "linux"},
{"echo build: x64 & ./build.sh", .os = "mac" }, }, },
{ .name = "build site",
.out = "*site*", .footer_panel = false, .save_dirty_files = true,
.cmd = { {"build_site.bat", .os = "win" },
{"build_site.sh" , .os = "linux"},
{"build_site.sh" , .os = "mac" }, }, },
{ .name = "build string",
.out = "*compilation*", .footer_panel = true, .save_dirty_files = true,
.cmd = { {"build_string.bat", .os = "win" },
{"build_string.sh" , .os = "linux"},
{"build_string.sh" , .os = "mac" }, }, },
{ .name = "build x86",
.out = "*compilation*", .footer_panel = true, .save_dirty_files = true,
.cmd = { {build_x86_win32, .os = "win" },
{build_x86_linux, .os = "linux"},
{build_x86_mac , .os = "mac" }, }, },
{ .name = "build metadata",
.out = "*compilation*", .footer_panel = true, .save_dirty_files = true,
.cmd = { {"build_metadata.bat", .os = "win" },
{"build_metadata.sh" , .os = "linux"},
{"build_metadata.sh" , .os = "mac" }, }, },
{ .name = "package",
.out = "*package*", .footer_panel = false, .save_dirty_files = true,
.cmd = { {"package.bat", .os = "win" },
{"package.sh" , .os = "linux"},
{"package.sh" , .os = "mac" }, }, },
};
fkey_command_win[1] = {"build_tests.bat" , "*compilation*" , .footer_panel = true , .save_dirty_files = true };
fkey_command_win[2] = {"generate_tests.bat" , "*compilation*" , .footer_panel = true , .save_dirty_files = true };
fkey_command_win[3] = {"run_regression_tests.bat" , "*test*" , .footer_panel = false, .save_dirty_files = true };
fkey_command_linux[1] = {"echo build: x64 & ./build.sh", "*compilation*" , .footer_panel = true , .save_dirty_files = true };
fkey_command_linux[2] = {"build_site.sh" , "*site*" , .footer_panel = false, .save_dirty_files = true };
fkey_command_linux[3] = {"build_string.sh" , "*compilation*" , .footer_panel = true , .save_dirty_files = true };
fkey_command_linux[4] = {build_x86_linux , "*compilation*" , .footer_panel = true , .save_dirty_files = true };
fkey_command_linux[5] = {"./build_metadata.sh" , "*compilation*" , .footer_panel = true , .save_dirty_files = true };
fkey_command_linux[12] = {"./package.sh" , "*package*" , .footer_panel = false, .save_dirty_files = true };
fkey_command_mac[1] = {"echo build: x64 & ./build.sh", "*compilation*" , .footer_panel = true , .save_dirty_files = true };
fkey_command_mac[2] = {"build_site.sh" , "*site*" , .footer_panel = false, .save_dirty_files = true };
fkey_command_mac[3] = {"build_string.sh" , "*compilation*" , .footer_panel = true , .save_dirty_files = true };
fkey_command_mac[4] = {build_x86_mac , "*compilation*" , .footer_panel = true , .save_dirty_files = true };
fkey_command_mac[10] = {"./package.sh" , "*package*" , .footer_panel = false, .save_dirty_files = true };
fkey_command[1] = "build x64";
fkey_command[2] = "build site";
fkey_command[3] = "build string";
fkey_command[4] = "build x86";
fkey_command[5] = "build metadata";
fkey_command[12] = "package";