Commit | Line | Data |
---|---|---|
0f2d19dd JB |
1 | /* classes: h_files */ |
2 | ||
dee01b01 DH |
3 | #ifndef SCM_GSUBR_H |
4 | #define SCM_GSUBR_H | |
5 | ||
be90d0b6 | 6 | /* Copyright (C) 1995, 1996, 1998, 2000, 2001, 2006, 2008, 2009, |
27337b63 | 7 | * 2010, 2011, 2013 Free Software Foundation, Inc. |
dee01b01 | 8 | * |
73be1d9e | 9 | * This library is free software; you can redistribute it and/or |
53befeb7 NJ |
10 | * modify it under the terms of the GNU Lesser General Public License |
11 | * as published by the Free Software Foundation; either version 3 of | |
12 | * the License, or (at your option) any later version. | |
dee01b01 | 13 | * |
53befeb7 NJ |
14 | * This library is distributed in the hope that it will be useful, but |
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
73be1d9e MV |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 | * Lesser General Public License for more details. | |
dee01b01 | 18 | * |
73be1d9e MV |
19 | * You should have received a copy of the GNU Lesser General Public |
20 | * License along with this library; if not, write to the Free Software | |
53befeb7 NJ |
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
22 | * 02110-1301 USA | |
73be1d9e | 23 | */ |
dee01b01 | 24 | |
0f2d19dd JB |
25 | \f |
26 | ||
b4309c3c | 27 | #include "libguile/__scm.h" |
0f2d19dd | 28 | |
9fdf9fd3 AW |
29 | |
30 | \f | |
31 | ||
9fdf9fd3 | 32 | |
fd12a19a AW |
33 | /* Subrs |
34 | */ | |
9fdf9fd3 | 35 | |
9174596d AW |
36 | /* Max number of args to the C procedure backing a gsubr */ |
37 | #define SCM_GSUBR_MAX 10 | |
38 | ||
d798a895 | 39 | #define SCM_PRIMITIVE_P(x) (SCM_PROGRAM_P (x) && SCM_PROGRAM_IS_PRIMITIVE (x)) |
d4149a51 | 40 | |
d798a895 | 41 | #define SCM_PRIMITIVE_GENERIC_P(x) (SCM_PROGRAM_P (x) && SCM_PROGRAM_IS_PRIMITIVE_GENERIC (x)) |
fd12a19a | 42 | |
d4149a51 | 43 | #define SCM_SUBRF(x) \ |
27337b63 | 44 | ((SCM (*) (void)) \ |
d798a895 | 45 | SCM_POINTER_VALUE (SCM_PROGRAM_FREE_VARIABLE_REF (x, 0))) |
d4149a51 | 46 | |
d798a895 | 47 | #define SCM_SUBR_NAME(x) (SCM_PROGRAM_FREE_VARIABLE_REF (x, 1)) |
d4149a51 LC |
48 | |
49 | #define SCM_SUBR_GENERIC(x) \ | |
d798a895 | 50 | ((SCM *) SCM_POINTER_VALUE (SCM_PROGRAM_FREE_VARIABLE_REF (x, 2))) |
d4149a51 | 51 | |
fd12a19a AW |
52 | #define SCM_SET_SUBR_GENERIC(x, g) \ |
53 | (*SCM_SUBR_GENERIC (x) = (g)) | |
9fdf9fd3 | 54 | |
0f2d19dd | 55 | \f |
0f2d19dd | 56 | |
27337b63 | 57 | SCM_INTERNAL int scm_i_primitive_arity (SCM subr, int *req, int *opt, int *rest); |
0e3a59f7 | 58 | SCM_INTERNAL scm_t_uintptr scm_i_primitive_call_ip (SCM subr); |
27337b63 | 59 | |
be90d0b6 LC |
60 | SCM_API SCM scm_c_make_gsubr (const char *name, |
61 | int req, int opt, int rst, scm_t_subr fcn); | |
33b001fd MV |
62 | SCM_API SCM scm_c_make_gsubr_with_generic (const char *name, |
63 | int req, int opt, int rst, | |
be90d0b6 LC |
64 | scm_t_subr fcn, SCM *gf); |
65 | SCM_API SCM scm_c_define_gsubr (const char *name, | |
66 | int req, int opt, int rst, scm_t_subr fcn); | |
33b001fd MV |
67 | SCM_API SCM scm_c_define_gsubr_with_generic (const char *name, |
68 | int req, int opt, int rst, | |
be90d0b6 | 69 | scm_t_subr fcn, SCM *gf); |
9d78586f | 70 | |
102dbb6f | 71 | SCM_INTERNAL void scm_init_gsubr (void); |
9d78586f | 72 | |
dee01b01 | 73 | #endif /* SCM_GSUBR_H */ |
89e00824 ML |
74 | |
75 | /* | |
76 | Local Variables: | |
77 | c-file-style: "gnu" | |
78 | End: | |
79 | */ |