merge from guile master
[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 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 #define SCM_GSUBR_MAKTYPE(req, opt, rst) ((req)|((opt)<<4)|((rst)<<8))
30 #define SCM_GSUBR_REQ(x) ((long)(x)&0xf)
31 #define SCM_GSUBR_OPT(x) (((long)(x)&0xf0)>>4)
32 #define SCM_GSUBR_REST(x) ((long)(x)>>8)
33
34 #define SCM_GSUBR_MAX 10
35 #define SCM_GSUBR_TYPE(cclo) (SCM_CCLO_REF ((cclo), 1))
36 #define SCM_SET_GSUBR_TYPE(cclo, type) (SCM_CCLO_SET ((cclo), 1, (type)))
37 #define SCM_GSUBR_PROC(cclo) (SCM_CCLO_REF ((cclo), 2))
38 #define SCM_SET_GSUBR_PROC(cclo, proc) (SCM_CCLO_SET ((cclo), 2, (proc)))
39
40 SCM_API SCM scm_f_gsubr_apply;
41
42 SCM_API SCM scm_c_make_gsubr (const char *name,
43 int req, int opt, int rst, SCM (*fcn) ());
44 SCM_API SCM scm_c_make_gsubr_with_generic (const char *name,
45 int req, int opt, int rst,
46 SCM (*fcn) (), SCM *gf);
47 SCM_API SCM scm_c_define_gsubr (const char *name,
48 int req, int opt, int rst, SCM (*fcn) ());
49 SCM_API SCM scm_c_define_gsubr_with_generic (const char *name,
50 int req, int opt, int rst,
51 SCM (*fcn) (), SCM *gf);
52
53 SCM_API SCM scm_gsubr_apply (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 */