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