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 | ||
118ff892 | 5 | /* Copyright (C) 2003, 2004, 2006, 2008, 2009, 2010, 2011, 2012, 2013 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" |
55d30fac | 30 | #include "libguile/deprecation.h" |
3452e666 | 31 | |
19e2247d MV |
32 | #if (SCM_ENABLE_DEPRECATED == 1) |
33 | ||
f3c6a02c AW |
34 | \f |
35 | ||
b2feee6b AW |
36 | SCM |
37 | scm_internal_dynamic_wind (scm_t_guard before, | |
38 | scm_t_inner inner, | |
39 | scm_t_guard after, | |
40 | void *inner_data, | |
41 | void *guard_data) | |
42 | { | |
43 | SCM ans; | |
44 | ||
45 | scm_c_issue_deprecation_warning | |
46 | ("`scm_internal_dynamic_wind' is deprecated. " | |
47 | "Use the `scm_dynwind_begin' / `scm_dynwind_end' API instead."); | |
48 | ||
49 | scm_dynwind_begin (SCM_F_DYNWIND_REWINDABLE); | |
50 | scm_dynwind_rewind_handler (before, guard_data, SCM_F_WIND_EXPLICITLY); | |
51 | scm_dynwind_unwind_handler (after, guard_data, SCM_F_WIND_EXPLICITLY); | |
52 | ans = inner (inner_data); | |
53 | scm_dynwind_end (); | |
54 | return ans; | |
55 | } | |
56 | ||
57 | \f | |
58 | ||
65619ebe AW |
59 | SCM |
60 | scm_immutable_cell (scm_t_bits car, scm_t_bits cdr) | |
61 | { | |
62 | scm_c_issue_deprecation_warning | |
63 | ("scm_immutable_cell is deprecated. Use scm_cell instead."); | |
64 | ||
65 | return scm_cell (car, cdr); | |
66 | } | |
67 | ||
68 | SCM | |
69 | scm_immutable_double_cell (scm_t_bits car, scm_t_bits cbr, | |
70 | scm_t_bits ccr, scm_t_bits cdr) | |
71 | { | |
72 | scm_c_issue_deprecation_warning | |
73 | ("scm_immutable_double_cell is deprecated. Use scm_double_cell instead."); | |
74 | ||
75 | return scm_double_cell (car, cbr, ccr, cdr); | |
76 | } | |
77 | ||
78 | ||
79 | \f | |
80 | ||
62e15979 | 81 | |
118ff892 AW |
82 | SCM_DEFINE (scm_generalized_vector_p, "generalized-vector?", 1, 0, 0, |
83 | (SCM obj), | |
84 | "Return @code{#t} if @var{obj} is a vector, string,\n" | |
85 | "bitvector, or uniform numeric vector.") | |
86 | #define FUNC_NAME s_scm_generalized_vector_p | |
87 | { | |
88 | scm_c_issue_deprecation_warning | |
89 | ("generalized-vector? is deprecated. Use array? and check the " | |
90 | "array-rank instead."); | |
91 | return scm_from_bool (scm_is_generalized_vector (obj)); | |
92 | } | |
93 | #undef FUNC_NAME | |
94 | ||
95 | SCM_DEFINE (scm_generalized_vector_length, "generalized-vector-length", 1, 0, 0, | |
96 | (SCM v), | |
97 | "Return the length of the generalized vector @var{v}.") | |
98 | #define FUNC_NAME s_scm_generalized_vector_length | |
99 | { | |
100 | scm_c_issue_deprecation_warning | |
101 | ("generalized-vector-length is deprecated. Use array-length instead."); | |
102 | return scm_from_size_t (scm_c_generalized_vector_length (v)); | |
103 | } | |
104 | #undef FUNC_NAME | |
105 | ||
106 | SCM_DEFINE (scm_generalized_vector_ref, "generalized-vector-ref", 2, 0, 0, | |
107 | (SCM v, SCM idx), | |
108 | "Return the element at index @var{idx} of the\n" | |
109 | "generalized vector @var{v}.") | |
110 | #define FUNC_NAME s_scm_generalized_vector_ref | |
111 | { | |
112 | scm_c_issue_deprecation_warning | |
113 | ("generalized-vector-ref is deprecated. Use array-ref instead."); | |
114 | return scm_c_generalized_vector_ref (v, scm_to_size_t (idx)); | |
115 | } | |
116 | #undef FUNC_NAME | |
117 | ||
118 | SCM_DEFINE (scm_generalized_vector_set_x, "generalized-vector-set!", 3, 0, 0, | |
119 | (SCM v, SCM idx, SCM val), | |
120 | "Set the element at index @var{idx} of the\n" | |
121 | "generalized vector @var{v} to @var{val}.") | |
122 | #define FUNC_NAME s_scm_generalized_vector_set_x | |
123 | { | |
124 | scm_c_issue_deprecation_warning | |
125 | ("generalized-vector-set! is deprecated. Use array-set! instead. " | |
126 | "Note the change in argument order!"); | |
127 | scm_c_generalized_vector_set_x (v, scm_to_size_t (idx), val); | |
128 | return SCM_UNSPECIFIED; | |
129 | } | |
130 | #undef FUNC_NAME | |
131 | ||
132 | SCM_DEFINE (scm_generalized_vector_to_list, "generalized-vector->list", 1, 0, 0, | |
133 | (SCM v), | |
134 | "Return a new list whose elements are the elements of the\n" | |
135 | "generalized vector @var{v}.") | |
136 | #define FUNC_NAME s_scm_generalized_vector_to_list | |
137 | { | |
138 | /* FIXME: This duplicates `array_to_list'. */ | |
139 | SCM ret = SCM_EOL; | |
140 | long inc; | |
141 | ssize_t pos, i; | |
142 | scm_t_array_handle h; | |
143 | ||
144 | scm_c_issue_deprecation_warning | |
145 | ("generalized-vector->list is deprecated. Use array->list instead."); | |
146 | ||
147 | scm_generalized_vector_get_handle (v, &h); | |
148 | ||
149 | i = h.dims[0].ubnd - h.dims[0].lbnd + 1; | |
150 | inc = h.dims[0].inc; | |
151 | pos = (i - 1) * inc; | |
152 | ||
153 | for (; i > 0; i--, pos -= inc) | |
154 | ret = scm_cons (h.impl->vref (&h, h.base + pos), ret); | |
155 | ||
156 | scm_array_handle_release (&h); | |
157 | return ret; | |
158 | } | |
159 | #undef FUNC_NAME | |
160 | ||
161 | ||
162 | \f | |
163 | ||
19e2247d MV |
164 | void |
165 | scm_i_init_deprecated () | |
166 | { | |
167 | #include "libguile/deprecated.x" | |
168 | } | |
169 | ||
170 | #endif |