merge view rules & view specs entirely; simplify graphical view rules down to single hook

This commit is contained in:
Ryan Fleury
2024-09-16 14:44:28 -07:00
parent 84f685803d
commit 9899efe93c
19 changed files with 680 additions and 1153 deletions
@@ -113,5 +113,5 @@ EV_ViewRuleTable:
@data(EV_ViewRuleInfo) @c_file ev_builtin_view_rule_info_table:
{
@expand(EV_ViewRuleTable a)
```{str8_lit_comp("$(a.string)"), (EV_ViewRuleInfoFlag_Inherited*$(a.ih == "x"))|(EV_ViewRuleInfoFlag_Expandable*$(a.ex == "x"))|(EV_ViewRuleInfoFlag_ExprResolution*$(a.xp == "x"))|(EV_ViewRuleInfoFlag_VizBlockProd*$(a.vb == "x")), $(a.xp == "x" -> "EV_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME("..a.name_lower..")") $(a.xp != "x" -> 0), $(a.vb == "x" -> "EV_VIEW_RULE_BLOCK_PROD_FUNCTION_NAME("..a.name_lower..")") $(a.vb != "x" -> 0), }```;
```{str8_lit_comp("$(a.string)"), (EV_ViewRuleInfoFlag_Inherited*$(a.ih == "x"))|(EV_ViewRuleInfoFlag_Expandable*$(a.ex == "x")), $(a.xp == "x" -> "EV_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME("..a.name_lower..")") $(a.xp != "x" -> 0), $(a.vb == "x" -> "EV_VIEW_RULE_BLOCK_PROD_FUNCTION_NAME("..a.name_lower..")") $(a.vb != "x" -> 0), }```;
}
@@ -417,7 +417,7 @@ ev_expr_from_expr_view_rules(Arena *arena, E_Expr *expr, EV_ViewRuleList *view_r
for(EV_ViewRuleNode *n = view_rules->first; n != 0; n = n->next)
{
EV_ViewRuleInfo *info = ev_view_rule_info_from_string(n->v.root->string);
if(info->flags & EV_ViewRuleInfoFlag_ExprResolution)
if(info->expr_resolution != 0)
{
expr = info->expr_resolution(arena, expr, n->v.root);
}
@@ -501,7 +501,7 @@ ev_append_expr_blocks__rec(Arena *arena, EV_View *view, EV_Key parent_key, EV_Ke
for(EV_ViewRuleNode *n = view_rules->first; n != 0; n = n->next)
{
EV_ViewRuleInfo *tln_info = ev_view_rule_info_from_string(n->v.root->string);
if(tln_info->flags & EV_ViewRuleInfoFlag_VizBlockProd)
if(tln_info->block_prod != 0)
{
block_prod_view_rule_info = tln_info;
block_prod_view_rule_params = n->v.root;
@@ -863,6 +863,7 @@ ev_row_list_push_new(Arena *arena, EV_View *view, EV_WindowedRowList *rows, EV_B
}
// rjf: fill
row->block_kind = block->kind;
row->depth = block->depth;
row->parent_key = block->parent_key;
row->key = key;
@@ -192,8 +192,6 @@ enum
{
EV_ViewRuleInfoFlag_Inherited = (1<<0),
EV_ViewRuleInfoFlag_Expandable = (1<<1),
EV_ViewRuleInfoFlag_ExprResolution = (1<<2),
EV_ViewRuleInfoFlag_VizBlockProd = (1<<3),
};
typedef struct EV_ViewRuleInfo EV_ViewRuleInfo;
@@ -246,6 +244,7 @@ struct EV_Row
EV_Row *next;
// rjf: block hierarchy info
EV_BlockKind block_kind;
S32 depth;
EV_Key parent_key;
EV_Key key;
@@ -6,11 +6,11 @@
C_LINKAGE_BEGIN
EV_ViewRuleInfo ev_builtin_view_rule_info_table[5] =
{
{str8_lit_comp("default"), (EV_ViewRuleInfoFlag_Inherited*0)|(EV_ViewRuleInfoFlag_Expandable*0)|(EV_ViewRuleInfoFlag_ExprResolution*0)|(EV_ViewRuleInfoFlag_VizBlockProd*1), 0, EV_VIEW_RULE_BLOCK_PROD_FUNCTION_NAME(default) , },
{str8_lit_comp("array"), (EV_ViewRuleInfoFlag_Inherited*0)|(EV_ViewRuleInfoFlag_Expandable*0)|(EV_ViewRuleInfoFlag_ExprResolution*1)|(EV_ViewRuleInfoFlag_VizBlockProd*0), EV_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME(array) , 0, },
{str8_lit_comp("slice"), (EV_ViewRuleInfoFlag_Inherited*0)|(EV_ViewRuleInfoFlag_Expandable*0)|(EV_ViewRuleInfoFlag_ExprResolution*1)|(EV_ViewRuleInfoFlag_VizBlockProd*0), EV_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME(slice) , 0, },
{str8_lit_comp("bswap"), (EV_ViewRuleInfoFlag_Inherited*1)|(EV_ViewRuleInfoFlag_Expandable*0)|(EV_ViewRuleInfoFlag_ExprResolution*1)|(EV_ViewRuleInfoFlag_VizBlockProd*0), EV_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME(bswap) , 0, },
{str8_lit_comp("cast"), (EV_ViewRuleInfoFlag_Inherited*0)|(EV_ViewRuleInfoFlag_Expandable*0)|(EV_ViewRuleInfoFlag_ExprResolution*1)|(EV_ViewRuleInfoFlag_VizBlockProd*0), EV_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME(cast) , 0, },
{str8_lit_comp("default"), (EV_ViewRuleInfoFlag_Inherited*0)|(EV_ViewRuleInfoFlag_Expandable*0), 0, EV_VIEW_RULE_BLOCK_PROD_FUNCTION_NAME(default) , },
{str8_lit_comp("array"), (EV_ViewRuleInfoFlag_Inherited*0)|(EV_ViewRuleInfoFlag_Expandable*0), EV_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME(array) , 0, },
{str8_lit_comp("slice"), (EV_ViewRuleInfoFlag_Inherited*0)|(EV_ViewRuleInfoFlag_Expandable*0), EV_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME(slice) , 0, },
{str8_lit_comp("bswap"), (EV_ViewRuleInfoFlag_Inherited*1)|(EV_ViewRuleInfoFlag_Expandable*0), EV_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME(bswap) , 0, },
{str8_lit_comp("cast"), (EV_ViewRuleInfoFlag_Inherited*0)|(EV_ViewRuleInfoFlag_Expandable*0), EV_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME(cast) , 0, },
};
C_LINKAGE_END