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 | ||
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" |
a3e92377 | 29 | #include "libguile/eval.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_make_subr (const char *name, int type, SCM (*fcn) ()); |
176 | SCM_DEPRECATED SCM scm_make_subr_with_generic (const char *name, | |
177 | int type, | |
178 | SCM (*fcn) (), | |
179 | SCM *gf); | |
180 | SCM_DEPRECATED SCM scm_make_subr_opt (const char *name, | |
181 | int type, | |
182 | SCM (*fcn) (), | |
183 | int set); | |
4abecea8 | 184 | |
0eb934f1 LC |
185 | SCM_DEPRECATED SCM scm_call_catching_errors (SCM (*thunk)(), SCM (*err_filter)(), |
186 | void * closure); | |
4abecea8 | 187 | |
0eb934f1 LC |
188 | SCM_DEPRECATED long scm_make_smob_type_mfpe (char *name, size_t size, |
189 | SCM (*mark) (SCM), | |
190 | size_t (*free) (SCM), | |
191 | int (*print) (SCM, SCM, | |
192 | scm_print_state*), | |
193 | SCM (*equalp) (SCM, SCM)); | |
4abecea8 | 194 | |
0eb934f1 LC |
195 | SCM_DEPRECATED void scm_set_smob_mfpe (long tc, |
196 | SCM (*mark) (SCM), | |
197 | size_t (*free) (SCM), | |
198 | int (*print) (SCM, SCM, scm_print_state*), | |
199 | SCM (*equalp) (SCM, SCM)); | |
4abecea8 | 200 | |
0eb934f1 | 201 | SCM_DEPRECATED size_t scm_smob_free (SCM obj); |
3051344b | 202 | |
0eb934f1 LC |
203 | SCM_DEPRECATED SCM scm_strprint_obj (SCM obj); |
204 | SCM_DEPRECATED SCM scm_read_0str (char *expr); | |
205 | SCM_DEPRECATED SCM scm_eval_0str (const char *expr); | |
4abecea8 | 206 | |
0eb934f1 | 207 | SCM_DEPRECATED char *scm_i_object_chars (SCM); |
a725fa95 MV |
208 | |
209 | #define SCM_CHARS(x) scm_i_object_chars(x) | |
210 | #define SCM_UCHARS(x) ((unsigned char *)SCM_CHARS(x)) | |
211 | ||
0eb934f1 | 212 | SCM_DEPRECATED long scm_i_object_length (SCM); |
a725fa95 MV |
213 | |
214 | #define SCM_LENGTH(x) scm_i_object_length(x) | |
215 | ||
cc5c1b66 MV |
216 | #define scm_strhash(str, len, n) (scm_string_hash ((str), (len)) % (n)) |
217 | ||
0eb934f1 LC |
218 | SCM_DEPRECATED SCM scm_sym2ovcell_soft (SCM sym, SCM obarray); |
219 | SCM_DEPRECATED SCM scm_sym2ovcell (SCM sym, SCM obarray); | |
220 | SCM_DEPRECATED SCM scm_intern_obarray_soft (const char *name, size_t len, | |
cc5c1b66 | 221 | SCM obarray, unsigned int softness); |
0eb934f1 LC |
222 | SCM_DEPRECATED SCM scm_intern_obarray (const char *name, size_t len, SCM obarray); |
223 | SCM_DEPRECATED SCM scm_symbol_value0 (const char *name); | |
cc5c1b66 | 224 | |
0eb934f1 LC |
225 | SCM_DEPRECATED SCM scm_string_to_obarray_symbol (SCM o, SCM s, SCM softp); |
226 | SCM_DEPRECATED SCM scm_intern_symbol (SCM o, SCM s); | |
227 | SCM_DEPRECATED SCM scm_unintern_symbol (SCM o, SCM s); | |
228 | SCM_DEPRECATED SCM scm_symbol_binding (SCM o, SCM s); | |
cc5c1b66 MV |
229 | #if 0 |
230 | /* This name has been reused for real uninterned symbols. */ | |
0eb934f1 | 231 | SCM_DEPRECATED SCM scm_symbol_interned_p (SCM o, SCM s); |
cc5c1b66 | 232 | #endif |
0eb934f1 LC |
233 | SCM_DEPRECATED SCM scm_symbol_bound_p (SCM o, SCM s); |
234 | SCM_DEPRECATED SCM scm_symbol_set_x (SCM o, SCM s, SCM v); | |
cc5c1b66 | 235 | |
0eb934f1 | 236 | SCM_DEPRECATED SCM scm_gentemp (SCM prefix, SCM obarray); |
cc5c1b66 | 237 | |
8de7acbd MV |
238 | #define SCM_OPDIRP(x) (SCM_DIRP (x) && (SCM_DIR_OPEN_P (x))) |
239 | #define scm_fport scm_t_fport | |
240 | #define scm_option scm_t_option | |
241 | #define scm_srcprops scm_t_srcprops | |
242 | #define scm_srcprops_chunk scm_t_srcprops_chunk | |
8de7acbd MV |
243 | #define scm_array scm_t_array |
244 | #define scm_array_dim scm_t_array_dim | |
245 | #define SCM_ARRAY_CONTIGUOUS SCM_ARRAY_FLAG_CONTIGUOUS | |
246 | #define SCM_FUNC_NAME (scm_makfrom0str (FUNC_NAME)) | |
247 | ||
248 | #define SCM_WTA(pos, scm) \ | |
249 | do { scm_wta (scm, (char *) pos, FUNC_NAME); } while (0) | |
250 | ||
251 | #define RETURN_SCM_WTA(pos, scm) \ | |
252 | do { return scm_wta (scm, (char *) pos, FUNC_NAME); } while (0) | |
253 | ||
254 | #define SCM_VALIDATE_NUMBER_COPY(pos, z, cvar) \ | |
255 | do { \ | |
3aa13a05 MV |
256 | if (SCM_I_INUMP (z)) \ |
257 | cvar = (double) SCM_I_INUM (z); \ | |
8de7acbd MV |
258 | else if (SCM_REALP (z)) \ |
259 | cvar = SCM_REAL_VALUE (z); \ | |
260 | else if (SCM_BIGP (z)) \ | |
261 | cvar = scm_i_big2dbl (z); \ | |
262 | else \ | |
263 | { \ | |
264 | cvar = 0.0; \ | |
265 | SCM_WRONG_TYPE_ARG (pos, z); \ | |
266 | } \ | |
267 | } while (0) | |
268 | ||
269 | #define SCM_VALIDATE_NUMBER_DEF_COPY(pos, number, def, cvar) \ | |
270 | do { \ | |
271 | if (SCM_UNBNDP (number)) \ | |
272 | cvar = def; \ | |
273 | else \ | |
274 | SCM_VALIDATE_NUMBER_COPY(pos, number, cvar); \ | |
275 | } while (0) | |
276 | ||
277 | #define SCM_VALIDATE_OPDIR(pos, port) SCM_MAKE_VALIDATE (pos, port, OPDIRP) | |
278 | ||
41a2f6fc MV |
279 | /* Deprecated because we can not safely cast a SCM* to a scm_t_bits* |
280 | */ | |
281 | ||
282 | #define SCM_CELL_WORD_LOC(x, n) ((scm_t_bits*)SCM_CELL_OBJECT_LOC((x),(n))) | |
283 | ||
8805b77d MV |
284 | /* Users shouldn't know about INUMs. |
285 | */ | |
286 | ||
0eb934f1 LC |
287 | SCM_DEPRECATED SCM scm_i_makinum (scm_t_signed_bits val); |
288 | SCM_DEPRECATED int scm_i_inump (SCM obj); | |
289 | SCM_DEPRECATED scm_t_signed_bits scm_i_inum (SCM obj); | |
fe78c51a MV |
290 | |
291 | #define SCM_MAKINUM(x) scm_i_makinum(x) | |
292 | #define SCM_INUM(x) scm_i_inum(x) | |
293 | #define SCM_INUMP(x) scm_i_inump(x) | |
294 | #define SCM_NINUMP(x) (!SCM_INUMP(x)) | |
3aa13a05 | 295 | |
8805b77d MV |
296 | #define SCM_VALIDATE_INUM(pos, k) SCM_MAKE_VALIDATE_MSG (pos, k, INUMP, "exact integer") |
297 | ||
298 | #define SCM_VALIDATE_INUM_COPY(pos, k, cvar) \ | |
299 | do { \ | |
3aa13a05 MV |
300 | SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \ |
301 | cvar = SCM_I_INUM (k); \ | |
8805b77d MV |
302 | } while (0) |
303 | ||
304 | #define SCM_VALIDATE_BIGINT(pos, k) SCM_MAKE_VALIDATE_MSG (pos, k, BIGP, "bignum") | |
305 | ||
306 | #define SCM_VALIDATE_INUM_MIN(pos, k, min) \ | |
307 | do { \ | |
3aa13a05 MV |
308 | SCM_ASSERT (SCM_I_INUMP(k), k, pos, FUNC_NAME); \ |
309 | SCM_ASSERT_RANGE (pos, k, (SCM_I_INUM (k) >= min)); \ | |
8805b77d MV |
310 | } while (0) |
311 | ||
312 | #define SCM_VALIDATE_INUM_MIN_COPY(pos, k, min, cvar) \ | |
313 | do { \ | |
3aa13a05 MV |
314 | SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \ |
315 | SCM_ASSERT_RANGE (pos, k, (SCM_I_INUM (k) >= min)); \ | |
8805b77d MV |
316 | cvar = SCM_INUM (k); \ |
317 | } while (0) | |
318 | ||
319 | #define SCM_VALIDATE_INUM_MIN_DEF_COPY(pos, k, min, default, cvar) \ | |
320 | do { \ | |
321 | if (SCM_UNBNDP (k)) \ | |
322 | k = SCM_I_MAKINUM (default); \ | |
3aa13a05 MV |
323 | SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \ |
324 | SCM_ASSERT_RANGE (pos, k, (SCM_I_INUM (k) >= min)); \ | |
8805b77d MV |
325 | cvar = SCM_INUM (k); \ |
326 | } while (0) | |
327 | ||
328 | #define SCM_VALIDATE_INUM_DEF(pos, k, default) \ | |
329 | do { \ | |
330 | if (SCM_UNBNDP (k)) \ | |
331 | k = SCM_I_MAKINUM (default); \ | |
3aa13a05 | 332 | else SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \ |
8805b77d MV |
333 | } while (0) |
334 | ||
335 | #define SCM_VALIDATE_INUM_DEF_COPY(pos, k, default, cvar) \ | |
336 | do { \ | |
337 | if (SCM_UNBNDP (k)) \ | |
338 | { \ | |
339 | k = SCM_I_MAKINUM (default); \ | |
340 | cvar = default; \ | |
341 | } \ | |
342 | else \ | |
343 | { \ | |
3aa13a05 | 344 | SCM_ASSERT (SCM_I_INUMP (k), k, pos, FUNC_NAME); \ |
8805b77d MV |
345 | cvar = SCM_INUM (k); \ |
346 | } \ | |
347 | } while (0) | |
348 | ||
349 | /* [low, high) */ | |
350 | #define SCM_VALIDATE_INUM_RANGE(pos, k, low, high) \ | |
3aa13a05 | 351 | do { SCM_ASSERT(SCM_I_INUMP(k), k, pos, FUNC_NAME); \ |
8805b77d | 352 | SCM_ASSERT_RANGE(pos, k, \ |
3aa13a05 MV |
353 | (SCM_I_INUM (k) >= low && \ |
354 | SCM_I_INUM (k) < high)); \ | |
8805b77d MV |
355 | } while (0) |
356 | ||
357 | #define SCM_VALIDATE_INUM_RANGE_COPY(pos, k, low, high, cvar) \ | |
358 | do { \ | |
359 | SCM_ASSERT (SCM_INUMP (k), k, pos, FUNC_NAME); \ | |
360 | SCM_ASSERT_RANGE (pos, k, low <= SCM_INUM (k) && SCM_INUM (k) < high); \ | |
361 | cvar = SCM_INUM (k); \ | |
362 | } while (0) | |
363 | ||
c829a427 MV |
364 | #define SCM_STRING_COERCE_0TERMINATION_X(x) (x) |
365 | ||
366 | /* XXX - buggy interface, STR might not be large enough. | |
367 | ||
368 | Converts the given Scheme string OBJ into a C string, containing a copy | |
369 | of OBJ's content with a trailing null byte. If LENP is non-NULL, set | |
370 | *LENP to the string's length. | |
371 | ||
372 | When STR is non-NULL it receives the copy and is returned by the function, | |
373 | otherwise new memory is allocated and the caller is responsible for | |
374 | freeing it via free(). If out of memory, NULL is returned. | |
375 | ||
376 | Note that Scheme strings may contain arbitrary data, including null | |
377 | characters. This means that null termination is not a reliable way to | |
378 | determine the length of the returned value. However, the function always | |
379 | copies the complete contents of OBJ, and sets *LENP to the length of the | |
380 | scheme string (if LENP is non-null). | |
381 | */ | |
0eb934f1 | 382 | SCM_DEPRECATED char *scm_c_string2str (SCM obj, char *str, size_t *lenp); |
c829a427 MV |
383 | |
384 | /* XXX - buggy interface, you don't know how many bytes have been copied. | |
385 | ||
386 | Copy LEN characters at START from the Scheme string OBJ to memory | |
387 | at STR. START is an index into OBJ; zero means the beginning of | |
388 | the string. STR has already been allocated by the caller. | |
389 | ||
390 | If START + LEN is off the end of OBJ, silently truncate the source | |
391 | region to fit the string. If truncation occurs, the corresponding | |
392 | area of STR is left unchanged. | |
393 | */ | |
0eb934f1 | 394 | SCM_DEPRECATED char *scm_c_substring2str (SCM obj, char *str, size_t start, size_t len); |
8805b77d | 395 | |
0eb934f1 | 396 | SCM_DEPRECATED char *scm_c_symbol2str (SCM obj, char *str, size_t *lenp); |
3ee86942 | 397 | |
3101f40f MV |
398 | /* Deprecated because the names belong to what is now |
399 | scm_truncate_number and scm_round_number. | |
400 | */ | |
0eb934f1 LC |
401 | SCM_DEPRECATED double scm_truncate (double x); |
402 | SCM_DEPRECATED double scm_round (double x); | |
6fc4d012 AW |
403 | /* Deprecated, use scm_expt */ |
404 | SCM_DEPRECATED SCM scm_sys_expt (SCM x, SCM y); | |
3101f40f | 405 | |
ad79736c AW |
406 | /* if your platform doesn't have asinh et al */ |
407 | SCM_API double scm_asinh (double x); | |
408 | SCM_API double scm_acosh (double x); | |
409 | SCM_API double scm_atanh (double x); | |
410 | SCM_API SCM scm_sys_atan2 (SCM z1, SCM z2); | |
411 | ||
6f14f578 MV |
412 | /* Deprecated because we don't want people to access the internal |
413 | representation of strings directly. | |
414 | */ | |
415 | ||
416 | #define SCM_VALIDATE_STRING_COPY(pos, str, cvar) \ | |
417 | do { \ | |
418 | SCM_ASSERT (SCM_STRINGP (str), str, pos, FUNC_NAME); \ | |
419 | cvar = SCM_STRING_CHARS(str); \ | |
420 | } while (0) | |
421 | ||
422 | /* validate a string and optional start/end arguments which default to | |
423 | 0/string-len. this is unrelated to the old shared substring | |
424 | support, so please do not deprecate it :) */ | |
425 | #define SCM_VALIDATE_SUBSTRING_SPEC_COPY(pos_str, str, c_str, \ | |
426 | pos_start, start, c_start,\ | |
427 | pos_end, end, c_end) \ | |
428 | do {\ | |
429 | SCM_VALIDATE_STRING_COPY (pos_str, str, c_str);\ | |
430 | c_start = SCM_UNBNDP(start)? 0 : scm_to_size_t (start);\ | |
431 | c_end = SCM_UNBNDP(end)? SCM_STRING_LENGTH(str) : scm_to_size_t (end);\ | |
432 | SCM_ASSERT_RANGE (pos_start, start,\ | |
433 | 0 <= c_start \ | |
434 | && (size_t) c_start <= SCM_STRING_LENGTH (str));\ | |
435 | SCM_ASSERT_RANGE (pos_end, end,\ | |
436 | c_start <= c_end \ | |
437 | && (size_t) c_end <= SCM_STRING_LENGTH (str));\ | |
438 | } while (0) | |
439 | ||
3ee86942 MV |
440 | /* Deprecated because we don't want people to access the internals of |
441 | symbols directly. | |
442 | */ | |
443 | ||
0eb934f1 LC |
444 | SCM_DEPRECATED char *scm_i_deprecated_symbol_chars (SCM sym); |
445 | SCM_DEPRECATED size_t scm_i_deprecated_symbol_length (SCM sym); | |
fe78c51a MV |
446 | |
447 | #define SCM_SYMBOL_CHARS(x) scm_i_deprecated_symbol_chars(x) | |
448 | #define SCM_SYMBOL_LENGTH(x) scm_i_deprecated_symbol_length(x) | |
6f14f578 | 449 | |
265a7997 MV |
450 | /* Deprecated because the macros used to evaluate the arguments more |
451 | than once and because the symbol of a keyword now has no dash. | |
452 | */ | |
453 | ||
0eb934f1 LC |
454 | SCM_DEPRECATED int scm_i_keywordp (SCM obj); |
455 | SCM_DEPRECATED SCM scm_i_keywordsym (SCM keyword); | |
fe78c51a MV |
456 | |
457 | #define SCM_KEYWORDP(x) scm_i_keywordp(x) | |
458 | #define SCM_KEYWORDSYM(x) scm_i_keywordsym(x) | |
265a7997 | 459 | |
354116f7 MV |
460 | /* Deprecated because we don't want to hand out unprotected pointers |
461 | to arrays, vectors, etc. */ | |
462 | ||
463 | #define SCM_VECTOR_MAX_LENGTH ((1L << 24) - 1) | |
464 | ||
0eb934f1 LC |
465 | SCM_DEPRECATED int scm_i_vectorp (SCM x); |
466 | SCM_DEPRECATED unsigned long scm_i_vector_length (SCM x); | |
467 | SCM_DEPRECATED const SCM *scm_i_velts (SCM x); | |
468 | SCM_DEPRECATED SCM *scm_i_writable_velts (SCM x); | |
469 | SCM_DEPRECATED SCM scm_i_vector_ref (SCM x, size_t idx); | |
470 | SCM_DEPRECATED void scm_i_vector_set (SCM x, size_t idx, SCM val); | |
471 | SCM_DEPRECATED SCM scm_vector_equal_p (SCM x, SCM y); | |
265a7997 | 472 | |
fe78c51a MV |
473 | #define SCM_VECTORP(x) scm_i_vectorp(x) |
474 | #define SCM_VECTOR_LENGTH(x) scm_i_vector_length(x) | |
475 | #define SCM_VELTS(x) scm_i_velts(x) | |
476 | #define SCM_WRITABLE_VELTS(x) scm_i_writable_velts(x) | |
477 | #define SCM_VECTOR_REF(x,y) scm_i_vector_ref(x,y) | |
478 | #define SCM_VECTOR_SET(x,y,z) scm_i_vector_set(x,y,z) | |
1f366ef7 | 479 | |
fe78c51a | 480 | typedef scm_i_t_array scm_t_array; |
1f366ef7 | 481 | |
0eb934f1 LC |
482 | SCM_DEPRECATED int scm_i_arrayp (SCM a); |
483 | SCM_DEPRECATED size_t scm_i_array_ndim (SCM a); | |
484 | SCM_DEPRECATED int scm_i_array_contp (SCM a); | |
485 | SCM_DEPRECATED scm_t_array *scm_i_array_mem (SCM a); | |
486 | SCM_DEPRECATED SCM scm_i_array_v (SCM a); | |
487 | SCM_DEPRECATED size_t scm_i_array_base (SCM a); | |
488 | SCM_DEPRECATED scm_t_array_dim *scm_i_array_dims (SCM a); | |
fe78c51a MV |
489 | |
490 | #define SCM_ARRAYP(a) scm_i_arrayp(a) | |
491 | #define SCM_ARRAY_NDIM(a) scm_i_array_ndim(a) | |
492 | #define SCM_ARRAY_CONTP(a) scm_i_array_contp(a) | |
493 | #define SCM_ARRAY_MEM(a) scm_i_array_mem(a) | |
494 | #define SCM_ARRAY_V(a) scm_i_array_v(a) | |
495 | #define SCM_ARRAY_BASE(a) scm_i_array_base(a) | |
9cc49060 | 496 | #define SCM_ARRAY_DIMS(a) scm_i_array_dims(a) |
1f366ef7 | 497 | |
9de87eea MV |
498 | /* Deprecated because they should not be lvalues and we want people to |
499 | use the official interfaces. | |
500 | */ | |
501 | ||
502 | #define scm_cur_inp scm_i_cur_inp () | |
503 | #define scm_cur_outp scm_i_cur_outp () | |
504 | #define scm_cur_errp scm_i_cur_errp () | |
505 | #define scm_cur_loadp scm_i_cur_loadp () | |
506 | #define scm_progargs scm_i_progargs () | |
507 | #define scm_dynwinds scm_i_deprecated_dynwinds () | |
9de87eea MV |
508 | #define scm_stack_base scm_i_stack_base () |
509 | ||
0eb934f1 LC |
510 | SCM_DEPRECATED SCM scm_i_cur_inp (void); |
511 | SCM_DEPRECATED SCM scm_i_cur_outp (void); | |
512 | SCM_DEPRECATED SCM scm_i_cur_errp (void); | |
513 | SCM_DEPRECATED SCM scm_i_cur_loadp (void); | |
514 | SCM_DEPRECATED SCM scm_i_progargs (void); | |
515 | SCM_DEPRECATED SCM scm_i_deprecated_dynwinds (void); | |
0eb934f1 | 516 | SCM_DEPRECATED SCM_STACKITEM *scm_i_stack_base (void); |
9de87eea MV |
517 | |
518 | /* Deprecated because it evaluates its argument twice. | |
519 | */ | |
520 | #define SCM_FLUIDP(x) scm_i_fluidp (x) | |
0eb934f1 | 521 | SCM_DEPRECATED int scm_i_fluidp (SCM x); |
9de87eea | 522 | |
3452e666 LC |
523 | /* Deprecated in Guile 1.9.5 on 2009-11-15 because these are IPv4-only |
524 | functions which are deprecated upstream. */ | |
525 | ||
526 | SCM_DEPRECATED SCM scm_inet_aton (SCM address); | |
527 | SCM_DEPRECATED SCM scm_inet_ntoa (SCM inetid); | |
528 | ||
06c1d900 MV |
529 | /* In the old days, SCM_CRITICAL_SECTION_START stopped signal handlers |
530 | from running, since in those days the handler directly ran scheme | |
531 | code, and that had to be avoided when the heap was not in a | |
532 | consistent state etc. And since the scheme code could do a stack | |
533 | swapping new continuation etc, signals had to be deferred around | |
534 | various C library functions which were not safe or not known to be | |
535 | safe to swap away, which was a lot of stuff. | |
536 | ||
537 | These days signals are implemented with asyncs and don't directly | |
538 | run scheme code in the handler, but hold it until an SCM_TICK etc | |
539 | where it will be safe. This means interrupt protection is not | |
540 | needed and SCM_CRITICAL_SECTION_START / SCM_CRITICAL_SECTION_END is | |
541 | something of an anachronism. | |
542 | ||
543 | What past SCM_CRITICAL_SECTION_START usage also did though was | |
544 | indicate code that was not reentrant, ie. could not be reentered by | |
545 | signal handler code. The present definitions are a mutex lock, | |
546 | affording that reentrancy protection against the new guile 1.8 | |
547 | free-running posix threads. | |
9de87eea MV |
548 | |
549 | One big problem with the present defintions though is that code which | |
550 | throws an error from within a DEFER/ALLOW region will leave the | |
551 | defer_mutex locked and hence hang other threads that attempt to enter a | |
552 | similar DEFER/ALLOW region. | |
553 | */ | |
554 | ||
0eb934f1 | 555 | SCM_DEPRECATED void scm_i_defer_ints_etc (void); |
9de87eea MV |
556 | #define SCM_DEFER_INTS scm_i_defer_ints_etc () |
557 | #define SCM_ALLOW_INTS scm_i_defer_ints_etc () | |
558 | #define SCM_REDEFER_INTS scm_i_defer_ints_etc () | |
559 | #define SCM_REALLOW_INTS scm_i_defer_ints_etc () | |
560 | ||
b8ec9dab LC |
561 | /* In the old days (pre-1.8), this macro was sometimes used as an lvalue as |
562 | in "scm_mask_ints = 1" to block async execution. It no longer works. */ | |
563 | #define scm_mask_ints (scm_i_mask_ints ()) | |
564 | ||
565 | SCM_DEPRECATED int scm_i_mask_ints (void); | |
566 | ||
06c1d900 MV |
567 | /* Deprecated since they are unnecessary and had not been documented. |
568 | */ | |
0eb934f1 LC |
569 | SCM_DEPRECATED SCM scm_guard (SCM guardian, SCM obj, int throw_p); |
570 | SCM_DEPRECATED SCM scm_get_one_zombie (SCM guardian); | |
06c1d900 MV |
571 | |
572 | /* Deprecated since guardians no longer have these special features. | |
573 | */ | |
0eb934f1 LC |
574 | SCM_DEPRECATED SCM scm_destroy_guardian_x (SCM guardian); |
575 | SCM_DEPRECATED SCM scm_guardian_greedy_p (SCM guardian); | |
576 | SCM_DEPRECATED SCM scm_guardian_destroyed_p (SCM guardian); | |
06c1d900 | 577 | |
760fb97d LC |
578 | \f |
579 | /* GC-related things deprecated with the move to BDW-GC starting from 1.9.3 | |
580 | (2009-09-15). */ | |
581 | ||
0eb934f1 LC |
582 | SCM_DEPRECATED unsigned long scm_mallocated; |
583 | SCM_DEPRECATED unsigned long scm_mtrigger; | |
760fb97d | 584 | |
0eb934f1 | 585 | SCM_DEPRECATED size_t scm_max_segment_size; |
760fb97d LC |
586 | |
587 | #if defined (GUILE_DEBUG) || defined (GUILE_DEBUG_FREELIST) | |
0eb934f1 | 588 | SCM_DEPRECATED SCM scm_map_free_list (void); |
760fb97d LC |
589 | #endif |
590 | ||
591 | #if defined (GUILE_DEBUG_FREELIST) | |
0eb934f1 | 592 | SCM_DEPRECATED SCM scm_gc_set_debug_check_freelist_x (SCM flag); |
760fb97d LC |
593 | #endif |
594 | ||
a3e92377 AW |
595 | \f |
596 | ||
597 | /* Deprecated 2009-11-27, scm_call_N is sufficient */ | |
598 | SCM_DEPRECATED scm_t_trampoline_0 scm_trampoline_0 (SCM proc); | |
599 | SCM_DEPRECATED scm_t_trampoline_1 scm_trampoline_1 (SCM proc); | |
600 | SCM_DEPRECATED scm_t_trampoline_2 scm_trampoline_2 (SCM proc); | |
760fb97d LC |
601 | |
602 | \f | |
55d30fac | 603 | void scm_i_init_deprecated (void); |
19e2247d | 604 | |
55d30fac | 605 | #endif |
19e2247d | 606 | |
55d30fac | 607 | #endif /* SCM_DEPRECATED_H */ |