aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-03-31 23:50:10 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-03-31 23:50:10 -0700
commita3587e13398f6ce2197e8d728f52f8389d4ffdec (patch)
tree7ff31077881ebca543d03bd4941d8a36a36b0399
parenta4e5db32fc40770b94ca410f815e0becba71ab09 (diff)
downloadcppawk-a3587e13398f6ce2197e8d728f52f8389d4ffdec.tar.gz
cppawk-a3587e13398f6ce2197e8d728f52f8389d4ffdec.tar.bz2
cppawk-a3587e13398f6ce2197e8d728f52f8389d4ffdec.zip
list_add: fix multiple evaluation and paren problem.
-rw-r--r--cppawk-include/cons.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/cppawk-include/cons.h b/cppawk-include/cons.h
index f5d9671..ca3bb39 100644
--- a/cppawk-include/cons.h
+++ b/cppawk-include/cons.h
@@ -98,7 +98,7 @@
prog(__g(i) = cdr(__g(i)), index++))
#define list_begin() ""
-#define list_add(stk, item) (length(item) ":" item stk)
+#define list_add(stk, item) __pack(stk, item)
#define list_end(stk) __unpack(stk)
#define __bag_init_first(x) (x = list_begin())
@@ -376,6 +376,11 @@ function equal(__obj1, __obj2)
#define equal(obj1, obj2) ((obj1) == (obj2) ? 1 : __slow_equal(obj1, obj2))
+function __pack(__stk, __item)
+{
+ return length(__item) ":" __item __stk
+}
+
function __unpack(__stk,
__col, __out)
{