Skip to content

Commit

Permalink
more entity code deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanfleury committed Jan 7, 2025
1 parent ee181c6 commit 1bf66af
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 97 deletions.
73 changes: 3 additions & 70 deletions src/raddbg/raddbg_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,72 +271,6 @@ rd_entity_array_from_list(Arena *arena, RD_EntityList *list)
return result;
}

//- rjf: display string entities, for referencing entities in ui

internal String8
rd_display_string_from_entity(Arena *arena, RD_Entity *entity)
{
String8 result = {0};
switch(entity->kind)
{
default:
{
if(entity->string.size != 0)
{
result = push_str8_copy(arena, entity->string);
}
else
{
String8 kind_string = d_entity_kind_display_string_table[entity->kind];
result = push_str8f(arena, "%S $%I64u", kind_string, entity->id);
}
}break;

case RD_EntityKind_Target:
{
if(entity->string.size != 0)
{
result = push_str8_copy(arena, entity->string);
}
else
{
RD_Entity *exe = rd_entity_child_from_kind(entity, RD_EntityKind_Executable);
result = push_str8_copy(arena, exe->string);
}
}break;

case RD_EntityKind_Breakpoint:
{
if(entity->string.size != 0)
{
result = push_str8_copy(arena, entity->string);
}
else
{
RD_Entity *loc = rd_entity_child_from_kind(entity, RD_EntityKind_Location);
if(loc->flags & RD_EntityFlag_HasTextPoint)
{
result = push_str8f(arena, "%S:%I64d:%I64d", str8_skip_last_slash(loc->string), loc->text_point.line, loc->text_point.column);
}
else if(loc->flags & RD_EntityFlag_HasVAddr)
{
result = str8_from_u64(arena, loc->vaddr, 16, 16, 0);
}
else if(loc->string.size != 0)
{
result = push_str8_copy(arena, loc->string);
}
}
}break;

case RD_EntityKind_RecentProject:
{
result = push_str8_copy(arena, str8_skip_last_slash(entity->string));
}break;
}
return result;
}

//- rjf: entity -> color operations

internal Vec4F32
Expand Down Expand Up @@ -1209,10 +1143,8 @@ rd_entity_release(RD_Entity *entity)
}
LogInfoNamedBlockF("end_entity")
{
String8 name = rd_display_string_from_entity(scratch.arena, task->e);
log_infof("kind: \"%S\"\n", d_entity_kind_display_string_table[task->e->kind]);
log_infof("id: $0x%I64x\n", task->e->id);
log_infof("display_string: \"%S\"\n", name);
}
SLLStackPush(rd_state->entities_free[free_list_idx], task->e);
rd_state->entities_free_count += 1;
Expand Down Expand Up @@ -5544,8 +5476,9 @@ rd_window_frame(RD_Window *ws)
ui_labelf("Launch all active targets:");
for(RD_EntityNode *n = targets.first; n != 0; n = n->next)
{
String8 target_display_name = rd_display_string_from_entity(scratch.arena, n->entity);
ui_label(target_display_name);
DR_FancyStringList title_fstrs = rd_title_fstrs_from_entity(ui_build_arena(), n->entity, ui_top_palette()->text_weak, ui_top_font_size());
UI_Box *box = ui_build_box_from_key(UI_BoxFlag_DrawText, ui_key_zero());
ui_box_equip_display_fancy_strings(box, &title_fstrs);
}
}
}
Expand Down
51 changes: 24 additions & 27 deletions src/raddbg/raddbg_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ struct RD_Entity
RD_Entity *prev;
RD_Entity *parent;

// rjf: metadata
// rjf: metadata
RD_EntityKind kind;
RD_EntityFlags flags;
RD_EntityID id;
Expand All @@ -400,10 +400,10 @@ struct RD_Entity

// rjf: basic equipment
TxtPt text_point;
B32 disabled;
B32 debug_subprocesses;
U64 u64;
U64 vaddr;
B32 disabled;
B32 debug_subprocesses;
U64 u64;
U64 vaddr;
Vec4F32 color_hsva;
RD_CfgSrc cfg_src;
U64 timestamp;
Expand Down Expand Up @@ -721,7 +721,7 @@ struct RD_CtrlEntityMetaEvalCacheSlot
};

////////////////////////////////
//~ rjf: Main Per-Process Graphical State
//~ rjf: Main Per-Process Graphical State

typedef struct RD_NameChunkNode RD_NameChunkNode;
struct RD_NameChunkNode
Expand All @@ -737,14 +737,14 @@ struct RD_EntityListCache
U64 alloc_gen;
RD_EntityList list;
};

typedef struct RD_AmbiguousPathNode RD_AmbiguousPathNode;
struct RD_AmbiguousPathNode
{
RD_AmbiguousPathNode *next;
String8 name;
String8List paths;
};

typedef struct RD_AmbiguousPathNode RD_AmbiguousPathNode;
struct RD_AmbiguousPathNode
{
RD_AmbiguousPathNode *next;
String8 name;
String8List paths;
};

typedef struct RD_State RD_State;
struct RD_State
Expand All @@ -767,14 +767,14 @@ struct RD_State

// rjf: frame parameters
F32 frame_dt;
DI_Scope *frame_di_scope;

// rjf: dbgi match store
DI_MatchStore *match_store;

// rjf: ambiguous path table
U64 ambiguous_path_slots_count;
RD_AmbiguousPathNode **ambiguous_path_slots;
DI_Scope *frame_di_scope;

// rjf: dbgi match store
DI_MatchStore *match_store;

// rjf: ambiguous path table
U64 ambiguous_path_slots_count;
RD_AmbiguousPathNode **ambiguous_path_slots;

// rjf: registers stack
RD_RegsNode base_regs;
Expand Down Expand Up @@ -1012,9 +1012,6 @@ internal void rd_entity_list_push(Arena *arena, RD_EntityList *list, RD_Entity *
internal RD_EntityArray rd_entity_array_from_list(Arena *arena, RD_EntityList *list);
#define rd_first_entity_from_list(list) ((list)->first != 0 ? (list)->first->entity : &rd_nil_entity)

//- rjf: display string entities, for referencing entities in ui
internal String8 rd_display_string_from_entity(Arena *arena, RD_Entity *entity);

//- rjf: entity -> color operations
internal Vec4F32 rd_hsva_from_entity(RD_Entity *entity);
internal Vec4F32 rd_rgba_from_entity(RD_Entity *entity);
Expand Down Expand Up @@ -1321,7 +1318,7 @@ internal String8List rd_cmd_name_list_from_binding(Arena *arena, RD_Binding bind

//- rjf: colors
internal Vec4F32 rd_rgba_from_theme_color(RD_ThemeColor color);
internal RD_ThemeColor rd_theme_color_from_txt_token_kind(TXT_TokenKind kind);
internal RD_ThemeColor rd_theme_color_from_txt_token_kind(TXT_TokenKind kind);
internal RD_ThemeColor rd_theme_color_from_txt_token_kind_lookup_string(TXT_TokenKind kind, String8 string);

//- rjf: code -> palette
Expand All @@ -1342,7 +1339,7 @@ internal String8List rd_cfg_strings_from_gfx(Arena *arena, String8 root_path, RD
////////////////////////////////
//~ rjf: Process Control Info Stringification

internal String8 rd_string_from_exception_code(U32 code);
internal String8 rd_string_from_exception_code(U32 code);
internal DR_FancyStringList rd_stop_explanation_fstrs_from_ctrl_event(Arena *arena, CTRL_Event *event);

////////////////////////////////
Expand Down

0 comments on commit 1bf66af

Please sign in to comment.