2018-05-12 00:53:02 +00:00
|
|
|
/*
|
|
|
|
4coder_config.h - Configuration structs.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TOP
|
|
|
|
|
|
|
|
#if !defined(FCODER_CONFIG_H)
|
|
|
|
#define FCODER_CONFIG_H
|
|
|
|
|
2018-05-20 04:44:20 +00:00
|
|
|
// TODO(allen): Stop handling files this way! My own API should be able to do this!!?!?!?!!?!?!!!!?
|
|
|
|
// NOTE(allen): Actually need binary buffers for some stuff to work, but not this parsing thing here.
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
struct Error_Location{
|
2019-02-26 23:08:42 +00:00
|
|
|
i32 line_number;
|
|
|
|
i32 column_number;
|
2018-05-20 04:44:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Config_Error{
|
|
|
|
Config_Error *next;
|
|
|
|
Config_Error *prev;
|
|
|
|
String file_name;
|
|
|
|
char *pos;
|
|
|
|
String text;
|
|
|
|
};
|
|
|
|
|
2018-06-02 04:06:13 +00:00
|
|
|
struct Config_Error_List{
|
|
|
|
Config_Error *first;
|
|
|
|
Config_Error *last;
|
2019-02-26 23:08:42 +00:00
|
|
|
i32 count;
|
2018-06-02 04:06:13 +00:00
|
|
|
};
|
|
|
|
|
2018-05-12 00:53:02 +00:00
|
|
|
struct Config_Parser{
|
|
|
|
Cpp_Token *start;
|
|
|
|
Cpp_Token *token;
|
2018-05-26 07:49:37 +00:00
|
|
|
Cpp_Token *end;
|
2018-05-12 00:53:02 +00:00
|
|
|
|
2018-05-26 07:49:37 +00:00
|
|
|
String file_name;
|
2018-05-12 00:53:02 +00:00
|
|
|
String data;
|
|
|
|
|
|
|
|
Partition *arena;
|
2018-05-20 04:44:20 +00:00
|
|
|
|
2018-06-02 04:06:13 +00:00
|
|
|
Config_Error_List errors;
|
2018-05-26 07:49:37 +00:00
|
|
|
};
|
2018-05-12 00:53:02 +00:00
|
|
|
|
|
|
|
struct Config_LValue{
|
|
|
|
String identifier;
|
2019-02-26 23:08:42 +00:00
|
|
|
i32 index;
|
2018-05-12 00:53:02 +00:00
|
|
|
};
|
|
|
|
|
2019-02-26 23:08:42 +00:00
|
|
|
typedef i32 Config_RValue_Type;
|
2018-05-12 00:53:02 +00:00
|
|
|
enum{
|
|
|
|
ConfigRValueType_LValue = 0,
|
|
|
|
ConfigRValueType_Boolean = 1,
|
|
|
|
ConfigRValueType_Integer = 2,
|
|
|
|
ConfigRValueType_Float = 3,
|
|
|
|
ConfigRValueType_String = 4,
|
|
|
|
ConfigRValueType_Character = 5,
|
|
|
|
ConfigRValueType_Compound = 6,
|
2018-05-26 07:49:37 +00:00
|
|
|
ConfigRValueType_NoType = 7,
|
|
|
|
};
|
|
|
|
enum{
|
|
|
|
ConfigRValueType_COUNT = ConfigRValueType_NoType,
|
2018-05-12 00:53:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Config_Compound{
|
|
|
|
struct Config_Compound_Element *first;
|
|
|
|
struct Config_Compound_Element *last;
|
2019-02-26 23:08:42 +00:00
|
|
|
i32 count;
|
2018-05-12 00:53:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Config_RValue{
|
|
|
|
Config_RValue_Type type;
|
|
|
|
union{
|
|
|
|
Config_LValue *lvalue;
|
2019-02-26 23:08:42 +00:00
|
|
|
b32 boolean;
|
|
|
|
i32 integer;
|
|
|
|
u32 uinteger;
|
2018-05-12 00:53:02 +00:00
|
|
|
String string;
|
|
|
|
char character;
|
|
|
|
Config_Compound *compound;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-05-19 22:05:31 +00:00
|
|
|
struct Config_Integer{
|
2019-02-26 23:08:42 +00:00
|
|
|
b32 is_signed;
|
2018-05-19 22:05:31 +00:00
|
|
|
union{
|
2019-02-26 23:08:42 +00:00
|
|
|
i32 integer;
|
|
|
|
u32 uinteger;
|
2018-05-19 22:05:31 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2019-02-26 23:08:42 +00:00
|
|
|
typedef i32 Config_Layout_Type;
|
2018-05-12 00:53:02 +00:00
|
|
|
enum{
|
|
|
|
ConfigLayoutType_Unset = 0,
|
|
|
|
ConfigLayoutType_Identifier = 1,
|
|
|
|
ConfigLayoutType_Integer = 2,
|
|
|
|
ConfigLayoutType_COUNT = 3,
|
|
|
|
};
|
|
|
|
struct Config_Layout{
|
|
|
|
Config_Layout_Type type;
|
2018-06-02 04:06:13 +00:00
|
|
|
char *pos;
|
2018-05-12 00:53:02 +00:00
|
|
|
union{
|
|
|
|
String identifier;
|
2019-02-26 23:08:42 +00:00
|
|
|
i32 integer;
|
2018-05-12 00:53:02 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Config_Compound_Element{
|
|
|
|
Config_Compound_Element *next;
|
|
|
|
Config_Compound_Element *prev;
|
|
|
|
|
|
|
|
Config_Layout l;
|
|
|
|
Config_RValue *r;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Config_Assignment{
|
|
|
|
Config_Assignment *next;
|
|
|
|
Config_Assignment *prev;
|
|
|
|
|
2018-06-02 04:06:13 +00:00
|
|
|
char *pos;
|
2018-05-12 00:53:02 +00:00
|
|
|
Config_LValue *l;
|
|
|
|
Config_RValue *r;
|
2018-05-15 20:19:48 +00:00
|
|
|
|
2019-02-26 23:08:42 +00:00
|
|
|
b32 visited;
|
2018-05-12 00:53:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Config{
|
2019-02-26 23:08:42 +00:00
|
|
|
i32 *version;
|
2018-05-12 00:53:02 +00:00
|
|
|
Config_Assignment *first;
|
|
|
|
Config_Assignment *last;
|
2019-02-26 23:08:42 +00:00
|
|
|
i32 count;
|
2018-05-20 04:44:20 +00:00
|
|
|
|
2018-06-02 04:06:13 +00:00
|
|
|
Config_Error_List errors;
|
2018-05-20 04:44:20 +00:00
|
|
|
|
2018-06-02 04:06:13 +00:00
|
|
|
String file_name;
|
2018-05-20 04:44:20 +00:00
|
|
|
String data;
|
2018-05-12 00:53:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
////////////////////////////////
|
|
|
|
|
2019-02-26 23:08:42 +00:00
|
|
|
typedef i32 Iteration_Step_Result;
|
2018-05-30 20:27:47 +00:00
|
|
|
enum{
|
|
|
|
Iteration_Good = 0,
|
|
|
|
Iteration_Skip = 1,
|
|
|
|
Iteration_Quit = 2,
|
|
|
|
};
|
|
|
|
|
2018-05-30 07:58:22 +00:00
|
|
|
struct Config_Get_Result{
|
2019-02-26 23:08:42 +00:00
|
|
|
b32 success;
|
2018-05-30 07:58:22 +00:00
|
|
|
Config_RValue_Type type;
|
2018-06-02 04:06:13 +00:00
|
|
|
char *pos;
|
2018-05-30 07:58:22 +00:00
|
|
|
union{
|
2019-02-26 23:08:42 +00:00
|
|
|
b32 boolean;
|
|
|
|
i32 integer;
|
|
|
|
u32 uinteger;
|
2018-05-30 07:58:22 +00:00
|
|
|
String string;
|
|
|
|
char character;
|
|
|
|
Config_Compound *compound;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-05-30 20:27:47 +00:00
|
|
|
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;
|
2019-02-26 23:08:42 +00:00
|
|
|
i32 count;
|
2018-05-30 20:27:47 +00:00
|
|
|
};
|
|
|
|
|
2018-05-30 07:58:22 +00:00
|
|
|
////////////////////////////////
|
|
|
|
|
2018-05-12 00:53:02 +00:00
|
|
|
struct Extension_List{
|
|
|
|
char space[256];
|
|
|
|
char *exts[94];
|
2019-02-26 23:08:42 +00:00
|
|
|
i32 count;
|
2018-05-12 00:53:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CString_Array{
|
|
|
|
char **strings;
|
2019-02-26 23:08:42 +00:00
|
|
|
i32 count;
|
2018-05-12 00:53:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Config_Data{
|
2018-05-28 01:00:13 +00:00
|
|
|
char user_name_space[256];
|
|
|
|
String user_name;
|
|
|
|
|
|
|
|
Extension_List code_exts;
|
|
|
|
|
|
|
|
char current_mapping_space[256];
|
|
|
|
String current_mapping;
|
2018-05-12 00:53:02 +00:00
|
|
|
|
2018-09-30 12:14:47 +00:00
|
|
|
char mode_space[64];
|
|
|
|
String mode;
|
|
|
|
|
2019-02-26 23:08:42 +00:00
|
|
|
b32 use_scroll_bars;
|
|
|
|
b32 use_file_bars;
|
|
|
|
b32 use_line_highlight;
|
|
|
|
b32 use_scope_highlight;
|
|
|
|
b32 use_paren_helper;
|
|
|
|
b32 use_comment_keyword;
|
2018-09-30 12:14:47 +00:00
|
|
|
|
2019-02-26 23:08:42 +00:00
|
|
|
b32 enable_virtual_whitespace;
|
|
|
|
b32 enable_code_wrapping;
|
|
|
|
b32 automatically_indent_text_on_save;
|
|
|
|
b32 automatically_save_changes_on_build;
|
|
|
|
b32 automatically_adjust_wrapping;
|
|
|
|
b32 automatically_load_project;
|
2018-05-28 01:00:13 +00:00
|
|
|
|
2019-02-26 23:08:42 +00:00
|
|
|
b32 indent_with_tabs;
|
|
|
|
i32 indent_width;
|
2018-05-28 05:30:31 +00:00
|
|
|
|
2019-02-26 23:08:42 +00:00
|
|
|
i32 default_wrap_width;
|
|
|
|
i32 default_min_base_width;
|
2018-05-12 00:53:02 +00:00
|
|
|
|
2018-05-26 07:49:37 +00:00
|
|
|
char default_theme_name_space[256];
|
|
|
|
String default_theme_name;
|
2018-05-12 00:53:02 +00:00
|
|
|
|
2019-02-26 23:08:42 +00:00
|
|
|
b32 highlight_line_at_cursor;
|
2018-09-25 08:41:49 +00:00
|
|
|
|
2018-05-26 07:49:37 +00:00
|
|
|
char default_font_name_space[256];
|
|
|
|
String default_font_name;
|
2019-02-26 23:08:42 +00:00
|
|
|
i32 default_font_size;
|
|
|
|
b32 default_font_hinting;
|
2018-05-12 00:53:02 +00:00
|
|
|
|
|
|
|
char default_compiler_bat_space[256];
|
|
|
|
String default_compiler_bat;
|
|
|
|
|
|
|
|
char default_flags_bat_space[1024];
|
|
|
|
String default_flags_bat;
|
|
|
|
|
|
|
|
char default_compiler_sh_space[256];
|
|
|
|
String default_compiler_sh;
|
|
|
|
|
|
|
|
char default_flags_sh_space[1024];
|
|
|
|
String default_flags_sh;
|
|
|
|
|
2019-02-26 23:08:42 +00:00
|
|
|
b32 lalt_lctrl_is_altgr;
|
2018-05-26 07:49:37 +00:00
|
|
|
};
|
2018-05-12 00:53:02 +00:00
|
|
|
|
2019-02-25 23:42:13 +00:00
|
|
|
#if 0
|
2018-05-12 00:53:02 +00:00
|
|
|
struct Theme_Data{
|
|
|
|
char space[128];
|
|
|
|
String name;
|
|
|
|
Theme theme;
|
|
|
|
};
|
2019-02-25 23:42:13 +00:00
|
|
|
#endif
|
2018-05-12 00:53:02 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// BOTTOM
|
|
|
|
|