mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-15 16:42:23 -07:00
make meta & eval type system a bit richer to express plain text vs. code text vs. path text
This commit is contained in:
+4
-21
@@ -100,9 +100,10 @@ TypeKind;
|
||||
typedef U32 TypeFlags;
|
||||
enum
|
||||
{
|
||||
TypeFlag_IsExternal = (1<<0),
|
||||
TypeFlag_IsCode = (1<<1),
|
||||
TypeFlag_IsPath = (1<<2),
|
||||
TypeFlag_IsExternal = (1<<0),
|
||||
TypeFlag_IsPlainText = (1<<1),
|
||||
TypeFlag_IsCodeText = (1<<2),
|
||||
TypeFlag_IsPathText = (1<<3),
|
||||
};
|
||||
|
||||
typedef U32 MemberFlags;
|
||||
@@ -212,24 +213,6 @@ struct_members(String8)
|
||||
};
|
||||
struct_type(String8);
|
||||
|
||||
//- rjf: String8 (Code)
|
||||
ptr_type(String8_Code__str_ptr_type, type(U8), str8_lit_comp("size"), .flags = TypeFlag_IsCode);
|
||||
struct_members(String8_Code)
|
||||
{
|
||||
member_lit_comp(String8, &String8_Code__str_ptr_type, str),
|
||||
member_lit_comp(String8, type(U64), size),
|
||||
};
|
||||
named_struct_type(String8_Code, String8);
|
||||
|
||||
//- rjf: String8 (Path)
|
||||
ptr_type(String8_Path__str_ptr_type, type(U8), str8_lit_comp("size"), .flags = TypeFlag_IsPath);
|
||||
struct_members(String8_Path)
|
||||
{
|
||||
member_lit_comp(String8, &String8_Path__str_ptr_type, str),
|
||||
member_lit_comp(String8, type(U64), size),
|
||||
};
|
||||
named_struct_type(String8_Path, String8);
|
||||
|
||||
//- rjf: String8Node
|
||||
extern Type String8Node__type;
|
||||
Type String8Node__ptr_type = {TypeKind_Ptr, 0, sizeof(void *), &String8Node__type};
|
||||
|
||||
@@ -17,9 +17,9 @@ typedef U64 CTRL_MachineID;
|
||||
|
||||
//- rjf: styled string types
|
||||
|
||||
ptr_type(CTRL_PlainString8__str_ptr_type, type(U8), .flags = 0, .count_delimiter_name = str8_lit_comp("size"));
|
||||
ptr_type(CTRL_CodeString8__str_ptr_type, type(U8), .flags = TypeFlag_IsCode, .count_delimiter_name = str8_lit_comp("size"));
|
||||
ptr_type(CTRL_PathString8__str_ptr_type, type(U8), .flags = TypeFlag_IsPath, .count_delimiter_name = str8_lit_comp("size"));
|
||||
ptr_type(CTRL_PlainString8__str_ptr_type, type(U8), .flags = TypeFlag_IsPlainText,.count_delimiter_name = str8_lit_comp("size"));
|
||||
ptr_type(CTRL_CodeString8__str_ptr_type, type(U8), .flags = TypeFlag_IsCodeText, .count_delimiter_name = str8_lit_comp("size"));
|
||||
ptr_type(CTRL_PathString8__str_ptr_type, type(U8), .flags = TypeFlag_IsPathText, .count_delimiter_name = str8_lit_comp("size"));
|
||||
Member CTRL_PlainString8__members[] =
|
||||
{
|
||||
member_lit_comp(String8, &CTRL_PlainString8__str_ptr_type, str, .pretty_name = str8_lit_comp("Contents")),
|
||||
|
||||
+4
-12
@@ -455,18 +455,10 @@ e_type_key_cons_base(Type *type)
|
||||
{
|
||||
E_TypeKey direct_type = e_type_key_cons_base(type->direct);
|
||||
E_TypeFlags flags = 0;
|
||||
if(type->flags & TypeFlag_IsExternal)
|
||||
{
|
||||
flags |= E_TypeFlag_External;
|
||||
}
|
||||
if(type->flags & TypeFlag_IsCode)
|
||||
{
|
||||
flags |= E_TypeFlag_IsCode;
|
||||
}
|
||||
if(type->flags & TypeFlag_IsPath)
|
||||
{
|
||||
flags |= E_TypeFlag_IsPath;
|
||||
}
|
||||
if(type->flags & TypeFlag_IsExternal) { flags |= E_TypeFlag_External; }
|
||||
if(type->flags & TypeFlag_IsPlainText){ flags |= E_TypeFlag_IsPlainText; }
|
||||
if(type->flags & TypeFlag_IsCodeText) { flags |= E_TypeFlag_IsCodeText; }
|
||||
if(type->flags & TypeFlag_IsPathText) { flags |= E_TypeFlag_IsPathText; }
|
||||
result = e_type_key_cons_ptr(arch_from_context(), direct_type, flags);
|
||||
}break;
|
||||
case TypeKind_Array:
|
||||
|
||||
@@ -66,11 +66,12 @@ E_MemberKind;
|
||||
typedef U32 E_TypeFlags;
|
||||
enum
|
||||
{
|
||||
E_TypeFlag_Const = (1<<0),
|
||||
E_TypeFlag_Volatile = (1<<1),
|
||||
E_TypeFlag_External = (1<<2),
|
||||
E_TypeFlag_IsCode = (1<<3),
|
||||
E_TypeFlag_IsPath = (1<<4),
|
||||
E_TypeFlag_Const = (1<<0),
|
||||
E_TypeFlag_Volatile = (1<<1),
|
||||
E_TypeFlag_External = (1<<2),
|
||||
E_TypeFlag_IsPlainText= (1<<3),
|
||||
E_TypeFlag_IsCodeText = (1<<4),
|
||||
E_TypeFlag_IsPathText = (1<<5),
|
||||
};
|
||||
|
||||
typedef struct E_Member E_Member;
|
||||
|
||||
+24
-13
@@ -2815,19 +2815,30 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: determine if cell is code
|
||||
//- rjf: determine if cell needs code styling
|
||||
B32 cell_is_code = !col->is_non_code;
|
||||
if(flags & RD_WatchViewFlag_PrettyNameMembers && cell_is_code && row->member != 0 && row->member->pretty_name.size != 0 && col->kind == RD_WatchViewColumnKind_Expr)
|
||||
switch(col->kind)
|
||||
{
|
||||
cell_is_code = 0;
|
||||
}
|
||||
if(col->kind == RD_WatchViewColumnKind_Value && row_type->flags & E_TypeFlag_IsCode)
|
||||
{
|
||||
cell_is_code = 1;
|
||||
}
|
||||
if(col->kind == RD_WatchViewColumnKind_Value && row_type->flags & E_TypeFlag_IsPath)
|
||||
{
|
||||
cell_is_code = 0;
|
||||
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:
|
||||
{
|
||||
if(row_type->flags & E_TypeFlag_IsCodeText)
|
||||
{
|
||||
cell_is_code = 1;
|
||||
}
|
||||
else if(row_type->flags & E_TypeFlag_IsPathText ||
|
||||
row_type->flags & E_TypeFlag_IsPlainText)
|
||||
{
|
||||
cell_is_code = 0;
|
||||
}
|
||||
}break;
|
||||
}
|
||||
|
||||
//- rjf: build cell
|
||||
@@ -4942,7 +4953,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(targets)
|
||||
{
|
||||
rd_watch_view_init(wv);
|
||||
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 = 1);
|
||||
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Value, 0.75f, .dequote_string = 1, .is_non_code = 0);
|
||||
}
|
||||
rd_watch_view_build(wv, RD_WatchViewFlag_NoHeader|RD_WatchViewFlag_PrettyNameMembers|RD_WatchViewFlag_PrettyEntityRows|RD_WatchViewFlag_DisableCacheLines,
|
||||
str8_lit("targets"), str8_lit("only: label exe args working_directory entry_point str"), 1, 10, rect);
|
||||
@@ -5596,7 +5607,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(modules)
|
||||
{
|
||||
rd_watch_view_init(wv);
|
||||
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Expr, 0.25f);
|
||||
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Value, 0.75f);
|
||||
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Value, 0.75f, .dequote_string = 1);
|
||||
}
|
||||
rd_watch_view_build(wv, RD_WatchViewFlag_NoHeader|RD_WatchViewFlag_PrettyNameMembers|RD_WatchViewFlag_PrettyEntityRows|RD_WatchViewFlag_DisableCacheLines,
|
||||
str8_lit("modules"), str8_lit("only: exe dbg str vaddr_range min max"), 0, 16, rect);
|
||||
|
||||
Reference in New Issue
Block a user