mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-03 12:38:11 +00:00
eval: lookup rule map building; eval: use general 'set' type-kind to specify custom lookup rule; watch: new table <-> stable-point mappings
This commit is contained in:
@@ -13086,6 +13086,8 @@ rd_frame(void)
|
||||
E_IRCtx *ctx = ir_ctx;
|
||||
ctx->macro_map = push_array(scratch.arena, E_String2ExprMap, 1);
|
||||
ctx->macro_map[0] = e_string2expr_map_make(scratch.arena, 512);
|
||||
ctx->lookup_rule_map = push_array(scratch.arena, E_LookupRuleMap, 1);
|
||||
ctx->lookup_rule_map[0] = e_lookup_rule_map_make(scratch.arena, 512);
|
||||
|
||||
//- rjf: add macros for collections
|
||||
{
|
||||
@@ -13228,6 +13230,7 @@ rd_frame(void)
|
||||
e_string2expr_map_insert(scratch.arena, ctx->macro_map, push_str8f(scratch.arena, "$%I64x%I64x", (U64)cfg, cfg->gen), expr);
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: add macros for all evallable control entities
|
||||
{
|
||||
CTRL_EntityKind evallable_kinds[] =
|
||||
@@ -13282,12 +13285,7 @@ rd_frame(void)
|
||||
{
|
||||
String8 cfg_name = evallable_cfg_names[cfg_name_idx];
|
||||
String8 collection_name = rd_plural_from_code_name(cfg_name);
|
||||
E_TypeKey collection_type_key = {0};
|
||||
{
|
||||
E_TypeKey element_type_key = evallable_cfg_types[cfg_name_idx];
|
||||
RD_CfgList cfgs = rd_cfg_top_level_list_from_string(scratch.arena, cfg_name);
|
||||
collection_type_key = e_type_key_cons_array(e_type_key_cons_space_ptr(element_type_key), cfgs.count);
|
||||
}
|
||||
E_TypeKey collection_type_key = e_type_key_cons(.kind = E_TypeKind_Set, .name = collection_name);
|
||||
E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafOffset, 0);
|
||||
E_Space space = e_space_make(RD_EvalSpaceKind_MetaCollection);
|
||||
space.u64s[0] = cfg_name_idx;
|
||||
@@ -13295,6 +13293,7 @@ rd_frame(void)
|
||||
expr->mode = E_Mode_Offset;
|
||||
expr->type_key = collection_type_key;
|
||||
e_string2expr_map_insert(scratch.arena, ctx->macro_map, collection_name, expr);
|
||||
// TODO(rjf): e_lookup_rule_map_insert_new(scratch.arena, ctx->lookup_rule_map, collection_name, );
|
||||
}
|
||||
|
||||
//- rjf: add macro for output log
|
||||
|
||||
@@ -796,6 +796,15 @@ rd_code_view_build(Arena *arena, RD_CodeViewState *cv, RD_CodeViewBuildFlags fla
|
||||
|
||||
//- rjf: cell list building
|
||||
|
||||
internal U64
|
||||
rd_id_from_watch_cell(RD_WatchCell *cell)
|
||||
{
|
||||
U64 result = 5381;
|
||||
result = e_hash_from_string(result, str8_struct(&cell->kind));
|
||||
result = e_hash_from_string(result, cell->member);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal RD_WatchCell *
|
||||
rd_watch_cell_list_push(Arena *arena, RD_WatchCellList *list)
|
||||
{
|
||||
@@ -846,9 +855,25 @@ internal RD_WatchPt
|
||||
rd_watch_pt_from_tbl(EV_BlockRangeList *block_ranges, Vec2S64 tbl)
|
||||
{
|
||||
RD_WatchPt pt = zero_struct;
|
||||
pt.cell_id = (U64)tbl.x;
|
||||
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;
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
EV_Row *row = ev_row_from_num(scratch.arena, rd_view_eval_view(), rd_view_filter(), block_ranges, (U64)tbl.y);
|
||||
RD_WatchRowInfo row_info = rd_watch_row_info_from_row(scratch.arena, row);
|
||||
{
|
||||
S64 x = 0;
|
||||
for(RD_WatchCell *cell = row_info.cells.first; cell != 0; cell = cell->next, x += 1)
|
||||
{
|
||||
if(x == tbl.x)
|
||||
{
|
||||
pt.cell_id = rd_id_from_watch_cell(cell);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
pt.key = row->key;
|
||||
pt.parent_key = row->block->key;
|
||||
scratch_end(scratch);
|
||||
}
|
||||
return pt;
|
||||
}
|
||||
|
||||
@@ -856,8 +881,27 @@ internal Vec2S64
|
||||
rd_tbl_from_watch_pt(EV_BlockRangeList *block_ranges, RD_WatchPt pt)
|
||||
{
|
||||
Vec2S64 tbl = {0};
|
||||
tbl.x = (S64)pt.cell_id;
|
||||
tbl.y = (S64)ev_num_from_key(block_ranges, pt.key);
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
U64 num = ev_num_from_key(block_ranges, pt.key);
|
||||
EV_Row *row = ev_row_from_num(scratch.arena, rd_view_eval_view(), rd_view_filter(), block_ranges, num);
|
||||
RD_WatchRowInfo row_info = rd_watch_row_info_from_row(scratch.arena, row);
|
||||
tbl.x = 0;
|
||||
{
|
||||
S64 x = 0;
|
||||
for(RD_WatchCell *cell = row_info.cells.first; cell != 0; cell = cell->next, x += 1)
|
||||
{
|
||||
U64 cell_id = rd_id_from_watch_cell(cell);
|
||||
if(cell_id == pt.cell_id)
|
||||
{
|
||||
tbl.x = x;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
tbl.y = (S64)num;
|
||||
scratch_end(scratch);
|
||||
}
|
||||
return tbl;
|
||||
}
|
||||
|
||||
|
||||
@@ -223,6 +223,7 @@ internal RD_CodeViewBuildResult rd_code_view_build(Arena *arena, RD_CodeViewStat
|
||||
//~ rjf: Watch View Functions
|
||||
|
||||
//- rjf: cell list building
|
||||
internal U64 rd_id_from_watch_cell(RD_WatchCell *cell);
|
||||
internal RD_WatchCell *rd_watch_cell_list_push(Arena *arena, RD_WatchCellList *list);
|
||||
internal RD_WatchCell *rd_watch_cell_list_push_new_(Arena *arena, RD_WatchCellList *list, RD_WatchCell *params);
|
||||
#define rd_watch_cell_list_push_new(arena, list, kind_, ...) rd_watch_cell_list_push_new_((arena), (list), &(RD_WatchCell){.kind = (kind_), __VA_ARGS__})
|
||||
|
||||
Reference in New Issue
Block a user