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 | ||
760fb97d | 5 | /* Copyright (C) 2003, 2004, 2006, 2008, 2009 Free Software Foundation, Inc. |
19e2247d | 6 | * |
73be1d9e | 7 | * This library is free software; you can redistribute it and/or |
53befeb7 NJ |
8 | * modify it under the terms of the GNU Lesser General Public License |
9 | * as published by the Free Software Foundation; either version 3 of | |
10 | * the License, or (at your option) any later version. | |
19e2247d | 11 | * |
53befeb7 NJ |
12 | * This library is distributed in the hope that it will be useful, but |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
73be1d9e MV |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | * Lesser General Public License for more details. | |
19e2247d | 16 | * |
73be1d9e MV |
17 | * You should have received a copy of the GNU Lesser General Public |
18 | * License along with this library; if not, write to the Free Software | |
53befeb7 NJ |
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
20 | * 02110-1301 USA | |
73be1d9e | 21 | */ |
19e2247d | 22 | |
dbb605f5 LC |
23 | #ifdef HAVE_CONFIG_H |
24 | # include <config.h> | |
25 | #endif | |
26 | ||
0eb934f1 LC |
27 | #define SCM_BUILDING_DEPRECATED_CODE |
28 | ||
19e2247d | 29 | #include "libguile/_scm.h" |
4e047c3e | 30 | #include "libguile/async.h" |
19e2247d | 31 | #include "libguile/deprecated.h" |
db74ed03 | 32 | #include "libguile/discouraged.h" |
55d30fac | 33 | #include "libguile/deprecation.h" |
19e2247d MV |
34 | #include "libguile/snarf.h" |
35 | #include "libguile/validate.h" | |
36 | #include "libguile/strings.h" | |
c44ca4fe | 37 | #include "libguile/srfi-13.h" |
a0454d72 | 38 | #include "libguile/modules.h" |
1030b450 | 39 | #include "libguile/generalized-arrays.h" |
a0454d72 MV |
40 | #include "libguile/eval.h" |
41 | #include "libguile/smob.h" | |
42 | #include "libguile/procprop.h" | |
43 | #include "libguile/vectors.h" | |
44 | #include "libguile/hashtab.h" | |
45 | #include "libguile/struct.h" | |
46 | #include "libguile/variable.h" | |
47 | #include "libguile/fluids.h" | |
48 | #include "libguile/ports.h" | |
965445d4 MV |
49 | #include "libguile/eq.h" |
50 | #include "libguile/read.h" | |
4abecea8 MV |
51 | #include "libguile/strports.h" |
52 | #include "libguile/smob.h" | |
cc5c1b66 | 53 | #include "libguile/alist.h" |
db74ed03 | 54 | #include "libguile/keywords.h" |
3452e666 | 55 | #include "libguile/socket.h" |
9de87eea | 56 | #include "libguile/feature.h" |
19e2247d | 57 | |
ad79736c | 58 | #include <math.h> |
55d30fac MV |
59 | #include <stdio.h> |
60 | #include <string.h> | |
61 | ||
3452e666 LC |
62 | #include <arpa/inet.h> |
63 | ||
19e2247d MV |
64 | #if (SCM_ENABLE_DEPRECATED == 1) |
65 | ||
7e6e6b37 DH |
66 | /* From print.c: Internal symbol names of isyms. Deprecated in guile 1.7.0 on |
67 | * 2004-04-22. */ | |
68 | char *scm_isymnames[] = | |
69 | { | |
70 | "#@<deprecated>" | |
71 | }; | |
72 | ||
73 | ||
19e2247d MV |
74 | SCM_REGISTER_PROC(s_substring_move_left_x, "substring-move-left!", 5, 0, 0, scm_substring_move_x); |
75 | ||
76 | SCM_REGISTER_PROC(s_substring_move_right_x, "substring-move-right!", 5, 0, 0, scm_substring_move_x); | |
77 | ||
55d30fac MV |
78 | SCM |
79 | scm_wta (SCM arg, const char *pos, const char *s_subr) | |
80 | { | |
81 | if (!s_subr || !*s_subr) | |
82 | s_subr = NULL; | |
83 | if ((~0x1fL) & (long) pos) | |
84 | { | |
85 | /* error string supplied. */ | |
86 | scm_misc_error (s_subr, pos, scm_list_1 (arg)); | |
87 | } | |
88 | else | |
89 | { | |
90 | /* numerical error code. */ | |
91 | scm_t_bits error = (scm_t_bits) pos; | |
92 | ||
93 | switch (error) | |
94 | { | |
95 | case SCM_ARGn: | |
96 | scm_wrong_type_arg (s_subr, 0, arg); | |
97 | case SCM_ARG1: | |
98 | scm_wrong_type_arg (s_subr, 1, arg); | |
99 | case SCM_ARG2: | |
100 | scm_wrong_type_arg (s_subr, 2, arg); | |
101 | case SCM_ARG3: | |
102 | scm_wrong_type_arg (s_subr, 3, arg); | |
103 | case SCM_ARG4: | |
104 | scm_wrong_type_arg (s_subr, 4, arg); | |
105 | case SCM_ARG5: | |
106 | scm_wrong_type_arg (s_subr, 5, arg); | |
107 | case SCM_ARG6: | |
108 | scm_wrong_type_arg (s_subr, 6, arg); | |
109 | case SCM_ARG7: | |
110 | scm_wrong_type_arg (s_subr, 7, arg); | |
111 | case SCM_WNA: | |
112 | scm_wrong_num_args (arg); | |
113 | case SCM_OUTOFRANGE: | |
114 | scm_out_of_range (s_subr, arg); | |
115 | case SCM_NALLOC: | |
116 | scm_memory_error (s_subr); | |
117 | default: | |
118 | /* this shouldn't happen. */ | |
119 | scm_misc_error (s_subr, "Unknown error", SCM_EOL); | |
120 | } | |
121 | } | |
122 | return SCM_UNSPECIFIED; | |
123 | } | |
124 | ||
125 | /* Module registry | |
126 | */ | |
127 | ||
128 | /* We can't use SCM objects here. One should be able to call | |
129 | SCM_REGISTER_MODULE from a C++ constructor for a static | |
130 | object. This happens before main and thus before libguile is | |
131 | initialized. */ | |
132 | ||
133 | struct moddata { | |
134 | struct moddata *link; | |
135 | char *module_name; | |
136 | void *init_func; | |
137 | }; | |
138 | ||
139 | static struct moddata *registered_mods = NULL; | |
140 | ||
141 | void | |
142 | scm_register_module_xxx (char *module_name, void *init_func) | |
143 | { | |
144 | struct moddata *md; | |
145 | ||
146 | scm_c_issue_deprecation_warning | |
147 | ("`scm_register_module_xxx' is deprecated. Use extensions instead."); | |
148 | ||
149 | /* XXX - should we (and can we) DEFER_INTS here? */ | |
150 | ||
151 | for (md = registered_mods; md; md = md->link) | |
152 | if (!strcmp (md->module_name, module_name)) | |
153 | { | |
154 | md->init_func = init_func; | |
155 | return; | |
156 | } | |
157 | ||
158 | md = (struct moddata *) malloc (sizeof (struct moddata)); | |
159 | if (md == NULL) | |
160 | { | |
161 | fprintf (stderr, | |
162 | "guile: can't register module (%s): not enough memory", | |
163 | module_name); | |
164 | return; | |
165 | } | |
166 | ||
167 | md->module_name = module_name; | |
168 | md->init_func = init_func; | |
169 | md->link = registered_mods; | |
170 | registered_mods = md; | |
171 | } | |
172 | ||
173 | SCM_DEFINE (scm_registered_modules, "c-registered-modules", 0, 0, 0, | |
174 | (), | |
175 | "Return a list of the object code modules that have been imported into\n" | |
176 | "the current Guile process. Each element of the list is a pair whose\n" | |
177 | "car is the name of the module, and whose cdr is the function handle\n" | |
178 | "for that module's initializer function. The name is the string that\n" | |
179 | "has been passed to scm_register_module_xxx.") | |
180 | #define FUNC_NAME s_scm_registered_modules | |
181 | { | |
182 | SCM res; | |
183 | struct moddata *md; | |
184 | ||
185 | res = SCM_EOL; | |
186 | for (md = registered_mods; md; md = md->link) | |
3ee86942 | 187 | res = scm_cons (scm_cons (scm_from_locale_string (md->module_name), |
c71b0706 | 188 | scm_from_ulong ((unsigned long) md->init_func)), |
55d30fac MV |
189 | res); |
190 | return res; | |
191 | } | |
192 | #undef FUNC_NAME | |
193 | ||
194 | SCM_DEFINE (scm_clear_registered_modules, "c-clear-registered-modules", 0, 0, 0, | |
195 | (), | |
196 | "Destroy the list of modules registered with the current Guile process.\n" | |
197 | "The return value is unspecified. @strong{Warning:} this function does\n" | |
198 | "not actually unlink or deallocate these modules, but only destroys the\n" | |
199 | "records of which modules have been loaded. It should therefore be used\n" | |
200 | "only by module bookkeeping operations.") | |
201 | #define FUNC_NAME s_scm_clear_registered_modules | |
202 | { | |
203 | struct moddata *md1, *md2; | |
204 | ||
9de87eea | 205 | SCM_CRITICAL_SECTION_START; |
55d30fac MV |
206 | |
207 | for (md1 = registered_mods; md1; md1 = md2) | |
208 | { | |
209 | md2 = md1->link; | |
210 | free (md1); | |
211 | } | |
212 | registered_mods = NULL; | |
213 | ||
9de87eea | 214 | SCM_CRITICAL_SECTION_END; |
55d30fac MV |
215 | return SCM_UNSPECIFIED; |
216 | } | |
217 | #undef FUNC_NAME | |
218 | ||
a0454d72 MV |
219 | void |
220 | scm_remember (SCM *ptr) | |
221 | { | |
222 | scm_c_issue_deprecation_warning ("`scm_remember' is deprecated. " | |
223 | "Use the `scm_remember_upto_here*' family of functions instead."); | |
224 | } | |
225 | ||
226 | SCM | |
227 | scm_protect_object (SCM obj) | |
228 | { | |
229 | scm_c_issue_deprecation_warning ("`scm_protect_object' is deprecated. " | |
230 | "Use `scm_gc_protect_object' instead."); | |
231 | return scm_gc_protect_object (obj); | |
232 | } | |
233 | ||
234 | SCM | |
235 | scm_unprotect_object (SCM obj) | |
236 | { | |
237 | scm_c_issue_deprecation_warning ("`scm_unprotect_object' is deprecated. " | |
238 | "Use `scm_gc_unprotect_object' instead."); | |
239 | return scm_gc_unprotect_object (obj); | |
240 | } | |
241 | ||
242 | SCM_SYMBOL (scm_sym_app, "app"); | |
243 | SCM_SYMBOL (scm_sym_modules, "modules"); | |
244 | static SCM module_prefix = SCM_BOOL_F; | |
245 | static SCM make_modules_in_var; | |
246 | static SCM beautify_user_module_x_var; | |
247 | static SCM try_module_autoload_var; | |
248 | ||
249 | static void | |
250 | init_module_stuff () | |
251 | { | |
a0454d72 MV |
252 | if (module_prefix == SCM_BOOL_F) |
253 | { | |
f39448c5 AW |
254 | module_prefix = scm_list_2 (scm_sym_app, scm_sym_modules); |
255 | make_modules_in_var = scm_c_lookup ("make-modules-in"); | |
a0454d72 | 256 | beautify_user_module_x_var = |
f39448c5 AW |
257 | scm_c_lookup ("beautify-user-module!"); |
258 | try_module_autoload_var = scm_c_lookup ("try-module-autoload"); | |
a0454d72 MV |
259 | } |
260 | } | |
261 | ||
a0454d72 MV |
262 | static SCM |
263 | scm_module_full_name (SCM name) | |
264 | { | |
265 | init_module_stuff (); | |
bc36d050 | 266 | if (scm_is_eq (SCM_CAR (name), scm_sym_app)) |
a0454d72 MV |
267 | return name; |
268 | else | |
269 | return scm_append (scm_list_2 (module_prefix, name)); | |
270 | } | |
271 | ||
272 | SCM | |
273 | scm_make_module (SCM name) | |
274 | { | |
275 | init_module_stuff (); | |
276 | scm_c_issue_deprecation_warning ("`scm_make_module' is deprecated. " | |
277 | "Use `scm_c_define_module instead."); | |
278 | ||
279 | return scm_call_2 (SCM_VARIABLE_REF (make_modules_in_var), | |
280 | scm_the_root_module (), | |
281 | scm_module_full_name (name)); | |
282 | } | |
283 | ||
284 | SCM | |
285 | scm_ensure_user_module (SCM module) | |
286 | { | |
287 | init_module_stuff (); | |
288 | scm_c_issue_deprecation_warning ("`scm_ensure_user_module' is deprecated. " | |
289 | "Use `scm_c_define_module instead."); | |
290 | ||
291 | scm_call_1 (SCM_VARIABLE_REF (beautify_user_module_x_var), module); | |
292 | return SCM_UNSPECIFIED; | |
293 | } | |
294 | ||
295 | SCM | |
296 | scm_load_scheme_module (SCM name) | |
297 | { | |
298 | init_module_stuff (); | |
299 | scm_c_issue_deprecation_warning ("`scm_load_scheme_module' is deprecated. " | |
300 | "Use `scm_c_resolve_module instead."); | |
301 | ||
302 | return scm_call_1 (SCM_VARIABLE_REF (try_module_autoload_var), name); | |
303 | } | |
304 | ||
305 | /* This is implemented in C solely for SCM_COERCE_OUTPORT ... */ | |
306 | ||
307 | static void | |
308 | maybe_close_port (void *data, SCM port) | |
309 | { | |
6eadcdab | 310 | SCM except_set = (SCM) data; |
a0454d72 | 311 | |
6eadcdab | 312 | while (!scm_is_null (except_set)) |
a0454d72 | 313 | { |
6eadcdab | 314 | SCM p = SCM_COERCE_OUTPORT (SCM_CAR (except_set)); |
bc36d050 | 315 | if (scm_is_eq (p, port)) |
a0454d72 | 316 | return; |
6eadcdab | 317 | except_set = SCM_CDR (except_set); |
a0454d72 MV |
318 | } |
319 | ||
320 | scm_close_port (port); | |
321 | } | |
322 | ||
323 | SCM_DEFINE (scm_close_all_ports_except, "close-all-ports-except", 0, 0, 1, | |
324 | (SCM ports), | |
325 | "[DEPRECATED] Close all open file ports used by the interpreter\n" | |
326 | "except for those supplied as arguments. This procedure\n" | |
327 | "was intended to be used before an exec call to close file descriptors\n" | |
328 | "which are not needed in the new process. However it has the\n" | |
329 | "undesirable side effect of flushing buffers, so it's deprecated.\n" | |
330 | "Use port-for-each instead.") | |
331 | #define FUNC_NAME s_scm_close_all_ports_except | |
332 | { | |
333 | SCM p; | |
334 | SCM_VALIDATE_REST_ARGUMENT (ports); | |
335 | ||
d2e53ed6 | 336 | for (p = ports; !scm_is_null (p); p = SCM_CDR (p)) |
a0454d72 MV |
337 | SCM_VALIDATE_OPPORT (SCM_ARG1, SCM_COERCE_OUTPORT (SCM_CAR (p))); |
338 | ||
339 | scm_c_port_for_each (maybe_close_port, ports); | |
340 | ||
341 | return SCM_UNSPECIFIED; | |
342 | } | |
343 | #undef FUNC_NAME | |
55d30fac | 344 | |
965445d4 MV |
345 | SCM_DEFINE (scm_variable_set_name_hint, "variable-set-name-hint!", 2, 0, 0, |
346 | (SCM var, SCM hint), | |
347 | "Do not use this function.") | |
348 | #define FUNC_NAME s_scm_variable_set_name_hint | |
349 | { | |
350 | SCM_VALIDATE_VARIABLE (1, var); | |
351 | SCM_VALIDATE_SYMBOL (2, hint); | |
352 | scm_c_issue_deprecation_warning | |
353 | ("'variable-set-name-hint!' is deprecated. Do not use it."); | |
354 | return SCM_UNSPECIFIED; | |
355 | } | |
356 | #undef FUNC_NAME | |
357 | ||
358 | SCM_DEFINE (scm_builtin_variable, "builtin-variable", 1, 0, 0, | |
359 | (SCM name), | |
360 | "Do not use this function.") | |
361 | #define FUNC_NAME s_scm_builtin_variable | |
362 | { | |
363 | SCM_VALIDATE_SYMBOL (1,name); | |
364 | scm_c_issue_deprecation_warning ("`builtin-variable' is deprecated. " | |
365 | "Use module system operations instead."); | |
366 | return scm_sym2var (name, SCM_BOOL_F, SCM_BOOL_T); | |
367 | } | |
368 | #undef FUNC_NAME | |
369 | ||
370 | SCM | |
371 | scm_makstr (size_t len, int dummy) | |
372 | { | |
373 | scm_c_issue_deprecation_warning | |
3ee86942 MV |
374 | ("'scm_makstr' is deprecated. Use 'scm_c_make_string' instead."); |
375 | return scm_c_make_string (len, SCM_UNDEFINED); | |
965445d4 MV |
376 | } |
377 | ||
378 | SCM | |
379 | scm_makfromstr (const char *src, size_t len, int dummy SCM_UNUSED) | |
380 | { | |
381 | scm_c_issue_deprecation_warning ("`scm_makfromstr' is deprecated. " | |
3ee86942 | 382 | "Use `scm_from_locale_stringn' instead."); |
965445d4 | 383 | |
3ee86942 | 384 | return scm_from_locale_stringn (src, len); |
965445d4 MV |
385 | } |
386 | ||
387 | SCM | |
388 | scm_internal_with_fluids (SCM fluids, SCM values, SCM (*cproc) (), void *cdata) | |
389 | { | |
390 | scm_c_issue_deprecation_warning ("`scm_internal_with_fluids' is deprecated. " | |
391 | "Use `scm_c_with_fluids' instead."); | |
392 | ||
393 | return scm_c_with_fluids (fluids, values, cproc, cdata); | |
394 | } | |
395 | ||
396 | SCM | |
397 | scm_make_gsubr (const char *name, int req, int opt, int rst, SCM (*fcn)()) | |
398 | { | |
399 | scm_c_issue_deprecation_warning | |
400 | ("`scm_make_gsubr' is deprecated. Use `scm_c_define_gsubr' instead."); | |
401 | ||
402 | return scm_c_define_gsubr (name, req, opt, rst, fcn); | |
403 | } | |
404 | ||
405 | SCM | |
406 | scm_make_gsubr_with_generic (const char *name, | |
407 | int req, int opt, int rst, | |
408 | SCM (*fcn)(), SCM *gf) | |
409 | { | |
410 | scm_c_issue_deprecation_warning | |
411 | ("`scm_make_gsubr_with_generic' is deprecated. " | |
412 | "Use `scm_c_define_gsubr_with_generic' instead."); | |
413 | ||
414 | return scm_c_define_gsubr_with_generic (name, req, opt, rst, fcn, gf); | |
415 | } | |
416 | ||
417 | SCM | |
418 | scm_create_hook (const char *name, int n_args) | |
419 | { | |
420 | scm_c_issue_deprecation_warning | |
421 | ("'scm_create_hook' is deprecated. " | |
422 | "Use 'scm_make_hook' and 'scm_c_define' instead."); | |
423 | { | |
7888309b | 424 | SCM hook = scm_make_hook (scm_from_int (n_args)); |
965445d4 | 425 | scm_c_define (name, hook); |
838aa000 | 426 | return hook; |
965445d4 MV |
427 | } |
428 | } | |
429 | ||
430 | SCM_DEFINE (scm_sloppy_memq, "sloppy-memq", 2, 0, 0, | |
431 | (SCM x, SCM lst), | |
432 | "This procedure behaves like @code{memq}, but does no type or error checking.\n" | |
433 | "Its use is recommended only in writing Guile internals,\n" | |
434 | "not for high-level Scheme programs.") | |
435 | #define FUNC_NAME s_scm_sloppy_memq | |
436 | { | |
437 | scm_c_issue_deprecation_warning | |
438 | ("'sloppy-memq' is deprecated. Use 'memq' instead."); | |
439 | ||
d2e53ed6 | 440 | for(; scm_is_pair (lst); lst = SCM_CDR(lst)) |
965445d4 | 441 | { |
bc36d050 | 442 | if (scm_is_eq (SCM_CAR (lst), x)) |
965445d4 MV |
443 | return lst; |
444 | } | |
445 | return lst; | |
446 | } | |
447 | #undef FUNC_NAME | |
448 | ||
449 | ||
450 | SCM_DEFINE (scm_sloppy_memv, "sloppy-memv", 2, 0, 0, | |
451 | (SCM x, SCM lst), | |
452 | "This procedure behaves like @code{memv}, but does no type or error checking.\n" | |
453 | "Its use is recommended only in writing Guile internals,\n" | |
454 | "not for high-level Scheme programs.") | |
455 | #define FUNC_NAME s_scm_sloppy_memv | |
456 | { | |
457 | scm_c_issue_deprecation_warning | |
458 | ("'sloppy-memv' is deprecated. Use 'memv' instead."); | |
459 | ||
d2e53ed6 | 460 | for(; scm_is_pair (lst); lst = SCM_CDR(lst)) |
965445d4 | 461 | { |
7888309b | 462 | if (! scm_is_false (scm_eqv_p (SCM_CAR (lst), x))) |
965445d4 MV |
463 | return lst; |
464 | } | |
465 | return lst; | |
466 | } | |
467 | #undef FUNC_NAME | |
468 | ||
469 | ||
470 | SCM_DEFINE (scm_sloppy_member, "sloppy-member", 2, 0, 0, | |
471 | (SCM x, SCM lst), | |
472 | "This procedure behaves like @code{member}, but does no type or error checking.\n" | |
473 | "Its use is recommended only in writing Guile internals,\n" | |
474 | "not for high-level Scheme programs.") | |
475 | #define FUNC_NAME s_scm_sloppy_member | |
476 | { | |
477 | scm_c_issue_deprecation_warning | |
478 | ("'sloppy-member' is deprecated. Use 'member' instead."); | |
479 | ||
d2e53ed6 | 480 | for(; scm_is_pair (lst); lst = SCM_CDR(lst)) |
965445d4 | 481 | { |
7888309b | 482 | if (! scm_is_false (scm_equal_p (SCM_CAR (lst), x))) |
965445d4 MV |
483 | return lst; |
484 | } | |
485 | return lst; | |
486 | } | |
487 | #undef FUNC_NAME | |
488 | ||
489 | SCM_SYMBOL (scm_end_of_file_key, "end-of-file"); | |
490 | ||
491 | SCM_DEFINE (scm_read_and_eval_x, "read-and-eval!", 0, 1, 0, | |
492 | (SCM port), | |
493 | "Read a form from @var{port} (standard input by default), and evaluate it\n" | |
494 | "(memoizing it in the process) in the top-level environment. If no data\n" | |
495 | "is left to be read from @var{port}, an @code{end-of-file} error is\n" | |
496 | "signalled.") | |
497 | #define FUNC_NAME s_scm_read_and_eval_x | |
498 | { | |
f8ba2197 DH |
499 | SCM form; |
500 | ||
965445d4 MV |
501 | scm_c_issue_deprecation_warning |
502 | ("'read-and-eval!' is deprecated. Use 'read' and 'eval' instead."); | |
503 | ||
f8ba2197 | 504 | form = scm_read (port); |
965445d4 MV |
505 | if (SCM_EOF_OBJECT_P (form)) |
506 | scm_ithrow (scm_end_of_file_key, SCM_EOL, 1); | |
507 | return scm_eval_x (form, scm_current_module ()); | |
508 | } | |
509 | #undef FUNC_NAME | |
510 | ||
4abecea8 MV |
511 | SCM |
512 | scm_make_subr_opt (const char *name, int type, SCM (*fcn) (), int set) | |
513 | { | |
514 | scm_c_issue_deprecation_warning | |
515 | ("`scm_make_subr_opt' is deprecated. Use `scm_c_make_subr' or " | |
516 | "`scm_c_define_subr' instead."); | |
517 | ||
518 | if (set) | |
519 | return scm_c_define_subr (name, type, fcn); | |
520 | else | |
521 | return scm_c_make_subr (name, type, fcn); | |
522 | } | |
523 | ||
524 | SCM | |
525 | scm_make_subr (const char *name, int type, SCM (*fcn) ()) | |
526 | { | |
527 | scm_c_issue_deprecation_warning | |
528 | ("`scm_make_subr' is deprecated. Use `scm_c_define_subr' instead."); | |
529 | ||
530 | return scm_c_define_subr (name, type, fcn); | |
531 | } | |
532 | ||
533 | SCM | |
534 | scm_make_subr_with_generic (const char *name, int type, SCM (*fcn) (), SCM *gf) | |
535 | { | |
536 | scm_c_issue_deprecation_warning | |
537 | ("`scm_make_subr_with_generic' is deprecated. Use " | |
538 | "`scm_c_define_subr_with_generic' instead."); | |
539 | ||
540 | return scm_c_define_subr_with_generic (name, type, fcn, gf); | |
541 | } | |
542 | ||
543 | /* Call thunk(closure) underneath a top-level error handler. | |
544 | * If an error occurs, pass the exitval through err_filter and return it. | |
545 | * If no error occurs, return the value of thunk. | |
546 | */ | |
547 | ||
548 | #ifdef _UNICOS | |
549 | typedef int setjmp_type; | |
550 | #else | |
551 | typedef long setjmp_type; | |
552 | #endif | |
553 | ||
554 | struct cce_handler_data { | |
555 | SCM (*err_filter) (); | |
556 | void *closure; | |
557 | }; | |
558 | ||
559 | static SCM | |
560 | invoke_err_filter (void *d, SCM tag, SCM args) | |
561 | { | |
562 | struct cce_handler_data *data = (struct cce_handler_data *)d; | |
563 | return data->err_filter (SCM_BOOL_F, data->closure); | |
564 | } | |
565 | ||
566 | SCM | |
567 | scm_call_catching_errors (SCM (*thunk)(), SCM (*err_filter)(), void *closure) | |
568 | { | |
569 | scm_c_issue_deprecation_warning | |
570 | ("'scm_call_catching_errors' is deprecated. " | |
571 | "Use 'scm_internal_catch' instead."); | |
572 | ||
573 | { | |
574 | struct cce_handler_data data; | |
575 | data.err_filter = err_filter; | |
576 | data.closure = closure; | |
577 | return scm_internal_catch (SCM_BOOL_T, | |
578 | (scm_t_catch_body)thunk, closure, | |
579 | (scm_t_catch_handler)invoke_err_filter, &data); | |
580 | } | |
581 | } | |
582 | ||
583 | long | |
584 | scm_make_smob_type_mfpe (char *name, size_t size, | |
585 | SCM (*mark) (SCM), | |
586 | size_t (*free) (SCM), | |
587 | int (*print) (SCM, SCM, scm_print_state *), | |
588 | SCM (*equalp) (SCM, SCM)) | |
589 | { | |
590 | scm_c_issue_deprecation_warning | |
591 | ("'scm_make_smob_type_mfpe' is deprecated. " | |
592 | "Use 'scm_make_smob_type' plus 'scm_set_smob_*' instead."); | |
593 | ||
594 | { | |
595 | long answer = scm_make_smob_type (name, size); | |
596 | scm_set_smob_mfpe (answer, mark, free, print, equalp); | |
597 | return answer; | |
598 | } | |
599 | } | |
600 | ||
601 | void | |
602 | scm_set_smob_mfpe (long tc, | |
603 | SCM (*mark) (SCM), | |
604 | size_t (*free) (SCM), | |
605 | int (*print) (SCM, SCM, scm_print_state *), | |
606 | SCM (*equalp) (SCM, SCM)) | |
607 | { | |
608 | scm_c_issue_deprecation_warning | |
609 | ("'scm_set_smob_mfpe' is deprecated. " | |
610 | "Use 'scm_set_smob_mark' instead, for example."); | |
611 | ||
612 | if (mark) scm_set_smob_mark (tc, mark); | |
613 | if (free) scm_set_smob_free (tc, free); | |
614 | if (print) scm_set_smob_print (tc, print); | |
615 | if (equalp) scm_set_smob_equalp (tc, equalp); | |
616 | } | |
617 | ||
3051344b LC |
618 | size_t |
619 | scm_smob_free (SCM obj) | |
620 | { | |
621 | long n = SCM_SMOBNUM (obj); | |
622 | ||
623 | scm_c_issue_deprecation_warning | |
624 | ("`scm_smob_free' is deprecated. " | |
625 | "It is no longer needed."); | |
626 | ||
627 | if (scm_smobs[n].size > 0) | |
628 | scm_gc_free ((void *) SCM_CELL_WORD_1 (obj), | |
629 | scm_smobs[n].size, SCM_SMOBNAME (n)); | |
630 | return 0; | |
631 | } | |
632 | ||
4abecea8 MV |
633 | SCM |
634 | scm_read_0str (char *expr) | |
635 | { | |
636 | scm_c_issue_deprecation_warning | |
637 | ("scm_read_0str is deprecated. Use scm_c_read_string instead."); | |
638 | ||
639 | return scm_c_read_string (expr); | |
640 | } | |
641 | ||
642 | SCM | |
643 | scm_eval_0str (const char *expr) | |
644 | { | |
645 | scm_c_issue_deprecation_warning | |
646 | ("scm_eval_0str is deprecated. Use scm_c_eval_string instead."); | |
647 | ||
648 | return scm_c_eval_string (expr); | |
649 | } | |
650 | ||
651 | SCM | |
652 | scm_strprint_obj (SCM obj) | |
653 | { | |
654 | scm_c_issue_deprecation_warning | |
655 | ("scm_strprint_obj is deprecated. Use scm_object_to_string instead."); | |
656 | return scm_object_to_string (obj, SCM_UNDEFINED); | |
657 | } | |
658 | ||
a725fa95 MV |
659 | char * |
660 | scm_i_object_chars (SCM obj) | |
661 | { | |
662 | scm_c_issue_deprecation_warning | |
663 | ("SCM_CHARS is deprecated. See the manual for alternatives."); | |
664 | if (SCM_STRINGP (obj)) | |
665 | return SCM_STRING_CHARS (obj); | |
666 | if (SCM_SYMBOLP (obj)) | |
667 | return SCM_SYMBOL_CHARS (obj); | |
668 | abort (); | |
669 | } | |
670 | ||
671 | long | |
672 | scm_i_object_length (SCM obj) | |
673 | { | |
674 | scm_c_issue_deprecation_warning | |
675 | ("SCM_LENGTH is deprecated. " | |
676 | "Use scm_c_string_length instead, for example, or see the manual."); | |
677 | if (SCM_STRINGP (obj)) | |
678 | return SCM_STRING_LENGTH (obj); | |
679 | if (SCM_SYMBOLP (obj)) | |
680 | return SCM_SYMBOL_LENGTH (obj); | |
681 | if (SCM_VECTORP (obj)) | |
682 | return SCM_VECTOR_LENGTH (obj); | |
683 | abort (); | |
684 | } | |
685 | ||
cc5c1b66 MV |
686 | SCM |
687 | scm_sym2ovcell_soft (SCM sym, SCM obarray) | |
688 | { | |
689 | SCM lsym, z; | |
3ee86942 | 690 | size_t hash = scm_i_symbol_hash (sym) % SCM_VECTOR_LENGTH (obarray); |
cc5c1b66 MV |
691 | |
692 | scm_c_issue_deprecation_warning ("`scm_sym2ovcell_soft' is deprecated. " | |
693 | "Use hashtables instead."); | |
694 | ||
9de87eea | 695 | SCM_CRITICAL_SECTION_START; |
cc5c1b66 MV |
696 | for (lsym = SCM_VECTOR_REF (obarray, hash); |
697 | SCM_NIMP (lsym); | |
698 | lsym = SCM_CDR (lsym)) | |
699 | { | |
700 | z = SCM_CAR (lsym); | |
bc36d050 | 701 | if (scm_is_eq (SCM_CAR (z), sym)) |
cc5c1b66 | 702 | { |
9de87eea | 703 | SCM_CRITICAL_SECTION_END; |
cc5c1b66 MV |
704 | return z; |
705 | } | |
706 | } | |
9de87eea | 707 | SCM_CRITICAL_SECTION_END; |
cc5c1b66 MV |
708 | return SCM_BOOL_F; |
709 | } | |
710 | ||
711 | ||
712 | SCM | |
713 | scm_sym2ovcell (SCM sym, SCM obarray) | |
714 | #define FUNC_NAME "scm_sym2ovcell" | |
715 | { | |
716 | SCM answer; | |
717 | ||
718 | scm_c_issue_deprecation_warning ("`scm_sym2ovcell' is deprecated. " | |
719 | "Use hashtables instead."); | |
720 | ||
721 | answer = scm_sym2ovcell_soft (sym, obarray); | |
7888309b | 722 | if (scm_is_true (answer)) |
cc5c1b66 MV |
723 | return answer; |
724 | SCM_MISC_ERROR ("uninterned symbol: ~S", scm_list_1 (sym)); | |
725 | return SCM_UNSPECIFIED; /* not reached */ | |
726 | } | |
727 | #undef FUNC_NAME | |
728 | ||
729 | ||
730 | /* Intern a symbol whose name is the LEN characters at NAME in OBARRAY. | |
731 | ||
732 | OBARRAY should be a vector of lists, indexed by the name's hash | |
733 | value, modulo OBARRAY's length. Each list has the form | |
734 | ((SYMBOL . VALUE) ...), where SYMBOL is a symbol, and VALUE is the | |
735 | value associated with that symbol (in the current module? in the | |
736 | system module?) | |
737 | ||
738 | To "intern" a symbol means: if OBARRAY already contains a symbol by | |
739 | that name, return its (SYMBOL . VALUE) pair; otherwise, create a | |
740 | new symbol, add the pair (SYMBOL . SCM_UNDEFINED) to the | |
741 | appropriate list of the OBARRAY, and return the pair. | |
742 | ||
743 | If softness is non-zero, don't create a symbol if it isn't already | |
744 | in OBARRAY; instead, just return #f. | |
745 | ||
746 | If OBARRAY is SCM_BOOL_F, create a symbol listed in no obarray and | |
747 | return (SYMBOL . SCM_UNDEFINED). */ | |
748 | ||
749 | ||
7f594642 MG |
750 | static SCM |
751 | intern_obarray_soft (SCM symbol, SCM obarray, unsigned int softness) | |
cc5c1b66 | 752 | { |
3ee86942 | 753 | size_t raw_hash = scm_i_symbol_hash (symbol); |
cc5c1b66 MV |
754 | size_t hash; |
755 | SCM lsym; | |
756 | ||
7888309b | 757 | if (scm_is_false (obarray)) |
cc5c1b66 MV |
758 | { |
759 | if (softness) | |
760 | return SCM_BOOL_F; | |
761 | else | |
762 | return scm_cons (symbol, SCM_UNDEFINED); | |
763 | } | |
764 | ||
765 | hash = raw_hash % SCM_VECTOR_LENGTH (obarray); | |
766 | ||
767 | for (lsym = SCM_VECTOR_REF(obarray, hash); | |
768 | SCM_NIMP (lsym); lsym = SCM_CDR (lsym)) | |
769 | { | |
770 | SCM a = SCM_CAR (lsym); | |
771 | SCM z = SCM_CAR (a); | |
bc36d050 | 772 | if (scm_is_eq (z, symbol)) |
cc5c1b66 MV |
773 | return a; |
774 | } | |
775 | ||
776 | if (softness) | |
777 | { | |
778 | return SCM_BOOL_F; | |
779 | } | |
780 | else | |
781 | { | |
782 | SCM cell = scm_cons (symbol, SCM_UNDEFINED); | |
783 | SCM slot = SCM_VECTOR_REF (obarray, hash); | |
784 | ||
785 | SCM_VECTOR_SET (obarray, hash, scm_cons (cell, slot)); | |
786 | ||
787 | return cell; | |
788 | } | |
789 | } | |
790 | ||
791 | ||
7f594642 MG |
792 | SCM |
793 | scm_intern_obarray_soft (const char *name, size_t len, SCM obarray, | |
794 | unsigned int softness) | |
795 | { | |
796 | SCM symbol = scm_from_locale_symboln (name, len); | |
797 | ||
798 | scm_c_issue_deprecation_warning ("`scm_intern_obarray_soft' is deprecated. " | |
799 | "Use hashtables instead."); | |
800 | ||
801 | return intern_obarray_soft (symbol, obarray, softness); | |
802 | } | |
803 | ||
cc5c1b66 MV |
804 | SCM |
805 | scm_intern_obarray (const char *name,size_t len,SCM obarray) | |
806 | { | |
807 | scm_c_issue_deprecation_warning ("`scm_intern_obarray' is deprecated. " | |
808 | "Use hashtables instead."); | |
809 | ||
810 | return scm_intern_obarray_soft (name, len, obarray, 0); | |
811 | } | |
812 | ||
813 | /* Lookup the value of the symbol named by the nul-terminated string | |
814 | NAME in the current module. */ | |
815 | SCM | |
816 | scm_symbol_value0 (const char *name) | |
817 | { | |
818 | scm_c_issue_deprecation_warning ("`scm_symbol_value0' is deprecated. " | |
819 | "Use `scm_lookup' instead."); | |
820 | ||
821 | return scm_variable_ref (scm_c_lookup (name)); | |
822 | } | |
823 | ||
824 | SCM_DEFINE (scm_string_to_obarray_symbol, "string->obarray-symbol", 2, 1, 0, | |
825 | (SCM o, SCM s, SCM softp), | |
826 | "Intern a new symbol in @var{obarray}, a symbol table, with name\n" | |
827 | "@var{string}.\n\n" | |
828 | "If @var{obarray} is @code{#f}, use the default system symbol table. If\n" | |
829 | "@var{obarray} is @code{#t}, the symbol should not be interned in any\n" | |
830 | "symbol table; merely return the pair (@var{symbol}\n" | |
831 | ". @var{#<undefined>}).\n\n" | |
832 | "The @var{soft?} argument determines whether new symbol table entries\n" | |
833 | "should be created when the specified symbol is not already present in\n" | |
834 | "@var{obarray}. If @var{soft?} is specified and is a true value, then\n" | |
835 | "new entries should not be added for symbols not already present in the\n" | |
836 | "table; instead, simply return @code{#f}.") | |
837 | #define FUNC_NAME s_scm_string_to_obarray_symbol | |
838 | { | |
839 | SCM vcell; | |
840 | SCM answer; | |
841 | int softness; | |
842 | ||
843 | SCM_VALIDATE_STRING (2, s); | |
7888309b | 844 | SCM_ASSERT (scm_is_bool (o) || SCM_VECTORP (o), o, SCM_ARG1, FUNC_NAME); |
cc5c1b66 MV |
845 | |
846 | scm_c_issue_deprecation_warning ("`string->obarray-symbol' is deprecated. " | |
847 | "Use hashtables instead."); | |
848 | ||
7888309b | 849 | softness = (!SCM_UNBNDP (softp) && scm_is_true(softp)); |
cc5c1b66 | 850 | /* iron out some screwy calling conventions */ |
7888309b | 851 | if (scm_is_false (o)) |
cc5c1b66 MV |
852 | { |
853 | /* nothing interesting to do here. */ | |
854 | return scm_string_to_symbol (s); | |
855 | } | |
bc36d050 | 856 | else if (scm_is_eq (o, SCM_BOOL_T)) |
cc5c1b66 MV |
857 | o = SCM_BOOL_F; |
858 | ||
7f594642 | 859 | vcell = intern_obarray_soft (scm_string_to_symbol (s), o, softness); |
7888309b | 860 | if (scm_is_false (vcell)) |
cc5c1b66 MV |
861 | return vcell; |
862 | answer = SCM_CAR (vcell); | |
863 | return answer; | |
864 | } | |
865 | #undef FUNC_NAME | |
866 | ||
867 | SCM_DEFINE (scm_intern_symbol, "intern-symbol", 2, 0, 0, | |
868 | (SCM o, SCM s), | |
869 | "Add a new symbol to @var{obarray} with name @var{string}, bound to an\n" | |
870 | "unspecified initial value. The symbol table is not modified if a symbol\n" | |
871 | "with this name is already present.") | |
872 | #define FUNC_NAME s_scm_intern_symbol | |
873 | { | |
874 | size_t hval; | |
875 | SCM_VALIDATE_SYMBOL (2,s); | |
7888309b | 876 | if (scm_is_false (o)) |
cc5c1b66 MV |
877 | return SCM_UNSPECIFIED; |
878 | ||
879 | scm_c_issue_deprecation_warning ("`intern-symbol' is deprecated. " | |
880 | "Use hashtables instead."); | |
881 | ||
882 | SCM_VALIDATE_VECTOR (1,o); | |
3ee86942 | 883 | hval = scm_i_symbol_hash (s) % SCM_VECTOR_LENGTH (o); |
cc5c1b66 | 884 | /* If the symbol is already interned, simply return. */ |
9de87eea | 885 | SCM_CRITICAL_SECTION_START; |
cc5c1b66 MV |
886 | { |
887 | SCM lsym; | |
888 | SCM sym; | |
889 | for (lsym = SCM_VECTOR_REF (o, hval); | |
890 | SCM_NIMP (lsym); | |
891 | lsym = SCM_CDR (lsym)) | |
892 | { | |
893 | sym = SCM_CAR (lsym); | |
bc36d050 | 894 | if (scm_is_eq (SCM_CAR (sym), s)) |
cc5c1b66 | 895 | { |
9de87eea | 896 | SCM_CRITICAL_SECTION_END; |
cc5c1b66 MV |
897 | return SCM_UNSPECIFIED; |
898 | } | |
899 | } | |
900 | SCM_VECTOR_SET (o, hval, | |
901 | scm_acons (s, SCM_UNDEFINED, | |
902 | SCM_VECTOR_REF (o, hval))); | |
903 | } | |
9de87eea | 904 | SCM_CRITICAL_SECTION_END; |
cc5c1b66 MV |
905 | return SCM_UNSPECIFIED; |
906 | } | |
907 | #undef FUNC_NAME | |
908 | ||
909 | SCM_DEFINE (scm_unintern_symbol, "unintern-symbol", 2, 0, 0, | |
910 | (SCM o, SCM s), | |
911 | "Remove the symbol with name @var{string} from @var{obarray}. This\n" | |
912 | "function returns @code{#t} if the symbol was present and @code{#f}\n" | |
913 | "otherwise.") | |
914 | #define FUNC_NAME s_scm_unintern_symbol | |
915 | { | |
916 | size_t hval; | |
917 | ||
918 | scm_c_issue_deprecation_warning ("`unintern-symbol' is deprecated. " | |
919 | "Use hashtables instead."); | |
920 | ||
921 | SCM_VALIDATE_SYMBOL (2,s); | |
7888309b | 922 | if (scm_is_false (o)) |
cc5c1b66 MV |
923 | return SCM_BOOL_F; |
924 | SCM_VALIDATE_VECTOR (1,o); | |
3ee86942 | 925 | hval = scm_i_symbol_hash (s) % SCM_VECTOR_LENGTH (o); |
9de87eea | 926 | SCM_CRITICAL_SECTION_START; |
cc5c1b66 MV |
927 | { |
928 | SCM lsym_follow; | |
929 | SCM lsym; | |
930 | SCM sym; | |
931 | for (lsym = SCM_VECTOR_REF (o, hval), lsym_follow = SCM_BOOL_F; | |
932 | SCM_NIMP (lsym); | |
933 | lsym_follow = lsym, lsym = SCM_CDR (lsym)) | |
934 | { | |
935 | sym = SCM_CAR (lsym); | |
bc36d050 | 936 | if (scm_is_eq (SCM_CAR (sym), s)) |
cc5c1b66 MV |
937 | { |
938 | /* Found the symbol to unintern. */ | |
7888309b | 939 | if (scm_is_false (lsym_follow)) |
cc5c1b66 MV |
940 | SCM_VECTOR_SET (o, hval, lsym); |
941 | else | |
942 | SCM_SETCDR (lsym_follow, SCM_CDR(lsym)); | |
9de87eea | 943 | SCM_CRITICAL_SECTION_END; |
cc5c1b66 MV |
944 | return SCM_BOOL_T; |
945 | } | |
946 | } | |
947 | } | |
9de87eea | 948 | SCM_CRITICAL_SECTION_END; |
cc5c1b66 MV |
949 | return SCM_BOOL_F; |
950 | } | |
951 | #undef FUNC_NAME | |
952 | ||
953 | SCM_DEFINE (scm_symbol_binding, "symbol-binding", 2, 0, 0, | |
954 | (SCM o, SCM s), | |
955 | "Look up in @var{obarray} the symbol whose name is @var{string}, and\n" | |
956 | "return the value to which it is bound. If @var{obarray} is @code{#f},\n" | |
957 | "use the global symbol table. If @var{string} is not interned in\n" | |
958 | "@var{obarray}, an error is signalled.") | |
959 | #define FUNC_NAME s_scm_symbol_binding | |
960 | { | |
961 | SCM vcell; | |
962 | ||
963 | scm_c_issue_deprecation_warning ("`symbol-binding' is deprecated. " | |
964 | "Use hashtables instead."); | |
965 | ||
966 | SCM_VALIDATE_SYMBOL (2,s); | |
7888309b | 967 | if (scm_is_false (o)) |
cc5c1b66 MV |
968 | return scm_variable_ref (scm_lookup (s)); |
969 | SCM_VALIDATE_VECTOR (1,o); | |
970 | vcell = scm_sym2ovcell (s, o); | |
971 | return SCM_CDR(vcell); | |
972 | } | |
973 | #undef FUNC_NAME | |
974 | ||
975 | #if 0 | |
976 | SCM_DEFINE (scm_symbol_interned_p, "symbol-interned?", 2, 0, 0, | |
977 | (SCM o, SCM s), | |
978 | "Return @code{#t} if @var{obarray} contains a symbol with name\n" | |
979 | "@var{string}, and @code{#f} otherwise.") | |
980 | #define FUNC_NAME s_scm_symbol_interned_p | |
981 | { | |
982 | SCM vcell; | |
983 | ||
984 | scm_c_issue_deprecation_warning ("`symbol-interned?' is deprecated. " | |
985 | "Use hashtables instead."); | |
986 | ||
987 | SCM_VALIDATE_SYMBOL (2,s); | |
7888309b | 988 | if (scm_is_false (o)) |
cc5c1b66 MV |
989 | { |
990 | SCM var = scm_sym2var (s, SCM_BOOL_F, SCM_BOOL_F); | |
991 | if (var != SCM_BOOL_F) | |
992 | return SCM_BOOL_T; | |
993 | return SCM_BOOL_F; | |
994 | } | |
995 | SCM_VALIDATE_VECTOR (1,o); | |
996 | vcell = scm_sym2ovcell_soft (s, o); | |
997 | return (SCM_NIMP(vcell) | |
998 | ? SCM_BOOL_T | |
999 | : SCM_BOOL_F); | |
1000 | } | |
1001 | #undef FUNC_NAME | |
1002 | #endif | |
1003 | ||
1004 | SCM_DEFINE (scm_symbol_bound_p, "symbol-bound?", 2, 0, 0, | |
1005 | (SCM o, SCM s), | |
1006 | "Return @code{#t} if @var{obarray} contains a symbol with name\n" | |
1007 | "@var{string} bound to a defined value. This differs from\n" | |
1008 | "@var{symbol-interned?} in that the mere mention of a symbol\n" | |
1009 | "usually causes it to be interned; @code{symbol-bound?}\n" | |
1010 | "determines whether a symbol has been given any meaningful\n" | |
1011 | "value.") | |
1012 | #define FUNC_NAME s_scm_symbol_bound_p | |
1013 | { | |
1014 | SCM vcell; | |
1015 | ||
1016 | scm_c_issue_deprecation_warning ("`symbol-bound?' is deprecated. " | |
1017 | "Use hashtables instead."); | |
1018 | ||
1019 | SCM_VALIDATE_SYMBOL (2,s); | |
7888309b | 1020 | if (scm_is_false (o)) |
cc5c1b66 MV |
1021 | { |
1022 | SCM var = scm_sym2var (s, SCM_BOOL_F, SCM_BOOL_F); | |
1023 | if (SCM_VARIABLEP(var) && !SCM_UNBNDP(SCM_VARIABLE_REF(var))) | |
1024 | return SCM_BOOL_T; | |
1025 | return SCM_BOOL_F; | |
1026 | } | |
1027 | SCM_VALIDATE_VECTOR (1,o); | |
1028 | vcell = scm_sym2ovcell_soft (s, o); | |
7888309b | 1029 | return scm_from_bool (SCM_NIMP (vcell) && !SCM_UNBNDP (SCM_CDR (vcell))); |
cc5c1b66 MV |
1030 | } |
1031 | #undef FUNC_NAME | |
1032 | ||
1033 | ||
1034 | SCM_DEFINE (scm_symbol_set_x, "symbol-set!", 3, 0, 0, | |
1035 | (SCM o, SCM s, SCM v), | |
1036 | "Find the symbol in @var{obarray} whose name is @var{string}, and rebind\n" | |
1037 | "it to @var{value}. An error is signalled if @var{string} is not present\n" | |
1038 | "in @var{obarray}.") | |
1039 | #define FUNC_NAME s_scm_symbol_set_x | |
1040 | { | |
1041 | SCM vcell; | |
1042 | ||
1043 | scm_c_issue_deprecation_warning ("`symbol-set!' is deprecated. " | |
1044 | "Use the module system instead."); | |
1045 | ||
1046 | SCM_VALIDATE_SYMBOL (2,s); | |
7888309b | 1047 | if (scm_is_false (o)) |
cc5c1b66 MV |
1048 | { |
1049 | scm_define (s, v); | |
1050 | return SCM_UNSPECIFIED; | |
1051 | } | |
1052 | SCM_VALIDATE_VECTOR (1,o); | |
1053 | vcell = scm_sym2ovcell (s, o); | |
1054 | SCM_SETCDR (vcell, v); | |
1055 | return SCM_UNSPECIFIED; | |
1056 | } | |
1057 | #undef FUNC_NAME | |
1058 | ||
1059 | #define MAX_PREFIX_LENGTH 30 | |
1060 | ||
1061 | static int gentemp_counter; | |
1062 | ||
1063 | SCM_DEFINE (scm_gentemp, "gentemp", 0, 2, 0, | |
1064 | (SCM prefix, SCM obarray), | |
1065 | "Create a new symbol with a name unique in an obarray.\n" | |
1066 | "The name is constructed from an optional string @var{prefix}\n" | |
1067 | "and a counter value. The default prefix is @code{t}. The\n" | |
1068 | "@var{obarray} is specified as a second optional argument.\n" | |
1069 | "Default is the system obarray where all normal symbols are\n" | |
1070 | "interned. The counter is increased by 1 at each\n" | |
1071 | "call. There is no provision for resetting the counter.") | |
1072 | #define FUNC_NAME s_scm_gentemp | |
1073 | { | |
1074 | char buf[MAX_PREFIX_LENGTH + SCM_INTBUFLEN]; | |
1075 | char *name = buf; | |
806f1ded MG |
1076 | int n_digits; |
1077 | size_t len; | |
cc5c1b66 MV |
1078 | |
1079 | scm_c_issue_deprecation_warning ("`gentemp' is deprecated. " | |
1080 | "Use `gensym' instead."); | |
1081 | ||
1082 | if (SCM_UNBNDP (prefix)) | |
1083 | { | |
1084 | name[0] = 't'; | |
1085 | len = 1; | |
1086 | } | |
1087 | else | |
1088 | { | |
1089 | SCM_VALIDATE_STRING (1, prefix); | |
3ee86942 | 1090 | len = scm_i_string_length (prefix); |
806f1ded | 1091 | name = scm_to_locale_stringn (prefix, &len); |
7f594642 | 1092 | name = scm_realloc (name, len + SCM_INTBUFLEN); |
cc5c1b66 MV |
1093 | } |
1094 | ||
1095 | if (SCM_UNBNDP (obarray)) | |
1096 | return scm_gensym (prefix); | |
1097 | else | |
4057a3e0 | 1098 | SCM_ASSERT ((scm_is_vector (obarray) || SCM_I_WVECTP (obarray)), |
cc5c1b66 MV |
1099 | obarray, |
1100 | SCM_ARG2, | |
1101 | FUNC_NAME); | |
1102 | do | |
1103 | n_digits = scm_iint2str (gentemp_counter++, 10, &name[len]); | |
7888309b | 1104 | while (scm_is_true (scm_intern_obarray_soft (name, |
cc5c1b66 MV |
1105 | len + n_digits, |
1106 | obarray, | |
1107 | 1))); | |
1108 | { | |
1109 | SCM vcell = scm_intern_obarray_soft (name, | |
1110 | len + n_digits, | |
1111 | obarray, | |
1112 | 0); | |
1113 | if (name != buf) | |
7f594642 | 1114 | free (name); |
cc5c1b66 MV |
1115 | return SCM_CAR (vcell); |
1116 | } | |
1117 | } | |
1118 | #undef FUNC_NAME | |
1119 | ||
7888309b | 1120 | SCM |
fe78c51a | 1121 | scm_i_makinum (scm_t_signed_bits val) |
7888309b MV |
1122 | { |
1123 | scm_c_issue_deprecation_warning | |
1124 | ("SCM_MAKINUM is deprecated. Use scm_from_int or similar instead."); | |
3aa13a05 MV |
1125 | return SCM_I_MAKINUM (val); |
1126 | } | |
1127 | ||
1128 | int | |
fe78c51a | 1129 | scm_i_inump (SCM obj) |
3aa13a05 MV |
1130 | { |
1131 | scm_c_issue_deprecation_warning | |
1132 | ("SCM_INUMP is deprecated. Use scm_is_integer or similar instead."); | |
1133 | return SCM_I_INUMP (obj); | |
1134 | } | |
1135 | ||
1136 | scm_t_signed_bits | |
fe78c51a | 1137 | scm_i_inum (SCM obj) |
3aa13a05 MV |
1138 | { |
1139 | scm_c_issue_deprecation_warning | |
1140 | ("SCM_INUM is deprecated. Use scm_to_int or similar instead."); | |
1141 | return scm_to_intmax (obj); | |
7888309b | 1142 | } |
7888309b | 1143 | |
c829a427 MV |
1144 | char * |
1145 | scm_c_string2str (SCM obj, char *str, size_t *lenp) | |
1146 | { | |
1147 | scm_c_issue_deprecation_warning | |
1148 | ("scm_c_string2str is deprecated. Use scm_to_locale_stringbuf or similar instead."); | |
1149 | ||
1150 | if (str == NULL) | |
1151 | { | |
1152 | char *result = scm_to_locale_string (obj); | |
1153 | if (lenp) | |
3ee86942 | 1154 | *lenp = scm_i_string_length (obj); |
c829a427 MV |
1155 | return result; |
1156 | } | |
1157 | else | |
1158 | { | |
1159 | /* Pray that STR is large enough. | |
1160 | */ | |
1161 | size_t len = scm_to_locale_stringbuf (obj, str, SCM_I_SIZE_MAX); | |
1162 | str[len] = '\0'; | |
1163 | if (lenp) | |
1164 | *lenp = len; | |
1165 | return str; | |
1166 | } | |
1167 | } | |
1168 | ||
1169 | char * | |
1170 | scm_c_substring2str (SCM obj, char *str, size_t start, size_t len) | |
1171 | { | |
1172 | scm_c_issue_deprecation_warning | |
1173 | ("scm_c_substring2str is deprecated. Use scm_substring plus scm_to_locale_stringbuf instead."); | |
1174 | ||
1175 | if (start) | |
1176 | obj = scm_substring (obj, scm_from_size_t (start), SCM_UNDEFINED); | |
1177 | ||
1178 | scm_to_locale_stringbuf (obj, str, len); | |
1179 | return str; | |
1180 | } | |
1181 | ||
3ee86942 MV |
1182 | /* Converts the given Scheme symbol OBJ into a C string, containing a copy |
1183 | of OBJ's content with a trailing null byte. If LENP is non-NULL, set | |
1184 | *LENP to the string's length. | |
1185 | ||
1186 | When STR is non-NULL it receives the copy and is returned by the function, | |
1187 | otherwise new memory is allocated and the caller is responsible for | |
1188 | freeing it via free(). If out of memory, NULL is returned. | |
1189 | ||
1190 | Note that Scheme symbols may contain arbitrary data, including null | |
1191 | characters. This means that null termination is not a reliable way to | |
1192 | determine the length of the returned value. However, the function always | |
1193 | copies the complete contents of OBJ, and sets *LENP to the length of the | |
1194 | scheme symbol (if LENP is non-null). */ | |
1195 | char * | |
1196 | scm_c_symbol2str (SCM obj, char *str, size_t *lenp) | |
1197 | { | |
1198 | return scm_c_string2str (scm_symbol_to_string (obj), str, lenp); | |
1199 | } | |
1200 | ||
3101f40f MV |
1201 | double |
1202 | scm_truncate (double x) | |
1203 | { | |
1204 | scm_c_issue_deprecation_warning | |
1205 | ("scm_truncate is deprecated. Use scm_c_truncate instead."); | |
1206 | return scm_c_truncate (x); | |
1207 | } | |
1208 | ||
1209 | double | |
1210 | scm_round (double x) | |
1211 | { | |
1212 | scm_c_issue_deprecation_warning | |
1213 | ("scm_round is deprecated. Use scm_c_round instead."); | |
1214 | return scm_c_round (x); | |
1215 | } | |
1216 | ||
6fc4d012 AW |
1217 | SCM |
1218 | scm_sys_expt (SCM x, SCM y) | |
1219 | { | |
1220 | scm_c_issue_deprecation_warning | |
1221 | ("scm_sys_expt is deprecated. Use scm_expt instead."); | |
1222 | return scm_expt (x, y); | |
1223 | } | |
1224 | ||
ad79736c AW |
1225 | double |
1226 | scm_asinh (double x) | |
1227 | { | |
1228 | scm_c_issue_deprecation_warning | |
1229 | ("scm_asinh is deprecated. Use asinh instead."); | |
1230 | #if HAVE_ASINH | |
1231 | return asinh (x); | |
1232 | #else | |
1233 | return log (x + sqrt (x * x + 1)); | |
1234 | #endif | |
1235 | } | |
1236 | ||
1237 | double | |
1238 | scm_acosh (double x) | |
1239 | { | |
1240 | scm_c_issue_deprecation_warning | |
1241 | ("scm_acosh is deprecated. Use acosh instead."); | |
1242 | #if HAVE_ACOSH | |
1243 | return acosh (x); | |
1244 | #else | |
1245 | return log (x + sqrt (x * x - 1)); | |
1246 | #endif | |
1247 | } | |
1248 | ||
1249 | double | |
1250 | scm_atanh (double x) | |
1251 | { | |
1252 | scm_c_issue_deprecation_warning | |
1253 | ("scm_atanh is deprecated. Use atanh instead."); | |
1254 | #if HAVE_ATANH | |
1255 | return atanh (x); | |
1256 | #else | |
1257 | return 0.5 * log ((1 + x) / (1 - x)); | |
1258 | #endif | |
1259 | } | |
1260 | ||
1261 | SCM | |
1262 | scm_sys_atan2 (SCM z1, SCM z2) | |
1263 | { | |
1264 | scm_c_issue_deprecation_warning | |
1265 | ("scm_sys_atan2 is deprecated. Use scm_atan instead."); | |
1266 | return scm_atan (z1, z2); | |
1267 | } | |
1268 | ||
3ee86942 | 1269 | char * |
fe78c51a | 1270 | scm_i_deprecated_symbol_chars (SCM sym) |
3ee86942 MV |
1271 | { |
1272 | scm_c_issue_deprecation_warning | |
1273 | ("SCM_SYMBOL_CHARS is deprecated. Use scm_symbol_to_string."); | |
1274 | ||
ba16a103 | 1275 | return (char *)scm_i_symbol_chars (sym); |
3ee86942 MV |
1276 | } |
1277 | ||
1278 | size_t | |
fe78c51a | 1279 | scm_i_deprecated_symbol_length (SCM sym) |
3ee86942 MV |
1280 | { |
1281 | scm_c_issue_deprecation_warning | |
1282 | ("SCM_SYMBOL_LENGTH is deprecated. Use scm_symbol_to_string."); | |
ba16a103 | 1283 | return scm_i_symbol_length (sym); |
3ee86942 MV |
1284 | } |
1285 | ||
265a7997 | 1286 | int |
fe78c51a | 1287 | scm_i_keywordp (SCM obj) |
265a7997 MV |
1288 | { |
1289 | scm_c_issue_deprecation_warning | |
1290 | ("SCM_KEYWORDP is deprecated. Use scm_is_keyword instead."); | |
1291 | return scm_is_keyword (obj); | |
1292 | } | |
1293 | ||
1294 | SCM | |
fe78c51a | 1295 | scm_i_keywordsym (SCM keyword) |
265a7997 MV |
1296 | { |
1297 | scm_c_issue_deprecation_warning | |
1298 | ("SCM_KEYWORDSYM is deprecated. See scm_keyword_to_symbol instead."); | |
1299 | return scm_keyword_dash_symbol (keyword); | |
1300 | } | |
1301 | ||
354116f7 | 1302 | int |
fe78c51a | 1303 | scm_i_vectorp (SCM x) |
354116f7 MV |
1304 | { |
1305 | scm_c_issue_deprecation_warning | |
1306 | ("SCM_VECTORP is deprecated. Use scm_is_vector instead."); | |
1307 | return SCM_I_IS_VECTOR (x); | |
1308 | } | |
1309 | ||
1310 | unsigned long | |
fe78c51a | 1311 | scm_i_vector_length (SCM x) |
354116f7 MV |
1312 | { |
1313 | scm_c_issue_deprecation_warning | |
1314 | ("SCM_VECTOR_LENGTH is deprecated. Use scm_c_vector_length instead."); | |
1315 | return SCM_I_VECTOR_LENGTH (x); | |
1316 | } | |
1317 | ||
1318 | const SCM * | |
fe78c51a | 1319 | scm_i_velts (SCM x) |
354116f7 MV |
1320 | { |
1321 | scm_c_issue_deprecation_warning | |
1322 | ("SCM_VELTS is deprecated. Use scm_vector_elements instead."); | |
1323 | return SCM_I_VECTOR_ELTS (x); | |
1324 | } | |
1325 | ||
1326 | SCM * | |
fe78c51a | 1327 | scm_i_writable_velts (SCM x) |
354116f7 MV |
1328 | { |
1329 | scm_c_issue_deprecation_warning | |
1330 | ("SCM_WRITABLE_VELTS is deprecated. " | |
1331 | "Use scm_vector_writable_elements instead."); | |
1332 | return SCM_I_VECTOR_WELTS (x); | |
1333 | } | |
1334 | ||
1335 | SCM | |
fe78c51a | 1336 | scm_i_vector_ref (SCM x, size_t idx) |
354116f7 MV |
1337 | { |
1338 | scm_c_issue_deprecation_warning | |
1339 | ("SCM_VECTOR_REF is deprecated. " | |
1340 | "Use scm_c_vector_ref or scm_vector_elements instead."); | |
1341 | return scm_c_vector_ref (x, idx); | |
1342 | } | |
1343 | ||
1344 | void | |
fe78c51a | 1345 | scm_i_vector_set (SCM x, size_t idx, SCM val) |
354116f7 MV |
1346 | { |
1347 | scm_c_issue_deprecation_warning | |
1348 | ("SCM_VECTOR_SET is deprecated. " | |
1349 | "Use scm_c_vector_set_x or scm_vector_writable_elements instead."); | |
1350 | scm_c_vector_set_x (x, idx, val); | |
1351 | } | |
1352 | ||
1353 | SCM | |
1354 | scm_vector_equal_p (SCM x, SCM y) | |
1355 | { | |
1356 | scm_c_issue_deprecation_warning | |
1357 | ("scm_vector_euqal_p is deprecated. " | |
1358 | "Use scm_equal_p instead."); | |
1359 | return scm_equal_p (x, y); | |
1360 | } | |
1361 | ||
1f366ef7 | 1362 | int |
fe78c51a | 1363 | scm_i_arrayp (SCM a) |
1f366ef7 MV |
1364 | { |
1365 | scm_c_issue_deprecation_warning | |
1366 | ("SCM_ARRAYP is deprecated. Use scm_is_array instead."); | |
66b9d7d3 | 1367 | return SCM_I_ARRAYP(a); |
1f366ef7 MV |
1368 | } |
1369 | ||
1370 | size_t | |
fe78c51a | 1371 | scm_i_array_ndim (SCM a) |
1f366ef7 MV |
1372 | { |
1373 | scm_c_issue_deprecation_warning | |
1374 | ("SCM_ARRAY_NDIM is deprecated. " | |
1375 | "Use scm_c_array_rank or scm_array_handle_rank instead."); | |
1376 | return scm_c_array_rank (a); | |
1377 | } | |
1378 | ||
1379 | int | |
fe78c51a | 1380 | scm_i_array_contp (SCM a) |
1f366ef7 MV |
1381 | { |
1382 | scm_c_issue_deprecation_warning | |
1383 | ("SCM_ARRAY_CONTP is deprecated. Do not use it."); | |
1384 | return SCM_I_ARRAY_CONTP (a); | |
1385 | } | |
1386 | ||
1387 | scm_t_array * | |
fe78c51a | 1388 | scm_i_array_mem (SCM a) |
1f366ef7 MV |
1389 | { |
1390 | scm_c_issue_deprecation_warning | |
1391 | ("SCM_ARRAY_MEM is deprecated. Do not use it."); | |
1392 | return (scm_t_array *)SCM_I_ARRAY_MEM (a); | |
1393 | } | |
1394 | ||
1395 | SCM | |
fe78c51a | 1396 | scm_i_array_v (SCM a) |
1f366ef7 MV |
1397 | { |
1398 | /* We could use scm_shared_array_root here, but it is better to move | |
1399 | them away from expecting vectors as the basic storage for arrays. | |
1400 | */ | |
1401 | scm_c_issue_deprecation_warning | |
1402 | ("SCM_ARRAY_V is deprecated. Do not use it."); | |
1403 | return SCM_I_ARRAY_V (a); | |
1404 | } | |
1405 | ||
1406 | size_t | |
fe78c51a | 1407 | scm_i_array_base (SCM a) |
1f366ef7 MV |
1408 | { |
1409 | scm_c_issue_deprecation_warning | |
1410 | ("SCM_ARRAY_BASE is deprecated. Do not use it."); | |
1411 | return SCM_I_ARRAY_BASE (a); | |
1412 | } | |
1413 | ||
1414 | scm_t_array_dim * | |
fe78c51a | 1415 | scm_i_array_dims (SCM a) |
1f366ef7 MV |
1416 | { |
1417 | scm_c_issue_deprecation_warning | |
1418 | ("SCM_ARRAY_DIMS is deprecated. Use scm_array_handle_dims instead."); | |
1419 | return SCM_I_ARRAY_DIMS (a); | |
1420 | } | |
1421 | ||
9de87eea MV |
1422 | SCM |
1423 | scm_i_cur_inp (void) | |
1424 | { | |
1425 | scm_c_issue_deprecation_warning | |
1426 | ("scm_cur_inp is deprecated. Use scm_current_input_port instead."); | |
1427 | return scm_current_input_port (); | |
1428 | } | |
1429 | ||
1430 | SCM | |
1431 | scm_i_cur_outp (void) | |
1432 | { | |
1433 | scm_c_issue_deprecation_warning | |
1434 | ("scm_cur_outp is deprecated. Use scm_current_output_port instead."); | |
1435 | return scm_current_output_port (); | |
1436 | } | |
1437 | ||
1438 | SCM | |
1439 | scm_i_cur_errp (void) | |
1440 | { | |
1441 | scm_c_issue_deprecation_warning | |
1442 | ("scm_cur_errp is deprecated. Use scm_current_error_port instead."); | |
1443 | return scm_current_error_port (); | |
1444 | } | |
1445 | ||
1446 | SCM | |
1447 | scm_i_cur_loadp (void) | |
1448 | { | |
1449 | scm_c_issue_deprecation_warning | |
1450 | ("scm_cur_loadp is deprecated. Use scm_current_load_port instead."); | |
1451 | return scm_current_load_port (); | |
1452 | } | |
1453 | ||
1454 | SCM | |
1455 | scm_i_progargs (void) | |
1456 | { | |
1457 | scm_c_issue_deprecation_warning | |
1458 | ("scm_progargs is deprecated. Use scm_program_arguments instead."); | |
1459 | return scm_program_arguments (); | |
1460 | } | |
1461 | ||
1462 | SCM | |
1463 | scm_i_deprecated_dynwinds (void) | |
1464 | { | |
1465 | scm_c_issue_deprecation_warning | |
1466 | ("scm_dynwinds is deprecated. Do not use it."); | |
1467 | return scm_i_dynwinds (); | |
1468 | } | |
1469 | ||
9de87eea MV |
1470 | SCM_STACKITEM * |
1471 | scm_i_stack_base (void) | |
1472 | { | |
1473 | scm_c_issue_deprecation_warning | |
1474 | ("scm_stack_base is deprecated. Do not use it."); | |
1475 | return SCM_I_CURRENT_THREAD->base; | |
1476 | } | |
1477 | ||
1478 | int | |
1479 | scm_i_fluidp (SCM x) | |
1480 | { | |
1481 | scm_c_issue_deprecation_warning | |
1482 | ("SCM_FLUIDP is deprecated. Use scm_is_fluid instead."); | |
1483 | return scm_is_fluid (x); | |
1484 | } | |
1485 | ||
3452e666 LC |
1486 | \f |
1487 | /* Networking. */ | |
1488 | ||
1040b205 LC |
1489 | #ifdef HAVE_NETWORKING |
1490 | ||
1491 | SCM_DEFINE (scm_inet_aton, "inet-aton", 1, 0, 0, | |
3452e666 LC |
1492 | (SCM address), |
1493 | "Convert an IPv4 Internet address from printable string\n" | |
1494 | "(dotted decimal notation) to an integer. E.g.,\n\n" | |
1495 | "@lisp\n" | |
1496 | "(inet-aton \"127.0.0.1\") @result{} 2130706433\n" | |
1497 | "@end lisp") | |
1498 | #define FUNC_NAME s_scm_inet_aton | |
1499 | { | |
1500 | scm_c_issue_deprecation_warning | |
1501 | ("`inet-aton' is deprecated. Use `inet-pton' instead."); | |
1502 | ||
1503 | return scm_inet_pton (scm_from_int (AF_INET), address); | |
1504 | } | |
1505 | #undef FUNC_NAME | |
1506 | ||
1507 | ||
1040b205 | 1508 | SCM_DEFINE (scm_inet_ntoa, "inet-ntoa", 1, 0, 0, |
3452e666 LC |
1509 | (SCM inetid), |
1510 | "Convert an IPv4 Internet address to a printable\n" | |
1511 | "(dotted decimal notation) string. E.g.,\n\n" | |
1512 | "@lisp\n" | |
1513 | "(inet-ntoa 2130706433) @result{} \"127.0.0.1\"\n" | |
1514 | "@end lisp") | |
1515 | #define FUNC_NAME s_scm_inet_ntoa | |
1516 | { | |
1517 | scm_c_issue_deprecation_warning | |
1518 | ("`inet-ntoa' is deprecated. Use `inet-ntop' instead."); | |
1519 | ||
1520 | return scm_inet_ntop (scm_from_int (AF_INET), inetid); | |
1521 | } | |
1522 | #undef FUNC_NAME | |
1523 | ||
1040b205 | 1524 | #endif /* HAVE_NETWORKING */ |
3452e666 LC |
1525 | |
1526 | \f | |
9de87eea MV |
1527 | void |
1528 | scm_i_defer_ints_etc () | |
1529 | { | |
1530 | scm_c_issue_deprecation_warning | |
2b829bbb | 1531 | ("SCM_DEFER_INTS etc are deprecated. " |
9de87eea MV |
1532 | "Use a mutex instead if appropriate."); |
1533 | } | |
1534 | ||
b8ec9dab LC |
1535 | int |
1536 | scm_i_mask_ints (void) | |
1537 | { | |
1538 | scm_c_issue_deprecation_warning ("`scm_mask_ints' is deprecated."); | |
1539 | return (SCM_I_CURRENT_THREAD->block_asyncs != 0); | |
1540 | } | |
1541 | ||
1542 | \f | |
06c1d900 MV |
1543 | SCM |
1544 | scm_guard (SCM guardian, SCM obj, int throw_p) | |
1545 | { | |
1546 | scm_c_issue_deprecation_warning | |
1547 | ("scm_guard is deprecated. Use scm_call_1 instead."); | |
1548 | ||
1549 | return scm_call_1 (guardian, obj); | |
1550 | } | |
1551 | ||
1552 | SCM | |
1553 | scm_get_one_zombie (SCM guardian) | |
1554 | { | |
1555 | scm_c_issue_deprecation_warning | |
1556 | ("scm_guard is deprecated. Use scm_call_0 instead."); | |
1557 | ||
1558 | return scm_call_0 (guardian); | |
1559 | } | |
1560 | ||
1561 | SCM_DEFINE (scm_guardian_destroyed_p, "guardian-destroyed?", 1, 0, 0, | |
1562 | (SCM guardian), | |
1563 | "Return @code{#t} if @var{guardian} has been destroyed, otherwise @code{#f}.") | |
1564 | #define FUNC_NAME s_scm_guardian_destroyed_p | |
1565 | { | |
1566 | scm_c_issue_deprecation_warning | |
1567 | ("'guardian-destroyed?' is deprecated."); | |
1568 | return SCM_BOOL_F; | |
1569 | } | |
1570 | #undef FUNC_NAME | |
1571 | ||
1572 | SCM_DEFINE (scm_guardian_greedy_p, "guardian-greedy?", 1, 0, 0, | |
1573 | (SCM guardian), | |
1574 | "Return @code{#t} if @var{guardian} is a greedy guardian, otherwise @code{#f}.") | |
1575 | #define FUNC_NAME s_scm_guardian_greedy_p | |
1576 | { | |
1577 | scm_c_issue_deprecation_warning | |
1578 | ("'guardian-greedy?' is deprecated."); | |
1579 | return SCM_BOOL_F; | |
1580 | } | |
1581 | #undef FUNC_NAME | |
1582 | ||
1583 | SCM_DEFINE (scm_destroy_guardian_x, "destroy-guardian!", 1, 0, 0, | |
1584 | (SCM guardian), | |
1585 | "Destroys @var{guardian}, by making it impossible to put any more\n" | |
1586 | "objects in it or get any objects from it. It also unguards any\n" | |
1587 | "objects guarded by @var{guardian}.") | |
1588 | #define FUNC_NAME s_scm_destroy_guardian_x | |
1589 | { | |
1590 | scm_c_issue_deprecation_warning | |
1591 | ("'destroy-guardian!' is deprecated and ineffective."); | |
1592 | return SCM_UNSPECIFIED; | |
1593 | } | |
1594 | #undef FUNC_NAME | |
1595 | ||
760fb97d LC |
1596 | \f |
1597 | /* GC-related things. */ | |
1598 | ||
1599 | unsigned long scm_mallocated, scm_mtrigger; | |
1600 | size_t scm_max_segment_size; | |
1601 | ||
1602 | #if defined (GUILE_DEBUG) || defined (GUILE_DEBUG_FREELIST) | |
1603 | SCM | |
1604 | scm_map_free_list (void) | |
1605 | { | |
1606 | return SCM_EOL; | |
1607 | } | |
1608 | #endif | |
1609 | ||
1610 | #if defined (GUILE_DEBUG_FREELIST) | |
1611 | SCM | |
1612 | scm_gc_set_debug_check_freelist_x (SCM flag) | |
1613 | { | |
1614 | return SCM_UNSPECIFIED; | |
1615 | } | |
1616 | #endif | |
1617 | ||
1618 | \f | |
a3e92377 AW |
1619 | /* Trampolines |
1620 | * | |
1621 | * Trampolines were an intent to speed up calling the same Scheme procedure many | |
1622 | * times from C. | |
1623 | * | |
1624 | * However, this was the wrong thing to optimize; if you really know what you're | |
1625 | * calling, call its function directly, otherwise you're in Scheme-land, and we | |
1626 | * have many better tricks there (inlining, for example, which can remove the | |
1627 | * need for closures and free variables). | |
1628 | * | |
1629 | * Also, in the normal debugging case, trampolines were being computed but not | |
1630 | * used. Silliness. | |
1631 | */ | |
1632 | ||
1633 | scm_t_trampoline_0 | |
1634 | scm_trampoline_0 (SCM proc) | |
1635 | { | |
1636 | scm_c_issue_deprecation_warning | |
1637 | ("`scm_trampoline_0' is deprecated. Just use `scm_call_0' instead."); | |
1638 | return scm_call_0; | |
1639 | } | |
1640 | ||
1641 | scm_t_trampoline_1 | |
1642 | scm_trampoline_1 (SCM proc) | |
1643 | { | |
1644 | scm_c_issue_deprecation_warning | |
1645 | ("`scm_trampoline_1' is deprecated. Just use `scm_call_1' instead."); | |
1646 | return scm_call_1; | |
1647 | } | |
1648 | ||
1649 | scm_t_trampoline_2 | |
1650 | scm_trampoline_2 (SCM proc) | |
1651 | { | |
1652 | scm_c_issue_deprecation_warning | |
1653 | ("`scm_trampoline_2' is deprecated. Just use `scm_call_2' instead."); | |
1654 | return scm_call_2; | |
1655 | } | |
1656 | ||
1657 | \f | |
19e2247d MV |
1658 | void |
1659 | scm_i_init_deprecated () | |
1660 | { | |
1661 | #include "libguile/deprecated.x" | |
1662 | } | |
1663 | ||
1664 | #endif |