diff --git a/src/l1/codegen/list_template_inst.h b/src/l1/codegen/list_template_inst.h new file mode 100644 index 0000000..aad4a30 --- /dev/null +++ b/src/l1/codegen/list_template_inst.h @@ -0,0 +1,26 @@ +#ifndef prototype1_src_l1_codegen_list_template_inst_h +#define prototype1_src_l1_codegen_list_template_inst_h + +#include "codegen.h" + +typedef struct { + SpanU8 T; + bool t_primitive; + bool t_clonable; +} list_instantiation_op; + +NODISCARD VecU8 generate_List_template_instantiation(list_instantiation_op op){ + if (op.t_primitive) + op.t_clonable = true; + assert(op.T.len > 0); + + VecU8 res = VecU8_fmt( + "typedef struct ListNode_%s ListNode_%s;\n" /* op.T, op.T */ + "struct ListNode_%s {\n" /* op.T */ + SPACE "" + "}\n\n" + ); + return res; +} + +#endif \ No newline at end of file