eliminate member-filtering hack for cfg views; eliminate deref-space-ptr hack

This commit is contained in:
Ryan Fleury
2025-01-30 15:52:26 -08:00
parent 68966ba55f
commit 5b82fc2339
6 changed files with 5 additions and 111 deletions
+1 -38
View File
@@ -2846,38 +2846,6 @@ rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range)
}
}
}break;
//- rjf: meta collections
case RD_EvalSpaceKind_MetaCollection:
{
typedef struct SpacePtr SpacePtr;
struct SpacePtr
{
E_Space space;
U64 off;
};
RD_CfgArray cfgs_array = {0};
if(space.u64s[0] < rd_state->eval_collection_cfg_names->count)
{
cfgs_array = rd_state->eval_collection_cfgs[space.u64s[0]];
}
U64 space_ptr_size = sizeof(SpacePtr);
Rng1U64 idx_range = r1u64(range.min/space_ptr_size, range.max/space_ptr_size);
U64 out_off = 0;
U64 out_opl = dim_1u64(range);
for(U64 src_idx = idx_range.min; src_idx < idx_range.max && out_off+space_ptr_size <= out_opl; src_idx += 1)
{
RD_Cfg *cfg = &rd_nil_cfg;
if(src_idx < cfgs_array.count)
{
cfg = cfgs_array.v[src_idx];
}
SpacePtr space_ptr = {rd_eval_space_from_cfg(cfg), 0};
MemoryCopy((U8 *)out + out_off, &space_ptr, space_ptr_size);
out_off += sizeof(space_ptr);
}
result = 1;
}break;
}
scratch_end(scratch);
return result;
@@ -13197,7 +13165,6 @@ rd_frame(void)
for EachElement(idx, rd_collection_name_table)
{
E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafOffset, 0);
expr->space = e_space_make(RD_EvalSpaceKind_MetaCollection);
expr->mode = E_Mode_Null;
expr->type_key = collection_type_keys[idx];
e_string2expr_map_insert(scratch.arena, ctx->macro_map, rd_collection_name_table[idx], expr);
@@ -13393,17 +13360,13 @@ rd_frame(void)
e_lookup_rule_map_insert_new(scratch.arena, ctx->lookup_rule_map, collection_name, E_LOOKUP_INFO_FUNCTION_NAME(watch_group), E_LOOKUP_FUNCTION_NAME(watch_group));
}
//- rjf: add macros for collections (new @cfg)
//- rjf: add macros for all cfg collections (new @cfg)
for EachElement(cfg_name_idx, evallable_cfg_names)
{
String8 cfg_name = evallable_cfg_names[cfg_name_idx];
String8 collection_name = rd_plural_from_code_name(cfg_name);
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;
expr->space = space;
expr->mode = E_Mode_Offset;
expr->type_key = collection_type_key;
e_string2expr_map_insert(scratch.arena, ctx->macro_map, collection_name, expr);
e_lookup_rule_map_insert_new(scratch.arena, ctx->lookup_rule_map, collection_name, E_LOOKUP_INFO_FUNCTION_NAME(top_level_cfg), E_LOOKUP_FUNCTION_NAME(top_level_cfg));
-1
View File
@@ -97,7 +97,6 @@ enum
RD_EvalSpaceKind_MetaCfg,
RD_EvalSpaceKind_MetaEntity,
RD_EvalSpaceKind_MetaCtrlEntity,
RD_EvalSpaceKind_MetaCollection,
};
////////////////////////////////
+4 -4
View File
@@ -4142,7 +4142,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(file_path_map)
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Expr, 0.25f);
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Value, 0.75f, .dequote_string = 1, .is_non_code = 0);
}
rd_watch_view_build(wv, str8_lit("collection:file_path_maps"), str8_lit("only: source_path destination_path str"), 1, 10, rect);
rd_watch_view_build(wv, str8_lit("collection:file_path_maps"), str8_zero(), 1, 10, rect);
ProfEnd();
}
@@ -4159,7 +4159,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(auto_view_rules)
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Expr, 0.25f);
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Value, 0.75f, .dequote_string = 1, .is_non_code = 0);
}
rd_watch_view_build(wv, str8_lit("collection:auto_view_rules"), str8_lit("only: type view_rule str"), 1, 10, rect);
rd_watch_view_build(wv, str8_lit("collection:auto_view_rules"), str8_zero(), 1, 10, rect);
ProfEnd();
}
@@ -4176,7 +4176,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(breakpoints)
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Expr, 0.25f);
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Value, 0.75f, .dequote_string = 1);
}
rd_watch_view_build(wv, str8_lit("collection:breakpoints"), str8_lit("only: label condition str hit_count source_location address_location function_location"), 0, 10, rect);
rd_watch_view_build(wv, str8_lit("collection:breakpoints"), str8_zero(), 0, 10, rect);
ProfEnd();
}
@@ -4193,7 +4193,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(watch_pins)
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Expr, 0.25f);
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Value, 0.75f, .dequote_string = 1);
}
rd_watch_view_build(wv, str8_lit("collection:watch_pins"), str8_lit("only: label source_location address_location str"), 0, 10, rect);
rd_watch_view_build(wv, str8_lit("collection:watch_pins"), str8_zero(), 0, 10, rect);
ProfEnd();
}