Commit | Line | Data |
---|---|---|
0f2d19dd JB |
1 | /* classes: h_files */ |
2 | ||
dee01b01 DH |
3 | #ifndef SCM_GSUBR_H |
4 | #define SCM_GSUBR_H | |
5 | ||
fd12a19a | 6 | /* Copyright (C) 1995,1996,1998,2000,2001, 2006, 2008, 2009, 2010 Free Software Foundation, Inc. |
dee01b01 | 7 | * |
73be1d9e | 8 | * This library is free software; you can redistribute it and/or |
53befeb7 NJ |
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. | |
dee01b01 | 12 | * |
53befeb7 NJ |
13 | * This library is distributed in the hope that it will be useful, but |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
73be1d9e MV |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | * Lesser General Public License for more details. | |
dee01b01 | 17 | * |
73be1d9e MV |
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 | |
53befeb7 NJ |
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
21 | * 02110-1301 USA | |
73be1d9e | 22 | */ |
dee01b01 | 23 | |
0f2d19dd JB |
24 | \f |
25 | ||
b4309c3c | 26 | #include "libguile/__scm.h" |
0f2d19dd | 27 | |
9fdf9fd3 AW |
28 | |
29 | \f | |
30 | ||
9fdf9fd3 | 31 | |
fd12a19a AW |
32 | SCM_API SCM scm_subr_objcode_trampoline (unsigned int nreq, |
33 | unsigned int nopt, | |
34 | unsigned int rest); | |
9fdf9fd3 | 35 | |
9fdf9fd3 | 36 | |
fd12a19a AW |
37 | /* Subrs |
38 | */ | |
9fdf9fd3 | 39 | |
9174596d AW |
40 | /* Max number of args to the C procedure backing a gsubr */ |
41 | #define SCM_GSUBR_MAX 10 | |
42 | ||
cc7005bc | 43 | #define SCM_PRIMITIVE_P(x) (SCM_PROGRAM_P (x) && SCM_PROGRAM_IS_PRIMITIVE (x)) |
fd12a19a AW |
44 | #define SCM_PRIMITIVE_GENERIC_P(x) (SCM_PROGRAM_P (x) && SCM_PROGRAM_IS_PRIMITIVE_GENERIC (x)) |
45 | ||
52fd9639 | 46 | #define SCM_SUBRF(x) ((SCM (*)()) (SCM_FOREIGN_POINTER (SCM_SIMPLE_VECTOR_REF (SCM_PROGRAM_OBJTABLE (x), 0), void))) |
fd12a19a AW |
47 | #define SCM_SUBR_NAME(x) (SCM_SIMPLE_VECTOR_REF (SCM_PROGRAM_OBJTABLE (x), 1)) |
48 | #define SCM_SUBR_GENERIC(x) \ | |
52fd9639 | 49 | (SCM_FOREIGN_POINTER (SCM_SIMPLE_VECTOR_REF (SCM_PROGRAM_OBJTABLE (x), 2), SCM)) |
fd12a19a AW |
50 | #define SCM_SET_SUBR_GENERIC(x, g) \ |
51 | (*SCM_SUBR_GENERIC (x) = (g)) | |
9fdf9fd3 | 52 | |
0f2d19dd | 53 | \f |
0f2d19dd | 54 | |
33b001fd MV |
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); | |
9d78586f | 65 | |
102dbb6f | 66 | SCM_INTERNAL void scm_init_gsubr (void); |
9d78586f | 67 | |
dee01b01 | 68 | #endif /* SCM_GSUBR_H */ |
89e00824 ML |
69 | |
70 | /* | |
71 | Local Variables: | |
72 | c-file-style: "gnu" | |
73 | End: | |
74 | */ |