1 /* This file contains definitions for deprecated features. When you
2 deprecate something, move it here when that is feasible.
5 /* Copyright (C) 2003 Free Software Foundation, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but 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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "libguile/_scm.h"
23 #include "libguile/deprecated.h"
24 #include "libguile/deprecation.h"
25 #include "libguile/snarf.h"
26 #include "libguile/validate.h"
27 #include "libguile/strings.h"
28 #include "libguile/strop.h"
33 #if (SCM_ENABLE_DEPRECATED == 1)
35 SCM_REGISTER_PROC(s_substring_move_left_x
, "substring-move-left!", 5, 0, 0, scm_substring_move_x
);
37 SCM_REGISTER_PROC(s_substring_move_right_x
, "substring-move-right!", 5, 0, 0, scm_substring_move_x
);
40 scm_wta (SCM arg
, const char *pos
, const char *s_subr
)
42 if (!s_subr
|| !*s_subr
)
44 if ((~0x1fL
) & (long) pos
)
46 /* error string supplied. */
47 scm_misc_error (s_subr
, pos
, scm_list_1 (arg
));
51 /* numerical error code. */
52 scm_t_bits error
= (scm_t_bits
) pos
;
57 scm_wrong_type_arg (s_subr
, 0, arg
);
59 scm_wrong_type_arg (s_subr
, 1, arg
);
61 scm_wrong_type_arg (s_subr
, 2, arg
);
63 scm_wrong_type_arg (s_subr
, 3, arg
);
65 scm_wrong_type_arg (s_subr
, 4, arg
);
67 scm_wrong_type_arg (s_subr
, 5, arg
);
69 scm_wrong_type_arg (s_subr
, 6, arg
);
71 scm_wrong_type_arg (s_subr
, 7, arg
);
73 scm_wrong_num_args (arg
);
75 scm_out_of_range (s_subr
, arg
);
77 scm_memory_error (s_subr
);
79 /* this shouldn't happen. */
80 scm_misc_error (s_subr
, "Unknown error", SCM_EOL
);
83 return SCM_UNSPECIFIED
;
89 /* We can't use SCM objects here. One should be able to call
90 SCM_REGISTER_MODULE from a C++ constructor for a static
91 object. This happens before main and thus before libguile is
100 static struct moddata
*registered_mods
= NULL
;
103 scm_register_module_xxx (char *module_name
, void *init_func
)
107 scm_c_issue_deprecation_warning
108 ("`scm_register_module_xxx' is deprecated. Use extensions instead.");
110 /* XXX - should we (and can we) DEFER_INTS here? */
112 for (md
= registered_mods
; md
; md
= md
->link
)
113 if (!strcmp (md
->module_name
, module_name
))
115 md
->init_func
= init_func
;
119 md
= (struct moddata
*) malloc (sizeof (struct moddata
));
123 "guile: can't register module (%s): not enough memory",
128 md
->module_name
= module_name
;
129 md
->init_func
= init_func
;
130 md
->link
= registered_mods
;
131 registered_mods
= md
;
134 SCM_DEFINE (scm_registered_modules
, "c-registered-modules", 0, 0, 0,
136 "Return a list of the object code modules that have been imported into\n"
137 "the current Guile process. Each element of the list is a pair whose\n"
138 "car is the name of the module, and whose cdr is the function handle\n"
139 "for that module's initializer function. The name is the string that\n"
140 "has been passed to scm_register_module_xxx.")
141 #define FUNC_NAME s_scm_registered_modules
147 for (md
= registered_mods
; md
; md
= md
->link
)
148 res
= scm_cons (scm_cons (scm_makfrom0str (md
->module_name
),
149 scm_ulong2num ((unsigned long) md
->init_func
)),
155 SCM_DEFINE (scm_clear_registered_modules
, "c-clear-registered-modules", 0, 0, 0,
157 "Destroy the list of modules registered with the current Guile process.\n"
158 "The return value is unspecified. @strong{Warning:} this function does\n"
159 "not actually unlink or deallocate these modules, but only destroys the\n"
160 "records of which modules have been loaded. It should therefore be used\n"
161 "only by module bookkeeping operations.")
162 #define FUNC_NAME s_scm_clear_registered_modules
164 struct moddata
*md1
, *md2
;
168 for (md1
= registered_mods
; md1
; md1
= md2
)
173 registered_mods
= NULL
;
176 return SCM_UNSPECIFIED
;
182 scm_i_init_deprecated ()
184 #include "libguile/deprecated.x"