Commit | Line | Data |
---|---|---|
5b4215a8 JB |
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 | ||
1e598865 | 8 | /* Copyright (C) 1995,1996,1997 Free Software Foundation, Inc. |
5b4215a8 JB |
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 | |
dfa84eae | 56 | #if REQ == 0 && OPT == 0 && VAR == 0 |
5b4215a8 | 57 | #define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN) \ |
d0104d7e | 58 | %%% scm_make_gsubr (RANAME, REQ, OPT, VAR, (SCM (*) (void)) CFN) |
dfa84eae MD |
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 | |
5b4215a8 | 64 | #define SCM_PROC1(RANAME, STR, TYPE, CFN) \ |
d0104d7e | 65 | %%% scm_make_subr(RANAME, TYPE, (SCM (*)(void)) CFN) |
dfa84eae MD |
66 | #else |
67 | #define SCM_PROC1(RANAME, STR, TYPE, CFN) \ | |
68 | %%% scm_make_subr(RANAME, TYPE, (SCM (*)(...)) CFN) | |
69 | #endif | |
70 | #else /* __cplusplus */ | |
5b4215a8 JB |
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) | |
dfa84eae | 75 | #endif /* __cplusplus */ |
5b4215a8 JB |
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 | ||
78f9f47b MD |
86 | #ifndef SCM_MAGIC_SNARFER |
87 | #define SCM_GLOBAL_SYMBOL(c_name, scheme_name) \ | |
88 | SCM c_name = SCM_BOOL_F | |
89 | #else | |
90 | #define SCM_GLOBAL_SYMBOL(C_NAME, SCHEME_NAME) \ | |
91 | %%% C_NAME = scm_permanent_object (SCM_CAR (scm_intern0 (SCHEME_NAME))) | |
92 | #endif | |
93 | ||
5b4215a8 JB |
94 | |
95 | #ifndef SCM_MAGIC_SNARFER | |
78f9f47b | 96 | #define SCM_VCELL(c_name, scheme_name) \ |
5b4215a8 JB |
97 | static SCM c_name = SCM_BOOL_F |
98 | #else | |
78f9f47b MD |
99 | #define SCM_VCELL(C_NAME, SCHEME_NAME) \ |
100 | %%% C_NAME = scm_permanent_object (scm_intern0 (SCHEME_NAME)); SCM_SETCDR (C_NAME, SCM_BOOL_F) | |
101 | #endif | |
102 | ||
103 | #ifndef SCM_MAGIC_SNARFER | |
104 | #define SCM_GLOBAL_VCELL(c_name, scheme_name) \ | |
105 | SCM c_name = SCM_BOOL_F | |
106 | #else | |
107 | #define SCM_GLOBAL_VCELL(C_NAME, SCHEME_NAME) \ | |
5b4215a8 JB |
108 | %%% C_NAME = scm_permanent_object (scm_intern0 (SCHEME_NAME)); SCM_SETCDR (C_NAME, SCM_BOOL_F) |
109 | #endif | |
110 | ||
111 | ||
112 | #ifndef SCM_MAGIC_SNARFER | |
113 | #define SCM_CONST_LONG(C_NAME, SCHEME_NAME,VALUE) \ | |
114 | static SCM C_NAME = SCM_BOOL_F | |
115 | #else | |
116 | #define SCM_CONST_LONG(C_NAME, SCHEME_NAME,VALUE) \ | |
117 | %%% C_NAME = scm_permanent_object (scm_intern0 (SCHEME_NAME)); SCM_SETCDR (C_NAME, scm_long2num (VALUE)) | |
118 | #endif | |
119 | ||
120 | #endif /* LIBGUILE_SNARF_H */ |