Begin drafting up improved parsing/metadata reflection

This commit is contained in:
doyle 2019-04-05 01:03:46 +11:00
parent a6c05a950e
commit 4a794b2492
3 changed files with 782 additions and 395 deletions

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,10 @@ enum struct OpenGLShader { Vertex, Count, };
DQN_INSPECT struct SampleStruct
{
// TODO(doyle): This shit not support yet, you can imagine why
const int *const a;
int const *const b, c, *d, *e;
int ebo DQN_INSPECT_META(char const *DisplayName = "Element Buffer Object"), vbo, vao DQN_INSPECT_META(char const *DisplayName = "Vertex Array Object", int OpenGLVersion = 330);
V4 draw_color DQN_INSPECT_META(char const *DisplayName = "HelloWorld");
// #if 0
// #endif
Array<V3, 32> lights;
@ -20,12 +23,9 @@ DQN_INSPECT struct SampleStruct
char **bitmaps;
int shaders[(int)OpenGLShader::Count];
void *win32_handle;
int ebo DQN_INSPECT_META(DisplayName = "Element Buffer Object"), vbo, vao DQN_INSPECT_META(DisplayName = "Vertex Array Object", OpenGLVersion = "330");
V4 draw_color DQN_INSPECT_META(DisplayName = "HelloWorld");
V3 lighting_ambient_coeff;
int draw_call_count;
const int *const a;
const int f;
int const g;
int *const h;

View File

@ -1,4 +1,9 @@
// This is an auto generated file using Dqn_Inspect
// This is an auto generated file using DqnInspect
// NOTE: These macros are undefined at the end of the file so to not pollute namespace
#define ARRAY_COUNT(array) sizeof(array)/sizeof((array)[0])
#define CHAR_COUNT(str) (ARRAY_COUNT(str) - 1)
#define STR_AND_LEN(str) str, CHAR_COUNT(str)
//
// ..\Data\DqnInspect_TestData.h
@ -7,145 +12,268 @@
#ifndef DQN_INSPECT_DQNINSPECT_TESTDATA_H
#define DQN_INSPECT_DQNINSPECT_TESTDATA_H
// NOTE: These macros are undefined at the end of the file so to not pollute namespace
#define ARRAY_COUNT(array) sizeof(array)/sizeof((array)[0])
#define CHAR_COUNT(str) (ARRAY_COUNT(str) - 1)
#define STR_AND_LEN(str) str, CHAR_COUNT(str)
enum struct DqnInspectMemberType
{
SampleStruct,
SampleStruct_a,
SampleStruct_b,
SampleStruct_c,
SampleStruct_d,
SampleStruct_e,
SampleStruct_ebo,
SampleStruct_DQN_INSPECT_META,
SampleStruct_DisplayName,
SampleStruct_int,
SampleStruct_draw_color,
SampleStruct_lights,
SampleStruct_camera_matrixes,
SampleStruct_bitmaps,
SampleStruct_shaders,
SampleStruct_win32_handle,
SampleStruct_lighting_ambient_coeff,
SampleStruct_draw_call_count,
SampleStruct_f,
SampleStruct_g,
SampleStruct_h,
SampleStruct_i,
SampleStruct_j,
SampleStruct_k,
SampleStruct_l,
SampleStruct_m,
EnumWithMetadata,
EnumWithMetadata_Rect,
EnumWithMetadata_Square,
EnumWithMetadata_Count,
};
DqnInspect_StructMember const DqnInspect_SampleStruct_StructMembers[] =
enum struct DqnInspectDeclType
{
V3,
V4,
int,
vao,
char,
Array,
int *,
void *,
char **,
int const,
int ******,
int *const,
int const*,
SampleStruct,
char const *,
EnumWithMetadata,
int const *const,
int *********const,
};
enum struct DqnInspectMetaType
{
DisplayName,
};
char const * DqnInspectMetadata_SampleStruct_ebo_DisplayName = "Element Buffer Object";
char const * DqnInspectMetadata_SampleStruct_draw_color_DisplayName = "HelloWorld";
DqnInspectMetadata const DqnInspectMetadata_SampleStruct_ebo[] =
{
{ DqnInspectDeclType::char const *_, DqnInspectMetaType::DisplayName, &DqnInspectMetadata_SampleStruct_ebo_DisplayName},
};
DqnInspectMetadata const DqnInspectMetadata_SampleStruct_draw_color[] =
{
{ DqnInspectDeclType::char const *_, DqnInspectMetaType::DisplayName, &DqnInspectMetadata_SampleStruct_draw_color_DisplayName},
};
DqnInspectStructMember const DqnInspect_SampleStruct_StructMembers[] =
{
{
STR_AND_LEN("int const *c"), STR_AND_LEN("b"),
DqnInspectMemberType::SampleStruct_a,
STR_AND_LEN("int *const"), STR_AND_LEN("a"),
nullptr, 0, // template_expr and template_expr_len
1 // array_dimensions
1 // array_dimensions,
nullptr, 0, // metadata array
},
{
DqnInspectMemberType::SampleStruct_b,
STR_AND_LEN("int const *const"), STR_AND_LEN("b"),
nullptr, 0, // template_expr and template_expr_len
1 // array_dimensions,
nullptr, 0, // metadata array
},
{
DqnInspectMemberType::SampleStruct_c,
STR_AND_LEN("int"), STR_AND_LEN("c"),
nullptr, 0, // template_expr and template_expr_len
0 // array_dimensions
0 // array_dimensions,
nullptr, 0, // metadata array
},
{
STR_AND_LEN("int const *const b, c, *"), STR_AND_LEN("d"),
DqnInspectMemberType::SampleStruct_d,
STR_AND_LEN("int *"), STR_AND_LEN("d"),
nullptr, 0, // template_expr and template_expr_len
1 // array_dimensions
1 // array_dimensions,
nullptr, 0, // metadata array
},
{
STR_AND_LEN("int const *const b, c, *d, *"), STR_AND_LEN("e"),
DqnInspectMemberType::SampleStruct_e,
STR_AND_LEN("int *"), STR_AND_LEN("e"),
nullptr, 0, // template_expr and template_expr_len
1 // array_dimensions
},
{
STR_AND_LEN("Array"), STR_AND_LEN("lights"),
nullptr, 0, // template_expr and template_expr_len
0 // array_dimensions
},
{
STR_AND_LEN("Array"), STR_AND_LEN("camera_matrixes"),
nullptr, 0, // template_expr and template_expr_len
0 // array_dimensions
},
{
STR_AND_LEN("char **"), STR_AND_LEN("bitmaps"),
nullptr, 0, // template_expr and template_expr_len
2 // array_dimensions
},
{
STR_AND_LEN("int"), STR_AND_LEN("shaders"),
nullptr, 0, // template_expr and template_expr_len
1 // array_dimensions
},
{
STR_AND_LEN("void *"), STR_AND_LEN("win32_handle"),
nullptr, 0, // template_expr and template_expr_len
1 // array_dimensions
1 // array_dimensions,
nullptr, 0, // metadata array
},
{
DqnInspectMemberType::SampleStruct_ebo,
STR_AND_LEN("int"), STR_AND_LEN("ebo"),
nullptr, 0, // template_expr and template_expr_len
0 // array_dimensions
0 // array_dimensions,
DqnInspectVariant_SampleStruct_ebo, ARRAY_COUNT(DqnInspectVariant_SampleStruct_ebo), // metadata array
},
{
DqnInspectMemberType::SampleStruct_DQN_INSPECT_META,
STR_AND_LEN("vao"), STR_AND_LEN("DQN_INSPECT_META"),
nullptr, 0, // template_expr and template_expr_len
0 // array_dimensions
0 // array_dimensions,
nullptr, 0, // metadata array
},
{
DqnInspectMemberType::SampleStruct_DisplayName,
STR_AND_LEN("char const *"), STR_AND_LEN("DisplayName"),
nullptr, 0, // template_expr and template_expr_len
1 // array_dimensions,
nullptr, 0, // metadata array
},
{
DqnInspectMemberType::SampleStruct_int,
STR_AND_LEN("char"), STR_AND_LEN("int"),
nullptr, 0, // template_expr and template_expr_len
0 // array_dimensions,
nullptr, 0, // metadata array
},
{
DqnInspectMemberType::SampleStruct_draw_color,
STR_AND_LEN("V4"), STR_AND_LEN("draw_color"),
nullptr, 0, // template_expr and template_expr_len
0 // array_dimensions
0 // array_dimensions,
DqnInspectVariant_SampleStruct_draw_color, ARRAY_COUNT(DqnInspectVariant_SampleStruct_draw_color), // metadata array
},
{
DqnInspectMemberType::SampleStruct_lights,
STR_AND_LEN("Array"), STR_AND_LEN("lights"),
nullptr, 0, // template_expr and template_expr_len
0 // array_dimensions,
nullptr, 0, // metadata array
},
{
DqnInspectMemberType::SampleStruct_camera_matrixes,
STR_AND_LEN("Array"), STR_AND_LEN("camera_matrixes"),
nullptr, 0, // template_expr and template_expr_len
0 // array_dimensions,
nullptr, 0, // metadata array
},
{
DqnInspectMemberType::SampleStruct_bitmaps,
STR_AND_LEN("char **"), STR_AND_LEN("bitmaps"),
nullptr, 0, // template_expr and template_expr_len
2 // array_dimensions,
nullptr, 0, // metadata array
},
{
DqnInspectMemberType::SampleStruct_shaders,
STR_AND_LEN("int"), STR_AND_LEN("shaders"),
nullptr, 0, // template_expr and template_expr_len
1 // array_dimensions,
nullptr, 0, // metadata array
},
{
DqnInspectMemberType::SampleStruct_win32_handle,
STR_AND_LEN("void *"), STR_AND_LEN("win32_handle"),
nullptr, 0, // template_expr and template_expr_len
1 // array_dimensions,
nullptr, 0, // metadata array
},
{
DqnInspectMemberType::SampleStruct_lighting_ambient_coeff,
STR_AND_LEN("V3"), STR_AND_LEN("lighting_ambient_coeff"),
nullptr, 0, // template_expr and template_expr_len
0 // array_dimensions
0 // array_dimensions,
nullptr, 0, // metadata array
},
{
DqnInspectMemberType::SampleStruct_draw_call_count,
STR_AND_LEN("int"), STR_AND_LEN("draw_call_count"),
nullptr, 0, // template_expr and template_expr_len
0 // array_dimensions
0 // array_dimensions,
nullptr, 0, // metadata array
},
{
STR_AND_LEN("const"), STR_AND_LEN("int"),
DqnInspectMemberType::SampleStruct_f,
STR_AND_LEN("int"), STR_AND_LEN("f"),
nullptr, 0, // template_expr and template_expr_len
0 // array_dimensions
0 // array_dimensions,
nullptr, 0, // metadata array
},
{
STR_AND_LEN("const"), STR_AND_LEN("a"),
DqnInspectMemberType::SampleStruct_g,
STR_AND_LEN("int const"), STR_AND_LEN("g"),
nullptr, 0, // template_expr and template_expr_len
0 // array_dimensions
0 // array_dimensions,
nullptr, 0, // metadata array
},
{
STR_AND_LEN("const"), STR_AND_LEN("int"),
DqnInspectMemberType::SampleStruct_h,
STR_AND_LEN("int *const"), STR_AND_LEN("h"),
nullptr, 0, // template_expr and template_expr_len
0 // array_dimensions
},
{
STR_AND_LEN("int"), STR_AND_LEN("g"),
nullptr, 0, // template_expr and template_expr_len
0 // array_dimensions
},
{
STR_AND_LEN("int *c"), STR_AND_LEN("h"),
nullptr, 0, // template_expr and template_expr_len
1 // array_dimensions
1 // array_dimensions,
nullptr, 0, // metadata array
},
{
DqnInspectMemberType::SampleStruct_i,
STR_AND_LEN("int const*"), STR_AND_LEN("i"),
nullptr, 0, // template_expr and template_expr_len
1 // array_dimensions
1 // array_dimensions,
nullptr, 0, // metadata array
},
{
STR_AND_LEN("int *********c"), STR_AND_LEN("j"),
DqnInspectMemberType::SampleStruct_j,
STR_AND_LEN("int *********const"), STR_AND_LEN("j"),
nullptr, 0, // template_expr and template_expr_len
9 // array_dimensions
9 // array_dimensions,
nullptr, 0, // metadata array
},
{
DqnInspectMemberType::SampleStruct_k,
STR_AND_LEN("int"), STR_AND_LEN("k"),
nullptr, 0, // template_expr and template_expr_len
0 // array_dimensions
0 // array_dimensions,
nullptr, 0, // metadata array
},
{
STR_AND_LEN("int *********const j, k, ******"), STR_AND_LEN("l"),
DqnInspectMemberType::SampleStruct_l,
STR_AND_LEN("int ******"), STR_AND_LEN("l"),
nullptr, 0, // template_expr and template_expr_len
6 // array_dimensions
6 // array_dimensions,
nullptr, 0, // metadata array
},
{
STR_AND_LEN("int *********const j, k, ******l, *"), STR_AND_LEN("m"),
DqnInspectMemberType::SampleStruct_m,
STR_AND_LEN("int *"), STR_AND_LEN("m"),
nullptr, 0, // template_expr and template_expr_len
1 // array_dimensions
1 // array_dimensions,
nullptr, 0, // metadata array
},
};
DqnInspect_Struct const DqnInspect_SampleStruct_Struct =
DqnInspectStruct const DqnInspect_SampleStruct_Struct =
{
STR_AND_LEN("SampleStruct"),
DqnInspect_SampleStruct_StructMembers, // members
ARRAY_COUNT(DqnInspect_SampleStruct_StructMembers) // members_len
};
DqnInspect_Struct const *DqnInspect_GetStruct(SampleStruct const *val)
DqnInspectStruct const *DqnInspect_Struct(SampleStruct const *)
{
(void)val;
DqnInspect_Struct const *result = &DqnInspect_SampleStruct_Struct;
return result;
}
@ -173,12 +301,12 @@ bool DqnInspectMetadata_Coords(EnumWithMetadata val, V3 *value)
return false;
}
void Function1(int a, float b = {}, char const * c = nullptr, bool e = false, int f = 1, char * g = "Hello world");
void Function1(int a, float b = {}, char char const * c = nullptr, bool e = false, int f = 1, char char * g = "Hello world");
void * Function2(V3 foo = V3(10, 20, 50), V3 bar = {120, 150, 20}, ...);
Array<int const *, 3> const *const Function3(Array<int, 32> const * foobar);
#endif // DQN_INSPECT_DQNINSPECT_TESTDATA_H
#undef ARRAY_COUNT
#undef CHAR_COUNT
#undef STR_AND_LEN
#endif // DQN_INSPECT_DQNINSPECT_TESTDATA_H