- type_class = new_tpop (tpo_class , id_from_str("class" , 5), sizeof (cls_attr));
- type_struct = new_tpop (tpo_struct , id_from_str("struct" , 6), sizeof (stc_attr));
- type_method = new_tpop (tpo_method , id_from_str("method" , 6), sizeof (mtd_attr));
- type_union = new_tpop (tpo_union , id_from_str("union" , 5), sizeof (uni_attr));
- type_array = new_tpop (tpo_array , id_from_str("array" , 5), sizeof (arr_attr));
- type_enumeration = new_tpop (tpo_enumeration, id_from_str("enumeration" ,11), sizeof (enm_attr));
- type_pointer = new_tpop (tpo_pointer , id_from_str("pointer" , 7), sizeof (ptr_attr));
- type_primitive = new_tpop (tpo_primitive , id_from_str("primitive" , 9), /* sizeof (pri_attr) */ 0);
- type_id = new_tpop (tpo_id , id_from_str("type_id" , 7), /* sizeof (id_attr) */ 0);
- tpop_none = new_tpop (tpo_none , id_from_str("type_none" , 9), /* sizeof (non_attr) */ 0);
- tpop_unknown = new_tpop (tpo_unknown , id_from_str("type_unknown",12), /* sizeof (ukn_attr) */ 0);
+ type_class = new_tpop(tpo_class , ID("class"), C, sizeof (cls_attr), &class_ops);
+ type_struct = new_tpop(tpo_struct , ID("struct"), C, sizeof (stc_attr), &struct_ops);
+ type_method = new_tpop(tpo_method , ID("method"), 0, sizeof (mtd_attr), &method_ops);
+ type_union = new_tpop(tpo_union , ID("union"), C, sizeof (uni_attr), &union_ops);
+ type_array = new_tpop(tpo_array , ID("array"), C, sizeof (arr_attr), &array_ops);
+ type_enumeration = new_tpop(tpo_enumeration, ID("enumeration"), 0, sizeof (enm_attr), &enum_ops);
+ type_pointer = new_tpop(tpo_pointer , ID("pointer"), 0, sizeof (ptr_attr), &pointer_ops);
+ type_primitive = new_tpop(tpo_primitive , ID("primitive"), 0, /* sizeof (pri_attr) */ 0, &null_ops);
+ type_id = new_tpop(tpo_id , ID("type_id"), 0, /* sizeof (id_attr) */ 0, &null_ops);
+ tpop_none = new_tpop(tpo_none , ID("None"), 0, /* sizeof (non_attr) */ 0, &pseudo_ops);
+ tpop_unknown = new_tpop(tpo_unknown , ID("Unknown"), 0, /* sizeof (ukn_attr) */ 0, &pseudo_ops);
+}
+#undef ID
+#undef C
+
+/* Finalize the tpop module.
+ * Frees all type opcodes. */
+void finish_tpop(void) {
+ free_tpop(type_class ); type_class = NULL;
+ free_tpop(type_struct ); type_struct = NULL;
+ free_tpop(type_method ); type_method = NULL;
+ free_tpop(type_union ); type_union = NULL;
+ free_tpop(type_array ); type_array = NULL;
+ free_tpop(type_enumeration); type_enumeration = NULL;
+ free_tpop(type_pointer ); type_pointer = NULL;
+ free_tpop(type_primitive ); type_primitive = NULL;
+ free_tpop(type_id ); type_id = NULL;
+ free_tpop(tpop_none ); tpop_none = NULL;
+ free_tpop(tpop_unknown ); tpop_unknown = NULL;