REPL Server: Don't establish a SIGINT handler.
[bpt/guile.git] / libguile / gsubr.h
1 /* classes: h_files */
2
3 #ifndef SCM_GSUBR_H
4 #define SCM_GSUBR_H
5
6 /* Copyright (C) 1995, 1996, 1998, 2000, 2001, 2006, 2008, 2009,
7 * 2010, 2011 Free Software Foundation, Inc.
8 *
9 * This library is free software; you can redistribute it and/or
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.
13 *
14 * This library is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
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
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 * 02110-1301 USA
23 */
24
25 \f
26
27 #include "libguile/__scm.h"
28
29
30 \f
31
32
33 SCM_API SCM scm_subr_objcode_trampoline (unsigned int nreq,
34 unsigned int nopt,
35 unsigned int rest);
36
37
38 /* Subrs
39 */
40
41 /* Max number of args to the C procedure backing a gsubr */
42 #define SCM_GSUBR_MAX 10
43
44 #define SCM_PRIMITIVE_P(x) (SCM_PROGRAM_P (x) && SCM_PROGRAM_IS_PRIMITIVE (x))
45
46 #define SCM_PRIMITIVE_GENERIC_P(x) (SCM_PROGRAM_P (x) && SCM_PROGRAM_IS_PRIMITIVE_GENERIC (x))
47
48 #define SCM_SUBRF(x) \
49 ((SCM (*) (void)) \
50 SCM_POINTER_VALUE (SCM_SIMPLE_VECTOR_REF (SCM_PROGRAM_OBJTABLE (x), 0)))
51
52 #define SCM_SUBR_NAME(x) (SCM_SIMPLE_VECTOR_REF (SCM_PROGRAM_OBJTABLE (x), 1))
53
54 #define SCM_SUBR_GENERIC(x) \
55 ((SCM *) \
56 SCM_POINTER_VALUE (SCM_SIMPLE_VECTOR_REF (SCM_PROGRAM_OBJTABLE (x), 2)))
57
58 #define SCM_SET_SUBR_GENERIC(x, g) \
59 (*SCM_SUBR_GENERIC (x) = (g))
60
61 \f
62
63 SCM_API SCM scm_c_make_gsubr (const char *name,
64 int req, int opt, int rst, scm_t_subr fcn);
65 SCM_API SCM scm_c_make_gsubr_with_generic (const char *name,
66 int req, int opt, int rst,
67 scm_t_subr fcn, SCM *gf);
68 SCM_API SCM scm_c_define_gsubr (const char *name,
69 int req, int opt, int rst, scm_t_subr fcn);
70 SCM_API SCM scm_c_define_gsubr_with_generic (const char *name,
71 int req, int opt, int rst,
72 scm_t_subr fcn, SCM *gf);
73
74 SCM_INTERNAL void scm_init_gsubr (void);
75
76 #endif /* SCM_GSUBR_H */
77
78 /*
79 Local Variables:
80 c-file-style: "gnu"
81 End:
82 */