mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-05 13:28:40 +00:00
always prefer explicitly attached tags (view rules); give all tags a chance in sequence; allow 'default' to be explicitly attached, to disable auto-view-rules etc.
This commit is contained in:
+10
-7
@@ -483,6 +483,11 @@ e_lookup_rule_map_make(Arena *arena, U64 slots_count)
|
|||||||
E_LookupRuleMap map = {0};
|
E_LookupRuleMap map = {0};
|
||||||
map.slots_count = slots_count;
|
map.slots_count = slots_count;
|
||||||
map.slots = push_array(arena, E_LookupRuleSlot, map.slots_count);
|
map.slots = push_array(arena, E_LookupRuleSlot, map.slots_count);
|
||||||
|
e_lookup_rule_map_insert_new(arena, &map, str8_lit("default"),
|
||||||
|
.info = E_LOOKUP_INFO_FUNCTION_NAME(default),
|
||||||
|
.range = E_LOOKUP_RANGE_FUNCTION_NAME(default),
|
||||||
|
.id_from_num = E_LOOKUP_ID_FROM_NUM_FUNCTION_NAME(default),
|
||||||
|
.num_from_id = E_LOOKUP_NUM_FROM_ID_FUNCTION_NAME(default));
|
||||||
e_lookup_rule_map_insert_new(arena, &map, str8_lit("folder"),
|
e_lookup_rule_map_insert_new(arena, &map, str8_lit("folder"),
|
||||||
.info = E_LOOKUP_INFO_FUNCTION_NAME(folder),
|
.info = E_LOOKUP_INFO_FUNCTION_NAME(folder),
|
||||||
.range = E_LOOKUP_RANGE_FUNCTION_NAME(folder),
|
.range = E_LOOKUP_RANGE_FUNCTION_NAME(folder),
|
||||||
@@ -1031,10 +1036,11 @@ e_irgen_rule_map_make(Arena *arena, U64 slots_count)
|
|||||||
E_IRGenRuleMap map = {0};
|
E_IRGenRuleMap map = {0};
|
||||||
map.slots_count = slots_count;
|
map.slots_count = slots_count;
|
||||||
map.slots = push_array(arena, E_IRGenRuleSlot, map.slots_count);
|
map.slots = push_array(arena, E_IRGenRuleSlot, map.slots_count);
|
||||||
e_irgen_rule_map_insert_new(arena, &map, str8_lit("cast"), .irgen = E_IRGEN_FUNCTION_NAME(cast));
|
e_irgen_rule_map_insert_new(arena, &map, str8_lit("default"), .irgen = E_IRGEN_FUNCTION_NAME(default));
|
||||||
e_irgen_rule_map_insert_new(arena, &map, str8_lit("bswap"), .irgen = E_IRGEN_FUNCTION_NAME(bswap));
|
e_irgen_rule_map_insert_new(arena, &map, str8_lit("cast"), .irgen = E_IRGEN_FUNCTION_NAME(cast));
|
||||||
e_irgen_rule_map_insert_new(arena, &map, str8_lit("array"), .irgen = E_IRGEN_FUNCTION_NAME(array));
|
e_irgen_rule_map_insert_new(arena, &map, str8_lit("bswap"), .irgen = E_IRGEN_FUNCTION_NAME(bswap));
|
||||||
e_irgen_rule_map_insert_new(arena, &map, str8_lit("wrap"), .irgen = E_IRGEN_FUNCTION_NAME(wrap));
|
e_irgen_rule_map_insert_new(arena, &map, str8_lit("array"), .irgen = E_IRGEN_FUNCTION_NAME(array));
|
||||||
|
e_irgen_rule_map_insert_new(arena, &map, str8_lit("wrap"), .irgen = E_IRGEN_FUNCTION_NAME(wrap));
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2391,7 +2397,6 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *expr)
|
|||||||
{
|
{
|
||||||
explicit_irgen_rule = irgen_rule_candidate;
|
explicit_irgen_rule = irgen_rule_candidate;
|
||||||
explicit_irgen_rule_tag = tag;
|
explicit_irgen_rule_tag = tag;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2776,7 +2781,6 @@ e_lookup_rule_tag_pair_from_expr_irtree(E_Expr *expr, E_IRTreeAndType *irtree)
|
|||||||
{
|
{
|
||||||
result.rule = candidate;
|
result.rule = candidate;
|
||||||
result.tag = tag;
|
result.tag = tag;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2809,7 +2813,6 @@ e_lookup_rule_tag_pair_from_expr_irtree(E_Expr *expr, E_IRTreeAndType *irtree)
|
|||||||
{
|
{
|
||||||
result.rule = candidate;
|
result.rule = candidate;
|
||||||
result.tag = n->v;
|
result.tag = n->v;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -489,16 +489,6 @@ ev_keyed_expr_push_tags(Arena *arena, EV_View *view, EV_Block *block, EV_Key key
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// rjf: push explicitly-attached tags (via key) next
|
|
||||||
String8 tag_expr = push_str8_copy(arena, ev_view_rule_from_key(view, key));
|
|
||||||
E_TokenArray tag_expr_tokens = e_token_array_from_text(scratch.arena, tag_expr);
|
|
||||||
E_Parse tag_expr_parse = e_parse_expr_from_text_tokens(arena, tag_expr, &tag_expr_tokens);
|
|
||||||
for(E_Expr *tag = tag_expr_parse.exprs.first, *next = &e_expr_nil; tag != &e_expr_nil; tag = next)
|
|
||||||
{
|
|
||||||
next = tag->next;
|
|
||||||
e_expr_push_tag(expr, tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
// rjf: push tags inferred from the type
|
// rjf: push tags inferred from the type
|
||||||
{
|
{
|
||||||
E_IRTreeAndType irtree = e_irtree_and_type_from_expr(scratch.arena, expr);
|
E_IRTreeAndType irtree = e_irtree_and_type_from_expr(scratch.arena, expr);
|
||||||
@@ -508,6 +498,16 @@ ev_keyed_expr_push_tags(Arena *arena, EV_View *view, EV_Block *block, EV_Key key
|
|||||||
e_expr_push_tag(expr, e_expr_copy(arena, n->v));
|
e_expr_push_tag(expr, e_expr_copy(arena, n->v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rjf: push explicitly-attached tags (via key) next
|
||||||
|
String8 tag_expr = push_str8_copy(arena, ev_view_rule_from_key(view, key));
|
||||||
|
E_TokenArray tag_expr_tokens = e_token_array_from_text(scratch.arena, tag_expr);
|
||||||
|
E_Parse tag_expr_parse = e_parse_expr_from_text_tokens(arena, tag_expr, &tag_expr_tokens);
|
||||||
|
for(E_Expr *tag = tag_expr_parse.exprs.first, *next = &e_expr_nil; tag != &e_expr_nil; tag = next)
|
||||||
|
{
|
||||||
|
next = tag->next;
|
||||||
|
e_expr_push_tag(expr, tag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ RD_NameSchemaInfo rd_name_schema_info_table[12] =
|
|||||||
{str8_lit_comp("breakpoint"), str8_lit_comp("@commands(enable_cfg, remove_cfg)\n@collection_commands(add_breakpoint, add_address_breakpoint, add_function_breakpoint)\nx:\n{\n 'label': code_string,\n 'condition': code_string,\n 'location': location,\n 'hit_count': u64,\n 'disabled': bool,\n}\n")},
|
{str8_lit_comp("breakpoint"), str8_lit_comp("@commands(enable_cfg, remove_cfg)\n@collection_commands(add_breakpoint, add_address_breakpoint, add_function_breakpoint)\nx:\n{\n 'label': code_string,\n 'condition': code_string,\n 'location': location,\n 'hit_count': u64,\n 'disabled': bool,\n}\n")},
|
||||||
{str8_lit_comp("watch_pin"), str8_lit_comp("@commands(remove_cfg)\n@collection_commands(add_watch_pin)\nx:\n{\n 'expression': code_string,\n 'view_rule': code_string,\n 'location': location,\n}\n")},
|
{str8_lit_comp("watch_pin"), str8_lit_comp("@commands(remove_cfg)\n@collection_commands(add_watch_pin)\nx:\n{\n 'expression': code_string,\n 'view_rule': code_string,\n 'location': location,\n}\n")},
|
||||||
{str8_lit_comp("file_path_map"), str8_lit_comp("@collection_commands(add_file_path_map) @commands(remove_cfg) x:{'source':path, 'dest':path}")},
|
{str8_lit_comp("file_path_map"), str8_lit_comp("@collection_commands(add_file_path_map) @commands(remove_cfg) x:{'source':path, 'dest':path}")},
|
||||||
{str8_lit_comp("auto_view_rule"), str8_lit_comp("@collection_commands(add_auto_view_rule) @commands(remove_cfg) x:{'source':code_string, 'dest':code_string}")},
|
{str8_lit_comp("auto_view_rule"), str8_lit_comp("@collection_commands(add_auto_view_rule) @commands(remove_cfg) x:{'type':code_string, 'view_rule':code_string}")},
|
||||||
{str8_lit_comp("recent_project"), str8_lit_comp("x:{'path':path}")},
|
{str8_lit_comp("recent_project"), str8_lit_comp("x:{'path':path}")},
|
||||||
{str8_lit_comp("recent_file"), str8_lit_comp("x:{'path':path}")},
|
{str8_lit_comp("recent_file"), str8_lit_comp("x:{'path':path}")},
|
||||||
{str8_lit_comp("machine"), str8_lit_comp("x:{'label':code_string, 'frozen':bool, 'unattached_processes':query, 'processes':query}")},
|
{str8_lit_comp("machine"), str8_lit_comp("x:{'label':code_string, 'frozen':bool, 'unattached_processes':query, 'processes':query}")},
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ RD_VocabTable:
|
|||||||
//- rjf: auto view rules
|
//- rjf: auto view rules
|
||||||
{
|
{
|
||||||
auto_view_rule,
|
auto_view_rule,
|
||||||
```@collection_commands(add_auto_view_rule) @commands(remove_cfg) x:{'source':code_string, 'dest':code_string}```,
|
```@collection_commands(add_auto_view_rule) @commands(remove_cfg) x:{'type':code_string, 'view_rule':code_string}```,
|
||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: recent projects
|
//- rjf: recent projects
|
||||||
|
|||||||
@@ -11527,8 +11527,8 @@ rd_frame(void)
|
|||||||
for(RD_CfgNode *n = auto_view_rules.first; n != 0; n = n->next)
|
for(RD_CfgNode *n = auto_view_rules.first; n != 0; n = n->next)
|
||||||
{
|
{
|
||||||
RD_Cfg *rule = n->v;
|
RD_Cfg *rule = n->v;
|
||||||
String8 type_string = rd_cfg_child_from_string(rule, str8_lit("source"))->first->string;
|
String8 type_string = rd_cfg_child_from_string(rule, str8_lit("type"))->first->string;
|
||||||
String8 view_rule_string = rd_cfg_child_from_string(rule, str8_lit("dest"))->first->string;
|
String8 view_rule_string = rd_cfg_child_from_string(rule, str8_lit("view_rule"))->first->string;
|
||||||
e_auto_hook_map_insert_new(scratch.arena, ctx->auto_hook_map, .type_pattern = type_string, .tag_expr_string = view_rule_string);
|
e_auto_hook_map_insert_new(scratch.arena, ctx->auto_hook_map, .type_pattern = type_string, .tag_expr_string = view_rule_string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -301,8 +301,8 @@ rd_title_fstrs_from_cfg(Arena *arena, RD_Cfg *cfg)
|
|||||||
//- rjf: special case: auto view rule
|
//- rjf: special case: auto view rule
|
||||||
if(str8_match(cfg->string, str8_lit("auto_view_rule"), 0))
|
if(str8_match(cfg->string, str8_lit("auto_view_rule"), 0))
|
||||||
{
|
{
|
||||||
String8 src_string = rd_cfg_child_from_string(cfg, str8_lit("source"))->first->string;
|
String8 src_string = rd_cfg_child_from_string(cfg, str8_lit("type"))->first->string;
|
||||||
String8 dst_string = rd_cfg_child_from_string(cfg, str8_lit("dest"))->first->string;
|
String8 dst_string = rd_cfg_child_from_string(cfg, str8_lit("view_rule"))->first->string;
|
||||||
Vec4F32 src_color = rgba;
|
Vec4F32 src_color = rgba;
|
||||||
Vec4F32 dst_color = rgba;
|
Vec4F32 dst_color = rgba;
|
||||||
DR_FStrList src_fstrs = {0};
|
DR_FStrList src_fstrs = {0};
|
||||||
@@ -328,9 +328,9 @@ rd_title_fstrs_from_cfg(Arena *arena, RD_Cfg *cfg)
|
|||||||
dst_fstrs = rd_fstrs_from_code_string(arena, 1.f, 0, dst_color, dst_string);
|
dst_fstrs = rd_fstrs_from_code_string(arena, 1.f, 0, dst_color, dst_string);
|
||||||
}
|
}
|
||||||
dr_fstrs_concat_in_place(&result, &src_fstrs);
|
dr_fstrs_concat_in_place(&result, &src_fstrs);
|
||||||
dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
|
dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
|
||||||
dr_fstrs_push_new(arena, &result, ¶ms, rd_icon_kind_text_table[RD_IconKind_RightArrow], .font = rd_font_from_slot(RD_FontSlot_Icons), .raster_flags = rd_raster_flags_from_slot(RD_FontSlot_Icons), .color = rgba_secondary);
|
dr_fstrs_push_new(arena, &result, ¶ms, rd_icon_kind_text_table[RD_IconKind_RightArrow], .font = rd_font_from_slot(RD_FontSlot_Icons), .raster_flags = rd_raster_flags_from_slot(RD_FontSlot_Icons), .color = rgba_secondary);
|
||||||
dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
|
dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
|
||||||
dr_fstrs_concat_in_place(&result, &dst_fstrs);
|
dr_fstrs_concat_in_place(&result, &dst_fstrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user