* Lots of files: New address for FSF.
[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,1997 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, Inc., 59 Temple Place, Suite 330,
23 * Boston, MA 02111-1307 USA
24 *
25 * As a special exception, the Free Software Foundation gives permission
26 * for additional uses of the text contained in its release of GUILE.
27 *
28 * The exception is that, if you link the GUILE library with other files
29 * to produce an executable, this does not by itself cause the
30 * resulting executable to be covered by the GNU General Public License.
31 * Your use of that executable is in no way restricted on account of
32 * linking the GUILE library code into it.
33 *
34 * This exception does not however invalidate any other reasons why
35 * the executable file might be covered by the GNU General Public License.
36 *
37 * This exception applies only to the code released by the
38 * Free Software Foundation under the name GUILE. If you copy
39 * code from other Free Software Foundation releases into a copy of
40 * GUILE, as the General Public License permits, the exception does
41 * not apply to the code that you add in this way. To avoid misleading
42 * anyone as to the status of such modified files, you must delete
43 * this exception notice from them.
44 *
45 * If you write modifications of your own for GUILE, it is your choice
46 * whether to permit this exception to apply to your modifications.
47 * If you do not wish that, delete this exception notice. */
48 \f
49
50 #ifndef SCM_MAGIC_SNARFER
51 #define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN) \
52 static char RANAME[]=STR
53 #define SCM_PROC1(RANAME, STR, TYPE, CFN) \
54 static char RANAME[]=STR
55 #else
56 #ifdef __cplusplus
57 #if REQ == 0 && OPT == 0 && VAR == 0
58 #define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN) \
59 %%% scm_make_gsubr (RANAME, REQ, OPT, VAR, (SCM (*) (void)) CFN)
60 #else
61 #define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN) \
62 %%% scm_make_gsubr (RANAME, REQ, OPT, VAR, (SCM (*) (SCM, ...)) CFN)
63 #endif
64 #if TYPE == scm_tc7_subr_0
65 #define SCM_PROC1(RANAME, STR, TYPE, CFN) \
66 %%% scm_make_subr(RANAME, TYPE, (SCM (*)(void)) CFN)
67 #else
68 #define SCM_PROC1(RANAME, STR, TYPE, CFN) \
69 %%% scm_make_subr(RANAME, TYPE, (SCM (*)(...)) CFN)
70 #endif
71 #else /* __cplusplus */
72 #define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN) \
73 %%% scm_make_gsubr (RANAME, REQ, OPT, VAR, CFN)
74 #define SCM_PROC1(RANAME, STR, TYPE, CFN) \
75 %%% scm_make_subr(RANAME, TYPE, CFN)
76 #endif /* __cplusplus */
77 #endif
78
79 #ifndef SCM_MAGIC_SNARFER
80 #define SCM_SYMBOL(c_name, scheme_name) \
81 static SCM c_name = SCM_BOOL_F
82 #else
83 #define SCM_SYMBOL(C_NAME, SCHEME_NAME) \
84 %%% C_NAME = scm_permanent_object (SCM_CAR (scm_intern0 (SCHEME_NAME)))
85 #endif
86
87 #ifndef SCM_MAGIC_SNARFER
88 #define SCM_GLOBAL_SYMBOL(c_name, scheme_name) \
89 SCM c_name = SCM_BOOL_F
90 #else
91 #define SCM_GLOBAL_SYMBOL(C_NAME, SCHEME_NAME) \
92 %%% C_NAME = scm_permanent_object (SCM_CAR (scm_intern0 (SCHEME_NAME)))
93 #endif
94
95
96 #ifndef SCM_MAGIC_SNARFER
97 #define SCM_VCELL(c_name, scheme_name) \
98 static SCM c_name = SCM_BOOL_F
99 #else
100 #define SCM_VCELL(C_NAME, SCHEME_NAME) \
101 %%% C_NAME = scm_permanent_object (scm_intern0 (SCHEME_NAME)); SCM_SETCDR (C_NAME, SCM_BOOL_F)
102 #endif
103
104 #ifndef SCM_MAGIC_SNARFER
105 #define SCM_GLOBAL_VCELL(c_name, scheme_name) \
106 SCM c_name = SCM_BOOL_F
107 #else
108 #define SCM_GLOBAL_VCELL(C_NAME, SCHEME_NAME) \
109 %%% C_NAME = scm_permanent_object (scm_intern0 (SCHEME_NAME)); SCM_SETCDR (C_NAME, SCM_BOOL_F)
110 #endif
111
112
113 #ifndef SCM_MAGIC_SNARFER
114 #define SCM_CONST_LONG(C_NAME, SCHEME_NAME,VALUE) \
115 static SCM C_NAME = SCM_BOOL_F
116 #else
117 #define SCM_CONST_LONG(C_NAME, SCHEME_NAME,VALUE) \
118 %%% C_NAME = scm_permanent_object (scm_intern0 (SCHEME_NAME)); SCM_SETCDR (C_NAME, scm_long2num (VALUE))
119 #endif
120
121 #endif /* LIBGUILE_SNARF_H */