Change inspect function macro to DQN_INSPECT_FUNCTION

This commit is contained in:
doyle 2019-05-03 20:23:14 +10:00
parent 1890745719
commit fbba79ee4a
3 changed files with 110 additions and 80 deletions

View File

@ -53,7 +53,7 @@
#define DQN_INSPECT #define DQN_INSPECT
#define DQN_INSPECT_META(...) #define DQN_INSPECT_META(...)
#define DQN_INSPECT_GENERATE_PROTOTYPE(...) #define DQN_INSPECT_FUNCTION(...)
struct DqnInspectMetadata struct DqnInspectMetadata
{ {
@ -446,7 +446,7 @@ Slice<char> Asprintf(MemArena *arena, char const *fmt, ...)
X(Ampersand, "&") \ X(Ampersand, "&") \
X(VarArgs, "Variable Args (...)") \ X(VarArgs, "Variable Args (...)") \
X(InspectCode, "DQN_INSPECT") \ X(InspectCode, "DQN_INSPECT") \
X(InspectGeneratePrototype, "DQN_INSPECT_GENERATE_PROTOTYPE") \ X(InspectFunction, "DQN_INSPECT_FUNCTION") \
X(Hash, "#") X(Hash, "#")
#define X(decl, str) decl, #define X(decl, str) decl,
@ -908,7 +908,7 @@ enum struct ParsedCodeType
Invalid, Invalid,
Struct, Struct,
Enum, Enum,
FunctionPrototype, Function,
}; };
struct ParsedEnum struct ParsedEnum
@ -925,7 +925,7 @@ struct ParsedStruct
}; };
struct ParsedFunctionPrototype struct ParsedFunction
{ {
Slice<char> return_type; Slice<char> return_type;
Slice<char> name; Slice<char> name;
@ -940,7 +940,7 @@ struct ParsedCode
union union
{ {
ParsedEnum parsed_enum; ParsedEnum parsed_enum;
ParsedFunctionPrototype parsed_func_prototype; ParsedFunction parsed_func;
ParsedStruct parsed_struct; ParsedStruct parsed_struct;
}; };
}; };
@ -1122,11 +1122,11 @@ b32 ParseCPPStruct(CPPTokeniser *tokeniser, ParsedStruct *parsed_struct)
return true; return true;
} }
b32 ParseCPPInspectPrototype(CPPTokeniser *tokeniser, ParsedFunctionPrototype *parsed_func) b32 ParseCPPInspectFunction(CPPTokeniser *tokeniser, ParsedFunction *parsed_func)
{ {
*parsed_func = {}; *parsed_func = {};
CPPToken token = CPPTokeniser_NextToken(tokeniser); CPPToken token = CPPTokeniser_NextToken(tokeniser);
if (!ExpectToken(token, CPPTokenType::InspectGeneratePrototype)) if (!ExpectToken(token, CPPTokenType::InspectFunction))
return false; return false;
struct FunctionDefaultParam struct FunctionDefaultParam
@ -1295,7 +1295,7 @@ enum struct InspectMode
{ {
All, All,
Code, Code,
GenerateProtypes Function
}; };
char *EnumOrStructOrFunctionLexer(CPPTokeniser *tokeniser, char *ptr, b32 lexing_function) char *EnumOrStructOrFunctionLexer(CPPTokeniser *tokeniser, char *ptr, b32 lexing_function)
@ -1503,8 +1503,8 @@ int main(int argc, char *argv[])
usize starting_arg_index = 1; usize starting_arg_index = 1;
char const *mode_str = argv[1]; char const *mode_str = argv[1];
InspectMode mode = InspectMode::All; InspectMode mode = InspectMode::All;
if (strcmp(mode_str, "code") == 0) mode = InspectMode::Code; if (strcmp(mode_str, "code") == 0) mode = InspectMode::Code;
else if (strcmp(mode_str, "generate_prototypes") == 0) mode = InspectMode::GenerateProtypes; else if (strcmp(mode_str, "function") == 0) mode = InspectMode::Function;
if (mode != InspectMode::All) if (mode != InspectMode::All)
starting_arg_index++; starting_arg_index++;
@ -1582,10 +1582,10 @@ int main(int argc, char *argv[])
tokeniser.tokens_max = 16384; tokeniser.tokens_max = 16384;
tokeniser.tokens = MEM_ARENA_ALLOC_ARRAY(&global_main_arena, CPPToken, tokeniser.tokens_max); tokeniser.tokens = MEM_ARENA_ALLOC_ARRAY(&global_main_arena, CPPToken, tokeniser.tokens_max);
Slice<char const> const INSPECT_PROTOTYPE = SLICE_LITERAL("DQN_INSPECT_GENERATE_PROTOTYPE"); Slice<char const> const INSPECT_FUNCTION = SLICE_LITERAL("DQN_INSPECT_FUNCTION");
Slice<char const> const INSPECT_PREFIX = SLICE_LITERAL("DQN_INSPECT"); Slice<char const> const INSPECT_PREFIX = SLICE_LITERAL("DQN_INSPECT");
char *file_buf_end = file_buf + file_size; char *file_buf_end = file_buf + file_size;
Slice<char> buffer = Slice<char>(file_buf, static_cast<int>(file_size)); Slice<char> buffer = Slice<char>(file_buf, static_cast<int>(file_size));
for (char *ptr = StrFind(buffer, INSPECT_PREFIX); for (char *ptr = StrFind(buffer, INSPECT_PREFIX);
ptr; ptr;
@ -1601,19 +1601,19 @@ int main(int argc, char *argv[])
}; };
CPPTokenType inspect_type = CPPTokenType::InspectCode; CPPTokenType inspect_type = CPPTokenType::InspectCode;
if (Slice_Cmp(Slice<char const>(ptr, INSPECT_PROTOTYPE.len), INSPECT_PROTOTYPE)) if (Slice_Cmp(Slice<char const>(ptr, INSPECT_FUNCTION.len), INSPECT_FUNCTION))
{ {
inspect_type = CPPTokenType::InspectGeneratePrototype; inspect_type = CPPTokenType::InspectFunction;
} }
if (inspect_type == CPPTokenType::InspectCode) if (inspect_type == CPPTokenType::InspectCode)
{ {
ptr += INSPECT_PREFIX.len; ptr += INSPECT_PREFIX.len;
if (mode == InspectMode::GenerateProtypes) continue; if (mode == InspectMode::Function) continue;
} }
else else
{ {
ptr += INSPECT_PROTOTYPE.len; ptr += INSPECT_FUNCTION.len;
if (mode == InspectMode::Code) continue; if (mode == InspectMode::Code) continue;
} }
@ -1621,7 +1621,7 @@ int main(int argc, char *argv[])
inspect_token->type = inspect_type; inspect_token->type = inspect_type;
inspect_token->str = marker_str; inspect_token->str = marker_str;
inspect_token->len = marker_len; inspect_token->len = marker_len;
ptr = EnumOrStructOrFunctionLexer(&tokeniser, ptr, inspect_type == CPPTokenType::InspectGeneratePrototype); ptr = EnumOrStructOrFunctionLexer(&tokeniser, ptr, inspect_type == CPPTokenType::InspectFunction);
} }
@ -1633,7 +1633,7 @@ int main(int argc, char *argv[])
token = CPPTokeniser_PeekToken(&tokeniser)) token = CPPTokeniser_PeekToken(&tokeniser))
{ {
ParsedCode parsed_code = {}; ParsedCode parsed_code = {};
if (token.type == CPPTokenType::InspectCode || token.type == CPPTokenType::InspectGeneratePrototype) if (token.type == CPPTokenType::InspectCode || token.type == CPPTokenType::InspectFunction)
{ {
if (token.type == CPPTokenType::InspectCode) if (token.type == CPPTokenType::InspectCode)
{ {
@ -1653,11 +1653,11 @@ int main(int argc, char *argv[])
} }
else else
{ {
if (ParseCPPInspectPrototype(&tokeniser, &parsed_code.parsed_func_prototype)) if (ParseCPPInspectFunction(&tokeniser, &parsed_code.parsed_func))
{ {
parsed_code.type = ParsedCodeType::FunctionPrototype; parsed_code.type = ParsedCodeType::Function;
parsing_results.max_func_return_type_decl_len = INSPECT_MAX(parsing_results.max_func_return_type_decl_len, parsed_code.parsed_func_prototype.return_type.len); parsing_results.max_func_return_type_decl_len = INSPECT_MAX(parsing_results.max_func_return_type_decl_len, parsed_code.parsed_func.return_type.len);
parsing_results.max_func_name_decl_len = INSPECT_MAX(parsing_results.max_func_name_decl_len, parsed_code.parsed_func_prototype.name.len); parsing_results.max_func_name_decl_len = INSPECT_MAX(parsing_results.max_func_name_decl_len, parsed_code.parsed_func.name.len);
} }
} }
} }
@ -2304,9 +2304,9 @@ int main(int argc, char *argv[])
} }
break; break;
case ParsedCodeType::FunctionPrototype: case ParsedCodeType::Function:
{ {
ParsedFunctionPrototype *parsed_func = &code.parsed_func_prototype; ParsedFunction *parsed_func = &code.parsed_func;
if (parsed_func->has_comments) if (parsed_func->has_comments)
{ {
for (LinkedList<Slice<char>> const *comment_link = &parsed_func->comments; for (LinkedList<Slice<char>> const *comment_link = &parsed_func->comments;

View File

@ -40,14 +40,14 @@ DQN_INSPECT enum struct EnumWithMetadata
Count, Count,
}; };
DQN_INSPECT_GENERATE_PROTOTYPE(b = {}, c = nullptr, e = false, f = 1, g = "Hello world") DQN_INSPECT_FUNCTION(b = {}, c = nullptr, e = false, f = 1, g = "Hello world")
void Function1(int a, float b, char const *c, bool e, int f, char *g) void Function1(int a, float b, char const *c, bool e, int f, char *g)
{ {
(void)a; (void)b; (void)c; (void)e; (void)f; (void)g; (void)a; (void)b; (void)c; (void)e; (void)f; (void)g;
} }
DQN_INSPECT_GENERATE_PROTOTYPE(foo = V3(10, 20, 50), bar = {120, 150, 20}) DQN_INSPECT_FUNCTION(foo = V3(10, 20, 50), bar = {120, 150, 20})
void *Function2(V3 foo, V3 bar, ...) { (void)foo; (void)bar; return nullptr; } void *Function2(V3 foo, V3 bar, ...) { (void)foo; (void)bar; return nullptr; }
DQN_INSPECT_GENERATE_PROTOTYPE() DQN_INSPECT_FUNCTION()
Array<int const *, 3> const *const Function3(Array<int, 32> const *foobar) { (void)foobar; return {}; } Array<int const *, 3> const *const Function3(Array<int, 32> const *foobar) { (void)foobar; return {}; }

View File

@ -40,11 +40,14 @@ enum struct DqnInspectMemberType
enum struct DqnInspectDeclType enum struct DqnInspectDeclType
{ {
NotAvailable_,
V3_, V3_,
V4_, V4_,
int_, int_,
Array_, Array_,
int_Ptr_, int_Ptr_,
V3,_32_,
V4,_32_,
int_Ptr_Ptr_, int_Ptr_Ptr_,
void_Ptr_, void_Ptr_,
char_Ptr_Ptr_, char_Ptr_Ptr_,
@ -53,6 +56,8 @@ enum struct DqnInspectDeclType
int_const_Ptr_, int_const_Ptr_,
SampleStruct_, SampleStruct_,
char_const_Ptr_, char_const_Ptr_,
Array_V3,_32_,
Array_V4,_32_,
int_Ptr_Ptr_Ptr_Ptr_const_, int_Ptr_Ptr_Ptr_Ptr_const_,
EnumWithMetadata_, EnumWithMetadata_,
int_const_Ptr_const_, int_const_Ptr_const_,
@ -98,8 +103,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_ebo, STR_AND_LEN("ebo"), DqnInspectMemberType::SampleStruct_ebo, STR_AND_LEN("ebo"),
offsetof(SampleStruct, ebo), offsetof(SampleStruct, ebo),
DqnInspectDeclType::int_, STR_AND_LEN("int"), DqnInspectDeclType::int_, STR_AND_LEN("int"),
sizeof(((SampleStruct *)0)->ebo), // decl_type_sizeof sizeof(((SampleStruct *)0)->ebo), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::int_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
0, // array_dimensions 0, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
DqnInspectMetadata_SampleStruct_ebo, ARRAY_COUNT(DqnInspectMetadata_SampleStruct_ebo), // metadata array DqnInspectMetadata_SampleStruct_ebo, ARRAY_COUNT(DqnInspectMetadata_SampleStruct_ebo), // metadata array
@ -108,8 +114,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_vbo, STR_AND_LEN("vbo"), DqnInspectMemberType::SampleStruct_vbo, STR_AND_LEN("vbo"),
offsetof(SampleStruct, vbo), offsetof(SampleStruct, vbo),
DqnInspectDeclType::int_, STR_AND_LEN("int"), DqnInspectDeclType::int_, STR_AND_LEN("int"),
sizeof(((SampleStruct *)0)->vbo), // decl_type_sizeof sizeof(((SampleStruct *)0)->vbo), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::int_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
0, // array_dimensions 0, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -118,8 +125,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_vao, STR_AND_LEN("vao"), DqnInspectMemberType::SampleStruct_vao, STR_AND_LEN("vao"),
offsetof(SampleStruct, vao), offsetof(SampleStruct, vao),
DqnInspectDeclType::int_, STR_AND_LEN("int"), DqnInspectDeclType::int_, STR_AND_LEN("int"),
sizeof(((SampleStruct *)0)->vao), // decl_type_sizeof sizeof(((SampleStruct *)0)->vao), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::int_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
0, // array_dimensions 0, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
DqnInspectMetadata_SampleStruct_vao, ARRAY_COUNT(DqnInspectMetadata_SampleStruct_vao), // metadata array DqnInspectMetadata_SampleStruct_vao, ARRAY_COUNT(DqnInspectMetadata_SampleStruct_vao), // metadata array
@ -128,8 +136,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_a, STR_AND_LEN("a"), DqnInspectMemberType::SampleStruct_a, STR_AND_LEN("a"),
offsetof(SampleStruct, a), offsetof(SampleStruct, a),
DqnInspectDeclType::int_Ptr_const_, STR_AND_LEN("int *const"), DqnInspectDeclType::int_Ptr_const_, STR_AND_LEN("int *const"),
sizeof(((SampleStruct *)0)->a), // decl_type_sizeof sizeof(((SampleStruct *)0)->a), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::int_Ptr_const_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
1, // array_dimensions 1, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -138,8 +147,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_b, STR_AND_LEN("b"), DqnInspectMemberType::SampleStruct_b, STR_AND_LEN("b"),
offsetof(SampleStruct, b), offsetof(SampleStruct, b),
DqnInspectDeclType::int_const_Ptr_const_, STR_AND_LEN("int const *const"), DqnInspectDeclType::int_const_Ptr_const_, STR_AND_LEN("int const *const"),
sizeof(((SampleStruct *)0)->b), // decl_type_sizeof sizeof(((SampleStruct *)0)->b), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::int_const_Ptr_const_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
1, // array_dimensions 1, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -148,8 +158,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_c, STR_AND_LEN("c"), DqnInspectMemberType::SampleStruct_c, STR_AND_LEN("c"),
offsetof(SampleStruct, c), offsetof(SampleStruct, c),
DqnInspectDeclType::int_, STR_AND_LEN("int"), DqnInspectDeclType::int_, STR_AND_LEN("int"),
sizeof(((SampleStruct *)0)->c), // decl_type_sizeof sizeof(((SampleStruct *)0)->c), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::int_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
0, // array_dimensions 0, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -158,8 +169,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_d, STR_AND_LEN("d"), DqnInspectMemberType::SampleStruct_d, STR_AND_LEN("d"),
offsetof(SampleStruct, d), offsetof(SampleStruct, d),
DqnInspectDeclType::int_Ptr_, STR_AND_LEN("int *"), DqnInspectDeclType::int_Ptr_, STR_AND_LEN("int *"),
sizeof(((SampleStruct *)0)->d), // decl_type_sizeof sizeof(((SampleStruct *)0)->d), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::int_Ptr_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
1, // array_dimensions 1, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -168,8 +180,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_e, STR_AND_LEN("e"), DqnInspectMemberType::SampleStruct_e, STR_AND_LEN("e"),
offsetof(SampleStruct, e), offsetof(SampleStruct, e),
DqnInspectDeclType::int_Ptr_, STR_AND_LEN("int *"), DqnInspectDeclType::int_Ptr_, STR_AND_LEN("int *"),
sizeof(((SampleStruct *)0)->e), // decl_type_sizeof sizeof(((SampleStruct *)0)->e), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::int_Ptr_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
1, // array_dimensions 1, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -178,8 +191,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_draw_color, STR_AND_LEN("draw_color"), DqnInspectMemberType::SampleStruct_draw_color, STR_AND_LEN("draw_color"),
offsetof(SampleStruct, draw_color), offsetof(SampleStruct, draw_color),
DqnInspectDeclType::V4_, STR_AND_LEN("V4"), DqnInspectDeclType::V4_, STR_AND_LEN("V4"),
sizeof(((SampleStruct *)0)->draw_color), // decl_type_sizeof sizeof(((SampleStruct *)0)->draw_color), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::V4_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
0, // array_dimensions 0, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
DqnInspectMetadata_SampleStruct_draw_color, ARRAY_COUNT(DqnInspectMetadata_SampleStruct_draw_color), // metadata array DqnInspectMetadata_SampleStruct_draw_color, ARRAY_COUNT(DqnInspectMetadata_SampleStruct_draw_color), // metadata array
@ -187,9 +201,10 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
{ {
DqnInspectMemberType::SampleStruct_lights, STR_AND_LEN("lights"), DqnInspectMemberType::SampleStruct_lights, STR_AND_LEN("lights"),
offsetof(SampleStruct, lights), offsetof(SampleStruct, lights),
DqnInspectDeclType::Array_, STR_AND_LEN("Array"), DqnInspectDeclType::Array_V3,_32_, STR_AND_LEN("Array<V3, 32>"),
sizeof(((SampleStruct *)0)->lights), // decl_type_sizeof sizeof(((SampleStruct *)0)->lights), // full_decl_type_sizeof
STR_AND_LEN("V3, 32"), // template_expr DqnInspectDeclType::Array_, DqnInspectDeclType::V3,_32_,
STR_AND_LEN("V3, 32"), // template_child_expr
0, // array_dimensions 0, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -197,9 +212,10 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
{ {
DqnInspectMemberType::SampleStruct_camera_matrixes, STR_AND_LEN("camera_matrixes"), DqnInspectMemberType::SampleStruct_camera_matrixes, STR_AND_LEN("camera_matrixes"),
offsetof(SampleStruct, camera_matrixes), offsetof(SampleStruct, camera_matrixes),
DqnInspectDeclType::Array_, STR_AND_LEN("Array"), DqnInspectDeclType::Array_V4,_32_, STR_AND_LEN("Array<V4, 32>"),
sizeof(((SampleStruct *)0)->camera_matrixes), // decl_type_sizeof sizeof(((SampleStruct *)0)->camera_matrixes), // full_decl_type_sizeof
STR_AND_LEN("V4, 32"), // template_expr DqnInspectDeclType::Array_, DqnInspectDeclType::V4,_32_,
STR_AND_LEN("V4, 32"), // template_child_expr
0, // array_dimensions 0, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -208,8 +224,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_bitmaps, STR_AND_LEN("bitmaps"), DqnInspectMemberType::SampleStruct_bitmaps, STR_AND_LEN("bitmaps"),
offsetof(SampleStruct, bitmaps), offsetof(SampleStruct, bitmaps),
DqnInspectDeclType::char_Ptr_Ptr_, STR_AND_LEN("char **"), DqnInspectDeclType::char_Ptr_Ptr_, STR_AND_LEN("char **"),
sizeof(((SampleStruct *)0)->bitmaps), // decl_type_sizeof sizeof(((SampleStruct *)0)->bitmaps), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::char_Ptr_Ptr_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
2, // array_dimensions 2, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -218,8 +235,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_shaders, STR_AND_LEN("shaders"), DqnInspectMemberType::SampleStruct_shaders, STR_AND_LEN("shaders"),
offsetof(SampleStruct, shaders), offsetof(SampleStruct, shaders),
DqnInspectDeclType::int_, STR_AND_LEN("int"), DqnInspectDeclType::int_, STR_AND_LEN("int"),
sizeof(((SampleStruct *)0)->shaders), // decl_type_sizeof sizeof(((SampleStruct *)0)->shaders), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::int_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
1, // array_dimensions 1, // array_dimensions
{ARRAY_COUNT(((SampleStruct *)0)->shaders), 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {ARRAY_COUNT(((SampleStruct *)0)->shaders), 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -228,8 +246,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_win32_handle, STR_AND_LEN("win32_handle"), DqnInspectMemberType::SampleStruct_win32_handle, STR_AND_LEN("win32_handle"),
offsetof(SampleStruct, win32_handle), offsetof(SampleStruct, win32_handle),
DqnInspectDeclType::void_Ptr_, STR_AND_LEN("void *"), DqnInspectDeclType::void_Ptr_, STR_AND_LEN("void *"),
sizeof(((SampleStruct *)0)->win32_handle), // decl_type_sizeof sizeof(((SampleStruct *)0)->win32_handle), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::void_Ptr_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
1, // array_dimensions 1, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -238,8 +257,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_lighting_ambient_coeff, STR_AND_LEN("lighting_ambient_coeff"), DqnInspectMemberType::SampleStruct_lighting_ambient_coeff, STR_AND_LEN("lighting_ambient_coeff"),
offsetof(SampleStruct, lighting_ambient_coeff), offsetof(SampleStruct, lighting_ambient_coeff),
DqnInspectDeclType::V3_, STR_AND_LEN("V3"), DqnInspectDeclType::V3_, STR_AND_LEN("V3"),
sizeof(((SampleStruct *)0)->lighting_ambient_coeff), // decl_type_sizeof sizeof(((SampleStruct *)0)->lighting_ambient_coeff), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::V3_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
0, // array_dimensions 0, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -248,8 +268,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_draw_call_count, STR_AND_LEN("draw_call_count"), DqnInspectMemberType::SampleStruct_draw_call_count, STR_AND_LEN("draw_call_count"),
offsetof(SampleStruct, draw_call_count), offsetof(SampleStruct, draw_call_count),
DqnInspectDeclType::int_, STR_AND_LEN("int"), DqnInspectDeclType::int_, STR_AND_LEN("int"),
sizeof(((SampleStruct *)0)->draw_call_count), // decl_type_sizeof sizeof(((SampleStruct *)0)->draw_call_count), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::int_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
0, // array_dimensions 0, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -258,8 +279,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_f, STR_AND_LEN("f"), DqnInspectMemberType::SampleStruct_f, STR_AND_LEN("f"),
offsetof(SampleStruct, f), offsetof(SampleStruct, f),
DqnInspectDeclType::int_, STR_AND_LEN("int"), DqnInspectDeclType::int_, STR_AND_LEN("int"),
sizeof(((SampleStruct *)0)->f), // decl_type_sizeof sizeof(((SampleStruct *)0)->f), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::int_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
0, // array_dimensions 0, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -268,8 +290,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_g, STR_AND_LEN("g"), DqnInspectMemberType::SampleStruct_g, STR_AND_LEN("g"),
offsetof(SampleStruct, g), offsetof(SampleStruct, g),
DqnInspectDeclType::int_const_, STR_AND_LEN("int const"), DqnInspectDeclType::int_const_, STR_AND_LEN("int const"),
sizeof(((SampleStruct *)0)->g), // decl_type_sizeof sizeof(((SampleStruct *)0)->g), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::int_const_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
0, // array_dimensions 0, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -278,8 +301,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_h, STR_AND_LEN("h"), DqnInspectMemberType::SampleStruct_h, STR_AND_LEN("h"),
offsetof(SampleStruct, h), offsetof(SampleStruct, h),
DqnInspectDeclType::int_Ptr_const_, STR_AND_LEN("int *const"), DqnInspectDeclType::int_Ptr_const_, STR_AND_LEN("int *const"),
sizeof(((SampleStruct *)0)->h), // decl_type_sizeof sizeof(((SampleStruct *)0)->h), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::int_Ptr_const_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
1, // array_dimensions 1, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -288,8 +312,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_i, STR_AND_LEN("i"), DqnInspectMemberType::SampleStruct_i, STR_AND_LEN("i"),
offsetof(SampleStruct, i), offsetof(SampleStruct, i),
DqnInspectDeclType::int_const_Ptr_, STR_AND_LEN("int const*"), DqnInspectDeclType::int_const_Ptr_, STR_AND_LEN("int const*"),
sizeof(((SampleStruct *)0)->i), // decl_type_sizeof sizeof(((SampleStruct *)0)->i), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::int_const_Ptr_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
1, // array_dimensions 1, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -298,8 +323,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_j, STR_AND_LEN("j"), DqnInspectMemberType::SampleStruct_j, STR_AND_LEN("j"),
offsetof(SampleStruct, j), offsetof(SampleStruct, j),
DqnInspectDeclType::int_Ptr_Ptr_Ptr_Ptr_const_, STR_AND_LEN("int ****const"), DqnInspectDeclType::int_Ptr_Ptr_Ptr_Ptr_const_, STR_AND_LEN("int ****const"),
sizeof(((SampleStruct *)0)->j), // decl_type_sizeof sizeof(((SampleStruct *)0)->j), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::int_Ptr_Ptr_Ptr_Ptr_const_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
4, // array_dimensions 4, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -308,8 +334,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_k, STR_AND_LEN("k"), DqnInspectMemberType::SampleStruct_k, STR_AND_LEN("k"),
offsetof(SampleStruct, k), offsetof(SampleStruct, k),
DqnInspectDeclType::int_, STR_AND_LEN("int"), DqnInspectDeclType::int_, STR_AND_LEN("int"),
sizeof(((SampleStruct *)0)->k), // decl_type_sizeof sizeof(((SampleStruct *)0)->k), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::int_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
0, // array_dimensions 0, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -318,8 +345,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_l, STR_AND_LEN("l"), DqnInspectMemberType::SampleStruct_l, STR_AND_LEN("l"),
offsetof(SampleStruct, l), offsetof(SampleStruct, l),
DqnInspectDeclType::int_Ptr_Ptr_, STR_AND_LEN("int **"), DqnInspectDeclType::int_Ptr_Ptr_, STR_AND_LEN("int **"),
sizeof(((SampleStruct *)0)->l), // decl_type_sizeof sizeof(((SampleStruct *)0)->l), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::int_Ptr_Ptr_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
2, // array_dimensions 2, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -328,8 +356,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] =
DqnInspectMemberType::SampleStruct_m, STR_AND_LEN("m"), DqnInspectMemberType::SampleStruct_m, STR_AND_LEN("m"),
offsetof(SampleStruct, m), offsetof(SampleStruct, m),
DqnInspectDeclType::int_Ptr_, STR_AND_LEN("int *"), DqnInspectDeclType::int_Ptr_, STR_AND_LEN("int *"),
sizeof(((SampleStruct *)0)->m), // decl_type_sizeof sizeof(((SampleStruct *)0)->m), // full_decl_type_sizeof
nullptr, 0, // template_expr and template_expr_len DqnInspectDeclType::int_Ptr_, DqnInspectDeclType::NotAvailable_,
nullptr, 0, // template_child_expr and template_child_expr_len
1, // array_dimensions 1, // array_dimensions
{0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown,
nullptr, 0, // metadata array nullptr, 0, // metadata array
@ -368,7 +397,7 @@ char const * DqnInspectMetadata_FilePath(EnumWithMetadata val)
return nullptr; return nullptr;
} }
bool DqnInspectMetadata_Coords(EnumWithMetadata val, V3 *value) bool DqnInspectMetadata_Coords(EnumWithMetadata val, V3 *value = nullptr)
{ {
if (val == EnumWithMetadata::Rect) { *value = V3(1, 2, 3); return true; } if (val == EnumWithMetadata::Rect) { *value = V3(1, 2, 3); return true; }
return false; return false;
@ -382,6 +411,7 @@ Array<int const *, 3> const *const Function3(Array<int, 32> const * foobar);
DqnInspectStruct const *DqnInspect_Struct(DqnInspectDeclType type) DqnInspectStruct const *DqnInspect_Struct(DqnInspectDeclType type)
{ {
(void)type;
#ifdef DQN_INSPECT_DQNINSPECT_TESTDATA_H #ifdef DQN_INSPECT_DQNINSPECT_TESTDATA_H
if (type == DqnInspectDeclType::SampleStruct_) return &DqnInspect_SampleStruct_Struct; if (type == DqnInspectDeclType::SampleStruct_) return &DqnInspect_SampleStruct_Struct;
#endif // DQN_INSPECT_DQNINSPECT_TESTDATA_H #endif // DQN_INSPECT_DQNINSPECT_TESTDATA_H