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