metagen: simplify data tables

This commit is contained in:
Ryan Fleury
2024-02-13 11:16:45 -08:00
parent 742d2387e2
commit 1d9dc2b9a9
12 changed files with 171 additions and 235 deletions
+29 -47
View File
@@ -1739,108 +1739,90 @@ DF_DevToggleTable:
@expand(DF_CmdParamSlotTable a) `$(a.c_type) $(a.name_lower)`;
}
@table_gen_data(type:Rng1U64, fallback:0)
df_g_cmd_param_slot_range_table:
@data(Rng1U64) df_g_cmd_param_slot_range_table:
{
`{0},`
@expand(DF_CmdParamSlotTable a)
`{OffsetOf(DF_CmdParams, $(a.name_lower)), OffsetOf(DF_CmdParams, $(a.name_lower)) + sizeof($(a.c_type))},`
`{0}`,
@expand(DF_CmdParamSlotTable a) `{OffsetOf(DF_CmdParams, $(a.name_lower)), OffsetOf(DF_CmdParams, $(a.name_lower)) + sizeof($(a.c_type))}`,
}
//- rjf: entity kind tables
@table_gen_data(type: DF_IconKind, fallback: `DF_IconKind_Null`)
df_g_entity_kind_icon_kind_table:
@data(DF_IconKind) df_g_entity_kind_icon_kind_table:
{
@expand(DF_EntityKindTable a) `DF_IconKind_$(a.icon_kind),`;
@expand(DF_EntityKindTable a) `DF_IconKind_$(a.icon_kind)`,
}
@table_gen_data(type: String8, fallback: `{0}`)
df_g_entity_kind_display_string_table:
@data(String8) df_g_entity_kind_display_string_table:
{
@expand(DF_EntityKindTable a) `str8_lit_comp("$(a.display_string)"),`;
@expand(DF_EntityKindTable a) `str8_lit_comp("$(a.display_string)")`,
}
@table_gen_data(type: String8, fallback: `{0}`)
df_g_entity_kind_name_label_table:
@data(String8) df_g_entity_kind_name_label_table:
{
@expand(DF_EntityKindTable a) `str8_lit_comp("$(a.name_label)"),`;
@expand(DF_EntityKindTable a) `str8_lit_comp("$(a.name_label)")`,
}
@table_gen_data(type:DF_EntityKindFlags, fallback: `0`)
df_g_entity_kind_flags_table:
@data(DF_EntityKindFlags) df_g_entity_kind_flags_table:
{
@expand(DF_EntityKindTable a) `($(a.lf_mut_user_cfg)*DF_EntityKindFlag_LeafMutationUserConfig | $(a.lf_mut_prof_cfg)*DF_EntityKindFlag_LeafMutationProfileConfig | $(a.lf_mut_halt)*DF_EntityKindFlag_LeafMutationSoftHalt | $(a.lf_mut_dbg)*DF_EntityKindFlag_LeafMutationDebugInfoMap | $(a.tr_mut_user_cfg)*DF_EntityKindFlag_TreeMutationUserConfig | $(a.tr_mut_prof_cfg)*DF_EntityKindFlag_TreeMutationProfileConfig | $(a.tr_mut_halt)*DF_EntityKindFlag_TreeMutationSoftHalt | $(a.tr_mut_dbg)*DF_EntityKindFlag_TreeMutationDebugInfoMap | $(a.name_is_code)*DF_EntityKindFlag_NameIsCode | $(a.user_lifetime)*DF_EntityKindFlag_UserDefinedLifetime),`;
@expand(DF_EntityKindTable a) `($(a.lf_mut_user_cfg)*DF_EntityKindFlag_LeafMutationUserConfig | $(a.lf_mut_prof_cfg)*DF_EntityKindFlag_LeafMutationProfileConfig | $(a.lf_mut_halt)*DF_EntityKindFlag_LeafMutationSoftHalt | $(a.lf_mut_dbg)*DF_EntityKindFlag_LeafMutationDebugInfoMap | $(a.tr_mut_user_cfg)*DF_EntityKindFlag_TreeMutationUserConfig | $(a.tr_mut_prof_cfg)*DF_EntityKindFlag_TreeMutationProfileConfig | $(a.tr_mut_halt)*DF_EntityKindFlag_TreeMutationSoftHalt | $(a.tr_mut_dbg)*DF_EntityKindFlag_TreeMutationDebugInfoMap | $(a.name_is_code)*DF_EntityKindFlag_NameIsCode | $(a.user_lifetime)*DF_EntityKindFlag_UserDefinedLifetime)`,
}
@table_gen_data(type: DF_EntityOpFlags, fallback: `0`)
df_g_entity_kind_op_flags_table:
@data(DF_EntityOpFlags) df_g_entity_kind_op_flags_table:
{
@expand(DF_EntityKindTable a) `($(a.op_delete)*DF_EntityOpFlag_Delete) | ($(a.op_freeze)*DF_EntityOpFlag_Freeze) | ($(a.op_edit)*DF_EntityOpFlag_Edit) | ($(a.op_rename)*DF_EntityOpFlag_Rename) | ($(a.op_enable)*DF_EntityOpFlag_Enable) | ($(a.op_cond)*DF_EntityOpFlag_Condition) | ($(a.op_dup)*DF_EntityOpFlag_Duplicate),`;
@expand(DF_EntityKindTable a) `($(a.op_delete)*DF_EntityOpFlag_Delete) | ($(a.op_freeze)*DF_EntityOpFlag_Freeze) | ($(a.op_edit)*DF_EntityOpFlag_Edit) | ($(a.op_rename)*DF_EntityOpFlag_Rename) | ($(a.op_enable)*DF_EntityOpFlag_Enable) | ($(a.op_cond)*DF_EntityOpFlag_Condition) | ($(a.op_dup)*DF_EntityOpFlag_Duplicate)`,
}
//- rjf: config source tables
@table_gen_data(type: String8, fallback: DF_CoreCmdKind_Null)
df_g_cfg_src_string_table:
@data(String8) df_g_cfg_src_string_table:
{
@expand(DF_CfgSrcTable a) `str8_lit_comp("$(a.string)"),`;
@expand(DF_CfgSrcTable a) `str8_lit_comp("$(a.string)")`,
}
@table_gen_data(type: DF_CoreCmdKind, fallback: DF_CoreCmdKind_Null)
df_g_cfg_src_load_cmd_kind_table:
@data(DF_CoreCmdKind) df_g_cfg_src_load_cmd_kind_table:
{
@expand(DF_CfgSrcTable a) `DF_CoreCmdKind_$(a.load_cmd),`;
@expand(DF_CfgSrcTable a) `DF_CoreCmdKind_$(a.load_cmd)`,
}
@table_gen_data(type: DF_CoreCmdKind, fallback: DF_CoreCmdKind_Null)
df_g_cfg_src_write_cmd_kind_table:
@data(DF_CoreCmdKind) df_g_cfg_src_write_cmd_kind_table:
{
@expand(DF_CfgSrcTable a) `DF_CoreCmdKind_$(a.write_cmd),`;
@expand(DF_CfgSrcTable a) `DF_CoreCmdKind_$(a.write_cmd)`,
}
@table_gen_data(type: DF_CoreCmdKind, fallback: DF_CoreCmdKind_Null)
df_g_cfg_src_apply_cmd_kind_table:
@data(DF_CoreCmdKind) df_g_cfg_src_apply_cmd_kind_table:
{
@expand(DF_CfgSrcTable a) `DF_CoreCmdKind_$(a.apply_cmd),`;
@expand(DF_CfgSrcTable a) `DF_CoreCmdKind_$(a.apply_cmd)`;
}
//- rjf: core view rule function prototypes
@table_gen
{
``;
@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 .. ");")`;
@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 .. ");")`;
}
//- rjf: core command kind tables
@table_gen_data(type: DF_CmdSpecInfo, fallback: `{0}`) @c_file
df_g_core_cmd_kind_spec_info_table:
@data(DF_CmdSpecInfo) @c_file df_g_core_cmd_kind_spec_info_table:
{
@expand(DF_CoreCmdTable, a)
```{ str8_lit_comp("$(a.string)"), str8_lit_comp("$(a.desc)"), str8_lit_comp("$(a.search_tags)"), str8_lit_comp("$(a.display_name)"), (DF_CmdSpecFlag_OmitFromLists*$(a.lister_omit)), {DF_CmdParamSlot_$(a.q_slot), DF_EntityKind_$(a.q_ent_kind), (DF_CmdQueryFlag_AllowFiles*$(a.q_allow_files))|(DF_CmdQueryFlag_AllowFolders*$(a.q_allow_folders))|(DF_CmdQueryFlag_CodeInput*$(a.q_is_code))|(DF_CmdQueryFlag_KeepOldInput*$(a.q_keep_oi))|(DF_CmdQueryFlag_SelectOldInput*$(a.q_select_oi))|(DF_CmdQueryFlag_Required*$(a.q_required))}, DF_IconKind_$(a.canonical_icon)},```;
```{ str8_lit_comp("$(a.string)"), str8_lit_comp("$(a.desc)"), str8_lit_comp("$(a.search_tags)"), str8_lit_comp("$(a.display_name)"), (DF_CmdSpecFlag_OmitFromLists*$(a.lister_omit)), {DF_CmdParamSlot_$(a.q_slot), DF_EntityKind_$(a.q_ent_kind), (DF_CmdQueryFlag_AllowFiles*$(a.q_allow_files))|(DF_CmdQueryFlag_AllowFolders*$(a.q_allow_folders))|(DF_CmdQueryFlag_CodeInput*$(a.q_is_code))|(DF_CmdQueryFlag_KeepOldInput*$(a.q_keep_oi))|(DF_CmdQueryFlag_SelectOldInput*$(a.q_select_oi))|(DF_CmdQueryFlag_Required*$(a.q_required))}, DF_IconKind_$(a.canonical_icon)}```;
}
//- rjf: core view rule tables
@table_gen_data(type: DF_CoreViewRuleSpecInfo, fallback: `{0}`) @c_file
df_g_core_view_rule_spec_info_table:
@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.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.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), }```;
}
//- rjf: icon kinds
@table_gen_data(type: String8, fallback: `{0}`)
df_g_icon_kind_text_table:
@data(String8) df_g_icon_kind_text_table:
{
@expand(DF_IconTable a)
`str8_lit_comp("$(a.text)"),`;
@expand(DF_IconTable a) `str8_lit_comp("$(a.text)")`;
}
//- rjf: instruction metadata table
-1
View File
@@ -409,7 +409,6 @@ B32 prefer_dasm;
B32 force_confirm;
};
DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(array);
DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(bswap);
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(list);