More progress on variables dump; more cleanup

master
Allen Webster 2020-11-24 17:06:12 -08:00
parent 8c5e345f66
commit d9eb312ccb
3 changed files with 18 additions and 55 deletions

View File

@ -582,6 +582,14 @@ struct Config{
String_Const_u8 file_name; String_Const_u8 file_name;
String_Const_u8 data; String_Const_u8 data;
}; };
struct Config_Compound{
struct Config_Compound_Element *first;
struct Config_Compound_Element *last;
i32 count;
};
#endif #endif
function Variable_Handle function Variable_Handle
@ -646,8 +654,8 @@ def_var_from_config(Application_Links *app, Variable_Handle parent, String_Const
}break; }break;
case ConfigRValueType_Compound: case ConfigRValueType_Compound:
case ConfigRValueType_NoType:
{ {
Variable_Handle sub_var = vars_new_variable(var, l_value);
}break; }break;
} }
@ -786,17 +794,6 @@ typed_array_reference_list(Arena *arena, Config *parsed, Config_Compound *compou
//////////////////////////////// ////////////////////////////////
function b32
config_has_var(Config *config, String_Const_u8 var_name, i32 subscript){
Config_Get_Result result = config_var(config, var_name, subscript);
return(result.success && result.type == ConfigRValueType_NoType);
}
function b32
config_has_var(Config *config, char *var_name, i32 subscript){
return(config_has_var(config, SCu8(var_name), subscript));
}
function b32 function b32
config_bool_var(Config *config, String_Const_u8 var_name, i32 subscript, b32* var_out){ config_bool_var(Config *config, String_Const_u8 var_name, i32 subscript, b32* var_out){
Config_Get_Result result = config_var(config, var_name, subscript); Config_Get_Result result = config_var(config, var_name, subscript);
@ -907,20 +904,6 @@ config_compound_var(Config *config, char *var_name, i32 subscript, Config_Compou
return(config_compound_var(config, SCu8(var_name), subscript, var_out)); return(config_compound_var(config, SCu8(var_name), subscript, var_out));
} }
function b32
config_compound_has_member(Config *config, Config_Compound *compound,
String_Const_u8 var_name, i32 index){
Config_Get_Result result = config_compound_member(config, compound, var_name, index);
b32 success = result.success && result.type == ConfigRValueType_NoType;
return(success);
}
function b32
config_compound_has_member(Config *config, Config_Compound *compound,
char *var_name, i32 index){
return(config_compound_has_member(config, compound, SCu8(var_name), index));
}
function b32 function b32
config_compound_bool_member(Config *config, Config_Compound *compound, config_compound_bool_member(Config *config, Config_Compound *compound,
String_Const_u8 var_name, i32 index, b32* var_out){ String_Const_u8 var_name, i32 index, b32* var_out){
@ -1026,12 +1009,6 @@ config_compound_compound_member(Config *config, Config_Compound *compound,
return(config_compound_compound_member(config, compound, SCu8(var_name), index, var_out)); return(config_compound_compound_member(config, compound, SCu8(var_name), index, var_out));
} }
function Iteration_Step_Result
typed_has_array_iteration_step(Config *config, Config_Compound *compound, i32 index){
Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_NoType, index);
return(result.step);
}
function Iteration_Step_Result function Iteration_Step_Result
typed_bool_array_iteration_step(Config *config, Config_Compound *compound, i32 index, b32* var_out){ typed_bool_array_iteration_step(Config *config, Config_Compound *compound, i32 index, b32* var_out){
Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Boolean, index); Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Boolean, index);
@ -1119,12 +1096,6 @@ typed_compound_array_get_count(Config *config, Config_Compound *compound){
return(count); return(count);
} }
function i32
typed_no_type_array_get_count(Config *config, Config_Compound *compound){
i32 count = typed_array_get_count(config, compound, ConfigRValueType_NoType);
return(count);
}
function Config_Get_Result_List function Config_Get_Result_List
typed_bool_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){ typed_bool_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){
Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Boolean); Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Boolean);
@ -1149,12 +1120,6 @@ typed_compound_array_reference_list(Arena *arena, Config *config, Config_Compoun
return(list); return(list);
} }
function Config_Get_Result_List
typed_no_type_array_reference_list(Arena *arena, Config *config, Config_Compound *compound){
Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_NoType);
return(list);
}
//////////////////////////////// ////////////////////////////////
function Config_Iteration_Step_Result function Config_Iteration_Step_Result
@ -1163,7 +1128,7 @@ typed_array_iteration_step(Config *parsed, Config_Compound *compound, Config_RVa
result.step = Iteration_Quit; result.step = Iteration_Quit;
Config_Get_Result get_result = config_compound_member(parsed, compound, string_u8_litexpr("~"), index); Config_Get_Result get_result = config_compound_member(parsed, compound, string_u8_litexpr("~"), index);
if (get_result.success){ if (get_result.success){
if (get_result.type == type || type == ConfigRValueType_NoType){ if (get_result.type == type){
result.step = Iteration_Good; result.step = Iteration_Good;
result.get = get_result; result.get = get_result;
} }

View File

@ -50,15 +50,13 @@ struct Config_LValue{
typedef i32 Config_RValue_Type; typedef i32 Config_RValue_Type;
enum{ enum{
ConfigRValueType_LValue = 0, ConfigRValueType_Null,
ConfigRValueType_Boolean = 1, ConfigRValueType_LValue,
ConfigRValueType_Integer = 2, ConfigRValueType_Boolean,
ConfigRValueType_String = 4, ConfigRValueType_Integer,
ConfigRValueType_Compound = 6, ConfigRValueType_String,
ConfigRValueType_NoType = 7, ConfigRValueType_Compound,
}; ConfigRValueType_COUNT
enum{
ConfigRValueType_COUNT = ConfigRValueType_NoType,
}; };
struct Config_Compound{ struct Config_Compound{

View File

@ -372,7 +372,7 @@ static Command_Metadata fcoder_metacmd_table[250] = {
{ 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, 867 }, { 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, 1702 }, { 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 },
{ 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, 1493 }, { 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, 1493 },