Save the decl type in struct members as well

This commit is contained in:
doyle 2019-04-22 01:28:59 +10:00
parent c444d50d17
commit 455d9bcbfc
2 changed files with 28 additions and 2 deletions

View File

@ -62,8 +62,9 @@ struct DqnInspectMetadata
struct DqnInspectMember struct DqnInspectMember
{ {
enum struct DqnInspectMemberType type_enum; enum struct DqnInspectMemberType type_enum;
char const * type; enum struct DqnInspectDeclType decl_type;
int type_len; char const * decl_type_str;
int decl_type_len;
char const * name; char const * name;
int name_len; int name_len;
char const * template_expr; char const * template_expr;
@ -2050,6 +2051,7 @@ int main(int argc, char *argv[])
indent_level++; indent_level++;
FprintfIndented(output_file, indent_level, "DqnInspectMemberType::%.*s_%.*s,\n", parsed_struct->name.len, parsed_struct->name.str, decl->name.len, decl->name.str); FprintfIndented(output_file, indent_level, "DqnInspectMemberType::%.*s_%.*s,\n", parsed_struct->name.len, parsed_struct->name.str, decl->name.len, decl->name.str);
FprintfIndented(output_file, indent_level, "DqnInspectDeclType::%.*s_,\n", decl->type.len, decl->type.str);
FprintfIndented(output_file, indent_level, "STR_AND_LEN(\"%.*s\"), ", decl->type.len, decl->type.str); FprintfIndented(output_file, indent_level, "STR_AND_LEN(\"%.*s\"), ", decl->type.len, decl->type.str);
fprintf(output_file, "STR_AND_LEN(\"%.*s\"),\n", decl->name.len, decl->name.str); fprintf(output_file, "STR_AND_LEN(\"%.*s\"),\n", decl->name.len, decl->name.str);

View File

@ -96,6 +96,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
{ {
{ {
DqnInspectMemberType::SampleStruct_ebo, DqnInspectMemberType::SampleStruct_ebo,
DqnInspectDeclType::int_,
STR_AND_LEN("int"), STR_AND_LEN("ebo"), STR_AND_LEN("int"), STR_AND_LEN("ebo"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
0, // array_dimensions 0, // array_dimensions
@ -103,6 +104,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_vbo, DqnInspectMemberType::SampleStruct_vbo,
DqnInspectDeclType::int_,
STR_AND_LEN("int"), STR_AND_LEN("vbo"), STR_AND_LEN("int"), STR_AND_LEN("vbo"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
0, // array_dimensions 0, // array_dimensions
@ -110,6 +112,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_vao, DqnInspectMemberType::SampleStruct_vao,
DqnInspectDeclType::int_,
STR_AND_LEN("int"), STR_AND_LEN("vao"), STR_AND_LEN("int"), STR_AND_LEN("vao"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
0, // array_dimensions 0, // array_dimensions
@ -117,6 +120,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_a, DqnInspectMemberType::SampleStruct_a,
DqnInspectDeclType::int *const_,
STR_AND_LEN("int *const"), STR_AND_LEN("a"), STR_AND_LEN("int *const"), STR_AND_LEN("a"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
1, // array_dimensions 1, // array_dimensions
@ -124,6 +128,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_b, DqnInspectMemberType::SampleStruct_b,
DqnInspectDeclType::int const *const_,
STR_AND_LEN("int const *const"), STR_AND_LEN("b"), STR_AND_LEN("int const *const"), STR_AND_LEN("b"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
1, // array_dimensions 1, // array_dimensions
@ -131,6 +136,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_c, DqnInspectMemberType::SampleStruct_c,
DqnInspectDeclType::int_,
STR_AND_LEN("int"), STR_AND_LEN("c"), STR_AND_LEN("int"), STR_AND_LEN("c"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
0, // array_dimensions 0, // array_dimensions
@ -138,6 +144,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_d, DqnInspectMemberType::SampleStruct_d,
DqnInspectDeclType::int *_,
STR_AND_LEN("int *"), STR_AND_LEN("d"), STR_AND_LEN("int *"), STR_AND_LEN("d"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
1, // array_dimensions 1, // array_dimensions
@ -145,6 +152,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_e, DqnInspectMemberType::SampleStruct_e,
DqnInspectDeclType::int *_,
STR_AND_LEN("int *"), STR_AND_LEN("e"), STR_AND_LEN("int *"), STR_AND_LEN("e"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
1, // array_dimensions 1, // array_dimensions
@ -152,6 +160,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_draw_color, DqnInspectMemberType::SampleStruct_draw_color,
DqnInspectDeclType::V4_,
STR_AND_LEN("V4"), STR_AND_LEN("draw_color"), STR_AND_LEN("V4"), STR_AND_LEN("draw_color"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
0, // array_dimensions 0, // array_dimensions
@ -159,6 +168,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_lights, DqnInspectMemberType::SampleStruct_lights,
DqnInspectDeclType::Array_,
STR_AND_LEN("Array"), STR_AND_LEN("lights"), STR_AND_LEN("Array"), STR_AND_LEN("lights"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
0, // array_dimensions 0, // array_dimensions
@ -166,6 +176,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_camera_matrixes, DqnInspectMemberType::SampleStruct_camera_matrixes,
DqnInspectDeclType::Array_,
STR_AND_LEN("Array"), STR_AND_LEN("camera_matrixes"), STR_AND_LEN("Array"), STR_AND_LEN("camera_matrixes"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
0, // array_dimensions 0, // array_dimensions
@ -173,6 +184,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_bitmaps, DqnInspectMemberType::SampleStruct_bitmaps,
DqnInspectDeclType::char **_,
STR_AND_LEN("char **"), STR_AND_LEN("bitmaps"), STR_AND_LEN("char **"), STR_AND_LEN("bitmaps"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
2, // array_dimensions 2, // array_dimensions
@ -180,6 +192,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_shaders, DqnInspectMemberType::SampleStruct_shaders,
DqnInspectDeclType::int_,
STR_AND_LEN("int"), STR_AND_LEN("shaders"), STR_AND_LEN("int"), STR_AND_LEN("shaders"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
1, // array_dimensions 1, // array_dimensions
@ -187,6 +200,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_win32_handle, DqnInspectMemberType::SampleStruct_win32_handle,
DqnInspectDeclType::void *_,
STR_AND_LEN("void *"), STR_AND_LEN("win32_handle"), STR_AND_LEN("void *"), STR_AND_LEN("win32_handle"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
1, // array_dimensions 1, // array_dimensions
@ -194,6 +208,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_lighting_ambient_coeff, DqnInspectMemberType::SampleStruct_lighting_ambient_coeff,
DqnInspectDeclType::V3_,
STR_AND_LEN("V3"), STR_AND_LEN("lighting_ambient_coeff"), STR_AND_LEN("V3"), STR_AND_LEN("lighting_ambient_coeff"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
0, // array_dimensions 0, // array_dimensions
@ -201,6 +216,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_draw_call_count, DqnInspectMemberType::SampleStruct_draw_call_count,
DqnInspectDeclType::int_,
STR_AND_LEN("int"), STR_AND_LEN("draw_call_count"), STR_AND_LEN("int"), STR_AND_LEN("draw_call_count"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
0, // array_dimensions 0, // array_dimensions
@ -208,6 +224,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_f, DqnInspectMemberType::SampleStruct_f,
DqnInspectDeclType::int_,
STR_AND_LEN("int"), STR_AND_LEN("f"), STR_AND_LEN("int"), STR_AND_LEN("f"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
0, // array_dimensions 0, // array_dimensions
@ -215,6 +232,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_g, DqnInspectMemberType::SampleStruct_g,
DqnInspectDeclType::int const_,
STR_AND_LEN("int const"), STR_AND_LEN("g"), STR_AND_LEN("int const"), STR_AND_LEN("g"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
0, // array_dimensions 0, // array_dimensions
@ -222,6 +240,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_h, DqnInspectMemberType::SampleStruct_h,
DqnInspectDeclType::int *const_,
STR_AND_LEN("int *const"), STR_AND_LEN("h"), STR_AND_LEN("int *const"), STR_AND_LEN("h"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
1, // array_dimensions 1, // array_dimensions
@ -229,6 +248,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_i, DqnInspectMemberType::SampleStruct_i,
DqnInspectDeclType::int const*_,
STR_AND_LEN("int const*"), STR_AND_LEN("i"), STR_AND_LEN("int const*"), STR_AND_LEN("i"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
1, // array_dimensions 1, // array_dimensions
@ -236,6 +256,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_j, DqnInspectMemberType::SampleStruct_j,
DqnInspectDeclType::int *********const_,
STR_AND_LEN("int *********const"), STR_AND_LEN("j"), STR_AND_LEN("int *********const"), STR_AND_LEN("j"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
9, // array_dimensions 9, // array_dimensions
@ -243,6 +264,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_k, DqnInspectMemberType::SampleStruct_k,
DqnInspectDeclType::int_,
STR_AND_LEN("int"), STR_AND_LEN("k"), STR_AND_LEN("int"), STR_AND_LEN("k"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
0, // array_dimensions 0, // array_dimensions
@ -250,6 +272,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_l, DqnInspectMemberType::SampleStruct_l,
DqnInspectDeclType::int ******_,
STR_AND_LEN("int ******"), STR_AND_LEN("l"), STR_AND_LEN("int ******"), STR_AND_LEN("l"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
6, // array_dimensions 6, // array_dimensions
@ -257,6 +280,7 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
}, },
{ {
DqnInspectMemberType::SampleStruct_m, DqnInspectMemberType::SampleStruct_m,
DqnInspectDeclType::int *_,
STR_AND_LEN("int *"), STR_AND_LEN("m"), STR_AND_LEN("int *"), STR_AND_LEN("m"),
nullptr, 0, // template_expr and template_expr_len nullptr, 0, // template_expr and template_expr_len
1, // array_dimensions 1, // array_dimensions