Merge branch 'master' into boehm-demers-weiser-gc
[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 Free Software Foundation, Inc.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but 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.
17 *
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 02110-1301 USA
21 */
22
23 \f
24
25 #include "libguile/__scm.h"
26
27 \f
28
29 /* Return an integer describing the arity of GSUBR, a subr of type
30 `scm_tc7_gsubr'. The result can be interpreted with `SCM_GSUBR_REQ ()'
31 and similar. */
32 #define SCM_GSUBR_TYPE(gsubr) (SCM_CELL_TYPE (gsubr) >> 8)
33
34 #define SCM_GSUBR_MAKTYPE(req, opt, rst) ((req)|((opt)<<4)|((rst)<<8))
35 #define SCM_GSUBR_MAX 33
36 #define SCM_GSUBR_REQ(x) ((long)(x)&0xf)
37 #define SCM_GSUBR_OPT(x) (((long)(x)&0xf0)>>4)
38 #define SCM_GSUBR_REST(x) ((long)(x)>>8)
39
40 SCM_API SCM scm_c_make_gsubr (const char *name,
41 int req, int opt, int rst, SCM (*fcn) ());
42 SCM_API SCM scm_c_make_gsubr_with_generic (const char *name,
43 int req, int opt, int rst,
44 SCM (*fcn) (), SCM *gf);
45 SCM_API SCM scm_c_define_gsubr (const char *name,
46 int req, int opt, int rst, SCM (*fcn) ());
47 SCM_API SCM scm_c_define_gsubr_with_generic (const char *name,
48 int req, int opt, int rst,
49 SCM (*fcn) (), SCM *gf);
50
51 SCM_INTERNAL SCM scm_i_gsubr_apply (SCM proc, SCM arg, ...);
52 SCM_INTERNAL SCM scm_i_gsubr_apply_list (SCM proc, SCM args);
53 SCM_INTERNAL void scm_init_gsubr (void);
54
55 #endif /* SCM_GSUBR_H */
56
57 /*
58 Local Variables:
59 c-file-style: "gnu"
60 End:
61 */