make some progress on watch window refinement for various row topologies

This commit is contained in:
Ryan Fleury
2025-01-28 18:31:34 -08:00
parent 2a1ab9b3be
commit 84d55c8939
9 changed files with 846 additions and 200 deletions
@@ -667,31 +667,11 @@ ev_resolved_from_expr(Arena *arena, E_Expr *expr, EV_ViewRuleList *view_rules)
return expr;
}
////////////////////////////////
//~ rjf: Column List Building
internal EV_Col *
ev_col_list_push(Arena *arena, EV_ColList *list)
{
EV_Col *col = push_array(arena, EV_Col, 1);
SLLQueuePush(list->first, list->last, col);
list->count += 1;
return col;
}
internal EV_Col *
ev_col_list_push_new(Arena *arena, EV_ColList *list, String8 key)
{
EV_Col *col = ev_col_list_push(arena, list);
col->key = push_str8_copy(arena, key);
return col;
}
////////////////////////////////
//~ rjf: Block Building
internal EV_BlockTree
ev_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, String8 string, E_Expr *expr, EV_ViewRuleList *view_rules, EV_ColList *cols)
ev_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, String8 string, E_Expr *expr, EV_ViewRuleList *view_rules)
{
ProfBeginFunction();
EV_BlockTree tree = {&ev_nil_block};
@@ -711,7 +691,6 @@ ev_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, String8 str
tree.root = push_array(arena, EV_Block, 1);
MemoryCopyStruct(tree.root, &ev_nil_block);
tree.root->key = ev_key_root();
tree.root->cols = *cols;
tree.root->string = string;
tree.root->expr = ev_resolved_from_expr(arena, expr, top_level_view_rules);
tree.root->view_rules = top_level_view_rules;
@@ -779,7 +758,6 @@ ev_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, String8 str
expansion_block->parent = t->parent_block;
expansion_block->key = key;
expansion_block->split_relative_idx = t->split_relative_idx;
expansion_block->cols = *cols;
expansion_block->expr = t->expr;
expansion_block->view_rules = t->view_rules;
expansion_block->expand_view_rule_info = expand_view_rule_info;
@@ -907,7 +885,7 @@ ev_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, String8 str
}
internal EV_BlockTree
ev_block_tree_from_string(Arena *arena, EV_View *view, String8 filter, String8 string, EV_ViewRuleList *view_rules, EV_ColList *cols)
ev_block_tree_from_string(Arena *arena, EV_View *view, String8 filter, String8 string, EV_ViewRuleList *view_rules)
{
ProfBeginFunction();
EV_BlockTree tree = {0};
@@ -918,7 +896,7 @@ ev_block_tree_from_string(Arena *arena, EV_View *view, String8 filter, String8 s
EV_ViewRuleList *fastpath_view_rules = ev_view_rule_list_from_expr_fastpaths(arena, string);
EV_ViewRuleList *all_view_rules = ev_view_rule_list_copy(arena, view_rules);
ev_view_rule_list_concat_in_place(all_view_rules, &fastpath_view_rules);
tree = ev_block_tree_from_expr(arena, view, filter, string, parse.expr, all_view_rules, cols);
tree = ev_block_tree_from_expr(arena, view, filter, string, parse.expr, all_view_rules);
}
scratch_end(scratch);
ProfEnd();
@@ -187,24 +187,6 @@ struct EV_ViewRuleInfoTable
U64 slots_count;
};
////////////////////////////////
//~ rjf: Columns
typedef struct EV_Col EV_Col;
struct EV_Col
{
EV_Col *next;
String8 key;
};
typedef struct EV_ColList EV_ColList;
struct EV_ColList
{
EV_Col *first;
EV_Col *last;
U64 count;
};
////////////////////////////////
//~ rjf: Blocks
@@ -224,9 +206,6 @@ struct EV_Block
// rjf: split index, relative to parent's space
U64 split_relative_idx;
// rjf: columns
EV_ColList cols;
// rjf: expression / visualization info
String8 string;
E_Expr *expr;
@@ -372,7 +351,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 EV_Block ev_nil_block = {&ev_nil_block, &ev_nil_block, &ev_nil_block, &ev_nil_block, &ev_nil_block, {0}, 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
@@ -436,17 +415,11 @@ internal void ev_view_rule_list_concat_in_place(EV_ViewRuleList *dst, EV_ViewRul
internal E_Expr *ev_resolved_from_expr(Arena *arena, E_Expr *expr, EV_ViewRuleList *view_rules);
////////////////////////////////
//~ rjf: Column List Building
internal EV_Col *ev_col_list_push(Arena *arena, EV_ColList *list);
internal EV_Col *ev_col_list_push_new(Arena *arena, EV_ColList *list, String8 key);
////////////////////////////////
//~ rjf: Block Building
internal EV_BlockTree ev_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, String8 string, E_Expr *expr, EV_ViewRuleList *view_rules, EV_ColList *cols);
internal EV_BlockTree ev_block_tree_from_string(Arena *arena, EV_View *view, String8 filter, String8 string, EV_ViewRuleList *view_rules, EV_ColList *cols);
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);
////////////////////////////////
+14 -14
View File
@@ -75,12 +75,12 @@ RD_VocabularyInfo rd_vocabulary_info_table[41] =
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("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("breakpoint"), str8_lit_comp("x:\n{\n 'label': code_string,\n 'condition': code_string,\n 'location': location,\n 'hit_count': u64,\n 'disabled': bool,\n}\n")},
{str8_lit_comp("watch_pin"), str8_lit_comp("x:\n{\n 'expression': code_string,\n 'view_rule': code_string,\n 'location': location,\n}\n")},
{str8_lit_comp("file_path_map"), str8_lit_comp("x:{'source':path, 'dest':path}")},
{str8_lit_comp("auto_view_rule"), str8_lit_comp("x:{'source':code_string, 'dest':code_string}")},
{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")},
{str8_lit_comp("breakpoint"), str8_lit_comp("x:\n{\n 'label': code_string,\n 'condition': code_string,\n 'location': location,\n 'hit_count': u64,\n 'disabled': bool,\n}\n"), str8_lit_comp("enable_cfg,remove_cfg")},
{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")},
};
String8 d_entity_kind_display_string_table[27] =
@@ -440,14 +440,14 @@ RD_CmdKindInfo rd_cmd_kind_info_table[213] =
{ str8_lit_comp("set_columns"), str8_lit_comp("Sets the number of columns for a memory view."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Set Columns"), RD_IconKind_Thumbnails, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*1)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil, CTRL_EntityKind_Null}},
{ str8_lit_comp("toggle_address_visibility"), str8_lit_comp("Toggles the visibility of addresses in a disassembly view."), str8_lit_comp(""), str8_lit_comp("$disasm,"), str8_lit_comp("Toggle Address Visibility"), RD_IconKind_Thumbnails, (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}},
{ str8_lit_comp("toggle_code_bytes_visibility"), str8_lit_comp("Toggles the visibility of machine code bytes in a disassembly view."), str8_lit_comp(""), str8_lit_comp("$disasm,"), str8_lit_comp("Toggle Code Bytes Visibility"), RD_IconKind_Thumbnails, (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}},
{ str8_lit_comp("enable_entity"), str8_lit_comp("Enables an entity."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Enable Entity"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(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}},
{ str8_lit_comp("disable_entity"), str8_lit_comp("Disables an entity."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Disable Entity"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(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}},
{ str8_lit_comp("select_entity"), str8_lit_comp("Selects an entity, disabling all others of the same kind."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Select Entity"), RD_IconKind_CheckHollow, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(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}},
{ str8_lit_comp("remove_entity"), str8_lit_comp("Removes an entity."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Remove Entity"), RD_IconKind_Trash, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(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}},
{ str8_lit_comp("name_entity"), str8_lit_comp("Equips an entity with a name."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Name Entity"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(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}},
{ str8_lit_comp("condition_entity"), str8_lit_comp("Equips an entity with a condition string."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Condition Entity"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(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}},
{ str8_lit_comp("duplicate_entity"), str8_lit_comp("Duplicates an entity."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Duplicate Entity"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(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}},
{ str8_lit_comp("relocate_entity"), str8_lit_comp("Relocates an entity."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Relocate Entity"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(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}},
{ str8_lit_comp("enable_cfg"), str8_lit_comp("Enables an entity."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Enable Config Tree"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(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}},
{ str8_lit_comp("disable_cfg"), str8_lit_comp("Disables an entity."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Disable Config Tree"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(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}},
{ str8_lit_comp("select_cfg"), str8_lit_comp("Selects an entity, disabling all others of the same kind."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Select Config Tree"), RD_IconKind_CheckHollow, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(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}},
{ str8_lit_comp("remove_cfg"), str8_lit_comp("Removes an entity."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Remove Config Tree"), RD_IconKind_Trash, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(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}},
{ str8_lit_comp("name_cfg"), str8_lit_comp("Equips an entity with a name."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Name Config Tree"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(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}},
{ str8_lit_comp("condition_cfg"), str8_lit_comp("Equips an entity with a condition string."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Condition Config Tree"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(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}},
{ str8_lit_comp("duplicate_cfg"), str8_lit_comp("Duplicates an entity."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Duplicate Config Tree"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(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}},
{ str8_lit_comp("relocate_cfg"), str8_lit_comp("Relocates an entity."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Relocate Config Tree"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(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}},
{ str8_lit_comp("add_breakpoint"), str8_lit_comp("Places a breakpoint at a given location (file path and line number, address, or symbol name)."), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Add Breakpoint"), RD_IconKind_CircleFilled, (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}},
{ str8_lit_comp("add_address_breakpoint"), str8_lit_comp("Places a breakpoint on the specified address."), str8_lit_comp(""), str8_lit_comp("$breakpoints,"), str8_lit_comp("Add Address Breakpoint"), RD_IconKind_CircleFilled, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*1)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_Vaddr, str8_lit_comp(""), RD_EntityKind_Nil, CTRL_EntityKind_Null}},
{ str8_lit_comp("add_function_breakpoint"), str8_lit_comp("Places a breakpoint on the first address(es) of the specified function."), str8_lit_comp(""), str8_lit_comp("$breakpoints,"), str8_lit_comp("Add Function Breakpoint"), RD_IconKind_CircleFilled, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*1)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_String, str8_lit_comp("symbol_lister"), RD_EntityKind_Nil, CTRL_EntityKind_Null}},
+1
View File
@@ -527,6 +527,7 @@ struct RD_CfgNameSchemaPair
{
String8 name;
String8 schema;
String8 cmd_names;
};
typedef struct RD_Regs RD_Regs;
+21 -15
View File
@@ -111,7 +111,7 @@ RD_VocabularyMap:
////////////////////////////////
//~ rjf: Configuration Tree Schemas
@table(name schema) RD_CfgSchemaTable:
@table(name schema cmd_names) RD_CfgSchemaTable:
{
//- rjf: settings
{
@@ -156,7 +156,8 @@ RD_VocabularyMap:
'stdin_path': path,
'debug_subprocesses': bool,
}
```
```,
`launch_and_run,launch_and_init,select_cfg,remove_cfg`,
}
//- rjf: breakpoints
@@ -170,7 +171,8 @@ RD_VocabularyMap:
'hit_count': u64,
'disabled': bool,
}
```
```,
`enable_cfg,remove_cfg`,
}
//- rjf: watch pins
@@ -182,19 +184,22 @@ RD_VocabularyMap:
'view_rule': code_string,
'location': location,
}
```
```,
`remove_cfg`,
}
//- rjf: file path maps
{
file_path_map,
```x:{'source':path, 'dest':path}```
```x:{'source':path, 'dest':path}```,
`remove_cfg`,
}
//- rjf: auto view rules
{
auto_view_rule,
```x:{'source':code_string, 'dest':code_string}```
```x:{'source':code_string, 'dest':code_string}```,
`remove_cfg`,
}
}
@@ -202,11 +207,12 @@ RD_VocabularyMap:
{
`String8 name`;
`String8 schema`;
`String8 cmd_names`;
}
@data(RD_CfgNameSchemaPair) rd_cfg_name_schema_pair_table:
{
@expand(RD_CfgSchemaTable a) `{str8_lit_comp("$(a.name)"), str8_lit_comp("$(a.schema)")}`
@expand(RD_CfgSchemaTable a) `{str8_lit_comp("$(a.name)"), str8_lit_comp("$(a.schema)"), str8_lit_comp("$(a.cmd_names)")}`
}
////////////////////////////////
@@ -573,14 +579,14 @@ RD_CmdTable: // | | | |
{ToggleCodeBytesVisibility 1 1 Null null Nil Null 0 0 0 0 0 0 Thumbnails "toggle_code_bytes_visibility""Toggle Code Bytes Visibility" "Toggles the visibility of machine code bytes in a disassembly view." "" "$disasm," }
//- rjf: general config operations
{EnableCfg 0 0 Null null Nil Null 0 0 0 0 0 0 Null "enable_entity" "Enable Entity" "Enables an entity." "" "" }
{DisableCfg 0 0 Null null Nil Null 0 0 0 0 0 0 Null "disable_entity" "Disable Entity" "Disables an entity." "" "" }
{SelectCfg 0 0 Null null Nil Null 0 0 0 0 0 0 CheckHollow "select_entity" "Select Entity" "Selects an entity, disabling all others of the same kind." "" "" }
{RemoveCfg 0 0 Null null Nil Null 0 0 0 0 0 0 Trash "remove_entity" "Remove Entity" "Removes an entity." "" "" }
{NameCfg 0 0 Null null Nil Null 0 0 0 0 0 0 Null "name_entity" "Name Entity" "Equips an entity with a name." "" "" }
{ConditionCfg 0 0 Null null Nil Null 0 0 0 0 0 0 Null "condition_entity" "Condition Entity" "Equips an entity with a condition string." "" "" }
{DuplicateCfg 0 0 Null null Nil Null 0 0 0 0 0 0 Null "duplicate_entity" "Duplicate Entity" "Duplicates an entity." "" "" }
{RelocateCfg 0 0 Null null Nil Null 0 0 0 0 0 0 Null "relocate_entity" "Relocate Entity" "Relocates an entity." "" "" }
{EnableCfg 0 0 Null null Nil Null 0 0 0 0 0 0 Null "enable_cfg" "Enable Config Tree" "Enables an entity." "" "" }
{DisableCfg 0 0 Null null Nil Null 0 0 0 0 0 0 Null "disable_cfg" "Disable Config Tree" "Disables an entity." "" "" }
{SelectCfg 0 0 Null null Nil Null 0 0 0 0 0 0 CheckHollow "select_cfg" "Select Config Tree" "Selects an entity, disabling all others of the same kind." "" "" }
{RemoveCfg 0 0 Null null Nil Null 0 0 0 0 0 0 Trash "remove_cfg" "Remove Config Tree" "Removes an entity." "" "" }
{NameCfg 0 0 Null null Nil Null 0 0 0 0 0 0 Null "name_cfg" "Name Config Tree" "Equips an entity with a name." "" "" }
{ConditionCfg 0 0 Null null Nil Null 0 0 0 0 0 0 Null "condition_cfg" "Condition Config Tree" "Equips an entity with a condition string." "" "" }
{DuplicateCfg 0 0 Null null Nil Null 0 0 0 0 0 0 Null "duplicate_cfg" "Duplicate Config Tree" "Duplicates an entity." "" "" }
{RelocateCfg 0 0 Null null Nil Null 0 0 0 0 0 0 Null "relocate_cfg" "Relocate Config Tree" "Relocates an entity." "" "" }
//- rjf: breakpoints
{AddBreakpoint 1 1 Null null Nil Null 0 0 0 0 0 0 CircleFilled "add_breakpoint" "Add Breakpoint" "Places a breakpoint at a given location (file path and line number, address, or symbol name)." "" "" }
+114 -36
View File
@@ -1543,6 +1543,46 @@ rd_setting_from_name(String8 name)
return result;
}
internal RD_Cfg *
rd_immediate_cfg_from_key(String8 string)
{
RD_Cfg *transient = rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("transient"));
RD_Cfg *immediate = &rd_nil_cfg;
RD_Cfg *cfg = &rd_nil_cfg;
for(RD_Cfg *child = transient->first; child != &rd_nil_cfg; child = child->next)
{
if(str8_match(child->string, str8_lit("immediate"), 0))
{
cfg = rd_cfg_child_from_string(child, string);
if(cfg != &rd_nil_cfg)
{
immediate = child;
break;
}
}
}
if(cfg == &rd_nil_cfg)
{
immediate = rd_cfg_new(transient, str8_lit("immediate"));
cfg = rd_cfg_new(immediate, string);
}
rd_cfg_new(immediate, str8_lit("hot"));
return cfg;
}
internal RD_Cfg *
rd_immediate_cfg_from_keyf(char *fmt, ...)
{
Temp scratch = scratch_begin(0, 0);
va_list args;
va_start(args, fmt);
String8 key = push_str8fv(scratch.arena, fmt, args);
RD_Cfg *result = rd_immediate_cfg_from_key(key);
va_end(args);
scratch_end(scratch);
return result;
}
////////////////////////////////
//~ rjf: Entity State Functions
@@ -3441,6 +3481,7 @@ rd_view_state_from_cfg(RD_Cfg *cfg)
DLLPushBack_NP(slot->first, slot->last, view_state, hash_next, hash_prev);
view_state->cfg_handle = cfg_handle;
view_state->arena = arena_alloc();
view_state->ev_view = ev_view_alloc();
view_state->loading_t = 1.f;
}
if(view_state != &rd_nil_view_state)
@@ -3613,6 +3654,14 @@ rd_view_scroll_pos(void)
return view_state->scroll_pos;
}
internal EV_View *
rd_view_eval_view(void)
{
RD_Cfg *view = rd_cfg_from_handle(rd_regs()->view);
RD_ViewState *view_state = rd_view_state_from_cfg(view);
return view_state->ev_view;
}
internal String8
rd_view_expr_string(void)
{
@@ -6674,12 +6723,47 @@ rd_window_frame(void)
UI_FontSize(rd_font_size_from_slot(RD_FontSlot_Main))
RD_Palette(RD_PaletteCode_Floating)
{
RD_Cfg *root = rd_immediate_cfg_from_keyf("hover_eval_%p", ws);
RD_Cfg *view = rd_cfg_child_from_string_or_alloc(root, str8_lit("watch"));
RD_Cfg *expr = rd_cfg_child_from_string_or_alloc(view, str8_lit("expression"));
RD_RegsScope(.panel = rd_handle_zero(), .view = rd_handle_from_cfg(view))
{
RD_ViewRuleInfo *view_rule_info = rd_view_rule_info_from_string(view->string);
rd_cfg_release_all_children(expr);
rd_cfg_new(expr, ws->hover_eval_string);
{
ui_set_next_fixed_x(ws->hover_eval_spawn_pos.x);
ui_set_next_fixed_y(ws->hover_eval_spawn_pos.y);
ui_set_next_pref_width(ui_em(60.f, 1.f));
ui_set_next_pref_height(ui_em(40.f, 1.f));
ui_set_next_child_layout_axis(Axis2_Y);
UI_Box *container = ui_build_box_from_key(UI_BoxFlag_Floating, ui_key_zero());
UI_Parent(container)
{
UI_Row
{
}
ui_set_next_pref_width(ui_pct(1, 0));
ui_set_next_pref_height(ui_pct(1, 0));
ui_set_next_child_layout_axis(Axis2_Y);
UI_Box *view_contents_container = ui_build_box_from_stringf(UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawBackground|UI_BoxFlag_Clip, "###view_contents_container");
UI_Parent(view_contents_container) UI_Focus(UI_FocusKind_Off) UI_WidthFill
{
RD_ViewRuleUIFunctionType *view_ui = view_rule_info->ui;
String8 params_string = rd_string_from_cfg_tree(scratch.arena, view);
MD_Node *params = md_tree_from_string(scratch.arena, params_string)->first;
view_ui(expr->first->string, params, view_contents_container->rect);
}
}
}
}
#if 0 // TODO(rjf): @cfg
Temp scratch = scratch_begin(0, 0);
DI_Scope *scope = di_scope_open();
String8 expr = ws->hover_eval_string;
E_Eval eval = e_eval_from_string(scratch.arena, expr);
EV_ViewRuleList top_level_view_rules = {0};
EV_ColList top_level_cols = {0};
//- rjf: build if good
if(!e_type_key_match(eval.type_key, e_type_key_zero()) && !ui_any_ctx_menu_is_open())
@@ -6693,7 +6777,7 @@ rd_window_frame(void)
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);
EV_BlockTree block_tree = ev_block_tree_from_string(scratch.arena, ev_view, str8_zero(), expr, &top_level_view_rules, &top_level_cols);
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);
@@ -6963,6 +7047,7 @@ rd_window_frame(void)
di_scope_close(scope);
scratch_end(scratch);
#endif
}
}
@@ -9466,38 +9551,6 @@ rd_ev_view_rule_expr_num_from_id__debug_info_tables(U64 id, void *user_data, RDI
return num;
}
internal EV_View *
rd_ev_view_from_key(U64 key)
{
U64 slot_idx = key % rd_state->eval_viz_view_cache_slots_count;
RD_EvalVizViewCacheNode *node = 0;
RD_EvalVizViewCacheSlot *slot = &rd_state->eval_viz_view_cache_slots[slot_idx];
for(RD_EvalVizViewCacheNode *n = slot->first; n != 0; n = n->next)
{
if(n->key == key)
{
node = n;
break;
}
}
if(node == 0)
{
node = rd_state->eval_viz_view_cache_node_free;
if(node)
{
SLLStackPop(rd_state->eval_viz_view_cache_node_free);
}
else
{
node = push_array(rd_state->arena, RD_EvalVizViewCacheNode, 1);
}
DLLPushBack(slot->first, slot->last, node);
node->key = key;
node->v = ev_view_alloc();
}
return node->v;
}
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)
{
@@ -12119,8 +12172,6 @@ rd_init(CmdLine *cmdln)
rd_state->ctx_menu_key = ui_key_from_string(ui_key_zero(), str8_lit("top_level_ctx_menu"));
rd_state->drop_completion_key = ui_key_from_string(ui_key_zero(), str8_lit("drop_completion_ctx_menu"));
rd_state->string_search_arena = arena_alloc();
rd_state->eval_viz_view_cache_slots_count = 1024;
rd_state->eval_viz_view_cache_slots = push_array(arena, RD_EvalVizViewCacheSlot, rd_state->eval_viz_view_cache_slots_count);
rd_state->bind_change_arena = arena_alloc();
rd_state->drag_drop_arena = arena_alloc();
rd_state->drag_drop_regs = push_array(rd_state->drag_drop_arena, RD_Regs, 1);
@@ -12327,6 +12378,32 @@ rd_frame(void)
rd_state->cfg2evalblob_map->slots_count = 256;
rd_state->cfg2evalblob_map->slots = push_array(rd_frame_arena(), RD_Cfg2EvalBlobSlot, rd_state->cfg2evalblob_map->slots_count);
//////////////////////////////
//- rjf: garbage collect untouched immediate cfg trees
//
if(depth == 0)
{
RD_Cfg *transient = rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("transient"));
for(RD_Cfg *tln = transient->first, *next = &rd_nil_cfg; tln != &rd_nil_cfg; tln = next)
{
next = tln->next;
if(str8_match(tln->string, str8_lit("immediate"), 0))
{
if(rd_cfg_child_from_string(tln, str8_lit("hot")) == &rd_nil_cfg)
{
rd_cfg_release(tln);
}
}
}
for(RD_Cfg *tln = transient->first; tln != &rd_nil_cfg; tln = tln->next)
{
if(str8_match(tln->string, str8_lit("immediate"), 0))
{
rd_cfg_release(rd_cfg_child_from_string(tln, str8_lit("hot")));
}
}
}
//////////////////////////////
//- rjf: garbage collect untouched window states
//
@@ -12374,6 +12451,7 @@ rd_frame(void)
next = vs->hash_next;
if(vs->last_frame_index_touched+2 < rd_state->frame_index)
{
ev_view_release(vs->ev_view);
for(RD_ArenaExt *ext = vs->first_arena_ext; ext != 0; ext = ext->next)
{
arena_release(ext->arena);
+7 -25
View File
@@ -194,6 +194,9 @@ struct RD_ViewState
// rjf: scroll position
UI_ScrollPt2 scroll_pos;
// rjf: eval visualization view state
EV_View *ev_view;
// rjf: view-lifetime allocation & user data extensions
Arena *arena;
RD_ArenaExt *first_arena_ext;
@@ -724,25 +727,6 @@ struct RD_WindowStateSlot
RD_WindowState *last;
};
////////////////////////////////
//~ rjf: Eval Visualization View Cache Types
typedef struct RD_EvalVizViewCacheNode RD_EvalVizViewCacheNode;
struct RD_EvalVizViewCacheNode
{
RD_EvalVizViewCacheNode *next;
RD_EvalVizViewCacheNode *prev;
U64 key;
EV_View *v;
};
typedef struct RD_EvalVizViewCacheSlot RD_EvalVizViewCacheSlot;
struct RD_EvalVizViewCacheSlot
{
RD_EvalVizViewCacheNode *first;
RD_EvalVizViewCacheNode *last;
};
////////////////////////////////
//~ rjf: Meta Evaluation Cache Types
@@ -919,11 +903,6 @@ struct RD_State
Arena *string_search_arena;
String8 string_search_string;
// rjf: eval visualization view cache
U64 eval_viz_view_cache_slots_count;
RD_EvalVizViewCacheSlot *eval_viz_view_cache_slots;
RD_EvalVizViewCacheNode *eval_viz_view_cache_node_free;
// rjf: ctrl entity meta eval cache
U64 ctrl_entity_meval_cache_slots_count;
RD_CtrlEntityMetaEvalCacheSlot *ctrl_entity_meval_cache_slots;
@@ -1209,6 +1188,9 @@ internal String8 rd_setting_from_name(String8 name);
#define rd_setting_b32_from_name(name) (str8_match(rd_setting_from_name(name), str8_lit("1"), 0))
#define rd_setting_u64_from_name(name) (u64_from_str8(rd_setting_from_name(name), 10))
internal RD_Cfg *rd_immediate_cfg_from_key(String8 string);
internal RD_Cfg *rd_immediate_cfg_from_keyf(char *fmt, ...);
////////////////////////////////
//~ rjf: Entity Stateful Functions
@@ -1320,6 +1302,7 @@ internal DR_FancyStringList rd_title_fstrs_from_view(Arena *arena, String8 viewe
//- rjf: view info extraction
internal Arena *rd_view_arena(void);
internal UI_ScrollPt2 rd_view_scroll_pos(void);
internal EV_View *rd_view_eval_view(void);
internal String8 rd_view_expr_string(void);
internal String8 rd_view_filter(void);
@@ -1365,7 +1348,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);
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);
+641 -52
View File
@@ -794,6 +794,26 @@ rd_code_view_build(Arena *arena, RD_CodeViewState *cv, RD_CodeViewBuildFlags fla
////////////////////////////////
//~ rjf: Watch Views
//- rjf: cell list building
internal RD_WatchCell *
rd_watch_cell_list_push(Arena *arena, RD_WatchCellList *list)
{
RD_WatchCell *cell = push_array(arena, RD_WatchCell, 1);
SLLQueuePush(list->first, list->last, cell);
list->count += 1;
return cell;
}
internal RD_WatchCell *
rd_watch_cell_list_push_new_(Arena *arena, RD_WatchCellList *list, RD_WatchCell *params)
{
RD_WatchCell *cell = rd_watch_cell_list_push(arena, list);
MemoryCopyStruct(cell, params);
cell->next = 0;
return cell;
}
//- rjf: index -> column
internal RD_WatchViewColumn *
@@ -817,16 +837,16 @@ rd_watch_view_column_from_x(RD_WatchViewState *wv, S64 index)
internal B32
rd_watch_view_point_match(RD_WatchViewPoint a, RD_WatchViewPoint b)
{
return (a.x == b.x &&
ev_key_match(a.parent_key, b.parent_key) &&
ev_key_match(a.key, b.key));
return (ev_key_match(a.parent_key, b.parent_key) &&
ev_key_match(a.key, b.key) &&
a.cell_id == b.cell_id);
}
internal RD_WatchViewPoint
rd_watch_view_point_from_tbl(EV_BlockRangeList *block_ranges, Vec2S64 tbl)
{
RD_WatchViewPoint pt = zero_struct;
pt.x = tbl.x;
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;
return pt;
@@ -836,7 +856,7 @@ internal Vec2S64
rd_tbl_from_watch_view_point(EV_BlockRangeList *block_ranges, RD_WatchViewPoint pt)
{
Vec2S64 tbl = {0};
tbl.x = pt.x;
tbl.x = (S64)pt.cell_id;
tbl.y = (S64)ev_num_from_key(block_ranges, pt.key);
return tbl;
}
@@ -996,10 +1016,23 @@ rd_watch_view_row_kind_from_flags_row_info(RD_WatchViewFlags flags, EV_Row *row,
return row_kind;
}
//- rjf: row info -> cell list
internal RD_WatchCellList
rd_watch_cell_list_from_row_info(Arena *arena, EV_Row *row, RD_WatchViewRowInfo *info)
{
RD_WatchCellList cell_list = {0};
rd_watch_cell_list_push_new(arena, &cell_list, RD_WatchCellKind_Expr, .pct = 0.25f);
rd_watch_cell_list_push_new(arena, &cell_list, RD_WatchCellKind_Value, .pct = 0.30f);
rd_watch_cell_list_push_new(arena, &cell_list, RD_WatchCellKind_Type, .pct = 0.15f);
rd_watch_cell_list_push_new(arena, &cell_list, RD_WatchCellKind_ViewRule, .pct = 0.30f);
return cell_list;
}
//- rjf: row/column -> strings
internal E_Expr *
rd_expr_from_watch_view_row_column(Arena *arena, EV_View *ev_view, EV_Row *row, RD_WatchViewColumn *col)
rd_expr_from_watch_view_row_column(Arena *arena, EV_Row *row, RD_WatchViewColumn *col)
{
E_Expr *expr = row->expr;
switch(col->kind)
@@ -1026,11 +1059,11 @@ rd_expr_from_watch_view_row_column(Arena *arena, EV_View *ev_view, EV_Row *row,
}
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)
rd_string_from_eval_viz_row_column(Arena *arena, EV_Row *row, RD_WatchViewColumn *col, EV_StringFlags string_flags, U32 default_radix, FNT_Tag font, F32 font_size, F32 max_size_px)
{
ProfBeginFunction();
String8 result = {0};
E_Expr *row_col_expr = rd_expr_from_watch_view_row_column(arena, ev, row, col);
E_Expr *row_col_expr = rd_expr_from_watch_view_row_column(arena, row, col);
switch(col->kind)
{
default:{}break;
@@ -1063,6 +1096,9 @@ rd_string_from_eval_viz_row_column(Arena *arena, EV_View *ev, EV_Row *row, RD_Wa
case RD_WatchViewColumnKind_ViewRule:
ProfScope("view rule cell string")
{
RD_Cfg *view = rd_cfg_from_handle(rd_regs()->view);
RD_ViewState *vs = rd_view_state_from_cfg(view);
EV_View *ev = vs->ev_view;
result = ev_view_rule_from_key(ev, row->key);
}break;
case RD_WatchViewColumnKind_Module:
@@ -1265,7 +1301,6 @@ internal void
rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 root_expr, String8 root_view_rule, B32 modifiable, U32 default_radix, Rng2F32 rect)
{
ProfBeginFunction();
DI_Scope *di_scope = di_scope_open();
Temp scratch = scratch_begin(0, 0);
UI_ScrollPt2 scroll_pos = rd_view_scroll_pos();
F32 entity_hover_t_rate = rd_setting_b32_from_name(str8_lit("hover_animations")) ? (1 - pow_f32(2, (-20.f * rd_state->frame_dt))) : 1.f;
@@ -1274,9 +1309,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
//- rjf: unpack arguments
//
EV_ViewRuleList *top_level_view_rules = ev_view_rule_list_from_string(scratch.arena, root_view_rule);
EV_ColList top_level_cols = {0};
String8 eval_view_key_string = push_str8f(scratch.arena, "eval_view_watch_%p", ewv);
EV_View *eval_view = rd_ev_view_from_key(d_hash_from_string(eval_view_key_string));
EV_View *eval_view = rd_view_eval_view();
String8 filter = rd_view_filter();
F32 row_height_px = floor_f32(ui_top_font_size()*2.5f);
S64 num_possible_visible_rows = (S64)(dim_2f32(rect).y/row_height_px);
@@ -1307,37 +1340,10 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
U64 row_ctrls_count = ArrayCount(row_ctrls_);
#endif
//////////////////////////////
//- rjf: root-level view rule which has a ui hook? call into that to build the UI
//
B32 is_top_level_hook = 0;
#if 0 // TODO(rjf): @cfg
{
RD_ViewRuleInfo *hook_rule_info = 0;
MD_Node *hook_rule_root = &md_nil_node;
for(EV_ViewRuleNode *n = top_level_view_rules->first; n != 0; n = n->next)
{
RD_ViewRuleInfo *rule_info = rd_view_rule_info_from_string(n->v.root->string);
if(rule_info != &rd_nil_view_rule_info && rule_info->ui != 0)
{
hook_rule_info = rule_info;
hook_rule_root = n->v.root;
break;
}
}
if(hook_rule_info)
{
hook_rule_info->ui(root_expr, hook_rule_root, rect);
is_top_level_hook = 1;
}
}
#endif
//////////////////////////////
//- rjf: determine autocompletion string
//
String8 autocomplete_hint_string = {0};
if(!is_top_level_hook)
{
for(UI_Event *evt = 0; ui_next_event(&evt);)
{
@@ -1358,7 +1364,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
Vec2S64 cursor_tbl = {0};
Vec2S64 mark_tbl = {0};
Rng2S64 selection_tbl = {0};
if(!is_top_level_hook) ProfScope("consume events & perform navigations/edits - calculate state") UI_Focus(UI_FocusKind_On)
ProfScope("consume events & perform navigations/edits - calculate state") UI_Focus(UI_FocusKind_On)
{
B32 state_dirty = 1;
B32 snap_to_cursor = 0;
@@ -1374,7 +1380,7 @@ 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 = ev_block_tree_from_string(scratch.arena, eval_view, filter, root_expr, top_level_view_rules, &top_level_cols);
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);
}
@@ -1591,9 +1597,9 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
for(S64 x = selection_tbl.min.x; x <= selection_tbl.max.x; x += 1)
{
RD_WatchViewColumn *col = rd_watch_view_column_from_x(ewv, x);
String8 string = rd_string_from_eval_viz_row_column(scratch.arena, eval_view, row, col, string_flags, default_radix, ui_top_font(), ui_top_font_size(), row_string_max_size_px);
String8 string = rd_string_from_eval_viz_row_column(scratch.arena, row, col, string_flags, default_radix, ui_top_font(), ui_top_font_size(), row_string_max_size_px);
string.size = Min(string.size, sizeof(ewv->dummy_text_edit_state.input_buffer));
RD_WatchViewPoint pt = {x, row->block->key, row->key};
RD_WatchViewPoint pt = {row->block->key, row->key, x};
U64 hash = ev_hash_from_key(pt.key);
U64 slot_idx = hash%ewv->text_edit_state_slots_count;
RD_WatchViewTextEditState *edit_state = push_array(ewv->text_edit_arena, RD_WatchViewTextEditState, 1);
@@ -1779,7 +1785,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
if(rows.first != 0)
{
B32 should_commit_asap = editing_complete;
E_Expr *expr = rd_expr_from_watch_view_row_column(scratch.arena, eval_view, row, col);
E_Expr *expr = rd_expr_from_watch_view_row_column(scratch.arena, row, col);
E_Eval dst_eval = e_eval_from_expr(scratch.arena, expr);
if(dst_eval.space.kind == RD_EvalSpaceKind_MetaEntity)
{
@@ -1852,7 +1858,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
for(S64 x = selection_tbl.min.x; x <= selection_tbl.max.x; x += 1)
{
RD_WatchViewColumn *col = rd_watch_view_column_from_x(ewv, x);
String8 cell_string = rd_string_from_eval_viz_row_column(scratch.arena, eval_view, row, col, string_flags|EV_StringFlag_ReadOnlyDisplayRules, default_radix, ui_top_font(), ui_top_font_size(), row_string_max_size_px);
String8 cell_string = rd_string_from_eval_viz_row_column(scratch.arena, row, col, string_flags|EV_StringFlag_ReadOnlyDisplayRules, default_radix, ui_top_font(), ui_top_font_size(), row_string_max_size_px);
cell_string = str8_skip_chop_whitespace(cell_string);
U64 comma_pos = str8_find_needle(cell_string, 0, str8_lit(","), 0);
if(selection_tbl.min.x != selection_tbl.max.x || selection_tbl.min.y != selection_tbl.max.y)
@@ -1920,7 +1926,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
key = row->block->key;
parent_key = row->block->parent->key;
}
RD_WatchViewPoint new_pt = {0, parent_key, key};
RD_WatchViewPoint new_pt = {parent_key, key, 0};
next_cursor_pt = new_pt;
next_cursor_set = 1;
}
@@ -1938,7 +1944,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
}
else if(tbl.y != 0 && (col->kind == RD_WatchViewColumnKind_Value || col->kind == RD_WatchViewColumnKind_Member) && row_kind == RD_WatchViewRowKind_Normal)
{
E_Expr *expr = rd_expr_from_watch_view_row_column(scratch.arena, eval_view, row, col);
E_Expr *expr = rd_expr_from_watch_view_row_column(scratch.arena, row, col);
E_Eval dst_eval = e_eval_from_expr(scratch.arena, expr);
rd_commit_eval_value_string(dst_eval, str8_zero(), 0);
}
@@ -2187,7 +2193,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
//- rjf: build ui
//
B32 pressed = 0;
if(!is_top_level_hook) ProfScope("build ui")
ProfScope("build ui")
{
F32 **col_pcts = push_array(scratch.arena, F32*, ewv->column_count);
{
@@ -2293,7 +2299,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
ui_view_rule_params_root = &md_nil_node;
}
RD_WatchViewRowInfo row_info = rd_watch_view_row_info_from_row(row);
RD_WatchViewRowKind row_kind = rd_watch_view_row_kind_from_flags_row_info(flags, row, &row_info);
RD_WatchCellList row_cells = rd_watch_cell_list_from_row_info(scratch.arena, row, &row_info);
ProfEnd();
////////////////////////
@@ -2346,6 +2352,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
palette = ui_build_palette(ui_top_palette(), .background = rd_rgba_from_theme_color(RD_ThemeColor_BaseBackgroundAlt));
row_flags |= UI_BoxFlag_DrawBackground;
}
#if 0 // TODO(rjf): @cfg
switch(row_kind)
{
default:{}break;
@@ -2354,6 +2361,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
case RD_WatchViewRowKind_Canvas:{row_flags |= UI_BoxFlag_Clip|UI_BoxFlag_DrawBorder;}break;
case RD_WatchViewRowKind_PrettyEntityControls:{row_flags |= UI_BoxFlag_DisableFocusOverlay;}break;
}
#endif
}
ProfEnd();
@@ -2372,6 +2380,587 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
//////////////////////
//- rjf: build row contents
//
RD_RegsScope(.module = row_module->handle) UI_Parent(row_box)
{
////////////////////
//- rjf: draw start of cache lines in expansions
//
if(!(flags & RD_WatchViewFlag_DisableCacheLines))
{
U64 row_offset = row_eval.value.u64;
if((row_eval.mode == E_Mode_Offset || row_eval.mode == E_Mode_Null) &&
row_offset%64 == 0 && row_depth > 0)
{
ui_set_next_fixed_x(0);
ui_set_next_fixed_y(0);
ui_set_next_fixed_height(ui_top_font_size()*0.2f);
ui_set_next_palette(ui_build_palette(ui_top_palette(), .background = rd_rgba_from_theme_color(RD_ThemeColor_CacheLineBoundary)));
ui_build_box_from_key(UI_BoxFlag_Floating|UI_BoxFlag_DrawBackground, ui_key_zero());
}
}
////////////////////
//- rjf: draw mid-row cache line boundaries in expansions
//
if(!(flags & RD_WatchViewFlag_DisableCacheLines))
{
if((row_eval.mode == E_Mode_Offset || row_eval.mode == E_Mode_Null) &&
row_eval.value.u64%64 != 0 &&
row_depth > 0 &&
!row_expanded)
{
U64 next_off = (row_eval.value.u64 + e_type_byte_size_from_key(row_eval.type_key));
if(next_off%64 != 0 && row_eval.value.u64/64 < next_off/64)
{
ui_set_next_fixed_x(0);
ui_set_next_fixed_y(scroll_list_params.row_height_px - ui_top_font_size()*0.5f);
ui_set_next_fixed_height(ui_top_font_size()*1.f);
Vec4F32 boundary_color = rd_rgba_from_theme_color(RD_ThemeColor_CacheLineBoundary);
boundary_color.w *= 0.5f;
ui_set_next_palette(ui_build_palette(ui_top_palette(), .background = boundary_color));
ui_build_box_from_key(UI_BoxFlag_Floating|UI_BoxFlag_DrawBackground, ui_key_zero());
}
}
}
////////////////////
//- rjf: build all cells
//
for(RD_WatchCell *cell = row_cells.first; cell != 0; cell = cell->next)
{
#if 0 // TODO(rjf): @cfg
//- rjf: unpack cell info
RD_WatchViewPoint cell_pt = {x, row->block->key, row->key};
RD_WatchViewTextEditState *cell_edit_state = rd_watch_view_text_edit_state_from_pt(ewv, cell_pt);
B32 cell_selected = (row_selected && selection_tbl.min.x <= cell_pt.x && cell_pt.x <= selection_tbl.max.x);
String8 cell_pre_edit_string = rd_string_from_eval_viz_row_column(scratch.arena, eval_view, row, col, string_flags|EV_StringFlag_ReadOnlyDisplayRules, default_radix, ui_top_font(), ui_top_font_size(), row_string_max_size_px);
//- rjf: unpack column-kind-specific info
ProfBegin("unpack column-kind-specific info");
E_Eval cell_eval = row_eval;
E_Type *cell_type = row_type;
B32 cell_can_edit = 0;
FuzzyMatchRangeList cell_matches = {0};
String8 cell_inheritance_string = {0};
String8 cell_error_string = {0};
String8 cell_error_tooltip_string = {0};
RD_ListerFlags cell_autocomp_flags = 0;
RD_ViewRuleUIFunctionType *cell_ui_hook = 0;
MD_Node *cell_ui_params = &md_nil_node;
Vec4F32 cell_base_color = ui_top_palette()->text;
RD_IconKind cell_icon = RD_IconKind_Null;
String8 cell_ghost_text = {0};
switch(col->kind)
{
default:{}break;
case RD_WatchViewColumnKind_Expr:
{
cell_can_edit = (row_depth == 0 && modifiable && filter.size == 0);
if(filter.size != 0)
{
cell_matches = fuzzy_match_find(scratch.arena, filter, ev_expr_string_from_row(scratch.arena, row, string_flags));
}
cell_autocomp_flags = (RD_ListerFlag_Locals|
RD_ListerFlag_Procedures|
RD_ListerFlag_Globals|
RD_ListerFlag_ThreadLocals|
RD_ListerFlag_Types);
if(row->member != 0 && row->member->inheritance_key_chain.first != 0)
{
String8List inheritance_chain_type_names = {0};
for(E_TypeKeyNode *n = row->member->inheritance_key_chain.first; n != 0; n = n->next)
{
String8 inherited_type_name = e_type_string_from_key(scratch.arena, n->v);
inherited_type_name = str8_skip_chop_whitespace(inherited_type_name);
str8_list_push(scratch.arena, &inheritance_chain_type_names, inherited_type_name);
}
if(inheritance_chain_type_names.node_count != 0)
{
StringJoin join = {0};
join.sep = str8_lit("::");
String8 inheritance_type = str8_list_join(scratch.arena, &inheritance_chain_type_names, &join);
cell_inheritance_string = inheritance_type;
}
}
}break;
case RD_WatchViewColumnKind_Value:
{
}goto value_cell;
case RD_WatchViewColumnKind_Member:
{
E_Expr *expr = rd_expr_from_watch_view_row_column(scratch.arena, eval_view, row, col);
cell_eval = e_eval_from_expr(scratch.arena, expr);
cell_type = e_type_from_key(scratch.arena, cell_eval.type_key);
}goto value_cell;
value_cell:;
{
E_MsgList msgs = cell_eval.msgs;
if(row_depth == 0 && row->string.size != 0)
{
E_TokenArray tokens = e_token_array_from_text(scratch.arena, row->string);
E_Parse parse = e_parse_expr_from_text_tokens(scratch.arena, row->string, &tokens);
e_msg_list_concat_in_place(&parse.msgs, &msgs);
msgs = parse.msgs;
}
if(msgs.max_kind > E_MsgKind_Null)
{
String8List strings = {0};
for(E_Msg *msg = msgs.first; msg != 0; msg = msg->next)
{
str8_list_push(scratch.arena, &strings, msg->text);
}
StringJoin join = {str8_lit(""), str8_lit(" "), str8_lit("")};
cell_error_string = str8_list_join(scratch.arena, &strings, &join);
}
if(row_is_bad)
{
cell_error_tooltip_string = str8_lit("Could not read memory successfully.");
}
cell_autocomp_flags = (RD_ListerFlag_Locals|
RD_ListerFlag_Procedures|
RD_ListerFlag_Globals|
RD_ListerFlag_ThreadLocals|
RD_ListerFlag_Types);
if(cell_type->flags & E_TypeFlag_IsPathText)
{
cell_autocomp_flags = RD_ListerFlag_Files;
}
if(ui_view_rule_info->flags & RD_ViewRuleInfoFlag_CanFillValueCell)
{
cell_ui_hook = ui_view_rule_info->ui;
cell_ui_params = ui_view_rule_params_root;
}
for(EV_ViewRuleNode *n = row->view_rules->first; n != 0; n = n->next)
{
EV_ViewRule *vr = &n->v;
RD_ViewRuleInfo *info = rd_view_rule_info_from_string(vr->root->string);
if(info->flags & RD_ViewRuleInfoFlag_CanFillValueCell && info->ui != 0)
{
cell_ui_hook = info->ui;
cell_ui_params = vr->root;
}
}
cell_can_edit = ev_type_key_is_editable(cell_eval.type_key);
}break;
case RD_WatchViewColumnKind_Type:
{
cell_can_edit = 0;
}break;
case RD_WatchViewColumnKind_ViewRule:
{
cell_can_edit = 1;
cell_autocomp_flags = RD_ListerFlag_ViewRules;
if(cell_pre_edit_string.size == 0)
{
EV_ViewRuleList *auto_view_rules = ev_auto_view_rules_from_type_key(scratch.arena, row_eval.type_key, 0, 1);
String8List strings = {0};
for(EV_ViewRuleNode *n = auto_view_rules->first; n != 0; n = n->next)
{
str8_list_push(scratch.arena, &strings, n->v.root->string);
}
cell_ghost_text = str8_list_join(scratch.arena, &strings, &(StringJoin){.sep = str8_lit(", ")});
}
}break;
case RD_WatchViewColumnKind_CallStackFrameSelection:
{
if(ctrl_handle_match(row_info.callstack_thread->handle, rd_regs()->thread) &&
row_info.callstack_unwind_index == rd_regs()->unwind_count &&
row_info.callstack_inline_depth == rd_regs()->inline_depth)
{
cell_icon = RD_IconKind_RightArrow;
cell_base_color = rd_rgba_from_ctrl_entity(row_info.callstack_thread);
}
}break;
}
ProfEnd();
//- rjf: apply column-specified view rules
ProfBegin("apply column-specified view rules");
if(col->view_rule_size != 0)
{
String8 col_view_rule = str8(col->view_rule_buffer, col->view_rule_size);
EV_ViewRuleList *view_rules = ev_view_rule_list_from_string(scratch.arena, col_view_rule);
for(EV_ViewRuleNode *n = view_rules->first; n != 0; n = n->next)
{
EV_ViewRule *vr = &n->v;
RD_ViewRuleInfo *info = rd_view_rule_info_from_string(vr->root->string);
if(info->flags & RD_ViewRuleInfoFlag_CanFillValueCell && info->ui != 0)
{
cell_ui_hook = info->ui;
cell_ui_params = vr->root;
}
}
}
ProfEnd();
//- rjf: determine cell's palette
ProfBegin("determine cell's palette");
UI_BoxFlags cell_flags = 0;
UI_Palette *palette = ui_top_palette();
{
if(cell_error_tooltip_string.size != 0 ||
cell_error_string.size != 0)
{
palette = ui_build_palette(ui_top_palette(), .text = rd_rgba_from_theme_color(RD_ThemeColor_TextNegative), .text_weak = rd_rgba_from_theme_color(RD_ThemeColor_TextNegative), .background = rd_rgba_from_theme_color(RD_ThemeColor_HighlightOverlayError));
cell_flags |= UI_BoxFlag_DrawBackground;
}
else if(cell_inheritance_string.size != 0)
{
palette = ui_build_palette(ui_top_palette(), .background = rd_rgba_from_theme_color(RD_ThemeColor_HighlightOverlay));
cell_flags |= UI_BoxFlag_DrawBackground;
}
else
{
palette = ui_build_palette(ui_top_palette(), .text = cell_base_color);
}
}
ProfEnd();
//- rjf: determine if cell needs code styling
B32 cell_is_code = !col->is_non_code;
switch(col->kind)
{
default:{}break;
case RD_WatchViewColumnKind_Expr:
{
cell_is_code = 1;
if(row->member != 0 && row->member->pretty_name.size != 0 && flags & RD_WatchViewFlag_PrettyNameMembers)
{
cell_is_code = 0;
}
}break;
case RD_WatchViewColumnKind_Value:
case RD_WatchViewColumnKind_Member:
{
if(cell_type->flags & E_TypeFlag_IsCodeText)
{
cell_is_code = 1;
}
else if(cell_type->flags & E_TypeFlag_IsPathText ||
cell_type->flags & E_TypeFlag_IsPlainText)
{
cell_is_code = 0;
}
}break;
}
//- rjf: build cell
UI_Signal sig = {0};
ProfScope("build cell")
UI_Palette(palette)
UI_TableCell
UI_FocusHot(cell_selected ? UI_FocusKind_On : UI_FocusKind_Off)
UI_FocusActive((cell_selected && ewv->text_editing) ? UI_FocusKind_On : UI_FocusKind_Off)
RD_Font(cell_is_code ? RD_FontSlot_Code : RD_FontSlot_Main)
UI_FlagsAdd(row_depth > 0 ? UI_BoxFlag_DrawTextWeak : 0)
{
ui_set_next_flags(ui_top_flags() | cell_flags);
// rjf: cell has errors? -> build error box
if(cell_error_string.size != 0) RD_Font(RD_FontSlot_Main)
{
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_Clip|UI_BoxFlag_Clickable, "###%I64x_row_%I64x", x, row_hash);
sig = ui_signal_from_box(box);
UI_Parent(box) UI_Flags(0)
{
rd_error_label(cell_error_string);
}
}
// rjf: cell has hook? -> build ui by calling hook
else if(cell_ui_hook != 0)
{
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_Clip|UI_BoxFlag_Clickable, "###val_%I64x", row_hash);
UI_Parent(box)
{
String8 row_expr = e_string_from_expr(scratch.arena, row->expr);
cell_ui_hook(row_expr, cell_ui_params, r2f32p(x_px, 0, x_px + col->pct*dim_2f32(rect).x, row_height_px));
}
sig = ui_signal_from_box(box);
}
// rjf: cell has icon? build icon
else if(cell_icon != RD_IconKind_Null)
{
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_Clickable, "###cell_%I64x", row_hash);
UI_Parent(box) RD_Font(RD_FontSlot_Icons) UI_WidthFill UI_TextAlignment(UI_TextAlign_Center)
{
ui_label(rd_icon_kind_text_table[cell_icon]);
}
sig = ui_signal_from_box(box);
}
// rjf: build cell line edit
else
{
sig = rd_line_editf((RD_LineEditFlag_CodeContents*(!!cell_is_code)|
RD_LineEditFlag_NoBackground|
RD_LineEditFlag_KeyboardClickable|
RD_LineEditFlag_DisableEdit*(!cell_can_edit)|
RD_LineEditFlag_Expander*!!(x == 0 && row_is_expandable && cell == row_cells.first)|
RD_LineEditFlag_ExpanderPlaceholder*(x == 0 && row_depth==0 && cell == row_cells.first)|
RD_LineEditFlag_ExpanderSpace*(x == 0 && row_depth!=0 && cell == row_cells.first)),
x == 0 ? row_depth : 0,
&cell_matches,
&cell_edit_state->cursor, &cell_edit_state->mark, cell_edit_state->input_buffer, sizeof(cell_edit_state->input_buffer), &cell_edit_state->input_size, &next_row_expanded,
cell_pre_edit_string,
"%S###%I64x_row_%I64x", cell_ghost_text, x, row_hash);
if(ui_is_focus_active() &&
selection_tbl.min.x == selection_tbl.max.x && selection_tbl.min.y == selection_tbl.max.y &&
txt_pt_match(cell_edit_state->cursor, cell_edit_state->mark))
{
String8 input = str8(cell_edit_state->input_buffer, cell_edit_state->input_size);
rd_set_autocomp_lister_query(.ui_key = sig.box->key,
.off_px = v2f32(0, dim_2f32(sig.box->rect).y),
.string = input,
.cursor = cell_edit_state->cursor,
.lister_flags = cell_autocomp_flags);
}
}
}
//- rjf: handle interactions
{
// rjf: single-click -> move selection here
if(ui_pressed(sig))
{
ewv->next_cursor = ewv->next_mark = cell_pt;
pressed = 1;
}
// rjf: double-click actions
if(ui_double_clicked(sig) || sig.f & UI_SignalFlag_KeyboardPressed)
{
ui_kill_action();
// rjf: has callstack info? -> select unwind
if(row_info.callstack_thread != &ctrl_entity_nil)
{
rd_cmd(RD_CmdKind_SelectThread, .thread = row_info.callstack_thread->handle);
rd_cmd(RD_CmdKind_SelectUnwind,
.unwind_count = row_info.callstack_unwind_index,
.inline_depth = row_info.callstack_inline_depth);
}
// rjf: can edit? -> begin editing
else if(cell_can_edit)
{
rd_cmd(RD_CmdKind_Edit);
}
// rjf: cannot edit, has addr info? -> go to address
else if(row_kind == RD_WatchViewRowKind_Normal &&
(col->kind == RD_WatchViewColumnKind_Value ||
col->kind == RD_WatchViewColumnKind_Member) &&
cell_eval.space.kind == RD_EvalSpaceKind_CtrlEntity)
{
CTRL_Entity *entity = rd_ctrl_entity_from_eval_space(cell_eval.space);
CTRL_Entity *process = ctrl_process_from_entity(entity);
if(process != &ctrl_entity_nil)
{
U64 vaddr = cell_eval.value.u64;
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, vaddr);
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
U64 voff = ctrl_voff_from_vaddr(module, vaddr);
D_LineList lines = d_lines_from_dbgi_key_voff(scratch.arena, &dbgi_key, voff);
String8 file_path = {0};
TxtPt pt = {0};
if(lines.first != 0)
{
file_path = lines.first->v.file_path;
pt = lines.first->v.pt;
}
rd_cmd(RD_CmdKind_FindCodeLocation,
.process = process->handle,
.vaddr = vaddr,
.file_path = file_path,
.cursor = pt);
}
}
}
// rjf: hovering with inheritance string -> show tooltip
if(ui_hovering(sig) && cell_inheritance_string.size != 0) UI_Tooltip
{
UI_PrefWidth(ui_children_sum(1)) UI_Row UI_PrefWidth(ui_text_dim(1, 1)) UI_TextPadding(0)
{
ui_labelf("Inherited from ");
RD_Font(RD_FontSlot_Code) rd_code_label(1.f, 0, rd_rgba_from_theme_color(RD_ThemeColor_CodeDefault), cell_inheritance_string);
}
}
// rjf: hovering with error tooltip -> show tooltip
if(ui_hovering(sig) && cell_error_tooltip_string.size != 0) UI_Tooltip
{
UI_PrefWidth(ui_children_sum(1)) rd_error_label(cell_error_tooltip_string);
}
}
//- rjf: bump x pixel coordinate
x_px += col->pct*dim_2f32(rect).x;
//- rjf: [DEV] hovering -> watch key tooltips
if(DEV_eval_watch_key_tooltips && ui_hovering(sig)) UI_Tooltip RD_Font(RD_FontSlot_Code)
{
ui_labelf("Block Key: {0x%I64x, %I64u}", row->block->key.parent_hash, row->block->key.child_id);
ui_labelf("Row Key: {0x%I64x, %I64u}", row->key.parent_hash, row->key.child_id);
ui_labelf("Cursor Key: {0x%I64x, %I64u}", ewv->cursor.key.parent_hash, ewv->cursor.key.child_id);
ui_spacer(ui_em(1.f, 1.f));
ui_labelf("Cursor Table Coordinates: {%I64u, %I64u}", selection_tbl.min.x, selection_tbl.min.y);
}
//- rjf: [DEV] hovering -> eval system tooltips
if(DEV_eval_compiler_tooltips && ui_hovering(sig)) UI_Tooltip RD_Font(RD_FontSlot_Code)
{
local_persist char *spaces = " ";
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);
E_OpList oplist = e_oplist_from_irtree(scratch.arena, irtree.root);
String8 bytecode = e_bytecode_from_oplist(scratch.arena, &oplist);
UI_Flags(UI_BoxFlag_DrawTextWeak) ui_labelf("Text:");
ui_label(string);
ui_spacer(ui_em(2.f, 1.f));
UI_Flags(UI_BoxFlag_DrawTextWeak) ui_labelf("Tokens:");
for(U64 idx = 0; idx < tokens.count; idx += 1)
{
ui_labelf("%S: '%S'", e_token_kind_strings[tokens.v[idx].kind], str8_substr(string, tokens.v[idx].range));
}
ui_spacer(ui_em(2.f, 1.f));
UI_Flags(UI_BoxFlag_DrawTextWeak) ui_labelf("Expression:");
{
typedef struct Task Task;
struct Task
{
Task *next;
Task *prev;
E_Expr *expr;
S64 depth;
};
Task start_task = {0, 0, parse.expr};
Task *first_task = &start_task;
Task *last_task = first_task;
for(Task *t = first_task; t != 0; t = t->next)
{
String8 ext = {0};
switch(t->expr->kind)
{
default:
{
if(t->expr->string.size != 0)
{
ext = push_str8f(scratch.arena, "'%S'", t->expr->string);
}
else if(t->expr->value.u32 != 0)
{
ext = push_str8f(scratch.arena, "0x%x", t->expr->value.u32);
}
else if(t->expr->value.f32 != 0)
{
ext = push_str8f(scratch.arena, "%f", t->expr->value.f32);
}
else if(t->expr->value.f64 != 0)
{
ext = push_str8f(scratch.arena, "%f", t->expr->value.f64);
}
else if(t->expr->value.u64 != 0)
{
ext = push_str8f(scratch.arena, "0x%I64x", t->expr->value.u64);
}
}break;
}
ui_labelf("%.*s%S%s%S", (int)t->depth*2, spaces, e_expr_kind_strings[t->expr->kind], ext.size ? " " : "", ext);
for(E_Expr *child = t->expr->first; child != &e_expr_nil; child = child->next)
{
Task *task = push_array(scratch.arena, Task, 1);
task->expr = child;
task->depth = t->depth+1;
DLLInsert(first_task, last_task, t, task);
}
}
}
ui_spacer(ui_em(2.f, 1.f));
UI_Flags(UI_BoxFlag_DrawTextWeak) ui_labelf("IR Tree:");
{
typedef struct Task Task;
struct Task
{
Task *next;
Task *prev;
E_IRNode *node;
S64 depth;
};
Task start_task = {0, 0, irtree.root};
Task *first_task = &start_task;
Task *last_task = first_task;
for(Task *t = first_task; t != 0; t = t->next)
{
String8 op_string = {0};
switch(t->node->op)
{
default:{}break;
case E_IRExtKind_Bytecode:{op_string = str8_lit("Bytecode");}break;
case E_IRExtKind_SetSpace:{op_string = str8_lit("SetSpace");}break;
#define X(name) case RDI_EvalOp_##name:{op_string = str8_lit(#name);}break;
RDI_EvalOp_XList
#undef X
}
String8 ext = {0};
ui_labelf("%.*s%S", (int)t->depth*2, spaces, op_string);
for(E_IRNode *child = t->node->first; child != &e_irnode_nil; child = child->next)
{
Task *task = push_array(scratch.arena, Task, 1);
task->node = child;
task->depth = t->depth+1;
DLLInsert(first_task, last_task, t, task);
}
}
}
ui_spacer(ui_em(2.f, 1.f));
UI_Flags(UI_BoxFlag_DrawTextWeak) ui_labelf("Op List:");
{
for(E_Op *op = oplist.first; op != 0; op = op->next)
{
String8 op_string = {0};
switch(op->opcode)
{
default:{}break;
case E_IRExtKind_Bytecode:{op_string = str8_lit("Bytecode");}break;
case E_IRExtKind_SetSpace:{op_string = str8_lit("SetSpace");}break;
#define X(name) case RDI_EvalOp_##name:{op_string = str8_lit(#name);}break;
RDI_EvalOp_XList
#undef X
}
String8 ext = {0};
switch(op->opcode)
{
case E_IRExtKind_Bytecode:{ext = str8_lit("[bytecode]");}break;
default:
{
ext = str8_from_u64(scratch.arena, op->value.u64, 16, 0, 0);
}break;
}
ui_labelf(" %S%s%S", op_string, ext.size ? " " : "", ext);
}
}
ui_spacer(ui_em(2.f, 1.f));
UI_Flags(UI_BoxFlag_DrawTextWeak) ui_labelf("Bytecode:");
{
for(U64 idx = 0; idx < bytecode.size; idx += 1)
{
ui_labelf(" 0x%x ('%c')", (U32)bytecode.str[idx], (char)bytecode.str[idx]);
}
}
}
#endif
}
}
//////////////////////
//- rjf: build row contents
//
#if 0 // TODO(rjf): @cfg
RD_RegsScope(.module = row_module->handle) UI_Parent(row_box) switch(row_kind)
{
////////////////////
@@ -3416,6 +4005,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
}
}break;
}
#endif
//////////////////////
//- rjf: commit expansion state changes
@@ -3432,14 +4022,13 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
//////////////////////////////
//- rjf: general table-wide press logic
//
if(!is_top_level_hook) if(pressed)
if(pressed)
{
rd_cmd(RD_CmdKind_FocusPanel);
}
if(!is_top_level_hook) { rd_store_view_scroll_pos(scroll_pos); }
rd_store_view_scroll_pos(scroll_pos);
scratch_end(scratch);
di_scope_close(di_scope);
ProfEnd();
}
+42 -3
View File
@@ -50,6 +50,37 @@ enum
RD_WatchViewFlag_DisableCacheLines = (1<<3),
};
typedef enum RD_WatchCellKind
{
RD_WatchCellKind_Expr,
RD_WatchCellKind_Value,
RD_WatchCellKind_Type,
RD_WatchCellKind_ViewRule,
RD_WatchCellKind_Member,
RD_WatchCellKind_CallStackFrame,
RD_WatchCellKind_CallStackFrameSelection,
RD_WatchCellKind_Module,
}
RD_WatchCellKind;
typedef struct RD_WatchCell RD_WatchCell;
struct RD_WatchCell
{
RD_WatchCell *next;
RD_WatchCellKind kind;
F32 pct;
String8 member;
String8 view_rule;
};
typedef struct RD_WatchCellList RD_WatchCellList;
struct RD_WatchCellList
{
RD_WatchCell *first;
RD_WatchCell *last;
U64 count;
};
typedef enum RD_WatchViewColumnKind
{
RD_WatchViewColumnKind_Expr,
@@ -113,9 +144,9 @@ RD_WatchViewRowKind;
typedef struct RD_WatchViewPoint RD_WatchViewPoint;
struct RD_WatchViewPoint
{
S64 x;
EV_Key parent_key;
EV_Key key;
U64 cell_id;
};
typedef struct RD_WatchViewRowInfo RD_WatchViewRowInfo;
@@ -178,6 +209,11 @@ internal RD_CodeViewBuildResult rd_code_view_build(Arena *arena, RD_CodeViewStat
////////////////////////////////
//~ rjf: Watch View Functions
//- rjf: cell list building
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__})
//- rjf: index -> column
internal RD_WatchViewColumn *rd_watch_view_column_from_x(RD_WatchViewState *wv, S64 index);
@@ -192,9 +228,12 @@ internal RD_WatchViewRowInfo rd_watch_view_row_info_from_row(EV_Row *row);
//- rjf: watch view flags & row & row info -> row kind
internal RD_WatchViewRowKind rd_watch_view_row_kind_from_flags_row_info(RD_WatchViewFlags flags, EV_Row *row, RD_WatchViewRowInfo *info);
//- rjf: row info -> cell list
internal RD_WatchCellList rd_watch_cell_list_from_row_info(Arena *arena, EV_Row *row, RD_WatchViewRowInfo *info);
//- rjf: row/column -> exprs / strings
internal E_Expr *rd_expr_from_watch_view_row_column(Arena *arena, EV_View *ev_view, EV_Row *row, RD_WatchViewColumn *col);
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);
internal E_Expr *rd_expr_from_watch_view_row_column(Arena *arena, EV_Row *row, RD_WatchViewColumn *col);
internal String8 rd_string_from_eval_viz_row_column(Arena *arena, 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);