* snarf.h (SCM_PROC1): Bugfix: Use (void) rather than (...) for
[bpt/guile.git] / libguile / snarf.h
1 /* classes: h_files */
2
3 /* Macros for snarfing initialization actions from C source. */
4
5 #ifndef LIBGUILE_SNARF_H
6 #define LIBGUILE_SNARF_H
7
8 /* Copyright (C) 1995,1996 Free Software Foundation, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2, or (at your option)
13 * any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this software; see the file COPYING. If not, write to
22 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 * As a special exception, the Free Software Foundation gives permission
25 * for additional uses of the text contained in its release of GUILE.
26 *
27 * The exception is that, if you link the GUILE library with other files
28 * to produce an executable, this does not by itself cause the
29 * resulting executable to be covered by the GNU General Public License.
30 * Your use of that executable is in no way restricted on account of
31 * linking the GUILE library code into it.
32 *
33 * This exception does not however invalidate any other reasons why
34 * the executable file might be covered by the GNU General Public License.
35 *
36 * This exception applies only to the code released by the
37 * Free Software Foundation under the name GUILE. If you copy
38 * code from other Free Software Foundation releases into a copy of
39 * GUILE, as the General Public License permits, the exception does
40 * not apply to the code that you add in this way. To avoid misleading
41 * anyone as to the status of such modified files, you must delete
42 * this exception notice from them.
43 *
44 * If you write modifications of your own for GUILE, it is your choice
45 * whether to permit this exception to apply to your modifications.
46 * If you do not wish that, delete this exception notice. */
47 \f
48
49 #ifndef SCM_MAGIC_SNARFER
50 #define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN) \
51 static char RANAME[]=STR
52 #define SCM_PROC1(RANAME, STR, TYPE, CFN) \
53 static char RANAME[]=STR
54 #else
55 #ifdef __cplusplus
56 #if REQ == 0 && OPT == 0 && VAR == 0
57 #define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN) \
58 %%% scm_make_gsubr (RANAME, REQ, OPT, VAR, (SCM (*) (void)) CFN)
59 #else
60 #define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN) \
61 %%% scm_make_gsubr (RANAME, REQ, OPT, VAR, (SCM (*) (SCM, ...)) CFN)
62 #endif
63 #if TYPE == scm_tc7_subr_0
64 #define SCM_PROC1(RANAME, STR, TYPE, CFN) \
65 %%% scm_make_subr(RANAME, TYPE, (SCM (*)(void)) CFN)
66 #else
67 #define SCM_PROC1(RANAME, STR, TYPE, CFN) \
68 %%% scm_make_subr(RANAME, TYPE, (SCM (*)(...)) CFN)
69 #endif
70 #else /* __cplusplus */
71 #define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN) \
72 %%% scm_make_gsubr (RANAME, REQ, OPT, VAR, CFN)
73 #define SCM_PROC1(RANAME, STR, TYPE, CFN) \
74 %%% scm_make_subr(RANAME, TYPE, CFN)
75 #endif /* __cplusplus */
76 #endif
77
78 #ifndef SCM_MAGIC_SNARFER
79 #define SCM_SYMBOL(c_name, scheme_name) \
80 static SCM c_name = SCM_BOOL_F
81 #else
82 #define SCM_SYMBOL(C_NAME, SCHEME_NAME) \
83 %%% C_NAME = scm_permanent_object (SCM_CAR (scm_intern0 (SCHEME_NAME)))
84 #endif
85
86
87 #ifndef SCM_MAGIC_SNARFER
88 #define SCM_GLOBAL(c_name, scheme_name) \
89 static SCM c_name = SCM_BOOL_F
90 #else
91 #define SCM_GLOBAL(C_NAME, SCHEME_NAME) \
92 %%% C_NAME = scm_permanent_object (scm_intern0 (SCHEME_NAME)); SCM_SETCDR (C_NAME, SCM_BOOL_F)
93 #endif
94
95
96 #ifndef SCM_MAGIC_SNARFER
97 #define SCM_CONST_LONG(C_NAME, SCHEME_NAME,VALUE) \
98 static SCM C_NAME = SCM_BOOL_F
99 #else
100 #define SCM_CONST_LONG(C_NAME, SCHEME_NAME,VALUE) \
101 %%% C_NAME = scm_permanent_object (scm_intern0 (SCHEME_NAME)); SCM_SETCDR (C_NAME, scm_long2num (VALUE))
102 #endif
103
104 #endif /* LIBGUILE_SNARF_H */