* numbers.h (SCM_INEXACTP): Removed uses of SCM_TYP16S.
[bpt/guile.git] / libguile / deprecated.h
CommitLineData
19e2247d
MV
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 *
73be1d9e
MV
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.
19e2247d 14 *
73be1d9e 15 * This library is distributed in the hope that it will be useful,
19e2247d 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
73be1d9e
MV
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19e2247d 19 *
73be1d9e
MV
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 */
19e2247d
MV
24
25#include "libguile/__scm.h"
55d30fac 26#include "libguile/strings.h"
19e2247d
MV
27
28#if (SCM_ENABLE_DEPRECATED == 1)
29
f03314f9
DH
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
0d5e3480
DH
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
d0624e39
DH
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
e90c3a89
DH
49/* From eval.h: Error messages of the evaluator. These were deprecated in
50 * guile 1.7.0 on 2003-06-02. */
51SCM_API const char scm_s_expression[];
52SCM_API const char scm_s_test[];
53SCM_API const char scm_s_body[];
54SCM_API const char scm_s_bindings[];
55SCM_API const char scm_s_variable[];
56SCM_API const char scm_s_clauses[];
57SCM_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
19e2247d
MV
80#define scm_substring_move_left_x scm_substring_move_x
81#define scm_substring_move_right_x scm_substring_move_x
82
fcc5d734 83#if SCM_SIZEOF_LONG_LONG != 0
55d30fac
MV
84typedef long long long_long;
85typedef unsigned long long ulong_long;
fcc5d734
SJ
86#elif SCM_SIZEOF___INT64 != 0
87typedef __int64 long_long;
88typedef unsigned __int64 ulong_long;
89#endif
19e2247d 90
55d30fac 91#define scm_sizet size_t
19e2247d 92
55d30fac 93SCM_API SCM scm_wta (SCM arg, const char *pos, const char *s_subr);
19e2247d 94
55d30fac
MV
95#define SCM_WNA 8
96#define SCM_OUTOFRANGE 10
97#define SCM_NALLOC 11
19e2247d 98
55d30fac
MV
99SCM_API void scm_register_module_xxx (char *module_name, void *init_func);
100SCM_API SCM scm_registered_modules (void);
101SCM_API SCM scm_clear_registered_modules (void);
19e2247d 102
a0454d72
MV
103SCM_API SCM scm_protect_object (SCM obj);
104SCM_API SCM scm_unprotect_object (SCM obj);
105
106#define SCM_SETAND_CAR(x, y) \
107 (SCM_SETCAR ((x), SCM_PACK (SCM_UNPACK (SCM_CAR (x)) & (y))))
108#define SCM_SETOR_CAR(x, y)\
109 (SCM_SETCAR ((x), SCM_PACK (SCM_UNPACK (SCM_CAR (x)) | (y))))
110#define SCM_SETAND_CDR(x, y)\
111 (SCM_SETCDR ((x), SCM_PACK (SCM_UNPACK (SCM_CDR (x)) & (y))))
112#define SCM_SETOR_CDR(x, y)\
113 (SCM_SETCDR ((x), SCM_PACK (SCM_UNPACK (SCM_CDR (x)) | (y))))
114#define SCM_FREEP(x) (SCM_FREE_CELL_P (x))
115#define SCM_NFREEP(x) (!SCM_FREE_CELL_P (x))
7aaf8dc9
MD
116#define SCM_GC8MARKP(x) SCM_GC_MARK_P (x)
117#define SCM_SETGC8MARK(x) SCM_SET_GC_MARK (x)
118#define SCM_CLRGC8MARK(x) SCM_CLEAR_GC_MARK (x)
a0454d72
MV
119#define SCM_GCTYP16(x) SCM_TYP16 (x)
120#define SCM_GCCDR(x) SCM_CDR (x)
121SCM_API void scm_remember (SCM * ptr);
122
123SCM_API SCM scm_the_root_module (void);
124SCM_API SCM scm_make_module (SCM name);
125SCM_API SCM scm_ensure_user_module (SCM name);
126SCM_API SCM scm_load_scheme_module (SCM name);
127
128#define scm_port scm_t_port
129#define scm_ptob_descriptor scm_t_ptob_descriptor
130#define scm_port_rw_active scm_t_port_rw_active
131
132SCM_API SCM scm_close_all_ports_except (SCM ports);
133
97f28fa4
MV
134#define scm_rstate scm_t_rstate
135#define scm_rng scm_t_rng
136
137#define SCM_SLOPPY_CONSP(x) ((1 & SCM_CELL_TYPE (x)) == 0)
138#define SCM_SLOPPY_NCONSP(x) (!SCM_SLOPPY_CONSP(x))
139
140#define scm_tc7_ssymbol scm_tc7_symbol
141#define scm_tc7_msymbol scm_tc7_symbol
142#define scm_tcs_symbols scm_tc7_symbol
143
965445d4
MV
144SCM_API SCM scm_makstr (size_t len, int);
145SCM_API SCM scm_makfromstr (const char *src, size_t len, int);
146
147SCM_API SCM scm_variable_set_name_hint (SCM var, SCM hint);
148SCM_API SCM scm_builtin_variable (SCM name);
149
150SCM_API SCM scm_internal_with_fluids (SCM fluids, SCM vals,
151 SCM (*cproc)(void *), void *cdata);
152
153SCM_API SCM scm_make_gsubr (const char *name, int req, int opt, int rst,
154 SCM (*fcn)());
155SCM_API SCM scm_make_gsubr_with_generic (const char *name,
156 int req,
157 int opt,
158 int rst,
159 SCM (*fcn)(),
160 SCM *gf);
161
162extern SCM scm_create_hook (const char* name, int n_args);
163
164#define SCM_LIST0 SCM_EOL
165#define SCM_LIST1(e0) scm_cons ((e0), SCM_EOL)
166#define SCM_LIST2(e0, e1) scm_cons2 ((e0), (e1), SCM_EOL)
167#define SCM_LIST3(e0, e1, e2) scm_cons ((e0), SCM_LIST2 ((e1), (e2)))
168#define SCM_LIST4(e0, e1, e2, e3)\
169 scm_cons2 ((e0), (e1), SCM_LIST2 ((e2), (e3)))
170#define SCM_LIST5(e0, e1, e2, e3, e4)\
171 scm_cons ((e0), SCM_LIST4 ((e1), (e2), (e3), (e4)))
172#define SCM_LIST6(e0, e1, e2, e3, e4, e5)\
173 scm_cons2 ((e0), (e1), SCM_LIST4 ((e2), (e3), (e4), (e5)))
174#define SCM_LIST7(e0, e1, e2, e3, e4, e5, e6)\
175 scm_cons ((e0), SCM_LIST6 ((e1), (e2), (e3), (e4), (e5), (e6)))
176#define SCM_LIST8(e0, e1, e2, e3, e4, e5, e6, e7)\
177 scm_cons2 ((e0), (e1), SCM_LIST6 ((e2), (e3), (e4), (e5), (e6), (e7)))
178#define SCM_LIST9(e0, e1, e2, e3, e4, e5, e6, e7, e8)\
179 scm_cons ((e0),\
180 SCM_LIST8 ((e1), (e2), (e3), (e4), (e5), (e6), (e7), (e8)))
181
182#define scm_listify scm_list_n
183
184SCM_API SCM scm_sloppy_memq (SCM x, SCM lst);
185SCM_API SCM scm_sloppy_memv (SCM x, SCM lst);
186SCM_API SCM scm_sloppy_member (SCM x, SCM lst);
187
188SCM_API SCM scm_read_and_eval_x (SCM port);
189
4abecea8
MV
190#define scm_subr_entry scm_t_subr_entry
191
192#define SCM_SUBR_DOC(x) SCM_BOOL_F
193
194SCM_API SCM scm_make_subr (const char *name, int type, SCM (*fcn) ());
195SCM_API SCM scm_make_subr_with_generic (const char *name,
196 int type,
197 SCM (*fcn) (),
198 SCM *gf);
199SCM_API SCM scm_make_subr_opt (const char *name,
200 int type,
201 SCM (*fcn) (),
202 int set);
203
204SCM_API SCM scm_call_catching_errors (SCM (*thunk)(), SCM (*err_filter)(),
205 void * closure);
206
207SCM_API long scm_make_smob_type_mfpe (char *name, size_t size,
208 SCM (*mark) (SCM),
209 size_t (*free) (SCM),
210 int (*print) (SCM, SCM,
211 scm_print_state*),
212 SCM (*equalp) (SCM, SCM));
213
214SCM_API void scm_set_smob_mfpe (long tc,
215 SCM (*mark) (SCM),
216 size_t (*free) (SCM),
217 int (*print) (SCM, SCM, scm_print_state*),
218 SCM (*equalp) (SCM, SCM));
219
220SCM_API SCM scm_strprint_obj (SCM obj);
221SCM_API SCM scm_read_0str (char *expr);
222SCM_API SCM scm_eval_0str (const char *expr);
223
224SCM_API char *scm_i_object_chars (SCM);
225
226#define SCM_CHARS(x) scm_i_object_chars(x)
227#define SCM_UCHARS(x) ((unsigned char *)SCM_CHARS(x))
228
229SCM_API long scm_i_object_length (SCM);
230
231#define SCM_LENGTH(x) scm_i_object_length(x)
232
cc5c1b66
MV
233#define scm_strhash(str, len, n) (scm_string_hash ((str), (len)) % (n))
234
235SCM_API SCM scm_sym2ovcell_soft (SCM sym, SCM obarray);
236SCM_API SCM scm_sym2ovcell (SCM sym, SCM obarray);
237SCM_API SCM scm_intern_obarray_soft (const char *name, size_t len,
238 SCM obarray, unsigned int softness);
239SCM_API SCM scm_intern_obarray (const char *name, size_t len, SCM obarray);
240SCM_API SCM scm_symbol_value0 (const char *name);
241
242SCM_API SCM scm_string_to_obarray_symbol (SCM o, SCM s, SCM softp);
243SCM_API SCM scm_intern_symbol (SCM o, SCM s);
244SCM_API SCM scm_unintern_symbol (SCM o, SCM s);
245SCM_API SCM scm_symbol_binding (SCM o, SCM s);
246#if 0
247/* This name has been reused for real uninterned symbols. */
248SCM_API SCM scm_symbol_interned_p (SCM o, SCM s);
249#endif
250SCM_API SCM scm_symbol_bound_p (SCM o, SCM s);
251SCM_API SCM scm_symbol_set_x (SCM o, SCM s, SCM v);
252
253SCM_API SCM scm_gentemp (SCM prefix, SCM obarray);
254
8de7acbd
MV
255#define SCM_OPDIRP(x) (SCM_DIRP (x) && (SCM_DIR_OPEN_P (x)))
256#define scm_fport scm_t_fport
257#define scm_option scm_t_option
258#define scm_srcprops scm_t_srcprops
259#define scm_srcprops_chunk scm_t_srcprops_chunk
260#define scm_info_frame scm_t_info_frame
261#define scm_stack scm_t_stack
262#define scm_array scm_t_array
263#define scm_array_dim scm_t_array_dim
264#define SCM_ARRAY_CONTIGUOUS SCM_ARRAY_FLAG_CONTIGUOUS
265#define SCM_FUNC_NAME (scm_makfrom0str (FUNC_NAME))
266
267#define SCM_WTA(pos, scm) \
268 do { scm_wta (scm, (char *) pos, FUNC_NAME); } while (0)
269
270#define RETURN_SCM_WTA(pos, scm) \
271 do { return scm_wta (scm, (char *) pos, FUNC_NAME); } while (0)
272
273#define SCM_VALIDATE_NUMBER_COPY(pos, z, cvar) \
274 do { \
275 if (SCM_INUMP (z)) \
276 cvar = (double) SCM_INUM (z); \
277 else if (SCM_REALP (z)) \
278 cvar = SCM_REAL_VALUE (z); \
279 else if (SCM_BIGP (z)) \
280 cvar = scm_i_big2dbl (z); \
281 else \
282 { \
283 cvar = 0.0; \
284 SCM_WRONG_TYPE_ARG (pos, z); \
285 } \
286 } while (0)
287
288#define SCM_VALIDATE_NUMBER_DEF_COPY(pos, number, def, cvar) \
289 do { \
290 if (SCM_UNBNDP (number)) \
291 cvar = def; \
292 else \
293 SCM_VALIDATE_NUMBER_COPY(pos, number, cvar); \
294 } while (0)
295
296#define SCM_VALIDATE_OPDIR(pos, port) SCM_MAKE_VALIDATE (pos, port, OPDIRP)
297
55d30fac 298void scm_i_init_deprecated (void);
19e2247d 299
55d30fac 300#endif
19e2247d 301
55d30fac 302#endif /* SCM_DEPRECATED_H */