summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/oo.h3
-rw-r--r--includes/point.c4
-rw-r--r--includes/point.h4
-rw-r--r--includes/rect.c4
-rw-r--r--includes/rect.h4
5 files changed, 9 insertions, 10 deletions
diff --git a/includes/oo.h b/includes/oo.h
index b75812f..85fc8ab 100644
--- a/includes/oo.h
+++ b/includes/oo.h
@@ -36,8 +36,7 @@
return ptr; \
}
-#define METHOD(T, N) CONCAT3(T, _, N) (T self)
-#define METHOD_ARG(T, N, ...) CONCAT3(T, _, N) (T self, __VA_ARGS__)
+#define METHOD(T, N, ...) CONCAT3(T, _, N) (T self __VA_OPT__(,) __VA_ARGS__)
#define GETTER(T, MT, M) MT CONCAT4(T, _, M, _get) (T self)
#define SETTER(T, MT, M) void CONCAT4(T, _, M, _set) (T self, MT v)
diff --git a/includes/point.c b/includes/point.c
index a68fcf2..99fe0bb 100644
--- a/includes/point.c
+++ b/includes/point.c
@@ -11,13 +11,13 @@ DEFINE_OBJECT_STRUCTURE(TYPE) {
CONSTRUCTOR_IMPLEMENT(TYPE);
-void METHOD_ARG(TYPE, init, float x, float y) {
+void METHOD(TYPE, init, float x, float y) {
CATCH_SELF_NULL(TYPE_init);
self->x = x;
self->y = y;
}
-int METHOD_ARG(TYPE, toString, char* buffer) {
+int METHOD(TYPE, toString, char* buffer) {
CATCH_SELF_NULL(TYPE_toString);
return sprintf(buffer, NAMEOF(TYPE) " { x = %.2f, y = %.2f }", self->x, self->y);
}
diff --git a/includes/point.h b/includes/point.h
index 311d64d..a7dc60b 100644
--- a/includes/point.h
+++ b/includes/point.h
@@ -11,9 +11,9 @@ DEFINE_OBJECT(TYPE);
CONSTRUCTOR(TYPE);
// Methods
-void METHOD_ARG(TYPE, init, float x, float y);
+void METHOD(TYPE, init, float x, float y);
-int METHOD_ARG(TYPE, toString, char* buffer);
+int METHOD(TYPE, toString, char* buffer);
// Properties (getters & setters)
GETTER(TYPE, float, x);
diff --git a/includes/rect.c b/includes/rect.c
index 36abde7..89b554b 100644
--- a/includes/rect.c
+++ b/includes/rect.c
@@ -10,14 +10,14 @@ DEFINE_OBJECT_STRUCTURE(TYPE) {
CONSTRUCTOR_IMPLEMENT(TYPE);
-void METHOD_ARG(TYPE, init, int l, int t, int w, int h) {
+void METHOD(TYPE, init, int l, int t, int w, int h) {
self->left = l;
self->top = t;
self->width = w;
self->height = h;
}
-int METHOD_ARG(TYPE, toString, char* buffer) {
+int METHOD(TYPE, toString, char* buffer) {
return sprintf(buffer, NAMEOF(TYPE) " { left = %i, top = %i, width = %i, height = %i }", self->left, self->top, self->width, self->height);
}
diff --git a/includes/rect.h b/includes/rect.h
index 7c3befc..3b84e01 100644
--- a/includes/rect.h
+++ b/includes/rect.h
@@ -11,8 +11,8 @@ DEFINE_OBJECT(TYPE);
CONSTRUCTOR(TYPE);
// Methods
-void METHOD_ARG(TYPE, init, int l, int t, int w, int h);
-int METHOD_ARG(TYPE, toString, char* buffer);
+void METHOD(TYPE, init, int l, int t, int w, int h);
+int METHOD(TYPE, toString, char* buffer);
// Properties (getters & setters)
GETTER(TYPE, int, left);