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