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