} while (0)
/* The opposite: push all of the elements in L onto the list. */
-#define PUSH_LIST(l) \
+#define PUSH_LIST(l, NILP) \
do \
{ \
for (; scm_is_pair (l); l = SCM_CDR (l)) \
PUSH (SCM_CAR (l)); \
- if (SCM_UNLIKELY (!SCM_NULLP (l))) { \
+ if (SCM_UNLIKELY (!NILP (l))) { \
err_args = scm_list_1 (l); \
goto vm_error_improper_list; \
} \
{
SCM l;
POP (l);
- PUSH_LIST (l);
+ PUSH_LIST (l, SCM_NULLP);
NEXT;
}
POP (values);
values = scm_struct_ref (values, SCM_INUM0);
nvalues = scm_ilength (values);
- PUSH_LIST (values);
+ PUSH_LIST (values, SCM_NULLP);
goto vm_return_values;
}
goto vm_return;
POP (values);
values = scm_struct_ref (values, SCM_INUM0);
len = scm_length (values);
- PUSH_LIST (values);
+ PUSH_LIST (values, SCM_NULLP);
PUSH (len);
ip += offset;
}
if (len < 0)
goto vm_error_wrong_type_arg;
- PUSH_LIST (ls);
+ PUSH_LIST (ls, SCM_NULL_OR_NIL_P);
nargs += len - 2;
goto vm_call;
if (len < 0)
goto vm_error_wrong_type_arg;
- PUSH_LIST (ls);
+ PUSH_LIST (ls, SCM_NULL_OR_NIL_P);
nargs += len - 2;
goto vm_goto_args;
SCM values;
values = scm_struct_ref (cont, SCM_INUM0);
nvalues = scm_ilength (values);
- PUSH_LIST (values);
+ PUSH_LIST (values, SCM_NULLP);
goto vm_return_values;
}
else
l = SCM_CDR (l);
nvalues++;
}
+ if (SCM_UNLIKELY (!SCM_NULL_OR_NIL_P (l))) {
+ err_args = scm_list_1 (l);
+ goto vm_error_improper_list;
+ }
goto vm_return_values;
}
#include "instructions.h"
#include "objcodes.h"
#include "programs.h"
+#include "lang.h" /* NULL_OR_NIL_P */
#include "vm.h"
/* I sometimes use this for debugging. */
(elisp-pass-if '(function (lambda (x y &optional o &rest r) (list x y o r))) "(lambda (x y &optional o &rest r) (list x y o r))")
(elisp-pass-if '(funcall (lambda (x y &optional o &rest r) (list x y o r)) 1 2 3 4) "(1 2 3 (4))")
- ;; If r4rs.scm is compiled, `apply' will only unroll true scheme
- ;; lists.
- (elisp-pass-if/maybe-error
- 'vm-error
- '(apply (lambda (x y &optional o &rest r) (list x y o r)) 1 2 3 nil)
- "(1 2 3 #nil)")
+ (elisp-pass-if '(apply (lambda (x y &optional o &rest r) (list x y o r)) 1 2 3 nil)
+ "(1 2 3 #nil)")
(elisp-pass-if '(setq x 3) "3")
(elisp-pass-if '(defvar x 4) "x")