%compute-applicable-methods in Scheme
[bpt/guile.git] / libguile / gsubr.c
index 1969dbf..329241d 100644 (file)
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2006, 2008, 2009, 2010, 2011, 2013 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2001, 2006, 2008-2011, 2013
+ *   Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -28,7 +29,6 @@
 #include "libguile/gsubr.h"
 #include "libguile/foreign.h"
 #include "libguile/instructions.h"
-#include "libguile/objcodes.h"
 #include "libguile/srfi-4.h"
 #include "libguile/programs.h"
 
@@ -43,9 +43,7 @@
 \f
 
 /* OK here goes nothing: we're going to define VM assembly trampolines for
-   invoking subrs, along with their meta-information, and then wrap them into
-   statically allocated objcode values. Ready? Right!
-*/
+   invoking subrs.  Ready?  Right!  */
 
 /* There's a maximum of 10 args, so the number of possible combinations is:
    (REQ-OPT-REST)
 
 /* A: req; B: opt; C: rest */
 #define A(nreq)                                                         \
-  SCM_PACK_RTL_24 (scm_op_assert_nargs_ee, nreq + 1),                   \
-  SCM_PACK_RTL_24 (scm_op_subr_call, 0),                                \
+  SCM_PACK_OP_24 (assert_nargs_ee, nreq + 1),                           \
+  SCM_PACK_OP_24 (subr_call, 0),                                        \
   0,                                                                    \
   0
 
 #define B(nopt)                                                         \
-  SCM_PACK_RTL_24 (scm_op_assert_nargs_le, nopt + 1),                   \
-  SCM_PACK_RTL_24 (scm_op_alloc_frame, nopt + 1),                       \
-  SCM_PACK_RTL_24 (scm_op_subr_call, 0),                                \
+  SCM_PACK_OP_24 (assert_nargs_le, nopt + 1),                           \
+  SCM_PACK_OP_24 (alloc_frame, nopt + 1),                               \
+  SCM_PACK_OP_24 (subr_call, 0),                                        \
   0
 
 #define C()                                                             \
-  SCM_PACK_RTL_24 (scm_op_bind_rest, 1),                                \
-  SCM_PACK_RTL_24 (scm_op_subr_call, 0),                                \
+  SCM_PACK_OP_24 (bind_rest, 1),                                        \
+  SCM_PACK_OP_24 (subr_call, 0),                                        \
   0,                                                                    \
   0
 
 #define AB(nreq, nopt)                                                  \
-  SCM_PACK_RTL_24 (scm_op_assert_nargs_ge, nreq + 1),                   \
-  SCM_PACK_RTL_24 (scm_op_assert_nargs_le, nreq + nopt + 1),            \
-  SCM_PACK_RTL_24 (scm_op_alloc_frame, nreq + nopt + 1),                \
-  SCM_PACK_RTL_24 (scm_op_subr_call, 0)
+  SCM_PACK_OP_24 (assert_nargs_ge, nreq + 1),                           \
+  SCM_PACK_OP_24 (assert_nargs_le, nreq + nopt + 1),                    \
+  SCM_PACK_OP_24 (alloc_frame, nreq + nopt + 1),                        \
+  SCM_PACK_OP_24 (subr_call, 0)
 
 #define AC(nreq)                                                        \
-  SCM_PACK_RTL_24 (scm_op_assert_nargs_ge, nreq + 1),                   \
-  SCM_PACK_RTL_24 (scm_op_bind_rest, nreq + 1),                         \
-  SCM_PACK_RTL_24 (scm_op_subr_call, 0),                                \
+  SCM_PACK_OP_24 (assert_nargs_ge, nreq + 1),                           \
+  SCM_PACK_OP_24 (bind_rest, nreq + 1),                                 \
+  SCM_PACK_OP_24 (subr_call, 0),                                        \
   0
 
 #define BC(nopt)                                                        \
-  SCM_PACK_RTL_24 (scm_op_bind_rest, nopt + 1),                         \
-  SCM_PACK_RTL_24 (scm_op_subr_call, 0),                                \
+  SCM_PACK_OP_24 (bind_rest, nopt + 1),                                 \
+  SCM_PACK_OP_24 (subr_call, 0),                                        \
   0,                                                                    \
   0
 
 #define ABC(nreq, nopt)                                                 \
-  SCM_PACK_RTL_24 (scm_op_assert_nargs_ge, nreq + 1),                   \
-  SCM_PACK_RTL_24 (scm_op_bind_rest, nreq + nopt + 1),                  \
-  SCM_PACK_RTL_24 (scm_op_subr_call, 0),                                \
+  SCM_PACK_OP_24 (assert_nargs_ge, nreq + 1),                           \
+  SCM_PACK_OP_24 (bind_rest, nreq + nopt + 1),                          \
+  SCM_PACK_OP_24 (subr_call, 0),                                        \
   0
 
 
@@ -253,9 +251,9 @@ create_subr (int define, const char *name,
   return ret;
 }
 
-/* Given an RTL primitive, determine its minimum arity.  This is
-   possible because each RTL primitive is 4 32-bit words long, and they
-   are laid out contiguously in an ordered pattern.  */
+/* Given a program that is a primitive, determine its minimum arity.
+   This is possible because each primitive's code is 4 32-bit words
+   long, and they are laid out contiguously in an ordered pattern.  */
 int
 scm_i_primitive_arity (SCM prim, int *req, int *opt, int *rest)
 {