Use `SCM_DEPRECATED' in declarations of deprecated functions/variables.
[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
f86f3b5b 8/* Copyright (C) 2003,2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
19e2247d 9 *
73be1d9e 10 * This library is free software; you can redistribute it and/or
53befeb7
NJ
11 * modify it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation; either version 3 of
13 * the License, or (at your option) any later version.
19e2247d 14 *
53befeb7
NJ
15 * This library is distributed in the hope that it will be useful, but
16 * 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
53befeb7
NJ
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 * 02110-1301 USA
73be1d9e 24 */
19e2247d
MV
25
26#include "libguile/__scm.h"
2a610be5 27#include "libguile/arrays.h"
55d30fac 28#include "libguile/strings.h"
19e2247d
MV
29
30#if (SCM_ENABLE_DEPRECATED == 1)
31
7e6e6b37
DH
32/* From eval.h: Macros for handling ilocs. These were deprecated in guile
33 * 1.7.0 on 2004-04-22. */
34#define SCM_IFRINC (0x00000100L)
35#define SCM_ICDR (0x00080000L)
36#define SCM_IFRAME(n) ((long)((SCM_ICDR-SCM_IFRINC)>>8) \
37 & (SCM_UNPACK (n) >> 8))
38#define SCM_IDIST(n) (SCM_UNPACK (n) >> 20)
39#define SCM_ICDRP(n) (SCM_ICDR & SCM_UNPACK (n))
40
41
42/* From tags.h: Macros to access internal symbol names of isyms. Deprecated
43 * in guile 1.7.0 on 2004-04-22. */
44SCM_API char *scm_isymnames[];
45#define SCM_ISYMNUM(n) 0
46#define SCM_ISYMCHARS(n) "#@<deprecated>"
47
48
f03314f9
DH
49/* From tags.h: Macro checking for two tc16 types that are allocated to differ
50 * only in the 's'-bit. Deprecated in guile 1.7.0 on 2003-09-21. */
51#define SCM_TYP16S(x) (0xfeff & SCM_CELL_TYPE (x))
52
53
0d5e3480
DH
54/* From numbers.h: Macros checking for types, but avoiding a redundant check
55 * for !SCM_IMP. These were deprecated in guile 1.7.0 on 2003-09-06. */
56#define SCM_SLOPPY_INEXACTP(x) (SCM_TYP16S (x) == scm_tc16_real)
57#define SCM_SLOPPY_REALP(x) (SCM_TYP16 (x) == scm_tc16_real)
58#define SCM_SLOPPY_COMPLEXP(x) (SCM_TYP16 (x) == scm_tc16_complex)
59
60
d0624e39
DH
61/* From eval.h: Macros for handling ilocs. These were deprecated in guile
62 * 1.7.0 on 2003-06-04. */
63#define SCM_ILOC00 SCM_MAKE_ITAG8(0L, scm_tc8_iloc)
64#define SCM_IDINC (0x00100000L)
65#define SCM_IDSTMSK (-SCM_IDINC)
66
67
e90c3a89
DH
68/* From eval.h: Error messages of the evaluator. These were deprecated in
69 * guile 1.7.0 on 2003-06-02. */
0eb934f1
LC
70SCM_DEPRECATED const char scm_s_expression[];
71SCM_DEPRECATED const char scm_s_test[];
72SCM_DEPRECATED const char scm_s_body[];
73SCM_DEPRECATED const char scm_s_bindings[];
74SCM_DEPRECATED const char scm_s_variable[];
75SCM_DEPRECATED const char scm_s_clauses[];
76SCM_DEPRECATED const char scm_s_formals[];
e90c3a89
DH
77
78
79/* From eval.h: Helper macros for evaluation and application. These were
80 * deprecated in guile 1.7.0 on 2003-06-02. */
81#define SCM_EVALIM2(x) \
2ad58b2a 82 ((scm_is_eq ((x), SCM_EOL) \
e90c3a89
DH
83 ? scm_misc_error (NULL, scm_s_expression, SCM_EOL), 0 \
84 : 0), \
85 (x))
86#define SCM_EVALIM(x, env) (SCM_ILOCP (x) \
87 ? *scm_ilookup ((x), env) \
88 : SCM_EVALIM2(x))
434f2f7a
DH
89#define SCM_XEVAL(x, env) (scm_i_eval_x ((x), (env)))
90#define SCM_XEVALCAR(x, env) (SCM_SYMBOLP (SCM_CAR (x)) \
91 ? *scm_lookupcar (x, env, 1) \
92 : scm_i_eval_x (SCM_CAR (x), (env)))
e90c3a89
DH
93
94
19e2247d
MV
95#define scm_substring_move_left_x scm_substring_move_x
96#define scm_substring_move_right_x scm_substring_move_x
97
55d30fac 98#define scm_sizet size_t
19e2247d 99
0eb934f1 100SCM_DEPRECATED SCM scm_wta (SCM arg, const char *pos, const char *s_subr);
19e2247d 101
55d30fac
MV
102#define SCM_WNA 8
103#define SCM_OUTOFRANGE 10
104#define SCM_NALLOC 11
19e2247d 105
0eb934f1
LC
106SCM_DEPRECATED void scm_register_module_xxx (char *module_name, void *init_func);
107SCM_DEPRECATED SCM scm_registered_modules (void);
108SCM_DEPRECATED SCM scm_clear_registered_modules (void);
19e2247d 109
0eb934f1
LC
110SCM_DEPRECATED SCM scm_protect_object (SCM obj);
111SCM_DEPRECATED SCM scm_unprotect_object (SCM obj);
a0454d72
MV
112
113#define SCM_SETAND_CAR(x, y) \
114 (SCM_SETCAR ((x), SCM_PACK (SCM_UNPACK (SCM_CAR (x)) & (y))))
115#define SCM_SETOR_CAR(x, y)\
116 (SCM_SETCAR ((x), SCM_PACK (SCM_UNPACK (SCM_CAR (x)) | (y))))
117#define SCM_SETAND_CDR(x, y)\
118 (SCM_SETCDR ((x), SCM_PACK (SCM_UNPACK (SCM_CDR (x)) & (y))))
119#define SCM_SETOR_CDR(x, y)\
120 (SCM_SETCDR ((x), SCM_PACK (SCM_UNPACK (SCM_CDR (x)) | (y))))
f86f3b5b
LC
121#define SCM_FREEP(x) (0)
122#define SCM_NFREEP(x) (1)
7aaf8dc9
MD
123#define SCM_GC8MARKP(x) SCM_GC_MARK_P (x)
124#define SCM_SETGC8MARK(x) SCM_SET_GC_MARK (x)
125#define SCM_CLRGC8MARK(x) SCM_CLEAR_GC_MARK (x)
a0454d72
MV
126#define SCM_GCTYP16(x) SCM_TYP16 (x)
127#define SCM_GCCDR(x) SCM_CDR (x)
0eb934f1 128SCM_DEPRECATED void scm_remember (SCM * ptr);
a0454d72 129
0eb934f1
LC
130SCM_DEPRECATED SCM scm_the_root_module (void);
131SCM_DEPRECATED SCM scm_make_module (SCM name);
132SCM_DEPRECATED SCM scm_ensure_user_module (SCM name);
133SCM_DEPRECATED SCM scm_load_scheme_module (SCM name);
a0454d72
MV
134
135#define scm_port scm_t_port
136#define scm_ptob_descriptor scm_t_ptob_descriptor
137#define scm_port_rw_active scm_t_port_rw_active
138
0eb934f1 139SCM_DEPRECATED SCM scm_close_all_ports_except (SCM ports);
a0454d72 140
97f28fa4
MV
141#define scm_rstate scm_t_rstate
142#define scm_rng scm_t_rng
143
144#define SCM_SLOPPY_CONSP(x) ((1 & SCM_CELL_TYPE (x)) == 0)
145#define SCM_SLOPPY_NCONSP(x) (!SCM_SLOPPY_CONSP(x))
146
147#define scm_tc7_ssymbol scm_tc7_symbol
148#define scm_tc7_msymbol scm_tc7_symbol
149#define scm_tcs_symbols scm_tc7_symbol
150
0eb934f1
LC
151SCM_DEPRECATED SCM scm_makstr (size_t len, int);
152SCM_DEPRECATED SCM scm_makfromstr (const char *src, size_t len, int);
965445d4 153
0eb934f1
LC
154SCM_DEPRECATED SCM scm_variable_set_name_hint (SCM var, SCM hint);
155SCM_DEPRECATED SCM scm_builtin_variable (SCM name);
965445d4 156
0eb934f1
LC
157SCM_DEPRECATED SCM scm_internal_with_fluids (SCM fluids, SCM vals,
158 SCM (*cproc)(void *),
159 void *cdata);
965445d4 160
0eb934f1
LC
161SCM_DEPRECATED SCM scm_make_gsubr (const char *name,
162 int req, int opt, int rst,
163 SCM (*fcn)());
164SCM_DEPRECATED SCM scm_make_gsubr_with_generic (const char *name,
165 int req,
166 int opt,
167 int rst,
168 SCM (*fcn)(),
169 SCM *gf);
965445d4 170
0eb934f1 171SCM_DEPRECATED SCM scm_create_hook (const char* name, int n_args);
965445d4
MV
172
173#define SCM_LIST0 SCM_EOL
174#define SCM_LIST1(e0) scm_cons ((e0), SCM_EOL)
175#define SCM_LIST2(e0, e1) scm_cons2 ((e0), (e1), SCM_EOL)
176#define SCM_LIST3(e0, e1, e2) scm_cons ((e0), SCM_LIST2 ((e1), (e2)))
177#define SCM_LIST4(e0, e1, e2, e3)\
178 scm_cons2 ((e0), (e1), SCM_LIST2 ((e2), (e3)))
179#define SCM_LIST5(e0, e1, e2, e3, e4)\
180 scm_cons ((e0), SCM_LIST4 ((e1), (e2), (e3), (e4)))
181#define SCM_LIST6(e0, e1, e2, e3, e4, e5)\
182 scm_cons2 ((e0), (e1), SCM_LIST4 ((e2), (e3), (e4), (e5)))
183#define SCM_LIST7(e0, e1, e2, e3, e4, e5, e6)\
184 scm_cons ((e0), SCM_LIST6 ((e1), (e2), (e3), (e4), (e5), (e6)))
185#define SCM_LIST8(e0, e1, e2, e3, e4, e5, e6, e7)\
186 scm_cons2 ((e0), (e1), SCM_LIST6 ((e2), (e3), (e4), (e5), (e6), (e7)))
187#define SCM_LIST9(e0, e1, e2, e3, e4, e5, e6, e7, e8)\
188 scm_cons ((e0),\
189 SCM_LIST8 ((e1), (e2), (e3), (e4), (e5), (e6), (e7), (e8)))
190
191#define scm_listify scm_list_n
192
0eb934f1
LC
193SCM_DEPRECATED SCM scm_sloppy_memq (SCM x, SCM lst);
194SCM_DEPRECATED SCM scm_sloppy_memv (SCM x, SCM lst);
195SCM_DEPRECATED SCM scm_sloppy_member (SCM x, SCM lst);
965445d4 196
0eb934f1 197SCM_DEPRECATED SCM scm_read_and_eval_x (SCM port);
965445d4 198
4abecea8
MV
199#define scm_subr_entry scm_t_subr_entry
200
201#define SCM_SUBR_DOC(x) SCM_BOOL_F
202
0eb934f1
LC
203SCM_DEPRECATED SCM scm_make_subr (const char *name, int type, SCM (*fcn) ());
204SCM_DEPRECATED SCM scm_make_subr_with_generic (const char *name,
205 int type,
206 SCM (*fcn) (),
207 SCM *gf);
208SCM_DEPRECATED SCM scm_make_subr_opt (const char *name,
209 int type,
210 SCM (*fcn) (),
211 int set);
4abecea8 212
0eb934f1
LC
213SCM_DEPRECATED SCM scm_call_catching_errors (SCM (*thunk)(), SCM (*err_filter)(),
214 void * closure);
4abecea8 215
0eb934f1
LC
216SCM_DEPRECATED long scm_make_smob_type_mfpe (char *name, size_t size,
217 SCM (*mark) (SCM),
218 size_t (*free) (SCM),
219 int (*print) (SCM, SCM,
220 scm_print_state*),
221 SCM (*equalp) (SCM, SCM));
4abecea8 222
0eb934f1
LC
223SCM_DEPRECATED void scm_set_smob_mfpe (long tc,
224 SCM (*mark) (SCM),
225 size_t (*free) (SCM),
226 int (*print) (SCM, SCM, scm_print_state*),
227 SCM (*equalp) (SCM, SCM));
4abecea8 228
0eb934f1 229SCM_DEPRECATED size_t scm_smob_free (SCM obj);
3051344b 230
0eb934f1
LC
231SCM_DEPRECATED SCM scm_strprint_obj (SCM obj);
232SCM_DEPRECATED SCM scm_read_0str (char *expr);
233SCM_DEPRECATED SCM scm_eval_0str (const char *expr);
4abecea8 234
0eb934f1 235SCM_DEPRECATED char *scm_i_object_chars (SCM);
a725fa95
MV
236
237#define SCM_CHARS(x) scm_i_object_chars(x)
238#define SCM_UCHARS(x) ((unsigned char *)SCM_CHARS(x))
239
0eb934f1 240SCM_DEPRECATED long scm_i_object_length (SCM);
a725fa95
MV
241
242#define SCM_LENGTH(x) scm_i_object_length(x)
243
cc5c1b66
MV
244#define scm_strhash(str, len, n) (scm_string_hash ((str), (len)) % (n))
245
0eb934f1
LC
246SCM_DEPRECATED SCM scm_sym2ovcell_soft (SCM sym, SCM obarray);
247SCM_DEPRECATED SCM scm_sym2ovcell (SCM sym, SCM obarray);
248SCM_DEPRECATED SCM scm_intern_obarray_soft (const char *name, size_t len,
cc5c1b66 249 SCM obarray, unsigned int softness);
0eb934f1
LC
250SCM_DEPRECATED SCM scm_intern_obarray (const char *name, size_t len, SCM obarray);
251SCM_DEPRECATED SCM scm_symbol_value0 (const char *name);
cc5c1b66 252
0eb934f1
LC
253SCM_DEPRECATED SCM scm_string_to_obarray_symbol (SCM o, SCM s, SCM softp);
254SCM_DEPRECATED SCM scm_intern_symbol (SCM o, SCM s);
255SCM_DEPRECATED SCM scm_unintern_symbol (SCM o, SCM s);
256SCM_DEPRECATED SCM scm_symbol_binding (SCM o, SCM s);
cc5c1b66
MV
257#if 0
258/* This name has been reused for real uninterned symbols. */
0eb934f1 259SCM_DEPRECATED SCM scm_symbol_interned_p (SCM o, SCM s);
cc5c1b66 260#endif
0eb934f1
LC
261SCM_DEPRECATED SCM scm_symbol_bound_p (SCM o, SCM s);
262SCM_DEPRECATED SCM scm_symbol_set_x (SCM o, SCM s, SCM v);
cc5c1b66 263
0eb934f1 264SCM_DEPRECATED SCM scm_gentemp (SCM prefix, SCM obarray);
cc5c1b66 265
8de7acbd
MV
266#define SCM_OPDIRP(x) (SCM_DIRP (x) && (SCM_DIR_OPEN_P (x)))
267#define scm_fport scm_t_fport
268#define scm_option scm_t_option
269#define scm_srcprops scm_t_srcprops
270#define scm_srcprops_chunk scm_t_srcprops_chunk
271#define scm_info_frame scm_t_info_frame
272#define scm_stack scm_t_stack
273#define scm_array scm_t_array
274#define scm_array_dim scm_t_array_dim
275#define SCM_ARRAY_CONTIGUOUS SCM_ARRAY_FLAG_CONTIGUOUS
276#define SCM_FUNC_NAME (scm_makfrom0str (FUNC_NAME))
277
278#define SCM_WTA(pos, scm) \
279 do { scm_wta (scm, (char *) pos, FUNC_NAME); } while (0)
280
281#define RETURN_SCM_WTA(pos, scm) \
282 do { return scm_wta (scm, (char *) pos, FUNC_NAME); } while (0)
283
284#define SCM_VALIDATE_NUMBER_COPY(pos, z, cvar) \
285 do { \
3aa13a05
MV
286 if (SCM_I_INUMP (z)) \
287 cvar = (double) SCM_I_INUM (z); \
8de7acbd
MV
288 else if (SCM_REALP (z)) \
289 cvar = SCM_REAL_VALUE (z); \
290 else if (SCM_BIGP (z)) \
291 cvar = scm_i_big2dbl (z); \
292 else \
293 { \
294 cvar = 0.0; \
295 SCM_WRONG_TYPE_ARG (pos, z); \
296 } \
297 } while (0)
298
299#define SCM_VALIDATE_NUMBER_DEF_COPY(pos, number, def, cvar) \
300 do { \
301 if (SCM_UNBNDP (number)) \
302 cvar = def; \
303 else \
304 SCM_VALIDATE_NUMBER_COPY(pos, number, cvar); \
305 } while (0)
306
307#define SCM_VALIDATE_OPDIR(pos, port) SCM_MAKE_VALIDATE (pos, port, OPDIRP)
308
41a2f6fc
MV
309/* Deprecated because we can not safely cast a SCM* to a scm_t_bits*
310 */
311
312#define SCM_CELL_WORD_LOC(x, n) ((scm_t_bits*)SCM_CELL_OBJECT_LOC((x),(n)))
313
8805b77d
MV
314/* Users shouldn't know about INUMs.
315 */
316
0eb934f1
LC
317SCM_DEPRECATED SCM scm_i_makinum (scm_t_signed_bits val);
318SCM_DEPRECATED int scm_i_inump (SCM obj);
319SCM_DEPRECATED scm_t_signed_bits scm_i_inum (SCM obj);
fe78c51a
MV
320
321#define SCM_MAKINUM(x) scm_i_makinum(x)
322#define SCM_INUM(x) scm_i_inum(x)
323#define SCM_INUMP(x) scm_i_inump(x)
324#define SCM_NINUMP(x) (!SCM_INUMP(x))
3aa13a05 325
8805b77d
MV
326#define SCM_VALIDATE_INUM(pos, k) SCM_MAKE_VALIDATE_MSG (pos, k, INUMP, "exact integer")
327
328#define SCM_VALIDATE_INUM_COPY(pos, k, cvar) \
329 do { \
3aa13a05
MV
330 SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
331 cvar = SCM_I_INUM (k); \
8805b77d
MV
332 } while (0)
333
334#define SCM_VALIDATE_BIGINT(pos, k) SCM_MAKE_VALIDATE_MSG (pos, k, BIGP, "bignum")
335
336#define SCM_VALIDATE_INUM_MIN(pos, k, min) \
337 do { \
3aa13a05
MV
338 SCM_ASSERT (SCM_I_INUMP(k), k, pos, FUNC_NAME); \
339 SCM_ASSERT_RANGE (pos, k, (SCM_I_INUM (k) >= min)); \
8805b77d
MV
340 } while (0)
341
342#define SCM_VALIDATE_INUM_MIN_COPY(pos, k, min, cvar) \
343 do { \
3aa13a05
MV
344 SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
345 SCM_ASSERT_RANGE (pos, k, (SCM_I_INUM (k) >= min)); \
8805b77d
MV
346 cvar = SCM_INUM (k); \
347 } while (0)
348
349#define SCM_VALIDATE_INUM_MIN_DEF_COPY(pos, k, min, default, cvar) \
350 do { \
351 if (SCM_UNBNDP (k)) \
352 k = SCM_I_MAKINUM (default); \
3aa13a05
MV
353 SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
354 SCM_ASSERT_RANGE (pos, k, (SCM_I_INUM (k) >= min)); \
8805b77d
MV
355 cvar = SCM_INUM (k); \
356 } while (0)
357
358#define SCM_VALIDATE_INUM_DEF(pos, k, default) \
359 do { \
360 if (SCM_UNBNDP (k)) \
361 k = SCM_I_MAKINUM (default); \
3aa13a05 362 else SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
8805b77d
MV
363 } while (0)
364
365#define SCM_VALIDATE_INUM_DEF_COPY(pos, k, default, cvar) \
366 do { \
367 if (SCM_UNBNDP (k)) \
368 { \
369 k = SCM_I_MAKINUM (default); \
370 cvar = default; \
371 } \
372 else \
373 { \
3aa13a05 374 SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
8805b77d
MV
375 cvar = SCM_INUM (k); \
376 } \
377 } while (0)
378
379/* [low, high) */
380#define SCM_VALIDATE_INUM_RANGE(pos, k, low, high) \
3aa13a05 381 do { SCM_ASSERT(SCM_I_INUMP(k), k, pos, FUNC_NAME); \
8805b77d 382 SCM_ASSERT_RANGE(pos, k, \
3aa13a05
MV
383 (SCM_I_INUM (k) >= low && \
384 SCM_I_INUM (k) < high)); \
8805b77d
MV
385 } while (0)
386
387#define SCM_VALIDATE_INUM_RANGE_COPY(pos, k, low, high, cvar) \
388 do { \
389 SCM_ASSERT (SCM_INUMP (k), k, pos, FUNC_NAME); \
390 SCM_ASSERT_RANGE (pos, k, low <= SCM_INUM (k) && SCM_INUM (k) < high); \
391 cvar = SCM_INUM (k); \
392 } while (0)
393
c829a427
MV
394#define SCM_STRING_COERCE_0TERMINATION_X(x) (x)
395
396/* XXX - buggy interface, STR might not be large enough.
397
398 Converts the given Scheme string OBJ into a C string, containing a copy
399 of OBJ's content with a trailing null byte. If LENP is non-NULL, set
400 *LENP to the string's length.
401
402 When STR is non-NULL it receives the copy and is returned by the function,
403 otherwise new memory is allocated and the caller is responsible for
404 freeing it via free(). If out of memory, NULL is returned.
405
406 Note that Scheme strings may contain arbitrary data, including null
407 characters. This means that null termination is not a reliable way to
408 determine the length of the returned value. However, the function always
409 copies the complete contents of OBJ, and sets *LENP to the length of the
410 scheme string (if LENP is non-null).
411*/
0eb934f1 412SCM_DEPRECATED char *scm_c_string2str (SCM obj, char *str, size_t *lenp);
c829a427
MV
413
414/* XXX - buggy interface, you don't know how many bytes have been copied.
415
416 Copy LEN characters at START from the Scheme string OBJ to memory
417 at STR. START is an index into OBJ; zero means the beginning of
418 the string. STR has already been allocated by the caller.
419
420 If START + LEN is off the end of OBJ, silently truncate the source
421 region to fit the string. If truncation occurs, the corresponding
422 area of STR is left unchanged.
423*/
0eb934f1 424SCM_DEPRECATED char *scm_c_substring2str (SCM obj, char *str, size_t start, size_t len);
8805b77d 425
0eb934f1 426SCM_DEPRECATED char *scm_c_symbol2str (SCM obj, char *str, size_t *lenp);
3ee86942 427
3101f40f
MV
428/* Deprecated because the names belong to what is now
429 scm_truncate_number and scm_round_number.
430*/
0eb934f1
LC
431SCM_DEPRECATED double scm_truncate (double x);
432SCM_DEPRECATED double scm_round (double x);
3101f40f 433
6f14f578
MV
434/* Deprecated because we don't want people to access the internal
435 representation of strings directly.
436*/
437
438#define SCM_VALIDATE_STRING_COPY(pos, str, cvar) \
439 do { \
440 SCM_ASSERT (SCM_STRINGP (str), str, pos, FUNC_NAME); \
441 cvar = SCM_STRING_CHARS(str); \
442 } while (0)
443
444/* validate a string and optional start/end arguments which default to
445 0/string-len. this is unrelated to the old shared substring
446 support, so please do not deprecate it :) */
447#define SCM_VALIDATE_SUBSTRING_SPEC_COPY(pos_str, str, c_str, \
448 pos_start, start, c_start,\
449 pos_end, end, c_end) \
450 do {\
451 SCM_VALIDATE_STRING_COPY (pos_str, str, c_str);\
452 c_start = SCM_UNBNDP(start)? 0 : scm_to_size_t (start);\
453 c_end = SCM_UNBNDP(end)? SCM_STRING_LENGTH(str) : scm_to_size_t (end);\
454 SCM_ASSERT_RANGE (pos_start, start,\
455 0 <= c_start \
456 && (size_t) c_start <= SCM_STRING_LENGTH (str));\
457 SCM_ASSERT_RANGE (pos_end, end,\
458 c_start <= c_end \
459 && (size_t) c_end <= SCM_STRING_LENGTH (str));\
460 } while (0)
461
3ee86942
MV
462/* Deprecated because we don't want people to access the internals of
463 symbols directly.
464*/
465
0eb934f1
LC
466SCM_DEPRECATED char *scm_i_deprecated_symbol_chars (SCM sym);
467SCM_DEPRECATED size_t scm_i_deprecated_symbol_length (SCM sym);
fe78c51a
MV
468
469#define SCM_SYMBOL_CHARS(x) scm_i_deprecated_symbol_chars(x)
470#define SCM_SYMBOL_LENGTH(x) scm_i_deprecated_symbol_length(x)
6f14f578 471
265a7997
MV
472/* Deprecated because the macros used to evaluate the arguments more
473 than once and because the symbol of a keyword now has no dash.
474*/
475
0eb934f1
LC
476SCM_DEPRECATED int scm_i_keywordp (SCM obj);
477SCM_DEPRECATED SCM scm_i_keywordsym (SCM keyword);
fe78c51a
MV
478
479#define SCM_KEYWORDP(x) scm_i_keywordp(x)
480#define SCM_KEYWORDSYM(x) scm_i_keywordsym(x)
265a7997 481
354116f7
MV
482/* Deprecated because we don't want to hand out unprotected pointers
483 to arrays, vectors, etc. */
484
485#define SCM_VECTOR_MAX_LENGTH ((1L << 24) - 1)
486
0eb934f1
LC
487SCM_DEPRECATED int scm_i_vectorp (SCM x);
488SCM_DEPRECATED unsigned long scm_i_vector_length (SCM x);
489SCM_DEPRECATED const SCM *scm_i_velts (SCM x);
490SCM_DEPRECATED SCM *scm_i_writable_velts (SCM x);
491SCM_DEPRECATED SCM scm_i_vector_ref (SCM x, size_t idx);
492SCM_DEPRECATED void scm_i_vector_set (SCM x, size_t idx, SCM val);
493SCM_DEPRECATED SCM scm_vector_equal_p (SCM x, SCM y);
265a7997 494
fe78c51a
MV
495#define SCM_VECTORP(x) scm_i_vectorp(x)
496#define SCM_VECTOR_LENGTH(x) scm_i_vector_length(x)
497#define SCM_VELTS(x) scm_i_velts(x)
498#define SCM_WRITABLE_VELTS(x) scm_i_writable_velts(x)
499#define SCM_VECTOR_REF(x,y) scm_i_vector_ref(x,y)
500#define SCM_VECTOR_SET(x,y,z) scm_i_vector_set(x,y,z)
1f366ef7 501
fe78c51a 502typedef scm_i_t_array scm_t_array;
1f366ef7 503
0eb934f1
LC
504SCM_DEPRECATED int scm_i_arrayp (SCM a);
505SCM_DEPRECATED size_t scm_i_array_ndim (SCM a);
506SCM_DEPRECATED int scm_i_array_contp (SCM a);
507SCM_DEPRECATED scm_t_array *scm_i_array_mem (SCM a);
508SCM_DEPRECATED SCM scm_i_array_v (SCM a);
509SCM_DEPRECATED size_t scm_i_array_base (SCM a);
510SCM_DEPRECATED scm_t_array_dim *scm_i_array_dims (SCM a);
fe78c51a
MV
511
512#define SCM_ARRAYP(a) scm_i_arrayp(a)
513#define SCM_ARRAY_NDIM(a) scm_i_array_ndim(a)
514#define SCM_ARRAY_CONTP(a) scm_i_array_contp(a)
515#define SCM_ARRAY_MEM(a) scm_i_array_mem(a)
516#define SCM_ARRAY_V(a) scm_i_array_v(a)
517#define SCM_ARRAY_BASE(a) scm_i_array_base(a)
9cc49060 518#define SCM_ARRAY_DIMS(a) scm_i_array_dims(a)
1f366ef7 519
9de87eea
MV
520/* Deprecated because they should not be lvalues and we want people to
521 use the official interfaces.
522 */
523
524#define scm_cur_inp scm_i_cur_inp ()
525#define scm_cur_outp scm_i_cur_outp ()
526#define scm_cur_errp scm_i_cur_errp ()
527#define scm_cur_loadp scm_i_cur_loadp ()
528#define scm_progargs scm_i_progargs ()
529#define scm_dynwinds scm_i_deprecated_dynwinds ()
530#define scm_last_debug_frame scm_i_deprecated_last_debug_frame ()
531#define scm_stack_base scm_i_stack_base ()
532
0eb934f1
LC
533SCM_DEPRECATED SCM scm_i_cur_inp (void);
534SCM_DEPRECATED SCM scm_i_cur_outp (void);
535SCM_DEPRECATED SCM scm_i_cur_errp (void);
536SCM_DEPRECATED SCM scm_i_cur_loadp (void);
537SCM_DEPRECATED SCM scm_i_progargs (void);
538SCM_DEPRECATED SCM scm_i_deprecated_dynwinds (void);
539SCM_DEPRECATED scm_t_debug_frame *scm_i_deprecated_last_debug_frame (void);
540SCM_DEPRECATED SCM_STACKITEM *scm_i_stack_base (void);
9de87eea
MV
541
542/* Deprecated because it evaluates its argument twice.
543 */
544#define SCM_FLUIDP(x) scm_i_fluidp (x)
0eb934f1 545SCM_DEPRECATED int scm_i_fluidp (SCM x);
9de87eea 546
06c1d900
MV
547/* In the old days, SCM_CRITICAL_SECTION_START stopped signal handlers
548 from running, since in those days the handler directly ran scheme
549 code, and that had to be avoided when the heap was not in a
550 consistent state etc. And since the scheme code could do a stack
551 swapping new continuation etc, signals had to be deferred around
552 various C library functions which were not safe or not known to be
553 safe to swap away, which was a lot of stuff.
554
555 These days signals are implemented with asyncs and don't directly
556 run scheme code in the handler, but hold it until an SCM_TICK etc
557 where it will be safe. This means interrupt protection is not
558 needed and SCM_CRITICAL_SECTION_START / SCM_CRITICAL_SECTION_END is
559 something of an anachronism.
560
561 What past SCM_CRITICAL_SECTION_START usage also did though was
562 indicate code that was not reentrant, ie. could not be reentered by
563 signal handler code. The present definitions are a mutex lock,
564 affording that reentrancy protection against the new guile 1.8
565 free-running posix threads.
9de87eea
MV
566
567 One big problem with the present defintions though is that code which
568 throws an error from within a DEFER/ALLOW region will leave the
569 defer_mutex locked and hence hang other threads that attempt to enter a
570 similar DEFER/ALLOW region.
571*/
572
0eb934f1 573SCM_DEPRECATED void scm_i_defer_ints_etc (void);
9de87eea
MV
574#define SCM_DEFER_INTS scm_i_defer_ints_etc ()
575#define SCM_ALLOW_INTS scm_i_defer_ints_etc ()
576#define SCM_REDEFER_INTS scm_i_defer_ints_etc ()
577#define SCM_REALLOW_INTS scm_i_defer_ints_etc ()
578
06c1d900
MV
579/* Deprecated since they are unnecessary and had not been documented.
580 */
0eb934f1
LC
581SCM_DEPRECATED SCM scm_guard (SCM guardian, SCM obj, int throw_p);
582SCM_DEPRECATED SCM scm_get_one_zombie (SCM guardian);
06c1d900
MV
583
584/* Deprecated since guardians no longer have these special features.
585 */
0eb934f1
LC
586SCM_DEPRECATED SCM scm_destroy_guardian_x (SCM guardian);
587SCM_DEPRECATED SCM scm_guardian_greedy_p (SCM guardian);
588SCM_DEPRECATED SCM scm_guardian_destroyed_p (SCM guardian);
06c1d900 589
760fb97d
LC
590\f
591/* GC-related things deprecated with the move to BDW-GC starting from 1.9.3
592 (2009-09-15). */
593
0eb934f1
LC
594SCM_DEPRECATED unsigned long scm_mallocated;
595SCM_DEPRECATED unsigned long scm_mtrigger;
760fb97d 596
0eb934f1 597SCM_DEPRECATED size_t scm_max_segment_size;
760fb97d
LC
598
599#if defined (GUILE_DEBUG) || defined (GUILE_DEBUG_FREELIST)
0eb934f1 600SCM_DEPRECATED SCM scm_map_free_list (void);
760fb97d
LC
601#endif
602
603#if defined (GUILE_DEBUG_FREELIST)
0eb934f1 604SCM_DEPRECATED SCM scm_gc_set_debug_check_freelist_x (SCM flag);
760fb97d
LC
605#endif
606
607
608\f
55d30fac 609void scm_i_init_deprecated (void);
19e2247d 610
55d30fac 611#endif
19e2247d 612
55d30fac 613#endif /* SCM_DEPRECATED_H */