Add `scm_t_subr' typedef (fix bug #23681).
[bpt/guile.git] / libguile / deprecated.h
1 /* This file contains definitions for deprecated features. When you
2 deprecate something, move it here when that is feasible.
3 */
4
5 #ifndef SCM_DEPRECATED_H
6 #define SCM_DEPRECATED_H
7
8 /* Copyright (C) 2003,2004, 2005, 2006, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
9 *
10 * This library is free software; you can redistribute it and/or
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.
14 *
15 * This library is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 * 02110-1301 USA
24 */
25
26 #include "libguile/__scm.h"
27 #include "libguile/strings.h"
28 #include "libguile/eval.h"
29 #include "libguile/throw.h"
30 #include "libguile/iselect.h"
31
32 #if (SCM_ENABLE_DEPRECATED == 1)
33
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. */
46 SCM_API char *scm_isymnames[];
47 #define SCM_ISYMNUM(n) 0
48 #define SCM_ISYMCHARS(n) "#@<deprecated>"
49
50
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
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
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
72 #define scm_substring_move_left_x scm_substring_move_x
73 #define scm_substring_move_right_x scm_substring_move_x
74
75 #define scm_sizet size_t
76
77 SCM_DEPRECATED SCM scm_wta (SCM arg, const char *pos, const char *s_subr);
78
79 #define SCM_WNA 8
80 #define SCM_OUTOFRANGE 10
81 #define SCM_NALLOC 11
82
83 SCM_DEPRECATED void scm_register_module_xxx (char *module_name, void *init_func);
84 SCM_DEPRECATED SCM scm_registered_modules (void);
85 SCM_DEPRECATED SCM scm_clear_registered_modules (void);
86
87 SCM_DEPRECATED SCM scm_protect_object (SCM obj);
88 SCM_DEPRECATED SCM scm_unprotect_object (SCM obj);
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))))
98 #define SCM_FREEP(x) (0)
99 #define SCM_NFREEP(x) (1)
100 #define SCM_GCTYP16(x) SCM_TYP16 (x)
101 #define SCM_GCCDR(x) SCM_CDR (x)
102 SCM_DEPRECATED void scm_remember (SCM * ptr);
103
104 SCM_DEPRECATED SCM scm_make_module (SCM name);
105 SCM_DEPRECATED SCM scm_ensure_user_module (SCM name);
106 SCM_DEPRECATED SCM scm_load_scheme_module (SCM name);
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
112 SCM_DEPRECATED SCM scm_close_all_ports_except (SCM ports);
113
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
124 SCM_DEPRECATED SCM scm_makstr (size_t len, int);
125 SCM_DEPRECATED SCM scm_makfromstr (const char *src, size_t len, int);
126
127 SCM_DEPRECATED SCM scm_variable_set_name_hint (SCM var, SCM hint);
128 SCM_DEPRECATED SCM scm_builtin_variable (SCM name);
129
130 SCM_DEPRECATED SCM scm_internal_with_fluids (SCM fluids, SCM vals,
131 SCM (*cproc)(void *),
132 void *cdata);
133
134 SCM_DEPRECATED SCM scm_make_gsubr (const char *name,
135 int req, int opt, int rst,
136 scm_t_subr fcn);
137 SCM_DEPRECATED SCM scm_make_gsubr_with_generic (const char *name,
138 int req,
139 int opt,
140 int rst,
141 scm_t_subr fcn,
142 SCM *gf);
143
144 SCM_DEPRECATED SCM scm_create_hook (const char* name, int n_args);
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
166 SCM_DEPRECATED SCM scm_sloppy_memq (SCM x, SCM lst);
167 SCM_DEPRECATED SCM scm_sloppy_memv (SCM x, SCM lst);
168 SCM_DEPRECATED SCM scm_sloppy_member (SCM x, SCM lst);
169
170 SCM_DEPRECATED SCM scm_read_and_eval_x (SCM port);
171
172 #define scm_subr_entry scm_t_subr_entry
173
174 #define SCM_SUBR_DOC(x) SCM_BOOL_F
175
176 SCM_DEPRECATED SCM scm_call_catching_errors (scm_t_subr thunk,
177 scm_t_subr err_filter,
178 void * closure);
179
180 SCM_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));
186
187 SCM_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));
192
193 SCM_DEPRECATED size_t scm_smob_free (SCM obj);
194
195 SCM_DEPRECATED SCM scm_strprint_obj (SCM obj);
196 SCM_DEPRECATED SCM scm_read_0str (char *expr);
197 SCM_DEPRECATED SCM scm_eval_0str (const char *expr);
198
199 SCM_DEPRECATED char *scm_i_object_chars (SCM);
200
201 #define SCM_CHARS(x) scm_i_object_chars(x)
202 #define SCM_UCHARS(x) ((unsigned char *)SCM_CHARS(x))
203
204 SCM_DEPRECATED long scm_i_object_length (SCM);
205
206 #define SCM_LENGTH(x) scm_i_object_length(x)
207
208 #define scm_strhash(str, len, n) (scm_string_hash ((str), (len)) % (n))
209
210 SCM_DEPRECATED SCM scm_sym2ovcell_soft (SCM sym, SCM obarray);
211 SCM_DEPRECATED SCM scm_sym2ovcell (SCM sym, SCM obarray);
212 SCM_DEPRECATED SCM scm_intern_obarray_soft (const char *name, size_t len,
213 SCM obarray, unsigned int softness);
214 SCM_DEPRECATED SCM scm_intern_obarray (const char *name, size_t len, SCM obarray);
215 SCM_DEPRECATED SCM scm_symbol_value0 (const char *name);
216
217 SCM_DEPRECATED SCM scm_string_to_obarray_symbol (SCM o, SCM s, SCM softp);
218 SCM_DEPRECATED SCM scm_intern_symbol (SCM o, SCM s);
219 SCM_DEPRECATED SCM scm_unintern_symbol (SCM o, SCM s);
220 SCM_DEPRECATED SCM scm_symbol_binding (SCM o, SCM s);
221 #if 0
222 /* This name has been reused for real uninterned symbols. */
223 SCM_DEPRECATED SCM scm_symbol_interned_p (SCM o, SCM s);
224 #endif
225 SCM_DEPRECATED SCM scm_symbol_bound_p (SCM o, SCM s);
226 SCM_DEPRECATED SCM scm_symbol_set_x (SCM o, SCM s, SCM v);
227
228 SCM_DEPRECATED SCM scm_gentemp (SCM prefix, SCM obarray);
229
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
235 #define scm_array scm_t_array
236 #define scm_array_dim scm_t_array_dim
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 { \
247 if (SCM_I_INUMP (z)) \
248 cvar = (double) SCM_I_INUM (z); \
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
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
275 /* Users shouldn't know about INUMs.
276 */
277
278 SCM_DEPRECATED SCM scm_i_makinum (scm_t_signed_bits val);
279 SCM_DEPRECATED int scm_i_inump (SCM obj);
280 SCM_DEPRECATED scm_t_signed_bits scm_i_inum (SCM obj);
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))
286
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 { \
291 SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
292 cvar = SCM_I_INUM (k); \
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 { \
299 SCM_ASSERT (SCM_I_INUMP(k), k, pos, FUNC_NAME); \
300 SCM_ASSERT_RANGE (pos, k, (SCM_I_INUM (k) >= min)); \
301 } while (0)
302
303 #define SCM_VALIDATE_INUM_MIN_COPY(pos, k, min, cvar) \
304 do { \
305 SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
306 SCM_ASSERT_RANGE (pos, k, (SCM_I_INUM (k) >= min)); \
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); \
314 SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
315 SCM_ASSERT_RANGE (pos, k, (SCM_I_INUM (k) >= min)); \
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); \
323 else SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
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 { \
335 SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \
336 cvar = SCM_INUM (k); \
337 } \
338 } while (0)
339
340 /* [low, high) */
341 #define SCM_VALIDATE_INUM_RANGE(pos, k, low, high) \
342 do { SCM_ASSERT(SCM_I_INUMP(k), k, pos, FUNC_NAME); \
343 SCM_ASSERT_RANGE(pos, k, \
344 (SCM_I_INUM (k) >= low && \
345 SCM_I_INUM (k) < high)); \
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
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 */
373 SCM_DEPRECATED char *scm_c_string2str (SCM obj, char *str, size_t *lenp);
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 */
385 SCM_DEPRECATED char *scm_c_substring2str (SCM obj, char *str, size_t start, size_t len);
386
387 SCM_DEPRECATED char *scm_c_symbol2str (SCM obj, char *str, size_t *lenp);
388
389 /* Deprecated because the names belong to what is now
390 scm_truncate_number and scm_round_number.
391 */
392 SCM_DEPRECATED double scm_truncate (double x);
393 SCM_DEPRECATED double scm_round (double x);
394 /* Deprecated, use scm_expt */
395 SCM_DEPRECATED SCM scm_sys_expt (SCM x, SCM y);
396
397 /* if your platform doesn't have asinh et al */
398 SCM_API double scm_asinh (double x);
399 SCM_API double scm_acosh (double x);
400 SCM_API double scm_atanh (double x);
401 SCM_API SCM scm_sys_atan2 (SCM z1, SCM z2);
402
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
431 /* Deprecated because we don't want people to access the internals of
432 symbols directly.
433 */
434
435 SCM_DEPRECATED char *scm_i_deprecated_symbol_chars (SCM sym);
436 SCM_DEPRECATED size_t scm_i_deprecated_symbol_length (SCM sym);
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)
440
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
445 SCM_DEPRECATED int scm_i_keywordp (SCM obj);
446 SCM_DEPRECATED SCM scm_i_keywordsym (SCM keyword);
447
448 #define SCM_KEYWORDP(x) scm_i_keywordp(x)
449 #define SCM_KEYWORDSYM(x) scm_i_keywordsym(x)
450
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
456 SCM_DEPRECATED int scm_i_vectorp (SCM x);
457 SCM_DEPRECATED unsigned long scm_i_vector_length (SCM x);
458 SCM_DEPRECATED const SCM *scm_i_velts (SCM x);
459 SCM_DEPRECATED SCM *scm_i_writable_velts (SCM x);
460 SCM_DEPRECATED SCM scm_i_vector_ref (SCM x, size_t idx);
461 SCM_DEPRECATED void scm_i_vector_set (SCM x, size_t idx, SCM val);
462 SCM_DEPRECATED SCM scm_vector_equal_p (SCM x, SCM y);
463
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)
470
471 typedef scm_i_t_array scm_t_array;
472
473 SCM_DEPRECATED int scm_i_arrayp (SCM a);
474 SCM_DEPRECATED size_t scm_i_array_ndim (SCM a);
475 SCM_DEPRECATED int scm_i_array_contp (SCM a);
476 SCM_DEPRECATED scm_t_array *scm_i_array_mem (SCM a);
477 SCM_DEPRECATED SCM scm_i_array_v (SCM a);
478 SCM_DEPRECATED size_t scm_i_array_base (SCM a);
479 SCM_DEPRECATED scm_t_array_dim *scm_i_array_dims (SCM a);
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)
487 #define SCM_ARRAY_DIMS(a) scm_i_array_dims(a)
488
489 SCM_DEPRECATED SCM scm_uniform_vector_read_x (SCM v, SCM port_or_fd,
490 SCM start, SCM end);
491 SCM_DEPRECATED SCM scm_uniform_vector_write (SCM v, SCM port_or_fd,
492 SCM start, SCM end);
493 SCM_DEPRECATED SCM scm_uniform_array_read_x (SCM ra, SCM port_or_fd,
494 SCM start, SCM end);
495 SCM_DEPRECATED SCM scm_uniform_array_write (SCM v, SCM port_or_fd,
496 SCM start, SCM end);
497
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 ()
508 #define scm_stack_base scm_i_stack_base ()
509
510 SCM_DEPRECATED SCM scm_i_cur_inp (void);
511 SCM_DEPRECATED SCM scm_i_cur_outp (void);
512 SCM_DEPRECATED SCM scm_i_cur_errp (void);
513 SCM_DEPRECATED SCM scm_i_cur_loadp (void);
514 SCM_DEPRECATED SCM scm_i_progargs (void);
515 SCM_DEPRECATED SCM scm_i_deprecated_dynwinds (void);
516 SCM_DEPRECATED SCM_STACKITEM *scm_i_stack_base (void);
517
518 /* Deprecated because it evaluates its argument twice.
519 */
520 #define SCM_FLUIDP(x) scm_i_fluidp (x)
521 SCM_DEPRECATED int scm_i_fluidp (SCM x);
522
523 /* Deprecated in Guile 1.9.5 on 2009-11-15 because these are IPv4-only
524 functions which are deprecated upstream. */
525
526 SCM_DEPRECATED SCM scm_inet_aton (SCM address);
527 SCM_DEPRECATED SCM scm_inet_ntoa (SCM inetid);
528
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.
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
555 SCM_DEPRECATED void scm_i_defer_ints_etc (void);
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
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
565 SCM_DEPRECATED int scm_i_mask_ints (void);
566
567 /* Deprecated since they are unnecessary and had not been documented.
568 */
569 SCM_DEPRECATED SCM scm_guard (SCM guardian, SCM obj, int throw_p);
570 SCM_DEPRECATED SCM scm_get_one_zombie (SCM guardian);
571
572 /* Deprecated since guardians no longer have these special features.
573 */
574 SCM_DEPRECATED SCM scm_destroy_guardian_x (SCM guardian);
575 SCM_DEPRECATED SCM scm_guardian_greedy_p (SCM guardian);
576 SCM_DEPRECATED SCM scm_guardian_destroyed_p (SCM guardian);
577
578 \f
579 /* GC-related things deprecated with the move to BDW-GC starting from 1.9.3
580 (2009-09-15). */
581
582 SCM_DEPRECATED unsigned long scm_mallocated;
583 SCM_DEPRECATED unsigned long scm_mtrigger;
584
585 SCM_DEPRECATED size_t scm_max_segment_size;
586
587 #if defined (GUILE_DEBUG) || defined (GUILE_DEBUG_FREELIST)
588 SCM_DEPRECATED SCM scm_map_free_list (void);
589 #endif
590
591 #if defined (GUILE_DEBUG_FREELIST)
592 SCM_DEPRECATED SCM scm_gc_set_debug_check_freelist_x (SCM flag);
593 #endif
594
595 \f
596
597 /* Deprecated 2009-11-27, scm_call_N is sufficient */
598 SCM_DEPRECATED scm_t_trampoline_0 scm_trampoline_0 (SCM proc);
599 SCM_DEPRECATED scm_t_trampoline_1 scm_trampoline_1 (SCM proc);
600 SCM_DEPRECATED scm_t_trampoline_2 scm_trampoline_2 (SCM proc);
601
602 \f
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
611 /* Deprecated 2010-01-05, use SCM_PRIMITIVE_P instead */
612 SCM_DEPRECATED int scm_i_subr_p (SCM x);
613 #define scm_subr_p(x) (scm_i_subr_p (x))
614
615 \f
616
617 /* Deprecated 2010-01-31, use with-throw-handler instead */
618 SCM_DEPRECATED SCM scm_lazy_catch (SCM tag, SCM thunk, SCM handler);
619 SCM_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
627 /* Deprecated 2010-03-31, use array-equal? instead */
628 SCM_DEPRECATED SCM scm_raequal (SCM ra0, SCM ra1);
629
630 /* Deprecated 2010-04-01, use the dynamic FFI instead */
631 SCM_DEPRECATED SCM scm_dynamic_args_call (SCM symb, SCM dobj, SCM args);
632
633 /* Deprecated 2010-05-12, no replacement */
634 SCM_DEPRECATED int scm_badargsp (SCM formals, SCM args);
635
636 /* Deprecated 2010-06-19, use call-with-error-handling instead */
637 SCM_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
643 \f
644
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
654 SCM_DEPRECATED SCM scm_short2num (short n);
655 SCM_DEPRECATED SCM scm_ushort2num (unsigned short n);
656 SCM_DEPRECATED SCM scm_int2num (int n);
657 SCM_DEPRECATED SCM scm_uint2num (unsigned int n);
658 SCM_DEPRECATED SCM scm_long2num (long n);
659 SCM_DEPRECATED SCM scm_ulong2num (unsigned long n);
660 SCM_DEPRECATED SCM scm_size2num (size_t n);
661 SCM_DEPRECATED SCM scm_ptrdiff2num (scm_t_ptrdiff n);
662 SCM_DEPRECATED short scm_num2short (SCM num, unsigned long int pos,
663 const char *s_caller);
664 SCM_DEPRECATED unsigned short scm_num2ushort (SCM num, unsigned long int pos,
665 const char *s_caller);
666 SCM_DEPRECATED int scm_num2int (SCM num, unsigned long int pos,
667 const char *s_caller);
668 SCM_DEPRECATED unsigned int scm_num2uint (SCM num, unsigned long int pos,
669 const char *s_caller);
670 SCM_DEPRECATED long scm_num2long (SCM num, unsigned long int pos,
671 const char *s_caller);
672 SCM_DEPRECATED unsigned long scm_num2ulong (SCM num, unsigned long int pos,
673 const char *s_caller);
674 SCM_DEPRECATED scm_t_ptrdiff scm_num2ptrdiff (SCM num, unsigned long int pos,
675 const char *s_caller);
676 SCM_DEPRECATED size_t scm_num2size (SCM num, unsigned long int pos,
677 const char *s_caller);
678 #if SCM_SIZEOF_LONG_LONG != 0
679 SCM_DEPRECATED SCM scm_long_long2num (long long sl);
680 SCM_DEPRECATED SCM scm_ulong_long2num (unsigned long long sl);
681 SCM_DEPRECATED long long scm_num2long_long (SCM num, unsigned long int pos,
682 const char *s_caller);
683 SCM_DEPRECATED unsigned long long scm_num2ulong_long (SCM num, unsigned long int pos,
684 const char *s_caller);
685 #endif
686
687 SCM_DEPRECATED SCM scm_make_real (double x);
688 SCM_DEPRECATED double scm_num2dbl (SCM a, const char * why);
689 SCM_DEPRECATED SCM scm_float2num (float n);
690 SCM_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 */
695 SCM_DEPRECATED float scm_num2float (SCM num, unsigned long int pos,
696 const char *s_caller);
697 SCM_DEPRECATED double scm_num2double (SCM num, unsigned long int pos,
698 const char *s_caller);
699
700 SCM_DEPRECATED SCM scm_make_complex (double x, double y);
701
702 /* Discouraged because they don't make the encoding explicit.
703 */
704
705 SCM_DEPRECATED SCM scm_mem2symbol (const char *mem, size_t len);
706 SCM_DEPRECATED SCM scm_mem2uninterned_symbol (const char *mem, size_t len);
707 SCM_DEPRECATED SCM scm_str2symbol (const char *str);
708
709 SCM_DEPRECATED SCM scm_take_str (char *s, size_t len);
710 SCM_DEPRECATED SCM scm_take0str (char *s);
711 SCM_DEPRECATED SCM scm_mem2string (const char *src, size_t len);
712 SCM_DEPRECATED SCM scm_str2string (const char *src);
713 SCM_DEPRECATED SCM scm_makfrom0str (const char *src);
714 SCM_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 */
719 SCM_DEPRECATED SCM scm_allocate_string (size_t len);
720
721 /* Discouraged because they are just strange.
722 */
723
724 SCM_DEPRECATED SCM scm_make_keyword_from_dash_symbol (SCM symbol);
725 SCM_DEPRECATED SCM scm_keyword_dash_symbol (SCM keyword);
726
727 /* Discouraged because it does not state what encoding S is in.
728 */
729
730 SCM_DEPRECATED SCM scm_c_make_keyword (const char *s);
731
732 SCM_DEPRECATED unsigned int scm_thread_sleep (unsigned int);
733 SCM_DEPRECATED unsigned long scm_thread_usleep (unsigned long);
734 SCM_DEPRECATED int scm_internal_select (int fds,
735 SELECT_TYPE *rfds,
736 SELECT_TYPE *wfds,
737 SELECT_TYPE *efds,
738 struct timeval *timeout);
739 \f
740 /* Deprecated because the cuserid call is deprecated.
741 */
742 SCM_DEPRECATED SCM scm_cuserid (void);
743
744 \f
745
746 /* Deprecated because it's yet another property interface.
747 */
748 SCM_DEPRECATED SCM scm_primitive_make_property (SCM not_found_proc);
749 SCM_DEPRECATED SCM scm_primitive_property_ref (SCM prop, SCM obj);
750 SCM_DEPRECATED SCM scm_primitive_property_set_x (SCM prop, SCM obj, SCM val);
751 SCM_DEPRECATED SCM scm_primitive_property_del_x (SCM prop, SCM obj);
752
753 \f
754
755 void scm_i_init_deprecated (void);
756
757 #endif
758
759 #endif /* SCM_DEPRECATED_H */