diff --git a/src/df/core/df_core.c b/src/df/core/df_core.c index 0eae2e46..ac50446c 100644 --- a/src/df/core/df_core.c +++ b/src/df/core/df_core.c @@ -3878,6 +3878,62 @@ df_eval_view_rule_from_key(DF_EvalView *eval_view, DF_ExpandKey key) //////////////////////////////// //~ rjf: Evaluation View Visualization & Interaction +//- rjf: expr * view rule table -> expr + +internal E_Expr * +df_expr_from_expr_cfg(Arena *arena, E_Expr *expr, 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_ExprResolution) + { + expr = spec->info.expr_resolution(arena, expr, val->last->root); + } + } + 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); + if(spec->info.flags & DF_CoreViewRuleSpecInfoFlag_EvalResolution) + { + eval = spec->info.eval_resolution(arena, eval, val->last->root); + } + } + return eval; +} + //- rjf: evaluation value string builder helpers internal String8 @@ -4573,6 +4629,9 @@ df_append_expr_eval_viz_blocks__rec(Arena *arena, DF_EvalView *eval_view, DF_Exp ProfBeginFunction(); Temp scratch = scratch_begin(&arena, 1); + //- rjf: apply expr resolution view rules + expr = df_expr_from_expr_cfg(arena, expr, cfg_table); + //- rjf: determine if this key is expanded DF_ExpandNode *node = df_expand_node_from_key(&eval_view->expand_tree_table, key); B32 parent_is_expanded = (node != 0 && node->expanded); @@ -4590,7 +4649,7 @@ df_append_expr_eval_viz_blocks__rec(Arena *arena, DF_EvalView *eval_view, DF_Exp //- rjf: determine view rule to generate children blocks DF_CoreViewRuleSpec *expand_view_rule_spec = df_core_view_rule_spec_from_string(str8_lit("default")); - DF_CfgVal *expand_view_rule_cfg = &df_g_nil_cfg_val; + MD_Node *expand_view_rule_params = &md_nil_node; if(parent_is_expanded) { for(DF_CfgVal *val = cfg_table->first_val; @@ -4601,7 +4660,7 @@ df_append_expr_eval_viz_blocks__rec(Arena *arena, DF_EvalView *eval_view, DF_Exp if(spec->info.flags & DF_CoreViewRuleSpecInfoFlag_VizBlockProd) { expand_view_rule_spec = spec; - expand_view_rule_cfg = val; + expand_view_rule_params = val->last->root; break; } } @@ -4610,7 +4669,7 @@ df_append_expr_eval_viz_blocks__rec(Arena *arena, DF_EvalView *eval_view, DF_Exp //- rjf: do view rule children block generation, if we have an applicable view rule if(parent_is_expanded && expand_view_rule_spec != &df_g_nil_core_view_rule_spec) { - expand_view_rule_spec->info.viz_block_prod(arena, eval_view, parent_key, key, node, string, expr, cfg_table, depth+1, expand_view_rule_cfg, list_out); + expand_view_rule_spec->info.viz_block_prod(arena, eval_view, parent_key, key, node, string, expr, cfg_table, depth+1, expand_view_rule_params, list_out); } scratch_end(scratch); @@ -4934,7 +4993,59 @@ df_eval_viz_row_list_push_new(Arena *arena, DF_EvalView *eval_view, DF_EvalVizWi SLLQueuePush(rows->first, rows->last, row); rows->count += 1; - // rjf: fill basics + // rjf: pick cfg table; resolve expression if needed + DF_CfgTable *cfg_table = 0; + switch(block->kind) + { + default: + { + cfg_table = push_array(arena, DF_CfgTable, 1); + *cfg_table = df_cfg_table_from_inheritance(arena, block->cfg_table); + String8 row_view_rules = df_eval_view_rule_from_key(eval_view, key); + if(row_view_rules.size != 0) + { + df_cfg_table_push_unparsed_string(arena, cfg_table, row_view_rules, DF_CfgSrc_User); + } + expr = df_expr_from_expr_cfg(arena, expr, cfg_table); + }break; + case DF_EvalVizBlockKind_Root: + { + cfg_table = block->cfg_table; + }break; + } + + // rjf: determine row ui hook to use for this row + DF_GfxViewRuleSpec *value_ui_rule_spec = &df_g_nil_gfx_view_rule_spec; + MD_Node *value_ui_rule_params = &md_nil_node; + for(DF_CfgVal *val = cfg_table->first_val; val != 0 && val != &df_g_nil_cfg_val; val = val->linear_next) + { + DF_GfxViewRuleSpec *spec = df_gfx_view_rule_spec_from_string(val->string); + if(spec->info.flags & DF_GfxViewRuleSpecInfoFlag_RowUI) + { + value_ui_rule_spec = spec; + value_ui_rule_params = val->last->root; + break; + } + } + + // rjf: determine block ui hook to use for this row + DF_GfxViewRuleSpec *expand_ui_rule_spec = &df_g_nil_gfx_view_rule_spec; + MD_Node *expand_ui_rule_params = &md_nil_node; + if(block->kind == DF_EvalVizBlockKind_Canvas) + { + for(DF_CfgVal *val = cfg_table->first_val; val != 0 && val != &df_g_nil_cfg_val; val = val->linear_next) + { + DF_GfxViewRuleSpec *spec = df_gfx_view_rule_spec_from_string(val->string); + if(spec->info.flags & DF_GfxViewRuleSpecInfoFlag_ViewUI) + { + expand_ui_rule_spec = spec; + expand_ui_rule_params = val->last->root; + break; + } + } + } + + // rjf: fill row->depth = block->depth; row->parent_key = block->parent_key; row->key = key; @@ -4954,60 +5065,11 @@ df_eval_viz_row_list_push_new(Arena *arena, DF_EvalView *eval_view, DF_EvalVizWi } scratch_end(scratch); } - - // rjf: fill view-rule-derived info - { - // rjf: pick cfg table - DF_CfgTable *cfg_table = block->cfg_table; - { - String8 row_view_rules = df_eval_view_rule_from_key(eval_view, row->key); - if(row_view_rules.size != 0) - { - cfg_table = push_array(arena, DF_CfgTable, 1); - *cfg_table = df_cfg_table_from_inheritance(arena, cfg_table); - df_cfg_table_push_unparsed_string(arena, cfg_table, row_view_rules, DF_CfgSrc_User); - } - } - - // rjf: determine row ui hook to use for this row - DF_GfxViewRuleSpec *value_ui_rule_spec = &df_g_nil_gfx_view_rule_spec; - MD_Node *value_ui_rule_params = &md_nil_node; - for(DF_CfgVal *val = cfg_table->first_val; val != 0 && val != &df_g_nil_cfg_val; val = val->linear_next) - { - DF_GfxViewRuleSpec *spec = df_gfx_view_rule_spec_from_string(val->string); - if(spec->info.flags & DF_GfxViewRuleSpecInfoFlag_RowUI) - { - value_ui_rule_spec = spec; - value_ui_rule_params = val->last->root; - break; - } - } - - // rjf: determine block ui hook to use for this row - DF_GfxViewRuleSpec *expand_ui_rule_spec = &df_g_nil_gfx_view_rule_spec; - MD_Node *expand_ui_rule_params = &md_nil_node; - if(block->kind == DF_EvalVizBlockKind_Canvas) - { - for(DF_CfgVal *val = cfg_table->first_val; val != 0 && val != &df_g_nil_cfg_val; val = val->linear_next) - { - DF_GfxViewRuleSpec *spec = df_gfx_view_rule_spec_from_string(val->string); - if(spec->info.flags & DF_GfxViewRuleSpecInfoFlag_ViewUI) - { - expand_ui_rule_spec = spec; - expand_ui_rule_params = val->last->root; - break; - } - } - } - - // rjf: fill - row->cfg_table = cfg_table; - row->value_ui_rule_spec = value_ui_rule_spec; - row->value_ui_rule_params = value_ui_rule_params; - row->expand_ui_rule_spec = expand_ui_rule_spec; - row->expand_ui_rule_params = expand_ui_rule_params; - } - + row->cfg_table = cfg_table; + row->value_ui_rule_spec = value_ui_rule_spec; + row->value_ui_rule_params = value_ui_rule_params; + row->expand_ui_rule_spec = expand_ui_rule_spec; + row->expand_ui_rule_params = expand_ui_rule_params; return row; } @@ -5217,6 +5279,17 @@ df_base_offset_from_eval(E_Eval eval) return eval.value.u64; } +internal E_Value +df_value_from_params(MD_Node *params) +{ + Temp scratch = scratch_begin(0, 0); + String8 expr = md_string_from_children(scratch.arena, params); + E_Eval eval = e_eval_from_string(scratch.arena, expr); + E_Eval value_eval = e_value_eval_from_eval(eval); + scratch_end(scratch); + return value_eval.value; +} + internal E_Value df_value_from_params_key(MD_Node *params, String8 key) { @@ -5316,7 +5389,7 @@ df_eval_from_eval_cfg_table(Arena *arena, E_Eval eval, DF_CfgTable *cfg) DF_CoreViewRuleSpec *spec = df_core_view_rule_spec_from_string(val->string); if(spec->info.flags & DF_CoreViewRuleSpecInfoFlag_EvalResolution) { - eval = spec->info.eval_resolution(arena, eval, val); + eval = spec->info.eval_resolution(arena, eval, val->last->root); break; } } diff --git a/src/df/core/df_core.h b/src/df/core/df_core.h index b5803ce0..ee3124a8 100644 --- a/src/df/core/df_core.h +++ b/src/df/core/df_core.h @@ -176,7 +176,13 @@ typedef struct DF_CfgVal DF_CfgVal; typedef struct DF_CfgTable DF_CfgTable; typedef struct DF_EvalView DF_EvalView; typedef struct DF_EvalVizBlockList DF_EvalVizBlockList; -#define DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_SIG(name) E_Eval name(Arena *arena, E_Eval eval, DF_CfgVal *val) +#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)) #define DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_SIG(name) void name(Arena *arena, \ @@ -188,10 +194,12 @@ String8 string, \ E_Expr *expr, \ DF_CfgTable *cfg_table, \ S32 depth, \ -DF_CfgVal *cfg_val, \ +MD_Node *params, \ 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); @@ -246,8 +254,10 @@ enum { DF_CoreViewRuleSpecInfoFlag_Inherited = (1<<0), DF_CoreViewRuleSpecInfoFlag_Expandable = (1<<1), - DF_CoreViewRuleSpecInfoFlag_EvalResolution = (1<<2), - DF_CoreViewRuleSpecInfoFlag_VizBlockProd = (1<<3), + DF_CoreViewRuleSpecInfoFlag_ExprResolution = (1<<2), + DF_CoreViewRuleSpecInfoFlag_TypeResolution = (1<<4), + DF_CoreViewRuleSpecInfoFlag_EvalResolution = (1<<5), + DF_CoreViewRuleSpecInfoFlag_VizBlockProd = (1<<6), }; typedef struct DF_CoreViewRuleSpecInfo DF_CoreViewRuleSpecInfo; @@ -258,6 +268,8 @@ struct DF_CoreViewRuleSpecInfo String8 schema; String8 description; DF_CoreViewRuleSpecInfoFlags flags; + DF_CoreViewRuleExprResolutionHookFunctionType *expr_resolution; + DF_CoreViewRuleTypeResolutionHookFunctionType *type_resolution; DF_CoreViewRuleEvalResolutionHookFunctionType *eval_resolution; DF_CoreViewRuleVizBlockProdHookFunctionType *viz_block_prod; }; @@ -1577,6 +1589,15 @@ internal String8 df_eval_view_rule_from_key(DF_EvalView *eval_view, DF_ExpandKey //////////////////////////////// //~ rjf: Evaluation Visualization +//- 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); + //- rjf: evaluation value string builder helpers internal String8 df_string_from_ascii_value(Arena *arena, U8 val); internal String8 df_string_from_hresult_facility_code(U32 code); @@ -1626,6 +1647,7 @@ internal B32 df_viz_row_is_editable(DF_EvalVizRow *row); //- rjf: eval / view rule params tree info extraction internal U64 df_base_offset_from_eval(E_Eval eval); +internal E_Value df_value_from_params(MD_Node *params); internal E_Value df_value_from_params_key(MD_Node *params, String8 key); internal Rng1U64 df_range_from_eval_params(E_Eval eval, MD_Node *params); internal TXT_LangKind df_lang_kind_from_eval_params(E_Eval eval, MD_Node *params); diff --git a/src/df/core/df_core.mdesk b/src/df/core/df_core.mdesk index 08909915..61a4c135 100644 --- a/src/df/core/df_core.mdesk +++ b/src/df/core/df_core.mdesk @@ -454,9 +454,16 @@ DF_CoreCmdTable:// | | | | // Below is a list of the stages in the eval visualization pipeline, as well as // abbreviations which are used in the tables. // +// expr resolution, "xp" -> provides a chance for a view rule to make +// 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 or type, before the rest of the eval visual -// pipeline continues. +// value, before the rest of the eval visual pipeline +// continues. // // viz block prod, "vb" -> given a resolved eval, produce a list of non- // windowed "viz blocks", which correspond to one or @@ -517,28 +524,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 er vb display_name docs schema description) +@table(name name_lower string ih ex xp tp 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 integer primitives 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 as a simple integer value as a checkbox, 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." } } //////////////////////////////// @@ -750,6 +757,8 @@ DF_DevToggleTable: @gen { + @expand(DF_CoreViewRuleTable a) `$(a.xp == "x" -> "DF_CORE_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_DEF(" .. a.name_lower .. ");")`; + @expand(DF_CoreViewRuleTable a) `$(a.tp == "x" -> "DF_CORE_VIEW_RULE_TYPE_RESOLUTION_FUNCTION_DEF(" .. a.name_lower .. ");")`; @expand(DF_CoreViewRuleTable a) `$(a.er == "x" -> "DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(" .. a.name_lower .. ");")`; @expand(DF_CoreViewRuleTable a) `$(a.vb == "x" -> "DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(" .. a.name_lower .. ");")`; } @@ -767,7 +776,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_EvalResolution*$(a.er == "x"))|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*$(a.vb == "x")), $(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_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), }```; } //- rjf: icon kinds diff --git a/src/df/core/generated/df_core.meta.c b/src/df/core/generated/df_core.meta.c index abdd5b31..2f5d37c4 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_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 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_EvalResolution*1)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_NAME(array) , 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_EvalResolution*1)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_NAME(slice) , 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_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 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 integer primitives should be byte-swapped, such that their endianness is reversed."), (DF_CoreViewRuleSpecInfoFlag_Inherited*1)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*1)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*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_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*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_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*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_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*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_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*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_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 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_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 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_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), 0, 0, }, -{str8_lit_comp("checkbox"), str8_lit_comp("Checkbox"), str8_lit_comp(""), str8_lit_comp("Displays as a simple integer value as a checkbox, encoding zero or nonzero values."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*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_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 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_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 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_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 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_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 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_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 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_EvalResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 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_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) , }, }; String8 df_g_icon_kind_text_table[69] = diff --git a/src/df/core/generated/df_core.meta.h b/src/df/core/generated/df_core.meta.h index fdbd3ef1..c91509ee 100644 --- a/src/df/core/generated/df_core.meta.h +++ b/src/df/core/generated/df_core.meta.h @@ -430,8 +430,8 @@ U64 unwind_index; U64 inline_depth; }; -DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(array); -DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(slice); +DF_CORE_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_DEF(array); +DF_CORE_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_DEF(slice); DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(bswap); DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(default); DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(list); diff --git a/src/df/gfx/df_view_rules.c b/src/df/gfx/df_view_rules.c index adc7b7d3..925556a5 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 = e_type_unwrap(irtree.type_key); + E_TypeKey type_key = df_type_key_from_type_key_cfg(e_type_unwrap(irtree.type_key), cfg_table); 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); @@ -100,11 +100,12 @@ DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(default) // rjf: unpack array type info E_Type *array_type = e_type_from_key(scratch.arena, e_type_kind_is_pointer_or_ref(type_kind) ? direct_type_key : type_key); U64 array_count = array_type->count; + B32 need_extra_deref = e_type_kind_is_pointer_or_ref(type_kind); // 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 = expr; + last_vb->expr = e_expr_ref_deref(arena, expr); last_vb->cfg_table = cfg_table; last_vb->visual_idx_range = last_vb->semantic_idx_range = r1u64(0, array_count); } @@ -171,49 +172,98 @@ DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(default) //////////////////////////////// //~ rjf: "array" -DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(array) +DF_CORE_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_DEF(array) { -#if 0 Temp scratch = scratch_begin(&arena, 1); - E_TypeKey type_key = eval.type_key; + E_IRTreeAndType irtree = e_irtree_and_type_from_expr(scratch.arena, expr); + E_TypeKey type_key = irtree.type_key; E_TypeKind type_kind = e_type_kind_from_key(type_key); if(e_type_kind_is_pointer_or_ref(type_kind)) { - DF_CfgNode *array_node = val->last; - if(array_node != &df_g_nil_cfg_node) - { - // rjf: determine array size - U64 array_size = 0; - { - String8List array_size_expr_strs = {0}; - for(DF_CfgNode *child = array_node->first; child != &df_g_nil_cfg_node; child = child->next) - { - str8_list_push(scratch.arena, &array_size_expr_strs, child->string); - } - String8 array_size_expr = str8_list_join(scratch.arena, &array_size_expr_strs, 0); - E_Eval array_size_eval = e_eval_from_string(arena, array_size_expr); - E_Eval array_size_eval_value = e_value_eval_from_eval(array_size_eval); - e_msg_list_concat_in_place(&eval.msgs, &array_size_eval.msgs); - array_size = array_size_eval_value.value.u64; - } - - // rjf: apply array size to type - E_TypeKey pointee = e_type_ptee_from_key(type_key); - E_TypeKey array_type = e_type_key_cons_array(pointee, array_size); - eval.type_key = e_type_key_cons_ptr(e_type_state->ctx->primary_module->arch, array_type); - } + E_Value count = df_value_from_params(params); + E_TypeKey element_type_key = e_type_ptee_from_key(type_key); + E_TypeKey array_type_key = e_type_key_cons_array(element_type_key, count.u64); + E_TypeKey ptr_type_key = e_type_key_cons_ptr(e_type_state->ctx->primary_module->arch, array_type_key); + expr = e_expr_ref_cast(arena, ptr_type_key, expr); } scratch_end(scratch); -#endif - return eval; + return expr; } //////////////////////////////// //~ rjf: "slice" -DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(slice) +DF_CORE_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_DEF(slice) { - return eval; + Temp scratch = scratch_begin(&arena, 1); + E_IRTreeAndType irtree = e_irtree_and_type_from_expr(scratch.arena, expr); + E_TypeKind type_kind = e_type_kind_from_key(irtree.type_key); + if(type_kind == E_TypeKind_Struct || type_kind == E_TypeKind_Class) + { + // rjf: unpack members + E_MemberArray members = e_type_data_members_from_key(scratch.arena, irtree.type_key); + + // rjf: choose base pointer & count members + E_Member *base_ptr_member = 0; + E_Member *count_member = 0; + for(U64 idx = 0; idx < members.count; idx += 1) + { + E_Member *member = &members.v[idx]; + E_TypeKey member_type = e_type_unwrap(member->type_key); + E_TypeKind member_type_kind = e_type_kind_from_key(member_type); + if(count_member == 0 && e_type_kind_is_integer(member_type_kind)) + { + count_member = member; + } + if(base_ptr_member == 0 && e_type_kind_is_pointer_or_ref(member_type_kind)) + { + base_ptr_member = &members.v[idx]; + } + if(count_member != 0 && base_ptr_member != 0) + { + break; + } + } + + // rjf: evaluate count member, determine count + U64 count = 0; + if(count_member != 0) + { + E_Expr *count_member_expr = e_expr_ref_member_access(scratch.arena, expr, count_member->name); + E_Eval count_member_eval = e_eval_from_expr(scratch.arena, count_member_expr); + E_Eval count_member_value_eval = e_value_eval_from_eval(count_member_eval); + count = count_member_value_eval.value.u64; + } + + // rjf: generate new struct slice type + E_TypeKey slice_type_key = zero_struct; + if(base_ptr_member != 0 && count_member != 0) + { + String8 struct_name = e_type_string_from_key(scratch.arena, irtree.type_key); + E_TypeKey element_type_key = e_type_ptee_from_key(base_ptr_member->type_key); + E_TypeKey array_type_key = e_type_key_cons_array(element_type_key, count); + E_TypeKey sized_base_ptr_type_key = e_type_key_cons_ptr(e_type_state->ctx->primary_module->arch, array_type_key); + E_MemberList slice_type_members = {0}; + e_member_list_push(scratch.arena, &slice_type_members, count_member); + e_member_list_push(scratch.arena, &slice_type_members, &(E_Member){.kind = E_MemberKind_DataField, .type_key = sized_base_ptr_type_key, .name = base_ptr_member->name, .off = base_ptr_member->off}); + E_MemberArray slice_type_members_array = e_member_array_from_list(scratch.arena, &slice_type_members); + slice_type_key = e_type_key_cons(.arch = e_type_state->ctx->primary_module->arch, + .kind = E_TypeKind_Struct, + .name = struct_name, + .members = slice_type_members_array.v, + .count = slice_type_members_array.count); + } + + // rjf: generate new expression tree - addr of struct, cast-to-ptr, deref + if(base_ptr_member != 0 && count_member != 0) + { + expr = e_expr_ref_addr(arena, expr); + expr = e_expr_ref_cast(arena, e_type_key_cons_ptr(e_type_state->ctx->primary_module->arch, slice_type_key), expr); + expr = e_expr_ref_deref(arena, expr); + } + } + scratch_end(scratch); + return expr; } //////////////////////////////// diff --git a/src/df/gfx/df_views.c b/src/df/gfx/df_views.c index 7137a45f..263faf1b 100644 --- a/src/df/gfx/df_views.c +++ b/src/df/gfx/df_views.c @@ -1233,13 +1233,13 @@ df_string_from_eval_viz_row_column(Arena *arena, DF_EvalView *ev, DF_EvalVizRow }break; case DF_WatchViewColumnKind_Value: { - E_Eval eval = e_eval_from_expr(arena, row->expr); + E_Eval eval = df_eval_from_eval_cfg(arena, e_eval_from_expr(arena, row->expr), row->cfg_table); result = df_value_string_from_eval(arena, !editable * DF_EvalVizStringFlag_ReadOnlyDisplayRules, default_radix, font, font_size, max_size_px, eval, row->member, row->cfg_table); }break; case DF_WatchViewColumnKind_Type: { E_IRTreeAndType irtree = e_irtree_and_type_from_expr(arena, row->expr); - E_TypeKey type_key = irtree.type_key; + E_TypeKey type_key = df_type_key_from_type_key_cfg(irtree.type_key, row->cfg_table); 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; @@ -1249,7 +1249,7 @@ df_string_from_eval_viz_row_column(Arena *arena, DF_EvalView *ev, DF_EvalVizRow }break; case DF_WatchViewColumnKind_Module: { - E_Eval eval = e_eval_from_expr(arena, row->expr); + E_Eval eval = df_eval_from_eval_cfg(arena, e_eval_from_expr(arena, row->expr), row->cfg_table); DF_Entity *process = df_entity_from_handle(df_interact_regs()->process); DF_Entity *module = df_module_from_process_vaddr(process, eval.value.u64); result = df_display_string_from_entity(arena, module); @@ -1268,7 +1268,6 @@ df_string_from_eval_viz_row_column(Arena *arena, DF_EvalView *ev, DF_EvalVizRow { result = str8_skip(str8_chop(result, 1), 1); } - return result; } @@ -2631,7 +2630,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS U64 row_hash = df_hash_from_expand_key(row->key); B32 row_selected = (selection_tbl.min.y <= (semantic_idx+1) && (semantic_idx+1) <= selection_tbl.max.y); B32 row_expanded = df_expand_key_is_set(&eval_view->expand_tree_table, row->key); - E_Eval row_eval = e_eval_from_expr(scratch.arena, row->expr); + E_Eval row_eval = df_eval_from_eval_cfg(scratch.arena, e_eval_from_expr(scratch.arena, row->expr), row->cfg_table); B32 row_is_expandable = df_viz_row_is_expandable(row); B32 row_is_editable = df_viz_row_is_editable(row); B32 next_row_expanded = row_expanded; @@ -2915,7 +2914,6 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS case DF_WatchViewColumnKind_Type: { cell_can_edit = 0; - E_TypeKey key = cell_eval.type_key; }break; case DF_WatchViewColumnKind_ViewRule: { @@ -2978,7 +2976,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS { 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_Parent(box) UI_Flags(0) { df_error_label(cell_error_string); } @@ -6826,8 +6824,11 @@ DF_VIEW_UI_FUNCTION_DEF(Code) } DF_Font(ws, DF_FontSlot_Code) { - ui_label(path); - ui_spacer(ui_em(1.5f, 1)); + if(path.size != 0) + { + ui_label(path); + ui_spacer(ui_em(1.5f, 1)); + } ui_labelf("Line: %I64d, Column: %I64d", df_interact_regs()->cursor.line, df_interact_regs()->cursor.column); ui_spacer(ui_pct(1, 0)); ui_labelf("(read only)"); @@ -8086,6 +8087,16 @@ DF_VIEW_UI_FUNCTION_DEF(Bitmap) HS_Scope *hs_scope = hs_scope_open(); TEX_Scope *tex_scope = tex_scope_open(); + ////////////////////////////// + //- rjf: evaluate expression + // + E_Eval eval = e_eval_from_string(scratch.arena, string); + Vec2S32 dim = df_dim2s32_from_eval_params(eval, params); + R_Tex2DFormat fmt = df_tex2dformat_from_eval_params(eval, params); + U64 base_offset = df_base_offset_from_eval(eval); + U64 expected_size = dim.x*dim.y*r_tex2d_format_bytes_per_pixel_table[fmt]; + Rng1U64 offset_range = r1u64(base_offset, base_offset + expected_size); + ////////////////////////////// //- rjf: unpack params // @@ -8097,19 +8108,18 @@ DF_VIEW_UI_FUNCTION_DEF(Bitmap) }; if(zoom == 0) { - zoom = 1.f; + F32 available_dim_y = dim_2f32(rect).y; + F32 image_dim_y = (F32)dim.y; + if(image_dim_y != 0) + { + zoom = (available_dim_y / image_dim_y) * 0.8f; + } + else + { + zoom = 1.f; + } } - ////////////////////////////// - //- rjf: evaluate expression - // - E_Eval eval = e_eval_from_string(scratch.arena, string); - Vec2S32 dim = df_dim2s32_from_eval_params(eval, params); - R_Tex2DFormat fmt = df_tex2dformat_from_eval_params(eval, params); - U64 base_offset = df_base_offset_from_eval(eval); - U64 expected_size = dim.x*dim.y*r_tex2d_format_bytes_per_pixel_table[fmt]; - Rng1U64 offset_range = r1u64(base_offset, base_offset + expected_size); - ////////////////////////////// //- rjf: map expression artifacts -> texture // diff --git a/src/eval/eval.mdesk b/src/eval/eval.mdesk index 67061e55..0e88e9ef 100644 --- a/src/eval/eval.mdesk +++ b/src/eval/eval.mdesk @@ -84,7 +84,7 @@ E_ExprKindTable: { Deref UnaryPrefix 2 "*" "*" "" "" } { Address UnaryPrefix 2 "&" "&" "" "" } - { Cast Null 1 "cast" "" "" "" } + { Cast Null 1 "cast" "(" ")" "" } { Sizeof UnaryPrefix 1 "sizeof" "sizeof" "" "" } { Neg UnaryPrefix 2 "-" "-" "" "" } diff --git a/src/eval/eval_parse.c b/src/eval/eval_parse.c index 2acbaae2..169ed59e 100644 --- a/src/eval/eval_parse.c +++ b/src/eval/eval_parse.c @@ -662,6 +662,15 @@ e_expr_ref(Arena *arena, E_Expr *ref) return expr; } +internal E_Expr * +e_expr_ref_addr(Arena *arena, E_Expr *rhs) +{ + E_Expr *expr = e_push_expr(arena, E_ExprKind_Address, 0); + E_Expr *rhs_ref = e_expr_ref(arena, rhs); + e_expr_push_child(expr, rhs_ref); + return expr; +} + internal E_Expr * e_expr_ref_member_access(Arena *arena, E_Expr *lhs, String8 member_name) { @@ -695,6 +704,18 @@ e_expr_ref_deref(Arena *arena, E_Expr *rhs) return root; } +internal E_Expr * +e_expr_ref_cast(Arena *arena, E_TypeKey type_key, E_Expr *rhs) +{ + E_Expr *root = e_push_expr(arena, E_ExprKind_Cast, 0); + E_Expr *lhs = e_push_expr(arena, E_ExprKind_TypeIdent, 0); + lhs->type_key = type_key; + E_Expr *rhs_ref = e_expr_ref(arena, rhs); + e_expr_push_child(root, lhs); + e_expr_push_child(root, rhs_ref); + return root; +} + //////////////////////////////// //~ rjf: Expression Tree -> String Conversions diff --git a/src/eval/eval_parse.h b/src/eval/eval_parse.h index df8a8acb..2e5ae719 100644 --- a/src/eval/eval_parse.h +++ b/src/eval/eval_parse.h @@ -217,9 +217,11 @@ internal E_Expr *e_push_expr(Arena *arena, E_ExprKind kind, void *location); internal void e_expr_push_child(E_Expr *parent, E_Expr *child); internal E_Expr *e_expr_ref(Arena *arena, E_Expr *ref); +internal E_Expr *e_expr_ref_addr(Arena *arena, E_Expr *rhs); internal E_Expr *e_expr_ref_member_access(Arena *arena, E_Expr *lhs, String8 member_name); internal E_Expr *e_expr_ref_array_index(Arena *arena, E_Expr *lhs, U64 index); internal E_Expr *e_expr_ref_deref(Arena *arena, E_Expr *rhs); +internal E_Expr *e_expr_ref_cast(Arena *arena, E_TypeKey type_key, E_Expr *rhs); //////////////////////////////// //~ rjf: Expression Tree -> String Conversions diff --git a/src/eval/generated/eval.meta.c b/src/eval/generated/eval.meta.c index d3a86ef8..b61b2d26 100644 --- a/src/eval/generated/eval.meta.c +++ b/src/eval/generated/eval.meta.c @@ -85,7 +85,7 @@ E_OpInfo e_expr_kind_op_info_table[44] = { E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp("."), str8_lit_comp("MemberAccess") }, { E_OpKind_UnaryPrefix, 2, str8_lit_comp("*"), str8_lit_comp(""), str8_lit_comp("Deref") }, { E_OpKind_UnaryPrefix, 2, str8_lit_comp("&"), str8_lit_comp(""), str8_lit_comp("Address") }, -{ E_OpKind_Null, 1, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("Cast") }, +{ E_OpKind_Null, 1, str8_lit_comp("("), str8_lit_comp(")"), str8_lit_comp("Cast") }, { E_OpKind_UnaryPrefix, 1, str8_lit_comp("sizeof"), str8_lit_comp(""), str8_lit_comp("Sizeof") }, { E_OpKind_UnaryPrefix, 2, str8_lit_comp("-"), str8_lit_comp(""), str8_lit_comp("Neg") }, { E_OpKind_UnaryPrefix, 2, str8_lit_comp("!"), str8_lit_comp(""), str8_lit_comp("LogNot") },