fix procedure-name on applicable structs
[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
fd12a19a
AW
40#define SCM_PRIMITIVE_P(x) (SCM_NIMP (x) && SCM_TYP7 (x) == scm_tc7_gsubr)
41#define SCM_PRIMITIVE_GENERIC_P(x) (SCM_PROGRAM_P (x) && SCM_PROGRAM_IS_PRIMITIVE_GENERIC (x))
42
43#define SCM_SUBRF(x) ((SCM (*)()) (SCM_FOREIGN_OBJECT (SCM_SIMPLE_VECTOR_REF (SCM_PROGRAM_OBJTABLE (x), 0), void*)))
44#define SCM_SUBR_NAME(x) (SCM_SIMPLE_VECTOR_REF (SCM_PROGRAM_OBJTABLE (x), 1))
45#define SCM_SUBR_GENERIC(x) \
46 (SCM_FOREIGN_OBJECT_REF (SCM_SIMPLE_VECTOR_REF (SCM_PROGRAM_OBJTABLE (x), 2), SCM*))
47#define SCM_SET_SUBR_GENERIC(x, g) \
48 (*SCM_SUBR_GENERIC (x) = (g))
9fdf9fd3 49
0f2d19dd 50\f
0f2d19dd 51
e20d7001
LC
52/* Return an integer describing the arity of GSUBR, a subr of type
53 `scm_tc7_gsubr'. The result can be interpreted with `SCM_GSUBR_REQ ()'
54 and similar. */
55#define SCM_GSUBR_TYPE(gsubr) (SCM_CELL_TYPE (gsubr) >> 8)
56
dc0938d8 57#define SCM_GSUBR_MAKTYPE(req, opt, rst) ((req)|((opt)<<4)|((rst)<<8))
e20d7001 58#define SCM_GSUBR_MAX 33
c014a02e
ML
59#define SCM_GSUBR_REQ(x) ((long)(x)&0xf)
60#define SCM_GSUBR_OPT(x) (((long)(x)&0xf0)>>4)
61#define SCM_GSUBR_REST(x) ((long)(x)>>8)
dc0938d8 62
33b001fd
MV
63SCM_API SCM scm_c_make_gsubr (const char *name,
64 int req, int opt, int rst, SCM (*fcn) ());
65SCM_API SCM scm_c_make_gsubr_with_generic (const char *name,
66 int req, int opt, int rst,
67 SCM (*fcn) (), SCM *gf);
68SCM_API SCM scm_c_define_gsubr (const char *name,
69 int req, int opt, int rst, SCM (*fcn) ());
70SCM_API SCM scm_c_define_gsubr_with_generic (const char *name,
71 int req, int opt, int rst,
72 SCM (*fcn) (), SCM *gf);
9d78586f 73
8321ed20
LC
74SCM_INTERNAL SCM scm_i_gsubr_apply (SCM proc, SCM arg, ...);
75SCM_INTERNAL SCM scm_i_gsubr_apply_list (SCM proc, SCM args);
23f276de
AW
76SCM_INTERNAL SCM scm_i_gsubr_apply_array (SCM proc, SCM *args, int nargs,
77 int headroom);
102dbb6f 78SCM_INTERNAL void scm_init_gsubr (void);
9d78586f 79
dee01b01 80#endif /* SCM_GSUBR_H */
89e00824
ML
81
82/*
83 Local Variables:
84 c-file-style: "gnu"
85 End:
86*/