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