fx: re-arrange type system to allow for reflection

This commit is contained in:
2026-05-05 19:03:22 +01:00
parent 8c12868651
commit 90a3905f48
83 changed files with 768 additions and 842 deletions
@@ -12,7 +12,7 @@ FX_DECLARE_TYPE(fx_assembly);
FX_TYPE_CLASS_DECLARATION_BEGIN(fx_assembly)
FX_TYPE_CLASS_DECLARATION_END(fx_assembly)
FX_API fx_type fx_assembly_get_type();
FX_API fx_type_id fx_assembly_get_type();
FX_TYPE_DEFAULT_CONSTRUCTOR(fx_assembly, FX_REFLECTION_TYPE_ASSEMBLY);
@@ -27,11 +27,10 @@ FX_API void fx_assembly_set_version(
FX_API void fx_assembly_add_type(
fx_assembly *asm,
const char *full_name,
fx_type type_id);
fx_type_id type_id);
FX_API void fx_assembly_dump(const fx_assembly *asm);
FX_DECLS_END
;
FX_DECLS_END;
#endif
@@ -23,7 +23,7 @@ FX_DECLARE_TYPE(fx_function);
FX_TYPE_CLASS_DECLARATION_BEGIN(fx_function)
FX_TYPE_CLASS_DECLARATION_END(fx_function)
FX_API fx_type fx_function_get_type();
FX_API fx_type_id fx_function_get_type();
FX_API fx_function *fx_function_create(
const char *name,
@@ -0,0 +1,26 @@
#ifndef FX_REFLECTION_TYPE_H_
#define FX_REFLECTION_TYPE_H_
#include <fx/macros.h>
FX_DECLS_BEGIN;
struct fx_type_info;
#define FX_REFLECTION_TYPE_TYPE (fx_type_get_type())
FX_DECLARE_TYPE(fx_type);
FX_TYPE_CLASS_DECLARATION_BEGIN(fx_type)
FX_TYPE_CLASS_DECLARATION_END(fx_type)
FX_API fx_type_id fx_type_get_type();
FX_API const char *fx_type_get_name(const fx_type *ty);
FX_API const fx_type *fx_type_get_by_id(fx_type_id id);
FX_API const fx_type *fx_type_get_by_name(const char *name);
FX_API fx_type *__fx_type_create(struct fx_type_info *opaque);
#endif