Commit 2132f4fd9035ef87f16c9d7e48948b8e2ed11ba5

Authored by Georg Hopp
1 parent 9a28fc52

another change on class definition macro

@@ -27,8 +27,10 @@ @@ -27,8 +27,10 @@
27 #define CCLASS_MAGIC 0xFEFE 27 #define CCLASS_MAGIC 0xFEFE
28 28
29 #define CLASS(_class) \ 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 #define ENDC(_class) } * _class; \ 35 #define ENDC(_class) } * _class; \
34 extern const _CCLASS const __##_class; 36 extern const _CCLASS const __##_class;
@@ -23,15 +23,15 @@ @@ -23,15 +23,15 @@
23 #include "token/cclass.h" 23 #include "token/cclass.h"
24 24
25 25
26 -CLASS(CRYPT) 26 +CLASS(CRYPT) {
  27 + const _CCLASS const class;
27 const char * algorithm; 28 const char * algorithm;
28 const char * mode; 29 const char * mode;
29 MCRYPT mcrypt; 30 MCRYPT mcrypt;
30 size_t ivsize; 31 size_t ivsize;
31 size_t keysize; 32 size_t keysize;
32 void * iv; 33 void * iv;
33 -ENDC(CRYPT)  
34 - 34 +};
35 35
36 void * crypt_encrypt( 36 void * crypt_encrypt(
37 CRYPT _this, 37 CRYPT _this,
@@ -37,7 +37,8 @@ enum DYNTYPE_TYPES { @@ -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 enum DYNTYPE_TYPES type; 42 enum DYNTYPE_TYPES type;
42 size_t size; 43 size_t size;
43 union _data { 44 union _data {
@@ -48,7 +49,7 @@ CLASS(DYNTYPE) @@ -48,7 +49,7 @@ CLASS(DYNTYPE)
48 struct _DYNTYPE ** _array; 49 struct _DYNTYPE ** _array;
49 DYNTYPE_HASH _hash; 50 DYNTYPE_HASH _hash;
50 } data; 51 } data;
51 -ENDC(DYNTYPE) 52 +};
52 53
53 #include "token/dyntype/hash.h" 54 #include "token/dyntype/hash.h"
54 55
@@ -30,12 +30,13 @@ struct _DYNTYPE_HASH; @@ -30,12 +30,13 @@ struct _DYNTYPE_HASH;
30 #undef DYNTYPE_HASH 30 #undef DYNTYPE_HASH
31 #define __DYNTYPE_HASH_H__ 31 #define __DYNTYPE_HASH_H__
32 32
33 -CLASS(DYNTYPE_HASH) 33 +CLASS(DYNTYPE_HASH) {
  34 + const _CCLASS const class;
34 char ** keys; 35 char ** keys;
35 DYNTYPE * values; 36 DYNTYPE * values;
36 size_t size; 37 size_t size;
37 size_t used; 38 size_t used;
38 -ENDC(DYNTYPE_HASH) 39 +};
39 40
40 41
41 void dyntype_hash_set(DYNTYPE_HASH _this, const char * key, struct _DYNTYPE * value); 42 void dyntype_hash_set(DYNTYPE_HASH _this, const char * key, struct _DYNTYPE * value);
@@ -28,9 +28,10 @@ enum PACKET_CONTENT_KEYS { @@ -28,9 +28,10 @@ enum PACKET_CONTENT_KEYS {
28 }; 28 };
29 29
30 30
31 -CLASS(PACKET) 31 +CLASS(PACKET) {
  32 + const _CCLASS const class;
32 DYNTYPE content[2]; 33 DYNTYPE content[2];
33 -ENDC(PACKET) 34 +};
34 35
35 36
36 DYNTYPE packet_getHeader(PACKET _this); 37 DYNTYPE packet_getHeader(PACKET _this);
@@ -16,9 +16,10 @@ _reset() @@ -16,9 +16,10 @@ _reset()
16 #endif//_RESET 16 #endif//_RESET
17 17
18 18
19 -CLASS(MOCK_CLASS) 19 +CLASS(MOCK_CLASS) {
  20 + const _CCLASS const class;
20 int value; 21 int value;
21 -ENDC(MOCK_CLASS) 22 +};
22 23
23 extern const _CCLASS const __MOCK_CLASS; 24 extern const _CCLASS const __MOCK_CLASS;
24 25
Please register or login to post a comment