6 /* Copyright (C) 1995,1996,1998,2000,2001, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 3 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 #include "libguile/__scm.h"
32 SCM_API SCM
scm_subr_objcode_trampoline (unsigned int nreq
,
40 /* Max number of args to the C procedure backing a gsubr */
41 #define SCM_GSUBR_MAX 10
43 #define SCM_PRIMITIVE_P(x) (SCM_PROGRAM_P (x) && SCM_PROGRAM_IS_PRIMITIVE (x))
44 #define SCM_PRIMITIVE_GENERIC_P(x) (SCM_PROGRAM_P (x) && SCM_PROGRAM_IS_PRIMITIVE_GENERIC (x))
46 #define SCM_SUBRF(x) ((SCM (*)()) (SCM_FOREIGN_OBJECT (SCM_SIMPLE_VECTOR_REF (SCM_PROGRAM_OBJTABLE (x), 0), void*)))
47 #define SCM_SUBR_NAME(x) (SCM_SIMPLE_VECTOR_REF (SCM_PROGRAM_OBJTABLE (x), 1))
48 #define SCM_SUBR_GENERIC(x) \
49 (SCM_FOREIGN_OBJECT_REF (SCM_SIMPLE_VECTOR_REF (SCM_PROGRAM_OBJTABLE (x), 2), SCM*))
50 #define SCM_SET_SUBR_GENERIC(x, g) \
51 (*SCM_SUBR_GENERIC (x) = (g))
55 SCM_API SCM
scm_c_make_gsubr (const char *name
,
56 int req
, int opt
, int rst
, SCM (*fcn
) ());
57 SCM_API SCM
scm_c_make_gsubr_with_generic (const char *name
,
58 int req
, int opt
, int rst
,
59 SCM (*fcn
) (), SCM
*gf
);
60 SCM_API SCM
scm_c_define_gsubr (const char *name
,
61 int req
, int opt
, int rst
, SCM (*fcn
) ());
62 SCM_API SCM
scm_c_define_gsubr_with_generic (const char *name
,
63 int req
, int opt
, int rst
,
64 SCM (*fcn
) (), SCM
*gf
);
66 SCM_INTERNAL
void scm_init_gsubr (void);
68 #endif /* SCM_GSUBR_H */