aboutsummaryrefslogtreecommitdiff
path: root/src/primitives.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/primitives.c')
-rw-r--r--src/primitives.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/primitives.c b/src/primitives.c
index a8bb62a..9f3e670 100644
--- a/src/primitives.c
+++ b/src/primitives.c
@@ -79,6 +79,17 @@ SExpRef primitive_eval(Interp *interp, SExpRef args, bool istail) {
return lisp_eval(interp, args, istail);
}
+SExpRef primitive_unwind_protect(Interp *interp, SExpRef args, bool istail) {
+ if (LENGTH(args) < 2) {
+ return new_error(interp, "unwind-protect: syntax error.\n");
+ }
+ SExpRef ret = EVAL(CAR(args));
+ for (SExpRef i = CDR(args); !NILP(i); i = CDR(i)) {
+ EVAL(CAR(i));
+ }
+ return ret;
+}
+
SExpRef primitive_if(Interp *interp, SExpRef args, bool istail) {
SExpRef cond, tb, fb;