mirror of
https://github.com/Ed94/metadesk.git
synced 2026-08-07 16:18:49 +00:00
[examples] finish type metadata commentary
This commit is contained in:
@@ -780,8 +780,21 @@ gen_check_complete_map_cases(void)
|
|||||||
|
|
||||||
//~ generators ////////////////////////////////////////////////////////////////
|
//~ generators ////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// @notes Each generator function does all of the generation for one of the
|
// @notes Each generator function handles generating every instance of a
|
||||||
// generated features we want. TODO keep going here.
|
// particular function. This means that there is only one place where the
|
||||||
|
// generator gets called and only one place where the generated code gets
|
||||||
|
// written. This keeps things simple but may be quite limiting depending on
|
||||||
|
// the use case.
|
||||||
|
//
|
||||||
|
// For instance, to have multiple groups of types and metadata generated to
|
||||||
|
// different .h/.c file pairs, we could make the output file name a parameter
|
||||||
|
// on the command line, and run the generator multiple times with different
|
||||||
|
// metadesk files.
|
||||||
|
//
|
||||||
|
// If we wanted to support references to entities accross files we would have
|
||||||
|
// to handle all the files in one run of the generator, and the generator
|
||||||
|
// functions would need to be called with different 'entities' for different
|
||||||
|
// output files.
|
||||||
|
|
||||||
void
|
void
|
||||||
gen_type_definitions_from_types(FILE *out)
|
gen_type_definitions_from_types(FILE *out)
|
||||||
@@ -801,7 +814,8 @@ gen_type_definitions_from_types(FILE *out)
|
|||||||
case GEN_TypeKind_Struct:
|
case GEN_TypeKind_Struct:
|
||||||
{
|
{
|
||||||
MD_String8 struct_name = type->node->string;
|
MD_String8 struct_name = type->node->string;
|
||||||
fprintf(out, "typedef struct %.*s %.*s;\n", MD_S8VArg(struct_name), MD_S8VArg(struct_name));
|
fprintf(out, "typedef struct %.*s %.*s;\n",
|
||||||
|
MD_S8VArg(struct_name), MD_S8VArg(struct_name));
|
||||||
fprintf(out, "struct %.*s\n", MD_S8VArg(struct_name));
|
fprintf(out, "struct %.*s\n", MD_S8VArg(struct_name));
|
||||||
fprintf(out, "{\n");
|
fprintf(out, "{\n");
|
||||||
for (GEN_TypeMember *member = type->first_member;
|
for (GEN_TypeMember *member = type->first_member;
|
||||||
|
|||||||
Reference in New Issue
Block a user