fix hash-set! in weak-value table from non-immediate to immediate
[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
79488112 8/* Copyright (C) 2003,2004, 2005, 2006, 2007, 2009, 2010, 2011 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"
55d30fac 27#include "libguile/strings.h"
a3e92377 28#include "libguile/eval.h"
ec16eb78 29#include "libguile/throw.h"
8a4ed2dd 30#include "libguile/iselect.h"
19e2247d
MV
31
32#if (SCM_ENABLE_DEPRECATED == 1)
33
7e6e6b37
DH
34/* From eval.h: Macros for handling ilocs. These were deprecated in guile
35 * 1.7.0 on 2004-04-22. */
36#define SCM_IFRINC (0x00000100L)
37#define SCM_ICDR (0x00080000L)
38#define SCM_IFRAME(n) ((long)((SCM_ICDR-SCM_IFRINC)>>8) \
39 & (SCM_UNPACK (n) >> 8))
40#define SCM_IDIST(n) (SCM_UNPACK (n) >> 20)
41#define SCM_ICDRP(n) (SCM_ICDR & SCM_UNPACK (n))
42
43
44/* From tags.h: Macros to access internal symbol names of isyms. Deprecated
45 * in guile 1.7.0 on 2004-04-22. */
46SCM_API char *scm_isymnames[];
47#define SCM_ISYMNUM(n) 0
48#define SCM_ISYMCHARS(n) "#@<deprecated>"
49
50
f03314f9
DH
51/* From tags.h: Macro checking for two tc16 types that are allocated to differ
52 * only in the 's'-bit. Deprecated in guile 1.7.0 on 2003-09-21. */
53#define SCM_TYP16S(x) (0xfeff & SCM_CELL_TYPE (x))
54
55
0d5e3480
DH
56/* From numbers.h: Macros checking for types, but avoiding a redundant check
57 * for !SCM_IMP. These were deprecated in guile 1.7.0 on 2003-09-06. */
58#define SCM_SLOPPY_INEXACTP(x) (SCM_TYP16S (x) == scm_tc16_real)
59#define SCM_SLOPPY_REALP(x) (SCM_TYP16 (x) == scm_tc16_real)
60#define SCM_SLOPPY_COMPLEXP(x) (SCM_TYP16 (x) == scm_tc16_complex)
61
62
b6cf4d02
AW
63/* From structs.h:
64 Deprecated in Guile 1.9.5 on 2009-11-03. */
65#define scm_vtable_index_vtable scm_vtable_index_self
66#define scm_vtable_index_printer scm_vtable_index_instance_printer
67#define scm_struct_i_free scm_vtable_index_instance_finalize
68#define scm_struct_i_flags scm_vtable_index_flags
69#define SCM_STRUCTF_MASK ((scm_t_bits)-1)
70#define SCM_SET_VTABLE_DESTRUCTOR(X, D) (SCM_STRUCT_DATA(x)[scm_struct_i_free]=(scm_t_bits)(D))
71
19e2247d
MV
72#define scm_substring_move_left_x scm_substring_move_x
73#define scm_substring_move_right_x scm_substring_move_x
74
55d30fac 75#define scm_sizet size_t
19e2247d 76
0eb934f1 77SCM_DEPRECATED SCM scm_wta (SCM arg, const char *pos, const char *s_subr);
19e2247d 78
55d30fac
MV
79#define SCM_WNA 8
80#define SCM_OUTOFRANGE 10
81#define SCM_NALLOC 11
19e2247d 82
0eb934f1
LC
83SCM_DEPRECATED void scm_register_module_xxx (char *module_name, void *init_func);
84SCM_DEPRECATED SCM scm_registered_modules (void);
85SCM_DEPRECATED SCM scm_clear_registered_modules (void);
19e2247d 86
0eb934f1
LC
87SCM_DEPRECATED SCM scm_protect_object (SCM obj);
88SCM_DEPRECATED SCM scm_unprotect_object (SCM obj);
a0454d72
MV
89
90#define SCM_SETAND_CAR(x, y) \
91 (SCM_SETCAR ((x), SCM_PACK (SCM_UNPACK (SCM_CAR (x)) & (y))))
92#define SCM_SETOR_CAR(x, y)\
93 (SCM_SETCAR ((x), SCM_PACK (SCM_UNPACK (SCM_CAR (x)) | (y))))
94#define SCM_SETAND_CDR(x, y)\
95 (SCM_SETCDR ((x), SCM_PACK (SCM_UNPACK (SCM_CDR (x)) & (y))))
96#define SCM_SETOR_CDR(x, y)\
97 (SCM_SETCDR ((x), SCM_PACK (SCM_UNPACK (SCM_CDR (x)) | (y))))
f86f3b5b
LC
98#define SCM_FREEP(x) (0)
99#define SCM_NFREEP(x) (1)
a0454d72
MV
100#define SCM_GCTYP16(x) SCM_TYP16 (x)
101#define SCM_GCCDR(x) SCM_CDR (x)
0eb934f1 102SCM_DEPRECATED void scm_remember (SCM * ptr);
a0454d72 103
0eb934f1
LC
104SCM_DEPRECATED SCM scm_make_module (SCM name);
105SCM_DEPRECATED SCM scm_ensure_user_module (SCM name);
106SCM_DEPRECATED SCM scm_load_scheme_module (SCM name);
a0454d72
MV
107
108#define scm_port scm_t_port
109#define scm_ptob_descriptor scm_t_ptob_descriptor
110#define scm_port_rw_active scm_t_port_rw_active
111
0eb934f1 112SCM_DEPRECATED SCM scm_close_all_ports_except (SCM ports);
a0454d72 113
97f28fa4
MV
114#define scm_rstate scm_t_rstate
115#define scm_rng scm_t_rng
116
117#define SCM_SLOPPY_CONSP(x) ((1 & SCM_CELL_TYPE (x)) == 0)
118#define SCM_SLOPPY_NCONSP(x) (!SCM_SLOPPY_CONSP(x))
119
120#define scm_tc7_ssymbol scm_tc7_symbol
121#define scm_tc7_msymbol scm_tc7_symbol
122#define scm_tcs_symbols scm_tc7_symbol
123
0eb934f1
LC
124SCM_DEPRECATED SCM scm_makstr (size_t len, int);
125SCM_DEPRECATED SCM scm_makfromstr (const char *src, size_t len, int);
965445d4 126
0eb934f1
LC
127SCM_DEPRECATED SCM scm_variable_set_name_hint (SCM var, SCM hint);
128SCM_DEPRECATED SCM scm_builtin_variable (SCM name);
965445d4 129
0eb934f1
LC
130SCM_DEPRECATED SCM scm_internal_with_fluids (SCM fluids, SCM vals,
131 SCM (*cproc)(void *),
132 void *cdata);
965445d4 133
0eb934f1
LC
134SCM_DEPRECATED SCM scm_make_gsubr (const char *name,
135 int req, int opt, int rst,
be90d0b6 136 scm_t_subr fcn);
0eb934f1
LC
137SCM_DEPRECATED SCM scm_make_gsubr_with_generic (const char *name,
138 int req,
139 int opt,
140 int rst,
be90d0b6 141 scm_t_subr fcn,
0eb934f1 142 SCM *gf);
965445d4 143
0eb934f1 144SCM_DEPRECATED SCM scm_create_hook (const char* name, int n_args);
965445d4
MV
145
146#define SCM_LIST0 SCM_EOL
147#define SCM_LIST1(e0) scm_cons ((e0), SCM_EOL)
148#define SCM_LIST2(e0, e1) scm_cons2 ((e0), (e1), SCM_EOL)
149#define SCM_LIST3(e0, e1, e2) scm_cons ((e0), SCM_LIST2 ((e1), (e2)))
150#define SCM_LIST4(e0, e1, e2, e3)\
151 scm_cons2 ((e0), (e1), SCM_LIST2 ((e2), (e3)))
152#define SCM_LIST5(e0, e1, e2, e3, e4)\
153 scm_cons ((e0), SCM_LIST4 ((e1), (e2), (e3), (e4)))
154#define SCM_LIST6(e0, e1, e2, e3, e4, e5)\
155 scm_cons2 ((e0), (e1), SCM_LIST4 ((e2), (e3), (e4), (e5)))
156#define SCM_LIST7(e0, e1, e2, e3, e4, e5, e6)\
157 scm_cons ((e0), SCM_LIST6 ((e1), (e2), (e3), (e4), (e5), (e6)))
158#define SCM_LIST8(e0, e1, e2, e3, e4, e5, e6, e7)\
159 scm_cons2 ((e0), (e1), SCM_LIST6 ((e2), (e3), (e4), (e5), (e6), (e7)))
160#define SCM_LIST9(e0, e1, e2, e3, e4, e5, e6, e7, e8)\
161 scm_cons ((e0),\
162 SCM_LIST8 ((e1), (e2), (e3), (e4), (e5), (e6), (e7), (e8)))
163
164#define scm_listify scm_list_n
165
0eb934f1
LC
166SCM_DEPRECATED SCM scm_sloppy_memq (SCM x, SCM lst);
167SCM_DEPRECATED SCM scm_sloppy_memv (SCM x, SCM lst);
168SCM_DEPRECATED SCM scm_sloppy_member (SCM x, SCM lst);
965445d4 169
0eb934f1 170SCM_DEPRECATED SCM scm_read_and_eval_x (SCM port);
965445d4 171
4abecea8
MV
172#define scm_subr_entry scm_t_subr_entry
173
174#define SCM_SUBR_DOC(x) SCM_BOOL_F
175
be90d0b6
LC
176SCM_DEPRECATED SCM scm_call_catching_errors (scm_t_subr thunk,
177 scm_t_subr err_filter,
0eb934f1 178 void * closure);
4abecea8 179
0eb934f1
LC
180SCM_DEPRECATED long scm_make_smob_type_mfpe (char *name, size_t size,
181 SCM (*mark) (SCM),
182 size_t (*free) (SCM),
183 int (*print) (SCM, SCM,
184 scm_print_state*),
185 SCM (*equalp) (SCM, SCM));
4abecea8 186
0eb934f1
LC
187SCM_DEPRECATED void scm_set_smob_mfpe (long tc,
188 SCM (*mark) (SCM),
189 size_t (*free) (SCM),
190 int (*print) (SCM, SCM, scm_print_state*),
191 SCM (*equalp) (SCM, SCM));
4abecea8 192
0eb934f1 193SCM_DEPRECATED size_t scm_smob_free (SCM obj);
3051344b 194
0eb934f1
LC
195SCM_DEPRECATED SCM scm_strprint_obj (SCM obj);
196SCM_DEPRECATED SCM scm_read_0str (char *expr);
197SCM_DEPRECATED SCM scm_eval_0str (const char *expr);
4abecea8 198
0eb934f1 199SCM_DEPRECATED char *scm_i_object_chars (SCM);
a725fa95
MV
200
201#define SCM_CHARS(x) scm_i_object_chars(x)
202#define SCM_UCHARS(x) ((unsigned char *)SCM_CHARS(x))
203
0eb934f1 204SCM_DEPRECATED long scm_i_object_length (SCM);
a725fa95
MV
205
206#define SCM_LENGTH(x) scm_i_object_length(x)
207
cc5c1b66
MV
208#define scm_strhash(str, len, n) (scm_string_hash ((str), (len)) % (n))
209
0eb934f1
LC
210SCM_DEPRECATED SCM scm_sym2ovcell_soft (SCM sym, SCM obarray);
211SCM_DEPRECATED SCM scm_sym2ovcell (SCM sym, SCM obarray);
212SCM_DEPRECATED SCM scm_intern_obarray_soft (const char *name, size_t len,
cc5c1b66 213 SCM obarray, unsigned int softness);
0eb934f1
LC
214SCM_DEPRECATED SCM scm_intern_obarray (const char *name, size_t len, SCM obarray);
215SCM_DEPRECATED SCM scm_symbol_value0 (const char *name);
cc5c1b66 216
0eb934f1
LC
217SCM_DEPRECATED SCM scm_string_to_obarray_symbol (SCM o, SCM s, SCM softp);
218SCM_DEPRECATED SCM scm_intern_symbol (SCM o, SCM s);
219SCM_DEPRECATED SCM scm_unintern_symbol (SCM o, SCM s);
220SCM_DEPRECATED SCM scm_symbol_binding (SCM o, SCM s);
cc5c1b66
MV
221#if 0
222/* This name has been reused for real uninterned symbols. */
0eb934f1 223SCM_DEPRECATED SCM scm_symbol_interned_p (SCM o, SCM s);
cc5c1b66 224#endif
0eb934f1
LC
225SCM_DEPRECATED SCM scm_symbol_bound_p (SCM o, SCM s);
226SCM_DEPRECATED SCM scm_symbol_set_x (SCM o, SCM s, SCM v);
cc5c1b66 227
0eb934f1 228SCM_DEPRECATED SCM scm_gentemp (SCM prefix, SCM obarray);
cc5c1b66 229
8de7acbd
MV
230#define SCM_OPDIRP(x) (SCM_DIRP (x) && (SCM_DIR_OPEN_P (x)))
231#define scm_fport scm_t_fport
232#define scm_option scm_t_option
233#define scm_srcprops scm_t_srcprops
234#define scm_srcprops_chunk scm_t_srcprops_chunk
8de7acbd
MV
235#define scm_array scm_t_array
236#define scm_array_dim scm_t_array_dim
8de7acbd
MV
237#define SCM_FUNC_NAME (scm_makfrom0str (FUNC_NAME))
238
239#define SCM_WTA(pos, scm) \
240 do { scm_wta (scm, (char *) pos, FUNC_NAME); } while (0)
241
242#define RETURN_SCM_WTA(pos, scm) \
243 do { return scm_wta (scm, (char *) pos, FUNC_NAME); } while (0)
244
245#define SCM_VALIDATE_NUMBER_COPY(pos, z, cvar) \
246 do { \
3aa13a05
MV
247 if (SCM_I_INUMP (z)) \
248 cvar = (double) SCM_I_INUM (z); \
8de7acbd
MV
249 else if (SCM_REALP (z)) \
250 cvar = SCM_REAL_VALUE (z); \
251 else if (SCM_BIGP (z)) \
252 cvar = scm_i_big2dbl (z); \
253 else \
254 { \
255 cvar = 0.0; \
256 SCM_WRONG_TYPE_ARG (pos, z); \
257 } \
258 } while (0)
259
260#define SCM_VALIDATE_NUMBER_DEF_COPY(pos, number, def, cvar) \
261 do { \
262 if (SCM_UNBNDP (number)) \
263 cvar = def; \
264 else \
265 SCM_VALIDATE_NUMBER_COPY(pos, number, cvar); \
266 } while (0)
267
268#define SCM_VALIDATE_OPDIR(pos, port) SCM_MAKE_VALIDATE (pos, port, OPDIRP)
269
41a2f6fc
MV
270/* Deprecated because we can not safely cast a SCM* to a scm_t_bits*
271 */
272
273#define SCM_CELL_WORD_LOC(x, n) ((scm_t_bits*)SCM_CELL_OBJECT_LOC((x),(n)))
274
8805b77d
MV
275/* Users shouldn't know about INUMs.
276 */
277
0eb934f1
LC
278SCM_DEPRECATED SCM scm_i_makinum (scm_t_signed_bits val);
279SCM_DEPRECATED int scm_i_inump (SCM obj);
280SCM_DEPRECATED scm_t_signed_bits scm_i_inum (SCM obj);
fe78c51a
MV
281
282#define SCM_MAKINUM(x) scm_i_makinum(x)
283#define SCM_INUM(x) scm_i_inum(x)
284#define SCM_INUMP(x) scm_i_inump(x)
285#define SCM_NINUMP(x) (!SCM_INUMP(x))
3aa13a05 286
8805b77d
MV
287#define SCM_VALIDATE_INUM(pos, k) SCM_MAKE_VALIDATE_MSG (pos, k, INUMP, "exact integer")
288
289#define SCM_VALIDATE_INUM_COPY(pos, k, cvar) \
290 do { \
3aa13a05
MV
291 SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
292 cvar = SCM_I_INUM (k); \
8805b77d
MV
293 } while (0)
294
295#define SCM_VALIDATE_BIGINT(pos, k) SCM_MAKE_VALIDATE_MSG (pos, k, BIGP, "bignum")
296
297#define SCM_VALIDATE_INUM_MIN(pos, k, min) \
298 do { \
3aa13a05
MV
299 SCM_ASSERT (SCM_I_INUMP(k), k, pos, FUNC_NAME); \
300 SCM_ASSERT_RANGE (pos, k, (SCM_I_INUM (k) >= min)); \
8805b77d
MV
301 } while (0)
302
303#define SCM_VALIDATE_INUM_MIN_COPY(pos, k, min, cvar) \
304 do { \
3aa13a05
MV
305 SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
306 SCM_ASSERT_RANGE (pos, k, (SCM_I_INUM (k) >= min)); \
8805b77d
MV
307 cvar = SCM_INUM (k); \
308 } while (0)
309
310#define SCM_VALIDATE_INUM_MIN_DEF_COPY(pos, k, min, default, cvar) \
311 do { \
312 if (SCM_UNBNDP (k)) \
313 k = SCM_I_MAKINUM (default); \
3aa13a05
MV
314 SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
315 SCM_ASSERT_RANGE (pos, k, (SCM_I_INUM (k) >= min)); \
8805b77d
MV
316 cvar = SCM_INUM (k); \
317 } while (0)
318
319#define SCM_VALIDATE_INUM_DEF(pos, k, default) \
320 do { \
321 if (SCM_UNBNDP (k)) \
322 k = SCM_I_MAKINUM (default); \
3aa13a05 323 else SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
8805b77d
MV
324 } while (0)
325
326#define SCM_VALIDATE_INUM_DEF_COPY(pos, k, default, cvar) \
327 do { \
328 if (SCM_UNBNDP (k)) \
329 { \
330 k = SCM_I_MAKINUM (default); \
331 cvar = default; \
332 } \
333 else \
334 { \
3aa13a05 335 SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
8805b77d
MV
336 cvar = SCM_INUM (k); \
337 } \
338 } while (0)
339
340/* [low, high) */
341#define SCM_VALIDATE_INUM_RANGE(pos, k, low, high) \
3aa13a05 342 do { SCM_ASSERT(SCM_I_INUMP(k), k, pos, FUNC_NAME); \
8805b77d 343 SCM_ASSERT_RANGE(pos, k, \
3aa13a05
MV
344 (SCM_I_INUM (k) >= low && \
345 SCM_I_INUM (k) < high)); \
8805b77d
MV
346 } while (0)
347
348#define SCM_VALIDATE_INUM_RANGE_COPY(pos, k, low, high, cvar) \
349 do { \
350 SCM_ASSERT (SCM_INUMP (k), k, pos, FUNC_NAME); \
351 SCM_ASSERT_RANGE (pos, k, low <= SCM_INUM (k) && SCM_INUM (k) < high); \
352 cvar = SCM_INUM (k); \
353 } while (0)
354
c829a427
MV
355#define SCM_STRING_COERCE_0TERMINATION_X(x) (x)
356
357/* XXX - buggy interface, STR might not be large enough.
358
359 Converts the given Scheme string OBJ into a C string, containing a copy
360 of OBJ's content with a trailing null byte. If LENP is non-NULL, set
361 *LENP to the string's length.
362
363 When STR is non-NULL it receives the copy and is returned by the function,
364 otherwise new memory is allocated and the caller is responsible for
365 freeing it via free(). If out of memory, NULL is returned.
366
367 Note that Scheme strings may contain arbitrary data, including null
368 characters. This means that null termination is not a reliable way to
369 determine the length of the returned value. However, the function always
370 copies the complete contents of OBJ, and sets *LENP to the length of the
371 scheme string (if LENP is non-null).
372*/
0eb934f1 373SCM_DEPRECATED char *scm_c_string2str (SCM obj, char *str, size_t *lenp);
c829a427
MV
374
375/* XXX - buggy interface, you don't know how many bytes have been copied.
376
377 Copy LEN characters at START from the Scheme string OBJ to memory
378 at STR. START is an index into OBJ; zero means the beginning of
379 the string. STR has already been allocated by the caller.
380
381 If START + LEN is off the end of OBJ, silently truncate the source
382 region to fit the string. If truncation occurs, the corresponding
383 area of STR is left unchanged.
384*/
0eb934f1 385SCM_DEPRECATED char *scm_c_substring2str (SCM obj, char *str, size_t start, size_t len);
8805b77d 386
0eb934f1 387SCM_DEPRECATED char *scm_c_symbol2str (SCM obj, char *str, size_t *lenp);
3ee86942 388
3101f40f
MV
389/* Deprecated because the names belong to what is now
390 scm_truncate_number and scm_round_number.
391*/
0eb934f1
LC
392SCM_DEPRECATED double scm_truncate (double x);
393SCM_DEPRECATED double scm_round (double x);
6fc4d012
AW
394/* Deprecated, use scm_expt */
395SCM_DEPRECATED SCM scm_sys_expt (SCM x, SCM y);
3101f40f 396
ad79736c
AW
397/* if your platform doesn't have asinh et al */
398SCM_API double scm_asinh (double x);
399SCM_API double scm_acosh (double x);
400SCM_API double scm_atanh (double x);
401SCM_API SCM scm_sys_atan2 (SCM z1, SCM z2);
402
6f14f578
MV
403/* Deprecated because we don't want people to access the internal
404 representation of strings directly.
405*/
406
407#define SCM_VALIDATE_STRING_COPY(pos, str, cvar) \
408 do { \
409 SCM_ASSERT (SCM_STRINGP (str), str, pos, FUNC_NAME); \
410 cvar = SCM_STRING_CHARS(str); \
411 } while (0)
412
413/* validate a string and optional start/end arguments which default to
414 0/string-len. this is unrelated to the old shared substring
415 support, so please do not deprecate it :) */
416#define SCM_VALIDATE_SUBSTRING_SPEC_COPY(pos_str, str, c_str, \
417 pos_start, start, c_start,\
418 pos_end, end, c_end) \
419 do {\
420 SCM_VALIDATE_STRING_COPY (pos_str, str, c_str);\
421 c_start = SCM_UNBNDP(start)? 0 : scm_to_size_t (start);\
422 c_end = SCM_UNBNDP(end)? SCM_STRING_LENGTH(str) : scm_to_size_t (end);\
423 SCM_ASSERT_RANGE (pos_start, start,\
424 0 <= c_start \
425 && (size_t) c_start <= SCM_STRING_LENGTH (str));\
426 SCM_ASSERT_RANGE (pos_end, end,\
427 c_start <= c_end \
428 && (size_t) c_end <= SCM_STRING_LENGTH (str));\
429 } while (0)
430
3ee86942
MV
431/* Deprecated because we don't want people to access the internals of
432 symbols directly.
433*/
434
0eb934f1
LC
435SCM_DEPRECATED char *scm_i_deprecated_symbol_chars (SCM sym);
436SCM_DEPRECATED size_t scm_i_deprecated_symbol_length (SCM sym);
fe78c51a
MV
437
438#define SCM_SYMBOL_CHARS(x) scm_i_deprecated_symbol_chars(x)
439#define SCM_SYMBOL_LENGTH(x) scm_i_deprecated_symbol_length(x)
6f14f578 440
265a7997
MV
441/* Deprecated because the macros used to evaluate the arguments more
442 than once and because the symbol of a keyword now has no dash.
443*/
444
0eb934f1
LC
445SCM_DEPRECATED int scm_i_keywordp (SCM obj);
446SCM_DEPRECATED SCM scm_i_keywordsym (SCM keyword);
fe78c51a
MV
447
448#define SCM_KEYWORDP(x) scm_i_keywordp(x)
449#define SCM_KEYWORDSYM(x) scm_i_keywordsym(x)
265a7997 450
354116f7
MV
451/* Deprecated because we don't want to hand out unprotected pointers
452 to arrays, vectors, etc. */
453
454#define SCM_VECTOR_MAX_LENGTH ((1L << 24) - 1)
455
0eb934f1
LC
456SCM_DEPRECATED int scm_i_vectorp (SCM x);
457SCM_DEPRECATED unsigned long scm_i_vector_length (SCM x);
458SCM_DEPRECATED const SCM *scm_i_velts (SCM x);
459SCM_DEPRECATED SCM *scm_i_writable_velts (SCM x);
460SCM_DEPRECATED SCM scm_i_vector_ref (SCM x, size_t idx);
461SCM_DEPRECATED void scm_i_vector_set (SCM x, size_t idx, SCM val);
462SCM_DEPRECATED SCM scm_vector_equal_p (SCM x, SCM y);
265a7997 463
fe78c51a
MV
464#define SCM_VECTORP(x) scm_i_vectorp(x)
465#define SCM_VECTOR_LENGTH(x) scm_i_vector_length(x)
466#define SCM_VELTS(x) scm_i_velts(x)
467#define SCM_WRITABLE_VELTS(x) scm_i_writable_velts(x)
468#define SCM_VECTOR_REF(x,y) scm_i_vector_ref(x,y)
469#define SCM_VECTOR_SET(x,y,z) scm_i_vector_set(x,y,z)
1f366ef7 470
fe78c51a 471typedef scm_i_t_array scm_t_array;
1f366ef7 472
0eb934f1
LC
473SCM_DEPRECATED int scm_i_arrayp (SCM a);
474SCM_DEPRECATED size_t scm_i_array_ndim (SCM a);
475SCM_DEPRECATED int scm_i_array_contp (SCM a);
476SCM_DEPRECATED scm_t_array *scm_i_array_mem (SCM a);
477SCM_DEPRECATED SCM scm_i_array_v (SCM a);
478SCM_DEPRECATED size_t scm_i_array_base (SCM a);
479SCM_DEPRECATED scm_t_array_dim *scm_i_array_dims (SCM a);
fe78c51a
MV
480
481#define SCM_ARRAYP(a) scm_i_arrayp(a)
482#define SCM_ARRAY_NDIM(a) scm_i_array_ndim(a)
483#define SCM_ARRAY_CONTP(a) scm_i_array_contp(a)
484#define SCM_ARRAY_MEM(a) scm_i_array_mem(a)
485#define SCM_ARRAY_V(a) scm_i_array_v(a)
486#define SCM_ARRAY_BASE(a) scm_i_array_base(a)
9cc49060 487#define SCM_ARRAY_DIMS(a) scm_i_array_dims(a)
1f366ef7 488
73d1aaaf
LC
489SCM_DEPRECATED SCM scm_uniform_vector_read_x (SCM v, SCM port_or_fd,
490 SCM start, SCM end);
491SCM_DEPRECATED SCM scm_uniform_vector_write (SCM v, SCM port_or_fd,
492 SCM start, SCM end);
493SCM_DEPRECATED SCM scm_uniform_array_read_x (SCM ra, SCM port_or_fd,
494 SCM start, SCM end);
495SCM_DEPRECATED SCM scm_uniform_array_write (SCM v, SCM port_or_fd,
496 SCM start, SCM end);
a2689737 497
9de87eea
MV
498/* Deprecated because they should not be lvalues and we want people to
499 use the official interfaces.
500 */
501
502#define scm_cur_inp scm_i_cur_inp ()
503#define scm_cur_outp scm_i_cur_outp ()
504#define scm_cur_errp scm_i_cur_errp ()
505#define scm_cur_loadp scm_i_cur_loadp ()
506#define scm_progargs scm_i_progargs ()
507#define scm_dynwinds scm_i_deprecated_dynwinds ()
9de87eea
MV
508#define scm_stack_base scm_i_stack_base ()
509
0eb934f1
LC
510SCM_DEPRECATED SCM scm_i_cur_inp (void);
511SCM_DEPRECATED SCM scm_i_cur_outp (void);
512SCM_DEPRECATED SCM scm_i_cur_errp (void);
513SCM_DEPRECATED SCM scm_i_cur_loadp (void);
514SCM_DEPRECATED SCM scm_i_progargs (void);
515SCM_DEPRECATED SCM scm_i_deprecated_dynwinds (void);
0eb934f1 516SCM_DEPRECATED SCM_STACKITEM *scm_i_stack_base (void);
9de87eea
MV
517
518/* Deprecated because it evaluates its argument twice.
519 */
520#define SCM_FLUIDP(x) scm_i_fluidp (x)
0eb934f1 521SCM_DEPRECATED int scm_i_fluidp (SCM x);
9de87eea 522
3452e666
LC
523/* Deprecated in Guile 1.9.5 on 2009-11-15 because these are IPv4-only
524 functions which are deprecated upstream. */
525
526SCM_DEPRECATED SCM scm_inet_aton (SCM address);
527SCM_DEPRECATED SCM scm_inet_ntoa (SCM inetid);
528
06c1d900
MV
529/* In the old days, SCM_CRITICAL_SECTION_START stopped signal handlers
530 from running, since in those days the handler directly ran scheme
531 code, and that had to be avoided when the heap was not in a
532 consistent state etc. And since the scheme code could do a stack
533 swapping new continuation etc, signals had to be deferred around
534 various C library functions which were not safe or not known to be
535 safe to swap away, which was a lot of stuff.
536
537 These days signals are implemented with asyncs and don't directly
538 run scheme code in the handler, but hold it until an SCM_TICK etc
539 where it will be safe. This means interrupt protection is not
540 needed and SCM_CRITICAL_SECTION_START / SCM_CRITICAL_SECTION_END is
541 something of an anachronism.
542
543 What past SCM_CRITICAL_SECTION_START usage also did though was
544 indicate code that was not reentrant, ie. could not be reentered by
545 signal handler code. The present definitions are a mutex lock,
546 affording that reentrancy protection against the new guile 1.8
547 free-running posix threads.
9de87eea
MV
548
549 One big problem with the present defintions though is that code which
550 throws an error from within a DEFER/ALLOW region will leave the
551 defer_mutex locked and hence hang other threads that attempt to enter a
552 similar DEFER/ALLOW region.
553*/
554
0eb934f1 555SCM_DEPRECATED void scm_i_defer_ints_etc (void);
9de87eea
MV
556#define SCM_DEFER_INTS scm_i_defer_ints_etc ()
557#define SCM_ALLOW_INTS scm_i_defer_ints_etc ()
558#define SCM_REDEFER_INTS scm_i_defer_ints_etc ()
559#define SCM_REALLOW_INTS scm_i_defer_ints_etc ()
560
b8ec9dab
LC
561/* In the old days (pre-1.8), this macro was sometimes used as an lvalue as
562 in "scm_mask_ints = 1" to block async execution. It no longer works. */
563#define scm_mask_ints (scm_i_mask_ints ())
564
565SCM_DEPRECATED int scm_i_mask_ints (void);
566
06c1d900
MV
567/* Deprecated since they are unnecessary and had not been documented.
568 */
0eb934f1
LC
569SCM_DEPRECATED SCM scm_guard (SCM guardian, SCM obj, int throw_p);
570SCM_DEPRECATED SCM scm_get_one_zombie (SCM guardian);
06c1d900
MV
571
572/* Deprecated since guardians no longer have these special features.
573 */
0eb934f1
LC
574SCM_DEPRECATED SCM scm_destroy_guardian_x (SCM guardian);
575SCM_DEPRECATED SCM scm_guardian_greedy_p (SCM guardian);
576SCM_DEPRECATED SCM scm_guardian_destroyed_p (SCM guardian);
06c1d900 577
760fb97d
LC
578\f
579/* GC-related things deprecated with the move to BDW-GC starting from 1.9.3
580 (2009-09-15). */
581
0eb934f1
LC
582SCM_DEPRECATED unsigned long scm_mallocated;
583SCM_DEPRECATED unsigned long scm_mtrigger;
760fb97d 584
0eb934f1 585SCM_DEPRECATED size_t scm_max_segment_size;
760fb97d
LC
586
587#if defined (GUILE_DEBUG) || defined (GUILE_DEBUG_FREELIST)
0eb934f1 588SCM_DEPRECATED SCM scm_map_free_list (void);
760fb97d
LC
589#endif
590
591#if defined (GUILE_DEBUG_FREELIST)
0eb934f1 592SCM_DEPRECATED SCM scm_gc_set_debug_check_freelist_x (SCM flag);
760fb97d
LC
593#endif
594
a3e92377
AW
595\f
596
597/* Deprecated 2009-11-27, scm_call_N is sufficient */
598SCM_DEPRECATED scm_t_trampoline_0 scm_trampoline_0 (SCM proc);
599SCM_DEPRECATED scm_t_trampoline_1 scm_trampoline_1 (SCM proc);
600SCM_DEPRECATED scm_t_trampoline_2 scm_trampoline_2 (SCM proc);
760fb97d
LC
601
602\f
ea68d342
AW
603
604/* Deprecated 2009-12-06, use the procedures instead */
605#define SCM_PROCEDURE_WITH_SETTER_P(obj) (scm_is_true (scm_procedure_with_setter_p (obj)))
606#define SCM_PROCEDURE(obj) SCM_STRUCT_PROCEDURE (obj, 0)
607#define SCM_SETTER(obj) SCM_STRUCT_SETTER (obj, 1)
608
609\f
610
9fdf9fd3 611/* Deprecated 2010-01-05, use SCM_PRIMITIVE_P instead */
97812f4d
AW
612SCM_DEPRECATED int scm_i_subr_p (SCM x);
613#define scm_subr_p(x) (scm_i_subr_p (x))
9fdf9fd3
AW
614
615\f
616
e10cf6b9
AW
617/* Deprecated 2010-01-31, use with-throw-handler instead */
618SCM_DEPRECATED SCM scm_lazy_catch (SCM tag, SCM thunk, SCM handler);
619SCM_DEPRECATED SCM scm_internal_lazy_catch (SCM tag,
620 scm_t_catch_body body,
621 void *body_data,
622 scm_t_catch_handler handler,
623 void *handler_data);
624
625\f
626
a587d6a9
AW
627/* Deprecated 2010-03-31, use array-equal? instead */
628SCM_DEPRECATED SCM scm_raequal (SCM ra0, SCM ra1);
629
43cd9cec
AW
630/* Deprecated 2010-04-01, use the dynamic FFI instead */
631SCM_DEPRECATED SCM scm_dynamic_args_call (SCM symb, SCM dobj, SCM args);
632
cc00f447
AW
633/* Deprecated 2010-05-12, no replacement */
634SCM_DEPRECATED int scm_badargsp (SCM formals, SCM args);
635
ec16eb78
AW
636/* Deprecated 2010-06-19, use call-with-error-handling instead */
637SCM_DEPRECATED SCM scm_internal_stack_catch (SCM tag,
638 scm_t_catch_body body,
639 void *body_data,
640 scm_t_catch_handler handler,
641 void *handler_data);
642
a587d6a9
AW
643\f
644
220058a8
AW
645/* These functions were "discouraged" in 1.8, and now are deprecated. */
646
647/* scm_to_int, scm_from_int are the official functions to do the job,
648 but there is nothing wrong with using scm_num2int, etc.
649
650 These could be trivially defined via macros, but we leave them as
651 functions since existing code may take their addresses.
652*/
653
654SCM_DEPRECATED SCM scm_short2num (short n);
655SCM_DEPRECATED SCM scm_ushort2num (unsigned short n);
656SCM_DEPRECATED SCM scm_int2num (int n);
657SCM_DEPRECATED SCM scm_uint2num (unsigned int n);
658SCM_DEPRECATED SCM scm_long2num (long n);
659SCM_DEPRECATED SCM scm_ulong2num (unsigned long n);
660SCM_DEPRECATED SCM scm_size2num (size_t n);
661SCM_DEPRECATED SCM scm_ptrdiff2num (scm_t_ptrdiff n);
662SCM_DEPRECATED short scm_num2short (SCM num, unsigned long int pos,
663 const char *s_caller);
664SCM_DEPRECATED unsigned short scm_num2ushort (SCM num, unsigned long int pos,
665 const char *s_caller);
666SCM_DEPRECATED int scm_num2int (SCM num, unsigned long int pos,
667 const char *s_caller);
668SCM_DEPRECATED unsigned int scm_num2uint (SCM num, unsigned long int pos,
669 const char *s_caller);
670SCM_DEPRECATED long scm_num2long (SCM num, unsigned long int pos,
671 const char *s_caller);
672SCM_DEPRECATED unsigned long scm_num2ulong (SCM num, unsigned long int pos,
673 const char *s_caller);
674SCM_DEPRECATED scm_t_ptrdiff scm_num2ptrdiff (SCM num, unsigned long int pos,
675 const char *s_caller);
676SCM_DEPRECATED size_t scm_num2size (SCM num, unsigned long int pos,
677 const char *s_caller);
678#if SCM_SIZEOF_LONG_LONG != 0
679SCM_DEPRECATED SCM scm_long_long2num (long long sl);
680SCM_DEPRECATED SCM scm_ulong_long2num (unsigned long long sl);
681SCM_DEPRECATED long long scm_num2long_long (SCM num, unsigned long int pos,
682 const char *s_caller);
683SCM_DEPRECATED unsigned long long scm_num2ulong_long (SCM num, unsigned long int pos,
684 const char *s_caller);
685#endif
686
687SCM_DEPRECATED SCM scm_make_real (double x);
688SCM_DEPRECATED double scm_num2dbl (SCM a, const char * why);
689SCM_DEPRECATED SCM scm_float2num (float n);
690SCM_DEPRECATED SCM scm_double2num (double n);
691
692/* The next two are implemented in numbers.c since they use features
693 only available there.
694*/
695SCM_DEPRECATED float scm_num2float (SCM num, unsigned long int pos,
696 const char *s_caller);
697SCM_DEPRECATED double scm_num2double (SCM num, unsigned long int pos,
698 const char *s_caller);
699
700SCM_DEPRECATED SCM scm_make_complex (double x, double y);
701
702/* Discouraged because they don't make the encoding explicit.
703 */
704
705SCM_DEPRECATED SCM scm_mem2symbol (const char *mem, size_t len);
706SCM_DEPRECATED SCM scm_mem2uninterned_symbol (const char *mem, size_t len);
707SCM_DEPRECATED SCM scm_str2symbol (const char *str);
708
709SCM_DEPRECATED SCM scm_take_str (char *s, size_t len);
710SCM_DEPRECATED SCM scm_take0str (char *s);
711SCM_DEPRECATED SCM scm_mem2string (const char *src, size_t len);
712SCM_DEPRECATED SCM scm_str2string (const char *src);
713SCM_DEPRECATED SCM scm_makfrom0str (const char *src);
714SCM_DEPRECATED SCM scm_makfrom0str_opt (const char *src);
715
716/* Discouraged because scm_c_make_string has a better name and is more
717 consistent with make-string.
718 */
719SCM_DEPRECATED SCM scm_allocate_string (size_t len);
720
721/* Discouraged because they are just strange.
722 */
723
724SCM_DEPRECATED SCM scm_make_keyword_from_dash_symbol (SCM symbol);
725SCM_DEPRECATED SCM scm_keyword_dash_symbol (SCM keyword);
726
727/* Discouraged because it does not state what encoding S is in.
728 */
729
730SCM_DEPRECATED SCM scm_c_make_keyword (const char *s);
731
8a4ed2dd
AW
732SCM_DEPRECATED unsigned int scm_thread_sleep (unsigned int);
733SCM_DEPRECATED unsigned long scm_thread_usleep (unsigned long);
734SCM_DEPRECATED int scm_internal_select (int fds,
735 SELECT_TYPE *rfds,
736 SELECT_TYPE *wfds,
737 SELECT_TYPE *efds,
738 struct timeval *timeout);
220058a8 739\f
cd28785f
AW
740/* Deprecated because the cuserid call is deprecated.
741 */
79488112
AW
742SCM_DEPRECATED SCM scm_cuserid (void);
743
744\f
745
746/* Deprecated because it's yet another property interface.
747 */
748SCM_DEPRECATED SCM scm_primitive_make_property (SCM not_found_proc);
749SCM_DEPRECATED SCM scm_primitive_property_ref (SCM prop, SCM obj);
750SCM_DEPRECATED SCM scm_primitive_property_set_x (SCM prop, SCM obj, SCM val);
751SCM_DEPRECATED SCM scm_primitive_property_del_x (SCM prop, SCM obj);
cd28785f
AW
752
753\f
220058a8 754
55d30fac 755void scm_i_init_deprecated (void);
19e2247d 756
55d30fac 757#endif
19e2247d 758
55d30fac 759#endif /* SCM_DEPRECATED_H */