mirror of
https://github.com/Ed94/metadesk.git
synced 2026-08-06 07:38:45 +00:00
[examples] get type info final program fully building
This commit is contained in:
@@ -20,12 +20,12 @@ F32 r;
|
|||||||
U32 count;
|
U32 count;
|
||||||
V2F32 *p;
|
V2F32 *p;
|
||||||
};
|
};
|
||||||
enum Shape
|
typedef enum Shape
|
||||||
{
|
{
|
||||||
Shape_Circle = 1,
|
Shape_Circle = 1,
|
||||||
Shape_Segment = 2,
|
Shape_Segment = 2,
|
||||||
Shape_Polygon = 3,
|
Shape_Polygon = 3,
|
||||||
};
|
} Shape;
|
||||||
TypeInfo* type_info_from_shape(Shape v);
|
TypeInfo* type_info_from_shape(Shape v);
|
||||||
U32 max_slot_from_shape(Shape v);
|
U32 max_slot_from_shape(Shape v);
|
||||||
#endif // META_TYEPS_H
|
#endif // META_TYEPS_H
|
||||||
|
|||||||
@@ -6,9 +6,26 @@
|
|||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//~ setup base types //////////////////////////////////////////////////////////
|
||||||
|
#include <stdint.h>
|
||||||
|
typedef uint32_t U32;
|
||||||
|
typedef float F32;
|
||||||
|
typedef struct V2F32 V2F32;
|
||||||
|
struct V2F32
|
||||||
|
{
|
||||||
|
F32 x;
|
||||||
|
F32 y;
|
||||||
|
};
|
||||||
|
|
||||||
|
//~ include types for type info ///////////////////////////////////////////////
|
||||||
|
#include "type_info.h"
|
||||||
|
|
||||||
|
//~ include generated type info ///////////////////////////////////////////////
|
||||||
#include "generated/meta_types.h"
|
#include "generated/meta_types.h"
|
||||||
#include "generated/meta_types.c"
|
#include "generated/meta_types.c"
|
||||||
|
|
||||||
|
//~ main //////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ generate_type_definitions(FILE *out, TypeInfo *first_type)
|
|||||||
case TypeKind_Enum:
|
case TypeKind_Enum:
|
||||||
{
|
{
|
||||||
MD_String8 enum_name = type->node->string;
|
MD_String8 enum_name = type->node->string;
|
||||||
fprintf(out, "enum %.*s\n", MD_S8VArg(enum_name));
|
fprintf(out, "typedef enum %.*s\n", MD_S8VArg(enum_name));
|
||||||
fprintf(out, "{\n");
|
fprintf(out, "{\n");
|
||||||
for (TypeEnumerant *enumerant = type->first_enumerant;
|
for (TypeEnumerant *enumerant = type->first_enumerant;
|
||||||
enumerant != 0;
|
enumerant != 0;
|
||||||
@@ -136,7 +136,7 @@ generate_type_definitions(FILE *out, TypeInfo *first_type)
|
|||||||
fprintf(out, "%.*s_%.*s = %d,\n",
|
fprintf(out, "%.*s_%.*s = %d,\n",
|
||||||
MD_S8VArg(enum_name), MD_S8VArg(member_name), enumerant->value);
|
MD_S8VArg(enum_name), MD_S8VArg(member_name), enumerant->value);
|
||||||
}
|
}
|
||||||
fprintf(out, "};\n");
|
fprintf(out, "} %.*s;\n", MD_S8VArg(enum_name));
|
||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user