2024-04-18 12:59:11 +00:00
|
|
|
#pragma once
|
|
|
|
#include "dqn.h"
|
|
|
|
|
2024-03-25 05:11:57 +00:00
|
|
|
/*
|
2024-01-31 12:49:23 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// $$$$$$$$\ $$\ $$\ $$$$$$$\ $$$$$$$$\ $$$$$$\ $$\ $$\ $$$$$$$$\ $$$$$$\
|
|
|
|
// \__$$ __|\$$\ $$ |$$ __$$\ $$ _____| \_$$ _|$$$\ $$ |$$ _____|$$ __$$\
|
|
|
|
// $$ | \$$\ $$ / $$ | $$ |$$ | $$ | $$$$\ $$ |$$ | $$ / $$ |
|
|
|
|
// $$ | \$$$$ / $$$$$$$ |$$$$$\ $$ | $$ $$\$$ |$$$$$\ $$ | $$ |
|
|
|
|
// $$ | \$$ / $$ ____/ $$ __| $$ | $$ \$$$$ |$$ __| $$ | $$ |
|
|
|
|
// $$ | $$ | $$ | $$ | $$ | $$ |\$$$ |$$ | $$ | $$ |
|
|
|
|
// $$ | $$ | $$ | $$$$$$$$\ $$$$$$\ $$ | \$$ |$$ | $$$$$$ |
|
|
|
|
// \__| \__| \__| \________| \______|\__| \__|\__| \______/
|
|
|
|
//
|
|
|
|
// dqn_type_info.h -- C++ type introspection
|
|
|
|
//
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
2024-03-25 05:11:57 +00:00
|
|
|
*/
|
2024-01-31 12:49:23 +00:00
|
|
|
|
2024-02-25 11:37:14 +00:00
|
|
|
enum Dqn_TypeKind
|
2024-01-31 12:49:23 +00:00
|
|
|
{
|
2024-02-25 11:37:14 +00:00
|
|
|
Dqn_TypeKind_Nil,
|
|
|
|
Dqn_TypeKind_Basic,
|
|
|
|
Dqn_TypeKind_Enum,
|
|
|
|
Dqn_TypeKind_Struct,
|
2024-01-31 12:49:23 +00:00
|
|
|
};
|
|
|
|
|
2024-02-25 11:37:14 +00:00
|
|
|
struct Dqn_TypeField
|
2024-01-31 12:49:23 +00:00
|
|
|
{
|
|
|
|
uint16_t index;
|
|
|
|
Dqn_Str8 name;
|
2024-08-01 03:34:36 +00:00
|
|
|
Dqn_Str8 label;
|
2024-02-25 11:37:14 +00:00
|
|
|
Dqn_isize value;
|
|
|
|
Dqn_usize offset_of;
|
|
|
|
Dqn_usize size_of;
|
2024-04-18 12:59:11 +00:00
|
|
|
Dqn_usize align_of;
|
2024-02-25 11:37:14 +00:00
|
|
|
Dqn_Str8 type_decl;
|
|
|
|
uint32_t type_enum;
|
2024-01-31 12:49:23 +00:00
|
|
|
bool is_pointer;
|
2024-02-25 11:37:14 +00:00
|
|
|
uint16_t array_size;
|
|
|
|
Dqn_TypeField const * array_size_field;
|
2024-01-31 12:49:23 +00:00
|
|
|
};
|
|
|
|
|
2024-02-25 11:37:14 +00:00
|
|
|
struct Dqn_TypeInfo
|
2024-01-31 12:49:23 +00:00
|
|
|
{
|
2024-02-25 11:37:14 +00:00
|
|
|
Dqn_Str8 name;
|
|
|
|
Dqn_TypeKind kind;
|
2024-03-19 12:11:00 +00:00
|
|
|
Dqn_usize size_of;
|
2024-02-25 11:37:14 +00:00
|
|
|
Dqn_TypeField const *fields;
|
|
|
|
uint16_t fields_count;
|
2024-01-31 12:49:23 +00:00
|
|
|
};
|
|
|
|
|
2024-02-25 11:37:14 +00:00
|
|
|
struct Dqn_TypeGetField
|
2024-01-31 12:49:23 +00:00
|
|
|
{
|
2024-02-25 11:37:14 +00:00
|
|
|
bool success;
|
|
|
|
Dqn_usize index;
|
|
|
|
Dqn_TypeField *field;
|
2024-01-31 12:49:23 +00:00
|
|
|
};
|
2024-02-25 11:37:14 +00:00
|
|
|
|
2024-03-25 05:11:57 +00:00
|
|
|
Dqn_TypeGetField Dqn_Type_GetField(Dqn_TypeInfo const *type_info, Dqn_Str8 name);
|