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