move long_long and ulong_long definitions to
[bpt/guile.git] / libguile / deprecated.h
1 /* This file contains definitions for deprecated features. When you
2 deprecate something, move it here when that is feasible.
3 */
4
5 #ifndef SCM_DEPRECATED_H
6 #define SCM_DEPRECATED_H
7
8 /* Copyright (C) 2003 Free Software Foundation, Inc.
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library 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 GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25 #include "libguile/__scm.h"
26 #include "libguile/strings.h"
27
28 #if (SCM_ENABLE_DEPRECATED == 1)
29
30 /* From tags.h: Macro checking for two tc16 types that are allocated to differ
31 * only in the 's'-bit. Deprecated in guile 1.7.0 on 2003-09-21. */
32 #define SCM_TYP16S(x) (0xfeff & SCM_CELL_TYPE (x))
33
34
35 /* From numbers.h: Macros checking for types, but avoiding a redundant check
36 * for !SCM_IMP. These were deprecated in guile 1.7.0 on 2003-09-06. */
37 #define SCM_SLOPPY_INEXACTP(x) (SCM_TYP16S (x) == scm_tc16_real)
38 #define SCM_SLOPPY_REALP(x) (SCM_TYP16 (x) == scm_tc16_real)
39 #define SCM_SLOPPY_COMPLEXP(x) (SCM_TYP16 (x) == scm_tc16_complex)
40
41
42 /* From eval.h: Macros for handling ilocs. These were deprecated in guile
43 * 1.7.0 on 2003-06-04. */
44 #define SCM_ILOC00 SCM_MAKE_ITAG8(0L, scm_tc8_iloc)
45 #define SCM_IDINC (0x00100000L)
46 #define SCM_IDSTMSK (-SCM_IDINC)
47
48
49 /* From eval.h: Error messages of the evaluator. These were deprecated in
50 * guile 1.7.0 on 2003-06-02. */
51 SCM_API const char scm_s_expression[];
52 SCM_API const char scm_s_test[];
53 SCM_API const char scm_s_body[];
54 SCM_API const char scm_s_bindings[];
55 SCM_API const char scm_s_variable[];
56 SCM_API const char scm_s_clauses[];
57 SCM_API const char scm_s_formals[];
58
59
60 /* From eval.h: Helper macros for evaluation and application. These were
61 * deprecated in guile 1.7.0 on 2003-06-02. */
62 #define SCM_EVALIM2(x) \
63 ((SCM_EQ_P ((x), SCM_EOL) \
64 ? scm_misc_error (NULL, scm_s_expression, SCM_EOL), 0 \
65 : 0), \
66 (x))
67 #define SCM_EVALIM(x, env) (SCM_ILOCP (x) \
68 ? *scm_ilookup ((x), env) \
69 : SCM_EVALIM2(x))
70 #define SCM_XEVAL(x, env) (SCM_IMP (x) \
71 ? SCM_EVALIM2(x) \
72 : (*scm_ceval_ptr) ((x), (env)))
73 #define SCM_XEVALCAR(x, env) (SCM_IMP (SCM_CAR (x)) \
74 ? SCM_EVALIM (SCM_CAR (x), env) \
75 : (SCM_SYMBOLP (SCM_CAR (x)) \
76 ? *scm_lookupcar (x, env, 1) \
77 : (*scm_ceval_ptr) (SCM_CAR (x), env)))
78
79
80 #define scm_substring_move_left_x scm_substring_move_x
81 #define scm_substring_move_right_x scm_substring_move_x
82
83 #define scm_sizet size_t
84
85 SCM_API SCM scm_wta (SCM arg, const char *pos, const char *s_subr);
86
87 #define SCM_WNA 8
88 #define SCM_OUTOFRANGE 10
89 #define SCM_NALLOC 11
90
91 SCM_API void scm_register_module_xxx (char *module_name, void *init_func);
92 SCM_API SCM scm_registered_modules (void);
93 SCM_API SCM scm_clear_registered_modules (void);
94
95 SCM_API SCM scm_protect_object (SCM obj);
96 SCM_API SCM scm_unprotect_object (SCM obj);
97
98 #define SCM_SETAND_CAR(x, y) \
99 (SCM_SETCAR ((x), SCM_PACK (SCM_UNPACK (SCM_CAR (x)) & (y))))
100 #define SCM_SETOR_CAR(x, y)\
101 (SCM_SETCAR ((x), SCM_PACK (SCM_UNPACK (SCM_CAR (x)) | (y))))
102 #define SCM_SETAND_CDR(x, y)\
103 (SCM_SETCDR ((x), SCM_PACK (SCM_UNPACK (SCM_CDR (x)) & (y))))
104 #define SCM_SETOR_CDR(x, y)\
105 (SCM_SETCDR ((x), SCM_PACK (SCM_UNPACK (SCM_CDR (x)) | (y))))
106 #define SCM_FREEP(x) (SCM_FREE_CELL_P (x))
107 #define SCM_NFREEP(x) (!SCM_FREE_CELL_P (x))
108 #define SCM_GC8MARKP(x) SCM_GC_MARK_P (x)
109 #define SCM_SETGC8MARK(x) SCM_SET_GC_MARK (x)
110 #define SCM_CLRGC8MARK(x) SCM_CLEAR_GC_MARK (x)
111 #define SCM_GCTYP16(x) SCM_TYP16 (x)
112 #define SCM_GCCDR(x) SCM_CDR (x)
113 SCM_API void scm_remember (SCM * ptr);
114
115 SCM_API SCM scm_the_root_module (void);
116 SCM_API SCM scm_make_module (SCM name);
117 SCM_API SCM scm_ensure_user_module (SCM name);
118 SCM_API SCM scm_load_scheme_module (SCM name);
119
120 #define scm_port scm_t_port
121 #define scm_ptob_descriptor scm_t_ptob_descriptor
122 #define scm_port_rw_active scm_t_port_rw_active
123
124 SCM_API SCM scm_close_all_ports_except (SCM ports);
125
126 #define scm_rstate scm_t_rstate
127 #define scm_rng scm_t_rng
128
129 #define SCM_SLOPPY_CONSP(x) ((1 & SCM_CELL_TYPE (x)) == 0)
130 #define SCM_SLOPPY_NCONSP(x) (!SCM_SLOPPY_CONSP(x))
131
132 #define scm_tc7_ssymbol scm_tc7_symbol
133 #define scm_tc7_msymbol scm_tc7_symbol
134 #define scm_tcs_symbols scm_tc7_symbol
135
136 SCM_API SCM scm_makstr (size_t len, int);
137 SCM_API SCM scm_makfromstr (const char *src, size_t len, int);
138
139 SCM_API SCM scm_variable_set_name_hint (SCM var, SCM hint);
140 SCM_API SCM scm_builtin_variable (SCM name);
141
142 SCM_API SCM scm_internal_with_fluids (SCM fluids, SCM vals,
143 SCM (*cproc)(void *), void *cdata);
144
145 SCM_API SCM scm_make_gsubr (const char *name, int req, int opt, int rst,
146 SCM (*fcn)());
147 SCM_API SCM scm_make_gsubr_with_generic (const char *name,
148 int req,
149 int opt,
150 int rst,
151 SCM (*fcn)(),
152 SCM *gf);
153
154 extern SCM scm_create_hook (const char* name, int n_args);
155
156 #define SCM_LIST0 SCM_EOL
157 #define SCM_LIST1(e0) scm_cons ((e0), SCM_EOL)
158 #define SCM_LIST2(e0, e1) scm_cons2 ((e0), (e1), SCM_EOL)
159 #define SCM_LIST3(e0, e1, e2) scm_cons ((e0), SCM_LIST2 ((e1), (e2)))
160 #define SCM_LIST4(e0, e1, e2, e3)\
161 scm_cons2 ((e0), (e1), SCM_LIST2 ((e2), (e3)))
162 #define SCM_LIST5(e0, e1, e2, e3, e4)\
163 scm_cons ((e0), SCM_LIST4 ((e1), (e2), (e3), (e4)))
164 #define SCM_LIST6(e0, e1, e2, e3, e4, e5)\
165 scm_cons2 ((e0), (e1), SCM_LIST4 ((e2), (e3), (e4), (e5)))
166 #define SCM_LIST7(e0, e1, e2, e3, e4, e5, e6)\
167 scm_cons ((e0), SCM_LIST6 ((e1), (e2), (e3), (e4), (e5), (e6)))
168 #define SCM_LIST8(e0, e1, e2, e3, e4, e5, e6, e7)\
169 scm_cons2 ((e0), (e1), SCM_LIST6 ((e2), (e3), (e4), (e5), (e6), (e7)))
170 #define SCM_LIST9(e0, e1, e2, e3, e4, e5, e6, e7, e8)\
171 scm_cons ((e0),\
172 SCM_LIST8 ((e1), (e2), (e3), (e4), (e5), (e6), (e7), (e8)))
173
174 #define scm_listify scm_list_n
175
176 SCM_API SCM scm_sloppy_memq (SCM x, SCM lst);
177 SCM_API SCM scm_sloppy_memv (SCM x, SCM lst);
178 SCM_API SCM scm_sloppy_member (SCM x, SCM lst);
179
180 SCM_API SCM scm_read_and_eval_x (SCM port);
181
182 #define scm_subr_entry scm_t_subr_entry
183
184 #define SCM_SUBR_DOC(x) SCM_BOOL_F
185
186 SCM_API SCM scm_make_subr (const char *name, int type, SCM (*fcn) ());
187 SCM_API SCM scm_make_subr_with_generic (const char *name,
188 int type,
189 SCM (*fcn) (),
190 SCM *gf);
191 SCM_API SCM scm_make_subr_opt (const char *name,
192 int type,
193 SCM (*fcn) (),
194 int set);
195
196 SCM_API SCM scm_call_catching_errors (SCM (*thunk)(), SCM (*err_filter)(),
197 void * closure);
198
199 SCM_API long scm_make_smob_type_mfpe (char *name, size_t size,
200 SCM (*mark) (SCM),
201 size_t (*free) (SCM),
202 int (*print) (SCM, SCM,
203 scm_print_state*),
204 SCM (*equalp) (SCM, SCM));
205
206 SCM_API void scm_set_smob_mfpe (long tc,
207 SCM (*mark) (SCM),
208 size_t (*free) (SCM),
209 int (*print) (SCM, SCM, scm_print_state*),
210 SCM (*equalp) (SCM, SCM));
211
212 SCM_API SCM scm_strprint_obj (SCM obj);
213 SCM_API SCM scm_read_0str (char *expr);
214 SCM_API SCM scm_eval_0str (const char *expr);
215
216 SCM_API char *scm_i_object_chars (SCM);
217
218 #define SCM_CHARS(x) scm_i_object_chars(x)
219 #define SCM_UCHARS(x) ((unsigned char *)SCM_CHARS(x))
220
221 SCM_API long scm_i_object_length (SCM);
222
223 #define SCM_LENGTH(x) scm_i_object_length(x)
224
225 #define scm_strhash(str, len, n) (scm_string_hash ((str), (len)) % (n))
226
227 SCM_API SCM scm_sym2ovcell_soft (SCM sym, SCM obarray);
228 SCM_API SCM scm_sym2ovcell (SCM sym, SCM obarray);
229 SCM_API SCM scm_intern_obarray_soft (const char *name, size_t len,
230 SCM obarray, unsigned int softness);
231 SCM_API SCM scm_intern_obarray (const char *name, size_t len, SCM obarray);
232 SCM_API SCM scm_symbol_value0 (const char *name);
233
234 SCM_API SCM scm_string_to_obarray_symbol (SCM o, SCM s, SCM softp);
235 SCM_API SCM scm_intern_symbol (SCM o, SCM s);
236 SCM_API SCM scm_unintern_symbol (SCM o, SCM s);
237 SCM_API SCM scm_symbol_binding (SCM o, SCM s);
238 #if 0
239 /* This name has been reused for real uninterned symbols. */
240 SCM_API SCM scm_symbol_interned_p (SCM o, SCM s);
241 #endif
242 SCM_API SCM scm_symbol_bound_p (SCM o, SCM s);
243 SCM_API SCM scm_symbol_set_x (SCM o, SCM s, SCM v);
244
245 SCM_API SCM scm_gentemp (SCM prefix, SCM obarray);
246
247 #define SCM_OPDIRP(x) (SCM_DIRP (x) && (SCM_DIR_OPEN_P (x)))
248 #define scm_fport scm_t_fport
249 #define scm_option scm_t_option
250 #define scm_srcprops scm_t_srcprops
251 #define scm_srcprops_chunk scm_t_srcprops_chunk
252 #define scm_info_frame scm_t_info_frame
253 #define scm_stack scm_t_stack
254 #define scm_array scm_t_array
255 #define scm_array_dim scm_t_array_dim
256 #define SCM_ARRAY_CONTIGUOUS SCM_ARRAY_FLAG_CONTIGUOUS
257 #define SCM_FUNC_NAME (scm_makfrom0str (FUNC_NAME))
258
259 #define SCM_WTA(pos, scm) \
260 do { scm_wta (scm, (char *) pos, FUNC_NAME); } while (0)
261
262 #define RETURN_SCM_WTA(pos, scm) \
263 do { return scm_wta (scm, (char *) pos, FUNC_NAME); } while (0)
264
265 #define SCM_VALIDATE_NUMBER_COPY(pos, z, cvar) \
266 do { \
267 if (SCM_INUMP (z)) \
268 cvar = (double) SCM_INUM (z); \
269 else if (SCM_REALP (z)) \
270 cvar = SCM_REAL_VALUE (z); \
271 else if (SCM_BIGP (z)) \
272 cvar = scm_i_big2dbl (z); \
273 else \
274 { \
275 cvar = 0.0; \
276 SCM_WRONG_TYPE_ARG (pos, z); \
277 } \
278 } while (0)
279
280 #define SCM_VALIDATE_NUMBER_DEF_COPY(pos, number, def, cvar) \
281 do { \
282 if (SCM_UNBNDP (number)) \
283 cvar = def; \
284 else \
285 SCM_VALIDATE_NUMBER_COPY(pos, number, cvar); \
286 } while (0)
287
288 #define SCM_VALIDATE_OPDIR(pos, port) SCM_MAKE_VALIDATE (pos, port, OPDIRP)
289
290 void scm_i_init_deprecated (void);
291
292 #endif
293
294 #endif /* SCM_DEPRECATED_H */