From accc77e03eb47b3712b7c0a00b202e8a0e420214 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Tue, 27 Aug 2024 11:17:05 -0700 Subject: [PATCH] eliminate type resolution eval viz stage (can just be done via the expr resolution stage, which is more powerful); fix elements expansion for non-pointers --- src/df/core/df_core.c | 24 --------------- src/df/core/df_core.h | 13 ++------ src/df/core/df_core.mdesk | 45 +++++++++++++--------------- src/df/core/generated/df_core.meta.c | 38 +++++++++++------------ src/df/gfx/df_view_rules.c | 4 +-- src/df/gfx/df_views.c | 2 +- 6 files changed, 45 insertions(+), 81 deletions(-) diff --git a/src/df/core/df_core.c b/src/df/core/df_core.c index ac50446c..cf45dc33 100644 --- a/src/df/core/df_core.c +++ b/src/df/core/df_core.c @@ -3894,35 +3894,11 @@ df_expr_from_expr_cfg(Arena *arena, E_Expr *expr, DF_CfgTable *cfg) return expr; } -//- rjf: type * view rule -> type - -internal E_TypeKey -df_type_key_from_type_key_cfg(E_TypeKey key, DF_CfgTable *cfg) -{ - for(DF_CfgVal *val = cfg->first_val; val != 0 && val != &df_g_nil_cfg_val; val = val->linear_next) - { - DF_CoreViewRuleSpec *spec = df_core_view_rule_spec_from_string(val->string); - if(spec->info.flags & DF_CoreViewRuleSpecInfoFlag_TypeResolution) - { - key = spec->info.type_resolution(key, val->last->root); - } - } - return key; -} - //- rjf: eval * view rule table -> eval internal E_Eval df_eval_from_eval_cfg(Arena *arena, E_Eval eval, DF_CfgTable *cfg) { - for(DF_CfgVal *val = cfg->first_val; val != 0 && val != &df_g_nil_cfg_val; val = val->linear_next) - { - DF_CoreViewRuleSpec *spec = df_core_view_rule_spec_from_string(val->string); - if(spec->info.flags & DF_CoreViewRuleSpecInfoFlag_TypeResolution) - { - eval.type_key = spec->info.type_resolution(eval.type_key, val->last->root); - } - } for(DF_CfgVal *val = cfg->first_val; val != 0 && val != &df_g_nil_cfg_val; val = val->linear_next) { DF_CoreViewRuleSpec *spec = df_core_view_rule_spec_from_string(val->string); diff --git a/src/df/core/df_core.h b/src/df/core/df_core.h index ee3124a8..12dbb440 100644 --- a/src/df/core/df_core.h +++ b/src/df/core/df_core.h @@ -179,9 +179,6 @@ typedef struct DF_EvalVizBlockList DF_EvalVizBlockList; #define DF_CORE_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_SIG(name) E_Expr *name(Arena *arena, E_Expr *expr, MD_Node *params) #define DF_CORE_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME(name) df_core_view_rule_expr_resolution__##name #define DF_CORE_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_DEF(name) internal DF_CORE_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_SIG(DF_CORE_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME(name)) -#define DF_CORE_VIEW_RULE_TYPE_RESOLUTION_FUNCTION_SIG(name) E_TypeKey name(E_TypeKey type_key, MD_Node *params) -#define DF_CORE_VIEW_RULE_TYPE_RESOLUTION_FUNCTION_NAME(name) df_core_view_rule_type_resolution__##name -#define DF_CORE_VIEW_RULE_TYPE_RESOLUTION_FUNCTION_DEF(name) internal DF_CORE_VIEW_RULE_TYPE_RESOLUTION_FUNCTION_SIG(DF_CORE_VIEW_RULE_TYPE_RESOLUTION_FUNCTION_NAME(name)) #define DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_SIG(name) E_Eval name(Arena *arena, E_Eval eval, MD_Node *params) #define DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_NAME(name) df_core_view_rule_eval_resolution__##name #define DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(name) internal DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_SIG(DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_NAME(name)) @@ -199,7 +196,6 @@ struct DF_EvalVizBlockList *out) #define DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(name) df_core_view_rule_viz_block_prod__##name #define DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(name) internal DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_SIG(DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(name)) typedef DF_CORE_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_SIG(DF_CoreViewRuleExprResolutionHookFunctionType); -typedef DF_CORE_VIEW_RULE_TYPE_RESOLUTION_FUNCTION_SIG(DF_CoreViewRuleTypeResolutionHookFunctionType); typedef DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_SIG(DF_CoreViewRuleEvalResolutionHookFunctionType); typedef DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_SIG(DF_CoreViewRuleVizBlockProdHookFunctionType); @@ -255,9 +251,8 @@ enum DF_CoreViewRuleSpecInfoFlag_Inherited = (1<<0), DF_CoreViewRuleSpecInfoFlag_Expandable = (1<<1), DF_CoreViewRuleSpecInfoFlag_ExprResolution = (1<<2), - DF_CoreViewRuleSpecInfoFlag_TypeResolution = (1<<4), - DF_CoreViewRuleSpecInfoFlag_EvalResolution = (1<<5), - DF_CoreViewRuleSpecInfoFlag_VizBlockProd = (1<<6), + DF_CoreViewRuleSpecInfoFlag_EvalResolution = (1<<3), + DF_CoreViewRuleSpecInfoFlag_VizBlockProd = (1<<4), }; typedef struct DF_CoreViewRuleSpecInfo DF_CoreViewRuleSpecInfo; @@ -269,7 +264,6 @@ struct DF_CoreViewRuleSpecInfo String8 description; DF_CoreViewRuleSpecInfoFlags flags; DF_CoreViewRuleExprResolutionHookFunctionType *expr_resolution; - DF_CoreViewRuleTypeResolutionHookFunctionType *type_resolution; DF_CoreViewRuleEvalResolutionHookFunctionType *eval_resolution; DF_CoreViewRuleVizBlockProdHookFunctionType *viz_block_prod; }; @@ -1592,9 +1586,6 @@ internal String8 df_eval_view_rule_from_key(DF_EvalView *eval_view, DF_ExpandKey //- rjf: expr * view rule table -> expr internal E_Expr *df_expr_from_expr_cfg(Arena *arena, E_Expr *expr, DF_CfgTable *cfg); -//- rjf: type * view rule table -> type -internal E_TypeKey df_type_key_from_type_key_cfg(E_TypeKey key, DF_CfgTable *cfg); - //- rjf: eval * view rule table -> eval internal E_Eval df_eval_from_eval_cfg(Arena *arena, E_Eval eval, DF_CfgTable *cfg); diff --git a/src/df/core/df_core.mdesk b/src/df/core/df_core.mdesk index 61a4c135..bb56175e 100644 --- a/src/df/core/df_core.mdesk +++ b/src/df/core/df_core.mdesk @@ -458,9 +458,6 @@ DF_CoreCmdTable:// | | | | // modifications to expression trees that it is // applied to // -// type resolution, "tp" -> provides a chance for a view rule to control the -// way an expression is resolved into a type -// // eval resolution, "er" -> provides a chance for a view rule to impact an eval // value, before the rest of the eval visual pipeline // continues. @@ -524,28 +521,28 @@ DF_CoreCmdTable:// | | | | // For any view rules in this layer which also have graphical features, they // are specified in both tables under the same name. -@table(name name_lower string ih ex xp tp er vb display_name docs schema description) +@table(name name_lower string ih ex xp er vb display_name docs schema description) DF_CoreViewRuleTable: { - {Default default "default" - - - - - x "Default" - "" "" } - {Array array "array" - - x - - - "Array" x "x:{expr}" "Specifies that a pointer points to N elements, rather than only 1." } - {Slice slice "slice" - - x - - - "Slice" x "" "Specifies that a pointer within a struct, also containing an integer, points to the number of elements encoded by the integer." } - {List list "list" - - - - - x "List" x "x:{member}" "Specifies that some struct, union, or class forms the top of a linked list, and the member which points at the following element in the list." } - {ByteSwap bswap "bswap" x - - - x - "Byte Swap" x "" "Specifies that all integral evaluations should be byte-swapped, such that their endianness is reversed." } - {BaseDec base_dec "dec" x - - - - - "Decimal Base (Base 10)" x "" "Specifies that all integral evaluations should appear in base-10 form." } - {BaseBin base_bin "bin" x - - - - - "Binary Base (Base 2)" x "" "Specifies that all integral evaluations should appear in base-2 form." } - {BaseOct base_oct "oct" x - - - - - "Octal Base (Base 8)" x "" "Specifies that all integral evaluations should appear in base-8 form." } - {BaseHex base_hex "hex" x - - - - - "Hexadecimal Base (Base 16)" x "" "Specifies that all integral evaluations should appear in base-16 form." } - {Only only "only" x - - - - x "Only Specified Members" x "x:{member}" "Specifies that only the specified members should appear in struct, union, or class evaluations." } - {Omit omit "omit" x - - - - x "Omit Specified Members" x "x:{member}" "Omits a list of member names from appearing in struct, union, or class evaluations." } - {NoAddr no_addr "no_addr" x - - - - - "Disable Address Values" x "" "Displays only what pointers point to, if possible, without the pointer's address value." } - {Checkbox checkbox "checkbox" - - - - - - "Checkbox" x "" "Displays simple integer values as checkboxes, encoding zero or nonzero values." } - {RGBA rgba "rgba" - x - - - x "Color (RGBA)" x "" "Displays as a color, interpreting the data as encoding R, G, B, and A values." } - {Text text "text" - x - - - x "Text" x "x:{'lang':lang, 'size':expr}" "Displays as text." } - {Disasm disasm "disasm" - x - - - x "Disassembly" x "x:{'arch':arch, 'size':expr}" "Displays as disassembled instructions, interpreting the data as raw machine code." } - {Graph graph "graph" - x - - - x "Graph" x "" "Displays as a pointer graph, visualizing nodes and edges formed by pointers directly." } - {Bitmap bitmap "bitmap" - x - - - x "Bitmap" x "x:{'w':expr, 'h':expr, 'fmt':tex2dformat}" "Displays as a bitmap, interpreting the data as raw pixel data." } - {Geo geo "geo" - x - - - x "Geometry" x "x:{'count':expr, 'vertices_base':expr, 'vertices_size':expr}" "Displays as geometry, interpreting the data as vertex data." } + {Default default "default" - - - - x "Default" - "" "" } + {Array array "array" - - x - - "Array" x "x:{expr}" "Specifies that a pointer points to N elements, rather than only 1." } + {Slice slice "slice" - - x - - "Slice" x "" "Specifies that a pointer within a struct, also containing an integer, points to the number of elements encoded by the integer." } + {List list "list" - - - - x "List" x "x:{member}" "Specifies that some struct, union, or class forms the top of a linked list, and the member which points at the following element in the list." } + {ByteSwap bswap "bswap" x - - x - "Byte Swap" x "" "Specifies that all integral evaluations should be byte-swapped, such that their endianness is reversed." } + {BaseDec base_dec "dec" x - - - - "Decimal Base (Base 10)" x "" "Specifies that all integral evaluations should appear in base-10 form." } + {BaseBin base_bin "bin" x - - - - "Binary Base (Base 2)" x "" "Specifies that all integral evaluations should appear in base-2 form." } + {BaseOct base_oct "oct" x - - - - "Octal Base (Base 8)" x "" "Specifies that all integral evaluations should appear in base-8 form." } + {BaseHex base_hex "hex" x - - - - "Hexadecimal Base (Base 16)" x "" "Specifies that all integral evaluations should appear in base-16 form." } + {Only only "only" x - - - x "Only Specified Members" x "x:{member}" "Specifies that only the specified members should appear in struct, union, or class evaluations." } + {Omit omit "omit" x - - - x "Omit Specified Members" x "x:{member}" "Omits a list of member names from appearing in struct, union, or class evaluations." } + {NoAddr no_addr "no_addr" x - - - - "Disable Address Values" x "" "Displays only what pointers point to, if possible, without the pointer's address value." } + {Checkbox checkbox "checkbox" - - - - - "Checkbox" x "" "Displays simple integer values as checkboxes, encoding zero or nonzero values." } + {RGBA rgba "rgba" - x - - x "Color (RGBA)" x "" "Displays as a color, interpreting the data as encoding R, G, B, and A values." } + {Text text "text" - x - - x "Text" x "x:{'lang':lang, 'size':expr}" "Displays as text." } + {Disasm disasm "disasm" - x - - x "Disassembly" x "x:{'arch':arch, 'size':expr}" "Displays as disassembled instructions, interpreting the data as raw machine code." } + {Graph graph "graph" - x - - x "Graph" x "" "Displays as a pointer graph, visualizing nodes and edges formed by pointers directly." } + {Bitmap bitmap "bitmap" - x - - x "Bitmap" x "x:{'w':expr, 'h':expr, 'fmt':tex2dformat}" "Displays as a bitmap, interpreting the data as raw pixel data." } + {Geo geo "geo" - x - - x "Geometry" x "x:{'count':expr, 'vertices_base':expr, 'vertices_size':expr}" "Displays as geometry, interpreting the data as vertex data." } } //////////////////////////////// @@ -776,7 +773,7 @@ DF_DevToggleTable: @data(DF_CoreViewRuleSpecInfo) @c_file df_g_core_view_rule_spec_info_table: { @expand(DF_CoreViewRuleTable a) - ```{str8_lit_comp("$(a.string)"), str8_lit_comp("$(a.display_name)"), str8_lit_comp("$(a.schema)"), str8_lit_comp("$(a.description)"), (DF_CoreViewRuleSpecInfoFlag_Inherited*$(a.ih == "x"))|(DF_CoreViewRuleSpecInfoFlag_Expandable*$(a.ex == "x"))|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*$(a.xp == "x"))|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*$(a.tp == "x"))|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*$(a.er == "x"))|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*$(a.vb == "x")), $(a.xp == "x" -> "DF_CORE_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME("..a.name_lower..")") $(a.xp != "x" -> 0), $(a.tp == "x" -> "DF_CORE_VIEW_RULE_TYPE_RESOLUTION_FUNCTION_NAME("..a.name_lower..")") $(a.tp != "x" -> 0), $(a.er == "x" -> "DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_NAME("..a.name_lower..")") $(a.er != "x" -> 0), $(a.vb == "x" -> "DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME("..a.name_lower..")") $(a.vb != "x" -> 0), }```; + ```{str8_lit_comp("$(a.string)"), str8_lit_comp("$(a.display_name)"), str8_lit_comp("$(a.schema)"), str8_lit_comp("$(a.description)"), (DF_CoreViewRuleSpecInfoFlag_Inherited*$(a.ih == "x"))|(DF_CoreViewRuleSpecInfoFlag_Expandable*$(a.ex == "x"))|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*$(a.xp == "x"))|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*$(a.er == "x"))|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*$(a.vb == "x")), $(a.xp == "x" -> "DF_CORE_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME("..a.name_lower..")") $(a.xp != "x" -> 0), $(a.er == "x" -> "DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_NAME("..a.name_lower..")") $(a.er != "x" -> 0), $(a.vb == "x" -> "DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME("..a.name_lower..")") $(a.vb != "x" -> 0), }```; } //- rjf: icon kinds diff --git a/src/df/core/generated/df_core.meta.c b/src/df/core/generated/df_core.meta.c index 2f5d37c4..00f76654 100644 --- a/src/df/core/generated/df_core.meta.c +++ b/src/df/core/generated/df_core.meta.c @@ -483,25 +483,25 @@ DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[221] = DF_CoreViewRuleSpecInfo df_g_core_view_rule_spec_info_table[19] = { -{str8_lit_comp("default"), str8_lit_comp("Default"), str8_lit_comp(""), str8_lit_comp(""), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(default) , }, -{str8_lit_comp("array"), str8_lit_comp("Array"), str8_lit_comp("x:{expr}"), str8_lit_comp("Specifies that a pointer points to N elements, rather than only 1."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*1)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), DF_CORE_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME(array) , 0, 0, 0, }, -{str8_lit_comp("slice"), str8_lit_comp("Slice"), str8_lit_comp(""), str8_lit_comp("Specifies that a pointer within a struct, also containing an integer, points to the number of elements encoded by the integer."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*1)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), DF_CORE_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME(slice) , 0, 0, 0, }, -{str8_lit_comp("list"), str8_lit_comp("List"), str8_lit_comp("x:{member}"), str8_lit_comp("Specifies that some struct, union, or class forms the top of a linked list, and the member which points at the following element in the list."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(list) , }, -{str8_lit_comp("bswap"), str8_lit_comp("Byte Swap"), str8_lit_comp(""), str8_lit_comp("Specifies that all integral evaluations should be byte-swapped, such that their endianness is reversed."), (DF_CoreViewRuleSpecInfoFlag_Inherited*1)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*1)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), 0, 0, DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_NAME(bswap) , 0, }, -{str8_lit_comp("dec"), str8_lit_comp("Decimal Base (Base 10)"), str8_lit_comp(""), str8_lit_comp("Specifies that all integral evaluations should appear in base-10 form."), (DF_CoreViewRuleSpecInfoFlag_Inherited*1)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), 0, 0, 0, 0, }, -{str8_lit_comp("bin"), str8_lit_comp("Binary Base (Base 2)"), str8_lit_comp(""), str8_lit_comp("Specifies that all integral evaluations should appear in base-2 form."), (DF_CoreViewRuleSpecInfoFlag_Inherited*1)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), 0, 0, 0, 0, }, -{str8_lit_comp("oct"), str8_lit_comp("Octal Base (Base 8)"), str8_lit_comp(""), str8_lit_comp("Specifies that all integral evaluations should appear in base-8 form."), (DF_CoreViewRuleSpecInfoFlag_Inherited*1)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), 0, 0, 0, 0, }, -{str8_lit_comp("hex"), str8_lit_comp("Hexadecimal Base (Base 16)"), str8_lit_comp(""), str8_lit_comp("Specifies that all integral evaluations should appear in base-16 form."), (DF_CoreViewRuleSpecInfoFlag_Inherited*1)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), 0, 0, 0, 0, }, -{str8_lit_comp("only"), str8_lit_comp("Only Specified Members"), str8_lit_comp("x:{member}"), str8_lit_comp("Specifies that only the specified members should appear in struct, union, or class evaluations."), (DF_CoreViewRuleSpecInfoFlag_Inherited*1)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(only) , }, -{str8_lit_comp("omit"), str8_lit_comp("Omit Specified Members"), str8_lit_comp("x:{member}"), str8_lit_comp("Omits a list of member names from appearing in struct, union, or class evaluations."), (DF_CoreViewRuleSpecInfoFlag_Inherited*1)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(omit) , }, -{str8_lit_comp("no_addr"), str8_lit_comp("Disable Address Values"), str8_lit_comp(""), str8_lit_comp("Displays only what pointers point to, if possible, without the pointer's address value."), (DF_CoreViewRuleSpecInfoFlag_Inherited*1)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), 0, 0, 0, 0, }, -{str8_lit_comp("checkbox"), str8_lit_comp("Checkbox"), str8_lit_comp(""), str8_lit_comp("Displays simple integer values as checkboxes, encoding zero or nonzero values."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), 0, 0, 0, 0, }, -{str8_lit_comp("rgba"), str8_lit_comp("Color (RGBA)"), str8_lit_comp(""), str8_lit_comp("Displays as a color, interpreting the data as encoding R, G, B, and A values."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(rgba) , }, -{str8_lit_comp("text"), str8_lit_comp("Text"), str8_lit_comp("x:{'lang':lang, 'size':expr}"), str8_lit_comp("Displays as text."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(text) , }, -{str8_lit_comp("disasm"), str8_lit_comp("Disassembly"), str8_lit_comp("x:{'arch':arch, 'size':expr}"), str8_lit_comp("Displays as disassembled instructions, interpreting the data as raw machine code."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(disasm) , }, -{str8_lit_comp("graph"), str8_lit_comp("Graph"), str8_lit_comp(""), str8_lit_comp("Displays as a pointer graph, visualizing nodes and edges formed by pointers directly."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(graph) , }, -{str8_lit_comp("bitmap"), str8_lit_comp("Bitmap"), str8_lit_comp("x:{'w':expr, 'h':expr, 'fmt':tex2dformat}"), str8_lit_comp("Displays as a bitmap, interpreting the data as raw pixel data."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(bitmap) , }, -{str8_lit_comp("geo"), str8_lit_comp("Geometry"), str8_lit_comp("x:{'count':expr, 'vertices_base':expr, 'vertices_size':expr}"), str8_lit_comp("Displays as geometry, interpreting the data as vertex data."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_TypeResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(geo) , }, +{str8_lit_comp("default"), str8_lit_comp("Default"), str8_lit_comp(""), str8_lit_comp(""), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(default) , }, +{str8_lit_comp("array"), str8_lit_comp("Array"), str8_lit_comp("x:{expr}"), str8_lit_comp("Specifies that a pointer points to N elements, rather than only 1."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*1)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), DF_CORE_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME(array) , 0, 0, }, +{str8_lit_comp("slice"), str8_lit_comp("Slice"), str8_lit_comp(""), str8_lit_comp("Specifies that a pointer within a struct, also containing an integer, points to the number of elements encoded by the integer."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*1)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), DF_CORE_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME(slice) , 0, 0, }, +{str8_lit_comp("list"), str8_lit_comp("List"), str8_lit_comp("x:{member}"), str8_lit_comp("Specifies that some struct, union, or class forms the top of a linked list, and the member which points at the following element in the list."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(list) , }, +{str8_lit_comp("bswap"), str8_lit_comp("Byte Swap"), str8_lit_comp(""), str8_lit_comp("Specifies that all integral evaluations should be byte-swapped, such that their endianness is reversed."), (DF_CoreViewRuleSpecInfoFlag_Inherited*1)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*1)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), 0, DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_NAME(bswap) , 0, }, +{str8_lit_comp("dec"), str8_lit_comp("Decimal Base (Base 10)"), str8_lit_comp(""), str8_lit_comp("Specifies that all integral evaluations should appear in base-10 form."), (DF_CoreViewRuleSpecInfoFlag_Inherited*1)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), 0, 0, 0, }, +{str8_lit_comp("bin"), str8_lit_comp("Binary Base (Base 2)"), str8_lit_comp(""), str8_lit_comp("Specifies that all integral evaluations should appear in base-2 form."), (DF_CoreViewRuleSpecInfoFlag_Inherited*1)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), 0, 0, 0, }, +{str8_lit_comp("oct"), str8_lit_comp("Octal Base (Base 8)"), str8_lit_comp(""), str8_lit_comp("Specifies that all integral evaluations should appear in base-8 form."), (DF_CoreViewRuleSpecInfoFlag_Inherited*1)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), 0, 0, 0, }, +{str8_lit_comp("hex"), str8_lit_comp("Hexadecimal Base (Base 16)"), str8_lit_comp(""), str8_lit_comp("Specifies that all integral evaluations should appear in base-16 form."), (DF_CoreViewRuleSpecInfoFlag_Inherited*1)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), 0, 0, 0, }, +{str8_lit_comp("only"), str8_lit_comp("Only Specified Members"), str8_lit_comp("x:{member}"), str8_lit_comp("Specifies that only the specified members should appear in struct, union, or class evaluations."), (DF_CoreViewRuleSpecInfoFlag_Inherited*1)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(only) , }, +{str8_lit_comp("omit"), str8_lit_comp("Omit Specified Members"), str8_lit_comp("x:{member}"), str8_lit_comp("Omits a list of member names from appearing in struct, union, or class evaluations."), (DF_CoreViewRuleSpecInfoFlag_Inherited*1)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(omit) , }, +{str8_lit_comp("no_addr"), str8_lit_comp("Disable Address Values"), str8_lit_comp(""), str8_lit_comp("Displays only what pointers point to, if possible, without the pointer's address value."), (DF_CoreViewRuleSpecInfoFlag_Inherited*1)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), 0, 0, 0, }, +{str8_lit_comp("checkbox"), str8_lit_comp("Checkbox"), str8_lit_comp(""), str8_lit_comp("Displays simple integer values as checkboxes, encoding zero or nonzero values."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), 0, 0, 0, }, +{str8_lit_comp("rgba"), str8_lit_comp("Color (RGBA)"), str8_lit_comp(""), str8_lit_comp("Displays as a color, interpreting the data as encoding R, G, B, and A values."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(rgba) , }, +{str8_lit_comp("text"), str8_lit_comp("Text"), str8_lit_comp("x:{'lang':lang, 'size':expr}"), str8_lit_comp("Displays as text."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(text) , }, +{str8_lit_comp("disasm"), str8_lit_comp("Disassembly"), str8_lit_comp("x:{'arch':arch, 'size':expr}"), str8_lit_comp("Displays as disassembled instructions, interpreting the data as raw machine code."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(disasm) , }, +{str8_lit_comp("graph"), str8_lit_comp("Graph"), str8_lit_comp(""), str8_lit_comp("Displays as a pointer graph, visualizing nodes and edges formed by pointers directly."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(graph) , }, +{str8_lit_comp("bitmap"), str8_lit_comp("Bitmap"), str8_lit_comp("x:{'w':expr, 'h':expr, 'fmt':tex2dformat}"), str8_lit_comp("Displays as a bitmap, interpreting the data as raw pixel data."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(bitmap) , }, +{str8_lit_comp("geo"), str8_lit_comp("Geometry"), str8_lit_comp("x:{'count':expr, 'vertices_base':expr, 'vertices_size':expr}"), str8_lit_comp("Displays as geometry, interpreting the data as vertex data."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(geo) , }, }; String8 df_g_icon_kind_text_table[69] = diff --git a/src/df/gfx/df_view_rules.c b/src/df/gfx/df_view_rules.c index 925556a5..32dab77c 100644 --- a/src/df/gfx/df_view_rules.c +++ b/src/df/gfx/df_view_rules.c @@ -12,7 +12,7 @@ DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(default) //- rjf: unpack expression type info // E_IRTreeAndType irtree = e_irtree_and_type_from_expr(scratch.arena, expr); - E_TypeKey type_key = df_type_key_from_type_key_cfg(e_type_unwrap(irtree.type_key), cfg_table); + E_TypeKey type_key = e_type_unwrap(irtree.type_key); E_TypeKind type_kind = e_type_kind_from_key(type_key); E_TypeKey direct_type_key = e_type_unwrap(e_type_direct_from_key(type_key)); E_TypeKind direct_type_kind = e_type_kind_from_key(direct_type_key); @@ -105,7 +105,7 @@ DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(default) // rjf: build blocks for all elements, split by sub-expansions DF_EvalVizBlock *last_vb = df_eval_viz_block_begin(arena, DF_EvalVizBlockKind_Elements, key, df_expand_key_make(df_hash_from_expand_key(key), 0), depth); { - last_vb->expr = e_expr_ref_deref(arena, expr); + last_vb->expr = need_extra_deref ? e_expr_ref_deref(arena, expr) : expr; last_vb->cfg_table = cfg_table; last_vb->visual_idx_range = last_vb->semantic_idx_range = r1u64(0, array_count); } diff --git a/src/df/gfx/df_views.c b/src/df/gfx/df_views.c index 263faf1b..6c0f8290 100644 --- a/src/df/gfx/df_views.c +++ b/src/df/gfx/df_views.c @@ -1239,7 +1239,7 @@ df_string_from_eval_viz_row_column(Arena *arena, DF_EvalView *ev, DF_EvalVizRow case DF_WatchViewColumnKind_Type: { E_IRTreeAndType irtree = e_irtree_and_type_from_expr(arena, row->expr); - E_TypeKey type_key = df_type_key_from_type_key_cfg(irtree.type_key, row->cfg_table); + E_TypeKey type_key = irtree.type_key; result = !e_type_key_match(type_key, e_type_key_zero()) ? e_type_string_from_key(arena, type_key) : str8_zero(); result = str8_skip_chop_whitespace(result); }break;