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