From 282f6022e1d5d9d7bde3054e7a61c7adcdc338ad Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Sat, 26 Apr 2025 17:30:34 -0700 Subject: [PATCH] begin color editing, fix some bugs with meta-type-info disrupting type chain scans --- src/eval/eval.mdesk | 2 + src/eval/eval_types.c | 8 ++- src/eval/generated/eval.meta.h | 2 + .../eval_visualization_core.c | 23 +++---- src/raddbg/generated/raddbg.meta.c | 16 +++-- src/raddbg/generated/raddbg.meta.h | 6 +- src/raddbg/raddbg.mdesk | 37 ++++++++++- src/raddbg/raddbg_core.c | 53 +++++++++++++++- src/raddbg/raddbg_core.h | 2 + src/raddbg/raddbg_eval.c | 61 +++++++++++++++++++ src/raddbg/raddbg_eval.h | 1 + src/raddbg/raddbg_views.c | 13 ++-- src/raddbg/raddbg_widgets.c | 17 ++++++ 13 files changed, 211 insertions(+), 30 deletions(-) diff --git a/src/eval/eval.mdesk b/src/eval/eval.mdesk index e4d88531..5717a44d 100644 --- a/src/eval/eval.mdesk +++ b/src/eval/eval.mdesk @@ -183,6 +183,8 @@ e_token_kind_strings: `LastSigned2 = E_TypeKind_S512`, `FirstIncomplete = E_TypeKind_IncompleteStruct`, `LastIncomplete = E_TypeKind_IncompleteEnum`, + `FirstMeta = E_TypeKind_MetaExpr`, + `LastMeta = E_TypeKind_MetaDescription`, } @data(String8) e_type_kind_basic_string_table: diff --git a/src/eval/eval_types.c b/src/eval/eval_types.c index 8f4fe480..2fa75880 100644 --- a/src/eval/eval_types.c +++ b/src/eval/eval_types.c @@ -1382,14 +1382,14 @@ e_expand_rule_from_type_key(E_TypeKey key) { E_TypeExpandRule *rule = &e_type_expand_rule__default; { - E_Type *type = e_type_from_key__cached(key); + E_Type *type = e_type_from_key__cached(e_type_key_unwrap(key, E_TypeUnwrapFlag_Meta)); if(type->expand.info != 0) { rule = &type->expand; } for(E_Type *lens_type = type; lens_type->kind == E_TypeKind_Lens || lens_type->kind == E_TypeKind_Set; - lens_type = e_type_from_key__cached(lens_type->direct_type_key)) + lens_type = e_type_from_key__cached(e_type_key_unwrap(lens_type->direct_type_key, E_TypeUnwrapFlag_Meta))) { if(lens_type->expand.info != 0) { @@ -1746,6 +1746,8 @@ e_type_lhs_string_from_key(Arena *arena, E_TypeKey key, String8List *out, U32 pr }break; case E_TypeKind_MetaExpr: + case E_TypeKind_MetaDisplayName: + case E_TypeKind_MetaDescription: { E_TypeKey direct = e_type_key_direct(key); e_type_lhs_string_from_key(arena, direct, out, prec, skip_return); @@ -1905,7 +1907,7 @@ e_default_expansion_type_from_key(E_TypeKey root_key) //- rjf: if we have meta-expression tags in the type chain, defer // to the next type in the chain. - else if(kind == E_TypeKind_MetaExpr) + else if(E_TypeKind_FirstMeta <= kind && kind <= E_TypeKind_LastMeta) { done = 0; } diff --git a/src/eval/generated/eval.meta.h b/src/eval/generated/eval.meta.h index 5bd73d8d..8e3e570b 100644 --- a/src/eval/generated/eval.meta.h +++ b/src/eval/generated/eval.meta.h @@ -91,6 +91,8 @@ E_TypeKind_FirstSigned2 = E_TypeKind_S8, E_TypeKind_LastSigned2 = E_TypeKind_S512, E_TypeKind_FirstIncomplete = E_TypeKind_IncompleteStruct, E_TypeKind_LastIncomplete = E_TypeKind_IncompleteEnum, +E_TypeKind_FirstMeta = E_TypeKind_MetaExpr, +E_TypeKind_LastMeta = E_TypeKind_MetaDescription, } E_TypeKind; typedef U32 E_ExprKind; diff --git a/src/eval_visualization/eval_visualization_core.c b/src/eval_visualization/eval_visualization_core.c index fef05868..d817f242 100644 --- a/src/eval_visualization/eval_visualization_core.c +++ b/src/eval_visualization/eval_visualization_core.c @@ -417,9 +417,9 @@ ev_expand_rule_from_type_key(E_TypeKey type_key) { EV_ExpandRule *rule = &ev_nil_expand_rule; { - E_TypeKey k = type_key; + E_TypeKey k = e_type_key_unwrap(type_key, E_TypeUnwrapFlag_Meta); E_TypeKind kind = e_type_kind_from_key(k); - for(;kind == E_TypeKind_Lens; k = e_type_key_direct(k), kind = e_type_kind_from_key(k)) + for(;kind == E_TypeKind_Lens; k = e_type_key_direct(e_type_key_unwrap(k, E_TypeUnwrapFlag_Meta)), kind = e_type_kind_from_key(k)) { E_Type *type = e_type_from_key__cached(k); EV_ExpandRule *candidate = ev_expand_rule_from_string(type->name); @@ -536,10 +536,10 @@ ev_block_tree_from_eval(Arena *arena, EV_View *view, String8 filter, E_Eval eval tree.total_item_count += 1; //- rjf: generate initial task, for root's evaluation - typedef struct Task Task; - struct Task + typedef struct BlockTreeBuildTask BlockTreeBuildTask; + struct BlockTreeBuildTask { - Task *next; + BlockTreeBuildTask *next; EV_Block *parent_block; E_Eval eval; E_Expr *next_expr; @@ -548,12 +548,12 @@ ev_block_tree_from_eval(Arena *arena, EV_View *view, String8 filter, E_Eval eval B32 default_expanded; B32 force_expanded; }; - Task start_task = {0, tree.root, tree.root->eval, tree.root->eval.expr->next, 1, 0}; - Task *first_task = &start_task; - Task *last_task = first_task; + BlockTreeBuildTask start_task = {0, tree.root, tree.root->eval, tree.root->eval.expr->next, 1, 0}; + BlockTreeBuildTask *first_task = &start_task; + BlockTreeBuildTask *last_task = first_task; //- rjf: iterate all expansions & generate blocks for each - for(Task *t = first_task; t != 0; t = t->next) + for(BlockTreeBuildTask *t = first_task; t != 0; t = t->next) { // rjf: get task key EV_Key key = ev_key_make(ev_hash_from_key(t->parent_block->key), t->child_id); @@ -704,7 +704,7 @@ ev_block_tree_from_eval(Arena *arena, EV_View *view, String8 filter, E_Eval eval E_Eval child_eval = {0}; type_expand_rule->range(arena, type_expand_info.user_data, t->eval, filter, r1u64(split_relative_idx, split_relative_idx+1), &child_eval); EV_Key child_key = child_keys[idx]; - Task *task = push_array(scratch.arena, Task, 1); + BlockTreeBuildTask *task = push_array(scratch.arena, BlockTreeBuildTask, 1); SLLQueuePush(first_task, last_task, task); task->parent_block = expansion_block; task->eval = child_eval; @@ -718,7 +718,7 @@ ev_block_tree_from_eval(Arena *arena, EV_View *view, String8 filter, E_Eval eval // rjf: if this expr has a sibling, push another task to continue the chain if(t->next_expr != &e_expr_nil) { - Task *task = push_array(scratch.arena, Task, 1); + BlockTreeBuildTask *task = push_array(scratch.arena, BlockTreeBuildTask, 1); task->next = t->next; t->next = task; task->parent_block = t->parent_block; @@ -1744,6 +1744,7 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string) // case E_TypeKind_Modifier: case E_TypeKind_MetaDescription: + case E_TypeKind_MetaDisplayName: { need_pop = 1; need_new_task = 1; diff --git a/src/raddbg/generated/raddbg.meta.c b/src/raddbg/generated/raddbg.meta.c index a9a8bbf9..879bb148 100644 --- a/src/raddbg/generated/raddbg.meta.c +++ b/src/raddbg/generated/raddbg.meta.c @@ -52,7 +52,7 @@ str8_lit_comp(""), str8_lit_comp(""), }; -RD_VocabInfo rd_vocab_info_table[316] = +RD_VocabInfo rd_vocab_info_table[319] = { {str8_lit_comp("auto_view_rule"), str8_lit_comp("auto_view_rules"), str8_lit_comp("Auto View Rule"), str8_lit_comp("Auto View Rules"), RD_IconKind_Binoculars}, {str8_lit_comp("file_path_map"), str8_lit_comp("file_path_maps"), str8_lit_comp("File Path Map"), str8_lit_comp("File Path Maps"), RD_IconKind_FileOutline}, @@ -65,6 +65,7 @@ RD_VocabInfo rd_vocab_info_table[316] = {str8_lit_comp("source_location"), str8_lit_comp("source_locations"), str8_lit_comp("Source Location"), str8_lit_comp("Source Locations"), RD_IconKind_Null}, {str8_lit_comp("address_location"), str8_lit_comp("address_locations"), str8_lit_comp("Address Location"), str8_lit_comp("Address Locations"), RD_IconKind_Null}, {str8_lit_comp("target"), str8_lit_comp("targets"), str8_lit_comp("Target"), str8_lit_comp("Targets"), RD_IconKind_Target}, +{str8_lit_comp("color"), str8_lit_comp("colors"), str8_lit_comp("Color"), str8_lit_comp("Colors"), RD_IconKind_Palette}, {str8_lit_comp("executable"), str8_lit_comp("executables"), str8_lit_comp("Executable"), str8_lit_comp("Executables"), RD_IconKind_Module}, {str8_lit_comp("arguments"), str8_lit_comp("arguments"), str8_lit_comp("Arguments"), str8_lit_comp("Arguments"), RD_IconKind_Null}, {str8_lit_comp("exe"), str8_lit_comp("exes"), str8_lit_comp("Executable"), str8_lit_comp("Executables"), RD_IconKind_Module}, @@ -332,6 +333,8 @@ RD_VocabInfo rd_vocab_info_table[316] = {str8_lit_comp("add_watch_pin"), str8_lit_comp(""), str8_lit_comp("Add Watch Pin"), str8_lit_comp(""), RD_IconKind_Pin}, {str8_lit_comp("toggle_watch_pin"), str8_lit_comp(""), str8_lit_comp("Toggle Watch Pin"), str8_lit_comp(""), RD_IconKind_Pin}, {str8_lit_comp("add_auto_view_rule"), str8_lit_comp(""), str8_lit_comp("Add Auto View Rule"), str8_lit_comp(""), RD_IconKind_Binoculars}, +{str8_lit_comp("add_color"), str8_lit_comp(""), str8_lit_comp("Add Color"), str8_lit_comp(""), RD_IconKind_Palette}, +{str8_lit_comp("import_colors"), str8_lit_comp(""), str8_lit_comp("Import Colors"), str8_lit_comp(""), RD_IconKind_Palette}, {str8_lit_comp("set_next_statement"), str8_lit_comp(""), str8_lit_comp("Set Next Statement"), str8_lit_comp(""), RD_IconKind_RightArrow}, {str8_lit_comp("add_target"), str8_lit_comp(""), str8_lit_comp("Add Target"), str8_lit_comp(""), RD_IconKind_Target}, {str8_lit_comp("select_target"), str8_lit_comp(""), str8_lit_comp("Select Target"), str8_lit_comp(""), RD_IconKind_Target}, @@ -372,10 +375,11 @@ RD_VocabInfo rd_vocab_info_table[316] = {str8_lit_comp("memory"), str8_lit_comp(""), str8_lit_comp("Memory"), str8_lit_comp(""), RD_IconKind_Grid}, }; -RD_NameSchemaInfo rd_name_schema_info_table[21] = +RD_NameSchemaInfo rd_name_schema_info_table[22] = { -{str8_lit_comp("user"), str8_lit_comp("x:\n{\n //- rjf: animations\n @default(1) 'hover_animations': bool,\n @default(1) 'press_animations': bool,\n @default(0) 'focus_animations': bool,\n @default(1) 'tooltip_animations': bool,\n @default(1) 'menu_animations': bool,\n @default(1) 'scrolling_animations': bool,\n\n //- rjf: fonts\n 'main_font': string,\n 'code_font': string,\n\n //- rjf: thread & breakpoint decorations\n @default(1) @display_name('Thread Lines') @description(\"Controls whether or not a long horizontal line is drawn before the next line or instruction that the selected thread will execute in source and disassembly views.\")\n 'thread_lines': bool,\n @default(1) @display_name('Thread Glow') @description(\"Controls whether or not a glowing effect is drawn on the selected thread in source and disassembly views.\")\n 'thread_glow': bool,\n @default(1) @display_name('Breakpoint Lines') @description(\"Controls whether or not a long horizontal line is drawn before the line or instruction at which a breakpoint is placed, in source and disassembly views.\")\n 'breakpoint_lines': bool,\n @default(1) @display_name('Breakpoint Glow') @description(\"Controls whether or not a glowing effect is drawn on breakpoints in source and disassembly views.\")\n 'breakpoint_glow': bool,\n\n //- rjf: occluding background settings\n @default(0) @display_name('Opaque Backgrounds') @description(\"Controls whether or not all floating background colors are forced to be fully opaque.\")\n 'opaque_backgrounds': bool,\n @default(1) @display_name('Background Blur') @description(\"Controls whether or not occluded regions behind floating elements are blurred.\")\n 'background_blur': bool,\n\n //- rjf: appearance settings\n @default(1) @display_name('Drop Shadows') @description(\"Controls whether or not drop shadows are drawn.\")\n 'drop_shadows': bool,\n @default(1.f) @display_name('Rounded Corner Amount') @description(\"Controls the degree to which UI corners are rounded.\")\n 'rounded_corner_amount': @range[0, 1] f32,\n\n //- rjf: code formatting settings\n @default(2) @display_name('User Tab Width') 'tab_width': @range[1, 32] u64,\n\n //- rjf: windows style menu bar\n @default(1) @display_name('Focus Menu Bar With Alt') @description(\"Mimics standard Windows behavior of focusing the menu bar using the Alt key.\")\n 'focus_menu_bar_with_alt': bool,\n}\n")}, +{str8_lit_comp("user"), str8_lit_comp("x:\n{\n //- rjf: animations\n @default(1) 'hover_animations': bool,\n @default(1) 'press_animations': bool,\n @default(0) 'focus_animations': bool,\n @default(1) 'tooltip_animations': bool,\n @default(1) 'menu_animations': bool,\n @default(1) 'scrolling_animations': bool,\n\n //- rjf: fonts\n 'main_font': string,\n 'code_font': string,\n\n //- rjf: colors\n @display_name('Color Preset')\n 'color_preset': string,\n @display_name('Color File')\n 'color_file': path,\n @display_name('Colors')\n 'colors': query,\n\n //- rjf: thread & breakpoint decorations\n @default(1) @display_name('Thread Lines') @description(\"Controls whether or not a long horizontal line is drawn before the next line or instruction that the selected thread will execute in source and disassembly views.\")\n 'thread_lines': bool,\n @default(1) @display_name('Thread Glow') @description(\"Controls whether or not a glowing effect is drawn on the selected thread in source and disassembly views.\")\n 'thread_glow': bool,\n @default(1) @display_name('Breakpoint Lines') @description(\"Controls whether or not a long horizontal line is drawn before the line or instruction at which a breakpoint is placed, in source and disassembly views.\")\n 'breakpoint_lines': bool,\n @default(1) @display_name('Breakpoint Glow') @description(\"Controls whether or not a glowing effect is drawn on breakpoints in source and disassembly views.\")\n 'breakpoint_glow': bool,\n\n //- rjf: occluding background settings\n @default(0) @display_name('Opaque Backgrounds') @description(\"Controls whether or not all floating background colors are forced to be fully opaque.\")\n 'opaque_backgrounds': bool,\n @default(1) @display_name('Background Blur') @description(\"Controls whether or not occluded regions behind floating elements are blurred.\")\n 'background_blur': bool,\n\n //- rjf: appearance settings\n @default(1) @display_name('Drop Shadows') @description(\"Controls whether or not drop shadows are drawn.\")\n 'drop_shadows': bool,\n @default(1.f) @display_name('Rounded Corner Amount') @description(\"Controls the degree to which UI corners are rounded.\")\n 'rounded_corner_amount': @range[0, 1] f32,\n\n //- rjf: code formatting settings\n @default(2) @display_name('User Tab Width') 'tab_width': @range[1, 32] u64,\n\n //- rjf: windows style menu bar\n @default(1) @display_name('Focus Menu Bar With Alt') @description(\"Mimics standard Windows behavior of focusing the menu bar using the Alt key.\")\n 'focus_menu_bar_with_alt': bool,\n}\n")}, {str8_lit_comp("project"), str8_lit_comp("x:\n{\n @default(2) @display_name('Project Tab Width') 'tab_width': @range[1, 32] u64,\n @default(1) @display_name(\"Break On Win32 Control-C Exceptions\") @description(\"Code: 0x40010005\")\n win32_ctrl_c: bool;\n @default(1) @display_name(\"Break On Win32 Control-Break Exceptions\") @description(\"Code: 0x40010008\")\n win32_ctrl_break: bool;\n @default(0) @display_name(\"Break On Win32 WinRT Originate Error Exceptions\") @description(\"Code: 0x40080201\")\n win32_win_rt_originate_error: bool;\n @default(0) @display_name(\"Break On Win32 WinRT Transform Error Exceptions\") @description(\"Code: 0x40080202\")\n win32_win_rt_transform_error: bool;\n @default(0) @display_name(\"Break On Win32 RPC Call Cancelled Exceptions\") @description(\"Code: 0x0000071a\")\n win32_rpc_call_cancelled: bool;\n @default(0) @display_name(\"Break On Win32 Data Type Misalignment Exceptions\") @description(\"Code: 0x80000002\")\n win32_datatype_misalignment: bool;\n @default(1) @display_name(\"Break On Win32 Access Violation Exceptions\") @description(\"Code: 0xc0000005\")\n win32_access_violation: bool;\n @default(0) @display_name(\"Break On Win32 In Page Error Exceptions\") @description(\"Code: 0xc0000006\")\n win32_in_page_error: bool;\n @default(1) @display_name(\"Break On Win32 Invalid Handle Specified Exceptions\") @description(\"Code: 0xc0000008\")\n win32_invalid_handle: bool;\n @default(0) @display_name(\"Break On Win32 Not Enough Quota Exceptions\") @description(\"Code: 0xc0000017\")\n win32_not_enough_quota: bool;\n @default(0) @display_name(\"Break On Win32 Illegal Instruction Exceptions\") @description(\"Code: 0xc000001d\")\n win32_illegal_instruction: bool;\n @default(0) @display_name(\"Break On Win32 Cannot Continue From Exception Exceptions\") @description(\"Code: 0xc0000025\")\n win32_cannot_continue_exception: bool;\n @default(0) @display_name(\"Break On Win32 Invalid Exception Disposition Returned By Handler Exceptions\") @description(\"Code: 0xc0000026\")\n win32_invalid_exception_disposition: bool;\n @default(0) @display_name(\"Break On Win32 Array Bounds Exceeded Exceptions\") @description(\"Code: 0xc000008c\")\n win32_array_bounds_exceeded: bool;\n @default(0) @display_name(\"Break On Win32 Floating-Point Denormal Operand Exceptions\") @description(\"Code: 0xc000008d\")\n win32_floating_point_denormal_operand: bool;\n @default(0) @display_name(\"Break On Win32 Floating-Point Division By Zero Exceptions\") @description(\"Code: 0xc000008e\")\n win32_floating_point_division_by_zero: bool;\n @default(0) @display_name(\"Break On Win32 Floating-Point Inexact Result Exceptions\") @description(\"Code: 0xc000008f\")\n win32_floating_point_inexact_result: bool;\n @default(0) @display_name(\"Break On Win32 Floating-Point Invalid Operation Exceptions\") @description(\"Code: 0xc0000090\")\n win32_floating_point_invalid_operation: bool;\n @default(0) @display_name(\"Break On Win32 Floating-Point Overflow Exceptions\") @description(\"Code: 0xc0000091\")\n win32_floating_point_overflow: bool;\n @default(0) @display_name(\"Break On Win32 Floating-Point Stack Check Exceptions\") @description(\"Code: 0xc0000092\")\n win32_floating_point_stack_check: bool;\n @default(0) @display_name(\"Break On Win32 Floating-Point Underflow Exceptions\") @description(\"Code: 0xc0000093\")\n win32_floating_point_underflow: bool;\n @default(0) @display_name(\"Break On Win32 Integer Division By Zero Exceptions\") @description(\"Code: 0xc0000094\")\n win32_integer_division_by_zero: bool;\n @default(0) @display_name(\"Break On Win32 Integer Overflow Exceptions\") @description(\"Code: 0xc0000095\")\n win32_integer_overflow: bool;\n @default(0) @display_name(\"Break On Win32 Privileged Instruction Exceptions\") @description(\"Code: 0xc0000096\")\n win32_privileged_instruction: bool;\n @default(0) @display_name(\"Break On Win32 Stack Overflow Exceptions\") @description(\"Code: 0xc00000fd\")\n win32_stack_overflow: bool;\n @default(0) @display_name(\"Break On Win32 Unable To Locate DLL Exceptions\") @description(\"Code: 0xc0000135\")\n win32_unable_to_locate_dll: bool;\n @default(0) @display_name(\"Break On Win32 Ordinal Not Found Exceptions\") @description(\"Code: 0xc0000138\")\n win32_ordinal_not_found: bool;\n @default(0) @display_name(\"Break On Win32 Entry Point Not Found Exceptions\") @description(\"Code: 0xc0000139\")\n win32_entry_point_not_found: bool;\n @default(0) @display_name(\"Break On Win32 DLL Initialization Failed Exceptions\") @description(\"Code: 0xc0000142\")\n win32_dll_initialization_failed: bool;\n @default(0) @display_name(\"Break On Win32 Floating Point SSE Multiple Faults Exceptions\") @description(\"Code: 0xc00002b4\")\n win32_floating_point_sse_multiple_faults: bool;\n @default(0) @display_name(\"Break On Win32 Floating Point SSE Multiple Traps Exceptions\") @description(\"Code: 0xc00002b5\")\n win32_floating_point_sse_multiple_traps: bool;\n @default(1) @display_name(\"Break On Win32 Assertion Failed Exceptions\") @description(\"Code: 0xc0000420\")\n win32_assertion_failed: bool;\n @default(0) @display_name(\"Break On Win32 Module Not Found Exceptions\") @description(\"Code: 0xc06d007e\")\n win32_module_not_found: bool;\n @default(0) @display_name(\"Break On Win32 Procedure Not Found Exceptions\") @description(\"Code: 0xc06d007f\")\n win32_procedure_not_found: bool;\n @default(1) @display_name(\"Break On Win32 Sanitizer Error Detected Exceptions\") @description(\"Code: 0xe073616e\")\n win32_sanitizer_error_detected: bool;\n @default(0) @display_name(\"Break On Win32 Sanitizer Raw Access Violation Exceptions\") @description(\"Code: 0xe0736171\")\n win32_sanitizer_raw_access_violation: bool;\n @default(1) @display_name(\"Break On Win32 DirectX Debug Layer Exceptions\") @description(\"Code: 0x0000087a\")\n win32_directx_debug_layer: bool;\n}\n")}, +{str8_lit_comp("color"), str8_lit_comp("@collection_commands(add_color, import_colors) x:\n{\n @display_name('Tags') tags: string,\n color: @color @hex u32,\n}\n")}, {str8_lit_comp("window"), str8_lit_comp("x:\n{\n //- rjf: text rasterization settings\n @default(1) @display_name('Smooth UI Text') @description(\"Controls whether or not UI text is fully anti-aliased, for a smoother appearance.\")\n 'smooth_ui_text': bool,\n @default(1) @display_name('Hint UI Text') @description(\"Controls whether or not UI text is hinted, for better text readability at small sizes.\")\n 'hint_ui_text': bool,\n @default(0) @display_name('Smooth Code Text') @description(\"Controls whether or not code text is fully anti-aliased, for a smoother appearance.\")\n 'smooth_code_text': bool,\n @default(1) @display_name('Hint Code Text') @description(\"Controls whether or not code text is hinted, for better text readability at small sizes.\")\n 'hint_code_text': bool,\n @default(11) @display_name('Window Font Size') @description(\"Controls the window's default font size. Does not apply to tabs with their own font size set.\")\n 'font_size': @range[6, 72] u64,\n\n //- rjf: size settings\n @default(3.f) @display_name('Window Row Height') @description(\"Controls the window's default row height, in multiples of the font size. Does not apply to tabs with their own row height set.\")\n 'row_height': @range[1.75f, 5.f] f32,\n @default(3.f) @description(\"Controls the height of tabs, in multiples of the font size.\")\n 'tab_height': @range[1.75f, 5.f] f32,\n}\n")}, {str8_lit_comp("tab"), str8_lit_comp("x:\n{\n @default(11) @display_name('Tab Font Size') @description(\"Controls the tab's font size.\")\n 'font_size': @range[6, 72] u64,\n}\n")}, {str8_lit_comp("watch"), str8_lit_comp("@inherit(tab) x:\n{\n @default(3.f) @display_name('Tab Row Height') @description(\"Controls the tab's row height, in multiples of the font size.\")\n 'row_height': @range[1.75f, 5.f] f32,\n 'label': code_string,\n @description(\"The root expression which is evaluated to produce the watch window.\")\n 'expression': code_string,\n @no_expand 'watches': query,\n}\n")}, @@ -443,7 +447,7 @@ Rng1U64 rd_reg_slot_range_table[42] = {OffsetOf(RD_Regs, os_event), OffsetOf(RD_Regs, os_event) + sizeof(OS_Event *)}, }; -RD_CmdKindInfo rd_cmd_kind_info_table[212] = +RD_CmdKindInfo rd_cmd_kind_info_table[214] = { {0}, { str8_lit_comp("launch_and_run"), str8_lit_comp("Starts debugging a new instance of a target, then runs."), str8_lit_comp("launch,start,run,target"), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_Cfg, str8_lit_comp("query:targets"), str8_lit_comp(""), CTRL_EntityKind_Null}}, @@ -619,6 +623,8 @@ RD_CmdKindInfo rd_cmd_kind_info_table[212] = { str8_lit_comp("add_watch_pin"), str8_lit_comp("Places a watch pin at a given location (file path and line number or address)."), str8_lit_comp(""), str8_lit_comp("$watch_pins,"), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*1)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_Expr, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}}, { str8_lit_comp("toggle_watch_pin"), str8_lit_comp("Places or removes a watch pin at a given location (file path and line number or address)."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*0)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*1)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_Expr, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}}, { str8_lit_comp("add_auto_view_rule"), str8_lit_comp("Adds a new auto view rule."), str8_lit_comp(""), str8_lit_comp("$auto_view_rules,"), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_String, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}}, +{ str8_lit_comp("add_color"), str8_lit_comp("Adds a new color."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}}, +{ str8_lit_comp("import_colors"), str8_lit_comp("Imports all colors from a loaded color theme file or color theme preset."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}}, { str8_lit_comp("set_next_statement"), str8_lit_comp("Sets the selected thread's instruction pointer to the cursor's position."), str8_lit_comp(""), str8_lit_comp("$text_pt,"), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*1)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}}, { str8_lit_comp("add_target"), str8_lit_comp("Adds a new target."), str8_lit_comp("application,executable,debug"), str8_lit_comp("$targets,"), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*1)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_FilePath, str8_lit_comp("folder:\"$input\""), str8_lit_comp(""), CTRL_EntityKind_Null}}, { str8_lit_comp("select_target"), str8_lit_comp("Selects a target."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_Cfg, str8_lit_comp("query:targets"), str8_lit_comp(""), CTRL_EntityKind_Null}}, @@ -905,7 +911,7 @@ String8 rd_theme_preset_cfg_string_table[9] = { str8_lit_comp("theme:\n{\n background: 0x1b1b1bff,\n alt: background: 0x222222ff,\n pop: background: 0x355b6eff,\n fresh: background: 0x31393dff,\n match: background: 0x31393dff,\n border: 0x404040ff,\n text: 0xe5e5e5ff,\n weak: text: 0xa4a4a4ff,\n good: text: 0x32a852ff,\n bad: text: 0xcf5242ff,\n hover: 0xffffffff,\n focus: 0xfda200ff,\n cursor: 0x8aff00ff,\n selection: 0x99ccffff,\n inactive: background: 0x0000002f,\n drop_shadow: 0x0000007f,\n\n good_pop:\n {\n background: 0x2c5b36ff,\n border: 0x568761ff,\n hover: 0xe3f5d3ff,\n weak: text: 0xe3f5d3ff,\n }\n\n bad_pop:\n {\n background: 0x803425ff,\n hover: 0xff825cff,\n }\n\n code_default: 0xcbcbcbff,\n code_symbol: 0x42a2cfff,\n code_type: 0xfec746ff,\n code_local: 0x98bc80ff,\n code_register: 0xb7afd5ff,\n code_keyword: 0xb38d4cff,\n code_delimiter_or_operator: 0x767676ff,\n code_numeric: 0x98abb1ff,\n code_numeric_alt_digit_group: 0x738287ff,\n code_string: 0x98abb1ff,\n code_meta: 0xd96759ff,\n code_comment: 0x717171ff,\n line_info_0: 0x4f3022ff,\n line_info_1: 0x4f3e15ff,\n line_info_2: 0x434e2aff,\n line_info_3: 0x36241fff,\n line_info_4: 0x4f3022ff,\n line_info_5: 0x4f3e15ff,\n line_info_6: 0x434e2aff,\n line_info_7: 0x36241fff,\n thread_0: 0xffcb7fff,\n thread_1: 0xb2ff65ff,\n thread_2: 0xff99e5ff,\n thread_3: 0x6598ffff,\n thread_4: 0x65ffcbff,\n thread_5: 0xff9819ff,\n thread_6: 0x9932ffff,\n thread_7: 0x65ff4cff,\n thread_unwound: 0xb2ccd8ff,\n thread_error: 0xb23219ff,\n breakpoint: 0xa72911ff,\n\n floating:\n {\n background: 0x1b1b1baf,\n background: alt: 0x0000005f,\n background: fresh: 0x31393d5f,\n border: 0xbfbfbf1f,\n scroll_bar:\n {\n background: 0x3b3b3b5f,\n border: 0x5f5f5f5f,\n }\n }\n\n menu_bar:\n {\n background: 0x2b3740ff,\n border: 0x3e4c57ff,\n }\n\n scroll_bar:\n {\n background: 0x2b2b2bff,\n border: 0x3f3f3fff,\n }\n\n implicit:\n {\n background: 0x00000000,\n border: 0x00000000,\n }\n\n hollow:\n {\n background: 0x00000000,\n border: 0xffffff1f,\n }\n\n tab:\n {\n background: 0x6f5135ff,\n border: 0x8a6e54ff,\n inactive:\n {\n background: 0x2b3740ff,\n border: 0x3e4c57ff,\n }\n auto:\n {\n background: 0x693847ff,\n border: 0x9e6274ff,\n inactive:\n {\n background: 0x2f2633ff,\n border: 0x685073ff,\n }\n }\n }\n\n drop_site:\n {\n background: 0xffffff05,\n border: 0xffffff0f,\n }\n}\n"), str8_lit_comp(""), -str8_lit_comp(""), +str8_lit_comp("theme:\n{\n background: 0x1b0000ff,\n}\n"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), diff --git a/src/raddbg/generated/raddbg.meta.h b/src/raddbg/generated/raddbg.meta.h index 3bf7d01c..af560e67 100644 --- a/src/raddbg/generated/raddbg.meta.h +++ b/src/raddbg/generated/raddbg.meta.h @@ -229,6 +229,8 @@ RD_CmdKind_DisableBreakpoint, RD_CmdKind_AddWatchPin, RD_CmdKind_ToggleWatchPin, RD_CmdKind_AddAutoViewRule, +RD_CmdKind_AddColor, +RD_CmdKind_ImportColors, RD_CmdKind_SetNextStatement, RD_CmdKind_AddTarget, RD_CmdKind_SelectTarget, @@ -668,8 +670,8 @@ Z(getting_started)\ C_LINKAGE_BEGIN extern String8 rd_tab_fast_path_view_name_table[20]; extern String8 rd_tab_fast_path_query_name_table[20]; -extern RD_VocabInfo rd_vocab_info_table[316]; -extern RD_NameSchemaInfo rd_name_schema_info_table[21]; +extern RD_VocabInfo rd_vocab_info_table[319]; +extern RD_NameSchemaInfo rd_name_schema_info_table[22]; extern Rng1U64 rd_reg_slot_range_table[42]; extern String8 rd_binding_version_remap_old_name_table[8]; extern String8 rd_binding_version_remap_new_name_table[8]; diff --git a/src/raddbg/raddbg.mdesk b/src/raddbg/raddbg.mdesk index df3d1446..ee29a4df 100644 --- a/src/raddbg/raddbg.mdesk +++ b/src/raddbg/raddbg.mdesk @@ -90,6 +90,7 @@ RD_VocabTable: {source_location _ "Source Location" _ Null } {address_location _ "Address Location" _ Null } {target _ "Target" _ Target } + {color _ "Color" _ Palette } {executable _ "Executable" _ Module } {arguments arguments "Arguments" "Arguments" Null } {exe exes "Executable" _ Module } @@ -227,6 +228,14 @@ RD_VocabTable: 'main_font': string, 'code_font': string, + //- rjf: colors + @display_name('Color Preset') + 'color_preset': string, + @display_name('Color File') + 'color_file': path, + @display_name('Colors') + 'colors': query, + //- rjf: thread & breakpoint decorations @default(1) @display_name('Thread Lines') @description("Controls whether or not a long horizontal line is drawn before the next line or instruction that the selected thread will execute in source and disassembly views.") 'thread_lines': bool, @@ -346,6 +355,18 @@ RD_VocabTable: ``` } + //- rjf: colors + { + color, + ``` + @collection_commands(add_color, import_colors) x: + { + @display_name('Tags') tags: string, + color: @color @hex u32, + } + ``` + } + //- rjf: windows { window, @@ -896,6 +917,10 @@ RD_CmdTable: // | | | | //- rjf: auto view rule {AddAutoViewRule 1 1 0 0 "" String null Nil Null 0 0 0 0 0 0 0 Binoculars "add_auto_view_rule" "Add Auto View Rule" "Adds a new auto view rule." "" "$auto_view_rules," } + //- rjf: colors + {AddColor 1 1 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Palette "add_color" "Add Color" "Adds a new color." "" "" } + {ImportColors 1 1 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Palette "import_colors" "Import Colors" "Imports all colors from a loaded color theme file or color theme preset." "" "" } + //- rjf: line operations {SetNextStatement 1 1 1 0 "" Null null Nil Null 0 0 0 0 0 0 0 RightArrow "set_next_statement" "Set Next Statement" "Sets the selected thread's instruction pointer to the cursor's position." "" "$text_pt," } @@ -1405,7 +1430,15 @@ RD_ThemePresetTable: } { DefaultLight default_light "Default (Light)" } - { VSDark vs_dark "VS (Dark)" } + + { + VSDark vs_dark "VS (Dark)", + ```theme: + { + background: 0x1b0000ff, + } + ``` + } { VSLight vs_light "VS (Light)" } { SolarizedDark solarized_dark "Solarized (Dark)" } { SolarizedLight solarized_light "Solarized (Light)" } @@ -1414,7 +1447,7 @@ RD_ThemePresetTable: { FarManager far_manager "Far Manager" } } -@table(name display_name name_lower default_dark default_light vs_dark vs_light solarized_dark solarized_light handmade_hero four_coder far_manager desc) +@table(name display_name name_lower default_dark default_light vs_dark vs_light solarized_dark solarized_light handmade_hero four_coder far_manager desc) RD_ThemeColorTable: { {Null "Null" null 0xff00ffff 0xff00ffff 0xff00ffff 0xff00ffff 0xff00ffff 0xff00ffff 0xff00ffff 0xff00ffff 0xff00ffff ""} diff --git a/src/raddbg/raddbg_core.c b/src/raddbg/raddbg_core.c index e4f7320c..a9c353a2 100644 --- a/src/raddbg/raddbg_core.c +++ b/src/raddbg/raddbg_core.c @@ -1780,6 +1780,17 @@ rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range) U64 value = e_value_from_string(value_string_casted).u64; read_data = push_str8_copy(scratch.arena, str8_struct(&value)); } + else if(str8_match(child_type_name, str8_lit("u32"), 0)) + { + String8 value_string = cfg->first->string; + if(value_string.size == 0) + { + value_string = md_tag_from_string(child_schema, str8_lit("default"), 0)->first->string; + } + String8 value_string_casted = push_str8f(scratch.arena, "(uint32)(%S)", value_string); + U64 value = e_value_from_string(value_string_casted).u64; + read_data = push_str8_copy(scratch.arena, str8_struct(&value)); + } else if(str8_match(child_type_name, str8_lit("f32"), 0)) { String8 value_string = cfg->first->string; @@ -4741,6 +4752,10 @@ rd_view_ui(Rng2F32 rect) { CTRL_Entity *entity = rd_ctrl_entity_from_eval_space(row->eval.space); RD_Cfg *cfg = rd_cfg_from_eval_space(row->eval.space); + if(cfg == &rd_nil_cfg) + { + cfg = rd_cfg_from_eval_space(row->block->eval.space); + } RD_RegsScope(.cfg = cfg->id, .ctrl_entity = entity->handle) { if(cfg != &rd_nil_cfg || entity != &ctrl_entity_nil) @@ -5483,7 +5498,7 @@ rd_window_frame(void) // that windows can have their own colors, and have those override higher-up settings. RD_Cfg *preset_cfg = &rd_nil_cfg; RD_CfgList colors_cfgs = {0}; - RD_Cfg *scan_parents[] = {window, rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("project")), rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("user"))}; + RD_Cfg *scan_parents[] = {window, rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("project")), rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("theme")), rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("user"))}; for EachElement(idx, scan_parents) { for(RD_Cfg *parent_cfg = scan_parents[idx]; parent_cfg != &rd_nil_cfg; parent_cfg = parent_cfg->parent) @@ -10864,6 +10879,7 @@ rd_init(CmdLine *cmdln) cmd_line_has_flag(cmdln, str8_lit("q"))); rd_state->user_path_arena = arena_alloc(); rd_state->project_path_arena = arena_alloc(); + rd_state->theme_path_arena = arena_alloc(); rd_state->user_cfg_string_key = hs_hash_from_data(str8_lit("raddbg_user_data_string_key")); rd_state->project_cfg_string_key = hs_hash_from_data(str8_lit("raddbg_project_data_string_key")); rd_state->cmdln_cfg_string_key = hs_hash_from_data(str8_lit("raddbg_cmdln_data_string_key")); @@ -12304,6 +12320,19 @@ rd_frame(void) { .info = E_TYPE_EXPAND_INFO_FUNCTION_NAME(call_stack), })); + e_string2typekey_map_insert(rd_frame_arena(), rd_state->meta_name2type_map, str8_lit("colors"), + e_type_key_cons(.kind = E_TypeKind_Set, + .flags = E_TypeFlag_EditableChildren, + .name = str8_lit("colors"), + .irext = E_TYPE_IREXT_FUNCTION_NAME(cfgs_slice), + .access = E_TYPE_ACCESS_FUNCTION_NAME(cfgs_slice), + .expand = + { + .info = E_TYPE_EXPAND_INFO_FUNCTION_NAME(cfgs_query), + .range = E_TYPE_EXPAND_RANGE_FUNCTION_NAME(cfgs_slice), + .id_from_num = E_TYPE_EXPAND_ID_FROM_NUM_FUNCTION_NAME(cfgs_slice), + .num_from_id = E_TYPE_EXPAND_NUM_FROM_ID_FUNCTION_NAME(cfgs_slice), + })); } //- rjf: add macro for collections with specific lookup rules (but no unique id rules) @@ -12846,7 +12875,9 @@ rd_frame(void) case RD_CmdKind_OpenUser: case RD_CmdKind_OpenProject: { - String8 file_root_key = (kind == RD_CmdKind_OpenUser ? str8_lit("user") : str8_lit("project")); + String8 file_root_key = (kind == RD_CmdKind_OpenUser ? str8_lit("user") : + kind == RD_CmdKind_OpenProject ? str8_lit("project") : + str8_lit("other")); RD_Cfg *file_root = rd_cfg_child_from_string(rd_state->root_cfg, file_root_key); //- rjf: load the new file's data @@ -15164,6 +15195,24 @@ rd_frame(void) rd_cfg_new(project, str8_lit("auto_view_rule")); }break; + //- rjf: colors + case RD_CmdKind_AddColor: + { + RD_Cfg *parent = rd_cfg_from_id(rd_regs()->cfg); + rd_cfg_new(parent, str8_lit("color")); + }break; + case RD_CmdKind_ImportColors: + { + RD_Cfg *parent = rd_cfg_from_id(rd_regs()->cfg); + RD_CfgList colors = rd_cfg_child_list_from_string(scratch.arena, parent, str8_lit("color")); + for(RD_CfgNode *n = colors.first; n != 0; n = n->next) + { + rd_cfg_release(n->v); + } + // String8 color_preset = rd_setting_from_name(str8_lit("color_preset")); + // String8 color_file = rd_setting_from_name(str8_lit("color_file")); + }break; + //- rjf: watches case RD_CmdKind_ToggleWatchExpression: if(rd_regs()->string.size != 0) diff --git a/src/raddbg/raddbg_core.h b/src/raddbg/raddbg_core.h index d9412353..6097e6bf 100644 --- a/src/raddbg/raddbg_core.h +++ b/src/raddbg/raddbg_core.h @@ -608,6 +608,8 @@ struct RD_State String8 user_path; Arena *project_path_arena; String8 project_path; + Arena *theme_path_arena; + String8 theme_path; // rjf: serialized config debug string keys U128 user_cfg_string_key; diff --git a/src/raddbg/raddbg_eval.c b/src/raddbg/raddbg_eval.c index 2bf9f201..02e78aa7 100644 --- a/src/raddbg/raddbg_eval.c +++ b/src/raddbg/raddbg_eval.c @@ -269,6 +269,11 @@ E_TYPE_ACCESS_FUNCTION_DEF(schema) child_type_key = e_type_key_basic(E_TypeKind_U64); wrap_child_w_meta_expr = 1; } + else if(str8_match(child_schema->first->string, str8_lit("u32"), 0)) + { + child_type_key = e_type_key_basic(E_TypeKind_U32); + wrap_child_w_meta_expr = 1; + } else if(str8_match(child_schema->first->string, str8_lit("f32"), 0)) { child_type_key = e_type_key_basic(E_TypeKind_F32); @@ -341,6 +346,28 @@ E_TYPE_ACCESS_FUNCTION_DEF(schema) } } + //- rjf: extend child type with hex lens + { + MD_Node *hex = md_tag_from_string(child_schema->first, str8_lit("hex"), 0); + if(!md_node_is_nil(hex)) + { + child_type_key = e_type_key_cons(.kind = E_TypeKind_Lens, + .name = str8_lit("hex"), + .direct_key = child_type_key); + } + } + + //- rjf: extend child type with color lens + { + MD_Node *color = md_tag_from_string(child_schema->first, str8_lit("color"), 0); + if(!md_node_is_nil(color)) + { + child_type_key = e_type_key_cons(.kind = E_TypeKind_Lens, + .name = str8_lit("color"), + .direct_key = child_type_key); + } + } + //- rjf: extend child type with ranges { MD_Node *range = md_tag_from_string(child_schema->first, str8_lit("range"), 0); @@ -668,6 +695,40 @@ E_TYPE_EXPAND_INFO_FUNCTION_DEF(cfgs_slice) return info; } +E_TYPE_EXPAND_INFO_FUNCTION_DEF(cfgs_query) +{ + RD_CfgsExpandAccel *accel = push_array(arena, RD_CfgsExpandAccel, 1); + { + Temp scratch = scratch_begin(&arena, 1); + RD_Cfg *root_cfg = rd_cfg_from_eval_space(eval.space); + String8 child_key = e_string_from_id(eval.space.u64s[1]); + String8 child_key_singular = rd_singular_from_code_name_plural(child_key); + if(child_key_singular.size != 0) + { + child_key = child_key_singular; + } + String8List cmds = {0}; + MD_NodePtrList schemas = rd_schemas_from_name(child_key); + for(MD_NodePtrNode *n = schemas.first; n != 0; n = n->next) + { + MD_Node *schema = n->v; + MD_Node *collection_cmds_root = md_tag_from_string(schema, str8_lit("collection_commands"), 0); + for MD_EachNode(cmd, collection_cmds_root->first) + { + str8_list_push(scratch.arena, &cmds, cmd->string); + } + } + RD_CfgList children = rd_cfg_child_list_from_string(scratch.arena, root_cfg, child_key); + accel->cmds = str8_array_from_list(arena, &cmds); + accel->cmds_idx_range = r1u64(0, accel->cmds.count); + accel->cfgs = rd_cfg_array_from_list(arena, &children); + accel->cfgs_idx_range = r1u64(accel->cmds.count + 0, accel->cmds.count + accel->cfgs.count); + scratch_end(scratch); + } + E_TypeExpandInfo info = {accel, accel->cfgs.count + accel->cmds.count}; + return info; +} + E_TYPE_EXPAND_RANGE_FUNCTION_DEF(cfgs_slice) { RD_CfgsExpandAccel *accel = (RD_CfgsExpandAccel *)user_data; diff --git a/src/raddbg/raddbg_eval.h b/src/raddbg/raddbg_eval.h index 41715697..2edc84c0 100644 --- a/src/raddbg/raddbg_eval.h +++ b/src/raddbg/raddbg_eval.h @@ -40,6 +40,7 @@ E_TYPE_ACCESS_FUNCTION_DEF(cfgs); //~ rjf: Config Slice Type Hooks E_TYPE_IREXT_FUNCTION_DEF(cfgs_slice); +E_TYPE_EXPAND_INFO_FUNCTION_DEF(cfgs_query); E_TYPE_ACCESS_FUNCTION_DEF(cfgs_slice); E_TYPE_EXPAND_INFO_FUNCTION_DEF(cfgs_slice); E_TYPE_EXPAND_RANGE_FUNCTION_DEF(cfgs_slice); diff --git a/src/raddbg/raddbg_views.c b/src/raddbg/raddbg_views.c index 3afc52a0..9f6f31e0 100644 --- a/src/raddbg/raddbg_views.c +++ b/src/raddbg/raddbg_views.c @@ -945,7 +945,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row) EV_Key key = row->key; EV_Block *block = row->block; E_Eval block_eval = row->block->eval; - E_TypeKey block_type_key = block_eval.irtree.type_key; + E_TypeKey block_type_key = e_type_key_unwrap(block_eval.irtree.type_key, E_TypeUnwrapFlag_Meta); E_TypeKind block_type_kind = e_type_kind_from_key(block_type_key); E_Type *block_type = e_type_from_key__cached(block_type_key); RD_Cfg *evalled_cfg = rd_cfg_from_eval_space(row->eval.space); @@ -1277,7 +1277,9 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row) //////////////////////////// //- rjf: @watch_row_build_cells queries // - else if(row->eval.space.kind == RD_EvalSpaceKind_MetaQuery) + else if(row->eval.space.kind == RD_EvalSpaceKind_MetaQuery || + (row->eval.space.kind == RD_EvalSpaceKind_MetaCfg && + e_type_kind_from_key(e_type_key_unwrap(row->eval.irtree.type_key, E_TypeUnwrapFlag_Meta)) == E_TypeKind_Set)) { rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval, .flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_NoEval|RD_WatchCellFlag_Indented, .pct = 1.f); } @@ -1339,8 +1341,9 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row) row->eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity || row->eval.space.kind == E_SpaceKind_File) { - if(e_type_kind_from_key(row->eval.irtree.type_key) == E_TypeKind_Array && - e_type_kind_from_key(e_type_key_direct(row->eval.irtree.type_key)) == E_TypeKind_U8) + E_TypeKey substantive_row_eval_type = e_type_key_unwrap(row->eval.irtree.type_key, E_TypeUnwrapFlag_Meta); + if(e_type_kind_from_key(substantive_row_eval_type) == E_TypeKind_Array && + e_type_kind_from_key(e_type_key_direct(substantive_row_eval_type)) == E_TypeKind_U8) { info.can_expand = 0; } @@ -1742,7 +1745,7 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla // rjf: determine if code B32 is_code = 1; { - E_Type *type = e_type_from_key__cached(cell->eval.irtree.type_key); + E_Type *type = e_type_from_key__cached(e_type_key_unwrap(cell->eval.irtree.type_key, E_TypeUnwrapFlag_Meta)); if(type->flags & (E_TypeFlag_IsPlainText|E_TypeFlag_IsPathText)) { is_code = 0; diff --git a/src/raddbg/raddbg_widgets.c b/src/raddbg/raddbg_widgets.c index b2d3001b..7d5c8d70 100644 --- a/src/raddbg/raddbg_widgets.c +++ b/src/raddbg/raddbg_widgets.c @@ -393,6 +393,23 @@ rd_title_fstrs_from_cfg(Arena *arena, RD_Cfg *cfg) dr_fstrs_push_new(arena, &result, ¶ms, dst_string, .color = dst_color); } + //- rjf: special case: colors + if(str8_match(cfg->string, str8_lit("color"), 0)) + { + String8 tags = rd_cfg_child_from_string(cfg, str8_lit("tags"))->first->string; + String8 color_string = rd_cfg_child_from_string(cfg, str8_lit("color"))->first->string; + U32 color_u32 = e_value_from_stringf("(uint32)(%S)", color_string).u32; + Vec4F32 color = rgba_from_u32(color_u32); + if(tags.size != 0) + { + dr_fstrs_push_new(arena, &result, ¶ms, tags, .color = color); + } + else + { + dr_fstrs_push_new(arena, &result, ¶ms, str8_lit("Color"), .color = rgba_secondary); + } + } + #undef start_secondary scratch_end(scratch); }