Commit | Line | Data |
---|---|---|
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 | ||
54cd7150 | 8 | /* Copyright (C) 2003,2004, 2005, 2006, 2007, 2009, 2010 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" |
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. */ | |
44 | SCM_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 | ||
b6cf4d02 AW |
61 | /* From structs.h: |
62 | Deprecated in Guile 1.9.5 on 2009-11-03. */ | |
63 | #define scm_vtable_index_vtable scm_vtable_index_self | |
64 | #define scm_vtable_index_printer scm_vtable_index_instance_printer | |
65 | #define scm_struct_i_free scm_vtable_index_instance_finalize | |
66 | #define scm_struct_i_flags scm_vtable_index_flags | |
67 | #define SCM_STRUCTF_MASK ((scm_t_bits)-1) | |
68 | #define SCM_SET_VTABLE_DESTRUCTOR(X, D) (SCM_STRUCT_DATA(x)[scm_struct_i_free]=(scm_t_bits)(D)) | |
69 | ||
19e2247d MV |
70 | #define scm_substring_move_left_x scm_substring_move_x |
71 | #define scm_substring_move_right_x scm_substring_move_x | |
72 | ||
55d30fac | 73 | #define scm_sizet size_t |
19e2247d | 74 | |
0eb934f1 | 75 | SCM_DEPRECATED SCM scm_wta (SCM arg, const char *pos, const char *s_subr); |
19e2247d | 76 | |
55d30fac MV |
77 | #define SCM_WNA 8 |
78 | #define SCM_OUTOFRANGE 10 | |
79 | #define SCM_NALLOC 11 | |
19e2247d | 80 | |
0eb934f1 LC |
81 | SCM_DEPRECATED void scm_register_module_xxx (char *module_name, void *init_func); |
82 | SCM_DEPRECATED SCM scm_registered_modules (void); | |
83 | SCM_DEPRECATED SCM scm_clear_registered_modules (void); | |
19e2247d | 84 | |
0eb934f1 LC |
85 | SCM_DEPRECATED SCM scm_protect_object (SCM obj); |
86 | SCM_DEPRECATED SCM scm_unprotect_object (SCM obj); | |
a0454d72 MV |
87 | |
88 | #define SCM_SETAND_CAR(x, y) \ | |
89 | (SCM_SETCAR ((x), SCM_PACK (SCM_UNPACK (SCM_CAR (x)) & (y)))) | |
90 | #define SCM_SETOR_CAR(x, y)\ | |
91 | (SCM_SETCAR ((x), SCM_PACK (SCM_UNPACK (SCM_CAR (x)) | (y)))) | |
92 | #define SCM_SETAND_CDR(x, y)\ | |
93 | (SCM_SETCDR ((x), SCM_PACK (SCM_UNPACK (SCM_CDR (x)) & (y)))) | |
94 | #define SCM_SETOR_CDR(x, y)\ | |
95 | (SCM_SETCDR ((x), SCM_PACK (SCM_UNPACK (SCM_CDR (x)) | (y)))) | |
f86f3b5b LC |
96 | #define SCM_FREEP(x) (0) |
97 | #define SCM_NFREEP(x) (1) | |
a0454d72 MV |
98 | #define SCM_GCTYP16(x) SCM_TYP16 (x) |
99 | #define SCM_GCCDR(x) SCM_CDR (x) | |
0eb934f1 | 100 | SCM_DEPRECATED void scm_remember (SCM * ptr); |
a0454d72 | 101 | |
0eb934f1 LC |
102 | SCM_DEPRECATED SCM scm_make_module (SCM name); |
103 | SCM_DEPRECATED SCM scm_ensure_user_module (SCM name); | |
104 | SCM_DEPRECATED SCM scm_load_scheme_module (SCM name); | |
a0454d72 MV |
105 | |
106 | #define scm_port scm_t_port | |
107 | #define scm_ptob_descriptor scm_t_ptob_descriptor | |
108 | #define scm_port_rw_active scm_t_port_rw_active | |
109 | ||
0eb934f1 | 110 | SCM_DEPRECATED SCM scm_close_all_ports_except (SCM ports); |
a0454d72 | 111 | |
97f28fa4 MV |
112 | #define scm_rstate scm_t_rstate |
113 | #define scm_rng scm_t_rng | |
114 | ||
115 | #define SCM_SLOPPY_CONSP(x) ((1 & SCM_CELL_TYPE (x)) == 0) | |
116 | #define SCM_SLOPPY_NCONSP(x) (!SCM_SLOPPY_CONSP(x)) | |
117 | ||
118 | #define scm_tc7_ssymbol scm_tc7_symbol | |
119 | #define scm_tc7_msymbol scm_tc7_symbol | |
120 | #define scm_tcs_symbols scm_tc7_symbol | |
121 | ||
0eb934f1 LC |
122 | SCM_DEPRECATED SCM scm_makstr (size_t len, int); |
123 | SCM_DEPRECATED SCM scm_makfromstr (const char *src, size_t len, int); | |
965445d4 | 124 | |
0eb934f1 LC |
125 | SCM_DEPRECATED SCM scm_variable_set_name_hint (SCM var, SCM hint); |
126 | SCM_DEPRECATED SCM scm_builtin_variable (SCM name); | |
965445d4 | 127 | |
0eb934f1 LC |
128 | SCM_DEPRECATED SCM scm_internal_with_fluids (SCM fluids, SCM vals, |
129 | SCM (*cproc)(void *), | |
130 | void *cdata); | |
965445d4 | 131 | |
0eb934f1 LC |
132 | SCM_DEPRECATED SCM scm_make_gsubr (const char *name, |
133 | int req, int opt, int rst, | |
134 | SCM (*fcn)()); | |
135 | SCM_DEPRECATED SCM scm_make_gsubr_with_generic (const char *name, | |
136 | int req, | |
137 | int opt, | |
138 | int rst, | |
139 | SCM (*fcn)(), | |
140 | SCM *gf); | |
965445d4 | 141 | |
0eb934f1 | 142 | SCM_DEPRECATED SCM scm_create_hook (const char* name, int n_args); |
965445d4 MV |
143 | |
144 | #define SCM_LIST0 SCM_EOL | |
145 | #define SCM_LIST1(e0) scm_cons ((e0), SCM_EOL) | |
146 | #define SCM_LIST2(e0, e1) scm_cons2 ((e0), (e1), SCM_EOL) | |
147 | #define SCM_LIST3(e0, e1, e2) scm_cons ((e0), SCM_LIST2 ((e1), (e2))) | |
148 | #define SCM_LIST4(e0, e1, e2, e3)\ | |
149 | scm_cons2 ((e0), (e1), SCM_LIST2 ((e2), (e3))) | |
150 | #define SCM_LIST5(e0, e1, e2, e3, e4)\ | |
151 | scm_cons ((e0), SCM_LIST4 ((e1), (e2), (e3), (e4))) | |
152 | #define SCM_LIST6(e0, e1, e2, e3, e4, e5)\ | |
153 | scm_cons2 ((e0), (e1), SCM_LIST4 ((e2), (e3), (e4), (e5))) | |
154 | #define SCM_LIST7(e0, e1, e2, e3, e4, e5, e6)\ | |
155 | scm_cons ((e0), SCM_LIST6 ((e1), (e2), (e3), (e4), (e5), (e6))) | |
156 | #define SCM_LIST8(e0, e1, e2, e3, e4, e5, e6, e7)\ | |
157 | scm_cons2 ((e0), (e1), SCM_LIST6 ((e2), (e3), (e4), (e5), (e6), (e7))) | |
158 | #define SCM_LIST9(e0, e1, e2, e3, e4, e5, e6, e7, e8)\ | |
159 | scm_cons ((e0),\ | |
160 | SCM_LIST8 ((e1), (e2), (e3), (e4), (e5), (e6), (e7), (e8))) | |
161 | ||
162 | #define scm_listify scm_list_n | |
163 | ||
0eb934f1 LC |
164 | SCM_DEPRECATED SCM scm_sloppy_memq (SCM x, SCM lst); |
165 | SCM_DEPRECATED SCM scm_sloppy_memv (SCM x, SCM lst); | |
166 | SCM_DEPRECATED SCM scm_sloppy_member (SCM x, SCM lst); | |
965445d4 | 167 | |
0eb934f1 | 168 | SCM_DEPRECATED SCM scm_read_and_eval_x (SCM port); |
965445d4 | 169 | |
4abecea8 MV |
170 | #define scm_subr_entry scm_t_subr_entry |
171 | ||
172 | #define SCM_SUBR_DOC(x) SCM_BOOL_F | |
173 | ||
0eb934f1 LC |
174 | SCM_DEPRECATED SCM scm_call_catching_errors (SCM (*thunk)(), SCM (*err_filter)(), |
175 | void * closure); | |
4abecea8 | 176 | |
0eb934f1 LC |
177 | SCM_DEPRECATED long scm_make_smob_type_mfpe (char *name, size_t size, |
178 | SCM (*mark) (SCM), | |
179 | size_t (*free) (SCM), | |
180 | int (*print) (SCM, SCM, | |
181 | scm_print_state*), | |
182 | SCM (*equalp) (SCM, SCM)); | |
4abecea8 | 183 | |
0eb934f1 LC |
184 | SCM_DEPRECATED void scm_set_smob_mfpe (long tc, |
185 | SCM (*mark) (SCM), | |
186 | size_t (*free) (SCM), | |
187 | int (*print) (SCM, SCM, scm_print_state*), | |
188 | SCM (*equalp) (SCM, SCM)); | |
4abecea8 | 189 | |
0eb934f1 | 190 | SCM_DEPRECATED size_t scm_smob_free (SCM obj); |
3051344b | 191 | |
0eb934f1 LC |
192 | SCM_DEPRECATED SCM scm_strprint_obj (SCM obj); |
193 | SCM_DEPRECATED SCM scm_read_0str (char *expr); | |
194 | SCM_DEPRECATED SCM scm_eval_0str (const char *expr); | |
4abecea8 | 195 | |
0eb934f1 | 196 | SCM_DEPRECATED char *scm_i_object_chars (SCM); |
a725fa95 MV |
197 | |
198 | #define SCM_CHARS(x) scm_i_object_chars(x) | |
199 | #define SCM_UCHARS(x) ((unsigned char *)SCM_CHARS(x)) | |
200 | ||
0eb934f1 | 201 | SCM_DEPRECATED long scm_i_object_length (SCM); |
a725fa95 MV |
202 | |
203 | #define SCM_LENGTH(x) scm_i_object_length(x) | |
204 | ||
cc5c1b66 MV |
205 | #define scm_strhash(str, len, n) (scm_string_hash ((str), (len)) % (n)) |
206 | ||
0eb934f1 LC |
207 | SCM_DEPRECATED SCM scm_sym2ovcell_soft (SCM sym, SCM obarray); |
208 | SCM_DEPRECATED SCM scm_sym2ovcell (SCM sym, SCM obarray); | |
209 | SCM_DEPRECATED SCM scm_intern_obarray_soft (const char *name, size_t len, | |
cc5c1b66 | 210 | SCM obarray, unsigned int softness); |
0eb934f1 LC |
211 | SCM_DEPRECATED SCM scm_intern_obarray (const char *name, size_t len, SCM obarray); |
212 | SCM_DEPRECATED SCM scm_symbol_value0 (const char *name); | |
cc5c1b66 | 213 | |
0eb934f1 LC |
214 | SCM_DEPRECATED SCM scm_string_to_obarray_symbol (SCM o, SCM s, SCM softp); |
215 | SCM_DEPRECATED SCM scm_intern_symbol (SCM o, SCM s); | |
216 | SCM_DEPRECATED SCM scm_unintern_symbol (SCM o, SCM s); | |
217 | SCM_DEPRECATED SCM scm_symbol_binding (SCM o, SCM s); | |
cc5c1b66 MV |
218 | #if 0 |
219 | /* This name has been reused for real uninterned symbols. */ | |
0eb934f1 | 220 | SCM_DEPRECATED SCM scm_symbol_interned_p (SCM o, SCM s); |
cc5c1b66 | 221 | #endif |
0eb934f1 LC |
222 | SCM_DEPRECATED SCM scm_symbol_bound_p (SCM o, SCM s); |
223 | SCM_DEPRECATED SCM scm_symbol_set_x (SCM o, SCM s, SCM v); | |
cc5c1b66 | 224 | |
0eb934f1 | 225 | SCM_DEPRECATED SCM scm_gentemp (SCM prefix, SCM obarray); |
cc5c1b66 | 226 | |
8de7acbd MV |
227 | #define SCM_OPDIRP(x) (SCM_DIRP (x) && (SCM_DIR_OPEN_P (x))) |
228 | #define scm_fport scm_t_fport | |
229 | #define scm_option scm_t_option | |
230 | #define scm_srcprops scm_t_srcprops | |
231 | #define scm_srcprops_chunk scm_t_srcprops_chunk | |
8de7acbd MV |
232 | #define scm_array scm_t_array |
233 | #define scm_array_dim scm_t_array_dim | |
8de7acbd MV |
234 | #define SCM_FUNC_NAME (scm_makfrom0str (FUNC_NAME)) |
235 | ||
236 | #define SCM_WTA(pos, scm) \ | |
237 | do { scm_wta (scm, (char *) pos, FUNC_NAME); } while (0) | |
238 | ||
239 | #define RETURN_SCM_WTA(pos, scm) \ | |
240 | do { return scm_wta (scm, (char *) pos, FUNC_NAME); } while (0) | |
241 | ||
242 | #define SCM_VALIDATE_NUMBER_COPY(pos, z, cvar) \ | |
243 | do { \ | |
3aa13a05 MV |
244 | if (SCM_I_INUMP (z)) \ |
245 | cvar = (double) SCM_I_INUM (z); \ | |
8de7acbd MV |
246 | else if (SCM_REALP (z)) \ |
247 | cvar = SCM_REAL_VALUE (z); \ | |
248 | else if (SCM_BIGP (z)) \ | |
249 | cvar = scm_i_big2dbl (z); \ | |
250 | else \ | |
251 | { \ | |
252 | cvar = 0.0; \ | |
253 | SCM_WRONG_TYPE_ARG (pos, z); \ | |
254 | } \ | |
255 | } while (0) | |
256 | ||
257 | #define SCM_VALIDATE_NUMBER_DEF_COPY(pos, number, def, cvar) \ | |
258 | do { \ | |
259 | if (SCM_UNBNDP (number)) \ | |
260 | cvar = def; \ | |
261 | else \ | |
262 | SCM_VALIDATE_NUMBER_COPY(pos, number, cvar); \ | |
263 | } while (0) | |
264 | ||
265 | #define SCM_VALIDATE_OPDIR(pos, port) SCM_MAKE_VALIDATE (pos, port, OPDIRP) | |
266 | ||
41a2f6fc MV |
267 | /* Deprecated because we can not safely cast a SCM* to a scm_t_bits* |
268 | */ | |
269 | ||
270 | #define SCM_CELL_WORD_LOC(x, n) ((scm_t_bits*)SCM_CELL_OBJECT_LOC((x),(n))) | |
271 | ||
8805b77d MV |
272 | /* Users shouldn't know about INUMs. |
273 | */ | |
274 | ||
0eb934f1 LC |
275 | SCM_DEPRECATED SCM scm_i_makinum (scm_t_signed_bits val); |
276 | SCM_DEPRECATED int scm_i_inump (SCM obj); | |
277 | SCM_DEPRECATED scm_t_signed_bits scm_i_inum (SCM obj); | |
fe78c51a MV |
278 | |
279 | #define SCM_MAKINUM(x) scm_i_makinum(x) | |
280 | #define SCM_INUM(x) scm_i_inum(x) | |
281 | #define SCM_INUMP(x) scm_i_inump(x) | |
282 | #define SCM_NINUMP(x) (!SCM_INUMP(x)) | |
3aa13a05 | 283 | |
8805b77d MV |
284 | #define SCM_VALIDATE_INUM(pos, k) SCM_MAKE_VALIDATE_MSG (pos, k, INUMP, "exact integer") |
285 | ||
286 | #define SCM_VALIDATE_INUM_COPY(pos, k, cvar) \ | |
287 | do { \ | |
3aa13a05 MV |
288 | SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \ |
289 | cvar = SCM_I_INUM (k); \ | |
8805b77d MV |
290 | } while (0) |
291 | ||
292 | #define SCM_VALIDATE_BIGINT(pos, k) SCM_MAKE_VALIDATE_MSG (pos, k, BIGP, "bignum") | |
293 | ||
294 | #define SCM_VALIDATE_INUM_MIN(pos, k, min) \ | |
295 | do { \ | |
3aa13a05 MV |
296 | SCM_ASSERT (SCM_I_INUMP(k), k, pos, FUNC_NAME); \ |
297 | SCM_ASSERT_RANGE (pos, k, (SCM_I_INUM (k) >= min)); \ | |
8805b77d MV |
298 | } while (0) |
299 | ||
300 | #define SCM_VALIDATE_INUM_MIN_COPY(pos, k, min, cvar) \ | |
301 | do { \ | |
3aa13a05 MV |
302 | SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \ |
303 | SCM_ASSERT_RANGE (pos, k, (SCM_I_INUM (k) >= min)); \ | |
8805b77d MV |
304 | cvar = SCM_INUM (k); \ |
305 | } while (0) | |
306 | ||
307 | #define SCM_VALIDATE_INUM_MIN_DEF_COPY(pos, k, min, default, cvar) \ | |
308 | do { \ | |
309 | if (SCM_UNBNDP (k)) \ | |
310 | k = SCM_I_MAKINUM (default); \ | |
3aa13a05 MV |
311 | SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \ |
312 | SCM_ASSERT_RANGE (pos, k, (SCM_I_INUM (k) >= min)); \ | |
8805b77d MV |
313 | cvar = SCM_INUM (k); \ |
314 | } while (0) | |
315 | ||
316 | #define SCM_VALIDATE_INUM_DEF(pos, k, default) \ | |
317 | do { \ | |
318 | if (SCM_UNBNDP (k)) \ | |
319 | k = SCM_I_MAKINUM (default); \ | |
3aa13a05 | 320 | else SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \ |
8805b77d MV |
321 | } while (0) |
322 | ||
323 | #define SCM_VALIDATE_INUM_DEF_COPY(pos, k, default, cvar) \ | |
324 | do { \ | |
325 | if (SCM_UNBNDP (k)) \ | |
326 | { \ | |
327 | k = SCM_I_MAKINUM (default); \ | |
328 | cvar = default; \ | |
329 | } \ | |
330 | else \ | |
331 | { \ | |
3aa13a05 | 332 | SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \ |
8805b77d MV |
333 | cvar = SCM_INUM (k); \ |
334 | } \ | |
335 | } while (0) | |
336 | ||
337 | /* [low, high) */ | |
338 | #define SCM_VALIDATE_INUM_RANGE(pos, k, low, high) \ | |
3aa13a05 | 339 | do { SCM_ASSERT(SCM_I_INUMP(k), k, pos, FUNC_NAME); \ |
8805b77d | 340 | SCM_ASSERT_RANGE(pos, k, \ |
3aa13a05 MV |
341 | (SCM_I_INUM (k) >= low && \ |
342 | SCM_I_INUM (k) < high)); \ | |
8805b77d MV |
343 | } while (0) |
344 | ||
345 | #define SCM_VALIDATE_INUM_RANGE_COPY(pos, k, low, high, cvar) \ | |
346 | do { \ | |
347 | SCM_ASSERT (SCM_INUMP (k), k, pos, FUNC_NAME); \ | |
348 | SCM_ASSERT_RANGE (pos, k, low <= SCM_INUM (k) && SCM_INUM (k) < high); \ | |
349 | cvar = SCM_INUM (k); \ | |
350 | } while (0) | |
351 | ||
c829a427 MV |
352 | #define SCM_STRING_COERCE_0TERMINATION_X(x) (x) |
353 | ||
354 | /* XXX - buggy interface, STR might not be large enough. | |
355 | ||
356 | Converts the given Scheme string OBJ into a C string, containing a copy | |
357 | of OBJ's content with a trailing null byte. If LENP is non-NULL, set | |
358 | *LENP to the string's length. | |
359 | ||
360 | When STR is non-NULL it receives the copy and is returned by the function, | |
361 | otherwise new memory is allocated and the caller is responsible for | |
362 | freeing it via free(). If out of memory, NULL is returned. | |
363 | ||
364 | Note that Scheme strings may contain arbitrary data, including null | |
365 | characters. This means that null termination is not a reliable way to | |
366 | determine the length of the returned value. However, the function always | |
367 | copies the complete contents of OBJ, and sets *LENP to the length of the | |
368 | scheme string (if LENP is non-null). | |
369 | */ | |
0eb934f1 | 370 | SCM_DEPRECATED char *scm_c_string2str (SCM obj, char *str, size_t *lenp); |
c829a427 MV |
371 | |
372 | /* XXX - buggy interface, you don't know how many bytes have been copied. | |
373 | ||
374 | Copy LEN characters at START from the Scheme string OBJ to memory | |
375 | at STR. START is an index into OBJ; zero means the beginning of | |
376 | the string. STR has already been allocated by the caller. | |
377 | ||
378 | If START + LEN is off the end of OBJ, silently truncate the source | |
379 | region to fit the string. If truncation occurs, the corresponding | |
380 | area of STR is left unchanged. | |
381 | */ | |
0eb934f1 | 382 | SCM_DEPRECATED char *scm_c_substring2str (SCM obj, char *str, size_t start, size_t len); |
8805b77d | 383 | |
0eb934f1 | 384 | SCM_DEPRECATED char *scm_c_symbol2str (SCM obj, char *str, size_t *lenp); |
3ee86942 | 385 | |
3101f40f MV |
386 | /* Deprecated because the names belong to what is now |
387 | scm_truncate_number and scm_round_number. | |
388 | */ | |
0eb934f1 LC |
389 | SCM_DEPRECATED double scm_truncate (double x); |
390 | SCM_DEPRECATED double scm_round (double x); | |
6fc4d012 AW |
391 | /* Deprecated, use scm_expt */ |
392 | SCM_DEPRECATED SCM scm_sys_expt (SCM x, SCM y); | |
3101f40f | 393 | |
ad79736c AW |
394 | /* if your platform doesn't have asinh et al */ |
395 | SCM_API double scm_asinh (double x); | |
396 | SCM_API double scm_acosh (double x); | |
397 | SCM_API double scm_atanh (double x); | |
398 | SCM_API SCM scm_sys_atan2 (SCM z1, SCM z2); | |
399 | ||
6f14f578 MV |
400 | /* Deprecated because we don't want people to access the internal |
401 | representation of strings directly. | |
402 | */ | |
403 | ||
404 | #define SCM_VALIDATE_STRING_COPY(pos, str, cvar) \ | |
405 | do { \ | |
406 | SCM_ASSERT (SCM_STRINGP (str), str, pos, FUNC_NAME); \ | |
407 | cvar = SCM_STRING_CHARS(str); \ | |
408 | } while (0) | |
409 | ||
410 | /* validate a string and optional start/end arguments which default to | |
411 | 0/string-len. this is unrelated to the old shared substring | |
412 | support, so please do not deprecate it :) */ | |
413 | #define SCM_VALIDATE_SUBSTRING_SPEC_COPY(pos_str, str, c_str, \ | |
414 | pos_start, start, c_start,\ | |
415 | pos_end, end, c_end) \ | |
416 | do {\ | |
417 | SCM_VALIDATE_STRING_COPY (pos_str, str, c_str);\ | |
418 | c_start = SCM_UNBNDP(start)? 0 : scm_to_size_t (start);\ | |
419 | c_end = SCM_UNBNDP(end)? SCM_STRING_LENGTH(str) : scm_to_size_t (end);\ | |
420 | SCM_ASSERT_RANGE (pos_start, start,\ | |
421 | 0 <= c_start \ | |
422 | && (size_t) c_start <= SCM_STRING_LENGTH (str));\ | |
423 | SCM_ASSERT_RANGE (pos_end, end,\ | |
424 | c_start <= c_end \ | |
425 | && (size_t) c_end <= SCM_STRING_LENGTH (str));\ | |
426 | } while (0) | |
427 | ||
3ee86942 MV |
428 | /* Deprecated because we don't want people to access the internals of |
429 | symbols directly. | |
430 | */ | |
431 | ||
0eb934f1 LC |
432 | SCM_DEPRECATED char *scm_i_deprecated_symbol_chars (SCM sym); |
433 | SCM_DEPRECATED size_t scm_i_deprecated_symbol_length (SCM sym); | |
fe78c51a MV |
434 | |
435 | #define SCM_SYMBOL_CHARS(x) scm_i_deprecated_symbol_chars(x) | |
436 | #define SCM_SYMBOL_LENGTH(x) scm_i_deprecated_symbol_length(x) | |
6f14f578 | 437 | |
265a7997 MV |
438 | /* Deprecated because the macros used to evaluate the arguments more |
439 | than once and because the symbol of a keyword now has no dash. | |
440 | */ | |
441 | ||
0eb934f1 LC |
442 | SCM_DEPRECATED int scm_i_keywordp (SCM obj); |
443 | SCM_DEPRECATED SCM scm_i_keywordsym (SCM keyword); | |
fe78c51a MV |
444 | |
445 | #define SCM_KEYWORDP(x) scm_i_keywordp(x) | |
446 | #define SCM_KEYWORDSYM(x) scm_i_keywordsym(x) | |
265a7997 | 447 | |
354116f7 MV |
448 | /* Deprecated because we don't want to hand out unprotected pointers |
449 | to arrays, vectors, etc. */ | |
450 | ||
451 | #define SCM_VECTOR_MAX_LENGTH ((1L << 24) - 1) | |
452 | ||
0eb934f1 LC |
453 | SCM_DEPRECATED int scm_i_vectorp (SCM x); |
454 | SCM_DEPRECATED unsigned long scm_i_vector_length (SCM x); | |
455 | SCM_DEPRECATED const SCM *scm_i_velts (SCM x); | |
456 | SCM_DEPRECATED SCM *scm_i_writable_velts (SCM x); | |
457 | SCM_DEPRECATED SCM scm_i_vector_ref (SCM x, size_t idx); | |
458 | SCM_DEPRECATED void scm_i_vector_set (SCM x, size_t idx, SCM val); | |
459 | SCM_DEPRECATED SCM scm_vector_equal_p (SCM x, SCM y); | |
265a7997 | 460 | |
fe78c51a MV |
461 | #define SCM_VECTORP(x) scm_i_vectorp(x) |
462 | #define SCM_VECTOR_LENGTH(x) scm_i_vector_length(x) | |
463 | #define SCM_VELTS(x) scm_i_velts(x) | |
464 | #define SCM_WRITABLE_VELTS(x) scm_i_writable_velts(x) | |
465 | #define SCM_VECTOR_REF(x,y) scm_i_vector_ref(x,y) | |
466 | #define SCM_VECTOR_SET(x,y,z) scm_i_vector_set(x,y,z) | |
1f366ef7 | 467 | |
fe78c51a | 468 | typedef scm_i_t_array scm_t_array; |
1f366ef7 | 469 | |
0eb934f1 LC |
470 | SCM_DEPRECATED int scm_i_arrayp (SCM a); |
471 | SCM_DEPRECATED size_t scm_i_array_ndim (SCM a); | |
472 | SCM_DEPRECATED int scm_i_array_contp (SCM a); | |
473 | SCM_DEPRECATED scm_t_array *scm_i_array_mem (SCM a); | |
474 | SCM_DEPRECATED SCM scm_i_array_v (SCM a); | |
475 | SCM_DEPRECATED size_t scm_i_array_base (SCM a); | |
476 | SCM_DEPRECATED scm_t_array_dim *scm_i_array_dims (SCM a); | |
fe78c51a MV |
477 | |
478 | #define SCM_ARRAYP(a) scm_i_arrayp(a) | |
479 | #define SCM_ARRAY_NDIM(a) scm_i_array_ndim(a) | |
480 | #define SCM_ARRAY_CONTP(a) scm_i_array_contp(a) | |
481 | #define SCM_ARRAY_MEM(a) scm_i_array_mem(a) | |
482 | #define SCM_ARRAY_V(a) scm_i_array_v(a) | |
483 | #define SCM_ARRAY_BASE(a) scm_i_array_base(a) | |
9cc49060 | 484 | #define SCM_ARRAY_DIMS(a) scm_i_array_dims(a) |
1f366ef7 | 485 | |
73d1aaaf LC |
486 | SCM_DEPRECATED SCM scm_uniform_vector_read_x (SCM v, SCM port_or_fd, |
487 | SCM start, SCM end); | |
488 | SCM_DEPRECATED SCM scm_uniform_vector_write (SCM v, SCM port_or_fd, | |
489 | SCM start, SCM end); | |
490 | SCM_DEPRECATED SCM scm_uniform_array_read_x (SCM ra, SCM port_or_fd, | |
491 | SCM start, SCM end); | |
492 | SCM_DEPRECATED SCM scm_uniform_array_write (SCM v, SCM port_or_fd, | |
493 | SCM start, SCM end); | |
a2689737 | 494 | |
9de87eea MV |
495 | /* Deprecated because they should not be lvalues and we want people to |
496 | use the official interfaces. | |
497 | */ | |
498 | ||
499 | #define scm_cur_inp scm_i_cur_inp () | |
500 | #define scm_cur_outp scm_i_cur_outp () | |
501 | #define scm_cur_errp scm_i_cur_errp () | |
502 | #define scm_cur_loadp scm_i_cur_loadp () | |
503 | #define scm_progargs scm_i_progargs () | |
504 | #define scm_dynwinds scm_i_deprecated_dynwinds () | |
9de87eea MV |
505 | #define scm_stack_base scm_i_stack_base () |
506 | ||
0eb934f1 LC |
507 | SCM_DEPRECATED SCM scm_i_cur_inp (void); |
508 | SCM_DEPRECATED SCM scm_i_cur_outp (void); | |
509 | SCM_DEPRECATED SCM scm_i_cur_errp (void); | |
510 | SCM_DEPRECATED SCM scm_i_cur_loadp (void); | |
511 | SCM_DEPRECATED SCM scm_i_progargs (void); | |
512 | SCM_DEPRECATED SCM scm_i_deprecated_dynwinds (void); | |
0eb934f1 | 513 | SCM_DEPRECATED SCM_STACKITEM *scm_i_stack_base (void); |
9de87eea MV |
514 | |
515 | /* Deprecated because it evaluates its argument twice. | |
516 | */ | |
517 | #define SCM_FLUIDP(x) scm_i_fluidp (x) | |
0eb934f1 | 518 | SCM_DEPRECATED int scm_i_fluidp (SCM x); |
9de87eea | 519 | |
3452e666 LC |
520 | /* Deprecated in Guile 1.9.5 on 2009-11-15 because these are IPv4-only |
521 | functions which are deprecated upstream. */ | |
522 | ||
523 | SCM_DEPRECATED SCM scm_inet_aton (SCM address); | |
524 | SCM_DEPRECATED SCM scm_inet_ntoa (SCM inetid); | |
525 | ||
06c1d900 MV |
526 | /* In the old days, SCM_CRITICAL_SECTION_START stopped signal handlers |
527 | from running, since in those days the handler directly ran scheme | |
528 | code, and that had to be avoided when the heap was not in a | |
529 | consistent state etc. And since the scheme code could do a stack | |
530 | swapping new continuation etc, signals had to be deferred around | |
531 | various C library functions which were not safe or not known to be | |
532 | safe to swap away, which was a lot of stuff. | |
533 | ||
534 | These days signals are implemented with asyncs and don't directly | |
535 | run scheme code in the handler, but hold it until an SCM_TICK etc | |
536 | where it will be safe. This means interrupt protection is not | |
537 | needed and SCM_CRITICAL_SECTION_START / SCM_CRITICAL_SECTION_END is | |
538 | something of an anachronism. | |
539 | ||
540 | What past SCM_CRITICAL_SECTION_START usage also did though was | |
541 | indicate code that was not reentrant, ie. could not be reentered by | |
542 | signal handler code. The present definitions are a mutex lock, | |
543 | affording that reentrancy protection against the new guile 1.8 | |
544 | free-running posix threads. | |
9de87eea MV |
545 | |
546 | One big problem with the present defintions though is that code which | |
547 | throws an error from within a DEFER/ALLOW region will leave the | |
548 | defer_mutex locked and hence hang other threads that attempt to enter a | |
549 | similar DEFER/ALLOW region. | |
550 | */ | |
551 | ||
0eb934f1 | 552 | SCM_DEPRECATED void scm_i_defer_ints_etc (void); |
9de87eea MV |
553 | #define SCM_DEFER_INTS scm_i_defer_ints_etc () |
554 | #define SCM_ALLOW_INTS scm_i_defer_ints_etc () | |
555 | #define SCM_REDEFER_INTS scm_i_defer_ints_etc () | |
556 | #define SCM_REALLOW_INTS scm_i_defer_ints_etc () | |
557 | ||
b8ec9dab LC |
558 | /* In the old days (pre-1.8), this macro was sometimes used as an lvalue as |
559 | in "scm_mask_ints = 1" to block async execution. It no longer works. */ | |
560 | #define scm_mask_ints (scm_i_mask_ints ()) | |
561 | ||
562 | SCM_DEPRECATED int scm_i_mask_ints (void); | |
563 | ||
06c1d900 MV |
564 | /* Deprecated since they are unnecessary and had not been documented. |
565 | */ | |
0eb934f1 LC |
566 | SCM_DEPRECATED SCM scm_guard (SCM guardian, SCM obj, int throw_p); |
567 | SCM_DEPRECATED SCM scm_get_one_zombie (SCM guardian); | |
06c1d900 MV |
568 | |
569 | /* Deprecated since guardians no longer have these special features. | |
570 | */ | |
0eb934f1 LC |
571 | SCM_DEPRECATED SCM scm_destroy_guardian_x (SCM guardian); |
572 | SCM_DEPRECATED SCM scm_guardian_greedy_p (SCM guardian); | |
573 | SCM_DEPRECATED SCM scm_guardian_destroyed_p (SCM guardian); | |
06c1d900 | 574 | |
760fb97d LC |
575 | \f |
576 | /* GC-related things deprecated with the move to BDW-GC starting from 1.9.3 | |
577 | (2009-09-15). */ | |
578 | ||
0eb934f1 LC |
579 | SCM_DEPRECATED unsigned long scm_mallocated; |
580 | SCM_DEPRECATED unsigned long scm_mtrigger; | |
760fb97d | 581 | |
0eb934f1 | 582 | SCM_DEPRECATED size_t scm_max_segment_size; |
760fb97d LC |
583 | |
584 | #if defined (GUILE_DEBUG) || defined (GUILE_DEBUG_FREELIST) | |
0eb934f1 | 585 | SCM_DEPRECATED SCM scm_map_free_list (void); |
760fb97d LC |
586 | #endif |
587 | ||
588 | #if defined (GUILE_DEBUG_FREELIST) | |
0eb934f1 | 589 | SCM_DEPRECATED SCM scm_gc_set_debug_check_freelist_x (SCM flag); |
760fb97d LC |
590 | #endif |
591 | ||
a3e92377 AW |
592 | \f |
593 | ||
594 | /* Deprecated 2009-11-27, scm_call_N is sufficient */ | |
595 | SCM_DEPRECATED scm_t_trampoline_0 scm_trampoline_0 (SCM proc); | |
596 | SCM_DEPRECATED scm_t_trampoline_1 scm_trampoline_1 (SCM proc); | |
597 | SCM_DEPRECATED scm_t_trampoline_2 scm_trampoline_2 (SCM proc); | |
760fb97d LC |
598 | |
599 | \f | |
ea68d342 AW |
600 | |
601 | /* Deprecated 2009-12-06, use the procedures instead */ | |
602 | #define SCM_PROCEDURE_WITH_SETTER_P(obj) (scm_is_true (scm_procedure_with_setter_p (obj))) | |
603 | #define SCM_PROCEDURE(obj) SCM_STRUCT_PROCEDURE (obj, 0) | |
604 | #define SCM_SETTER(obj) SCM_STRUCT_SETTER (obj, 1) | |
605 | ||
606 | \f | |
607 | ||
9fdf9fd3 | 608 | /* Deprecated 2010-01-05, use SCM_PRIMITIVE_P instead */ |
97812f4d AW |
609 | SCM_DEPRECATED int scm_i_subr_p (SCM x); |
610 | #define scm_subr_p(x) (scm_i_subr_p (x)) | |
9fdf9fd3 AW |
611 | |
612 | \f | |
613 | ||
55d30fac | 614 | void scm_i_init_deprecated (void); |
19e2247d | 615 | |
55d30fac | 616 | #endif |
19e2247d | 617 | |
55d30fac | 618 | #endif /* SCM_DEPRECATED_H */ |