Moved meta generation for config system into the 4coder code base, and added refernce lists to generated operations
This commit is contained in:
parent
e7659e147b
commit
91384ca559
|
@ -624,13 +624,15 @@ config_compound_member(Config *config, Config_Compound *compound, String var_nam
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Iteration_Step_Result
|
static Config_Iteration_Step_Result
|
||||||
typed_array_iteration_step(Config *parsed, Config_Compound *compound, Config_RValue_Type type,
|
typed_array_iteration_step(Config *parsed, Config_Compound *compound, Config_RValue_Type type, int32_t index);
|
||||||
int32_t index, void *var_out);
|
|
||||||
|
|
||||||
static int32_t
|
static int32_t
|
||||||
typed_array_get_count(Config *parsed, Config_Compound *compound, Config_RValue_Type type);
|
typed_array_get_count(Config *parsed, Config_Compound *compound, Config_RValue_Type type);
|
||||||
|
|
||||||
|
static Config_Get_Result_List
|
||||||
|
typed_array_reference_list(Partition *arena, 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))
|
#define config_fixed_string_var(c,v,s,o,a) config_placed_string_var((c),(v),(s),(o),(a),sizeof(a))
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
@ -968,73 +970,85 @@ config_compound_compound_member(Config *config, Config_Compound *compound,
|
||||||
}
|
}
|
||||||
|
|
||||||
static Iteration_Step_Result
|
static Iteration_Step_Result
|
||||||
typed_has_array_iteration_step(Config *config, Config_Compound *compound,
|
typed_has_array_iteration_step(Config *config, Config_Compound *compound, int32_t index){
|
||||||
int32_t index){
|
Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_NoType, index);
|
||||||
Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_NoType,
|
return(result.step);
|
||||||
index, 0);
|
|
||||||
return(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Iteration_Step_Result
|
static Iteration_Step_Result
|
||||||
typed_bool_array_iteration_step(Config *config, Config_Compound *compound,
|
typed_bool_array_iteration_step(Config *config, Config_Compound *compound, int32_t index, bool32* var_out){
|
||||||
int32_t index, bool32* var_out){
|
Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Boolean, index);
|
||||||
Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Boolean,
|
bool32 success = (result.step == Iteration_Good);
|
||||||
index, var_out);
|
if (success){
|
||||||
return(result);
|
*var_out = result.get.boolean;
|
||||||
|
}
|
||||||
|
return(result.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Iteration_Step_Result
|
static Iteration_Step_Result
|
||||||
typed_int_array_iteration_step(Config *config, Config_Compound *compound,
|
typed_int_array_iteration_step(Config *config, Config_Compound *compound, int32_t index, int32_t* var_out){
|
||||||
int32_t index, int32_t* var_out){
|
Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Integer, index);
|
||||||
Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Integer,
|
bool32 success = (result.step == Iteration_Good);
|
||||||
index, var_out);
|
if (success){
|
||||||
return(result);
|
*var_out = result.get.integer;
|
||||||
|
}
|
||||||
|
return(result.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Iteration_Step_Result
|
static Iteration_Step_Result
|
||||||
typed_uint_array_iteration_step(Config *config, Config_Compound *compound,
|
typed_uint_array_iteration_step(Config *config, Config_Compound *compound, int32_t index, uint32_t* var_out){
|
||||||
int32_t index, uint32_t* var_out){
|
Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Integer, index);
|
||||||
Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Integer,
|
bool32 success = (result.step == Iteration_Good);
|
||||||
index, var_out);
|
if (success){
|
||||||
return(result);
|
*var_out = result.get.uinteger;
|
||||||
|
}
|
||||||
|
return(result.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Iteration_Step_Result
|
static Iteration_Step_Result
|
||||||
typed_string_array_iteration_step(Config *config, Config_Compound *compound,
|
typed_string_array_iteration_step(Config *config, Config_Compound *compound, int32_t index, String* var_out){
|
||||||
int32_t index, String* var_out){
|
Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_String, index);
|
||||||
Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_String,
|
bool32 success = (result.step == Iteration_Good);
|
||||||
index, var_out);
|
if (success){
|
||||||
return(result);
|
*var_out = result.get.string;
|
||||||
|
}
|
||||||
|
return(result.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Iteration_Step_Result
|
static Iteration_Step_Result
|
||||||
typed_placed_string_array_iteration_step(Config *config, Config_Compound *compound,
|
typed_placed_string_array_iteration_step(Config *config, Config_Compound *compound, int32_t index, String* var_out
|
||||||
int32_t index, String* var_out, char *space, int32_t space_size){
|
, char *space, int32_t space_size){
|
||||||
Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_String,
|
Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_String, index);
|
||||||
index, var_out);
|
bool32 success = (result.step == Iteration_Good);
|
||||||
bool32 success = (result == Iteration_Good);
|
if (success){
|
||||||
|
*var_out = result.get.string;
|
||||||
|
}
|
||||||
if (success){
|
if (success){
|
||||||
String str = *var_out;
|
String str = *var_out;
|
||||||
*var_out = make_string_cap(space, 0, space_size);
|
*var_out = make_string_cap(space, 0, space_size);
|
||||||
copy(var_out, str);
|
copy(var_out, str);
|
||||||
}
|
}
|
||||||
return(result);
|
return(result.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Iteration_Step_Result
|
static Iteration_Step_Result
|
||||||
typed_char_array_iteration_step(Config *config, Config_Compound *compound,
|
typed_char_array_iteration_step(Config *config, Config_Compound *compound, int32_t index, char* var_out){
|
||||||
int32_t index, char* var_out){
|
Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Character, index);
|
||||||
Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Character,
|
bool32 success = (result.step == Iteration_Good);
|
||||||
index, var_out);
|
if (success){
|
||||||
return(result);
|
*var_out = result.get.character;
|
||||||
|
}
|
||||||
|
return(result.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Iteration_Step_Result
|
static Iteration_Step_Result
|
||||||
typed_compound_array_iteration_step(Config *config, Config_Compound *compound,
|
typed_compound_array_iteration_step(Config *config, Config_Compound *compound, int32_t index, Config_Compound** var_out){
|
||||||
int32_t index, Config_Compound** var_out){
|
Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Compound, index);
|
||||||
Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_Compound,
|
bool32 success = (result.step == Iteration_Good);
|
||||||
index, var_out);
|
if (success){
|
||||||
return(result);
|
*var_out = result.get.compound;
|
||||||
|
}
|
||||||
|
return(result.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t
|
static int32_t
|
||||||
|
@ -1079,61 +1093,76 @@ typed_no_type_array_get_count(Config *config, Config_Compound *compound){
|
||||||
return(count);
|
return(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Config_Get_Result_List
|
||||||
|
typed_bool_array_reference_list(Partition *arena, Config *config, Config_Compound *compound){
|
||||||
|
Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Boolean);
|
||||||
|
return(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Config_Get_Result_List
|
||||||
|
typed_int_array_reference_list(Partition *arena, Config *config, Config_Compound *compound){
|
||||||
|
Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Integer);
|
||||||
|
return(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Config_Get_Result_List
|
||||||
|
typed_float_array_reference_list(Partition *arena, Config *config, Config_Compound *compound){
|
||||||
|
Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Float);
|
||||||
|
return(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Config_Get_Result_List
|
||||||
|
typed_string_array_reference_list(Partition *arena, Config *config, Config_Compound *compound){
|
||||||
|
Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_String);
|
||||||
|
return(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Config_Get_Result_List
|
||||||
|
typed_character_array_reference_list(Partition *arena, Config *config, Config_Compound *compound){
|
||||||
|
Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Character);
|
||||||
|
return(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Config_Get_Result_List
|
||||||
|
typed_compound_array_reference_list(Partition *arena, Config *config, Config_Compound *compound){
|
||||||
|
Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_Compound);
|
||||||
|
return(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Config_Get_Result_List
|
||||||
|
typed_no_type_array_reference_list(Partition *arena, Config *config, Config_Compound *compound){
|
||||||
|
Config_Get_Result_List list = typed_array_reference_list(arena, config, compound, ConfigRValueType_NoType);
|
||||||
|
return(list);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
static Iteration_Step_Result
|
static Config_Iteration_Step_Result
|
||||||
typed_array_iteration_step(Config *parsed, Config_Compound *compound, Config_RValue_Type type,
|
typed_array_iteration_step(Config *parsed, Config_Compound *compound, Config_RValue_Type type, int32_t index){
|
||||||
int32_t index, void *var_out){
|
Config_Iteration_Step_Result result = {0};
|
||||||
Iteration_Step_Result step_result = Iteration_Quit;
|
result.step = Iteration_Quit;
|
||||||
Config_Get_Result result = config_compound_member(parsed, compound, make_lit_string("~"), index);
|
Config_Get_Result get_result = config_compound_member(parsed, compound, make_lit_string("~"), index);
|
||||||
if (result.success){
|
if (get_result.success){
|
||||||
if (result.type == type){
|
if (get_result.type == type || type == ConfigRValueType_NoType){
|
||||||
step_result = Iteration_Good;
|
result.step = Iteration_Good;
|
||||||
if (var_out != 0){
|
result.get = get_result;
|
||||||
switch (type){
|
|
||||||
case ConfigRValueType_Boolean:
|
|
||||||
{
|
|
||||||
*(bool32*)var_out = result.boolean;
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case ConfigRValueType_Integer:
|
|
||||||
{
|
|
||||||
*(int32_t*)var_out = result.integer;
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case ConfigRValueType_String:
|
|
||||||
{
|
|
||||||
*(String*)var_out = result.string;
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case ConfigRValueType_Character:
|
|
||||||
{
|
|
||||||
*(char*)var_out = result.character;
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case ConfigRValueType_Compound:
|
|
||||||
{
|
|
||||||
*(Config_Compound**)var_out = result.compound;
|
|
||||||
}break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
step_result = Iteration_Skip;
|
result.step = Iteration_Skip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(step_result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t
|
static int32_t
|
||||||
typed_array_get_count(Config *parsed, Config_Compound *compound, Config_RValue_Type type){
|
typed_array_get_count(Config *parsed, Config_Compound *compound, Config_RValue_Type type){
|
||||||
int32_t count = 0;
|
int32_t count = 0;
|
||||||
for (int32_t i = 0;; ++i){
|
for (int32_t i = 0;; ++i){
|
||||||
Iteration_Step_Result step_result = typed_array_iteration_step(parsed, compound, type, i, 0);
|
Config_Iteration_Step_Result result = typed_array_iteration_step(parsed, compound, type, i);
|
||||||
if (step_result == Iteration_Skip){
|
if (result.step == Iteration_Skip){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (step_result == Iteration_Quit){
|
else if (result.step == Iteration_Quit){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
count += 1;
|
count += 1;
|
||||||
|
@ -1141,6 +1170,25 @@ typed_array_get_count(Config *parsed, Config_Compound *compound, Config_RValue_T
|
||||||
return(count);
|
return(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Config_Get_Result_List
|
||||||
|
typed_array_reference_list(Partition *arena, Config *parsed, Config_Compound *compound, Config_RValue_Type type){
|
||||||
|
Config_Get_Result_List list = {0};
|
||||||
|
for (int32_t i = 0;; ++i){
|
||||||
|
Config_Iteration_Step_Result result = typed_array_iteration_step(parsed, compound, type, i);
|
||||||
|
if (result.step == Iteration_Skip){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (result.step == Iteration_Quit){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Config_Get_Result_Node *node = push_array(arena, Config_Get_Result_Node, 1);
|
||||||
|
node->result = result.get;
|
||||||
|
zdll_push_back(list.first, list.last, node);
|
||||||
|
list.count += 1;
|
||||||
|
}
|
||||||
|
return(list);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -134,6 +134,13 @@ struct Config{
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
|
typedef int32_t Iteration_Step_Result;
|
||||||
|
enum{
|
||||||
|
Iteration_Good = 0,
|
||||||
|
Iteration_Skip = 1,
|
||||||
|
Iteration_Quit = 2,
|
||||||
|
};
|
||||||
|
|
||||||
struct Config_Get_Result{
|
struct Config_Get_Result{
|
||||||
bool32 success;
|
bool32 success;
|
||||||
Config_RValue_Type type;
|
Config_RValue_Type type;
|
||||||
|
@ -147,6 +154,23 @@ struct Config_Get_Result{
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Config_Iteration_Step_Result{
|
||||||
|
Iteration_Step_Result step;
|
||||||
|
Config_Get_Result get;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Config_Get_Result_Node{
|
||||||
|
Config_Get_Result_Node *next;
|
||||||
|
Config_Get_Result_Node *prev;
|
||||||
|
Config_Get_Result result;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Config_Get_Result_List{
|
||||||
|
Config_Get_Result_Node *first;
|
||||||
|
Config_Get_Result_Node *last;
|
||||||
|
int32_t count;
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
struct Extension_List{
|
struct Extension_List{
|
||||||
|
|
|
@ -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(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_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(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, 981 },
|
{ 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, 974 },
|
||||||
{ 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_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(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 },
|
{ 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_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, 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(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, 1004 },
|
{ 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, 997 },
|
||||||
{ 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(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_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 },
|
{ 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_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_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(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, 988 },
|
{ 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, 981 },
|
||||||
{ 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, 995 },
|
{ 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, 988 },
|
||||||
{ 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_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_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 },
|
{ 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, 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(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(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, 1011 },
|
{ 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, 1004 },
|
||||||
{ 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, 1036 },
|
{ 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, 1029 },
|
||||||
{ 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, 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_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 },
|
{ 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_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_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(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, 1084 },
|
{ 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, 1077 },
|
||||||
{ 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_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(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 },
|
{ 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 },
|
||||||
|
|
|
@ -300,18 +300,17 @@ parse_project__extract_pattern_array(Partition *arena, Config *parsed,
|
||||||
Project_File_Pattern_Array *array_out){
|
Project_File_Pattern_Array *array_out){
|
||||||
Config_Compound *compound = 0;
|
Config_Compound *compound = 0;
|
||||||
if (config_compound_var(parsed, root_variable_name, 0, &compound)){
|
if (config_compound_var(parsed, root_variable_name, 0, &compound)){
|
||||||
int32_t count = typed_array_get_count(parsed, compound, ConfigRValueType_String);
|
Config_Get_Result_List list = typed_string_array_reference_list(arena, parsed, compound);
|
||||||
|
|
||||||
array_out->patterns = push_array(arena, Project_File_Pattern, count);
|
array_out->patterns = push_array(arena, Project_File_Pattern, list.count);
|
||||||
array_out->count = count;
|
array_out->count = list.count;
|
||||||
|
|
||||||
for (int32_t i = 0, c = 0; c < count; ++i){
|
int32_t i = 0;
|
||||||
String str = {0};
|
for (Config_Get_Result_Node *node = list.first;
|
||||||
if (config_compound_string_member(parsed, compound, "~", i, &str)){
|
node != 0;
|
||||||
str = push_string_copy(arena, str);
|
node = node->next, i += 1){
|
||||||
get_absolutes(str, &array_out->patterns[c].absolutes, false, false);
|
String str = push_string_copy(arena, node->result.string);
|
||||||
++c;
|
get_absolutes(str, &array_out->patterns[i].absolutes, false, false);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -348,14 +347,14 @@ parse_project__config_data__version_1(Partition *arena, String root_dir, Config
|
||||||
Config_Compound *compound = 0;
|
Config_Compound *compound = 0;
|
||||||
if (config_compound_var(parsed, "load_paths", 0, &compound)){
|
if (config_compound_var(parsed, "load_paths", 0, &compound)){
|
||||||
for (int32_t i = 0;; ++i){
|
for (int32_t i = 0;; ++i){
|
||||||
Config_Compound *paths_option = 0;
|
Config_Iteration_Step_Result result = typed_array_iteration_step(parsed, compound, ConfigRValueType_Compound, i);
|
||||||
Iteration_Step_Result step_result = typed_array_iteration_step(parsed, compound, ConfigRValueType_Compound, i, &paths_option);
|
if (result.step == Iteration_Skip){
|
||||||
if (step_result == Iteration_Skip){
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (step_result == Iteration_Quit){
|
else if (result.step == Iteration_Quit){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Config_Compound *paths_option = result.get.compound;
|
||||||
|
|
||||||
bool32 use_this_option = false;
|
bool32 use_this_option = false;
|
||||||
|
|
||||||
|
@ -370,30 +369,27 @@ parse_project__config_data__version_1(Partition *arena, String root_dir, Config
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_this_option){
|
if (use_this_option){
|
||||||
int32_t count = typed_array_get_count(parsed, paths, ConfigRValueType_Compound);
|
Config_Get_Result_List list = typed_compound_array_reference_list(arena, parsed, paths);
|
||||||
|
|
||||||
project->load_path_array.paths = push_array(arena, Project_File_Load_Path, count);
|
project->load_path_array.paths = push_array(arena, Project_File_Load_Path, list.count);
|
||||||
project->load_path_array.count = count;
|
project->load_path_array.count = list.count;
|
||||||
|
|
||||||
Project_File_Load_Path *dst = project->load_path_array.paths;
|
Project_File_Load_Path *dst = project->load_path_array.paths;
|
||||||
for (int32_t j = 0, c = 0; c < count; ++j){
|
for (Config_Get_Result_Node *node = list.first;
|
||||||
Config_Compound *src = 0;
|
node != 0;
|
||||||
if (config_compound_compound_member(parsed, paths, "~", j, &src)){
|
node = node->next, ++dst){
|
||||||
memset(dst, 0, sizeof(*dst));
|
Config_Compound *src = node->result.compound;
|
||||||
dst->recursive = true;
|
memset(dst, 0, sizeof(*dst));
|
||||||
dst->relative = true;
|
dst->recursive = true;
|
||||||
|
dst->relative = true;
|
||||||
|
|
||||||
String str = {0};
|
String str = {0};
|
||||||
if (config_compound_string_member(parsed, src, "path", 0, &str)){
|
if (config_compound_string_member(parsed, src, "path", 0, &str)){
|
||||||
dst->path = push_string_copy(arena, str);
|
dst->path = push_string_copy(arena, str);
|
||||||
}
|
|
||||||
|
|
||||||
config_compound_bool_member(parsed, src, "recursive", 1, &dst->recursive);
|
|
||||||
config_compound_bool_member(parsed, src, "relative", 2, &dst->relative);
|
|
||||||
|
|
||||||
++c;
|
|
||||||
++dst;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config_compound_bool_member(parsed, src, "recursive", 1, &dst->recursive);
|
||||||
|
config_compound_bool_member(parsed, src, "relative", 2, &dst->relative);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -406,84 +402,81 @@ parse_project__config_data__version_1(Partition *arena, String root_dir, Config
|
||||||
{
|
{
|
||||||
Config_Compound *compound = 0;
|
Config_Compound *compound = 0;
|
||||||
if (config_compound_var(parsed, "command_list", 0, &compound)){
|
if (config_compound_var(parsed, "command_list", 0, &compound)){
|
||||||
int32_t count = typed_array_get_count(parsed, compound, ConfigRValueType_Compound);
|
Config_Get_Result_List list = typed_compound_array_reference_list(arena, parsed, compound);
|
||||||
|
|
||||||
project->command_array.commands = push_array(arena, Project_Command, count);
|
project->command_array.commands = push_array(arena, Project_Command, list.count);
|
||||||
project->command_array.count = count;
|
project->command_array.count = list.count;
|
||||||
|
|
||||||
Project_Command *dst = project->command_array.commands;
|
Project_Command *dst = project->command_array.commands;
|
||||||
for (int32_t i = 0, c = 0; c < count; ++i){
|
for (Config_Get_Result_Node *node = list.first;
|
||||||
|
node != 0;
|
||||||
|
node = node->next, ++dst){
|
||||||
|
Config_Compound *src = node->result.compound;
|
||||||
|
memset(dst, 0, sizeof(*dst));
|
||||||
|
|
||||||
Config_Compound *src = 0;
|
bool32 can_emit_command = true;
|
||||||
if (config_compound_compound_member(parsed, compound, "~", i, &src)){
|
|
||||||
memset(dst, 0, sizeof(*dst));
|
|
||||||
|
|
||||||
bool32 can_emit_command = true;
|
String name = {0};
|
||||||
|
Config_Compound *cmd_set = 0;
|
||||||
String name = {0};
|
String out = {0};
|
||||||
Config_Compound *cmd_set = 0;
|
bool32 footer_panel = false;
|
||||||
String out = {0};
|
bool32 save_dirty_files = true;
|
||||||
bool32 footer_panel = false;
|
String cmd_str = {0};
|
||||||
bool32 save_dirty_files = true;
|
|
||||||
String cmd_str = {0};
|
|
||||||
|
|
||||||
if (!config_compound_string_member(parsed, src, "name", 0, &name)){
|
|
||||||
can_emit_command = false;
|
|
||||||
goto finish_command;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!config_compound_compound_member(parsed, src, "cmd", 1, &cmd_set)){
|
|
||||||
can_emit_command = false;
|
|
||||||
goto finish_command;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!config_compound_string_member(parsed, src, "name", 0, &name)){
|
||||||
can_emit_command = false;
|
can_emit_command = false;
|
||||||
for (int32_t j = 0;; ++j){
|
goto finish_command;
|
||||||
Config_Compound *cmd_option = 0;
|
}
|
||||||
Iteration_Step_Result step_result = typed_array_iteration_step(parsed, cmd_set, ConfigRValueType_Compound, j, &cmd_option);
|
|
||||||
if (step_result == Iteration_Skip){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (step_result == Iteration_Quit){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool32 use_this_option = false;
|
if (!config_compound_compound_member(parsed, src, "cmd", 1, &cmd_set)){
|
||||||
|
can_emit_command = false;
|
||||||
|
goto finish_command;
|
||||||
|
}
|
||||||
|
|
||||||
String cmd = {0};
|
can_emit_command = false;
|
||||||
if (config_compound_string_member(parsed, cmd_option, "cmd", 0, &cmd)){
|
for (int32_t j = 0;; ++j){
|
||||||
String str = {0};
|
Config_Iteration_Step_Result result = typed_array_iteration_step(parsed, cmd_set, ConfigRValueType_Compound, j);
|
||||||
if (config_compound_string_member(parsed, cmd_option, "os", 1, &str)){
|
if (result.step == Iteration_Skip){
|
||||||
if (match(str, make_lit_string(PlatformName))){
|
continue;
|
||||||
use_this_option = true;
|
}
|
||||||
}
|
else if (result.step == Iteration_Quit){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Config_Compound *cmd_option = result.get.compound;
|
||||||
|
|
||||||
|
bool32 use_this_option = false;
|
||||||
|
|
||||||
|
String cmd = {0};
|
||||||
|
if (config_compound_string_member(parsed, cmd_option, "cmd", 0, &cmd)){
|
||||||
|
String str = {0};
|
||||||
|
if (config_compound_string_member(parsed, cmd_option, "os", 1, &str)){
|
||||||
|
if (match(str, make_lit_string(PlatformName))){
|
||||||
|
use_this_option = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_this_option){
|
|
||||||
can_emit_command = true;
|
|
||||||
cmd_str = cmd;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (can_emit_command){
|
if (use_this_option){
|
||||||
config_compound_string_member(parsed, src, "out", 2, &out);
|
can_emit_command = true;
|
||||||
config_compound_bool_member(parsed, src, "footer_panel", 3, &footer_panel);
|
cmd_str = cmd;
|
||||||
config_compound_bool_member(parsed, src, "save_dirty_files", 4,
|
break;
|
||||||
&save_dirty_files);
|
|
||||||
|
|
||||||
dst->name = push_string_copy(arena, name);
|
|
||||||
dst->cmd = push_string_copy(arena, cmd_str);
|
|
||||||
dst->out = push_string_copy(arena, out);
|
|
||||||
dst->footer_panel = footer_panel;
|
|
||||||
dst->save_dirty_files = save_dirty_files;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
finish_command:;
|
|
||||||
++dst;
|
|
||||||
++c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (can_emit_command){
|
||||||
|
config_compound_string_member(parsed, src, "out", 2, &out);
|
||||||
|
config_compound_bool_member(parsed, src, "footer_panel", 3, &footer_panel);
|
||||||
|
config_compound_bool_member(parsed, src, "save_dirty_files", 4,
|
||||||
|
&save_dirty_files);
|
||||||
|
|
||||||
|
dst->name = push_string_copy(arena, name);
|
||||||
|
dst->cmd = push_string_copy(arena, cmd_str);
|
||||||
|
dst->out = push_string_copy(arena, out);
|
||||||
|
dst->footer_panel = footer_panel;
|
||||||
|
dst->save_dirty_files = save_dirty_files;
|
||||||
|
}
|
||||||
|
|
||||||
|
finish_command:;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,15 +15,6 @@ enum{
|
||||||
|
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
|
||||||
typedef int32_t Iteration_Step_Result;
|
|
||||||
enum{
|
|
||||||
Iteration_Good = 0,
|
|
||||||
Iteration_Skip = 1,
|
|
||||||
Iteration_Quit = 2,
|
|
||||||
};
|
|
||||||
|
|
||||||
///////////////////////////////
|
|
||||||
|
|
||||||
struct Project_File_Pattern{
|
struct Project_File_Pattern{
|
||||||
Absolutes absolutes;
|
Absolutes absolutes;
|
||||||
};
|
};
|
||||||
|
|
12
build.bat
12
build.bat
|
@ -1,15 +1,15 @@
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
SET OPTS=/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /wd4390 /WX
|
set opts=/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /wd4390 /WX
|
||||||
SET OPTS=%OPTS% /GR- /EHa- /nologo /FC
|
set opts=%opts% /GR- /EHa- /nologo /FC
|
||||||
|
|
||||||
SET FirstError=0
|
set FirstError=0
|
||||||
|
|
||||||
SET BUILD_MODE=%1
|
set build_mode=%1
|
||||||
if "%BUILD_MODE%" == "" (SET BUILD_MODE="/DDEV_BUILD")
|
if "%build_mode%" == "" (set build_mode="/DDEV_BUILD")
|
||||||
|
|
||||||
pushd ..\build
|
pushd ..\build
|
||||||
cl %OPTS% kernel32.lib ..\code\meta\4ed_build.cpp /Zi /Febuild %BUILD_MODE%
|
cl %opts% kernel32.lib ..\code\meta\4ed_build.cpp /Zi /Febuild %build_mode%
|
||||||
if %ERRORLEVEL% neq 0 (set FirstError=1)
|
if %ERRORLEVEL% neq 0 (set FirstError=1)
|
||||||
if %ERRORLEVEL% neq 0 (goto END)
|
if %ERRORLEVEL% neq 0 (goto END)
|
||||||
popd
|
popd
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
set opts=/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /wd4390 /WX
|
||||||
|
set opts=%opts% /GR- /EHa- /nologo /FC
|
||||||
|
set opts=%opts% /Zi
|
||||||
|
|
||||||
|
pushd ..\build
|
||||||
|
cl %opts% ..\code\meta\4ed_meta_generate_parser.cpp /Fegenerate_config_parser
|
||||||
|
popd
|
||||||
|
|
|
@ -0,0 +1,316 @@
|
||||||
|
/*
|
||||||
|
* Mr. 4th Dimention - Allen Webster
|
||||||
|
*
|
||||||
|
* 30.05.2018
|
||||||
|
*
|
||||||
|
* Generate config parser procedures.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// TOP
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "../4ed_defines.h"
|
||||||
|
#include "4ed_meta_generate_parser.h"
|
||||||
|
|
||||||
|
#define ConfigOpClassList(M) \
|
||||||
|
M(ConfigVar , 1, Operations) \
|
||||||
|
M(CompoundMember , 1, Operations) \
|
||||||
|
M(TypedArrayStep , 0, Operations) \
|
||||||
|
M(TypedArrayCount , 0, Types ) \
|
||||||
|
M(TypedArrayRefernceList , 0, Types ) \
|
||||||
|
|
||||||
|
#define ConfigRValueTypeList(M) \
|
||||||
|
M(LValue , lvalue ) \
|
||||||
|
M(Boolean , bool ) \
|
||||||
|
M(Integer , int ) \
|
||||||
|
M(Float , float ) \
|
||||||
|
M(String , string ) \
|
||||||
|
M(Character, character) \
|
||||||
|
M(Compound , compound ) \
|
||||||
|
M(NoType , no_type ) \
|
||||||
|
|
||||||
|
enum{
|
||||||
|
#define ENUM(N,C,I) OpClass_##N,
|
||||||
|
ConfigOpClassList(ENUM)
|
||||||
|
#undef ENUM
|
||||||
|
OpClass_COUNT,
|
||||||
|
};
|
||||||
|
|
||||||
|
Op_Class op_class_array[] = {
|
||||||
|
#define MEMBER(N,C,I) {OpClassIterate_##I},
|
||||||
|
ConfigOpClassList(MEMBER)
|
||||||
|
#undef MEMBER
|
||||||
|
};
|
||||||
|
|
||||||
|
enum{
|
||||||
|
#define ENUM(N,P) Type_##N,
|
||||||
|
ConfigRValueTypeList(ENUM)
|
||||||
|
#undef ENUM
|
||||||
|
Type_COUNT,
|
||||||
|
};
|
||||||
|
|
||||||
|
char *type_names[Type_COUNT] = {
|
||||||
|
#define MEMBER(N,P) #N,
|
||||||
|
ConfigRValueTypeList(MEMBER)
|
||||||
|
#undef MEMBER
|
||||||
|
};
|
||||||
|
|
||||||
|
char *type_proc_names[Type_COUNT] = {
|
||||||
|
#define MEMBER(N,P) #P,
|
||||||
|
ConfigRValueTypeList(MEMBER)
|
||||||
|
#undef MEMBER
|
||||||
|
};
|
||||||
|
|
||||||
|
Operation operations[] = {
|
||||||
|
{Type_NoType , "has" , 0 , 0 , 0, 0, 0, 0},
|
||||||
|
{Type_Boolean, "bool" , "boolean" , "bool32" , 0, 0, 0, 0},
|
||||||
|
{Type_Integer, "int" , "integer" , "int32_t" , 0, 0, 0, 0},
|
||||||
|
{Type_Integer, "uint" , "uinteger", "uint32_t", 0, 0, 0, 0},
|
||||||
|
{Type_String , "string", "string" , "String" , 0, 0, 0, 0},
|
||||||
|
{Type_String, "placed_string", "string", "String",
|
||||||
|
", char *space, int32_t space_size",
|
||||||
|
", space, space_size",
|
||||||
|
0,
|
||||||
|
""
|
||||||
|
"if (success){\n"
|
||||||
|
"String str = *var_out;\n"
|
||||||
|
"*var_out = make_string_cap(space, 0, space_size);\n"
|
||||||
|
"copy(var_out, str);\n"
|
||||||
|
"}\n",
|
||||||
|
},
|
||||||
|
{Type_Character, "char" , "character", "char" , 0, 0, 0, 0},
|
||||||
|
{Type_Compound , "compound", "compound" , "Config_Compound*", 0, 0, 0, 0},
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
print_config_var(FILE *out, Operation *op){
|
||||||
|
fprintf(out, "static bool32\n");
|
||||||
|
fprintf(out, "config_%s_var(", op->proc_name);
|
||||||
|
fprintf(out, "Config *config, String var_name, int32_t subscript");
|
||||||
|
if (op->output_type != 0){
|
||||||
|
fprintf(out, ", %s* var_out", op->output_type);
|
||||||
|
}
|
||||||
|
if (op->extra_params != 0){
|
||||||
|
fprintf(out, "%s", op->extra_params);
|
||||||
|
}
|
||||||
|
fprintf(out, "){\n");
|
||||||
|
if (op->code_before != 0){
|
||||||
|
fprintf(out, "%s", op->code_before);
|
||||||
|
}
|
||||||
|
fprintf(out, "Config_Get_Result result = config_var(config, var_name, subscript);\n");
|
||||||
|
if (op->output_type != 0){
|
||||||
|
fprintf(out, "if (result.success){\n");
|
||||||
|
fprintf(out, "*var_out = result.%s;\n", op->result_type);
|
||||||
|
fprintf(out, "}\n");
|
||||||
|
}
|
||||||
|
if (op->code_after != 0){
|
||||||
|
fprintf(out, "bool32 success = result.success;\n");
|
||||||
|
fprintf(out, "%s", op->code_after);
|
||||||
|
}
|
||||||
|
fprintf(out, "return(result.success);\n");
|
||||||
|
fprintf(out, "}\n\n");
|
||||||
|
|
||||||
|
fprintf(out, "static bool32\n");
|
||||||
|
fprintf(out, "config_%s_var(", op->proc_name);
|
||||||
|
fprintf(out, "Config *config, char *var_name, int32_t subscript");
|
||||||
|
if (op->output_type != 0){
|
||||||
|
fprintf(out, ", %s* var_out", op->output_type);
|
||||||
|
}
|
||||||
|
if (op->extra_params != 0){
|
||||||
|
fprintf(out, "%s", op->extra_params);
|
||||||
|
}
|
||||||
|
fprintf(out, "){\n");
|
||||||
|
if (op->code_before != 0){
|
||||||
|
fprintf(out, "%s", op->code_before);
|
||||||
|
}
|
||||||
|
fprintf(out, "String var_name_str = make_string_slowly(var_name);\n");
|
||||||
|
fprintf(out, "Config_Get_Result result = config_var(config, var_name_str, subscript);\n");
|
||||||
|
if (op->output_type != 0){
|
||||||
|
fprintf(out, "if (result.success){\n");
|
||||||
|
fprintf(out, "*var_out = result.%s;\n", op->result_type);
|
||||||
|
fprintf(out, "}\n");
|
||||||
|
}
|
||||||
|
if (op->code_after != 0){
|
||||||
|
fprintf(out, "bool32 success = result.success;\n");
|
||||||
|
fprintf(out, "%s", op->code_after);
|
||||||
|
}
|
||||||
|
fprintf(out, "return(result.success);\n");
|
||||||
|
fprintf(out, "}\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
print_compound_member(FILE *out, Operation *op){
|
||||||
|
fprintf(out, "static bool32\n");
|
||||||
|
fprintf(out, "config_compound_%s_member(", op->proc_name);
|
||||||
|
fprintf(out, "Config *config, Config_Compound *compound,\n");
|
||||||
|
fprintf(out, "String var_name, int32_t index");
|
||||||
|
if (op->output_type != 0){
|
||||||
|
fprintf(out, ", %s* var_out", op->output_type);
|
||||||
|
}
|
||||||
|
if (op->extra_params != 0){
|
||||||
|
fprintf(out, "%s", op->extra_params);
|
||||||
|
}
|
||||||
|
fprintf(out, "){\n");
|
||||||
|
if (op->code_before != 0){
|
||||||
|
fprintf(out, "%s", op->code_before);
|
||||||
|
}
|
||||||
|
fprintf(out, "Config_Get_Result result = config_compound_member(config, compound, var_name, index);\n");
|
||||||
|
if (op->output_type != 0){
|
||||||
|
fprintf(out, "if (result.success){\n");
|
||||||
|
fprintf(out, "*var_out = result.%s;\n", op->result_type);
|
||||||
|
fprintf(out, "}\n");
|
||||||
|
}
|
||||||
|
if (op->code_after != 0){
|
||||||
|
fprintf(out, "bool32 success = result.success;\n");
|
||||||
|
fprintf(out, "%s", op->code_after);
|
||||||
|
}
|
||||||
|
fprintf(out, "return(result.success);\n");
|
||||||
|
fprintf(out, "}\n\n");
|
||||||
|
|
||||||
|
fprintf(out, "static bool32\n");
|
||||||
|
fprintf(out, "config_compound_%s_member(", op->proc_name);
|
||||||
|
fprintf(out, "Config *config, Config_Compound *compound,\n");
|
||||||
|
fprintf(out, "char *var_name, int32_t index");
|
||||||
|
if (op->output_type != 0){
|
||||||
|
fprintf(out, ", %s* var_out", op->output_type);
|
||||||
|
}
|
||||||
|
if (op->extra_params != 0){
|
||||||
|
fprintf(out, "%s", op->extra_params);
|
||||||
|
}
|
||||||
|
fprintf(out, "){\n");
|
||||||
|
fprintf(out, "String var_name_str = make_string_slowly(var_name);\n");
|
||||||
|
if (op->code_before != 0){
|
||||||
|
fprintf(out, "%s", op->code_before);
|
||||||
|
}
|
||||||
|
fprintf(out, "Config_Get_Result result = config_compound_member(config, compound, var_name_str, index);\n");
|
||||||
|
if (op->output_type != 0){
|
||||||
|
fprintf(out, "if (result.success){\n");
|
||||||
|
fprintf(out, "*var_out = result.%s;\n", op->result_type);
|
||||||
|
fprintf(out, "}\n");
|
||||||
|
}
|
||||||
|
if (op->code_after != 0){
|
||||||
|
fprintf(out, "bool32 success = result.success;\n");
|
||||||
|
fprintf(out, "%s", op->code_after);
|
||||||
|
}
|
||||||
|
fprintf(out, "return(result.success);\n");
|
||||||
|
fprintf(out, "}\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
print_typed_array(FILE *out, Operation *op){
|
||||||
|
fprintf(out, "static Iteration_Step_Result\n");
|
||||||
|
fprintf(out, "typed_%s_array_iteration_step(", op->proc_name);
|
||||||
|
fprintf(out, "Config *config, Config_Compound *compound, int32_t index");
|
||||||
|
if (op->output_type != 0){
|
||||||
|
fprintf(out, ", %s* var_out", op->output_type);
|
||||||
|
}
|
||||||
|
if (op->extra_params != 0){
|
||||||
|
fprintf(out, "\n%s", op->extra_params);
|
||||||
|
}
|
||||||
|
fprintf(out, "){\n");
|
||||||
|
if (op->code_before != 0){
|
||||||
|
fprintf(out, "%s", op->code_before);
|
||||||
|
}
|
||||||
|
fprintf(out, "Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_%s, index);\n", type_names[op->r_type]);
|
||||||
|
if (op->output_type != 0 || op->code_after != 0){
|
||||||
|
fprintf(out, "bool32 success = (result.step == Iteration_Good);\n");
|
||||||
|
}
|
||||||
|
if (op->output_type != 0){
|
||||||
|
fprintf(out, "if (success){\n");
|
||||||
|
fprintf(out, "*var_out = result.get.%s;\n", op->result_type);
|
||||||
|
fprintf(out, "}\n");
|
||||||
|
}
|
||||||
|
if (op->code_after != 0){
|
||||||
|
fprintf(out, "%s", op->code_after);
|
||||||
|
}
|
||||||
|
fprintf(out, "return(result.step);\n");
|
||||||
|
fprintf(out, "}\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
print_typed_array_count(FILE *out, int32_t r_type){
|
||||||
|
if (r_type == Type_LValue){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fprintf(out, "static int32_t\n");
|
||||||
|
fprintf(out, "typed_%s_array_get_count(", type_proc_names[r_type]);
|
||||||
|
fprintf(out, "Config *config, Config_Compound *compound){\n");
|
||||||
|
fprintf(out, "int32_t count = typed_array_get_count(config, compound, ConfigRValueType_%s);\n",
|
||||||
|
type_names[r_type]);
|
||||||
|
fprintf(out, "return(count);\n");
|
||||||
|
fprintf(out, "}\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
print_typed_array_reference_list(FILE *out, int32_t r_type){
|
||||||
|
if (r_type == Type_LValue){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fprintf(out, "static Config_Get_Result_List\n");
|
||||||
|
fprintf(out, "typed_%s_array_reference_list(", type_proc_names[r_type]);
|
||||||
|
fprintf(out, "Partition *arena, Config *config, Config_Compound *compound){\n");
|
||||||
|
fprintf(out, "Config_Get_Result_List list = "
|
||||||
|
"typed_array_reference_list(arena, config, compound, ConfigRValueType_%s);\n",
|
||||||
|
type_names[r_type]);
|
||||||
|
fprintf(out, "return(list);\n");
|
||||||
|
fprintf(out, "}\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
print_config_queries(void){
|
||||||
|
FILE *out = stdout;
|
||||||
|
for (int32_t i = 0; i < OpClass_COUNT; ++i){
|
||||||
|
Op_Class *op_class = &op_class_array[i];
|
||||||
|
switch (op_class->iteration_type){
|
||||||
|
case OpClassIterate_Operations:
|
||||||
|
{
|
||||||
|
Operation *op = operations;
|
||||||
|
for (int32_t j = 0; j < ArrayCount(operations); ++j, ++op){
|
||||||
|
switch (i){
|
||||||
|
case OpClass_ConfigVar:
|
||||||
|
{
|
||||||
|
print_config_var(out, op);
|
||||||
|
}break;
|
||||||
|
case OpClass_CompoundMember:
|
||||||
|
{
|
||||||
|
print_compound_member(out, op);
|
||||||
|
}break;
|
||||||
|
case OpClass_TypedArrayStep:
|
||||||
|
{
|
||||||
|
print_typed_array(out, op);
|
||||||
|
}break;
|
||||||
|
}
|
||||||
|
fflush(out);
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
|
||||||
|
case OpClassIterate_Types:
|
||||||
|
{
|
||||||
|
for (int32_t j = 0; j < Type_COUNT; ++j){
|
||||||
|
switch (i){
|
||||||
|
case OpClass_TypedArrayCount:
|
||||||
|
{
|
||||||
|
print_typed_array_count(out, j);
|
||||||
|
}break;
|
||||||
|
case OpClass_TypedArrayRefernceList:
|
||||||
|
{
|
||||||
|
print_typed_array_reference_list(out, j);
|
||||||
|
}break;
|
||||||
|
}
|
||||||
|
fflush(out);
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void){
|
||||||
|
print_config_queries();
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// BOTTOM
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Mr. 4th Dimention - Allen Webster
|
||||||
|
*
|
||||||
|
* 30.05.2018
|
||||||
|
*
|
||||||
|
* Generate config parser procedures.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// TOP
|
||||||
|
|
||||||
|
#if !defined(FRED_META_GENERATE_PARSER_H)
|
||||||
|
#define FRED_META_GENERATE_PARSER_H
|
||||||
|
|
||||||
|
struct Operation{
|
||||||
|
int32_t r_type;
|
||||||
|
char *proc_name;
|
||||||
|
char *result_type;
|
||||||
|
char *output_type;
|
||||||
|
char *extra_params;
|
||||||
|
char *extra_args;
|
||||||
|
char *code_before;
|
||||||
|
char *code_after;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum{
|
||||||
|
OpClassIterate_Operations = 0,
|
||||||
|
OpClassIterate_Types = 1,
|
||||||
|
OpClassIterate_COUNT = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Op_Class{
|
||||||
|
int32_t iteration_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// BOTTOM
|
||||||
|
|
|
@ -55,6 +55,16 @@ command_list = {
|
||||||
.cmd = { {"package.bat", .os = "win" },
|
.cmd = { {"package.bat", .os = "win" },
|
||||||
{"package.sh" , .os = "linux"},
|
{"package.sh" , .os = "linux"},
|
||||||
{"package.sh" , .os = "mac" }, }, },
|
{"package.sh" , .os = "mac" }, }, },
|
||||||
|
{ .name = "build config parser generator",
|
||||||
|
.out = "*compilation*", .footer_panel = true, .save_dirty_files = true,
|
||||||
|
.cmd = { {"build_config_parser_generator.bat", .os = "win" },
|
||||||
|
{"build_config_parser_generator.sh" , .os = "linux"},
|
||||||
|
{"build_config_parser_generator.sh" , .os = "mac" }, }, },
|
||||||
|
{ .name = "generate config parser",
|
||||||
|
.out = "*gen*", .footer_panel = false, .save_dirty_files = true,
|
||||||
|
.cmd = { {"..\\build\\generate_config_parser", .os = "win" },
|
||||||
|
{"../build/generate_config_parser", .os = "linux"},
|
||||||
|
{"../build/generate_config_parser", .os = "mac" }, }, },
|
||||||
};
|
};
|
||||||
|
|
||||||
fkey_command[1] = "build x64";
|
fkey_command[1] = "build x64";
|
||||||
|
@ -62,5 +72,7 @@ fkey_command[2] = "build site";
|
||||||
fkey_command[3] = "build string";
|
fkey_command[3] = "build string";
|
||||||
fkey_command[4] = "build x86";
|
fkey_command[4] = "build x86";
|
||||||
fkey_command[5] = "build metadata";
|
fkey_command[5] = "build metadata";
|
||||||
|
fkey_command[6] = "build config parser generator";
|
||||||
|
fkey_command[7] = "generate config parser";
|
||||||
fkey_command[12] = "package";
|
fkey_command[12] = "package";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue