runtime: add assembly system to collect and export type definitions
This commit is contained in:
+6
-4
@@ -1,5 +1,7 @@
|
||||
include(../cmake/Templates.cmake)
|
||||
set(namespace_include_paths ${CMAKE_CURRENT_SOURCE_DIR}/include PARENT_SCOPE)
|
||||
|
||||
add_fx_assembly(
|
||||
NAME fx
|
||||
SUBDIRS hash)
|
||||
file(GLOB namespace_sources
|
||||
*.c *.h
|
||||
hash/*.c hash/*.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/fx/*.h)
|
||||
set(namespace_sources ${namespace_sources} PARENT_SCOPE)
|
||||
|
||||
@@ -200,6 +200,28 @@
|
||||
func_name(priv); \
|
||||
} while (0)
|
||||
|
||||
#define FX_ASSEMBLY_BEGIN() \
|
||||
const fx_assembly *__fx_assembly_get(void) \
|
||||
{ \
|
||||
static fx_assembly *self = NULL; \
|
||||
if (self) { \
|
||||
return self; \
|
||||
} \
|
||||
self = fx_assembly_create();
|
||||
#define FX_ASSEMBLY_END() \
|
||||
fx_assembly_dump(self); \
|
||||
return self; \
|
||||
}
|
||||
#define FX_ASSEMBLY_NAME(name) fx_assembly_set_name(self, name)
|
||||
#define FX_ASSEMBLY_VERSION(major, minor, build, revision) \
|
||||
fx_assembly_set_version(self, major, minor, build, revision)
|
||||
#define FX_ASSEMBLY_EXPORT_TYPE(namespace_name, type_name, type_id) \
|
||||
extern fx_type type_id##_get_type(void); \
|
||||
fx_assembly_add_type( \
|
||||
self, \
|
||||
namespace_name "." type_name, \
|
||||
type_id##_get_type())
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define FX_DECLS_BEGIN extern "C" {
|
||||
#define FX_DECLS_END }
|
||||
|
||||
@@ -24,6 +24,7 @@ struct fx_type_component {
|
||||
|
||||
struct fx_type_registration {
|
||||
enum fx_type_category r_category;
|
||||
const char *r_name;
|
||||
struct fx_bst_node r_node;
|
||||
const fx_type_info *r_info;
|
||||
struct _fx_class *r_class;
|
||||
@@ -35,6 +36,7 @@ struct fx_type_registration {
|
||||
|
||||
extern struct fx_type_registration *fx_type_get_registration(fx_type id);
|
||||
extern struct fx_type_component *fx_type_get_component(
|
||||
const fx_bst *tree, const union fx_type *key);
|
||||
const fx_bst *tree,
|
||||
const union fx_type *key);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user