From 48ae9b69737f5bebbc6839e0186332acbafcbff4 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Fri, 13 Sep 2024 14:51:07 -0700 Subject: [PATCH] move rest of cfg-related stuff into frontend --- src/dbg_engine/dbg_engine.mdesk | 23 -- src/dbg_engine/dbg_engine_core.c | 116 +-------- src/dbg_engine/dbg_engine_core.h | 83 +------ src/dbg_engine/generated/dbg_engine.meta.c | 8 - src/dbg_engine/generated/dbg_engine.meta.h | 14 -- src/dbg_frontend/dbg_frontend.mdesk | 26 +- src/dbg_frontend/dbg_frontend_core.c | 223 +++++++++++++----- src/dbg_frontend/dbg_frontend_core.h | 103 +++++++- src/dbg_frontend/dbg_frontend_views.c | 4 +- src/dbg_frontend/dbg_frontend_widgets.c | 4 +- .../generated/dbg_frontend.meta.c | 8 + .../generated/dbg_frontend.meta.h | 10 + src/raddbg/raddbg_main.c | 2 +- 13 files changed, 309 insertions(+), 315 deletions(-) diff --git a/src/dbg_engine/dbg_engine.mdesk b/src/dbg_engine/dbg_engine.mdesk index 3d3c01c2..78db1a89 100644 --- a/src/dbg_engine/dbg_engine.mdesk +++ b/src/dbg_engine/dbg_engine.mdesk @@ -1,29 +1,6 @@ // Copyright (c) 2024 Epic Games Tools // Licensed under the MIT license (https://opensource.org/license/mit/) -//////////////////////////////// -//~ rjf: Config Sources - -@table(string, name, load_cmd, write_cmd, apply_cmd) -D_CfgSrcTable: -{ - {"user" User OpenUser WriteUserData ApplyUserData } - {"project" Project OpenProject WriteProjectData ApplyProjectData } - {"command_line" CommandLine Null Null Null } - {"transient" Transient Null Null Null } -} - -@enum D_CfgSrc: -{ - @expand(D_CfgSrcTable a) `$(a.name)`, - COUNT, -} - -@data(String8) d_cfg_src_string_table: -{ - @expand(D_CfgSrcTable a) `str8_lit_comp("$(a.string)")`, -} - //////////////////////////////// //~ rjf: Built-In Command Tables diff --git a/src/dbg_engine/dbg_engine_core.c b/src/dbg_engine/dbg_engine_core.c index 4d723686..61138329 100644 --- a/src/dbg_engine/dbg_engine_core.c +++ b/src/dbg_engine/dbg_engine_core.c @@ -46,48 +46,6 @@ d_hash_from_string__case_insensitive(String8 string) return d_hash_from_seed_string__case_insensitive(5381, string); } -//////////////////////////////// -//~ rjf: Handles - -internal D_Handle -d_handle_zero(void) -{ - D_Handle result = {0}; - return result; -} - -internal B32 -d_handle_match(D_Handle a, D_Handle b) -{ - return (a.u64[0] == b.u64[0] && a.u64[1] == b.u64[1]); -} - -internal void -d_handle_list_push_node(D_HandleList *list, D_HandleNode *node) -{ - DLLPushBack(list->first, list->last, node); - list->count += 1; -} - -internal void -d_handle_list_push(Arena *arena, D_HandleList *list, D_Handle handle) -{ - D_HandleNode *n = push_array(arena, D_HandleNode, 1); - n->handle = handle; - d_handle_list_push_node(list, n); -} - -internal D_HandleList -d_handle_list_copy(Arena *arena, D_HandleList list) -{ - D_HandleList result = {0}; - for(D_HandleNode *n = list.first; n != 0; n = n->next) - { - d_handle_list_push(arena, &result, n->handle); - } - return result; -} - //////////////////////////////// //~ rjf: Breakpoints @@ -180,78 +138,6 @@ d_possible_path_overrides_from_maps_path(Arena *arena, D_PathMapArray *path_maps return result; } -//////////////////////////////// -//~ rjf: Config Type Functions - -internal void -d_cfg_table_push_unparsed_string(Arena *arena, D_CfgTable *table, String8 string, D_CfgSrc source) -{ - if(table->slot_count == 0) - { - table->slot_count = 64; - table->slots = push_array(arena, D_CfgSlot, table->slot_count); - } - MD_TokenizeResult tokenize = md_tokenize_from_text(arena, string); - MD_ParseResult parse = md_parse_from_text_tokens(arena, str8_lit(""), string, tokenize.tokens); - for(MD_EachNode(tln, parse.root->first)) if(tln->string.size != 0) - { - // rjf: map string -> hash*slot - String8 string = str8(tln->string.str, tln->string.size); - U64 hash = d_hash_from_string__case_insensitive(string); - U64 slot_idx = hash % table->slot_count; - D_CfgSlot *slot = &table->slots[slot_idx]; - - // rjf: find existing value for this string - D_CfgVal *val = 0; - for(D_CfgVal *v = slot->first; v != 0; v = v->hash_next) - { - if(str8_match(v->string, string, StringMatchFlag_CaseInsensitive)) - { - val = v; - break; - } - } - - // rjf: create new value if needed - if(val == 0) - { - val = push_array(arena, D_CfgVal, 1); - val->string = push_str8_copy(arena, string); - val->insertion_stamp = table->insertion_stamp_counter; - SLLStackPush_N(slot->first, val, hash_next); - SLLQueuePush_N(table->first_val, table->last_val, val, linear_next); - table->insertion_stamp_counter += 1; - } - - // rjf: create new node within this value - D_CfgTree *tree = push_array(arena, D_CfgTree, 1); - SLLQueuePush_NZ(&d_nil_cfg_tree, val->first, val->last, tree, next); - tree->source = source; - tree->root = md_tree_copy(arena, tln); - } -} - -internal D_CfgVal * -d_cfg_val_from_string(D_CfgTable *table, String8 string) -{ - D_CfgVal *result = &d_nil_cfg_val; - if(table->slot_count != 0) - { - U64 hash = d_hash_from_string__case_insensitive(string); - U64 slot_idx = hash % table->slot_count; - D_CfgSlot *slot = &table->slots[slot_idx]; - for(D_CfgVal *val = slot->first; val != 0; val = val->hash_next) - { - if(str8_match(val->string, string, StringMatchFlag_CaseInsensitive)) - { - result = val; - break; - } - } - } - return result; -} - //////////////////////////////// //~ rjf: Debug Info Extraction Type Pure Functions @@ -271,7 +157,7 @@ d_line_list_copy(Arena *arena, D_LineList *list) } //////////////////////////////// -//~ rjf: Command Type Pure Functions +//~ rjf: Command Type Functions //- rjf: command parameters diff --git a/src/dbg_engine/dbg_engine_core.h b/src/dbg_engine/dbg_engine_core.h index 290c87bb..eb1365c0 100644 --- a/src/dbg_engine/dbg_engine_core.h +++ b/src/dbg_engine/dbg_engine_core.h @@ -98,31 +98,6 @@ struct D_EventList U64 count; }; -//////////////////////////////// -//~ rjf: Handles - -typedef struct D_Handle D_Handle; -struct D_Handle -{ - U64 u64[2]; -}; - -typedef struct D_HandleNode D_HandleNode; -struct D_HandleNode -{ - D_HandleNode *next; - D_HandleNode *prev; - D_Handle handle; -}; - -typedef struct D_HandleList D_HandleList; -struct D_HandleList -{ - D_HandleNode *first; - D_HandleNode *last; - U64 count; -}; - //////////////////////////////// //~ rjf: Line Info Types @@ -175,44 +150,6 @@ D_RunKind; #include "dbg_engine/generated/dbg_engine.meta.h" -//////////////////////////////// -//~ rjf: Config Types - -typedef struct D_CfgTree D_CfgTree; -struct D_CfgTree -{ - D_CfgTree *next; - D_CfgSrc source; - MD_Node *root; -}; - -typedef struct D_CfgVal D_CfgVal; -struct D_CfgVal -{ - D_CfgVal *hash_next; - D_CfgVal *linear_next; - D_CfgTree *first; - D_CfgTree *last; - U64 insertion_stamp; - String8 string; -}; - -typedef struct D_CfgSlot D_CfgSlot; -struct D_CfgSlot -{ - D_CfgVal *first; -}; - -typedef struct D_CfgTable D_CfgTable; -struct D_CfgTable -{ - U64 slot_count; - D_CfgSlot *slots; - U64 insertion_stamp_counter; - D_CfgVal *first_val; - D_CfgVal *last_val; -}; - //////////////////////////////// //~ rjf: View Rules @@ -471,9 +408,6 @@ struct D_State //~ rjf: Globals read_only global D_ViewRuleSpec d_nil_core_view_rule_spec = {0}; -read_only global D_CfgTree d_nil_cfg_tree = {&d_nil_cfg_tree, D_CfgSrc_User, &md_nil_node}; -read_only global D_CfgVal d_nil_cfg_val = {&d_nil_cfg_val, &d_nil_cfg_val, &d_nil_cfg_tree, &d_nil_cfg_tree}; - global D_State *d_state = 0; //////////////////////////////// @@ -484,15 +418,6 @@ internal U64 d_hash_from_string(String8 string); internal U64 d_hash_from_seed_string__case_insensitive(U64 seed, String8 string); internal U64 d_hash_from_string__case_insensitive(String8 string); -//////////////////////////////// -//~ rjf: Handle Type Pure Functions - -internal D_Handle d_handle_zero(void); -internal B32 d_handle_match(D_Handle a, D_Handle b); -internal void d_handle_list_push_node(D_HandleList *list, D_HandleNode *node); -internal void d_handle_list_push(Arena *arena, D_HandleList *list, D_Handle handle); -internal D_HandleList d_handle_list_copy(Arena *arena, D_HandleList list); - //////////////////////////////// //~ rjf: Breakpoints @@ -503,19 +428,13 @@ internal D_BreakpointArray d_breakpoint_array_copy(Arena *arena, D_BreakpointArr internal String8List d_possible_path_overrides_from_maps_path(Arena *arena, D_PathMapArray *path_maps, String8 file_path); -//////////////////////////////// -//~ rjf: Config Type Pure Functions - -internal void d_cfg_table_push_unparsed_string(Arena *arena, D_CfgTable *table, String8 string, D_CfgSrc source); -internal D_CfgVal *d_cfg_val_from_string(D_CfgTable *table, String8 string); - //////////////////////////////// //~ rjf: Debug Info Extraction Type Pure Functions internal D_LineList d_line_list_copy(Arena *arena, D_LineList *list); //////////////////////////////// -//~ rjf: Command Type Pure Functions +//~ rjf: Command Type Functions //- rjf: command parameters internal D_CmdParams d_cmd_params_copy(Arena *arena, D_CmdParams *src); diff --git a/src/dbg_engine/generated/dbg_engine.meta.c b/src/dbg_engine/generated/dbg_engine.meta.c index bcdac9cc..6d096e0b 100644 --- a/src/dbg_engine/generated/dbg_engine.meta.c +++ b/src/dbg_engine/generated/dbg_engine.meta.c @@ -4,14 +4,6 @@ //- GENERATED CODE C_LINKAGE_BEGIN -String8 d_cfg_src_string_table[4] = -{ -str8_lit_comp("user"), -str8_lit_comp("project"), -str8_lit_comp("command_line"), -str8_lit_comp("transient"), -}; - D_ViewRuleSpecInfo d_core_view_rule_spec_info_table[21] = { {str8_lit_comp("default"), str8_lit_comp("Default"), str8_lit_comp(""), str8_lit_comp(""), (D_ViewRuleSpecInfoFlag_Inherited*0)|(D_ViewRuleSpecInfoFlag_Expandable*0)|(D_ViewRuleSpecInfoFlag_ExprResolution*0)|(D_ViewRuleSpecInfoFlag_VizBlockProd*1), }, diff --git a/src/dbg_engine/generated/dbg_engine.meta.h b/src/dbg_engine/generated/dbg_engine.meta.h index ea02fdbe..68b91a00 100644 --- a/src/dbg_engine/generated/dbg_engine.meta.h +++ b/src/dbg_engine/generated/dbg_engine.meta.h @@ -6,15 +6,6 @@ #ifndef DBG_ENGINE_META_H #define DBG_ENGINE_META_H -typedef enum D_CfgSrc -{ -D_CfgSrc_User, -D_CfgSrc_Project, -D_CfgSrc_CommandLine, -D_CfgSrc_Transient, -D_CfgSrc_COUNT, -} D_CfgSrc; - typedef enum D_CmdKind { D_CmdKind_Null, @@ -101,9 +92,4 @@ struct {B32 *value_ptr; String8 name;} DEV_toggle_table[] = {&DEV_scratch_mouse_draw, str8_lit_comp("scratch_mouse_draw")}, {&DEV_updating_indicator, str8_lit_comp("updating_indicator")}, }; -C_LINKAGE_BEGIN -extern String8 d_cfg_src_string_table[4]; - -C_LINKAGE_END - #endif // DBG_ENGINE_META_H diff --git a/src/dbg_frontend/dbg_frontend.mdesk b/src/dbg_frontend/dbg_frontend.mdesk index 289dcd3d..cceb4bbd 100644 --- a/src/dbg_frontend/dbg_frontend.mdesk +++ b/src/dbg_frontend/dbg_frontend.mdesk @@ -13,19 +13,39 @@ //////////////////////////////// //~ rjf: Config Sources +@table(string, name, load_cmd, write_cmd, apply_cmd) +DF_CfgSrcTable: +{ + {"user" User OpenUser WriteUserData ApplyUserData } + {"project" Project OpenProject WriteProjectData ApplyProjectData } + {"command_line" CommandLine Null Null Null } + {"transient" Transient Null Null Null } +} + +@enum DF_CfgSrc: +{ + @expand(DF_CfgSrcTable a) `$(a.name)`, + COUNT, +} + +@data(String8) d_cfg_src_string_table: +{ + @expand(DF_CfgSrcTable a) `str8_lit_comp("$(a.string)")`, +} + @data(DF_CmdKind) d_cfg_src_load_cmd_kind_table: { - @expand(D_CfgSrcTable a) `DF_CmdKind_$(a.load_cmd)`, + @expand(DF_CfgSrcTable a) `DF_CmdKind_$(a.load_cmd)`, } @data(DF_CmdKind) d_cfg_src_write_cmd_kind_table: { - @expand(D_CfgSrcTable a) `DF_CmdKind_$(a.write_cmd)`, + @expand(DF_CfgSrcTable a) `DF_CmdKind_$(a.write_cmd)`, } @data(DF_CmdKind) d_cfg_src_apply_cmd_kind_table: { - @expand(D_CfgSrcTable a) `DF_CmdKind_$(a.apply_cmd)`; + @expand(DF_CfgSrcTable a) `DF_CmdKind_$(a.apply_cmd)`; } //////////////////////////////// diff --git a/src/dbg_frontend/dbg_frontend_core.c b/src/dbg_frontend/dbg_frontend_core.c index 170fbbd0..fc67768a 100644 --- a/src/dbg_frontend/dbg_frontend_core.c +++ b/src/dbg_frontend/dbg_frontend_core.c @@ -9,6 +9,120 @@ #include "generated/dbg_frontend.meta.c" +//////////////////////////////// +//~ rjf: Handles + +internal D_Handle +d_handle_zero(void) +{ + D_Handle result = {0}; + return result; +} + +internal B32 +d_handle_match(D_Handle a, D_Handle b) +{ + return (a.u64[0] == b.u64[0] && a.u64[1] == b.u64[1]); +} + +internal void +d_handle_list_push_node(D_HandleList *list, D_HandleNode *node) +{ + DLLPushBack(list->first, list->last, node); + list->count += 1; +} + +internal void +d_handle_list_push(Arena *arena, D_HandleList *list, D_Handle handle) +{ + D_HandleNode *n = push_array(arena, D_HandleNode, 1); + n->handle = handle; + d_handle_list_push_node(list, n); +} + +internal D_HandleList +d_handle_list_copy(Arena *arena, D_HandleList list) +{ + D_HandleList result = {0}; + for(D_HandleNode *n = list.first; n != 0; n = n->next) + { + d_handle_list_push(arena, &result, n->handle); + } + return result; +} + +//////////////////////////////// +//~ rjf: Config Type Functions + +internal void +d_cfg_table_push_unparsed_string(Arena *arena, D_CfgTable *table, String8 string, DF_CfgSrc source) +{ + if(table->slot_count == 0) + { + table->slot_count = 64; + table->slots = push_array(arena, D_CfgSlot, table->slot_count); + } + MD_TokenizeResult tokenize = md_tokenize_from_text(arena, string); + MD_ParseResult parse = md_parse_from_text_tokens(arena, str8_lit(""), string, tokenize.tokens); + for(MD_EachNode(tln, parse.root->first)) if(tln->string.size != 0) + { + // rjf: map string -> hash*slot + String8 string = str8(tln->string.str, tln->string.size); + U64 hash = d_hash_from_string__case_insensitive(string); + U64 slot_idx = hash % table->slot_count; + D_CfgSlot *slot = &table->slots[slot_idx]; + + // rjf: find existing value for this string + D_CfgVal *val = 0; + for(D_CfgVal *v = slot->first; v != 0; v = v->hash_next) + { + if(str8_match(v->string, string, StringMatchFlag_CaseInsensitive)) + { + val = v; + break; + } + } + + // rjf: create new value if needed + if(val == 0) + { + val = push_array(arena, D_CfgVal, 1); + val->string = push_str8_copy(arena, string); + val->insertion_stamp = table->insertion_stamp_counter; + SLLStackPush_N(slot->first, val, hash_next); + SLLQueuePush_N(table->first_val, table->last_val, val, linear_next); + table->insertion_stamp_counter += 1; + } + + // rjf: create new node within this value + D_CfgTree *tree = push_array(arena, D_CfgTree, 1); + SLLQueuePush_NZ(&d_nil_cfg_tree, val->first, val->last, tree, next); + tree->source = source; + tree->root = md_tree_copy(arena, tln); + } +} + +internal D_CfgVal * +d_cfg_val_from_string(D_CfgTable *table, String8 string) +{ + D_CfgVal *result = &d_nil_cfg_val; + if(table->slot_count != 0) + { + U64 hash = d_hash_from_string__case_insensitive(string); + U64 slot_idx = hash % table->slot_count; + D_CfgSlot *slot = &table->slots[slot_idx]; + for(D_CfgVal *val = slot->first; val != 0; val = val->hash_next) + { + if(str8_match(val->string, string, StringMatchFlag_CaseInsensitive)) + { + result = val; + break; + } + } + } + return result; +} + //////////////////////////////// //~ rjf: Registers Type Functions @@ -399,7 +513,7 @@ df_search_tags_from_entity(Arena *arena, DF_Entity *entity) { Temp scratch = scratch_begin(&arena, 1); CTRL_Entity *entity_ctrl = ctrl_entity_from_handle(d_state->ctrl_entity_store, entity->ctrl_handle); - CTRL_Entity *process = ctrl_entity_ancestor_from_kind(entity_ctrl, DF_EntityKind_Process); + CTRL_Entity *process = ctrl_entity_ancestor_from_kind(entity_ctrl, CTRL_EntityKind_Process); CTRL_Unwind unwind = d_query_cached_unwind_from_thread(entity_ctrl); String8List strings = {0}; for(U64 frame_num = unwind.frames.count; frame_num > 0; frame_num -= 1) @@ -511,7 +625,7 @@ df_view_is_project_filtered(DF_View *view) String8 view_project = view->project_path; if(view_project.size != 0) { - String8 current_project = df_cfg_path_from_src(D_CfgSrc_Project); + String8 current_project = df_cfg_path_from_src(DF_CfgSrc_Project); result = !path_match_normalized(view_project, current_project); } return result; @@ -1326,7 +1440,7 @@ df_entity_equip_color_hsva(DF_Entity *entity, Vec4F32 hsva) } internal void -df_entity_equip_cfg_src(DF_Entity *entity, D_CfgSrc cfg_src) +df_entity_equip_cfg_src(DF_Entity *entity, DF_CfgSrc cfg_src) { df_require_entity_nonnil(entity, return); entity->cfg_src = cfg_src; @@ -1836,6 +1950,7 @@ internal U128 d_key_from_eval_space_range(E_Space space, Rng1U64 range, B32 zero_terminated) { U128 result = {0}; +#if 0 // TODO(rjf): @msgs DF_Entity *entity = d_entity_from_eval_space(space); switch(entity->kind) { @@ -1853,6 +1968,7 @@ d_key_from_eval_space_range(E_Space space, Rng1U64 range, B32 zero_terminated) result = ctrl_hash_store_key_from_process_vaddr_range(entity->ctrl_handle, range, zero_terminated); }break; } +#endif return result; } @@ -2355,7 +2471,7 @@ df_view_equip_spec(DF_View *view, DF_ViewSpec *spec, String8 query, MD_Node *par if(spec->info.flags & DF_ViewSpecFlag_ProjectSpecific) { arena_clear(view->project_path_arena); - view->project_path = push_str8_copy(view->project_path_arena, df_cfg_path_from_src(D_CfgSrc_Project)); + view->project_path = push_str8_copy(view->project_path_arena, df_cfg_path_from_src(DF_CfgSrc_Project)); } else { @@ -2549,7 +2665,7 @@ df_panel_release_all_views(DF_Panel *panel) //~ rjf: Window State Functions internal DF_Window * -df_window_open(Vec2F32 size, OS_Handle preferred_monitor, D_CfgSrc cfg_src) +df_window_open(Vec2F32 size, OS_Handle preferred_monitor, DF_CfgSrc cfg_src) { DF_Window *window = df_state->free_window; if(window != 0) @@ -3408,9 +3524,9 @@ df_window_frame(DF_Window *ws) } // rjf: is command line only? -> make permanent - if(entity->cfg_src == D_CfgSrc_CommandLine && ui_clicked(df_icon_buttonf(DF_IconKind_Save, 0, "Save To Project"))) + if(entity->cfg_src == DF_CfgSrc_CommandLine && ui_clicked(df_icon_buttonf(DF_IconKind_Save, 0, "Save To Project"))) { - df_entity_equip_cfg_src(entity, D_CfgSrc_Project); + df_entity_equip_cfg_src(entity, DF_CfgSrc_Project); } // rjf: duplicate @@ -4734,7 +4850,6 @@ df_window_frame(DF_Window *ws) { ui_labelf("Restart all running targets:"); { - DF_EntityList processes = d_query_cached_entity_list_with_kind(DF_EntityKind_Process); for(DF_EntityNode *n = processes.first; n != 0; n = n->next) { DF_Entity *process = n->entity; @@ -4930,7 +5045,7 @@ df_window_frame(DF_Window *ws) os_window_push_custom_title_bar_client_area(ws->os, user_box->rect); UI_Parent(user_box) UI_PrefWidth(ui_text_dim(10, 0)) UI_TextAlignment(UI_TextAlign_Center) { - String8 user_path = df_cfg_path_from_src(D_CfgSrc_User); + String8 user_path = df_cfg_path_from_src(DF_CfgSrc_User); user_path = str8_chop_last_dot(user_path); DF_Font(DF_FontSlot_Icons) UI_TextRasterFlags(df_raster_flags_from_slot(DF_FontSlot_Icons)) @@ -4964,7 +5079,7 @@ df_window_frame(DF_Window *ws) os_window_push_custom_title_bar_client_area(ws->os, prof_box->rect); UI_Parent(prof_box) UI_PrefWidth(ui_text_dim(10, 0)) UI_TextAlignment(UI_TextAlign_Center) { - String8 prof_path = df_cfg_path_from_src(D_CfgSrc_Project); + String8 prof_path = df_cfg_path_from_src(DF_CfgSrc_Project); prof_path = str8_chop_last_dot(prof_path); DF_Font(DF_FontSlot_Icons) ui_label(df_g_icon_kind_text_table[DF_IconKind_Briefcase]); @@ -8424,7 +8539,7 @@ df_setting_val_from_code(DF_SettingCode code) } if(result.set == 0) { - for(EachEnumVal(D_CfgSrc, src)) + for(EachEnumVal(DF_CfgSrc, src)) { if(df_state->cfg_setting_vals[src][code].set) { @@ -8445,7 +8560,7 @@ df_qsort_compare__cfg_string_bindings(DF_StringBindingPair *a, DF_StringBindingP } internal String8List -df_cfg_strings_from_gfx(Arena *arena, String8 root_path, D_CfgSrc source) +df_cfg_strings_from_gfx(Arena *arena, String8 root_path, DF_CfgSrc source) { ProfBeginFunction(); local_persist char *spaces = " "; @@ -8595,7 +8710,7 @@ df_cfg_strings_from_gfx(Arena *arena, String8 root_path, D_CfgSrc source) } //- rjf: write exception code filters - if(source == D_CfgSrc_Project) + if(source == DF_CfgSrc_Project) { str8_list_push(arena, &strs, str8_lit("/// exception code filters ////////////////////////////////////////////////////\n")); str8_list_push(arena, &strs, str8_lit("\n")); @@ -8819,7 +8934,7 @@ df_cfg_strings_from_gfx(Arena *arena, String8 root_path, D_CfgSrc source) } //- rjf: serialize keybindings - if(source == D_CfgSrc_User) + if(source == DF_CfgSrc_User) { Temp scratch = scratch_begin(&arena, 1); String8 indent_str = str8_lit(" "); @@ -8873,7 +8988,7 @@ df_cfg_strings_from_gfx(Arena *arena, String8 root_path, D_CfgSrc source) } //- rjf: serialize theme colors - if(source == D_CfgSrc_User) + if(source == DF_CfgSrc_User) { // rjf: determine if this theme matches an existing preset B32 is_preset = 0; @@ -8932,7 +9047,7 @@ df_cfg_strings_from_gfx(Arena *arena, String8 root_path, D_CfgSrc source) } //- rjf: serialize fonts - if(source == D_CfgSrc_User) + if(source == DF_CfgSrc_User) { String8 code_font_path_escaped = escaped_from_raw_str8(arena, df_state->cfg_code_font_path); String8 main_font_path_escaped = escaped_from_raw_str8(arena, df_state->cfg_main_font_path); @@ -9122,7 +9237,7 @@ df_frame_arena(void) //- rjf: config paths internal String8 -df_cfg_path_from_src(D_CfgSrc src) +df_cfg_path_from_src(DF_CfgSrc src) { return df_state->cfg_paths[src]; } @@ -9490,8 +9605,8 @@ df_init(CmdLine *cmdln) } // rjf: set up config path state - String8 cfg_src_paths[D_CfgSrc_COUNT] = {user_cfg_path, project_cfg_path}; - for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1)) + String8 cfg_src_paths[DF_CfgSrc_COUNT] = {user_cfg_path, project_cfg_path}; + for(DF_CfgSrc src = (DF_CfgSrc)0; src < DF_CfgSrc_COUNT; src = (DF_CfgSrc)(src+1)) { df_state->cfg_path_arenas[src] = arena_alloc(); df_cmd(d_cfg_src_load_cmd_kind_table[src], .file_path = path_normalized_from_string(scratch.arena, cfg_src_paths[src])); @@ -9686,7 +9801,7 @@ df_frame(void) df_request_frame(); df_unbind_name(df_state->bind_change_cmd_name, df_state->bind_change_binding); df_state->bind_change_active = 0; - df_cmd(d_cfg_src_write_cmd_kind_table[D_CfgSrc_User]); + df_cmd(d_cfg_src_write_cmd_kind_table[DF_CfgSrc_User]); } for(OS_Event *event = events.first, *next = 0; event != 0; event = next) { @@ -9713,7 +9828,7 @@ df_frame(void) U32 codepoint = os_codepoint_from_event_flags_and_key(event->flags, event->key); os_text(&events, os_handle_zero(), codepoint); os_eat_event(&events, event); - df_cmd(d_cfg_src_write_cmd_kind_table[D_CfgSrc_User]); + df_cmd(d_cfg_src_write_cmd_kind_table[DF_CfgSrc_User]); df_request_frame(); break; } @@ -10187,7 +10302,7 @@ df_frame(void) originating_window = df_state->first_window; } OS_Handle preferred_monitor = {0}; - DF_Window *new_ws = df_window_open(v2f32(1280, 720), preferred_monitor, D_CfgSrc_User); + DF_Window *new_ws = df_window_open(v2f32(1280, 720), preferred_monitor, DF_CfgSrc_User); if(originating_window) { MemoryCopy(new_ws->setting_vals, originating_window->setting_vals, sizeof(DF_SettingVal)*DF_SettingCode_COUNT); @@ -10265,8 +10380,8 @@ df_frame(void) case DF_CmdKind_OpenUser: case DF_CmdKind_OpenProject: { - B32 load_cfg[D_CfgSrc_COUNT] = {0}; - for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1)) + B32 load_cfg[DF_CfgSrc_COUNT] = {0}; + for(DF_CfgSrc src = (DF_CfgSrc)0; src < DF_CfgSrc_COUNT; src = (DF_CfgSrc)(src+1)) { load_cfg[src] = (kind == d_cfg_src_load_cmd_kind_table[src]); } @@ -10294,7 +10409,7 @@ df_frame(void) //- rjf: set new config paths if(file_is_okay) { - for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1)) + for(DF_CfgSrc src = (DF_CfgSrc)0; src < DF_CfgSrc_COUNT; src = (DF_CfgSrc)(src+1)) { if(load_cfg[src]) { @@ -10305,10 +10420,10 @@ df_frame(void) } //- rjf: get config file properties - FileProperties cfg_props[D_CfgSrc_COUNT] = {0}; + FileProperties cfg_props[DF_CfgSrc_COUNT] = {0}; if(file_is_okay) { - for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1)) + for(DF_CfgSrc src = (DF_CfgSrc)0; src < DF_CfgSrc_COUNT; src = (DF_CfgSrc)(src+1)) { String8 path = df_cfg_path_from_src(src); cfg_props[src] = os_properties_from_file_path(path); @@ -10316,11 +10431,11 @@ df_frame(void) } //- rjf: load files - String8 cfg_data[D_CfgSrc_COUNT] = {0}; - U64 cfg_timestamps[D_CfgSrc_COUNT] = {0}; + String8 cfg_data[DF_CfgSrc_COUNT] = {0}; + U64 cfg_timestamps[DF_CfgSrc_COUNT] = {0}; if(file_is_okay) { - for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1)) + for(DF_CfgSrc src = (DF_CfgSrc)0; src < DF_CfgSrc_COUNT; src = (DF_CfgSrc)(src+1)) { String8 path = df_cfg_path_from_src(src); OS_Handle file = os_file_open(OS_AccessFlag_ShareRead|OS_AccessFlag_Read, path); @@ -10336,21 +10451,21 @@ df_frame(void) } //- rjf: determine if we need to save config - B32 cfg_save[D_CfgSrc_COUNT] = {0}; + B32 cfg_save[DF_CfgSrc_COUNT] = {0}; if(file_is_okay) { - for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1)) + for(DF_CfgSrc src = (DF_CfgSrc)0; src < DF_CfgSrc_COUNT; src = (DF_CfgSrc)(src+1)) { cfg_save[src] = (load_cfg[src] && cfg_props[src].created == 0); } } //- rjf: determine if we need to reload config - B32 cfg_load[D_CfgSrc_COUNT] = {0}; + B32 cfg_load[DF_CfgSrc_COUNT] = {0}; B32 cfg_load_any = 0; if(file_is_okay) { - for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1)) + for(DF_CfgSrc src = (DF_CfgSrc)0; src < DF_CfgSrc_COUNT; src = (DF_CfgSrc)(src+1)) { cfg_load[src] = (load_cfg[src] && ((cfg_save[src] == 0 && df_state->cfg_cached_timestamp[src] != cfg_timestamps[src]) || cfg_props[src].created == 0)); cfg_load_any = cfg_load_any || cfg_load[src]; @@ -10362,7 +10477,7 @@ df_frame(void) { arena_clear(df_state->cfg_arena); MemoryZeroStruct(&df_state->cfg_table); - for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1)) + for(DF_CfgSrc src = (DF_CfgSrc)0; src < DF_CfgSrc_COUNT; src = (DF_CfgSrc)(src+1)) { d_cfg_table_push_unparsed_string(df_state->cfg_arena, &df_state->cfg_table, cfg_data[src], src); } @@ -10375,7 +10490,7 @@ df_frame(void) // if(file_is_okay) { - for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1)) + for(DF_CfgSrc src = (DF_CfgSrc)0; src < DF_CfgSrc_COUNT; src = (DF_CfgSrc)(src+1)) { if(cfg_load[src]) { @@ -10389,7 +10504,7 @@ df_frame(void) //- rjf: save => dispatch write if(file_is_okay) { - for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1)) + for(DF_CfgSrc src = (DF_CfgSrc)0; src < DF_CfgSrc_COUNT; src = (DF_CfgSrc)(src+1)) { if(cfg_save[src]) { @@ -10414,8 +10529,8 @@ df_frame(void) OS_HandleArray monitors = os_push_monitors_array(scratch.arena); //- rjf: get config source - D_CfgSrc src = D_CfgSrc_User; - for(D_CfgSrc s = (D_CfgSrc)0; s < D_CfgSrc_COUNT; s = (D_CfgSrc)(s+1)) + DF_CfgSrc src = DF_CfgSrc_User; + for(DF_CfgSrc s = (DF_CfgSrc)0; s < DF_CfgSrc_COUNT; s = (DF_CfgSrc)(s+1)) { if(kind == d_cfg_src_apply_cmd_kind_table[s]) { @@ -10429,7 +10544,7 @@ df_frame(void) String8 cfg_folder = str8_chop_last_slash(cfg_path); //- rjf: keep track of recent projects - if(src == D_CfgSrc_Project) + if(src == DF_CfgSrc_Project) { DF_EntityList recent_projects = d_query_cached_entity_list_with_kind(DF_EntityKind_RecentProject); DF_Entity *recent_project = &d_nil_entity; @@ -10445,7 +10560,7 @@ df_frame(void) { recent_project = df_entity_alloc(df_entity_root(), DF_EntityKind_RecentProject); df_entity_equip_name(recent_project, path_normalized_from_string(scratch.arena, cfg_path)); - df_entity_equip_cfg_src(recent_project, D_CfgSrc_User); + df_entity_equip_cfg_src(recent_project, DF_CfgSrc_User); } } @@ -10997,7 +11112,7 @@ df_frame(void) } //- rjf: apply keybindings - if(src == D_CfgSrc_User) + if(src == DF_CfgSrc_User) { df_clear_bindings(); } @@ -11208,7 +11323,7 @@ df_frame(void) } //- rjf: if config applied 0 settings, we need to do some sensible default - if(src == D_CfgSrc_User) + if(src == DF_CfgSrc_User) { for(EachEnumVal(DF_SettingCode, code)) { @@ -11220,12 +11335,12 @@ df_frame(void) } //- rjf: if config opened 0 windows, we need to do some sensible default - if(src == D_CfgSrc_User && windows->first == &d_nil_cfg_tree) + if(src == DF_CfgSrc_User && windows->first == &d_nil_cfg_tree) { OS_Handle preferred_monitor = os_primary_monitor(); Vec2F32 monitor_dim = os_dim_from_monitor(preferred_monitor); Vec2F32 window_dim = v2f32(monitor_dim.x*4/5, monitor_dim.y*4/5); - DF_Window *ws = df_window_open(window_dim, preferred_monitor, D_CfgSrc_User); + DF_Window *ws = df_window_open(window_dim, preferred_monitor, DF_CfgSrc_User); if(monitor_dim.x < 1920) { df_cmd(DF_CmdKind_ResetToCompactPanels); @@ -11237,7 +11352,7 @@ df_frame(void) } //- rjf: if config bound 0 keys, we need to do some sensible default - if(src == D_CfgSrc_User && df_state->key_map_total_count == 0) + if(src == DF_CfgSrc_User && df_state->key_map_total_count == 0) { for(U64 idx = 0; idx < ArrayCount(df_g_default_binding_table); idx += 1) { @@ -11247,7 +11362,7 @@ df_frame(void) } //- rjf: always ensure that the meta controls have bindings - if(src == D_CfgSrc_User) + if(src == DF_CfgSrc_User) { struct { @@ -11276,8 +11391,8 @@ df_frame(void) case DF_CmdKind_WriteUserData: case DF_CmdKind_WriteProjectData: { - D_CfgSrc src = D_CfgSrc_User; - for(D_CfgSrc s = (D_CfgSrc)0; s < D_CfgSrc_COUNT; s = (D_CfgSrc)(s+1)) + DF_CfgSrc src = DF_CfgSrc_User; + for(DF_CfgSrc s = (DF_CfgSrc)0; s < DF_CfgSrc_COUNT; s = (DF_CfgSrc)(s+1)) { if(kind == d_cfg_src_write_cmd_kind_table[s]) { @@ -12353,7 +12468,7 @@ df_frame(void) } // rjf: dispatch cfg saves - for(D_CfgSrc src = (D_CfgSrc)0; src < D_CfgSrc_COUNT; src = (D_CfgSrc)(src+1)) + for(DF_CfgSrc src = (DF_CfgSrc)0; src < DF_CfgSrc_COUNT; src = (DF_CfgSrc)(src+1)) { DF_CmdKind write_cmd = d_cfg_src_write_cmd_kind_table[src]; df_cmd(write_cmd, .file_path = df_cfg_path_from_src(src)); @@ -13188,7 +13303,7 @@ df_frame(void) if(!removed_already_existing) { DF_Entity *bp = df_entity_alloc(df_entity_root(), DF_EntityKind_Breakpoint); - df_entity_equip_cfg_src(bp, D_CfgSrc_Project); + df_entity_equip_cfg_src(bp, DF_CfgSrc_Project); DF_Entity *loc = df_entity_alloc(bp, DF_EntityKind_Location); if(file_path.size != 0 && pt.line != 0) { @@ -13241,7 +13356,7 @@ df_frame(void) { DF_Entity *wp = df_entity_alloc(df_entity_root(), DF_EntityKind_WatchPin); df_entity_equip_name(wp, string); - df_entity_equip_cfg_src(wp, D_CfgSrc_Project); + df_entity_equip_cfg_src(wp, DF_CfgSrc_Project); DF_Entity *loc = df_entity_alloc(wp, DF_EntityKind_Location); if(file_path.size != 0 && pt.line != 0) { @@ -13264,7 +13379,7 @@ df_frame(void) { DF_Entity *watch = &d_nil_entity; watch = df_entity_alloc(df_entity_root(), DF_EntityKind_Watch); - df_entity_equip_cfg_src(watch, D_CfgSrc_Project); + df_entity_equip_cfg_src(watch, DF_CfgSrc_Project); df_entity_equip_name(watch, df_regs()->string); } else @@ -13364,7 +13479,7 @@ df_frame(void) DF_Entity *entity = &d_nil_entity; entity = df_entity_alloc(df_entity_root(), DF_EntityKind_Target); df_entity_equip_disabled(entity, 1); - df_entity_equip_cfg_src(entity, D_CfgSrc_Project); + df_entity_equip_cfg_src(entity, DF_CfgSrc_Project); DF_Entity *exe = df_entity_alloc(entity, DF_EntityKind_Executable); df_entity_equip_name(exe, df_regs()->file_path); String8 working_dir = str8_chop_last_slash(df_regs()->file_path); diff --git a/src/dbg_frontend/dbg_frontend_core.h b/src/dbg_frontend/dbg_frontend_core.h index 8de68c40..827cbb30 100644 --- a/src/dbg_frontend/dbg_frontend_core.h +++ b/src/dbg_frontend/dbg_frontend_core.h @@ -4,6 +4,31 @@ #ifndef DBG_FRONTEND_CORE_H #define DBG_FRONTEND_CORE_H +//////////////////////////////// +//~ rjf: Handles + +typedef struct D_Handle D_Handle; +struct D_Handle +{ + U64 u64[2]; +}; + +typedef struct D_HandleNode D_HandleNode; +struct D_HandleNode +{ + D_HandleNode *next; + D_HandleNode *prev; + D_Handle handle; +}; + +typedef struct D_HandleList D_HandleList; +struct D_HandleList +{ + D_HandleNode *first; + D_HandleNode *last; + U64 count; +}; + //////////////////////////////// //~ rjf: Entity Kind Flags @@ -31,7 +56,7 @@ enum }; //////////////////////////////// -//~ rjf: Entity Kind Flags +//~ rjf: Entity Flags typedef U32 DF_EntityFlags; enum @@ -458,6 +483,44 @@ enum #include "generated/dbg_frontend.meta.h" +//////////////////////////////// +//~ rjf: Config Types + +typedef struct D_CfgTree D_CfgTree; +struct D_CfgTree +{ + D_CfgTree *next; + DF_CfgSrc source; + MD_Node *root; +}; + +typedef struct D_CfgVal D_CfgVal; +struct D_CfgVal +{ + D_CfgVal *hash_next; + D_CfgVal *linear_next; + D_CfgTree *first; + D_CfgTree *last; + U64 insertion_stamp; + String8 string; +}; + +typedef struct D_CfgSlot D_CfgSlot; +struct D_CfgSlot +{ + D_CfgVal *first; +}; + +typedef struct D_CfgTable D_CfgTable; +struct D_CfgTable +{ + U64 slot_count; + D_CfgSlot *slots; + U64 insertion_stamp_counter; + D_CfgVal *first_val; + D_CfgVal *last_val; +}; + //////////////////////////////// //~ rjf: Entity Types @@ -487,7 +550,7 @@ struct DF_Entity B32 disabled; U64 u64; Vec4F32 color_hsva; - D_CfgSrc cfg_src; + DF_CfgSrc cfg_src; U64 timestamp; // rjf: ctrl equipment @@ -705,7 +768,7 @@ struct DF_Window DF_Window *prev; U64 gen; U64 frames_alive; - D_CfgSrc cfg_src; + DF_CfgSrc cfg_src; // rjf: top-level info & handles Arena *arena; @@ -967,9 +1030,9 @@ struct DF_State DF_Regs *next_hover_regs; // rjf: config reading state - Arena *cfg_path_arenas[D_CfgSrc_COUNT]; - String8 cfg_paths[D_CfgSrc_COUNT]; - U64 cfg_cached_timestamp[D_CfgSrc_COUNT]; + Arena *cfg_path_arenas[DF_CfgSrc_COUNT]; + String8 cfg_paths[DF_CfgSrc_COUNT]; + U64 cfg_cached_timestamp[DF_CfgSrc_COUNT]; Arena *cfg_arena; D_CfgTable cfg_table; U64 ctrl_exception_code_filters[(CTRL_ExceptionCodeKind_COUNT+63)/64]; @@ -984,7 +1047,7 @@ struct DF_State FNT_Tag cfg_font_tags[DF_FontSlot_COUNT]; // derivative from font paths // rjf: global settings - DF_SettingVal cfg_setting_vals[D_CfgSrc_COUNT][DF_SettingCode_COUNT]; + DF_SettingVal cfg_setting_vals[DF_CfgSrc_COUNT][DF_SettingCode_COUNT]; // rjf: icon texture R_Handle icon_texture; @@ -997,6 +1060,9 @@ struct DF_State //////////////////////////////// //~ rjf: Globals +read_only global D_CfgTree d_nil_cfg_tree = {&d_nil_cfg_tree, DF_CfgSrc_User, &md_nil_node}; +read_only global D_CfgVal d_nil_cfg_val = {&d_nil_cfg_val, &d_nil_cfg_val, &d_nil_cfg_tree, &d_nil_cfg_tree}; + read_only global DF_Entity d_nil_entity = { &d_nil_entity, @@ -1054,6 +1120,21 @@ global DF_DragDropPayload df_drag_drop_payload = {0}; global D_Handle df_last_drag_drop_panel = {0}; global D_Handle df_last_drag_drop_prev_tab = {0}; +//////////////////////////////// +//~ rjf: Handle Type Pure Functions + +internal D_Handle d_handle_zero(void); +internal B32 d_handle_match(D_Handle a, D_Handle b); +internal void d_handle_list_push_node(D_HandleList *list, D_HandleNode *node); +internal void d_handle_list_push(Arena *arena, D_HandleList *list, D_Handle handle); +internal D_HandleList d_handle_list_copy(Arena *arena, D_HandleList list); + +//////////////////////////////// +//~ rjf: Config Type Pure Functions + +internal void d_cfg_table_push_unparsed_string(Arena *arena, D_CfgTable *table, String8 string, DF_CfgSrc source); +internal D_CfgVal *d_cfg_val_from_string(D_CfgTable *table, String8 string); + //////////////////////////////// //~ rjf: Registers Type Functions @@ -1213,7 +1294,7 @@ internal void df_entity_equip_disabled(DF_Entity *entity, B32 b32); internal void df_entity_equip_u64(DF_Entity *entity, U64 u64); internal void df_entity_equip_color_rgba(DF_Entity *entity, Vec4F32 rgba); internal void df_entity_equip_color_hsva(DF_Entity *entity, Vec4F32 hsva); -internal void df_entity_equip_cfg_src(DF_Entity *entity, D_CfgSrc cfg_src); +internal void df_entity_equip_cfg_src(DF_Entity *entity, DF_CfgSrc cfg_src); internal void df_entity_equip_timestamp(DF_Entity *entity, U64 timestamp); //- rjf: control layer correllation equipment @@ -1340,7 +1421,7 @@ internal void df_panel_release_all_views(DF_Panel *panel); //////////////////////////////// //~ rjf: Window State Functions -internal DF_Window *df_window_open(Vec2F32 size, OS_Handle preferred_monitor, D_CfgSrc cfg_src); +internal DF_Window *df_window_open(Vec2F32 size, OS_Handle preferred_monitor, DF_CfgSrc cfg_src); internal DF_Window *df_window_from_os_handle(OS_Handle os); @@ -1404,7 +1485,7 @@ internal DF_SettingVal df_setting_val_from_code(DF_SettingCode code); //- rjf: config serialization internal int df_qsort_compare__cfg_string_bindings(DF_StringBindingPair *a, DF_StringBindingPair *b); -internal String8List df_cfg_strings_from_gfx(Arena *arena, String8 root_path, D_CfgSrc source); +internal String8List df_cfg_strings_from_gfx(Arena *arena, String8 root_path, DF_CfgSrc source); //////////////////////////////// //~ rjf: Process Control Info Stringification @@ -1424,7 +1505,7 @@ internal void df_request_frame(void); internal Arena *df_frame_arena(void); //- rjf: config paths -internal String8 df_cfg_path_from_src(D_CfgSrc src); +internal String8 df_cfg_path_from_src(DF_CfgSrc src); //- rjf: entity cache queries internal DF_EntityList d_query_cached_entity_list_with_kind(DF_EntityKind kind); diff --git a/src/dbg_frontend/dbg_frontend_views.c b/src/dbg_frontend/dbg_frontend_views.c index 0d46cf14..d30b0c62 100644 --- a/src/dbg_frontend/dbg_frontend_views.c +++ b/src/dbg_frontend/dbg_frontend_views.c @@ -1737,7 +1737,7 @@ df_watch_view_build(DF_View *view, DF_WatchViewState *ewv, B32 modifiable, U32 d else if(editing_complete && new_string.size != 0 && ev_key_match(pt.key, empty_row_key)) { watch = df_entity_alloc(df_entity_root(), mutable_entity_kind); - df_entity_equip_cfg_src(watch, D_CfgSrc_Project); + df_entity_equip_cfg_src(watch, DF_CfgSrc_Project); df_entity_equip_name(watch, new_string); EV_Key key = df_ev_key_from_entity(watch); ev_key_set_view_rule(eval_view, key, str8_zero()); @@ -9039,7 +9039,7 @@ DF_VIEW_UI_FUNCTION_DEF(settings) S32 slider_s32_val = 0; F32 slider_pct = 0.f; UI_BoxFlags flags = UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawHotEffects|UI_BoxFlag_DrawActiveEffects; - DF_SettingVal *val_table = &df_state->cfg_setting_vals[D_CfgSrc_User][0]; + DF_SettingVal *val_table = &df_state->cfg_setting_vals[DF_CfgSrc_User][0]; switch(item->kind) { case DF_SettingsItemKind_COUNT:{}break; diff --git a/src/dbg_frontend/dbg_frontend_widgets.c b/src/dbg_frontend/dbg_frontend_widgets.c index 4aa1e014..a550fe07 100644 --- a/src/dbg_frontend/dbg_frontend_widgets.c +++ b/src/dbg_frontend/dbg_frontend_widgets.c @@ -606,7 +606,7 @@ df_entity_desc_button(DF_Entity *entity, FuzzyMatchRangeList *name_matches, Stri palette = df_palette_from_code(DF_PaletteCode_NegativePopButton); } } - if(entity->cfg_src == D_CfgSrc_CommandLine) + if(entity->cfg_src == DF_CfgSrc_CommandLine) { palette = df_palette_from_code(DF_PaletteCode_NeutralPopButton); } @@ -642,7 +642,7 @@ df_entity_desc_button(DF_Entity *entity, FuzzyMatchRangeList *name_matches, Stri UI_PrefWidth(ui_em(1.875f, 1.f)) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) ui_label(df_g_icon_kind_text_table[icon]); - if(entity->cfg_src == D_CfgSrc_CommandLine) + if(entity->cfg_src == DF_CfgSrc_CommandLine) { UI_TextAlignment(UI_TextAlign_Center) UI_PrefWidth(ui_em(1.875f, 1.f)) diff --git a/src/dbg_frontend/generated/dbg_frontend.meta.c b/src/dbg_frontend/generated/dbg_frontend.meta.c index fd5ffa66..64cbcb0e 100644 --- a/src/dbg_frontend/generated/dbg_frontend.meta.c +++ b/src/dbg_frontend/generated/dbg_frontend.meta.c @@ -4,6 +4,14 @@ //- GENERATED CODE C_LINKAGE_BEGIN +String8 d_cfg_src_string_table[4] = +{ +str8_lit_comp("user"), +str8_lit_comp("project"), +str8_lit_comp("command_line"), +str8_lit_comp("transient"), +}; + DF_CmdKind d_cfg_src_load_cmd_kind_table[4] = { DF_CmdKind_OpenUser, diff --git a/src/dbg_frontend/generated/dbg_frontend.meta.h b/src/dbg_frontend/generated/dbg_frontend.meta.h index 19a3f452..0d08356d 100644 --- a/src/dbg_frontend/generated/dbg_frontend.meta.h +++ b/src/dbg_frontend/generated/dbg_frontend.meta.h @@ -6,6 +6,15 @@ #ifndef DBG_FRONTEND_META_H #define DBG_FRONTEND_META_H +typedef enum DF_CfgSrc +{ +DF_CfgSrc_User, +DF_CfgSrc_Project, +DF_CfgSrc_CommandLine, +DF_CfgSrc_Transient, +DF_CfgSrc_COUNT, +} DF_CfgSrc; + typedef enum DF_EntityKind { DF_EntityKind_Nil, @@ -777,6 +786,7 @@ DF_VIEW_UI_FUNCTION_DEF(exception_filters); DF_VIEW_UI_FUNCTION_DEF(settings); C_LINKAGE_BEGIN +extern String8 d_cfg_src_string_table[4]; extern DF_CmdKind d_cfg_src_load_cmd_kind_table[4]; extern DF_CmdKind d_cfg_src_write_cmd_kind_table[4]; extern DF_CmdKind d_cfg_src_apply_cmd_kind_table[4]; diff --git a/src/raddbg/raddbg_main.c b/src/raddbg/raddbg_main.c index 9727d852..91f67a20 100644 --- a/src/raddbg/raddbg_main.c +++ b/src/raddbg/raddbg_main.c @@ -776,7 +776,7 @@ entry_point(CmdLine *cmd_line) { Temp scratch = scratch_begin(0, 0); DF_Entity *target = df_entity_alloc(df_entity_root(), DF_EntityKind_Target); - df_entity_equip_cfg_src(target, D_CfgSrc_CommandLine); + df_entity_equip_cfg_src(target, DF_CfgSrc_CommandLine); String8List passthrough_args_list = {0}; for(String8Node *n = args.first->next; n != 0; n = n->next) {