diff options
author | 2024-06-05 17:23:45 +0600 | |
---|---|---|
committer | 2024-06-05 17:23:45 +0600 | |
commit | 815eca3e8f367a6fed50be59b10316b5028773aa (patch) | |
tree | da6db4241b77bb54f51a4dfdecb7ab6cece20914 /src/cobj.h | |
parent | 83cf6de508664535c77e4d6aa8f0695a3fa7cdf2 (diff) | |
download | c-obp-example-815eca3e8f367a6fed50be59b10316b5028773aa.tar.gz c-obp-example-815eca3e8f367a6fed50be59b10316b5028773aa.zip |
Add class declaration helper
Signed-off-by: Mubashshir <ahmubashshir@gmail.com>
Diffstat (limited to '')
-rw-r--r-- | src/cobj.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -38,6 +38,22 @@ # define DEL(klass, body, ...) \ void klass ## _del(klass self, ## __VA_ARGS__) \ body +# define NCLASS(klass, data) \ + typedef struct __##klass##_impl * klass; \ + struct __##klass##_impl data + +# define LIST(klass, field, type, dim, ...) \ + type _property_ ## field dim; \ + type* (*get_ ## field)(klass, ## __VA_ARGS__); \ + bool (*set_ ## field)(klass, ## __VA_ARGS__, type *) + +# define ATOM(klass, field, type, ...) \ + type _property_ ## field; \ + type (*get_ ## field)(klass, ## __VA_ARGS__);\ + bool (*set_ ## field)(klass, ## __VA_ARGS__, type) + +# define DEFN(klass, name, type, ...) \ + type (*name)(klass, ## __VA_ARGS__) #else # define CLASS(klass) \ typedef struct klass ## _impl_struct * klass |