Merge remote-tracking branch 'origin/stable-2.0'
[bpt/guile.git] / libguile / eval.c
index e008b3a..5a42b1e 100644 (file)
@@ -24,6 +24,7 @@
 #endif
 
 #include <alloca.h>
+#include <stdarg.h>
 
 #include "libguile/__scm.h"
 
@@ -229,10 +230,9 @@ eval (SCM x, SCM env)
   mx = SCM_MEMOIZED_ARGS (x);
   switch (SCM_MEMOIZED_TAG (x))
     {
-    case SCM_M_BEGIN:
-      for (; !scm_is_null (CDR (mx)); mx = CDR (mx))
-        eval (CAR (mx), env);
-      x = CAR (mx);
+    case SCM_M_SEQ:
+      eval (CAR (mx), env);
+      x = CDR (mx);
       goto loop;
 
     case SCM_M_IF:
@@ -521,12 +521,57 @@ scm_call_6 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM arg4, SCM arg5,
   return scm_c_vm_run (scm_the_vm (), proc, args, 6);
 }
 
+SCM
+scm_call_7 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM arg4, SCM arg5,
+            SCM arg6, SCM arg7)
+{
+  SCM args[] = { arg1, arg2, arg3, arg4, arg5, arg6, arg7 };
+  return scm_c_vm_run (scm_the_vm (), proc, args, 7);
+}
+
+SCM
+scm_call_8 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM arg4, SCM arg5,
+            SCM arg6, SCM arg7, SCM arg8)
+{
+  SCM args[] = { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 };
+  return scm_c_vm_run (scm_the_vm (), proc, args, 8);
+}
+
+SCM
+scm_call_9 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM arg4, SCM arg5,
+            SCM arg6, SCM arg7, SCM arg8, SCM arg9)
+{
+  SCM args[] = { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 };
+  return scm_c_vm_run (scm_the_vm (), proc, args, 9);
+}
+
 SCM
 scm_call_n (SCM proc, SCM *argv, size_t nargs)
 {
   return scm_c_vm_run (scm_the_vm (), proc, argv, nargs);
 }
 
+SCM
+scm_call (SCM proc, ...)
+{
+  va_list argp;
+  SCM *argv = NULL;
+  size_t i, nargs = 0;
+
+  va_start (argp, proc);
+  while (!SCM_UNBNDP (va_arg (argp, SCM)))
+    nargs++;
+  va_end (argp);
+
+  argv = alloca (nargs * sizeof (SCM));
+  va_start (argp, proc);
+  for (i = 0; i < nargs; i++)
+    argv[i] = va_arg (argp, SCM);
+  va_end (argp);
+
+  return scm_c_vm_run (scm_the_vm (), proc, argv, nargs);
+}
+
 /* Simple procedure applies
  */
 
@@ -914,16 +959,16 @@ static int
 boot_closure_print (SCM closure, SCM port, scm_print_state *pstate)
 {
   SCM args;
-  scm_puts ("#<boot-closure ", port);
-  scm_uintprint ((scm_t_bits)SCM2PTR (closure), 16, port);
-  scm_putc (' ', port);
+  scm_puts_unlocked ("#<boot-closure ", port);
+  scm_uintprint (SCM_UNPACK (closure), 16, port);
+  scm_putc_unlocked (' ', port);
   args = scm_make_list (scm_from_int (BOOT_CLOSURE_NUM_REQUIRED_ARGS (closure)),
                         scm_from_latin1_symbol ("_"));
   if (!BOOT_CLOSURE_IS_FIXED (closure) && BOOT_CLOSURE_HAS_REST_ARGS (closure))
     args = scm_cons_star (scm_from_latin1_symbol ("_"), args);
   /* FIXME: optionals and rests */
   scm_display (args, port);
-  scm_putc ('>', port);
+  scm_putc_unlocked ('>', port);
   return 1;
 }