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