aboutsummaryrefslogtreecommitdiff
path: root/macro.h
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-02-18 22:39:56 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-18 22:39:56 +0100
commit33fa5b5d0c512c72c1d50b9420a36431cd10eb5d (patch)
tree6642ec876ecd15ce62f83075d7f9d261050fe3a6 /macro.h
parentStart rework of guile interface. (diff)
downloadcalp-33fa5b5d0c512c72c1d50b9420a36431cd10eb5d.tar.gz
calp-33fa5b5d0c512c72c1d50b9420a36431cd10eb5d.tar.xz
Made to compile as C++.
Diffstat (limited to 'macro.h')
-rw-r--r--macro.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/macro.h b/macro.h
index 5762eee6..6421b2fd 100644
--- a/macro.h
+++ b/macro.h
@@ -40,31 +40,31 @@
/* Returns full type of constructor */
#define INIT_F(T, ...) \
- int __INIT_T(T, VA_ARGS_NUM(__VA_ARGS__)) (T* this, ## __VA_ARGS__)
+ int __INIT_T(T, VA_ARGS_NUM(__VA_ARGS__)) (T* self, ## __VA_ARGS__)
/*
* Call the constructor of an object
- * `int` part of the macro, to ensure that any attempt to call this
+ * `int` part of the macro, to ensure that any attempt to call self
* function results in an error.
*/
#define INIT(T, N, ...) \
__INIT_T(T, VA_ARGS_NUM(__VA_ARGS__)) (N, ## __VA_ARGS__)
-/* Allocate a new object on the HEAP */
+/* Allocate a new_ object on the HEAP */
#define NEW(T, N, ...) \
- T* N = malloc(sizeof(*N)); \
+ T* N = (T*) malloc(sizeof(*N)); \
INIT(T, N, ## __VA_ARGS__);
/*
* Reconstructs a object. Use with caution.
*/
#define RENEW(T, N, ...) do { \
- N = malloc(sizeof(*N)); \
+ N = (T*) malloc(sizeof(*N)); \
INIT(T, N, ## __VA_ARGS__); \
} while (0)
-/* Allocate a new object on the STACK */
+/* Allocate a new_ object on the STACK */
#define SNEW(T, N, ...) \
T N; \
INIT(T, & N, ## __VA_ARGS__);
@@ -76,7 +76,7 @@
#define FFREE(T, N) do { FREE(T)(N); free(N); } while (0)
/* Declare destructor */
-#define FREE_F(T) int FREE(T) (T* this)
+#define FREE_F(T) int FREE(T) (T* self)
/* generate reusable internal symbol */
#define __INTER(s) TP3(__, s, __internal)
@@ -122,7 +122,7 @@
*/
#define FMT_T(T) TEMPL(format , T)
-#define FMT_F(T) int FMT_T(T)(T* this, char* buf, ...)
+#define FMT_F(T) int FMT_T(T)(T* self, char* buf, ...)
// TODO change order of buf and item
#define __FMT_HELP(item, buf, ...) ((item), (buf), VA_ARGS_NUM(__VA_ARGS__), ## __VA_ARGS__)
#define FMT(T) FMT_T(T) __FMT_HELP