mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-15 00:22:23 -07:00
eval: more progress on 'sets', plug primary watch group into it; rd: more progress on watch ui based on new sets/lookups
This commit is contained in:
@@ -104,7 +104,8 @@ struct EV_DefaultExpandAccel
|
||||
{
|
||||
E_MemberArray members;
|
||||
E_EnumValArray enum_vals;
|
||||
void *lookup_accel;
|
||||
E_LookupRule *lookup_rule;
|
||||
void *lookup_user_data;
|
||||
U64 array_count;
|
||||
B32 array_need_extra_deref;
|
||||
B32 is_ptr2ptr;
|
||||
@@ -181,7 +182,11 @@ EV_VIEW_RULE_EXPR_EXPAND_INFO_FUNCTION_DEF(default)
|
||||
else if(type_kind == E_TypeKind_Set)
|
||||
{
|
||||
E_Type *type = e_type_from_key(scratch.arena, type_key);
|
||||
//E_LookupRule *rule = e_lookup_rule_from_string(type->name);
|
||||
E_LookupRule *rule = e_lookup_rule_from_string(type->name);
|
||||
E_LookupInfo lookup_info = rule->lookup_info(arena, expr);
|
||||
total_row_count = Max(lookup_info.named_expr_count, lookup_info.idxed_expr_count);
|
||||
accel->lookup_rule = rule;
|
||||
accel->lookup_user_data = lookup_info.user_data;
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
@@ -273,6 +278,23 @@ EV_VIEW_RULE_EXPR_EXPAND_RANGE_INFO_FUNCTION_DEF(default)
|
||||
result.row_members[0] = &e_member_nil;
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: fill with lookups
|
||||
//
|
||||
else if(accel->lookup_rule != 0)
|
||||
{
|
||||
result.row_exprs_count = needed_row_count;
|
||||
result.row_exprs = push_array(arena, E_Expr *, result.row_exprs_count);
|
||||
result.row_strings = push_array(arena, String8, result.row_exprs_count);
|
||||
result.row_view_rules = push_array(arena, String8, result.row_exprs_count);
|
||||
result.row_members = push_array(arena, E_Member *, result.row_exprs_count);
|
||||
for EachIndex(row_expr_idx, result.row_exprs_count)
|
||||
{
|
||||
result.row_exprs[row_expr_idx] = e_expr_ref_array_index(arena, expr, idx_range.min + row_expr_idx);
|
||||
result.row_members[row_expr_idx] = &e_member_nil;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ RD_VocabularyInfo rd_vocabulary_info_table[41] =
|
||||
{str8_lit_comp("label"), str8_lit_comp("labels"), str8_lit_comp("Label"), str8_lit_comp("Labels"), RD_IconKind_Null},
|
||||
};
|
||||
|
||||
RD_CfgNameSchemaPair rd_cfg_name_schema_pair_table[7] =
|
||||
RD_CfgNameSchemaPair rd_cfg_name_schema_pair_table[6] =
|
||||
{
|
||||
{str8_lit_comp("settings"), str8_lit_comp("x:\n{\n @default(1) 'hover_animations': bool,\n @default(1) 'press_animations': bool,\n @default(0) 'focus_animations': bool,\n @default(1) 'tooltip_animations': bool,\n @default(1) 'menu_animations': bool,\n @default(1) 'scrolling_animations': bool,\n @default(1) 'background_blur': bool,\n @default(1) 'thread_lines': bool,\n @default(1) 'breakpoint_lines': bool,\n @default(1) 'thread_glow': bool,\n @default(1) 'breakpoint_glow': bool,\n @default(0) 'opaque_backgrounds': bool,\n @default(1) 'smooth_main_text': bool,\n @default(0) 'smooth_code_text': bool,\n @default(1) 'hint_main_text': bool,\n @default(1) 'hint_code_text': bool,\n @default(2) 'tab_width': @range[1, 32] u64,\n @can_be_per_window 'main_font_size': @range[6, 72] u64,\n @can_be_per_window 'code_font_size': @range[1, 32] u64,\n}\n"), str8_lit_comp("")},
|
||||
{str8_lit_comp("target"), str8_lit_comp("x:\n{\n 'label': code_string,\n 'executable': path,\n 'arguments': string,\n 'working_directory': path,\n 'entry_point': code_string,\n 'stdout_path': path,\n 'stderr_path': path,\n 'stdin_path': path,\n 'debug_subprocesses': bool,\n}\n"), str8_lit_comp("launch_and_run,launch_and_init,select_cfg,remove_cfg")},
|
||||
@@ -81,7 +81,6 @@ RD_CfgNameSchemaPair rd_cfg_name_schema_pair_table[7] =
|
||||
{str8_lit_comp("watch_pin"), str8_lit_comp("x:\n{\n 'expression': code_string,\n 'view_rule': code_string,\n 'location': location,\n}\n"), str8_lit_comp("remove_cfg")},
|
||||
{str8_lit_comp("file_path_map"), str8_lit_comp("x:{'source':path, 'dest':path}"), str8_lit_comp("remove_cfg")},
|
||||
{str8_lit_comp("auto_view_rule"), str8_lit_comp("x:{'source':code_string, 'dest':code_string}"), str8_lit_comp("remove_cfg")},
|
||||
{str8_lit_comp("watch"), str8_lit_comp("x:\n{\n 'expression': code_string,\n 'view_rule': code_string,\n}\n"), str8_lit_comp("remove_cfg")},
|
||||
};
|
||||
|
||||
String8 d_entity_kind_display_string_table[27] =
|
||||
@@ -500,7 +499,7 @@ RD_CmdKindInfo rd_cmd_kind_info_table[213] =
|
||||
{ str8_lit_comp("log_marker"), str8_lit_comp("Logs a marker in the application log, to denote specific points in time within the log."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Log Marker"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil, CTRL_EntityKind_Null}},
|
||||
};
|
||||
|
||||
RD_StringBindingPair rd_default_binding_table[110] =
|
||||
RD_StringBindingPair rd_default_binding_table[111] =
|
||||
{
|
||||
{str8_lit_comp("kill_all"), {OS_Key_F5, 0 |OS_Modifier_Shift }},
|
||||
{str8_lit_comp("step_into_inst"), {OS_Key_F11, 0 |OS_Modifier_Alt}},
|
||||
@@ -612,6 +611,7 @@ RD_StringBindingPair rd_default_binding_table[110] =
|
||||
{str8_lit_comp("filter"), {OS_Key_Slash, 0 |OS_Modifier_Ctrl }},
|
||||
{str8_lit_comp("open_lister"), {OS_Key_F1, 0 }},
|
||||
{str8_lit_comp("log_marker"), {OS_Key_M, 0 |OS_Modifier_Ctrl |OS_Modifier_Shift |OS_Modifier_Alt}},
|
||||
{str8_lit_comp("toggle_dev_menu"), {OS_Key_D, 0 |OS_Modifier_Ctrl |OS_Modifier_Shift |OS_Modifier_Alt}},
|
||||
};
|
||||
|
||||
String8 rd_binding_version_remap_old_name_table[8] =
|
||||
|
||||
@@ -734,14 +734,14 @@ extern String8 rd_cfg_src_string_table[4];
|
||||
extern RD_CmdKind rd_cfg_src_load_cmd_kind_table[4];
|
||||
extern RD_CmdKind rd_cfg_src_write_cmd_kind_table[4];
|
||||
extern RD_VocabularyInfo rd_vocabulary_info_table[41];
|
||||
extern RD_CfgNameSchemaPair rd_cfg_name_schema_pair_table[7];
|
||||
extern RD_CfgNameSchemaPair rd_cfg_name_schema_pair_table[6];
|
||||
extern String8 d_entity_kind_display_string_table[27];
|
||||
extern String8 d_entity_kind_name_lower_table[27];
|
||||
extern String8 d_entity_kind_name_lower_plural_table[27];
|
||||
extern String8 d_entity_kind_name_label_table[27];
|
||||
extern RD_EntityKindFlags rd_entity_kind_flags_table[27];
|
||||
extern Rng1U64 rd_reg_slot_range_table[40];
|
||||
extern RD_StringBindingPair rd_default_binding_table[110];
|
||||
extern RD_StringBindingPair rd_default_binding_table[111];
|
||||
extern String8 rd_binding_version_remap_old_name_table[8];
|
||||
extern String8 rd_binding_version_remap_new_name_table[8];
|
||||
extern String8 rd_icon_kind_text_table[69];
|
||||
|
||||
+1
-13
@@ -201,19 +201,6 @@ RD_VocabularyMap:
|
||||
```x:{'source':code_string, 'dest':code_string}```,
|
||||
`remove_cfg`,
|
||||
}
|
||||
|
||||
//- rjf: watches
|
||||
{
|
||||
watch,
|
||||
```x:
|
||||
{
|
||||
'expression': code_string,
|
||||
'view_rule': code_string,
|
||||
}
|
||||
```,
|
||||
`remove_cfg`,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@struct RD_CfgNameSchemaPair:
|
||||
@@ -877,6 +864,7 @@ RD_DefaultBindingTable:
|
||||
|
||||
//- rjf: developer commands
|
||||
{ "log_marker" M ctrl shift alt }
|
||||
{ "toggle_dev_menu" D ctrl shift alt }
|
||||
}
|
||||
|
||||
@data(RD_StringBindingPair) rd_default_binding_table:
|
||||
|
||||
+79
-17
@@ -9161,6 +9161,45 @@ 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); }
|
||||
|
||||
E_LOOKUP_INFO_FUNCTION_DEF(watch_group)
|
||||
{
|
||||
E_LookupInfo result = {0};
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
{
|
||||
RD_CfgList cfgs_list = rd_cfg_top_level_list_from_string(scratch.arena, str8_lit("watch"));
|
||||
RD_CfgArray *cfgs = push_array(arena, RD_CfgArray, 1);
|
||||
cfgs[0] = rd_cfg_array_from_list(arena, &cfgs_list);
|
||||
result.user_data = cfgs;
|
||||
result.idxed_expr_count = cfgs_list.count;
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
|
||||
E_LOOKUP_FUNCTION_DEF(watch_group)
|
||||
{
|
||||
E_Lookup result = {{&e_irnode_nil}};
|
||||
if(kind == E_ExprKind_ArrayIndex)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
RD_CfgArray *cfgs = (RD_CfgArray *)user_data;
|
||||
E_IRTreeAndType rhs_irtree = e_irtree_and_type_from_expr(scratch.arena, rhs);
|
||||
E_OpList rhs_oplist = e_oplist_from_irtree(scratch.arena, rhs_irtree.root);
|
||||
String8 rhs_bytecode = e_bytecode_from_oplist(scratch.arena, &rhs_oplist);
|
||||
E_Interpretation rhs_interp = e_interpret(rhs_bytecode);
|
||||
E_Value rhs_value = rhs_interp.value;
|
||||
if(0 <= rhs_value.u64 && rhs_value.u64 < cfgs->count)
|
||||
{
|
||||
RD_Cfg *watch = cfgs->v[rhs_value.u64];
|
||||
String8 expr_string = rd_cfg_child_from_string(watch, str8_lit("expression"))->first->string;
|
||||
E_Expr *expr = e_parse_expr_from_text(arena, expr_string);
|
||||
result.irtree_and_type = e_irtree_and_type_from_expr(arena, expr);
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
E_LOOKUP_INFO_FUNCTION_DEF(top_level_cfg)
|
||||
{
|
||||
E_LookupInfo result = {0};
|
||||
@@ -9169,7 +9208,8 @@ E_LOOKUP_INFO_FUNCTION_DEF(top_level_cfg)
|
||||
E_IRTreeAndType lhs_irtree = e_irtree_and_type_from_expr(scratch.arena, lhs);
|
||||
E_TypeKey lhs_type_key = lhs_irtree.type_key;
|
||||
E_Type *lhs_type = e_type_from_key(scratch.arena, lhs_type_key);
|
||||
RD_CfgList cfgs_list = rd_cfg_top_level_list_from_string(scratch.arena, lhs_type->name);
|
||||
String8 cfg_name = rd_singular_from_code_name_plural(lhs_type->name);
|
||||
RD_CfgList cfgs_list = rd_cfg_top_level_list_from_string(scratch.arena, cfg_name);
|
||||
RD_CfgArray *cfgs = push_array(arena, RD_CfgArray, 1);
|
||||
cfgs[0] = rd_cfg_array_from_list(arena, &cfgs_list);
|
||||
result.user_data = cfgs;
|
||||
@@ -9660,22 +9700,11 @@ rd_append_value_strings_from_eval(Arena *arena, EV_StringFlags flags, U32 defaul
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: member evaluations -> display member info
|
||||
if(eval.mode == E_Mode_Null && !e_type_key_match(e_type_key_zero(), eval.type_key) && member != &e_member_nil)
|
||||
//- rjf: type evaluations -> display type string
|
||||
if(eval.mode == E_Mode_Null && !e_type_key_match(e_type_key_zero(), eval.type_key))
|
||||
{
|
||||
U64 member_byte_size = e_type_byte_size_from_key(eval.type_key);
|
||||
String8 offset_string = str8_from_u64(arena, member->off, radix, 0, 0);
|
||||
String8 size_string = str8_from_u64(arena, member_byte_size, radix, 0, 0);
|
||||
str8_list_pushf(arena, out, "member (%S offset, %S byte%s)", offset_string, size_string, member_byte_size == 1 ? "" : "s");
|
||||
}
|
||||
|
||||
//- rjf: type evaluations -> display type basic information
|
||||
else if(eval.mode == E_Mode_Null && !e_type_key_match(e_type_key_zero(), eval.type_key) && eval.expr->kind != E_ExprKind_MemberAccess)
|
||||
{
|
||||
String8 basic_type_kind_string = e_kind_basic_string_table[e_type_kind_from_key(eval.type_key)];
|
||||
U64 byte_size = e_type_byte_size_from_key(eval.type_key);
|
||||
String8 size_string = str8_from_u64(arena, byte_size, radix, 0, 0);
|
||||
str8_list_pushf(arena, out, "%S (%S byte%s)", basic_type_kind_string, size_string, byte_size == 1 ? "" : "s");
|
||||
String8 string = e_type_string_from_key(arena, eval.type_key);
|
||||
str8_list_push(arena, out, string);
|
||||
}
|
||||
|
||||
//- rjf: value/offset evaluations
|
||||
@@ -11945,6 +11974,21 @@ rd_vocabulary_info_from_code_name(String8 code_name)
|
||||
return info;
|
||||
}
|
||||
|
||||
internal RD_VocabularyInfo *
|
||||
rd_vocabulary_info_from_code_name_plural(String8 code_name_plural)
|
||||
{
|
||||
RD_VocabularyInfo *info = &rd_nil_vocabulary_info;
|
||||
for EachElement(idx, rd_vocabulary_info_table)
|
||||
{
|
||||
if(str8_match(rd_vocabulary_info_table[idx].code_name_plural, code_name_plural, 0))
|
||||
{
|
||||
info = &rd_vocabulary_info_table[idx];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Continuous Frame Requests
|
||||
|
||||
@@ -13163,7 +13207,6 @@ rd_frame(void)
|
||||
//- rjf: choose set of evallable config names
|
||||
String8 evallable_cfg_names[] =
|
||||
{
|
||||
str8_lit("watch"),
|
||||
str8_lit("breakpoint"),
|
||||
str8_lit("watch_pin"),
|
||||
str8_lit("target"),
|
||||
@@ -13340,6 +13383,16 @@ rd_frame(void)
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: add macros for watch groups
|
||||
{
|
||||
String8 collection_name = str8_lit("watches");
|
||||
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);
|
||||
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(watch_group), E_LOOKUP_FUNCTION_NAME(watch_group));
|
||||
}
|
||||
|
||||
//- rjf: add macros for collections (new @cfg)
|
||||
for EachElement(cfg_name_idx, evallable_cfg_names)
|
||||
{
|
||||
@@ -13835,6 +13888,15 @@ rd_frame(void)
|
||||
rd_cfg_release(recent_projects.last->v);
|
||||
}
|
||||
}
|
||||
|
||||
//- TODO(rjf): @cfg set up debugging config state
|
||||
if(kind == RD_CmdKind_OpenUser)
|
||||
{
|
||||
RD_Cfg *user = rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("user"));
|
||||
RD_Cfg *watch = rd_cfg_new(user, str8_lit("watch"));
|
||||
RD_Cfg *expr = rd_cfg_new(watch, str8_lit("expression"));
|
||||
rd_cfg_new(expr, str8_lit("basics"));
|
||||
}
|
||||
}break;
|
||||
|
||||
//- rjf: writing config changes
|
||||
|
||||
@@ -1416,10 +1416,12 @@ internal DR_FancyStringList rd_stop_explanation_fstrs_from_ctrl_event(Arena *are
|
||||
//~ rjf: Vocabulary Info Lookups
|
||||
|
||||
internal RD_VocabularyInfo *rd_vocabulary_info_from_code_name(String8 code_name);
|
||||
internal RD_VocabularyInfo *rd_vocabulary_info_from_code_name_plural(String8 code_name_plural);
|
||||
#define rd_plural_from_code_name(code_name) (rd_vocabulary_info_from_code_name(code_name)->code_name_plural)
|
||||
#define rd_display_from_code_name(code_name) (rd_vocabulary_info_from_code_name(code_name)->display_name)
|
||||
#define rd_display_plural_from_code_name(code_name) (rd_vocabulary_info_from_code_name(code_name)->display_name_plural)
|
||||
#define rd_icon_kind_from_code_name(code_name) (rd_vocabulary_info_from_code_name(code_name)->icon_kind)
|
||||
#define rd_singular_from_code_name_plural(code_name_plural) (rd_vocabulary_info_from_code_name_plural(code_name_plural)->code_name)
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Continuous Frame Requests
|
||||
|
||||
@@ -596,14 +596,6 @@ entry_point(CmdLine *cmd_line)
|
||||
rd_init(cmd_line);
|
||||
}
|
||||
|
||||
//- TODO(rjf): @cfg set up debugging config state
|
||||
{
|
||||
RD_Cfg *user = rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("user"));
|
||||
RD_Cfg *watch = rd_cfg_new(user, str8_lit("watch"));
|
||||
RD_Cfg *expr = rd_cfg_new(watch, str8_lit("expression"));
|
||||
rd_cfg_new(expr, str8_lit("basics"));
|
||||
}
|
||||
|
||||
//- rjf: setup initial target from command line args
|
||||
{
|
||||
String8List args = cmd_line->inputs;
|
||||
|
||||
+103
-4
@@ -957,9 +957,10 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
|
||||
// rjf: fill row's cells
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .string = str8_lit("expression"), .pct = 0.25f);
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .pct = 0.30f);
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .pct = 0.20f);
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .string = str8_lit("typeof($expr)"), .pct = 0.15f);
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .string = str8_lit("view_rule"), .pct = 0.30f);
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .string = str8_lit("sizeof($expr)"), .pct = 0.15f);
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .string = str8_lit("view_rule"), .pct = 0.25f);
|
||||
|
||||
di_scope_close(di_scope);
|
||||
scratch_end(scratch);
|
||||
@@ -1092,7 +1093,105 @@ internal RD_WatchRowCellInfo
|
||||
rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, RD_WatchRowInfo *row_info, RD_WatchCell *cell, FNT_Tag font, F32 font_size, F32 max_size_px)
|
||||
{
|
||||
RD_WatchRowCellInfo result = {0};
|
||||
result.string = row->string;
|
||||
switch(cell->kind)
|
||||
{
|
||||
//- rjf: expression cells -> if no string attached to row itself, form one from the
|
||||
// expression tree.
|
||||
case RD_WatchCellKind_Expr:
|
||||
{
|
||||
result.string = row->string;
|
||||
if(result.string.size == 0)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
switch(notable_expr->kind)
|
||||
{
|
||||
default:
|
||||
{
|
||||
result.string = e_string_from_expr(arena, notable_expr);
|
||||
}break;
|
||||
case E_ExprKind_ArrayIndex:
|
||||
{
|
||||
result.string = push_str8f(arena, "[%S]", e_string_from_expr(arena, notable_expr->last));
|
||||
}break;
|
||||
case E_ExprKind_MemberAccess:
|
||||
{
|
||||
result.string = push_str8f(arena, ".%S", e_string_from_expr(arena, notable_expr->last));
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}break;
|
||||
|
||||
//- rjf: evaluation cells -> wrap expression if needed, evaluate, & stringize
|
||||
case RD_WatchCellKind_Eval:
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
|
||||
//- rjf: use cell's wrap string to wrap row's expression
|
||||
String8 wrap_string = cell->string;
|
||||
E_Expr *root_expr = row->expr;
|
||||
if(wrap_string.size != 0)
|
||||
{
|
||||
E_Expr *wrap_expr = e_parse_expr_from_text(scratch.arena, wrap_string);
|
||||
root_expr = wrap_expr;
|
||||
typedef struct Task Task;
|
||||
struct Task
|
||||
{
|
||||
Task *next;
|
||||
E_Expr *parent;
|
||||
E_Expr *expr;
|
||||
};
|
||||
Task start_task = {0, &e_expr_nil, wrap_expr};
|
||||
Task *first_task = &start_task;
|
||||
Task *last_task = first_task;
|
||||
for(Task *t = first_task; t != 0; t = t->next)
|
||||
{
|
||||
if(t->expr->kind == E_ExprKind_LeafIdent && str8_match(t->expr->string, str8_lit("$expr"), 0))
|
||||
{
|
||||
E_Expr *original_expr_ref = e_expr_ref(scratch.arena, row->expr);
|
||||
if(t->parent != &e_expr_nil)
|
||||
{
|
||||
e_expr_insert_child(t->parent, t->expr, original_expr_ref);
|
||||
e_expr_remove_child(t->parent, t->expr);
|
||||
}
|
||||
else
|
||||
{
|
||||
root_expr = original_expr_ref;
|
||||
}
|
||||
}
|
||||
else for(E_Expr *child = t->expr->first; child != &e_expr_nil; child = child->next)
|
||||
{
|
||||
Task *task = push_array(scratch.arena, Task, 1);
|
||||
SLLQueuePush(first_task, last_task, task);
|
||||
task->parent = t->expr;
|
||||
task->expr = child;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: evaluate wrapped expression
|
||||
result.eval = e_eval_from_expr(scratch.arena, root_expr);
|
||||
result.string = rd_value_string_from_eval(arena, 0, 10, font, font_size, max_size_px, result.eval, &e_member_nil, row->view_rules);
|
||||
|
||||
scratch_end(scratch);
|
||||
}break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -4026,7 +4125,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(targets)
|
||||
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:targets"), str8_lit("only: label exe args working_directory entry_point stdout_path stderr_path stdin_path debug_subprocesses b32 str"), 1, 10, rect);
|
||||
rd_watch_view_build(wv, str8_lit("collection:targets"), str8_zero(), 1, 10, rect);
|
||||
ProfEnd();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user