entity name -> string

This commit is contained in:
Ryan Fleury
2024-08-29 11:48:55 -07:00
parent bb553b4ec0
commit 0f4d2cfbc1
4 changed files with 116 additions and 111 deletions
+17 -17
View File
@@ -3774,11 +3774,11 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds)
D_Entity *dst = d_entity_from_handle(e->entity_handle);
if(!d_entity_is_nil(dst))
{
ui_labelf("[link] %S -> %S", e->name, dst->name);
ui_labelf("[link] %S -> %S", e->string, dst->string);
}
else
{
ui_labelf("%S: %S", d_entity_kind_display_string_table[e->kind], e->name);
ui_labelf("%S: %S", d_entity_kind_display_string_table[e->kind], e->string);
}
}
rec = d_entity_rec_depth_first_pre(e, d_entity_root());
@@ -3972,7 +3972,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds)
// rjf: name editor
if(kind_flags & D_EntityKindFlag_CanRename) UI_TextPadding(ui_top_font_size()*1.5f)
{
UI_Signal sig = df_line_editf(DF_LineEditFlag_Border, 0, 0, &ws->entity_ctx_menu_input_cursor, &ws->entity_ctx_menu_input_mark, ws->entity_ctx_menu_input_buffer, sizeof(ws->entity_ctx_menu_input_buffer), &ws->entity_ctx_menu_input_size, 0, entity->name, "%S###entity_name_edit_%p", d_entity_kind_name_label_table[entity->kind], entity);
UI_Signal sig = df_line_editf(DF_LineEditFlag_Border, 0, 0, &ws->entity_ctx_menu_input_cursor, &ws->entity_ctx_menu_input_mark, ws->entity_ctx_menu_input_buffer, sizeof(ws->entity_ctx_menu_input_buffer), &ws->entity_ctx_menu_input_size, 0, entity->string, "%S###entity_name_edit_%p", d_entity_kind_name_label_table[entity->kind], entity);
if(ui_committed(sig))
{
d_cmd(D_CmdKind_NameEntity,
@@ -3987,7 +3987,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds)
UI_TextPadding(ui_top_font_size()*1.5f)
{
D_Entity *condition = d_entity_child_from_kind(entity, D_EntityKind_Condition);
UI_Signal sig = df_line_editf(DF_LineEditFlag_Border|DF_LineEditFlag_CodeContents, 0, 0, &ws->entity_ctx_menu_input_cursor, &ws->entity_ctx_menu_input_mark, ws->entity_ctx_menu_input_buffer, sizeof(ws->entity_ctx_menu_input_buffer), &ws->entity_ctx_menu_input_size, 0, condition->name, "Condition###entity_cond_edit_%p", entity);
UI_Signal sig = df_line_editf(DF_LineEditFlag_Border|DF_LineEditFlag_CodeContents, 0, 0, &ws->entity_ctx_menu_input_cursor, &ws->entity_ctx_menu_input_mark, ws->entity_ctx_menu_input_buffer, sizeof(ws->entity_ctx_menu_input_buffer), &ws->entity_ctx_menu_input_size, 0, condition->string, "Condition###entity_cond_edit_%p", entity);
if(ui_committed(sig))
{
String8 new_string = str8(ws->entity_ctx_menu_input_buffer, ws->entity_ctx_menu_input_size);
@@ -4010,7 +4010,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds)
if(entity->kind == D_EntityKind_Target) UI_TextPadding(ui_top_font_size()*1.5f)
{
D_Entity *exe = d_entity_child_from_kind(entity, D_EntityKind_Executable);
UI_Signal sig = df_line_editf(DF_LineEditFlag_Border, 0, 0, &ws->entity_ctx_menu_input_cursor, &ws->entity_ctx_menu_input_mark, ws->entity_ctx_menu_input_buffer, sizeof(ws->entity_ctx_menu_input_buffer), &ws->entity_ctx_menu_input_size, 0, exe->name, "Executable###entity_exe_edit_%p", entity);
UI_Signal sig = df_line_editf(DF_LineEditFlag_Border, 0, 0, &ws->entity_ctx_menu_input_cursor, &ws->entity_ctx_menu_input_mark, ws->entity_ctx_menu_input_buffer, sizeof(ws->entity_ctx_menu_input_buffer), &ws->entity_ctx_menu_input_size, 0, exe->string, "Executable###entity_exe_edit_%p", entity);
if(ui_committed(sig))
{
String8 new_string = str8(ws->entity_ctx_menu_input_buffer, ws->entity_ctx_menu_input_size);
@@ -4033,7 +4033,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds)
if(entity->kind == D_EntityKind_Target) UI_TextPadding(ui_top_font_size()*1.5f)
{
D_Entity *args = d_entity_child_from_kind(entity, D_EntityKind_Arguments);
UI_Signal sig = df_line_editf(DF_LineEditFlag_Border, 0, 0, &ws->entity_ctx_menu_input_cursor, &ws->entity_ctx_menu_input_mark, ws->entity_ctx_menu_input_buffer, sizeof(ws->entity_ctx_menu_input_buffer), &ws->entity_ctx_menu_input_size, 0, args->name, "Arguments###entity_args_edit_%p", entity);
UI_Signal sig = df_line_editf(DF_LineEditFlag_Border, 0, 0, &ws->entity_ctx_menu_input_cursor, &ws->entity_ctx_menu_input_mark, ws->entity_ctx_menu_input_buffer, sizeof(ws->entity_ctx_menu_input_buffer), &ws->entity_ctx_menu_input_size, 0, args->string, "Arguments###entity_args_edit_%p", entity);
if(ui_committed(sig))
{
String8 new_string = str8(ws->entity_ctx_menu_input_buffer, ws->entity_ctx_menu_input_size);
@@ -4121,7 +4121,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds)
if(!d_entity_is_nil(loc) && ui_clicked(df_icon_buttonf(DF_IconKind_FileOutline, 0, "Go To Location")))
{
d_cmd(D_CmdKind_FindCodeLocation,
.file_path = loc->name,
.file_path = loc->string,
.text_point = loc->text_point,
.vaddr = loc->vaddr);
ui_ctx_menu_close();
@@ -4194,17 +4194,17 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds)
RDI_InlineSite *inline_site = inline_frame->inline_site;
String8 name = {0};
name.str = rdi_string_from_idx(rdi, inline_site->name_string_idx, &name.size);
str8_list_pushf(scratch.arena, &lines, "0x%I64x: [inlined] \"%S\"%s%S", rip_vaddr, name, d_entity_is_nil(module) ? "" : " in ", module->name);
str8_list_pushf(scratch.arena, &lines, "0x%I64x: [inlined] \"%S\"%s%S", rip_vaddr, name, d_entity_is_nil(module) ? "" : " in ", module->string);
}
if(procedure != 0)
{
String8 name = {0};
name.str = rdi_name_from_procedure(rdi, procedure, &name.size);
str8_list_pushf(scratch.arena, &lines, "0x%I64x: \"%S\"%s%S", rip_vaddr, name, d_entity_is_nil(module) ? "" : " in ", module->name);
str8_list_pushf(scratch.arena, &lines, "0x%I64x: \"%S\"%s%S", rip_vaddr, name, d_entity_is_nil(module) ? "" : " in ", module->string);
}
else if(!d_entity_is_nil(module))
{
str8_list_pushf(scratch.arena, &lines, "0x%I64x: [??? in %S]", rip_vaddr, module->name);
str8_list_pushf(scratch.arena, &lines, "0x%I64x: [??? in %S]", rip_vaddr, module->string);
}
else
{
@@ -4235,13 +4235,13 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds)
UI_Signal copy_full_path_sig = df_icon_buttonf(DF_IconKind_Clipboard, 0, "Copy Full Path");
if(ui_clicked(copy_full_path_sig))
{
String8 string = entity->name;
String8 string = entity->string;
os_set_clipboard_text(string);
ui_ctx_menu_close();
}
if(ui_hovering(copy_full_path_sig)) UI_Tooltip
{
String8 string = entity->name;
String8 string = entity->string;
ui_label(string);
}
if(ui_clicked(df_icon_buttonf(DF_IconKind_Clipboard, 0, "Copy Base Address")))
@@ -5301,7 +5301,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds)
D_Entity *task = n->entity;
if(task->alloc_time_us + 500000 < os_now_microseconds())
{
String8 rdi_path = task->name;
String8 rdi_path = task->string;
String8 rdi_name = str8_skip_last_slash(rdi_path);
String8 task_text = push_str8f(scratch.arena, "Creating %S...", rdi_name);
UI_Key key = ui_key_from_stringf(ui_key_zero(), "task_%p", task);
@@ -10060,7 +10060,7 @@ df_entity_tooltips(D_Entity *entity)
RDI_Procedure *procedure = f->procedure;
U64 rip_vaddr = regs_rip_from_arch_block(entity->arch, f->regs);
D_Entity *module = d_module_from_process_vaddr(process, rip_vaddr);
String8 module_name = d_entity_is_nil(module) ? str8_lit("???") : str8_skip_last_slash(module->name);
String8 module_name = d_entity_is_nil(module) ? str8_lit("???") : str8_skip_last_slash(module->string);
// rjf: inline frames
for(D_UnwindInlineFrame *fin = f->last_inline_frame; fin != 0; fin = fin->prev)
@@ -10115,7 +10115,7 @@ df_entity_tooltips(D_Entity *entity)
UI_PrefWidth(ui_text_dim(10, 1)) ui_label(display_string);
UI_PrefWidth(ui_children_sum(1)) UI_Row
{
String8 stop_condition = d_entity_child_from_kind(entity, D_EntityKind_Condition)->name;
String8 stop_condition = d_entity_child_from_kind(entity, D_EntityKind_Condition)->string;
if(stop_condition.size == 0)
{
stop_condition = str8_lit("true");
@@ -10242,7 +10242,7 @@ df_entity_desc_button(D_Entity *entity, FuzzyMatchRangeList *name_matches, Strin
if(entity->kind == D_EntityKind_Target) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) UI_FontSize(ui_top_font_size()*0.95f)
{
D_Entity *args = d_entity_child_from_kind(entity, D_EntityKind_Arguments);
ui_label(args->name);
ui_label(args->string);
}
if(kind_flags & D_EntityKindFlag_CanEnable && entity->disabled) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) UI_FontSize(ui_top_font_size()*0.95f) UI_HeightFill
{
@@ -11218,7 +11218,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
for(D_EntityNode *n = pins.first; n != 0; n = n->next)
{
D_Entity *pin = n->entity;
String8 pin_expr = pin->name;
String8 pin_expr = pin->string;
E_Eval eval = e_eval_from_string(scratch.arena, pin_expr);
String8 eval_string = {0};
if(!e_type_key_match(e_type_key_zero(), eval.type_key))
+16 -16
View File
@@ -206,7 +206,7 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie
{
D_Entity *bp = n->entity;
D_Entity *loc = d_entity_child_from_kind(bp, D_EntityKind_Location);
if(path_match_normalized(loc->name, d_regs()->file_path) &&
if(path_match_normalized(loc->string, d_regs()->file_path) &&
visible_line_num_range.min <= loc->text_point.line && loc->text_point.line <= visible_line_num_range.max)
{
U64 slice_line_idx = (loc->text_point.line-visible_line_num_range.min);
@@ -252,7 +252,7 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie
{
D_Entity *wp = n->entity;
D_Entity *loc = d_entity_child_from_kind(wp, D_EntityKind_Location);
if(path_match_normalized(loc->name, d_regs()->file_path) &&
if(path_match_normalized(loc->string, d_regs()->file_path) &&
visible_line_num_range.min <= loc->text_point.line && loc->text_point.line <= visible_line_num_range.max)
{
U64 slice_line_idx = (loc->text_point.line-visible_line_num_range.min);
@@ -1072,8 +1072,8 @@ df_watch_view_build(DF_View *view, DF_WatchViewState *ewv, B32 modifiable, U32 d
D_ExpandKey parent_key = d_parent_expand_key_from_entity(watch);
D_ExpandKey key = d_expand_key_from_entity(watch);
D_Entity *view_rule = d_entity_child_from_kind(watch, D_EntityKind_ViewRule);
d_eval_view_set_key_rule(eval_view, key, view_rule->name);
String8 expr_string = watch->name;
d_eval_view_set_key_rule(eval_view, key, view_rule->string);
String8 expr_string = watch->string;
FuzzyMatchRangeList matches = fuzzy_match_find(scratch.arena, filter, expr_string);
if(matches.count == matches.needle_part_count)
{
@@ -1138,7 +1138,7 @@ df_watch_view_build(DF_View *view, DF_WatchViewState *ewv, B32 modifiable, U32 d
}
D_ExpandKey parent_key = d_parent_expand_key_from_entity(wp);
D_ExpandKey key = d_expand_key_from_entity(wp);
String8 title = wp->name;
String8 title = wp->string;
FuzzyMatchRangeList matches = fuzzy_match_find(scratch.arena, filter, title);
if(matches.count == matches.needle_part_count)
{
@@ -2986,7 +2986,7 @@ DF_VIEW_UI_FUNCTION_DEF(getting_started)
case 1:
{
D_Entity *target = d_first_entity_from_list(&targets);
String8 target_full_path = target->name;
String8 target_full_path = target->string;
String8 target_name = str8_skip_last_slash(target_full_path);
UI_PrefHeight(ui_em(3.75f, 1.f))
UI_Row
@@ -4692,11 +4692,11 @@ DF_VIEW_UI_FUNCTION_DEF(target)
}
kv_info[] =
{
{ 0, 0, 0, str8_lit("Label"), D_EntityKind_Nil, entity->name },
{ 1, 0, 0, str8_lit("Executable"), D_EntityKind_Executable, d_entity_child_from_kind(entity, D_EntityKind_Executable)->name },
{ 0, 0, 0, str8_lit("Arguments"), D_EntityKind_Arguments, d_entity_child_from_kind(entity, D_EntityKind_Arguments)->name },
{ 0, 1, 0, str8_lit("Working Directory"), D_EntityKind_WorkingDirectory, d_entity_child_from_kind(entity, D_EntityKind_WorkingDirectory)->name },
{ 0, 0, 1, str8_lit("Entry Point Override"), D_EntityKind_EntryPoint, d_entity_child_from_kind(entity, D_EntityKind_EntryPoint)->name },
{ 0, 0, 0, str8_lit("Label"), D_EntityKind_Nil, entity->string },
{ 1, 0, 0, str8_lit("Executable"), D_EntityKind_Executable, d_entity_child_from_kind(entity, D_EntityKind_Executable)->string },
{ 0, 0, 0, str8_lit("Arguments"), D_EntityKind_Arguments, d_entity_child_from_kind(entity, D_EntityKind_Arguments)->string },
{ 0, 1, 0, str8_lit("Working Directory"), D_EntityKind_WorkingDirectory, d_entity_child_from_kind(entity, D_EntityKind_WorkingDirectory)->string },
{ 0, 0, 1, str8_lit("Entry Point Override"), D_EntityKind_EntryPoint, d_entity_child_from_kind(entity, D_EntityKind_EntryPoint)->string },
};
//- rjf: take controls to start/end editing
@@ -5243,8 +5243,8 @@ DF_VIEW_UI_FUNCTION_DEF(file_path_map)
D_Entity *map = (map_idx < maps.count ? maps.v[map_idx] : &d_nil_entity);
D_Entity *map_src = d_entity_child_from_kind(map, D_EntityKind_Source);
D_Entity *map_dst = d_entity_child_from_kind(map, D_EntityKind_Dest);
String8 map_src_path = map_src->name;
String8 map_dst_path = map_dst->name;
String8 map_src_path = map_src->string;
String8 map_dst_path = map_dst->string;
B32 row_selected = (fpms->cursor.y == row_idx);
//- rjf: src
@@ -5779,7 +5779,7 @@ DF_VIEW_CMD_FUNCTION_DEF(modules)
D_Entity *module = d_entity_from_handle(mv->pick_file_dst_entity);
if(module->kind == D_EntityKind_Module)
{
String8 exe_path = module->name;
String8 exe_path = module->string;
String8 dbg_path = pick_string;
// TODO(rjf)
}
@@ -6032,7 +6032,7 @@ DF_VIEW_UI_FUNCTION_DEF(modules)
mv->txt_editing = 0;
if(!d_entity_is_nil(commit_module))
{
String8 exe_path = commit_module->name;
String8 exe_path = commit_module->string;
String8 dbg_path = str8(mv->txt_buffer, mv->txt_size);
// TODO(rjf)
}
@@ -6874,7 +6874,7 @@ DF_VIEW_UI_FUNCTION_DEF(disasm)
U64 cursor_vaddr = (1 <= d_regs()->cursor.line && d_regs()->cursor.line <= dasm_info.lines.count) ? (range.min+dasm_info.lines.v[d_regs()->cursor.line-1].code_off) : 0;
if(!d_entity_is_nil(dasm_module))
{
ui_labelf("%S", path_normalized_from_string(scratch.arena, dasm_module->name));
ui_labelf("%S", path_normalized_from_string(scratch.arena, dasm_module->string));
ui_spacer(ui_em(1.5f, 1));
}
ui_labelf("Address: 0x%I64x, Line: %I64d, Column: %I64d", cursor_vaddr, d_regs()->cursor.line, d_regs()->cursor.column);