Commit 2132f4fd9035ef87f16c9d7e48948b8e2ed11ba5
1 parent
9a28fc52
another change on class definition macro
Showing
6 changed files
with
19 additions
and
13 deletions
... | ... | @@ -27,8 +27,10 @@ |
27 | 27 | #define CCLASS_MAGIC 0xFEFE |
28 | 28 | |
29 | 29 | #define CLASS(_class) \ |
30 | - typedef struct _##_class { \ | |
31 | - const _CCLASS const class; | |
30 | + struct _##_class; \ | |
31 | + typedef struct _##_class * _class; \ | |
32 | + extern const _CCLASS const __##_class; \ | |
33 | + struct _##_class | |
32 | 34 | |
33 | 35 | #define ENDC(_class) } * _class; \ |
34 | 36 | extern const _CCLASS const __##_class; | ... | ... |
... | ... | @@ -23,15 +23,15 @@ |
23 | 23 | #include "token/cclass.h" |
24 | 24 | |
25 | 25 | |
26 | -CLASS(CRYPT) | |
26 | +CLASS(CRYPT) { | |
27 | + const _CCLASS const class; | |
27 | 28 | const char * algorithm; |
28 | 29 | const char * mode; |
29 | 30 | MCRYPT mcrypt; |
30 | 31 | size_t ivsize; |
31 | 32 | size_t keysize; |
32 | 33 | void * iv; |
33 | -ENDC(CRYPT) | |
34 | - | |
34 | +}; | |
35 | 35 | |
36 | 36 | void * crypt_encrypt( |
37 | 37 | CRYPT _this, | ... | ... |
... | ... | @@ -37,7 +37,8 @@ enum DYNTYPE_TYPES { |
37 | 37 | }; |
38 | 38 | |
39 | 39 | |
40 | -CLASS(DYNTYPE) | |
40 | +CLASS(DYNTYPE) { | |
41 | + const _CCLASS const class; | |
41 | 42 | enum DYNTYPE_TYPES type; |
42 | 43 | size_t size; |
43 | 44 | union _data { |
... | ... | @@ -48,7 +49,7 @@ CLASS(DYNTYPE) |
48 | 49 | struct _DYNTYPE ** _array; |
49 | 50 | DYNTYPE_HASH _hash; |
50 | 51 | } data; |
51 | -ENDC(DYNTYPE) | |
52 | +}; | |
52 | 53 | |
53 | 54 | #include "token/dyntype/hash.h" |
54 | 55 | ... | ... |
... | ... | @@ -30,12 +30,13 @@ struct _DYNTYPE_HASH; |
30 | 30 | #undef DYNTYPE_HASH |
31 | 31 | #define __DYNTYPE_HASH_H__ |
32 | 32 | |
33 | -CLASS(DYNTYPE_HASH) | |
33 | +CLASS(DYNTYPE_HASH) { | |
34 | + const _CCLASS const class; | |
34 | 35 | char ** keys; |
35 | 36 | DYNTYPE * values; |
36 | 37 | size_t size; |
37 | 38 | size_t used; |
38 | -ENDC(DYNTYPE_HASH) | |
39 | +}; | |
39 | 40 | |
40 | 41 | |
41 | 42 | void dyntype_hash_set(DYNTYPE_HASH _this, const char * key, struct _DYNTYPE * value); | ... | ... |
Please
register
or
login
to post a comment