Optimize 'string-hash'.
[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
b9b88351 8/* Copyright (C) 2003,2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013, 2014 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 145
b2feee6b
AW
146
147/* Deprecated 13-05-2011 because it's better just to scm_dynwind_begin.
148 That also avoids the temptation to stuff pointers in an SCM. */
149
150typedef SCM (*scm_t_inner) (void *);
151SCM_DEPRECATED SCM scm_internal_dynamic_wind (scm_t_guard before,
152 scm_t_inner inner,
153 scm_t_guard after,
154 void *inner_data,
155 void *guard_data);
156
965445d4
MV
157#define SCM_LIST0 SCM_EOL
158#define SCM_LIST1(e0) scm_cons ((e0), SCM_EOL)
159#define SCM_LIST2(e0, e1) scm_cons2 ((e0), (e1), SCM_EOL)
160#define SCM_LIST3(e0, e1, e2) scm_cons ((e0), SCM_LIST2 ((e1), (e2)))
161#define SCM_LIST4(e0, e1, e2, e3)\
162 scm_cons2 ((e0), (e1), SCM_LIST2 ((e2), (e3)))
163#define SCM_LIST5(e0, e1, e2, e3, e4)\
164 scm_cons ((e0), SCM_LIST4 ((e1), (e2), (e3), (e4)))
165#define SCM_LIST6(e0, e1, e2, e3, e4, e5)\
166 scm_cons2 ((e0), (e1), SCM_LIST4 ((e2), (e3), (e4), (e5)))
167#define SCM_LIST7(e0, e1, e2, e3, e4, e5, e6)\
168 scm_cons ((e0), SCM_LIST6 ((e1), (e2), (e3), (e4), (e5), (e6)))
169#define SCM_LIST8(e0, e1, e2, e3, e4, e5, e6, e7)\
170 scm_cons2 ((e0), (e1), SCM_LIST6 ((e2), (e3), (e4), (e5), (e6), (e7)))
171#define SCM_LIST9(e0, e1, e2, e3, e4, e5, e6, e7, e8)\
172 scm_cons ((e0),\
173 SCM_LIST8 ((e1), (e2), (e3), (e4), (e5), (e6), (e7), (e8)))
174
175#define scm_listify scm_list_n
176
0eb934f1
LC
177SCM_DEPRECATED SCM scm_sloppy_memq (SCM x, SCM lst);
178SCM_DEPRECATED SCM scm_sloppy_memv (SCM x, SCM lst);
179SCM_DEPRECATED SCM scm_sloppy_member (SCM x, SCM lst);
965445d4 180
0eb934f1 181SCM_DEPRECATED SCM scm_read_and_eval_x (SCM port);
965445d4 182
4abecea8
MV
183#define scm_subr_entry scm_t_subr_entry
184
185#define SCM_SUBR_DOC(x) SCM_BOOL_F
186
be90d0b6
LC
187SCM_DEPRECATED SCM scm_call_catching_errors (scm_t_subr thunk,
188 scm_t_subr err_filter,
0eb934f1 189 void * closure);
4abecea8 190
0eb934f1
LC
191SCM_DEPRECATED long scm_make_smob_type_mfpe (char *name, size_t size,
192 SCM (*mark) (SCM),
193 size_t (*free) (SCM),
194 int (*print) (SCM, SCM,
195 scm_print_state*),
196 SCM (*equalp) (SCM, SCM));
4abecea8 197
0eb934f1
LC
198SCM_DEPRECATED void scm_set_smob_mfpe (long tc,
199 SCM (*mark) (SCM),
200 size_t (*free) (SCM),
201 int (*print) (SCM, SCM, scm_print_state*),
202 SCM (*equalp) (SCM, SCM));
4abecea8 203
0eb934f1 204SCM_DEPRECATED size_t scm_smob_free (SCM obj);
3051344b 205
0eb934f1
LC
206SCM_DEPRECATED SCM scm_strprint_obj (SCM obj);
207SCM_DEPRECATED SCM scm_read_0str (char *expr);
208SCM_DEPRECATED SCM scm_eval_0str (const char *expr);
4abecea8 209
0eb934f1 210SCM_DEPRECATED char *scm_i_object_chars (SCM);
a725fa95
MV
211
212#define SCM_CHARS(x) scm_i_object_chars(x)
213#define SCM_UCHARS(x) ((unsigned char *)SCM_CHARS(x))
214
0eb934f1 215SCM_DEPRECATED long scm_i_object_length (SCM);
a725fa95
MV
216
217#define SCM_LENGTH(x) scm_i_object_length(x)
218
cc5c1b66
MV
219#define scm_strhash(str, len, n) (scm_string_hash ((str), (len)) % (n))
220
0eb934f1
LC
221SCM_DEPRECATED SCM scm_sym2ovcell_soft (SCM sym, SCM obarray);
222SCM_DEPRECATED SCM scm_sym2ovcell (SCM sym, SCM obarray);
223SCM_DEPRECATED SCM scm_intern_obarray_soft (const char *name, size_t len,
cc5c1b66 224 SCM obarray, unsigned int softness);
0eb934f1
LC
225SCM_DEPRECATED SCM scm_intern_obarray (const char *name, size_t len, SCM obarray);
226SCM_DEPRECATED SCM scm_symbol_value0 (const char *name);
cc5c1b66 227
0eb934f1
LC
228SCM_DEPRECATED SCM scm_string_to_obarray_symbol (SCM o, SCM s, SCM softp);
229SCM_DEPRECATED SCM scm_intern_symbol (SCM o, SCM s);
230SCM_DEPRECATED SCM scm_unintern_symbol (SCM o, SCM s);
231SCM_DEPRECATED SCM scm_symbol_binding (SCM o, SCM s);
cc5c1b66
MV
232#if 0
233/* This name has been reused for real uninterned symbols. */
0eb934f1 234SCM_DEPRECATED SCM scm_symbol_interned_p (SCM o, SCM s);
cc5c1b66 235#endif
0eb934f1
LC
236SCM_DEPRECATED SCM scm_symbol_bound_p (SCM o, SCM s);
237SCM_DEPRECATED SCM scm_symbol_set_x (SCM o, SCM s, SCM v);
cc5c1b66 238
0eb934f1 239SCM_DEPRECATED SCM scm_gentemp (SCM prefix, SCM obarray);
cc5c1b66 240
8de7acbd
MV
241#define SCM_OPDIRP(x) (SCM_DIRP (x) && (SCM_DIR_OPEN_P (x)))
242#define scm_fport scm_t_fport
243#define scm_option scm_t_option
244#define scm_srcprops scm_t_srcprops
245#define scm_srcprops_chunk scm_t_srcprops_chunk
8de7acbd
MV
246#define scm_array scm_t_array
247#define scm_array_dim scm_t_array_dim
8de7acbd
MV
248#define SCM_FUNC_NAME (scm_makfrom0str (FUNC_NAME))
249
250#define SCM_WTA(pos, scm) \
251 do { scm_wta (scm, (char *) pos, FUNC_NAME); } while (0)
252
253#define RETURN_SCM_WTA(pos, scm) \
254 do { return scm_wta (scm, (char *) pos, FUNC_NAME); } while (0)
255
256#define SCM_VALIDATE_NUMBER_COPY(pos, z, cvar) \
257 do { \
3aa13a05
MV
258 if (SCM_I_INUMP (z)) \
259 cvar = (double) SCM_I_INUM (z); \
8de7acbd
MV
260 else if (SCM_REALP (z)) \
261 cvar = SCM_REAL_VALUE (z); \
262 else if (SCM_BIGP (z)) \
263 cvar = scm_i_big2dbl (z); \
264 else \
265 { \
266 cvar = 0.0; \
267 SCM_WRONG_TYPE_ARG (pos, z); \
268 } \
269 } while (0)
270
271#define SCM_VALIDATE_NUMBER_DEF_COPY(pos, number, def, cvar) \
272 do { \
273 if (SCM_UNBNDP (number)) \
274 cvar = def; \
275 else \
276 SCM_VALIDATE_NUMBER_COPY(pos, number, cvar); \
277 } while (0)
278
279#define SCM_VALIDATE_OPDIR(pos, port) SCM_MAKE_VALIDATE (pos, port, OPDIRP)
280
41a2f6fc
MV
281/* Deprecated because we can not safely cast a SCM* to a scm_t_bits*
282 */
283
284#define SCM_CELL_WORD_LOC(x, n) ((scm_t_bits*)SCM_CELL_OBJECT_LOC((x),(n)))
285
8805b77d
MV
286/* Users shouldn't know about INUMs.
287 */
288
0eb934f1
LC
289SCM_DEPRECATED SCM scm_i_makinum (scm_t_signed_bits val);
290SCM_DEPRECATED int scm_i_inump (SCM obj);
291SCM_DEPRECATED scm_t_signed_bits scm_i_inum (SCM obj);
fe78c51a
MV
292
293#define SCM_MAKINUM(x) scm_i_makinum(x)
294#define SCM_INUM(x) scm_i_inum(x)
295#define SCM_INUMP(x) scm_i_inump(x)
296#define SCM_NINUMP(x) (!SCM_INUMP(x))
3aa13a05 297
8805b77d
MV
298#define SCM_VALIDATE_INUM(pos, k) SCM_MAKE_VALIDATE_MSG (pos, k, INUMP, "exact integer")
299
300#define SCM_VALIDATE_INUM_COPY(pos, k, cvar) \
301 do { \
3aa13a05
MV
302 SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
303 cvar = SCM_I_INUM (k); \
8805b77d
MV
304 } while (0)
305
306#define SCM_VALIDATE_BIGINT(pos, k) SCM_MAKE_VALIDATE_MSG (pos, k, BIGP, "bignum")
307
308#define SCM_VALIDATE_INUM_MIN(pos, k, min) \
309 do { \
3aa13a05
MV
310 SCM_ASSERT (SCM_I_INUMP(k), k, pos, FUNC_NAME); \
311 SCM_ASSERT_RANGE (pos, k, (SCM_I_INUM (k) >= min)); \
8805b77d
MV
312 } while (0)
313
314#define SCM_VALIDATE_INUM_MIN_COPY(pos, k, min, cvar) \
315 do { \
3aa13a05
MV
316 SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
317 SCM_ASSERT_RANGE (pos, k, (SCM_I_INUM (k) >= min)); \
8805b77d
MV
318 cvar = SCM_INUM (k); \
319 } while (0)
320
321#define SCM_VALIDATE_INUM_MIN_DEF_COPY(pos, k, min, default, cvar) \
322 do { \
323 if (SCM_UNBNDP (k)) \
324 k = SCM_I_MAKINUM (default); \
3aa13a05
MV
325 SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
326 SCM_ASSERT_RANGE (pos, k, (SCM_I_INUM (k) >= min)); \
8805b77d
MV
327 cvar = SCM_INUM (k); \
328 } while (0)
329
330#define SCM_VALIDATE_INUM_DEF(pos, k, default) \
331 do { \
332 if (SCM_UNBNDP (k)) \
333 k = SCM_I_MAKINUM (default); \
3aa13a05 334 else SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
8805b77d
MV
335 } while (0)
336
337#define SCM_VALIDATE_INUM_DEF_COPY(pos, k, default, cvar) \
338 do { \
339 if (SCM_UNBNDP (k)) \
340 { \
341 k = SCM_I_MAKINUM (default); \
342 cvar = default; \
343 } \
344 else \
345 { \
3aa13a05 346 SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
8805b77d
MV
347 cvar = SCM_INUM (k); \
348 } \
349 } while (0)
350
351/* [low, high) */
352#define SCM_VALIDATE_INUM_RANGE(pos, k, low, high) \
3aa13a05 353 do { SCM_ASSERT(SCM_I_INUMP(k), k, pos, FUNC_NAME); \
8805b77d 354 SCM_ASSERT_RANGE(pos, k, \
3aa13a05
MV
355 (SCM_I_INUM (k) >= low && \
356 SCM_I_INUM (k) < high)); \
8805b77d
MV
357 } while (0)
358
359#define SCM_VALIDATE_INUM_RANGE_COPY(pos, k, low, high, cvar) \
360 do { \
361 SCM_ASSERT (SCM_INUMP (k), k, pos, FUNC_NAME); \
362 SCM_ASSERT_RANGE (pos, k, low <= SCM_INUM (k) && SCM_INUM (k) < high); \
363 cvar = SCM_INUM (k); \
364 } while (0)
365
c829a427
MV
366#define SCM_STRING_COERCE_0TERMINATION_X(x) (x)
367
368/* XXX - buggy interface, STR might not be large enough.
369
370 Converts the given Scheme string OBJ into a C string, containing a copy
371 of OBJ's content with a trailing null byte. If LENP is non-NULL, set
372 *LENP to the string's length.
373
374 When STR is non-NULL it receives the copy and is returned by the function,
375 otherwise new memory is allocated and the caller is responsible for
376 freeing it via free(). If out of memory, NULL is returned.
377
378 Note that Scheme strings may contain arbitrary data, including null
379 characters. This means that null termination is not a reliable way to
380 determine the length of the returned value. However, the function always
381 copies the complete contents of OBJ, and sets *LENP to the length of the
382 scheme string (if LENP is non-null).
383*/
0eb934f1 384SCM_DEPRECATED char *scm_c_string2str (SCM obj, char *str, size_t *lenp);
c829a427
MV
385
386/* XXX - buggy interface, you don't know how many bytes have been copied.
387
388 Copy LEN characters at START from the Scheme string OBJ to memory
389 at STR. START is an index into OBJ; zero means the beginning of
390 the string. STR has already been allocated by the caller.
391
392 If START + LEN is off the end of OBJ, silently truncate the source
393 region to fit the string. If truncation occurs, the corresponding
394 area of STR is left unchanged.
395*/
0eb934f1 396SCM_DEPRECATED char *scm_c_substring2str (SCM obj, char *str, size_t start, size_t len);
8805b77d 397
0eb934f1 398SCM_DEPRECATED char *scm_c_symbol2str (SCM obj, char *str, size_t *lenp);
3ee86942 399
3101f40f
MV
400/* Deprecated because the names belong to what is now
401 scm_truncate_number and scm_round_number.
402*/
0eb934f1
LC
403SCM_DEPRECATED double scm_truncate (double x);
404SCM_DEPRECATED double scm_round (double x);
6fc4d012
AW
405/* Deprecated, use scm_expt */
406SCM_DEPRECATED SCM scm_sys_expt (SCM x, SCM y);
3101f40f 407
ad79736c 408/* if your platform doesn't have asinh et al */
b5070556
AW
409SCM_DEPRECATED double scm_asinh (double x);
410SCM_DEPRECATED double scm_acosh (double x);
411SCM_DEPRECATED double scm_atanh (double x);
412SCM_DEPRECATED SCM scm_sys_atan2 (SCM z1, SCM z2);
ad79736c 413
6f14f578
MV
414/* Deprecated because we don't want people to access the internal
415 representation of strings directly.
416*/
417
418#define SCM_VALIDATE_STRING_COPY(pos, str, cvar) \
419 do { \
420 SCM_ASSERT (SCM_STRINGP (str), str, pos, FUNC_NAME); \
421 cvar = SCM_STRING_CHARS(str); \
422 } while (0)
423
424/* validate a string and optional start/end arguments which default to
425 0/string-len. this is unrelated to the old shared substring
426 support, so please do not deprecate it :) */
427#define SCM_VALIDATE_SUBSTRING_SPEC_COPY(pos_str, str, c_str, \
428 pos_start, start, c_start,\
429 pos_end, end, c_end) \
430 do {\
431 SCM_VALIDATE_STRING_COPY (pos_str, str, c_str);\
432 c_start = SCM_UNBNDP(start)? 0 : scm_to_size_t (start);\
433 c_end = SCM_UNBNDP(end)? SCM_STRING_LENGTH(str) : scm_to_size_t (end);\
434 SCM_ASSERT_RANGE (pos_start, start,\
435 0 <= c_start \
436 && (size_t) c_start <= SCM_STRING_LENGTH (str));\
437 SCM_ASSERT_RANGE (pos_end, end,\
438 c_start <= c_end \
439 && (size_t) c_end <= SCM_STRING_LENGTH (str));\
440 } while (0)
441
3ee86942
MV
442/* Deprecated because we don't want people to access the internals of
443 symbols directly.
444*/
445
0eb934f1
LC
446SCM_DEPRECATED char *scm_i_deprecated_symbol_chars (SCM sym);
447SCM_DEPRECATED size_t scm_i_deprecated_symbol_length (SCM sym);
fe78c51a
MV
448
449#define SCM_SYMBOL_CHARS(x) scm_i_deprecated_symbol_chars(x)
450#define SCM_SYMBOL_LENGTH(x) scm_i_deprecated_symbol_length(x)
6f14f578 451
265a7997
MV
452/* Deprecated because the macros used to evaluate the arguments more
453 than once and because the symbol of a keyword now has no dash.
454*/
455
0eb934f1
LC
456SCM_DEPRECATED int scm_i_keywordp (SCM obj);
457SCM_DEPRECATED SCM scm_i_keywordsym (SCM keyword);
fe78c51a
MV
458
459#define SCM_KEYWORDP(x) scm_i_keywordp(x)
460#define SCM_KEYWORDSYM(x) scm_i_keywordsym(x)
265a7997 461
354116f7
MV
462/* Deprecated because we don't want to hand out unprotected pointers
463 to arrays, vectors, etc. */
464
465#define SCM_VECTOR_MAX_LENGTH ((1L << 24) - 1)
466
0eb934f1
LC
467SCM_DEPRECATED int scm_i_vectorp (SCM x);
468SCM_DEPRECATED unsigned long scm_i_vector_length (SCM x);
469SCM_DEPRECATED const SCM *scm_i_velts (SCM x);
470SCM_DEPRECATED SCM *scm_i_writable_velts (SCM x);
471SCM_DEPRECATED SCM scm_i_vector_ref (SCM x, size_t idx);
472SCM_DEPRECATED void scm_i_vector_set (SCM x, size_t idx, SCM val);
473SCM_DEPRECATED SCM scm_vector_equal_p (SCM x, SCM y);
265a7997 474
fe78c51a
MV
475#define SCM_VECTORP(x) scm_i_vectorp(x)
476#define SCM_VECTOR_LENGTH(x) scm_i_vector_length(x)
477#define SCM_VELTS(x) scm_i_velts(x)
478#define SCM_WRITABLE_VELTS(x) scm_i_writable_velts(x)
479#define SCM_VECTOR_REF(x,y) scm_i_vector_ref(x,y)
480#define SCM_VECTOR_SET(x,y,z) scm_i_vector_set(x,y,z)
1f366ef7 481
fe78c51a 482typedef scm_i_t_array scm_t_array;
1f366ef7 483
0eb934f1
LC
484SCM_DEPRECATED int scm_i_arrayp (SCM a);
485SCM_DEPRECATED size_t scm_i_array_ndim (SCM a);
486SCM_DEPRECATED int scm_i_array_contp (SCM a);
487SCM_DEPRECATED scm_t_array *scm_i_array_mem (SCM a);
488SCM_DEPRECATED SCM scm_i_array_v (SCM a);
489SCM_DEPRECATED size_t scm_i_array_base (SCM a);
490SCM_DEPRECATED scm_t_array_dim *scm_i_array_dims (SCM a);
fe78c51a
MV
491
492#define SCM_ARRAYP(a) scm_i_arrayp(a)
493#define SCM_ARRAY_NDIM(a) scm_i_array_ndim(a)
494#define SCM_ARRAY_CONTP(a) scm_i_array_contp(a)
495#define SCM_ARRAY_MEM(a) scm_i_array_mem(a)
496#define SCM_ARRAY_V(a) scm_i_array_v(a)
497#define SCM_ARRAY_BASE(a) scm_i_array_base(a)
9cc49060 498#define SCM_ARRAY_DIMS(a) scm_i_array_dims(a)
1f366ef7 499
73d1aaaf
LC
500SCM_DEPRECATED SCM scm_uniform_vector_read_x (SCM v, SCM port_or_fd,
501 SCM start, SCM end);
502SCM_DEPRECATED SCM scm_uniform_vector_write (SCM v, SCM port_or_fd,
503 SCM start, SCM end);
504SCM_DEPRECATED SCM scm_uniform_array_read_x (SCM ra, SCM port_or_fd,
505 SCM start, SCM end);
506SCM_DEPRECATED SCM scm_uniform_array_write (SCM v, SCM port_or_fd,
507 SCM start, SCM end);
a2689737 508
9de87eea
MV
509/* Deprecated because they should not be lvalues and we want people to
510 use the official interfaces.
511 */
512
513#define scm_cur_inp scm_i_cur_inp ()
514#define scm_cur_outp scm_i_cur_outp ()
515#define scm_cur_errp scm_i_cur_errp ()
516#define scm_cur_loadp scm_i_cur_loadp ()
517#define scm_progargs scm_i_progargs ()
518#define scm_dynwinds scm_i_deprecated_dynwinds ()
9de87eea
MV
519#define scm_stack_base scm_i_stack_base ()
520
0eb934f1
LC
521SCM_DEPRECATED SCM scm_i_cur_inp (void);
522SCM_DEPRECATED SCM scm_i_cur_outp (void);
523SCM_DEPRECATED SCM scm_i_cur_errp (void);
524SCM_DEPRECATED SCM scm_i_cur_loadp (void);
525SCM_DEPRECATED SCM scm_i_progargs (void);
526SCM_DEPRECATED SCM scm_i_deprecated_dynwinds (void);
0eb934f1 527SCM_DEPRECATED SCM_STACKITEM *scm_i_stack_base (void);
9de87eea
MV
528
529/* Deprecated because it evaluates its argument twice.
530 */
531#define SCM_FLUIDP(x) scm_i_fluidp (x)
0eb934f1 532SCM_DEPRECATED int scm_i_fluidp (SCM x);
9de87eea 533
3452e666
LC
534/* Deprecated in Guile 1.9.5 on 2009-11-15 because these are IPv4-only
535 functions which are deprecated upstream. */
536
537SCM_DEPRECATED SCM scm_inet_aton (SCM address);
538SCM_DEPRECATED SCM scm_inet_ntoa (SCM inetid);
539
06c1d900
MV
540/* In the old days, SCM_CRITICAL_SECTION_START stopped signal handlers
541 from running, since in those days the handler directly ran scheme
542 code, and that had to be avoided when the heap was not in a
543 consistent state etc. And since the scheme code could do a stack
544 swapping new continuation etc, signals had to be deferred around
545 various C library functions which were not safe or not known to be
546 safe to swap away, which was a lot of stuff.
547
548 These days signals are implemented with asyncs and don't directly
549 run scheme code in the handler, but hold it until an SCM_TICK etc
550 where it will be safe. This means interrupt protection is not
551 needed and SCM_CRITICAL_SECTION_START / SCM_CRITICAL_SECTION_END is
552 something of an anachronism.
553
554 What past SCM_CRITICAL_SECTION_START usage also did though was
555 indicate code that was not reentrant, ie. could not be reentered by
556 signal handler code. The present definitions are a mutex lock,
557 affording that reentrancy protection against the new guile 1.8
558 free-running posix threads.
9de87eea
MV
559
560 One big problem with the present defintions though is that code which
561 throws an error from within a DEFER/ALLOW region will leave the
562 defer_mutex locked and hence hang other threads that attempt to enter a
563 similar DEFER/ALLOW region.
564*/
565
0eb934f1 566SCM_DEPRECATED void scm_i_defer_ints_etc (void);
9de87eea
MV
567#define SCM_DEFER_INTS scm_i_defer_ints_etc ()
568#define SCM_ALLOW_INTS scm_i_defer_ints_etc ()
569#define SCM_REDEFER_INTS scm_i_defer_ints_etc ()
570#define SCM_REALLOW_INTS scm_i_defer_ints_etc ()
571
b8ec9dab
LC
572/* In the old days (pre-1.8), this macro was sometimes used as an lvalue as
573 in "scm_mask_ints = 1" to block async execution. It no longer works. */
574#define scm_mask_ints (scm_i_mask_ints ())
575
576SCM_DEPRECATED int scm_i_mask_ints (void);
577
06c1d900
MV
578/* Deprecated since they are unnecessary and had not been documented.
579 */
0eb934f1
LC
580SCM_DEPRECATED SCM scm_guard (SCM guardian, SCM obj, int throw_p);
581SCM_DEPRECATED SCM scm_get_one_zombie (SCM guardian);
06c1d900
MV
582
583/* Deprecated since guardians no longer have these special features.
584 */
0eb934f1
LC
585SCM_DEPRECATED SCM scm_destroy_guardian_x (SCM guardian);
586SCM_DEPRECATED SCM scm_guardian_greedy_p (SCM guardian);
587SCM_DEPRECATED SCM scm_guardian_destroyed_p (SCM guardian);
06c1d900 588
760fb97d
LC
589\f
590/* GC-related things deprecated with the move to BDW-GC starting from 1.9.3
591 (2009-09-15). */
592
0eb934f1
LC
593SCM_DEPRECATED unsigned long scm_mallocated;
594SCM_DEPRECATED unsigned long scm_mtrigger;
760fb97d 595
0eb934f1 596SCM_DEPRECATED size_t scm_max_segment_size;
760fb97d
LC
597
598#if defined (GUILE_DEBUG) || defined (GUILE_DEBUG_FREELIST)
0eb934f1 599SCM_DEPRECATED SCM scm_map_free_list (void);
760fb97d
LC
600#endif
601
602#if defined (GUILE_DEBUG_FREELIST)
0eb934f1 603SCM_DEPRECATED SCM scm_gc_set_debug_check_freelist_x (SCM flag);
760fb97d
LC
604#endif
605
a3e92377
AW
606\f
607
608/* Deprecated 2009-11-27, scm_call_N is sufficient */
609SCM_DEPRECATED scm_t_trampoline_0 scm_trampoline_0 (SCM proc);
610SCM_DEPRECATED scm_t_trampoline_1 scm_trampoline_1 (SCM proc);
611SCM_DEPRECATED scm_t_trampoline_2 scm_trampoline_2 (SCM proc);
760fb97d
LC
612
613\f
ea68d342
AW
614
615/* Deprecated 2009-12-06, use the procedures instead */
616#define SCM_PROCEDURE_WITH_SETTER_P(obj) (scm_is_true (scm_procedure_with_setter_p (obj)))
617#define SCM_PROCEDURE(obj) SCM_STRUCT_PROCEDURE (obj, 0)
618#define SCM_SETTER(obj) SCM_STRUCT_SETTER (obj, 1)
619
620\f
621
9fdf9fd3 622/* Deprecated 2010-01-05, use SCM_PRIMITIVE_P instead */
97812f4d
AW
623SCM_DEPRECATED int scm_i_subr_p (SCM x);
624#define scm_subr_p(x) (scm_i_subr_p (x))
9fdf9fd3
AW
625
626\f
627
e10cf6b9
AW
628/* Deprecated 2010-01-31, use with-throw-handler instead */
629SCM_DEPRECATED SCM scm_lazy_catch (SCM tag, SCM thunk, SCM handler);
630SCM_DEPRECATED SCM scm_internal_lazy_catch (SCM tag,
631 scm_t_catch_body body,
632 void *body_data,
633 scm_t_catch_handler handler,
634 void *handler_data);
635
636\f
637
a587d6a9
AW
638/* Deprecated 2010-03-31, use array-equal? instead */
639SCM_DEPRECATED SCM scm_raequal (SCM ra0, SCM ra1);
640
43cd9cec
AW
641/* Deprecated 2010-04-01, use the dynamic FFI instead */
642SCM_DEPRECATED SCM scm_dynamic_args_call (SCM symb, SCM dobj, SCM args);
643
cc00f447
AW
644/* Deprecated 2010-05-12, no replacement */
645SCM_DEPRECATED int scm_badargsp (SCM formals, SCM args);
646
ec16eb78
AW
647/* Deprecated 2010-06-19, use call-with-error-handling instead */
648SCM_DEPRECATED SCM scm_internal_stack_catch (SCM tag,
649 scm_t_catch_body body,
650 void *body_data,
651 scm_t_catch_handler handler,
652 void *handler_data);
653
a587d6a9
AW
654\f
655
220058a8
AW
656/* These functions were "discouraged" in 1.8, and now are deprecated. */
657
658/* scm_to_int, scm_from_int are the official functions to do the job,
659 but there is nothing wrong with using scm_num2int, etc.
660
661 These could be trivially defined via macros, but we leave them as
662 functions since existing code may take their addresses.
663*/
664
665SCM_DEPRECATED SCM scm_short2num (short n);
666SCM_DEPRECATED SCM scm_ushort2num (unsigned short n);
667SCM_DEPRECATED SCM scm_int2num (int n);
668SCM_DEPRECATED SCM scm_uint2num (unsigned int n);
669SCM_DEPRECATED SCM scm_long2num (long n);
670SCM_DEPRECATED SCM scm_ulong2num (unsigned long n);
671SCM_DEPRECATED SCM scm_size2num (size_t n);
672SCM_DEPRECATED SCM scm_ptrdiff2num (scm_t_ptrdiff n);
673SCM_DEPRECATED short scm_num2short (SCM num, unsigned long int pos,
674 const char *s_caller);
675SCM_DEPRECATED unsigned short scm_num2ushort (SCM num, unsigned long int pos,
676 const char *s_caller);
677SCM_DEPRECATED int scm_num2int (SCM num, unsigned long int pos,
678 const char *s_caller);
679SCM_DEPRECATED unsigned int scm_num2uint (SCM num, unsigned long int pos,
680 const char *s_caller);
681SCM_DEPRECATED long scm_num2long (SCM num, unsigned long int pos,
682 const char *s_caller);
683SCM_DEPRECATED unsigned long scm_num2ulong (SCM num, unsigned long int pos,
684 const char *s_caller);
685SCM_DEPRECATED scm_t_ptrdiff scm_num2ptrdiff (SCM num, unsigned long int pos,
686 const char *s_caller);
687SCM_DEPRECATED size_t scm_num2size (SCM num, unsigned long int pos,
688 const char *s_caller);
689#if SCM_SIZEOF_LONG_LONG != 0
690SCM_DEPRECATED SCM scm_long_long2num (long long sl);
691SCM_DEPRECATED SCM scm_ulong_long2num (unsigned long long sl);
692SCM_DEPRECATED long long scm_num2long_long (SCM num, unsigned long int pos,
693 const char *s_caller);
694SCM_DEPRECATED unsigned long long scm_num2ulong_long (SCM num, unsigned long int pos,
695 const char *s_caller);
696#endif
697
698SCM_DEPRECATED SCM scm_make_real (double x);
699SCM_DEPRECATED double scm_num2dbl (SCM a, const char * why);
700SCM_DEPRECATED SCM scm_float2num (float n);
701SCM_DEPRECATED SCM scm_double2num (double n);
702
703/* The next two are implemented in numbers.c since they use features
704 only available there.
705*/
706SCM_DEPRECATED float scm_num2float (SCM num, unsigned long int pos,
707 const char *s_caller);
708SCM_DEPRECATED double scm_num2double (SCM num, unsigned long int pos,
709 const char *s_caller);
710
711SCM_DEPRECATED SCM scm_make_complex (double x, double y);
712
713/* Discouraged because they don't make the encoding explicit.
714 */
715
716SCM_DEPRECATED SCM scm_mem2symbol (const char *mem, size_t len);
717SCM_DEPRECATED SCM scm_mem2uninterned_symbol (const char *mem, size_t len);
718SCM_DEPRECATED SCM scm_str2symbol (const char *str);
719
720SCM_DEPRECATED SCM scm_take_str (char *s, size_t len);
721SCM_DEPRECATED SCM scm_take0str (char *s);
722SCM_DEPRECATED SCM scm_mem2string (const char *src, size_t len);
723SCM_DEPRECATED SCM scm_str2string (const char *src);
724SCM_DEPRECATED SCM scm_makfrom0str (const char *src);
725SCM_DEPRECATED SCM scm_makfrom0str_opt (const char *src);
726
727/* Discouraged because scm_c_make_string has a better name and is more
728 consistent with make-string.
729 */
730SCM_DEPRECATED SCM scm_allocate_string (size_t len);
731
732/* Discouraged because they are just strange.
733 */
734
735SCM_DEPRECATED SCM scm_make_keyword_from_dash_symbol (SCM symbol);
736SCM_DEPRECATED SCM scm_keyword_dash_symbol (SCM keyword);
737
738/* Discouraged because it does not state what encoding S is in.
739 */
740
741SCM_DEPRECATED SCM scm_c_make_keyword (const char *s);
742
8a4ed2dd
AW
743SCM_DEPRECATED unsigned int scm_thread_sleep (unsigned int);
744SCM_DEPRECATED unsigned long scm_thread_usleep (unsigned long);
745SCM_DEPRECATED int scm_internal_select (int fds,
6ab4de61
AW
746 fd_set *rfds,
747 fd_set *wfds,
748 fd_set *efds,
8a4ed2dd 749 struct timeval *timeout);
220058a8 750\f
cd28785f
AW
751/* Deprecated because the cuserid call is deprecated.
752 */
79488112
AW
753SCM_DEPRECATED SCM scm_cuserid (void);
754
755\f
756
757/* Deprecated because it's yet another property interface.
758 */
759SCM_DEPRECATED SCM scm_primitive_make_property (SCM not_found_proc);
760SCM_DEPRECATED SCM scm_primitive_property_ref (SCM prop, SCM obj);
761SCM_DEPRECATED SCM scm_primitive_property_set_x (SCM prop, SCM obj, SCM val);
762SCM_DEPRECATED SCM scm_primitive_property_del_x (SCM prop, SCM obj);
cd28785f
AW
763
764\f
220058a8 765
d1c4720c
AW
766/* {The old whash table interface}
767 * Deprecated, as the hash table interface is sufficient, and accessing
768 * handles of weak hash tables is no longer supported.
769 */
770
771#define scm_whash_handle SCM
772
773SCM_DEPRECATED SCM scm_whash_get_handle (SCM whash, SCM key);
774SCM_DEPRECATED int SCM_WHASHFOUNDP (SCM h);
775SCM_DEPRECATED SCM SCM_WHASHREF (SCM whash, SCM handle);
776SCM_DEPRECATED void SCM_WHASHSET (SCM whash, SCM handle, SCM obj);
777SCM_DEPRECATED SCM scm_whash_create_handle (SCM whash, SCM key);
778SCM_DEPRECATED SCM scm_whash_lookup (SCM whash, SCM obj);
779SCM_DEPRECATED void scm_whash_insert (SCM whash, SCM key, SCM obj);
780
781
782\f
783
f3c6a02c
AW
784/* No need for a table for names, and the struct->class mapping is
785 maintained by GOOPS now. */
786#define SCM_STRUCT_TABLE_NAME(X) SCM_CAR (X)
787#define SCM_SET_STRUCT_TABLE_NAME(X, NAME) SCM_SETCAR (X, NAME)
788#define SCM_STRUCT_TABLE_CLASS(X) SCM_CDR (X)
789#define SCM_SET_STRUCT_TABLE_CLASS(X, CLASS) SCM_SETCDR (X, CLASS)
790
791SCM_DEPRECATED SCM scm_struct_table;
792SCM_DEPRECATED SCM scm_struct_create_handle (SCM obj);
793
794
795\f
796
65619ebe
AW
797/* Deprecated 26-05-2011, as the GC_STUBBORN API doesn't do anything any
798 more. */
4f5fb351
AW
799SCM_DEPRECATED SCM scm_immutable_cell (scm_t_bits car, scm_t_bits cdr);
800SCM_DEPRECATED SCM scm_immutable_double_cell (scm_t_bits car, scm_t_bits cbr,
65619ebe
AW
801 scm_t_bits ccr, scm_t_bits cdr);
802
803\f
804
9a384393 805SCM_DEPRECATED scm_t_bits scm_i_deprecated_asrtgo (scm_t_bits condition);
4f5fb351
AW
806
807/* Deprecated 08-01-2012, as it's undocumented and unused. */
808#define SCM_ASRTGO(_cond, _label) \
809 do { if (!scm_i_deprecated_asrtgo(_cond)) goto _label; } while (0)
810
811\f
812
62e15979
AW
813/* Deprecated 23-05-2012, as as it's undocumented, poorly named, and
814 adequately replaced by scm_module_variable /
815 scm_ensure_module_variable / scm_define / scm_module_define. */
816SCM_DEPRECATED SCM scm_sym2var (SCM sym, SCM thunk, SCM definep);
817
818\f
819
3f48638c
AW
820/* Eval closure deprecation, 23-05-2012. */
821#define SCM_TOP_LEVEL_LOOKUP_CLOSURE (scm_current_module_lookup_closure())
822
823SCM_DEPRECATED SCM scm_lookup_closure_module (SCM proc);
824SCM_DEPRECATED SCM scm_module_lookup_closure (SCM module);
825SCM_DEPRECATED SCM scm_current_module_lookup_closure (void);
826
2de74cb5
AW
827SCM_DEPRECATED scm_t_bits scm_tc16_eval_closure;
828
829#define SCM_EVAL_CLOSURE_P(x) SCM_TYP16_PREDICATE (scm_tc16_eval_closure, x)
830
831SCM_DEPRECATED SCM scm_eval_closure_lookup (SCM eclo, SCM sym, SCM definep);
832SCM_DEPRECATED SCM scm_standard_eval_closure (SCM module);
833SCM_DEPRECATED SCM scm_standard_interface_eval_closure (SCM module);
834SCM_DEPRECATED SCM scm_eval_closure_module (SCM eval_closure);
3f48638c
AW
835
836\f
837
d1927913
AW
838SCM_DEPRECATED SCM scm_struct_vtable_tag (SCM handle);
839
840\f
841
921cd222
AW
842#ifdef UCHAR_MAX
843# define SCM_CHAR_CODE_LIMIT (UCHAR_MAX + 1L)
844#else
845# define SCM_CHAR_CODE_LIMIT 256L
846#endif
847
848\f
849
118ff892
AW
850SCM_DEPRECATED SCM scm_generalized_vector_p (SCM v);
851SCM_DEPRECATED SCM scm_generalized_vector_length (SCM v);
852SCM_DEPRECATED SCM scm_generalized_vector_ref (SCM v, SCM idx);
853SCM_DEPRECATED SCM scm_generalized_vector_set_x (SCM v, SCM idx, SCM val);
854SCM_DEPRECATED SCM scm_generalized_vector_to_list (SCM v);
855
856\f
857
d7794a9d
AW
858SCM_DEPRECATED SCM scm_c_program_source (SCM program, size_t ip);
859
860\f
861
d364a897
AW
862SCM_DEPRECATED SCM scm_gc_live_object_stats (void);
863
864\f
865
b9b88351
AW
866SCM_DEPRECATED SCM scm_htons (SCM in);
867SCM_DEPRECATED SCM scm_ntohs (SCM in);
868SCM_DEPRECATED SCM scm_htonl (SCM in);
869SCM_DEPRECATED SCM scm_ntohl (SCM in);
870
871\f
872
55d30fac 873void scm_i_init_deprecated (void);
19e2247d 874
55d30fac 875#endif
19e2247d 876
55d30fac 877#endif /* SCM_DEPRECATED_H */