commit 30e659bb8314118e1a659ff73b7c6edfe3c68226
parent 0a53289a889582b76931ab064a6451cd538bce4b
Author: Ed van Bruggen <edvb@uw.edu>
Date: Mon, 4 Mar 2019 17:03:51 -0800
Use macro to get string literal of function name
Diffstat:
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tibs/math.c b/tibs/math.c
@@ -160,7 +160,7 @@ prim_mod(Env env, Val args)
return mk_int((int)num(a) % abs((int)num(b)));
}
-#define PRIM_COMPARE(NAME, OP, FUNC) \
+#define PRIM_COMPARE(NAME, OP) \
static Val \
prim_##NAME(Env env, Val args) \
{ \
@@ -169,15 +169,15 @@ prim_##NAME(Env env, Val args) \
return NULL; \
if (list_len(v) != 2) \
return env->t; \
- tsp_arg_type(car(v), FUNC, INTEGER); \
- tsp_arg_type(car(cdr(v)), FUNC, INTEGER); \
+ tsp_arg_type(car(v), #OP, INTEGER); \
+ tsp_arg_type(car(cdr(v)), #OP, INTEGER); \
return (num(car(v)) OP num(car(cdr(v)))) ? env->t : env->nil; \
}
-PRIM_COMPARE(lt, <, "<")
-PRIM_COMPARE(gt, >, ">")
-PRIM_COMPARE(lte, <=, "<=")
-PRIM_COMPARE(gte, >=, ">=")
+PRIM_COMPARE(lt, <)
+PRIM_COMPARE(gt, >)
+PRIM_COMPARE(lte, <=)
+PRIM_COMPARE(gte, >=)
void
tib_env_math(Env env)