aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLAN-TW <lantw44@gmail.com>2013-12-07 18:30:38 +0800
committerLAN-TW <lantw44@gmail.com>2013-12-07 18:30:38 +0800
commitdc258e02720308981a4f8a2e4848c582c1b71123 (patch)
tree9d34431021f5d10e1975098de4ec4287d2e4cb3b
parente83e95d018fe264f56ce7145a2d345fbaba1fe69 (diff)
downloadl4basic-dc258e02720308981a4f8a2e4848c582c1b71123.tar.gz
l4basic-dc258e02720308981a4f8a2e4848c582c1b71123.tar.zst
l4basic-dc258e02720308981a4f8a2e4848c582c1b71123.zip
Add macros to define getters and setters
-rw-r--r--l4common.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/l4common.h b/l4common.h
index 12d5697..d054b34 100644
--- a/l4common.h
+++ b/l4common.h
@@ -16,10 +16,19 @@
# define bool char
# define true 1
# define false 0
+# define inline
# define LBS_COMMON_ISO_C89
# define LBS_COMMON_CHECK_TYPE(x,type) (x)
#endif /* __STDC_VERSION__ */
#define LBS_COMMON_NULL_PTR ((void*)NULL)
+#define LBS_COMMON_DEFINE_GETTER(ns,xt,m,mt) \
+ static inline mt ns ## _get_ ## m (xt x) { \
+ return x->m; \
+ }
+#define LBS_COMMON_DEFINE_SETTER(ns,xt,m,mt) \
+ static inline void ns ## _set_ ## m (xt x, mt v) { \
+ x->m = v; \
+ }
#endif /* LBS_COMMON_H */