@ -61,11 +61,18 @@
* that are needed to create a new class .
* that are needed to create a new class .
*/
*/
# define TR_CLASS(name) \
# define TR_CLASS(name) \
struct TR_class c_ # # name ; \
struct c_ # # name ; \
struct c_ # # name ; \
typedef struct c_ # # name * name ; \
typedef struct c_ # # name * name ; \
extern struct TR_class * const _ # # name ; \
extern struct TR_class * const _ # # name ; \
struct c_ # # name
struct c_ # # name
# define TR_INSTANCE_INIT(name) \
struct c_ # # name # # _object { \
void * TR_class ; \
struct c_ # # name data ; \
}
/**
/**
* Make the new class a child of an existing class .
* Make the new class a child of an existing class .
* This is used within the class declaration and can
* This is used within the class declaration and can
@ -97,25 +104,19 @@
* created .
* created .
*/
*/
# define TR_CREATE_CLASS(name,_parent,...) \
# define TR_CREATE_CLASS(name,_parent,...) \
static struct TR_class c_ # # name ; \
static TR_class_ptr _classInit # # name # # _ ( void ) { \
static TR_class_ptr _classInit # # name # # _ ( void ) { \
c_ # # name . parent = _ # # _parent ; \
c_ # # name . parent = _ # # _parent ; \
c_ # # name . init = NULL ; \
c_ # # name . init = NULL ; \
return & c_ # # name ; \
return & c_ # # name ; \
} ; \
} ; \
static st ruct TR_class c_ # # name = { \
struct TR_class c_ # # name = { \
TR_CLASS_MAGIC , \
TR_CLASS_MAGIC , \
NULL , \
NULL , \
sizeof ( struct c_ # # name ) , \
sizeof ( struct c_ # # name ) , \
_classInit # # name # # _ , \
_classInit # # name # # _ , \
TR_INIT_IFACE_IMPL ( __VA_ARGS__ ) \
TR_INIT_IFACE_IMPL ( __VA_ARGS__ ) \
} ; \
} ; \
struct TR_class * const _ # # name = & c_ # # name ; \
struct c_ # # name # # _object { \
void * TR_class ; \
struct c_ # # name data ; \
}
struct TR_class * const _ # # name = & c_ # # name
/**
/**
* Create a static instance of a class .
* Create a static instance of a class .