From ecaa2c55c0c04baad23241605d69ab10dc9647a4 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Fri, 27 Sep 2024 10:29:55 -0700 Subject: [PATCH] eliminate all old eval visualization block/row code --- .../eval_visualization.mdesk | 1 - .../eval_visualization_builtin_view_rules.c | 181 ---- .../eval_visualization_core.c | 772 +----------------- .../eval_visualization_core.h | 244 +----- src/raddbg/raddbg.mdesk | 9 - src/raddbg/raddbg_core.c | 340 +------- src/raddbg/raddbg_core.h | 4 - src/raddbg/raddbg_views.c | 183 ++--- src/raddbg/raddbg_views.h | 10 +- 9 files changed, 147 insertions(+), 1597 deletions(-) diff --git a/src/eval_visualization/eval_visualization.mdesk b/src/eval_visualization/eval_visualization.mdesk index 6f2cfc03..7fd76bae 100644 --- a/src/eval_visualization/eval_visualization.mdesk +++ b/src/eval_visualization/eval_visualization.mdesk @@ -115,7 +115,6 @@ EV_ViewRuleTable: @expand(EV_ViewRuleTable a) `$(a.xr == "x" -> "EV_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_DEF(" .. a.name_lower .. ");")`; @expand(EV_ViewRuleTable a) `$(a.xe == "x" -> "EV_VIEW_RULE_EXPR_EXPAND_INFO_FUNCTION_DEF(" .. a.name_lower .. ");")`; @expand(EV_ViewRuleTable a) `$(a.xe == "x" -> "EV_VIEW_RULE_EXPR_EXPAND_RANGE_INFO_FUNCTION_DEF(" .. a.name_lower .. ");")`; - // @blocks @expand(EV_ViewRuleTable a) `$(a.vb == "x" -> "EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(" .. a.name_lower .. ");")`; } @data(EV_ViewRuleInfo) @c_file ev_builtin_view_rule_info_table: diff --git a/src/eval_visualization/eval_visualization_builtin_view_rules.c b/src/eval_visualization/eval_visualization_builtin_view_rules.c index b26dfd65..29f65814 100644 --- a/src/eval_visualization/eval_visualization_builtin_view_rules.c +++ b/src/eval_visualization/eval_visualization_builtin_view_rules.c @@ -265,187 +265,6 @@ EV_VIEW_RULE_EXPR_EXPAND_RANGE_INFO_FUNCTION_DEF(default) return result; } -#if 0 // TODO(rjf): @blocks -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(default) -{ - Temp scratch = scratch_begin(&arena, 1); - - //////////////////////////// - //- rjf: unpack expression type info - // - E_IRTreeAndType irtree = e_irtree_and_type_from_expr(scratch.arena, expr); - E_TypeKey type_key = e_type_unwrap(irtree.type_key); - E_TypeKind type_kind = e_type_kind_from_key(type_key); - E_TypeKey direct_type_key = e_type_unwrap(e_type_direct_from_key(type_key)); - E_TypeKind direct_type_kind = e_type_kind_from_key(direct_type_key); - - //////////////////////////// - //- rjf: do struct/union/class member block generation - // - if((type_kind == E_TypeKind_Struct || - type_kind == E_TypeKind_Union || - type_kind == E_TypeKind_Class) || - (e_type_kind_is_pointer_or_ref(type_kind) && (direct_type_kind == E_TypeKind_Struct || - direct_type_kind == E_TypeKind_Union || - direct_type_kind == E_TypeKind_Class))) - { - // rjf: type -> filtered data members - E_MemberArray data_members = e_type_data_members_from_key(arena, e_type_kind_is_pointer_or_ref(type_kind) ? direct_type_key : type_key); - - // rjf: build blocks for all members, split by sub-expansions - EV_Block *last_vb = ev_block_begin(arena, EV_BlockKind_Members, key, ev_key_make(ev_hash_from_key(key), 0), depth); - { - last_vb->expr = expr; - last_vb->view_rules = view_rules; - last_vb->visual_idx_range = last_vb->semantic_idx_range = r1u64(0, data_members.count); - last_vb->members = data_members; - } - for(EV_ExpandNode *child = expand_node->first; child != 0; child = child->next) - { - // rjf: unpack expansion info; skip out-of-bounds splits - U64 child_id = child->key.child_id; - U64 child_idx = child_id-1; - E_Expr *child_expr = ev_expr_from_block_index(arena, last_vb, child_idx); - if(child_idx >= last_vb->semantic_idx_range.max) - { - continue; - } - - // rjf: form split: truncate & complete last block; begin next block - last_vb = ev_block_split_and_continue(arena, out, last_vb, child_idx); - - // rjf: build child view rules - EV_ViewRuleList *child_view_rules = ev_view_rule_list_from_inheritance(arena, view_rules); - { - String8 view_rule_string = ev_view_rule_from_key(view, child->key); - if(view_rule_string.size == 0) - { - Temp scratch = scratch_begin(&arena, 1); - E_IRTreeAndType irtree = e_irtree_and_type_from_expr(arena, child_expr); - view_rule_string = ev_auto_view_rule_from_type_key(irtree.type_key); - scratch_end(scratch); - } - if(view_rule_string.size != 0) - { - ev_view_rule_list_push_string(arena, child_view_rules, view_rule_string); - } - } - - // rjf: recurse for child - ev_append_expr_blocks__rec(arena, view, filter, key, child->key, str8_zero(), child_expr, child_view_rules, depth, out); - } - ev_block_end(out, last_vb); - } - - //////////////////////////// - //- rjf: do enum member block generation - // - // (just a single block for all enum members; enum members can never be expanded) - // - else if(type_kind == E_TypeKind_Enum || - (e_type_kind_is_pointer_or_ref(type_kind) && direct_type_kind == E_TypeKind_Enum)) - { - E_Type *type = e_type_from_key(arena, e_type_kind_is_pointer_or_ref(type_kind) ? direct_type_key : type_key); - EV_Block *last_vb = ev_block_begin(arena, EV_BlockKind_EnumMembers, key, ev_key_make(ev_hash_from_key(key), 0), depth); - { - last_vb->expr = expr; - last_vb->view_rules = view_rules; - last_vb->visual_idx_range = last_vb->semantic_idx_range = r1u64(0, type->count); - last_vb->enum_vals.v = type->enum_vals; - last_vb->enum_vals.count = type->count; - } - ev_block_end(out, last_vb); - } - - //////////////////////////// - //- rjf: do array element block generation - // - else if(type_kind == E_TypeKind_Array || - (e_type_kind_is_pointer_or_ref(type_kind) && direct_type_kind == E_TypeKind_Array)) - { - // rjf: unpack array type info - E_Type *array_type = e_type_from_key(scratch.arena, e_type_kind_is_pointer_or_ref(type_kind) ? direct_type_key : type_key); - U64 array_count = array_type->count; - B32 need_extra_deref = e_type_kind_is_pointer_or_ref(type_kind); - - // rjf: build blocks for all elements, split by sub-expansions - EV_Block *last_vb = ev_block_begin(arena, EV_BlockKind_Elements, key, ev_key_make(ev_hash_from_key(key), 0), depth); - { - last_vb->expr = need_extra_deref ? e_expr_ref_deref(arena, expr) : expr; - last_vb->view_rules = view_rules; - last_vb->visual_idx_range = last_vb->semantic_idx_range = r1u64(0, array_count); - } - for(EV_ExpandNode *child = expand_node->first; child != 0; child = child->next) - { - // rjf: unpack expansion info; skip out-of-bounds splits - U64 child_id = child->key.child_id; - U64 child_idx = child_id-1; - E_Expr *child_expr = ev_expr_from_block_index(arena, last_vb, child_idx); - if(child_idx >= last_vb->semantic_idx_range.max) - { - continue; - } - - // rjf: form split: truncate & complete last block; begin next block - last_vb = ev_block_split_and_continue(arena, out, last_vb, child_idx); - - // rjf: build child view rules - EV_ViewRuleList *child_view_rules = ev_view_rule_list_from_inheritance(arena, view_rules); - { - String8 view_rule_string = ev_view_rule_from_key(view, child->key); - if(view_rule_string.size == 0) - { - Temp scratch = scratch_begin(&arena, 1); - E_IRTreeAndType irtree = e_irtree_and_type_from_expr(arena, child_expr); - view_rule_string = ev_auto_view_rule_from_type_key(irtree.type_key); - scratch_end(scratch); - } - if(view_rule_string.size != 0) - { - ev_view_rule_list_push_string(arena, child_view_rules, view_rule_string); - } - } - - // rjf: recurse for child - ev_append_expr_blocks__rec(arena, view, filter, key, child->key, str8_zero(), child_expr, child_view_rules, depth, out); - } - ev_block_end(out, last_vb); - } - - //////////////////////////// - //- rjf: do pointer-to-pointer block generation - // - else if(e_type_kind_is_pointer_or_ref(type_kind) && e_type_kind_is_pointer_or_ref(direct_type_kind)) - { - // rjf: compute key, compute expr - EV_Key child_key = ev_key_make(ev_hash_from_key(key), 1); - E_Expr *child_expr = e_expr_ref_deref(arena, expr); - - // rjf: build child view rules - EV_ViewRuleList *child_view_rules = ev_view_rule_list_from_inheritance(arena, view_rules); - { - String8 view_rule_string = ev_view_rule_from_key(view, child_key); - if(view_rule_string.size == 0) - { - Temp scratch = scratch_begin(&arena, 1); - E_IRTreeAndType irtree = e_irtree_and_type_from_expr(arena, child_expr); - view_rule_string = ev_auto_view_rule_from_type_key(irtree.type_key); - scratch_end(scratch); - } - if(view_rule_string.size != 0) - { - ev_view_rule_list_push_string(arena, child_view_rules, view_rule_string); - } - } - - // rjf: recurse for child - ev_append_expr_blocks__rec(arena, view, filter, key, child_key, str8_zero(), child_expr, child_view_rules, depth, out); - } - - scratch_end(scratch); -} -#endif - //////////////////////////////// //~ rjf: "array" diff --git a/src/eval_visualization/eval_visualization_core.c b/src/eval_visualization/eval_visualization_core.c index 31aa3275..1daf3f40 100644 --- a/src/eval_visualization/eval_visualization_core.c +++ b/src/eval_visualization/eval_visualization_core.c @@ -529,12 +529,12 @@ ev_expr_from_expr_view_rules(Arena *arena, E_Expr *expr, EV_ViewRuleList *view_r } //////////////////////////////// -//~ rjf: Block Building (v2) +//~ rjf: Block Building -internal EV2_BlockTree -ev2_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, String8 string, E_Expr *expr, EV_ViewRuleList *view_rules) +internal EV_BlockTree +ev_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, String8 string, E_Expr *expr, EV_ViewRuleList *view_rules) { - EV2_BlockTree tree = {&ev2_nil_block}; + EV_BlockTree tree = {&ev_nil_block}; { Temp scratch = scratch_begin(&arena, 1); EV_ViewRuleInfo *default_expand_view_rule_info = ev_view_rule_info_from_string(str8_lit("default")); @@ -548,8 +548,8 @@ ev2_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, String8 st } //- rjf: generate root block - tree.root = push_array(arena, EV2_Block, 1); - MemoryCopyStruct(tree.root, &ev2_nil_block); + tree.root = push_array(arena, EV_Block, 1); + MemoryCopyStruct(tree.root, &ev_nil_block); tree.root->key = ev_key_root(); tree.root->string = string; tree.root->expr = ev_expr_from_expr_view_rules(arena, expr, top_level_view_rules); @@ -563,7 +563,7 @@ ev2_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, String8 st struct Task { Task *next; - EV2_Block *parent_block; + EV_Block *parent_block; E_Expr *expr; U64 child_id; EV_ViewRuleList *view_rules; @@ -600,12 +600,12 @@ ev2_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, String8 st EV_ExpandInfo expand_info = expand_view_rule_info->expr_expand_info(arena, view, filter, t->expr, expand_params); // rjf: generate block for expansion - EV2_Block *expansion_block = &ev2_nil_block; + EV_Block *expansion_block = &ev_nil_block; if(expand_info.row_count != 0) { - expansion_block = push_array(arena, EV2_Block, 1); - MemoryCopyStruct(expansion_block, &ev2_nil_block); - DLLPushBack_NPZ(&ev2_nil_block, t->parent_block->first, t->parent_block->last, expansion_block, next, prev); + expansion_block = push_array(arena, EV_Block, 1); + MemoryCopyStruct(expansion_block, &ev_nil_block); + DLLPushBack_NPZ(&ev_nil_block, t->parent_block->first, t->parent_block->last, expansion_block, next, prev); expansion_block->parent = t->parent_block; expansion_block->key = key; expansion_block->split_relative_idx = t->split_relative_idx; @@ -717,10 +717,10 @@ ev2_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, String8 st return tree; } -internal EV2_BlockTree -ev2_block_tree_from_string(Arena *arena, EV_View *view, String8 filter, String8 string, EV_ViewRuleList *view_rules) +internal EV_BlockTree +ev_block_tree_from_string(Arena *arena, EV_View *view, String8 filter, String8 string, EV_ViewRuleList *view_rules) { - EV2_BlockTree tree = {0}; + EV_BlockTree tree = {0}; Temp scratch = scratch_begin(&arena, 1); { // rjf: parse expression @@ -771,17 +771,17 @@ ev2_block_tree_from_string(Arena *arena, EV_View *view, String8 filter, String8 } // rjf: produce tree - tree = ev2_block_tree_from_expr(arena, view, filter, string, parse.expr, all_view_rules); + tree = ev_block_tree_from_expr(arena, view, filter, string, parse.expr, all_view_rules); } scratch_end(scratch); return tree; } internal U64 -ev2_depth_from_block(EV2_Block *block) +ev_depth_from_block(EV_Block *block) { U64 depth = 0; - for(EV2_Block *b = block->parent; b != &ev2_nil_block; b = b->parent) + for(EV_Block *b = block->parent; b != &ev_nil_block; b = b->parent) { depth += 1; } @@ -789,20 +789,20 @@ ev2_depth_from_block(EV2_Block *block) } //////////////////////////////// -//~ rjf: Block Coordinate Spaces (v2) +//~ rjf: Block Coordinate Spaces -internal EV2_BlockRangeList -ev2_block_range_list_from_tree(Arena *arena, EV2_BlockTree *block_tree) +internal EV_BlockRangeList +ev_block_range_list_from_tree(Arena *arena, EV_BlockTree *block_tree) { - EV2_BlockRangeList list = {0}; + EV_BlockRangeList list = {0}; { Temp scratch = scratch_begin(&arena, 1); typedef struct BlockTask BlockTask; struct BlockTask { BlockTask *next; - EV2_Block *block; - EV2_Block *next_child; + EV_Block *block; + EV_Block *next_child; Rng1U64 block_relative_range; }; BlockTask start_task = {0, block_tree->root, block_tree->root->first, r1u64(0, block_tree->root->row_count)}; @@ -810,7 +810,7 @@ ev2_block_range_list_from_tree(Arena *arena, EV2_BlockTree *block_tree) { // rjf: get block-relative range, truncated by split position of next child Rng1U64 block_relative_range = t->block_relative_range; - if(t->next_child != &ev2_nil_block) + if(t->next_child != &ev_nil_block) { block_relative_range.max = t->next_child->split_relative_idx+1; } @@ -819,7 +819,7 @@ ev2_block_range_list_from_tree(Arena *arena, EV2_BlockTree *block_tree) // rjf: generate range node if(block_num_visual_rows != 0) { - EV2_BlockRangeNode *n = push_array(arena, EV2_BlockRangeNode, 1); + EV_BlockRangeNode *n = push_array(arena, EV_BlockRangeNode, 1); n->v.block = t->block; n->v.range = block_relative_range; SLLQueuePush(list.first, list.last, n); @@ -827,7 +827,7 @@ ev2_block_range_list_from_tree(Arena *arena, EV2_BlockTree *block_tree) } // rjf: generate task for child, + for post-child parts of this block - if(t->next_child != &ev2_nil_block) + if(t->next_child != &ev_nil_block) { // rjf: generate task for child - do *before* remainder (descend block tree depth first) BlockTask *child_task = push_array(scratch.arena, BlockTask, 1); @@ -855,12 +855,12 @@ ev2_block_range_list_from_tree(Arena *arena, EV2_BlockTree *block_tree) return list; } -internal EV2_BlockRange -ev2_block_range_from_num(EV2_BlockRangeList *block_ranges, U64 num) +internal EV_BlockRange +ev_block_range_from_num(EV_BlockRangeList *block_ranges, U64 num) { - EV2_BlockRange result = {&ev2_nil_block}; + EV_BlockRange result = {&ev_nil_block}; U64 base_num = 0; - for(EV2_BlockRangeNode *n = block_ranges->first; n != 0; n = n->next) + for(EV_BlockRangeNode *n = block_ranges->first; n != 0; n = n->next) { U64 range_size = n->v.block->single_item ? 1 : dim_1u64(n->v.range); Rng1U64 global_range = r1u64(base_num, base_num + range_size); @@ -875,7 +875,7 @@ ev2_block_range_from_num(EV2_BlockRangeList *block_ranges, U64 num) } internal EV_Key -ev2_key_from_num(EV2_BlockRangeList *block_ranges, U64 num) +ev_key_from_num(EV_BlockRangeList *block_ranges, U64 num) { EV_Key key = {0}; if(block_ranges->first) @@ -883,7 +883,7 @@ ev2_key_from_num(EV2_BlockRangeList *block_ranges, U64 num) key = ev_key_make(ev_hash_from_key(ev_key_root()), 1); } U64 base_num = 0; - for(EV2_BlockRangeNode *n = block_ranges->first; n != 0; n = n->next) + for(EV_BlockRangeNode *n = block_ranges->first; n != 0; n = n->next) { U64 range_size = n->v.block->single_item ? 1 : dim_1u64(n->v.range); Rng1U64 global_range = r1u64(base_num, base_num + range_size); @@ -901,11 +901,11 @@ ev2_key_from_num(EV2_BlockRangeList *block_ranges, U64 num) } internal U64 -ev2_num_from_key(EV2_BlockRangeList *block_ranges, EV_Key key) +ev_num_from_key(EV_BlockRangeList *block_ranges, EV_Key key) { U64 result = 0; U64 base_num = 0; - for(EV2_BlockRangeNode *n = block_ranges->first; n != 0; n = n->next) + for(EV_BlockRangeNode *n = block_ranges->first; n != 0; n = n->next) { U64 hash = ev_hash_from_key(n->v.block->key); if(hash == key.parent_hash) @@ -924,15 +924,15 @@ ev2_num_from_key(EV2_BlockRangeList *block_ranges, EV_Key key) } //////////////////////////////// -//~ rjf: Row Building (v2) +//~ rjf: Row Building -internal EV2_WindowedRowList -ev2_windowed_row_list_from_block_range_list(Arena *arena, EV_View *view, String8 filter, EV2_BlockRangeList *block_ranges, Rng1U64 visible_range) +internal EV_WindowedRowList +ev_windowed_row_list_from_block_range_list(Arena *arena, EV_View *view, String8 filter, EV_BlockRangeList *block_ranges, Rng1U64 visible_range) { - EV2_WindowedRowList rows = {0}; + EV_WindowedRowList rows = {0}; { U64 visual_idx_off = 0; - for(EV2_BlockRangeNode *n = block_ranges->first; n != 0; n = n->next) + for(EV_BlockRangeNode *n = block_ranges->first; n != 0; n = n->next) { // rjf: unpack this block/range pair Rng1U64 block_relative_range = n->v.range; @@ -986,7 +986,7 @@ ev2_windowed_row_list_from_block_range_list(Arena *arena, EV_View *view, String8 // rjf: no expansion operator applied -> push row for block expression; pass through block info if(expand_range_info.row_exprs_count == 0) { - EV2_Row *row = push_array(arena, EV2_Row, 1); + EV_Row *row = push_array(arena, EV_Row, 1); SLLQueuePush(rows.first, rows.last, row); rows.count += 1; row->block = n->v.block; @@ -1027,7 +1027,7 @@ ev2_windowed_row_list_from_block_range_list(Arena *arena, EV_View *view, String8 scratch_end(scratch); } E_Expr *row_expr__resolved = ev_expr_from_expr_view_rules(arena, row_expr, row_view_rules); - EV2_Row *row = push_array(arena, EV2_Row, 1); + EV_Row *row = push_array(arena, EV_Row, 1); SLLQueuePush(rows.first, rows.last, row); rows.count += 1; row->block = n->v.block; @@ -1051,693 +1051,6 @@ ev2_windowed_row_list_from_block_range_list(Arena *arena, EV_View *view, String8 return rows; } -internal String8 -ev2_expr_string_from_row(Arena *arena, EV2_Row *row, EV_StringFlags flags) -{ - String8 result = row->string; - E_Expr *notable_expr = row->expr; - for(B32 good = 0; !good;) - { - switch(notable_expr->kind) - { - default:{good = 1;}break; - case E_ExprKind_Address: - case E_ExprKind_Deref: - case E_ExprKind_Cast: - { - notable_expr = notable_expr->last; - }break; - case E_ExprKind_Ref: - { - notable_expr = notable_expr->ref; - }break; - } - } - if(result.size == 0) switch(notable_expr->kind) - { - default: - { - result = e_string_from_expr(arena, notable_expr); - }break; - case E_ExprKind_ArrayIndex: - { - result = push_str8f(arena, "[%S]", e_string_from_expr(arena, notable_expr->last)); - }break; - case E_ExprKind_MemberAccess: - { - if(flags & EV_StringFlag_PrettyNames && row->member->pretty_name.size != 0) - { - result = push_str8_copy(arena, row->member->pretty_name); - } - else - { - result = push_str8f(arena, ".%S", e_string_from_expr(arena, notable_expr->last)); - } - }break; - } - return result; -} - -internal B32 -ev2_row_is_expandable(EV2_Row *row) -{ - B32 result = 0; - { - // rjf: determine if view rules force expandability - if(!result) - { - for(EV_ViewRuleNode *n = row->view_rules->first; n != 0; n = n->next) - { - EV_ViewRuleInfo *info = ev_view_rule_info_from_string(n->v.root->string); - if(info->flags & EV_ViewRuleInfoFlag_Expandable) - { - result = 1; - break; - } - } - } - - // rjf: determine if type info force expandability - if(!result) - { - Temp scratch = scratch_begin(0, 0); - E_IRTreeAndType irtree = e_irtree_and_type_from_expr(scratch.arena, row->expr); - result = ev_type_key_and_mode_is_expandable(irtree.type_key, irtree.mode); - scratch_end(scratch); - } - } - return result; -} - -internal B32 -ev2_row_is_editable(EV2_Row *row) -{ - B32 result = 0; - Temp scratch = scratch_begin(0, 0); - E_IRTreeAndType irtree = e_irtree_and_type_from_expr(scratch.arena, row->expr); - result = ev_type_key_is_editable(irtree.type_key); - scratch_end(scratch); - return result; -} - -//////////////////////////////// -//~ rjf: Block Building - -#if 0 // TODO(rjf): @blocks -internal EV_Block * -ev_block_begin(Arena *arena, EV_BlockKind kind, EV_Key parent_key, EV_Key key, S32 depth) -{ - EV_BlockNode *n = push_array(arena, EV_BlockNode, 1); - n->v.kind = kind; - n->v.parent_key = parent_key; - n->v.key = key; - n->v.depth = depth; - n->v.expr = &e_expr_nil; - n->v.view_rules = &ev_nil_view_rule_list; - return &n->v; -} - -internal EV_Block * -ev_block_split_and_continue(Arena *arena, EV_BlockList *list, EV_Block *split_block, U64 split_idx) -{ - U64 total_count = split_block->semantic_idx_range.max; - split_block->visual_idx_range.max = split_block->semantic_idx_range.max = split_idx+1; - ev_block_end(list, split_block); - EV_Block *continue_block = ev_block_begin(arena, split_block->kind, split_block->parent_key, split_block->key, split_block->depth); - continue_block->string = split_block->string; - continue_block->expr = split_block->expr; - continue_block->visual_idx_range = continue_block->semantic_idx_range = r1u64(split_idx+1, total_count); - continue_block->view_rules = split_block->view_rules; - continue_block->members = split_block->members; - continue_block->enum_vals = split_block->enum_vals; - continue_block->fzy_target = split_block->fzy_target; - continue_block->fzy_backing_items = split_block->fzy_backing_items; - return continue_block; -} - -internal void -ev_block_end(EV_BlockList *list, EV_Block *block) -{ - EV_BlockNode *n = CastFromMember(EV_BlockNode, v, block); - DLLPushBack(list->first, list->last, n); - list->count += 1; - list->total_visual_row_count += dim_1u64(block->visual_idx_range); - list->total_semantic_row_count += dim_1u64(block->semantic_idx_range); -} - -internal void -ev_append_expr_blocks__rec(Arena *arena, EV_View *view, String8 filter, EV_Key parent_key, EV_Key key, String8 string, E_Expr *expr, EV_ViewRuleList *view_rules, S32 depth, EV_BlockList *list_out) -{ - ProfBeginFunction(); - Temp scratch = scratch_begin(&arena, 1); - - //- rjf: determine if this key is expanded - EV_ExpandNode *node = ev_expand_node_from_key(view, key); - B32 parent_is_expanded = (node != 0 && node->expanded); - - //- rjf: determine view rule to generate children blocks - EV_ViewRuleInfo *block_prod_view_rule_info = ev_view_rule_info_from_string(str8_lit("default")); - MD_Node *block_prod_view_rule_params = &md_nil_node; - if(parent_is_expanded) - { - for(EV_ViewRuleNode *n = view_rules->first; n != 0; n = n->next) - { - EV_ViewRuleInfo *tln_info = ev_view_rule_info_from_string(n->v.root->string); - if(tln_info->block_prod != 0) - { - block_prod_view_rule_info = tln_info; - block_prod_view_rule_params = n->v.root; - break; - } - } - } - - //- rjf: do view rule children block generation, if we have an applicable view rule - if(parent_is_expanded && block_prod_view_rule_info != &ev_nil_view_rule_info) - { - E_Expr *expr_resolved = ev_expr_from_expr_view_rules(arena, expr, view_rules); - block_prod_view_rule_info->block_prod(arena, view, filter, parent_key, key, node, string, expr_resolved, view_rules, block_prod_view_rule_params, depth+1, list_out); - } - - scratch_end(scratch); - ProfEnd(); -} - -internal EV_BlockList -ev_block_list_from_view_expr_keys(Arena *arena, EV_View *view, String8 filter, EV_ViewRuleList *view_rules, String8 expr, EV_Key parent_key, EV_Key key, S32 depth) -{ - ProfBeginFunction(); - EV_BlockList blocks = {0}; - { - E_TokenArray tokens = e_token_array_from_text(arena, expr); - E_Parse parse = e_parse_expr_from_text_tokens(arena, expr, &tokens); - U64 parse_opl = parse.last_token >= tokens.v + tokens.count ? expr.size : parse.last_token->range.min; - U64 expr_comma_pos = str8_find_needle(expr, parse_opl, str8_lit(","), 0); - U64 passthrough_pos = str8_find_needle(expr, parse_opl, str8_lit("--"), 0); - String8List default_view_rules = {0}; - if(expr_comma_pos < expr.size && expr_comma_pos < passthrough_pos) - { - String8 expr_extension = str8_substr(expr, r1u64(expr_comma_pos+1, passthrough_pos)); - expr_extension = str8_skip_chop_whitespace(expr_extension); - if(str8_match(expr_extension, str8_lit("x"), StringMatchFlag_CaseInsensitive)) - { - str8_list_pushf(arena, &default_view_rules, "hex"); - } - else if(str8_match(expr_extension, str8_lit("b"), StringMatchFlag_CaseInsensitive)) - { - str8_list_pushf(arena, &default_view_rules, "bin"); - } - else if(str8_match(expr_extension, str8_lit("o"), StringMatchFlag_CaseInsensitive)) - { - str8_list_pushf(arena, &default_view_rules, "oct"); - } - else if(expr_extension.size != 0) - { - str8_list_pushf(arena, &default_view_rules, "array:{%S}", expr_extension); - } - } - if(passthrough_pos < expr.size) - { - String8 passthrough_view_rule = str8_skip_chop_whitespace(str8_skip(expr, passthrough_pos+2)); - if(passthrough_view_rule.size != 0) - { - str8_list_push(arena, &default_view_rules, passthrough_view_rule); - } - } - String8 view_rule_string = ev_view_rule_from_key(view, key); - if(view_rule_string.size == 0) - { - E_IRTreeAndType irtree = e_irtree_and_type_from_expr(arena, parse.expr); - view_rule_string = ev_auto_view_rule_from_type_key(irtree.type_key); - } - EV_ViewRuleList *view_rule_list = ev_view_rule_list_copy(arena, view_rules); - for(String8Node *n = default_view_rules.first; n != 0; n = n->next) - { - ev_view_rule_list_push_string(arena, view_rule_list, n->string); - } - ev_view_rule_list_push_string(arena, view_rule_list, view_rule_string); - - //- rjf: apply expr resolution view rules - E_Expr *expr_resolved = ev_expr_from_expr_view_rules(arena, parse.expr, view_rule_list); - - //- rjf: push block for expression root - { - EV_Block *block = ev_block_begin(arena, EV_BlockKind_Root, parent_key, key, depth); - block->string = expr; - block->expr = expr_resolved; - block->view_rules = view_rule_list; - block->visual_idx_range = r1u64(key.child_id-1, key.child_id+0); - block->semantic_idx_range = r1u64(key.child_id-1, key.child_id+0); - ev_block_end(&blocks, block); - } - - //- rjf: push expansions for root - ev_append_expr_blocks__rec(arena, view, filter, parent_key, key, expr, parse.expr, view_rule_list, depth, &blocks); - } - ProfEnd(); - return blocks; -} - -internal void -ev_block_list_concat__in_place(EV_BlockList *dst, EV_BlockList *to_push) -{ - if(dst->last == 0) - { - *dst = *to_push; - } - else if(to_push->first != 0) - { - dst->last->next = to_push->first; - dst->last = to_push->last; - dst->count += to_push->count; - dst->total_visual_row_count += to_push->total_visual_row_count; - dst->total_semantic_row_count += to_push->total_semantic_row_count; - } - MemoryZeroStruct(to_push); -} -#endif - -//////////////////////////////// -//~ rjf: Block List <-> Row Coordinates - -#if 0 // TODO(rjf): @blocks -internal S64 -ev_row_num_from_block_list_key(EV_BlockList *blocks, EV_Key key) -{ - S64 row_num = 1; - B32 found = 0; - for(EV_BlockNode *n = blocks->first; n != 0; n = n->next) - { - EV_Block *block = &n->v; - if(key.parent_hash == block->key.parent_hash) - { - B32 this_block_contains_this_key = 0; - { - if(block->fzy_backing_items.v != 0) - { - U64 item_num = fzy_item_num_from_array_element_idx__linear_search(&block->fzy_backing_items, key.child_id); - this_block_contains_this_key = (item_num != 0 && contains_1u64(block->semantic_idx_range, item_num-1)); - } - else - { - this_block_contains_this_key = (block->semantic_idx_range.min+1 <= key.child_id && key.child_id < block->semantic_idx_range.max+1); - } - } - if(this_block_contains_this_key) - { - found = 1; - if(block->fzy_backing_items.v != 0) - { - U64 item_num = fzy_item_num_from_array_element_idx__linear_search(&block->fzy_backing_items, key.child_id); - row_num += item_num-1-block->semantic_idx_range.min; - } - else - { - row_num += key.child_id-1-block->semantic_idx_range.min; - } - break; - } - } - if(!found) - { - row_num += (S64)dim_1u64(block->semantic_idx_range); - } - } - if(!found) - { - row_num = 0; - } - return row_num; -} - -internal EV_Key -ev_key_from_block_list_row_num(EV_BlockList *blocks, S64 row_num) -{ - EV_Key key = {0}; - S64 scan_y = 1; - for(EV_BlockNode *n = blocks->first; n != 0; n = n->next) - { - EV_Block *vb = &n->v; - Rng1S64 vb_row_num_range = r1s64(scan_y, scan_y + (S64)dim_1u64(vb->semantic_idx_range)); - if(contains_1s64(vb_row_num_range, row_num)) - { - key = vb->key; - if(vb->fzy_backing_items.v != 0) - { - U64 item_idx = (U64)((row_num - vb_row_num_range.min) + vb->semantic_idx_range.min); - if(item_idx < vb->fzy_backing_items.count) - { - key.child_id = vb->fzy_backing_items.v[item_idx].idx; - } - } - else - { - key.child_id = vb->semantic_idx_range.min + (row_num - vb_row_num_range.min) + 1; - } - break; - } - scan_y += dim_1s64(vb_row_num_range); - } - return key; -} - -internal EV_Key -ev_parent_key_from_block_list_row_num(EV_BlockList *blocks, S64 row_num) -{ - EV_Key key = {0}; - S64 scan_y = 1; - for(EV_BlockNode *n = blocks->first; n != 0; n = n->next) - { - EV_Block *vb = &n->v; - Rng1S64 vb_row_num_range = r1s64(scan_y, scan_y + (S64)dim_1u64(vb->semantic_idx_range)); - if(contains_1s64(vb_row_num_range, row_num)) - { - key = vb->parent_key; - break; - } - scan_y += dim_1s64(vb_row_num_range); - } - return key; -} -#endif - -//////////////////////////////// -//~ rjf: Block * Index -> Expressions - -#if 0 // TODO(rjf): @blocks -internal E_Expr * -ev_expr_from_block_index(Arena *arena, EV_Block *block, U64 index) -{ - E_Expr *result = block->expr; - switch(block->kind) - { - default:{}break; - case EV_BlockKind_Members: - { - E_MemberArray *members = &block->members; - if(index < members->count) - { - E_Member *member = &members->v[index]; - E_Expr *dot_expr = e_expr_ref_member_access(arena, block->expr, member->name); - result = dot_expr; - } - }break; - case EV_BlockKind_EnumMembers: - { - E_EnumValArray *enum_vals = &block->enum_vals; - if(index < enum_vals->count) - { - E_EnumVal *val = &enum_vals->v[index]; - E_Expr *dot_expr = e_expr_ref_member_access(arena, block->expr, val->name); - result = dot_expr; - } - }break; - case EV_BlockKind_Elements: - { - E_Expr *idx_expr = e_expr_ref_array_index(arena, block->expr, index); - result = idx_expr; - }break; - case EV_BlockKind_DebugInfoTable: - { - // rjf: unpack row info - FZY_Item *item = &block->fzy_backing_items.v[index]; - EV_Key parent_key = block->parent_key; - EV_Key key = block->key; - key.child_id = block->fzy_backing_items.v[index].idx; - - // rjf: determine module to which this item belongs - E_Module *module = e_parse_ctx->primary_module; - U64 base_idx = 0; - { - for(U64 module_idx = 0; module_idx < e_parse_ctx->modules_count; module_idx += 1) - { - U64 all_items_count = 0; - rdi_section_raw_table_from_kind(e_parse_ctx->modules[module_idx].rdi, block->fzy_target, &all_items_count); - if(base_idx <= item->idx && item->idx < base_idx + all_items_count) - { - module = &e_parse_ctx->modules[module_idx]; - break; - } - base_idx += all_items_count; - } - } - - // rjf: build expr - E_Expr *item_expr = &e_expr_nil; - { - RDI_SectionKind section = block->fzy_target; - U64 element_idx = block->fzy_backing_items.v[index].idx - base_idx; - switch(section) - { - default:{}break; - case RDI_SectionKind_Procedures: - { - RDI_Procedure *procedure = rdi_element_from_name_idx(module->rdi, Procedures, element_idx); - RDI_Scope *scope = rdi_element_from_name_idx(module->rdi, Scopes, procedure->root_scope_idx); - U64 voff = *rdi_element_from_name_idx(module->rdi, ScopeVOffData, scope->voff_range_first); - E_OpList oplist = {0}; - e_oplist_push_op(arena, &oplist, RDI_EvalOp_ModuleOff, e_value_u64(voff)); - String8 bytecode = e_bytecode_from_oplist(arena, &oplist); - U32 type_idx = procedure->type_idx; - RDI_TypeNode *type_node = rdi_element_from_name_idx(module->rdi, TypeNodes, type_idx); - E_TypeKey type_key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), type_idx, (U32)(module - e_parse_ctx->modules)); - item_expr = e_push_expr(arena, E_ExprKind_LeafBytecode, 0); - item_expr->mode = E_Mode_Value; - item_expr->space = module->space; - item_expr->type_key = type_key; - item_expr->bytecode = bytecode; - item_expr->string.str = rdi_string_from_idx(module->rdi, procedure->name_string_idx, &item_expr->string.size); - }break; - case RDI_SectionKind_GlobalVariables: - { - RDI_GlobalVariable *gvar = rdi_element_from_name_idx(module->rdi, GlobalVariables, element_idx); - U64 voff = gvar->voff; - E_OpList oplist = {0}; - e_oplist_push_op(arena, &oplist, RDI_EvalOp_ModuleOff, e_value_u64(voff)); - String8 bytecode = e_bytecode_from_oplist(arena, &oplist); - U32 type_idx = gvar->type_idx; - RDI_TypeNode *type_node = rdi_element_from_name_idx(module->rdi, TypeNodes, type_idx); - E_TypeKey type_key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), type_idx, (U32)(module - e_parse_ctx->modules)); - item_expr = e_push_expr(arena, E_ExprKind_LeafBytecode, 0); - item_expr->mode = E_Mode_Offset; - item_expr->space = module->space; - item_expr->type_key = type_key; - item_expr->bytecode = bytecode; - item_expr->string.str = rdi_string_from_idx(module->rdi, gvar->name_string_idx, &item_expr->string.size); - }break; - case RDI_SectionKind_ThreadVariables: - { - RDI_ThreadVariable *tvar = rdi_element_from_name_idx(module->rdi, ThreadVariables, element_idx); - E_OpList oplist = {0}; - e_oplist_push_op(arena, &oplist, RDI_EvalOp_TLSOff, e_value_u64(tvar->tls_off)); - String8 bytecode = e_bytecode_from_oplist(arena, &oplist); - U32 type_idx = tvar->type_idx; - RDI_TypeNode *type_node = rdi_element_from_name_idx(module->rdi, TypeNodes, type_idx); - E_TypeKey type_key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), type_idx, (U32)(module - e_parse_ctx->modules)); - item_expr = e_push_expr(arena, E_ExprKind_LeafBytecode, 0); - item_expr->mode = E_Mode_Offset; - item_expr->space = module->space; - item_expr->type_key = type_key; - item_expr->bytecode = bytecode; - item_expr->string.str = rdi_string_from_idx(module->rdi, tvar->name_string_idx, &item_expr->string.size); - }break; - case RDI_SectionKind_UDTs: - { - RDI_UDT *udt = rdi_element_from_name_idx(module->rdi, UDTs, element_idx); - RDI_TypeNode *type_node = rdi_element_from_name_idx(module->rdi, TypeNodes, udt->self_type_idx); - E_TypeKey type_key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), udt->self_type_idx, (U32)(module - e_parse_ctx->modules)); - item_expr = e_push_expr(arena, E_ExprKind_TypeIdent, 0); - item_expr->type_key = type_key; - }break; - } - } - - result = item_expr; - }break; - } - return result; -} -#endif - -//////////////////////////////// -//~ rjf: Row Lists - -#if 0 // TODO(rjf): @blocks -internal EV_Row * -ev_row_list_push_new(Arena *arena, EV_View *view, EV_WindowedRowList *rows, EV_Block *block, EV_Key key, E_Expr *expr) -{ - // rjf: push - EV_Row *row = push_array(arena, EV_Row, 1); - SLLQueuePush(rows->first, rows->last, row); - rows->count += 1; - - // rjf: pick view rule list; resolve expression if needed - EV_ViewRuleList *view_rules = 0; - E_Expr *expr_resolved = expr; - switch(block->kind) - { - default: - { - view_rules = ev_view_rule_list_from_inheritance(arena, block->view_rules); - String8 row_view_rules = ev_view_rule_from_key(view, key); - if(row_view_rules.size == 0) - { - Temp scratch = scratch_begin(&arena, 1); - E_IRTreeAndType irtree = e_irtree_and_type_from_expr(arena, expr); - row_view_rules = ev_auto_view_rule_from_type_key(irtree.type_key); - scratch_end(scratch); - } - if(row_view_rules.size != 0) - { - ev_view_rule_list_push_string(arena, view_rules, row_view_rules); - } - expr_resolved = ev_expr_from_expr_view_rules(arena, expr, view_rules); - }break; - case EV_BlockKind_Root: - case EV_BlockKind_Canvas: - { - view_rules = block->view_rules; - }break; - } - - // rjf: fill - row->block_kind = block->kind; - row->depth = block->depth; - row->parent_key = block->parent_key; - row->key = key; - row->size_in_rows = 1; - row->string = block->string; - row->expr = expr_resolved; - row->view_rules = view_rules; - return row; -} - -internal EV_WindowedRowList -ev_windowed_row_list_from_block_list(Arena *arena, EV_View *view, Rng1S64 visible_range, EV_BlockList *blocks) -{ - ProfBeginFunction(); - - ////////////////////////////// - //- rjf: produce windowed rows, per block - // - U64 visual_idx_off = 0; - U64 semantic_idx_off = 0; - EV_WindowedRowList list = {0}; - for(EV_BlockNode *n = blocks->first; n != 0; n = n->next) - { - EV_Block *block = &n->v; - - ////////////////////////////// - //- rjf: extract block info - // - U64 block_num_visual_rows = dim_1u64(block->visual_idx_range); - U64 block_num_semantic_rows = dim_1u64(block->semantic_idx_range); - Rng1S64 block_visual_range = r1s64(visual_idx_off, visual_idx_off + block_num_visual_rows); - Rng1S64 block_semantic_range = r1s64(semantic_idx_off, semantic_idx_off + block_num_semantic_rows); - - ////////////////////////////// - //- rjf: get skip/chop of block's index range - // - U64 num_skipped_visual = 0; - U64 num_chopped_visual = 0; - { - if(visible_range.min > block_visual_range.min) - { - num_skipped_visual = (visible_range.min - block_visual_range.min); - num_skipped_visual = Min(num_skipped_visual, block_num_visual_rows); - } - if(visible_range.max < block_visual_range.max) - { - num_chopped_visual = (block_visual_range.max - visible_range.max); - num_chopped_visual = Min(num_chopped_visual, block_num_visual_rows); - } - } - - ////////////////////////////// - //- rjf: get visible idx range & invisible counts - // - Rng1U64 visible_idx_range = block->visual_idx_range; - { - visible_idx_range.min += num_skipped_visual; - visible_idx_range.max -= num_chopped_visual; - } - - ////////////////////////////// - //- rjf: sum & advance - // - list.count_before_visual += num_skipped_visual; - if(block_num_visual_rows != 0) - { - list.count_before_semantic += block_num_semantic_rows * num_skipped_visual / block_num_visual_rows; - } - visual_idx_off += block_num_visual_rows; - semantic_idx_off += block_num_semantic_rows; - - ////////////////////////////// - //- rjf: produce rows, depending on block's kind - // - if(visible_idx_range.max > visible_idx_range.min) switch(block->kind) - { - default:{}break; - - ////////////////////////////// - //- rjf: single rows, piping in info from the originating block - // - case EV_BlockKind_Null: - case EV_BlockKind_Root: - { - ev_row_list_push_new(arena, view, &list, block, block->key, block->expr); - }break; - - ////////////////////////////// - //- rjf: canvas -> produce blank row, sized by the idx range specified in the block - // - case EV_BlockKind_Canvas: - if(num_skipped_visual < block_num_visual_rows) - { - EV_Key key = ev_key_make(ev_hash_from_key(block->parent_key), 1); - EV_Row *row = ev_row_list_push_new(arena, view, &list, block, key, block->expr); - row->size_in_rows = dim_1u64(intersect_1u64(visible_idx_range, r1u64(0, dim_1u64(block->visual_idx_range)))); - row->skipped_size_in_rows= (visible_idx_range.min > block->visual_idx_range.min) ? visible_idx_range.min - block->visual_idx_range.min : 0; - row->chopped_size_in_rows= (visible_idx_range.max < block->visual_idx_range.max) ? block->visual_idx_range.max - visible_idx_range.max : 0; - }break; - - ////////////////////////////// - //- rjf: all elements of a debug info table -> produce rows for visible range - // - case EV_BlockKind_DebugInfoTable: - for(U64 idx = visible_idx_range.min; idx < visible_idx_range.max; idx += 1) - { - FZY_Item *item = &block->fzy_backing_items.v[idx]; - EV_Key key = ev_key_make(ev_hash_from_key(block->parent_key), block->fzy_backing_items.v[idx].idx); - E_Expr *row_expr = ev_expr_from_block_index(arena, block, idx); - ev_row_list_push_new(arena, view, &list, block, key, row_expr); - }break; - - ////////////////////////////// - //- rjf: members/elements/enum-members - // - case EV_BlockKind_Members: - case EV_BlockKind_EnumMembers: - case EV_BlockKind_Elements: - { - for(U64 idx = visible_idx_range.min; idx < visible_idx_range.max; idx += 1) - { - EV_Key key = ev_key_make(ev_hash_from_key(block->parent_key), idx+1); - E_Expr *expr = ev_expr_from_block_index(arena, block, idx); - EV_Row *row = ev_row_list_push_new(arena, view, &list, block, key, expr); - if(block->kind == EV_BlockKind_Members && idx < block->members.count) - { - row->member = e_type_member_copy(arena, &block->members.v[idx]); - } - } - }break; - } - } - ProfEnd(); - return list; -} - internal String8 ev_expr_string_from_row(Arena *arena, EV_Row *row, EV_StringFlags flags) { @@ -1772,7 +1085,7 @@ ev_expr_string_from_row(Arena *arena, EV_Row *row, EV_StringFlags flags) }break; case E_ExprKind_MemberAccess: { - if(flags & EV_StringFlag_PrettyNames && row->member != 0 && row->member->pretty_name.size != 0) + if(flags & EV_StringFlag_PrettyNames && row->member->pretty_name.size != 0) { result = push_str8_copy(arena, row->member->pretty_name); } @@ -1826,7 +1139,6 @@ ev_row_is_editable(EV_Row *row) scratch_end(scratch); return result; } -#endif //////////////////////////////// //~ rjf: Stringification diff --git a/src/eval_visualization/eval_visualization_core.h b/src/eval_visualization/eval_visualization_core.h index 732e6efb..98232428 100644 --- a/src/eval_visualization/eval_visualization_core.h +++ b/src/eval_visualization/eval_visualization_core.h @@ -98,65 +98,6 @@ struct EV_ViewRuleList U64 count; }; -//////////////////////////////// -//~ rjf: Blocks - -typedef enum EV_BlockKind -{ - EV_BlockKind_Null, // empty - EV_BlockKind_Root, // root of tree or subtree; possibly-expandable expression. - EV_BlockKind_Members, // members of struct, class, union - EV_BlockKind_EnumMembers, // members of enum - EV_BlockKind_Elements, // elements of array - EV_BlockKind_Canvas, // escape hatch for arbitrary UI - EV_BlockKind_DebugInfoTable, // block of filtered debug info table elements - EV_BlockKind_COUNT, -} -EV_BlockKind; - -typedef struct EV_Block EV_Block; -struct EV_Block -{ - // rjf: kind & keys - EV_BlockKind kind; - EV_Key parent_key; - EV_Key key; - S32 depth; - - // rjf: evaluation info - String8 string; - E_Expr *expr; - - // rjf: info about ranges that this block spans - Rng1U64 visual_idx_range; - Rng1U64 semantic_idx_range; - - // rjf: visualization info extensions - EV_ViewRuleList *view_rules; - E_MemberArray members; - E_EnumValArray enum_vals; - RDI_SectionKind fzy_target; - FZY_ItemArray fzy_backing_items; -}; - -typedef struct EV_BlockNode EV_BlockNode; -struct EV_BlockNode -{ - EV_BlockNode *next; - EV_BlockNode *prev; - EV_Block v; -}; - -typedef struct EV_BlockList EV_BlockList; -struct EV_BlockList -{ - EV_BlockNode *first; - EV_BlockNode *last; - U64 count; - U64 total_visual_row_count; - U64 total_semantic_row_count; -}; - //////////////////////////////// //~ rjf: View Rule Info Types @@ -199,31 +140,11 @@ struct EV_ExpandRangeInfo #define EV_VIEW_RULE_EXPR_EXPAND_NUM_FROM_ID_FUNCTION_NAME(name) ev_view_rule_expr_expand_num_from_id_##name #define EV_VIEW_RULE_EXPR_EXPAND_NUM_FROM_ID_FUNCTION_DEF(name) internal EV_VIEW_RULE_EXPR_EXPAND_NUM_FROM_ID_FUNCTION_SIG(EV_VIEW_RULE_EXPR_EXPAND_NUM_FROM_ID_FUNCTION_NAME(name)) -#if 0 // TODO(rjf): @blocks -#define EV_VIEW_RULE_BLOCK_PROD_FUNCTION_SIG(name) void name(Arena *arena, \ -EV_View *view, \ -String8 filter, \ -EV_Key parent_key, \ -EV_Key key, \ -EV_ExpandNode *expand_node, \ -String8 string, \ -E_Expr *expr, \ -EV_ViewRuleList *view_rules, \ -MD_Node *view_params, \ -S32 depth, \ -struct EV_BlockList *out) -#define EV_VIEW_RULE_BLOCK_PROD_FUNCTION_NAME(name) ev_view_rule_block_prod__##name -#define EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(name) internal EV_VIEW_RULE_BLOCK_PROD_FUNCTION_SIG(EV_VIEW_RULE_BLOCK_PROD_FUNCTION_NAME(name)) -#endif - typedef EV_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_SIG(EV_ViewRuleExprResolutionHookFunctionType); typedef EV_VIEW_RULE_EXPR_EXPAND_INFO_FUNCTION_SIG(EV_ViewRuleExprExpandInfoHookFunctionType); typedef EV_VIEW_RULE_EXPR_EXPAND_RANGE_INFO_FUNCTION_SIG(EV_ViewRuleExprExpandRangeInfoHookFunctionType); typedef EV_VIEW_RULE_EXPR_EXPAND_ID_FROM_NUM_FUNCTION_SIG(EV_ViewRuleExprExpandIDFromNumHookFunctionType); typedef EV_VIEW_RULE_EXPR_EXPAND_NUM_FROM_ID_FUNCTION_SIG(EV_ViewRuleExprExpandNumFromIDHookFunctionType); -#if 0 // TODO(rjf): @blocks -typedef EV_VIEW_RULE_BLOCK_PROD_FUNCTION_SIG(EV_ViewRuleBlockProdHookFunctionType); -#endif typedef U32 EV_ViewRuleInfoFlags; // NOTE(rjf): see @view_rule_info enum @@ -242,9 +163,6 @@ struct EV_ViewRuleInfo EV_ViewRuleExprExpandRangeInfoHookFunctionType *expr_expand_range_info; EV_ViewRuleExprExpandIDFromNumHookFunctionType *expr_expand_id_from_num; EV_ViewRuleExprExpandIDFromNumHookFunctionType *expr_expand_num_from_id; -#if 0 // TODO(rjf): @blocks - EV_ViewRuleBlockProdHookFunctionType *block_prod; -#endif }; typedef struct EV_ViewRuleInfoNode EV_ViewRuleInfoNode; @@ -269,17 +187,17 @@ struct EV_ViewRuleInfoTable }; //////////////////////////////// -//~ rjf: Blocks (v2) +//~ rjf: Blocks -typedef struct EV2_Block EV2_Block; -struct EV2_Block +typedef struct EV_Block EV_Block; +struct EV_Block { // rjf: links - EV2_Block *first; - EV2_Block *last; - EV2_Block *next; - EV2_Block *prev; - EV2_Block *parent; + EV_Block *first; + EV_Block *last; + EV_Block *next; + EV_Block *prev; + EV_Block *parent; // rjf: key EV_Key key; @@ -300,46 +218,46 @@ struct EV2_Block B32 single_item; }; -typedef struct EV2_BlockTree EV2_BlockTree; -struct EV2_BlockTree +typedef struct EV_BlockTree EV_BlockTree; +struct EV_BlockTree { - EV2_Block *root; + EV_Block *root; U64 total_row_count; U64 total_item_count; }; -typedef struct EV2_BlockRange EV2_BlockRange; -struct EV2_BlockRange +typedef struct EV_BlockRange EV_BlockRange; +struct EV_BlockRange { - EV2_Block *block; + EV_Block *block; Rng1U64 range; }; -typedef struct EV2_BlockRangeNode EV2_BlockRangeNode; -struct EV2_BlockRangeNode +typedef struct EV_BlockRangeNode EV_BlockRangeNode; +struct EV_BlockRangeNode { - EV2_BlockRangeNode *next; - EV2_BlockRange v; + EV_BlockRangeNode *next; + EV_BlockRange v; }; -typedef struct EV2_BlockRangeList EV2_BlockRangeList; -struct EV2_BlockRangeList +typedef struct EV_BlockRangeList EV_BlockRangeList; +struct EV_BlockRangeList { - EV2_BlockRangeNode *first; - EV2_BlockRangeNode *last; + EV_BlockRangeNode *first; + EV_BlockRangeNode *last; U64 count; }; //////////////////////////////// -//~ rjf: Rows (v2) +//~ rjf: Rows -typedef struct EV2_Row EV2_Row; -struct EV2_Row +typedef struct EV_Row EV_Row; +struct EV_Row { - EV2_Row *next; + EV_Row *next; // rjf: block hierarchy info - EV2_Block *block; + EV_Block *block; EV_Key key; // rjf: row size/scroll info @@ -354,11 +272,11 @@ struct EV2_Row EV_ViewRuleList *view_rules; }; -typedef struct EV2_WindowedRowList EV2_WindowedRowList; -struct EV2_WindowedRowList +typedef struct EV_WindowedRowList EV_WindowedRowList; +struct EV_WindowedRowList { - EV2_Row *first; - EV2_Row *last; + EV_Row *first; + EV_Row *last; U64 count; U64 count_before_visual; U64 count_before_semantic; @@ -396,7 +314,7 @@ struct EV_AutoViewRuleTable #include "generated/eval_visualization.meta.h" //////////////////////////////// -//~ rjf: Rows +//~ rjf: String Generation Types typedef U32 EV_StringFlags; enum @@ -405,41 +323,6 @@ enum EV_StringFlag_PrettyNames = (1<<1), }; -typedef struct EV_Row EV_Row; -struct EV_Row -{ - EV_Row *next; - - // rjf: block hierarchy info - EV_BlockKind block_kind; - S32 depth; - EV_Key parent_key; - EV_Key key; - - // rjf: row size/scroll info - U64 size_in_rows; - U64 skipped_size_in_rows; - U64 chopped_size_in_rows; - - // rjf: evaluation expression - String8 string; - E_Member *member; - E_Expr *expr; - - // rjf: view rule attachments - EV_ViewRuleList *view_rules; -}; - -typedef struct EV_WindowedRowList EV_WindowedRowList; -struct EV_WindowedRowList -{ - EV_Row *first; - EV_Row *last; - U64 count; - U64 count_before_visual; - U64 count_before_semantic; -}; - //////////////////////////////// //~ rjf: Nil/Identity View Rule Hooks @@ -465,7 +348,7 @@ global read_only EV_ViewRuleInfo ev_nil_view_rule_info = thread_static EV_ViewRuleInfoTable *ev_view_rule_info_table = 0; global read_only EV_ViewRuleList ev_nil_view_rule_list = {0}; thread_static EV_AutoViewRuleTable *ev_auto_view_rule_table = 0; -global read_only EV2_Block ev2_nil_block = {&ev2_nil_block, &ev2_nil_block, &ev2_nil_block, &ev2_nil_block, &ev2_nil_block, {0}, 0, {0}, &e_expr_nil, &ev_nil_view_rule_list, &ev_nil_view_rule_info}; +global read_only EV_Block ev_nil_block = {&ev_nil_block, &ev_nil_block, &ev_nil_block, &ev_nil_block, &ev_nil_block, {0}, 0, {0}, &e_expr_nil, &ev_nil_view_rule_list, &ev_nil_view_rule_info}; //////////////////////////////// //~ rjf: Key Functions @@ -527,67 +410,28 @@ internal EV_ViewRuleList *ev_view_rule_list_copy(Arena *arena, EV_ViewRuleList * internal E_Expr *ev_expr_from_expr_view_rules(Arena *arena, E_Expr *expr, EV_ViewRuleList *view_rules); -//////////////////////////////// -//~ rjf: Block Building (v2) - -internal EV2_BlockTree ev2_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, String8 string, E_Expr *expr, EV_ViewRuleList *view_rules); -internal EV2_BlockTree ev2_block_tree_from_string(Arena *arena, EV_View *view, String8 filter, String8 string, EV_ViewRuleList *view_rules); -internal U64 ev2_depth_from_block(EV2_Block *block); - -//////////////////////////////// -//~ rjf: Block Coordinate Spaces (v2) - -internal EV2_BlockRangeList ev2_block_range_list_from_tree(Arena *arena, EV2_BlockTree *block_tree); -internal EV2_BlockRange ev2_block_range_from_num(EV2_BlockRangeList *block_ranges, U64 num); -internal EV_Key ev2_key_from_num(EV2_BlockRangeList *block_ranges, U64 num); -internal U64 ev2_num_from_key(EV2_BlockRangeList *block_ranges, EV_Key key); - -//////////////////////////////// -//~ rjf: Row Building (v2) - -internal EV2_WindowedRowList ev2_windowed_row_list_from_block_range_list(Arena *arena, EV_View *view, String8 filter, EV2_BlockRangeList *block_ranges, Rng1U64 visible_range); -internal String8 ev2_expr_string_from_row(Arena *arena, EV2_Row *row, EV_StringFlags flags); -internal B32 ev2_row_is_expandable(EV2_Row *row); -internal B32 ev2_row_is_editable(EV2_Row *row); - //////////////////////////////// //~ rjf: Block Building -#if 0 // TODO(rjf): @blocks -internal EV_Block *ev_block_begin(Arena *arena, EV_BlockKind kind, EV_Key parent_key, EV_Key key, S32 depth); -internal EV_Block *ev_block_split_and_continue(Arena *arena, EV_BlockList *list, EV_Block *split_block, U64 split_idx); -internal void ev_block_end(EV_BlockList *list, EV_Block *block); -internal void ev_append_expr_blocks__rec(Arena *arena, EV_View *view, String8 filter, EV_Key parent_key, EV_Key key, String8 string, E_Expr *expr, EV_ViewRuleList *view_rules, S32 depth, EV_BlockList *list_out); -internal EV_BlockList ev_block_list_from_view_expr_keys(Arena *arena, EV_View *view, String8 filter, EV_ViewRuleList *view_rules, String8 expr, EV_Key parent_key, EV_Key key, S32 depth); -internal void ev_block_list_concat__in_place(EV_BlockList *dst, EV_BlockList *to_push); -#endif +internal EV_BlockTree ev_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, String8 string, E_Expr *expr, EV_ViewRuleList *view_rules); +internal EV_BlockTree ev_block_tree_from_string(Arena *arena, EV_View *view, String8 filter, String8 string, EV_ViewRuleList *view_rules); +internal U64 ev_depth_from_block(EV_Block *block); //////////////////////////////// -//~ rjf: Block List <-> Row Coordinates +//~ rjf: Block Coordinate Spaces -#if 0 // TODO(rjf): @blocks -internal S64 ev_row_num_from_block_list_key(EV_BlockList *blocks, EV_Key key); -internal EV_Key ev_key_from_block_list_row_num(EV_BlockList *blocks, S64 row_num); -internal EV_Key ev_parent_key_from_block_list_row_num(EV_BlockList *blocks, S64 row_num); -#endif +internal EV_BlockRangeList ev_block_range_list_from_tree(Arena *arena, EV_BlockTree *block_tree); +internal EV_BlockRange ev_block_range_from_num(EV_BlockRangeList *block_ranges, U64 num); +internal EV_Key ev_key_from_num(EV_BlockRangeList *block_ranges, U64 num); +internal U64 ev_num_from_key(EV_BlockRangeList *block_ranges, EV_Key key); //////////////////////////////// -//~ rjf: Block * Index -> Expressions +//~ rjf: Row Building -#if 0 // TODO(rjf): @blocks -internal E_Expr *ev_expr_from_block_index(Arena *arena, EV_Block *block, U64 index); -#endif - -//////////////////////////////// -//~ rjf: Row Lists - -#if 0 // TODO(rjf): @blocks -internal EV_Row *ev_row_list_push_new(Arena *arena, EV_View *view, EV_WindowedRowList *rows, EV_Block *block, EV_Key key, E_Expr *expr); -internal EV_WindowedRowList ev_windowed_row_list_from_block_list(Arena *arena, EV_View *view, Rng1S64 visible_range, EV_BlockList *blocks); -internal String8 ev_expr_string_from_row(Arena *arena, EV_Row *row, EV_StringFlags ); +internal EV_WindowedRowList ev_windowed_row_list_from_block_range_list(Arena *arena, EV_View *view, String8 filter, EV_BlockRangeList *block_ranges, Rng1U64 visible_range); +internal String8 ev_expr_string_from_row(Arena *arena, EV_Row *row, EV_StringFlags flags); internal B32 ev_row_is_expandable(EV_Row *row); internal B32 ev_row_is_editable(EV_Row *row); -#endif //////////////////////////////// //~ rjf: Stringification diff --git a/src/raddbg/raddbg.mdesk b/src/raddbg/raddbg.mdesk index cac6c065..290dd059 100644 --- a/src/raddbg/raddbg.mdesk +++ b/src/raddbg/raddbg.mdesk @@ -873,13 +873,6 @@ RD_CollectionTable: @expand(RD_CollectionTable a) `EV_VIEW_RULE_EXPR_EXPAND_NUM_FROM_ID_FUNCTION_NAME($(a.id_space == x -> a.name)$(a.id_space != x -> identity))` } -/* @blocks -@data(`EV_ViewRuleBlockProdHookFunctionType *`) rd_collection_block_prod_hook_function_table: -{ - @expand(RD_CollectionTable a) `EV_VIEW_RULE_BLOCK_PROD_FUNCTION_NAME($(a.name))` -} -*/ - //////////////////////////////// //~ rjf: View Rules @@ -951,7 +944,6 @@ RD_ViewRuleTable: `String8 params_schema`; `RD_IconKind icon_kind`; `RD_ViewRuleInfoFlags flags`; - // TODO(rjf): @blocks `EV_ViewRuleBlockProdHookFunctionType *block_prod`; `EV_ViewRuleExprExpandInfoHookFunctionType *expr_expand_info`; `RD_ViewRuleUIFunctionType *ui`; } @@ -959,7 +951,6 @@ RD_ViewRuleTable: @gen { `RD_VIEW_RULE_UI_FUNCTION_DEF(null);`, - // @blocks @expand(RD_ViewRuleTable a) `$(a.can_use_in_watch_table != 0 -> "EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(" .. a.name_lower .. ");")`, @expand(RD_ViewRuleTable a) `$(a.can_use_in_watch_table != 0 && a.can_expand != 0 -> "EV_VIEW_RULE_EXPR_EXPAND_INFO_FUNCTION_DEF(" .. a.name_lower .. ");")`, @expand(RD_ViewRuleTable a) `RD_VIEW_RULE_UI_FUNCTION_DEF($(a.name_lower));`, } diff --git a/src/raddbg/raddbg_core.c b/src/raddbg/raddbg_core.c index 1024bc60..9637b734 100644 --- a/src/raddbg/raddbg_core.c +++ b/src/raddbg/raddbg_core.c @@ -5825,12 +5825,12 @@ rd_window_frame(RD_Window *ws) EV_View *ev_view = rd_ev_view_from_key(d_hash_from_string(ev_view_key_string)); EV_Key parent_key = ev_key_make(5381, 1); EV_Key key = ev_key_make(ev_hash_from_key(parent_key), 1); - EV2_BlockTree block_tree = ev2_block_tree_from_string(scratch.arena, ev_view, str8_zero(), expr, &top_level_view_rules); - EV2_BlockRangeList block_ranges = ev2_block_range_list_from_tree(scratch.arena, &block_tree); + EV_BlockTree block_tree = ev_block_tree_from_string(scratch.arena, ev_view, str8_zero(), expr, &top_level_view_rules); + EV_BlockRangeList block_ranges = ev_block_range_list_from_tree(scratch.arena, &block_tree); // EV_BlockList viz_blocks = ev_block_list_from_view_expr_keys(scratch.arena, ev_view, str8_zero(), &top_level_view_rules, expr, parent_key, key, 0); CTRL_Entity *entity = rd_ctrl_entity_from_eval_space(eval.space); U32 default_radix = (entity->kind == CTRL_EntityKind_Thread ? 16 : 10); - EV2_WindowedRowList rows = ev2_windowed_row_list_from_block_range_list(scratch.arena, ev_view, str8_zero(), &block_ranges, r1u64(0, 50)); + EV_WindowedRowList rows = ev_windowed_row_list_from_block_range_list(scratch.arena, ev_view, str8_zero(), &block_ranges, r1u64(0, 50)); // EV_WindowedRowList viz_rows = ev_windowed_row_list_from_block_list(scratch.arena, ev_view, r1s64(0, 50), &viz_blocks); //- rjf: animate @@ -5872,9 +5872,9 @@ rd_window_frame(RD_Window *ws) F32 value_column_width_px = 30.f*ui_top_font_size(); if(rows.first != 0) { - EV2_Row *row = rows.first; + EV_Row *row = rows.first; E_Eval row_eval = e_eval_from_expr(scratch.arena, row->expr); - String8 row_expr_string = ev2_expr_string_from_row(scratch.arena, row, 0); + String8 row_expr_string = ev_expr_string_from_row(scratch.arena, row, 0); String8 row_display_value = rd_value_string_from_eval(scratch.arena, EV_StringFlag_ReadOnlyDisplayRules, default_radix, ui_top_font(), ui_top_font_size(), 500.f, row_eval, row->member, row->view_rules); expr_column_width_px = fnt_dim_from_tag_size_string(ui_top_font(), ui_top_font_size(), 0, 0, row_expr_string).x + ui_top_font_size()*5.f; value_column_width_px = fnt_dim_from_tag_size_string(ui_top_font(), ui_top_font_size(), 0, 0, row_display_value).x + ui_top_font_size()*5.f; @@ -5918,16 +5918,16 @@ rd_window_frame(RD_Window *ws) UI_Parent(hover_eval_box) UI_PrefHeight(ui_px(row_height, 1.f)) { //- rjf: build rows - for(EV2_Row *row = rows.first; row != 0; row = row->next) + for(EV_Row *row = rows.first; row != 0; row = row->next) { //- rjf: unpack row - U64 row_depth = ev2_depth_from_block(row->block); + U64 row_depth = ev_depth_from_block(row->block); E_Eval row_eval = e_eval_from_expr(scratch.arena, row->expr); - String8 row_expr_string = ev2_expr_string_from_row(scratch.arena, row, 0); + String8 row_expr_string = ev_expr_string_from_row(scratch.arena, row, 0); String8 row_edit_value = rd_value_string_from_eval(scratch.arena, 0, default_radix, ui_top_font(), ui_top_font_size(), 500.f, row_eval, row->member, row->view_rules); String8 row_display_value = rd_value_string_from_eval(scratch.arena, EV_StringFlag_ReadOnlyDisplayRules, default_radix, ui_top_font(), ui_top_font_size(), 500.f, row_eval, row->member, row->view_rules); - B32 row_is_editable = ev2_row_is_editable(row); - B32 row_is_expandable = ev2_row_is_expandable(row); + B32 row_is_editable = ev_row_is_editable(row); + B32 row_is_expandable = ev_row_is_expandable(row); //- rjf: determine if row's data is fresh and/or bad B32 row_is_fresh = 0; @@ -8072,199 +8072,6 @@ EV_VIEW_RULE_EXPR_EXPAND_RANGE_INFO_FUNCTION_DEF(procedures) {return rd_ev_ EV_VIEW_RULE_EXPR_EXPAND_ID_FROM_NUM_FUNCTION_DEF(procedures) {return rd_ev_view_rule_expr_id_from_num__debug_info_tables(num, user_data, RDI_SectionKind_Procedures); } EV_VIEW_RULE_EXPR_EXPAND_NUM_FROM_ID_FUNCTION_DEF(procedures) {return rd_ev_view_rule_expr_num_from_id__debug_info_tables(id, user_data, RDI_SectionKind_Procedures); } -//- TODO(rjf): OLD VVVVVVVVVVVVVVVVVVVVVVVVVV - -#if 0 // TODO(rjf): @blocks -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(watches) -{ - Temp scratch = scratch_begin(&arena, 1); - RD_EntityList watches = rd_query_cached_entity_list_with_kind(RD_EntityKind_Watch); - EV_ViewRuleList *view_rules_inherited = ev_view_rule_list_from_inheritance(arena, view_rules); - for(RD_EntityNode *n = watches.first; n != 0; n = n->next) - { - RD_Entity *entity = n->entity; - String8 entity_expr_string = entity->string; - EV_Key entity_parent_key = rd_parent_ev_key_from_entity(entity); - EV_Key entity_key = rd_ev_key_from_entity(entity); - EV_BlockList blocks = ev_block_list_from_view_expr_keys(arena, view, filter, view_rules_inherited, entity_expr_string, entity_parent_key, entity_key, depth); - FuzzyMatchRangeList matches = fuzzy_match_find(scratch.arena, filter, entity_expr_string); - if(blocks.total_semantic_row_count > 1 || matches.count == matches.needle_part_count) - { - ev_block_list_concat__in_place(out, &blocks); - } - } - scratch_end(scratch); -} - -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(targets) -{ - Temp scratch = scratch_begin(&arena, 1); - RD_EntityList targets = rd_query_cached_entity_list_with_kind(RD_EntityKind_Target); - EV_ViewRuleList *view_rules_inherited = ev_view_rule_list_from_inheritance(arena, view_rules); - ev_view_rule_list_push_string(arena, view_rules_inherited, str8_lit("target")); - for(RD_EntityNode *n = targets.first; n != 0; n = n->next) - { - RD_Entity *target = n->entity; - String8 target_expr_string = push_str8f(arena, "$%I64u", target->id); - EV_Key target_parent_key = key; - EV_Key target_key = ev_key_make(ev_hash_from_key(target_parent_key), target->id); - EV_BlockList blocks = ev_block_list_from_view_expr_keys(arena, view, str8_zero(), view_rules_inherited, target_expr_string, target_parent_key, target_key, depth); - ev_block_list_concat__in_place(out, &blocks); - } - scratch_end(scratch); -} - -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(breakpoints) -{ - Temp scratch = scratch_begin(&arena, 1); - RD_EntityList bps = rd_query_cached_entity_list_with_kind(RD_EntityKind_Breakpoint); - EV_ViewRuleList *view_rules_inherited = ev_view_rule_list_from_inheritance(arena, view_rules); - for(RD_EntityNode *n = bps.first; n != 0; n = n->next) - { - RD_Entity *bp = n->entity; - String8 bp_expr_string = push_str8f(arena, "$%I64u", bp->id); - EV_Key bp_parent_key = key; - EV_Key bp_key = ev_key_make(ev_hash_from_key(bp_parent_key), bp->id); - EV_BlockList blocks = ev_block_list_from_view_expr_keys(arena, view, str8_zero(), view_rules_inherited, bp_expr_string, bp_parent_key, bp_key, depth); - ev_block_list_concat__in_place(out, &blocks); - } - scratch_end(scratch); -} - -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(watch_pins) -{ - Temp scratch = scratch_begin(&arena, 1); - RD_EntityList wps = rd_query_cached_entity_list_with_kind(RD_EntityKind_WatchPin); - EV_ViewRuleList *view_rules_inherited = ev_view_rule_list_from_inheritance(arena, view_rules); - for(RD_EntityNode *n = wps.first; n != 0; n = n->next) - { - RD_Entity *wp = n->entity; - String8 wp_expr_string = push_str8f(arena, "$%I64u", wp->id); - EV_Key wp_parent_key = key; - EV_Key wp_key = ev_key_make(ev_hash_from_key(wp_parent_key), wp->id); - EV_BlockList blocks = ev_block_list_from_view_expr_keys(arena, view, str8_zero(), view_rules_inherited, wp_expr_string, wp_parent_key, wp_key, depth); - ev_block_list_concat__in_place(out, &blocks); - } - scratch_end(scratch); -} - -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(threads) -{ - Temp scratch = scratch_begin(&arena, 1); - CTRL_EntityList entities = ctrl_entity_list_from_kind(d_state->ctrl_entity_store, CTRL_EntityKind_Thread); - EV_ViewRuleList *view_rules_inherited = ev_view_rule_list_from_inheritance(arena, view_rules); - ev_view_rule_list_push_string(arena, view_rules_inherited, str8_lit("thread")); - for(CTRL_EntityNode *n = entities.first; n != 0; n = n->next) - { - CTRL_Entity *entity = n->v; - String8 entity_expr_string = push_str8f(arena, "$_%I64x_%I64x", entity->handle.machine_id, entity->handle.dmn_handle.u64[0]); - EV_Key entity_parent_key = key; - EV_Key entity_key = ev_key_make(ev_hash_from_key(entity_parent_key), d_hash_from_string(entity_expr_string)); - EV_BlockList blocks = ev_block_list_from_view_expr_keys(arena, view, str8_zero(), view_rules_inherited, entity_expr_string, entity_parent_key, entity_key, depth); - ev_block_list_concat__in_place(out, &blocks); - } - scratch_end(scratch); -} - -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(modules) -{ - Temp scratch = scratch_begin(&arena, 1); - CTRL_EntityList entities = ctrl_entity_list_from_kind(d_state->ctrl_entity_store, CTRL_EntityKind_Module); - EV_ViewRuleList *view_rules_inherited = ev_view_rule_list_from_inheritance(arena, view_rules); - for(CTRL_EntityNode *n = entities.first; n != 0; n = n->next) - { - CTRL_Entity *entity = n->v; - String8 entity_expr_string = push_str8f(arena, "$_%I64x_%I64x", entity->handle.machine_id, entity->handle.dmn_handle.u64[0]); - EV_Key entity_parent_key = key; - EV_Key entity_key = ev_key_make(ev_hash_from_key(entity_parent_key), d_hash_from_string(entity_expr_string)); - EV_BlockList blocks = ev_block_list_from_view_expr_keys(arena, view, str8_zero(), view_rules_inherited, entity_expr_string, entity_parent_key, entity_key, depth); - ev_block_list_concat__in_place(out, &blocks); - } - scratch_end(scratch); -} - -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(locals) -{ - Temp scratch = scratch_begin(&arena, 1); - E_String2NumMapNodeArray nodes = e_string2num_map_node_array_from_map(scratch.arena, e_parse_ctx->locals_map); - e_string2num_map_node_array_sort__in_place(&nodes); - EV_ViewRuleList *view_rules_inherited = ev_view_rule_list_from_inheritance(arena, view_rules); - for(U64 idx = 0; idx < nodes.count; idx += 1) - { - E_String2NumMapNode *n = nodes.v[idx]; - String8 root_expr_string = n->string; - FuzzyMatchRangeList matches = fuzzy_match_find(scratch.arena, filter, root_expr_string); - if(matches.count == matches.needle_part_count) - { - EV_Key local_parent_key = key; - EV_Key local_key = ev_key_make(ev_hash_from_key(local_parent_key), idx+1); - EV_BlockList root_blocks = ev_block_list_from_view_expr_keys(arena, view, str8_zero(), view_rules_inherited, root_expr_string, local_parent_key, local_key, depth); - ev_block_list_concat__in_place(out, &root_blocks); - } - } - scratch_end(scratch); -} - -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(registers) -{ - Temp scratch = scratch_begin(&arena, 1); - CTRL_Entity *thread = ctrl_entity_from_handle(d_state->ctrl_entity_store, rd_regs()->thread); - Arch arch = thread->arch; - U64 reg_count = regs_reg_code_count_from_arch(arch); - String8 *reg_strings = regs_reg_code_string_table_from_arch(arch); - U64 alias_count = regs_alias_code_count_from_arch(arch); - String8 *alias_strings = regs_alias_code_string_table_from_arch(arch); - U64 num = 1; - EV_ViewRuleList *view_rules_inherited = ev_view_rule_list_from_inheritance(arena, view_rules); - ev_view_rule_list_push_string(arena, view_rules_inherited, str8_lit("hex")); - for(U64 reg_idx = 1; reg_idx < reg_count; reg_idx += 1, num += 1) - { - String8 root_expr_string = push_str8f(arena, "reg:%S", reg_strings[reg_idx]); - FuzzyMatchRangeList matches = fuzzy_match_find(scratch.arena, filter, root_expr_string); - if(matches.count == matches.needle_part_count) - { - EV_Key reg_parent_key = key; - EV_Key reg_key = ev_key_make(ev_hash_from_key(reg_parent_key), num); - EV_BlockList root_blocks = ev_block_list_from_view_expr_keys(arena, view, str8_zero(), view_rules_inherited, root_expr_string, reg_parent_key, reg_key, depth); - ev_block_list_concat__in_place(out, &root_blocks); - } - } - for(U64 alias_idx = 1; alias_idx < alias_count; alias_idx += 1, num += 1) - { - String8 root_expr_string = push_str8f(arena, "reg:%S", alias_strings[alias_idx]); - FuzzyMatchRangeList matches = fuzzy_match_find(scratch.arena, filter, root_expr_string); - if(matches.count == matches.needle_part_count) - { - EV_Key reg_parent_key = ev_key_make(5381, 0); - EV_Key reg_key = ev_key_make(ev_hash_from_key(reg_parent_key), num); - EV_BlockList root_blocks = ev_block_list_from_view_expr_keys(arena, view, str8_zero(), view_rules_inherited, root_expr_string, reg_parent_key, reg_key, depth); - ev_block_list_concat__in_place(out, &root_blocks); - } - } - scratch_end(scratch); -} - -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(globals) -{ - rd_ev_view_rule_block_prod_collection_debug_tables(arena, RDI_SectionKind_GlobalVariables, view, filter, parent_key, key, expand_node, string, expr, view_rules, view_params, depth, out); -} - -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(thread_locals) -{ - rd_ev_view_rule_block_prod_collection_debug_tables(arena, RDI_SectionKind_ThreadVariables, view, filter, parent_key, key, expand_node, string, expr, view_rules, view_params, depth, out); -} - -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(types) -{ - rd_ev_view_rule_block_prod_collection_debug_tables(arena, RDI_SectionKind_UDTs, view, filter, parent_key, key, expand_node, string, expr, view_rules, view_params, depth, out); -} - -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(procedures) -{ - rd_ev_view_rule_block_prod_collection_debug_tables(arena, RDI_SectionKind_Procedures, view, filter, parent_key, key, expand_node, string, expr, view_rules, view_params, depth, out); -} -#endif - internal EV_ExpandInfo rd_ev_view_rule_expr_expand_info__meta_entities(Arena *arena, EV_View *view, String8 filter, E_Expr *expr, MD_Node *params, RD_EntityKind kind) { @@ -8569,133 +8376,6 @@ rd_ev_view_rule_expr_num_from_id__debug_info_tables(U64 id, void *user_data, RDI return num; } -#if 0 // TODO(rjf): @blocks -internal void -rd_ev_view_rule_block_prod_collection_debug_tables(Arena *arena, RDI_SectionKind target, EV_View *view, String8 filter, EV_Key parent_key, EV_Key key, EV_ExpandNode *expand_node, String8 string, E_Expr *expr, EV_ViewRuleList *view_rules, MD_Node *view_params, S32 depth, struct EV_BlockList *out) -{ - Temp scratch = scratch_begin(&arena, 1); - if(target != RDI_SectionKind_NULL) - { - U64 endt_us = os_now_microseconds()+200; - - //- rjf: unpack context - DI_KeyList dbgi_keys_list = d_push_active_dbgi_key_list(scratch.arena); - DI_KeyArray dbgi_keys = di_key_array_from_list(scratch.arena, &dbgi_keys_list); - U64 rdis_count = dbgi_keys.count; - RDI_Parsed **rdis = push_array(scratch.arena, RDI_Parsed *, rdis_count); - for(U64 idx = 0; idx < rdis_count; idx += 1) - { - rdis[idx] = di_rdi_from_key(rd_state->frame_di_scope, &dbgi_keys.v[idx], endt_us); - } - - //- rjf: calculate top-level keys, expand root-level, grab root expansion node - EV_ExpandNode *root_node = ev_expand_node_from_key(view, key); - - //- rjf: query all filtered items from dbgi searching system - U128 fuzzy_search_key = {rd_regs()->view.u64[0], d_hash_from_seed_string(ev_hash_from_key(key), string)}; - B32 items_stale = 0; - FZY_Params params = {target, dbgi_keys}; - FZY_ItemArray items = fzy_items_from_key_params_query(rd_state->frame_fzy_scope, fuzzy_search_key, ¶ms, filter, endt_us, &items_stale); - if(items_stale) - { - rd_request_frame(); - } - - //- rjf: gather unsorted child expansion keys - // - // Nodes are sorted in the underlying expansion tree data structure, but - // ONLY by THEIR ORDER IN THE UNDERLYING DEBUG INFO TABLE. This is - // because debug info watch rows use the DEBUG INFO TABLE INDEX to form - // their key - this provides more stable/predictable behavior as rows - // are reordered, filtered, and shuffled around, as the user filters. - // - // When we actually build viz blocks, however, we want to produce viz - // blocks BY THE ORDER OF SUB-EXPANSIONS IN THE FILTERED ITEM ARRAY - // SPACE, so that all of the expansions come out in the right order. - // - EV_Key *sub_expand_keys = 0; - U64 *sub_expand_item_idxs = 0; - U64 sub_expand_keys_count = 0; - { - for(EV_ExpandNode *child = root_node->first; child != 0; child = child->next) - { - sub_expand_keys_count += 1; - } - sub_expand_keys = push_array(scratch.arena, EV_Key, sub_expand_keys_count); - sub_expand_item_idxs = push_array(scratch.arena, U64, sub_expand_keys_count); - U64 idx = 0; - for(EV_ExpandNode *child = root_node->first; child != 0; child = child->next) - { - U64 item_num = fzy_item_num_from_array_element_idx__linear_search(&items, child->key.child_id); - if(item_num != 0) - { - sub_expand_keys[idx] = child->key; - sub_expand_item_idxs[idx] = item_num-1; - idx += 1; - } - else - { - sub_expand_keys_count -= 1; - } - } - } - - //- rjf: sort child expansion keys - { - for(U64 idx1 = 0; idx1 < sub_expand_keys_count; idx1 += 1) - { - U64 min_idx2 = 0; - U64 min_item_idx = sub_expand_item_idxs[idx1]; - for(U64 idx2 = idx1+1; idx2 < sub_expand_keys_count; idx2 += 1) - { - if(sub_expand_item_idxs[idx2] < min_item_idx) - { - min_idx2 = idx2; - min_item_idx = sub_expand_item_idxs[idx2]; - } - } - if(min_idx2 != 0) - { - Swap(EV_Key, sub_expand_keys[idx1], sub_expand_keys[min_idx2]); - Swap(U64, sub_expand_item_idxs[idx1], sub_expand_item_idxs[min_idx2]); - } - } - } - - //- rjf: build blocks for all table items, split by sorted sub-expansions - EV_Block *last_vb = ev_block_begin(arena, EV_BlockKind_DebugInfoTable, key, ev_key_make(ev_hash_from_key(key), 0), depth); - { - last_vb->visual_idx_range = last_vb->semantic_idx_range = r1u64(0, items.count); - last_vb->fzy_target = target; - last_vb->fzy_backing_items = items; - } - for(U64 sub_expand_idx = 0; sub_expand_idx < sub_expand_keys_count; sub_expand_idx += 1) - { - FZY_Item *item = &items.v[sub_expand_item_idxs[sub_expand_idx]]; - E_Expr *child_expr = ev_expr_from_block_index(arena, last_vb, sub_expand_item_idxs[sub_expand_idx]); - - // rjf: form split: truncate & complete last block; begin next block - last_vb = ev_block_split_and_continue(arena, out, last_vb, sub_expand_item_idxs[sub_expand_idx]); - - // rjf: build child view rules - EV_ViewRuleList *child_view_rules = ev_view_rule_list_from_inheritance(arena, view_rules); - { - String8 view_rule_string = ev_view_rule_from_key(view, sub_expand_keys[sub_expand_idx]); - if(view_rule_string.size != 0) - { - ev_view_rule_list_push_string(arena, child_view_rules, view_rule_string); - } - } - - // rjf: recurse for child - ev_append_expr_blocks__rec(arena, view, str8_zero(), key, sub_expand_keys[sub_expand_idx], str8_zero(), child_expr, child_view_rules, depth, out); - } - ev_block_end(out, last_vb); - } - scratch_end(scratch); -} -#endif - internal EV_View * rd_ev_view_from_key(U64 key) { diff --git a/src/raddbg/raddbg_core.h b/src/raddbg/raddbg_core.h index 9ff2a4e0..9fd0a7a8 100644 --- a/src/raddbg/raddbg_core.h +++ b/src/raddbg/raddbg_core.h @@ -1303,10 +1303,6 @@ internal EV_ExpandRangeInfo rd_ev_view_rule_expr_expand_range_info__debug_info_t internal U64 rd_ev_view_rule_expr_id_from_num__debug_info_tables(U64 num, void *user_data, RDI_SectionKind section); internal U64 rd_ev_view_rule_expr_num_from_id__debug_info_tables(U64 id, void *user_data, RDI_SectionKind section); -#if 0 // TODO(rjf): @blocks -internal void rd_ev_view_rule_block_prod_collection_debug_tables(Arena *arena, RDI_SectionKind target, EV_View *view, String8 filter, EV_Key parent_key, EV_Key key, EV_ExpandNode *expand_node, String8 string, E_Expr *expr, EV_ViewRuleList *view_rules, MD_Node *view_params, S32 depth, struct EV_BlockList *out); -#endif - internal EV_View *rd_ev_view_from_key(U64 key); internal F32 rd_append_value_strings_from_eval(Arena *arena, EV_StringFlags flags, U32 default_radix, FNT_Tag font, F32 font_size, F32 max_size, S32 depth, E_Eval eval, E_Member *member, EV_ViewRuleList *view_rules, String8List *out); internal String8 rd_value_string_from_eval(Arena *arena, EV_StringFlags flags, U32 default_radix, FNT_Tag font, F32 font_size, F32 max_size, E_Eval eval, E_Member *member, EV_ViewRuleList *view_rules); diff --git a/src/raddbg/raddbg_views.c b/src/raddbg/raddbg_views.c index 0f2804d5..2f21a315 100644 --- a/src/raddbg/raddbg_views.c +++ b/src/raddbg/raddbg_views.c @@ -793,32 +793,32 @@ rd_watch_view_point_match(RD_WatchViewPoint a, RD_WatchViewPoint b) } internal RD_WatchViewPoint -rd_watch_view_point_from_tbl(EV2_BlockRangeList *block_ranges, Vec2S64 tbl) +rd_watch_view_point_from_tbl(EV_BlockRangeList *block_ranges, Vec2S64 tbl) { RD_WatchViewPoint pt = zero_struct; pt.x = tbl.x; - pt.key = ev2_key_from_num(block_ranges, (U64)tbl.y); - pt.parent_key = ev2_block_range_from_num(block_ranges, (U64)tbl.y).block->key; + pt.key = ev_key_from_num(block_ranges, (U64)tbl.y); + pt.parent_key = ev_block_range_from_num(block_ranges, (U64)tbl.y).block->key; return pt; } internal Vec2S64 -rd_tbl_from_watch_view_point(EV2_BlockRangeList *block_ranges, RD_WatchViewPoint pt) +rd_tbl_from_watch_view_point(EV_BlockRangeList *block_ranges, RD_WatchViewPoint pt) { Vec2S64 tbl = {0}; tbl.x = pt.x; - tbl.y = (S64)ev2_num_from_key(block_ranges, pt.key); + tbl.y = (S64)ev_num_from_key(block_ranges, pt.key); return tbl; } //- rjf: table coordinates -> entities in collectons internal RD_WatchViewCollectionInfo -rd_collection_info_from_num(EV2_BlockRangeList *block_ranges, S64 num) +rd_collection_info_from_num(EV_BlockRangeList *block_ranges, S64 num) { Temp scratch = scratch_begin(0, 0); - EV2_Block *block = ev2_block_range_from_num(block_ranges, num).block; - EV_Key key = ev2_key_from_num(block_ranges, num); + EV_Block *block = ev_block_range_from_num(block_ranges, num).block; + EV_Key key = ev_key_from_num(block_ranges, num); U64 block_relative_num = block->expand_view_rule_info->expr_expand_num_from_id(key.child_id, block->expand_view_rule_info_user_data); RD_EntityKind collection_entity_kind = RD_EntityKind_Nil; E_IRTreeAndType irtree = e_irtree_and_type_from_expr(scratch.arena, block->expr); @@ -846,7 +846,7 @@ rd_collection_info_from_num(EV2_BlockRangeList *block_ranges, S64 num) //- rjf: row/column -> strings internal String8 -rd_string_from_eval_viz_row_column(Arena *arena, EV_View *ev, EV2_Row *row, RD_WatchViewColumn *col, EV_StringFlags string_flags, U32 default_radix, FNT_Tag font, F32 font_size, F32 max_size_px) +rd_string_from_eval_viz_row_column(Arena *arena, EV_View *ev, EV_Row *row, RD_WatchViewColumn *col, EV_StringFlags string_flags, U32 default_radix, FNT_Tag font, F32 font_size, F32 max_size_px) { String8 result = {0}; EV_ViewRuleList *view_rules = row->view_rules; @@ -860,7 +860,7 @@ rd_string_from_eval_viz_row_column(Arena *arena, EV_View *ev, EV2_Row *row, RD_W default:{}break; case RD_WatchViewColumnKind_Expr: { - result = ev2_expr_string_from_row(arena, row, string_flags); + result = ev_expr_string_from_row(arena, row, string_flags); }break; case RD_WatchViewColumnKind_Value: { @@ -1059,8 +1059,8 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo ////////////////////////////// //- rjf: consume events & perform navigations/edits - calculate state // - EV2_BlockTree block_tree = {0}; - EV2_BlockRangeList block_ranges = {0}; + EV_BlockTree block_tree = {0}; + EV_BlockRangeList block_ranges = {0}; UI_ScrollListRowBlockArray row_blocks = {0}; Vec2S64 cursor_tbl = {0}; Vec2S64 mark_tbl = {0}; @@ -1081,8 +1081,8 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo MemoryZeroStruct(&block_tree); MemoryZeroStruct(&block_ranges); ev_key_set_expansion(eval_view, ev_key_root(), ev_key_make(ev_hash_from_key(ev_key_root()), 1), 1); - block_tree = ev2_block_tree_from_string(scratch.arena, eval_view, filter, root_expr, top_level_view_rules); - block_ranges = ev2_block_range_list_from_tree(scratch.arena, &block_tree); + block_tree = ev_block_tree_from_string(scratch.arena, eval_view, filter, root_expr, top_level_view_rules); + block_ranges = ev_block_range_list_from_tree(scratch.arena, &block_tree); } ////////////////////////// @@ -1090,7 +1090,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo // { UI_ScrollListRowBlockChunkList row_block_chunks = {0}; - for(EV2_BlockRangeNode *n = block_ranges.first; n != 0; n = n->next) + for(EV_BlockRangeNode *n = block_ranges.first; n != 0; n = n->next) { UI_ScrollListRowBlock block = {0}; block.row_count = dim_1u64(n->v.range); @@ -1245,9 +1245,9 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo ewv->text_edit_state_slots_count = u64_up_to_pow2(selection_dim.y+1); ewv->text_edit_state_slots_count = Max(ewv->text_edit_state_slots_count, 64); ewv->text_edit_state_slots = push_array(ewv->text_edit_arena, RD_WatchViewTextEditState*, ewv->text_edit_state_slots_count); - EV2_WindowedRowList rows = ev2_windowed_row_list_from_block_range_list(scratch.arena, eval_view, filter, &block_ranges, r1u64(ui_scroll_list_row_from_item(&row_blocks, selection_tbl.min.y), - ui_scroll_list_row_from_item(&row_blocks, selection_tbl.max.y)+1)); - EV2_Row *row = rows.first; + EV_WindowedRowList rows = ev_windowed_row_list_from_block_range_list(scratch.arena, eval_view, filter, &block_ranges, r1u64(ui_scroll_list_row_from_item(&row_blocks, selection_tbl.min.y), + ui_scroll_list_row_from_item(&row_blocks, selection_tbl.max.y)+1)); + EV_Row *row = rows.first; for(S64 y = selection_tbl.min.y; y <= selection_tbl.max.y; y += 1, row = row->next) { for(S64 x = selection_tbl.min.x; x <= selection_tbl.max.x; x += 1) @@ -1276,12 +1276,12 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo // if(!ewv->text_editing && evt->slot == UI_EventActionSlot_Accept) { - EV2_WindowedRowList rows = ev2_windowed_row_list_from_block_range_list(scratch.arena, eval_view, filter, &block_ranges, r1u64(ui_scroll_list_row_from_item(&row_blocks, selection_tbl.min.y), - ui_scroll_list_row_from_item(&row_blocks, selection_tbl.max.y)+1)); - EV2_Row *row = rows.first; + EV_WindowedRowList rows = ev_windowed_row_list_from_block_range_list(scratch.arena, eval_view, filter, &block_ranges, r1u64(ui_scroll_list_row_from_item(&row_blocks, selection_tbl.min.y), + ui_scroll_list_row_from_item(&row_blocks, selection_tbl.max.y)+1)); + EV_Row *row = rows.first; for(S64 y = selection_tbl.min.y; y <= selection_tbl.max.y && row != 0; y += 1, row = row->next) { - if(selection_tbl.min.x <= 0 && ev2_row_is_expandable(row)) + if(selection_tbl.min.x <= 0 && ev_row_is_expandable(row)) { B32 is_expanded = ev_expansion_from_key(eval_view, row->key); ev_key_set_expansion(eval_view, row->block->key, row->key, !is_expanded); @@ -1457,8 +1457,8 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo case RD_WatchViewColumnKind_Value: if(editing_complete && evt->slot != UI_EventActionSlot_Cancel) { - EV2_WindowedRowList rows = ev2_windowed_row_list_from_block_range_list(scratch.arena, eval_view, filter, &block_ranges, r1u64(ui_scroll_list_row_from_item(&row_blocks, y), - ui_scroll_list_row_from_item(&row_blocks, y)+1)); + EV_WindowedRowList rows = ev_windowed_row_list_from_block_range_list(scratch.arena, eval_view, filter, &block_ranges, r1u64(ui_scroll_list_row_from_item(&row_blocks, y), + ui_scroll_list_row_from_item(&row_blocks, y)+1)); B32 success = 0; if(rows.first != 0) { @@ -1537,9 +1537,9 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo { taken = 1; String8List strs = {0}; - EV2_WindowedRowList rows = ev2_windowed_row_list_from_block_range_list(scratch.arena, eval_view, filter, &block_ranges, r1u64(ui_scroll_list_row_from_item(&row_blocks, selection_tbl.min.y), - ui_scroll_list_row_from_item(&row_blocks, selection_tbl.max.y)+1)); - EV2_Row *row = rows.first; + EV_WindowedRowList rows = ev_windowed_row_list_from_block_range_list(scratch.arena, eval_view, filter, &block_ranges, r1u64(ui_scroll_list_row_from_item(&row_blocks, selection_tbl.min.y), + ui_scroll_list_row_from_item(&row_blocks, selection_tbl.max.y)+1)); + EV_Row *row = rows.first; for(S64 y = selection_tbl.min.y; y <= selection_tbl.max.y && row != 0; y += 1, row = row->next) { for(S64 x = selection_tbl.min.x; x <= selection_tbl.max.x; x += 1) @@ -1788,35 +1788,35 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo if(filter.size == 0) { // rjf: determine blocks of each endpoint of the table selection - EV2_Block *selection_endpoint_blocks[2] = + EV_Block *selection_endpoint_blocks[2] = { - ev2_block_range_from_num(&block_ranges, selection_tbl.min.y).block, - ev2_block_range_from_num(&block_ranges, selection_tbl.max.y).block, + ev_block_range_from_num(&block_ranges, selection_tbl.min.y).block, + ev_block_range_from_num(&block_ranges, selection_tbl.max.y).block, }; // rjf: pick shallowest block within which we can do reordering U64 selection_depths[2] = { - ev2_depth_from_block(selection_endpoint_blocks[0]), - ev2_depth_from_block(selection_endpoint_blocks[1]), + ev_depth_from_block(selection_endpoint_blocks[0]), + ev_depth_from_block(selection_endpoint_blocks[1]), }; - EV2_Block *selection_block = (selection_depths[1] < selection_depths[0] - ? selection_endpoint_blocks[1] - : selection_endpoint_blocks[0]); + EV_Block *selection_block = (selection_depths[1] < selection_depths[0] + ? selection_endpoint_blocks[1] + : selection_endpoint_blocks[0]); // rjf: find selection keys within the block in which we are doing reordering EV_Key selection_keys_in_block[2] = {0}; { for EachElement(idx, selection_endpoint_blocks) { - EV2_Block *endpoint_block = selection_endpoint_blocks[idx]; + EV_Block *endpoint_block = selection_endpoint_blocks[idx]; if(endpoint_block == selection_block) { - selection_keys_in_block[idx] = ev2_key_from_num(&block_ranges, selection_tbl.v[idx].y); + selection_keys_in_block[idx] = ev_key_from_num(&block_ranges, selection_tbl.v[idx].y); } else { - for(;endpoint_block->parent != selection_block && endpoint_block != &ev2_nil_block;) + for(;endpoint_block->parent != selection_block && endpoint_block != &ev_nil_block;) { endpoint_block = endpoint_block->parent; } @@ -1981,9 +1981,9 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo //////////////////////////// //- rjf: viz blocks -> rows // - EV2_WindowedRowList rows = {0}; + EV_WindowedRowList rows = {0}; { - rows = ev2_windowed_row_list_from_block_range_list(scratch.arena, eval_view, filter, &block_ranges, r1u64(visible_row_rng.min, visible_row_rng.max+1)); + rows = ev_windowed_row_list_from_block_range_list(scratch.arena, eval_view, filter, &block_ranges, r1u64(visible_row_rng.min, visible_row_rng.max+1)); } //////////////////////////// @@ -1992,13 +1992,13 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo ProfScope("build table") { U64 global_row_idx = rows.count_before_semantic; - for(EV2_Row *row = rows.first; row != 0; row = row->next, global_row_idx += 1) + for(EV_Row *row = rows.first; row != 0; row = row->next, global_row_idx += 1) { //////////////////////// //- rjf: unpack row info // U64 row_hash = ev_hash_from_key(row->key); - U64 row_depth = ev2_depth_from_block(row->block); + U64 row_depth = ev_depth_from_block(row->block); if(row_depth > 0) { row_depth -= 1; @@ -2007,8 +2007,8 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo B32 row_expanded = ev_expansion_from_key(eval_view, row->key); E_Eval row_eval = e_eval_from_expr(scratch.arena, row->expr); E_Type *row_type = e_type_from_key(scratch.arena, row_eval.type_key); - B32 row_is_expandable = ev2_row_is_expandable(row); - B32 row_is_editable = ev2_row_is_editable(row); + B32 row_is_expandable = ev_row_is_expandable(row); + B32 row_is_editable = ev_row_is_editable(row); B32 next_row_expanded = row_expanded; RD_ViewRuleInfo *ui_view_rule_info = rd_view_rule_info_from_string(row->block->expand_view_rule_info->string); MD_Node *ui_view_rule_params_root = row->block->expand_view_rule_params; @@ -2361,7 +2361,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo cell_can_edit = (row_depth == 0 && modifiable && filter.size == 0); if(filter.size != 0) { - cell_matches = fuzzy_match_find(scratch.arena, filter, ev2_expr_string_from_row(scratch.arena, row, string_flags)); + cell_matches = fuzzy_match_find(scratch.arena, filter, ev_expr_string_from_row(scratch.arena, row, string_flags)); } cell_autocomp_flags = (RD_AutoCompListerFlag_Locals| RD_AutoCompListerFlag_Procedures| @@ -2659,7 +2659,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo if(DEV_eval_compiler_tooltips && x == 0 && ui_hovering(sig)) UI_Tooltip RD_Font(RD_FontSlot_Code) { local_persist char *spaces = " "; - String8 string = ev2_expr_string_from_row(scratch.arena, row, 0); + String8 string = ev_expr_string_from_row(scratch.arena, row, 0); E_TokenArray tokens = e_token_array_from_text(scratch.arena, string); E_Parse parse = e_parse_expr_from_text_tokens(scratch.arena, string, &tokens); E_IRTreeAndType irtree = e_irtree_and_type_from_expr(scratch.arena, parse.expr); @@ -5534,19 +5534,6 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(pending_file) //////////////////////////////// //~ rjf: text @view_hook_impl -#if 0 // TODO(rjf): @blocks -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(text) -{ - EV_Block *vb = ev_block_begin(arena, EV_BlockKind_Canvas, key, ev_key_make(ev_hash_from_key(key), 1), depth); - vb->string = string; - vb->expr = expr; - vb->visual_idx_range = r1u64(0, 8); - vb->semantic_idx_range = r1u64(0, 1); - vb->view_rules = view_rules; - ev_block_end(out, vb); -} -#endif - EV_VIEW_RULE_EXPR_EXPAND_INFO_FUNCTION_DEF(text) { EV_ExpandInfo info = {0}; @@ -5784,19 +5771,6 @@ struct RD_DisasmViewState RD_CodeViewState cv; }; -#if 0 // TODO(rjf): @blocks -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(disasm) -{ - EV_Block *vb = ev_block_begin(arena, EV_BlockKind_Canvas, key, ev_key_make(ev_hash_from_key(key), 1), depth); - vb->string = string; - vb->expr = expr; - vb->visual_idx_range = r1u64(0, 8); - vb->semantic_idx_range = r1u64(0, 1); - vb->view_rules = view_rules; - ev_block_end(out, vb); -} -#endif - EV_VIEW_RULE_EXPR_EXPAND_INFO_FUNCTION_DEF(disasm) { EV_ExpandInfo info = {0}; @@ -6082,19 +6056,6 @@ struct RD_MemoryViewState B32 contain_cursor; }; -#if 0 // TODO(rjf): @blocks -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(memory) -{ - EV_Block *vb = ev_block_begin(arena, EV_BlockKind_Canvas, key, ev_key_make(ev_hash_from_key(key), 1), depth); - vb->string = string; - vb->expr = expr; - vb->visual_idx_range = r1u64(0, 16); - vb->semantic_idx_range = r1u64(0, 1); - vb->view_rules = view_rules; - ev_block_end(out, vb); -} -#endif - EV_VIEW_RULE_EXPR_EXPAND_INFO_FUNCTION_DEF(memory) { EV_ExpandInfo info = {0}; @@ -6895,19 +6856,6 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(memory) //////////////////////////////// //~ rjf: "graph" -#if 0 // TODO(rjf): @blocks -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(graph) -{ - EV_Block *vb = ev_block_begin(arena, EV_BlockKind_Canvas, key, ev_key_make(ev_hash_from_key(key), 1), depth); - vb->string = string; - vb->expr = expr; - vb->visual_idx_range = r1u64(0, 8); - vb->semantic_idx_range = r1u64(0, 1); - vb->view_rules = view_rules; - ev_block_end(out, vb); -} -#endif - EV_VIEW_RULE_EXPR_EXPAND_INFO_FUNCTION_DEF(graph) { EV_ExpandInfo info = {0}; @@ -7000,19 +6948,6 @@ internal UI_BOX_CUSTOM_DRAW(rd_bitmap_view_canvas_box_draw) } } -#if 0 // TODO(rjf): @blocks -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(bitmap) -{ - EV_Block *vb = ev_block_begin(arena, EV_BlockKind_Canvas, key, ev_key_make(ev_hash_from_key(key), 1), depth); - vb->string = string; - vb->expr = expr; - vb->visual_idx_range = r1u64(0, 8); - vb->semantic_idx_range = r1u64(0, 1); - vb->view_rules = view_rules; - ev_block_end(out, vb); -} -#endif - EV_VIEW_RULE_EXPR_EXPAND_INFO_FUNCTION_DEF(bitmap) { EV_ExpandInfo info = {0}; @@ -7261,19 +7196,6 @@ rd_rgba_from_eval_params(E_Eval eval, MD_Node *params) return rgba; } -#if 0 // TODO(rjf): @blocks -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(color_rgba) -{ - EV_Block *vb = ev_block_begin(arena, EV_BlockKind_Canvas, key, ev_key_make(ev_hash_from_key(key), 1), depth); - vb->string = string; - vb->expr = expr; - vb->visual_idx_range = r1u64(0, 8); - vb->semantic_idx_range = r1u64(0, 1); - vb->view_rules = view_rules; - ev_block_end(out, vb); -} -#endif - EV_VIEW_RULE_EXPR_EXPAND_INFO_FUNCTION_DEF(color_rgba) { EV_ExpandInfo info = {0}; @@ -7435,19 +7357,6 @@ internal UI_BOX_CUSTOM_DRAW(rd_geo3d_box_draw) dr_mesh(draw_data->vertex_buffer, draw_data->index_buffer, R_GeoTopologyKind_Triangles, R_GeoVertexFlag_TexCoord|R_GeoVertexFlag_Normals|R_GeoVertexFlag_RGB, r_handle_zero(), mat_4x4f32(1.f)); } -#if 0 // TODO(rjf): @blocks -EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(geo3d) -{ - EV_Block *vb = ev_block_begin(arena, EV_BlockKind_Canvas, key, ev_key_make(ev_hash_from_key(key), 1), depth); - vb->string = string; - vb->expr = expr; - vb->visual_idx_range = r1u64(0, 16); - vb->semantic_idx_range = r1u64(0, 1); - vb->view_rules = view_rules; - ev_block_end(out, vb); -} -#endif - EV_VIEW_RULE_EXPR_EXPAND_INFO_FUNCTION_DEF(geo3d) { EV_ExpandInfo info = {0}; diff --git a/src/raddbg/raddbg_views.h b/src/raddbg/raddbg_views.h index 337c570e..1692eef4 100644 --- a/src/raddbg/raddbg_views.h +++ b/src/raddbg/raddbg_views.h @@ -104,7 +104,7 @@ struct RD_WatchViewPoint typedef struct RD_WatchViewCollectionInfo RD_WatchViewCollectionInfo; struct RD_WatchViewCollectionInfo { - EV2_Block *block; + EV_Block *block; EV_Key key; RD_EntityKind kind; RD_Entity *entity; @@ -163,14 +163,14 @@ internal RD_WatchViewColumn *rd_watch_view_column_from_x(RD_WatchViewState *wv, //- rjf: watch view points <-> table coordinates internal B32 rd_watch_view_point_match(RD_WatchViewPoint a, RD_WatchViewPoint b); -internal RD_WatchViewPoint rd_watch_view_point_from_tbl(EV2_BlockRangeList *block_ranges, Vec2S64 tbl); -internal Vec2S64 rd_tbl_from_watch_view_point(EV2_BlockRangeList *block_ranges, RD_WatchViewPoint pt); +internal RD_WatchViewPoint rd_watch_view_point_from_tbl(EV_BlockRangeList *block_ranges, Vec2S64 tbl); +internal Vec2S64 rd_tbl_from_watch_view_point(EV_BlockRangeList *block_ranges, RD_WatchViewPoint pt); //- rjf: table coordinates -> entities in collectons -internal RD_WatchViewCollectionInfo rd_collection_info_from_num(EV2_BlockRangeList *block_ranges, S64 num); +internal RD_WatchViewCollectionInfo rd_collection_info_from_num(EV_BlockRangeList *block_ranges, S64 num); //- rjf: row/column -> strings -internal String8 rd_string_from_eval_viz_row_column(Arena *arena, EV_View *ev, EV2_Row *row, RD_WatchViewColumn *col, EV_StringFlags string_flags, U32 default_radix, FNT_Tag font, F32 font_size, F32 max_size_px); +internal String8 rd_string_from_eval_viz_row_column(Arena *arena, EV_View *ev, EV_Row *row, RD_WatchViewColumn *col, EV_StringFlags string_flags, U32 default_radix, FNT_Tag font, F32 font_size, F32 max_size_px); //- rjf: table coordinates -> text edit state internal RD_WatchViewTextEditState *rd_watch_view_text_edit_state_from_pt(RD_WatchViewState *wv, RD_WatchViewPoint pt);