Commit | Line | Data |
---|---|---|
f8579182 MV |
1 | #ifndef SCM_SRFI_4_H |
2 | #define SCM_SRFI_4_H | |
3 | /* srfi-4.c --- Homogeneous numeric vector datatypes. | |
4 | * | |
4ca48269 | 5 | * Copyright (C) 2001, 2004, 2006, 2008, 2009, 2010 Free Software Foundation, Inc. |
f8579182 MV |
6 | * |
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. | |
f8579182 | 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 | |
f8579182 MV |
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 | |
53befeb7 NJ |
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
20 | * 02110-1301 USA | |
f8579182 MV |
21 | */ |
22 | \f | |
23 | ||
24 | #include "libguile/__scm.h" | |
e0e49670 | 25 | |
a2689737 AW |
26 | SCM_API SCM scm_make_srfi_4_vector (SCM type, SCM len, SCM fill); |
27 | ||
28 | ||
e0e49670 MV |
29 | /* Specific procedures. |
30 | */ | |
31 | ||
f8579182 MV |
32 | SCM_API SCM scm_u8vector_p (SCM obj); |
33 | SCM_API SCM scm_make_u8vector (SCM n, SCM fill); | |
ab7acbb7 | 34 | SCM_API SCM scm_take_u8vector (scm_t_uint8 *data, size_t n); |
f8579182 MV |
35 | SCM_API SCM scm_u8vector (SCM l); |
36 | SCM_API SCM scm_u8vector_length (SCM uvec); | |
37 | SCM_API SCM scm_u8vector_ref (SCM uvec, SCM index); | |
38 | SCM_API SCM scm_u8vector_set_x (SCM uvec, SCM index, SCM value); | |
39 | SCM_API SCM scm_u8vector_to_list (SCM uvec); | |
40 | SCM_API SCM scm_list_to_u8vector (SCM l); | |
90d4368c | 41 | SCM_API SCM scm_any_to_u8vector (SCM obj); |
6e708ef2 MV |
42 | SCM_API const scm_t_uint8 *scm_array_handle_u8_elements (scm_t_array_handle *h); |
43 | SCM_API scm_t_uint8 *scm_array_handle_u8_writable_elements (scm_t_array_handle *h); | |
44 | SCM_API const scm_t_uint8 *scm_u8vector_elements (SCM uvec, | |
45 | scm_t_array_handle *h, | |
46 | size_t *lenp, ssize_t *incp); | |
47 | SCM_API scm_t_uint8 *scm_u8vector_writable_elements (SCM uvec, | |
48 | scm_t_array_handle *h, | |
49 | size_t *lenp, | |
50 | ssize_t *incp); | |
f8579182 MV |
51 | |
52 | SCM_API SCM scm_s8vector_p (SCM obj); | |
53 | SCM_API SCM scm_make_s8vector (SCM n, SCM fill); | |
ab7acbb7 | 54 | SCM_API SCM scm_take_s8vector (scm_t_int8 *data, size_t n); |
f8579182 MV |
55 | SCM_API SCM scm_s8vector (SCM l); |
56 | SCM_API SCM scm_s8vector_length (SCM uvec); | |
57 | SCM_API SCM scm_s8vector_ref (SCM uvec, SCM index); | |
58 | SCM_API SCM scm_s8vector_set_x (SCM uvec, SCM index, SCM value); | |
59 | SCM_API SCM scm_s8vector_to_list (SCM uvec); | |
60 | SCM_API SCM scm_list_to_s8vector (SCM l); | |
90d4368c | 61 | SCM_API SCM scm_any_to_s8vector (SCM obj); |
6e708ef2 MV |
62 | SCM_API const scm_t_int8 *scm_array_handle_s8_elements (scm_t_array_handle *h); |
63 | SCM_API scm_t_int8 *scm_array_handle_s8_writable_elements (scm_t_array_handle *h); | |
64 | SCM_API const scm_t_int8 *scm_s8vector_elements (SCM uvec, | |
65 | scm_t_array_handle *h, | |
66 | size_t *lenp, ssize_t *incp); | |
67 | SCM_API scm_t_int8 *scm_s8vector_writable_elements (SCM uvec, | |
68 | scm_t_array_handle *h, | |
69 | size_t *lenp, | |
70 | ssize_t *incp); | |
f8579182 MV |
71 | |
72 | SCM_API SCM scm_u16vector_p (SCM obj); | |
73 | SCM_API SCM scm_make_u16vector (SCM n, SCM fill); | |
ab7acbb7 | 74 | SCM_API SCM scm_take_u16vector (scm_t_uint16 *data, size_t n); |
f8579182 MV |
75 | SCM_API SCM scm_u16vector (SCM l); |
76 | SCM_API SCM scm_u16vector_length (SCM uvec); | |
77 | SCM_API SCM scm_u16vector_ref (SCM uvec, SCM index); | |
78 | SCM_API SCM scm_u16vector_set_x (SCM uvec, SCM index, SCM value); | |
79 | SCM_API SCM scm_u16vector_to_list (SCM uvec); | |
80 | SCM_API SCM scm_list_to_u16vector (SCM l); | |
90d4368c | 81 | SCM_API SCM scm_any_to_u16vector (SCM obj); |
6e708ef2 MV |
82 | SCM_API const scm_t_uint16 *scm_array_handle_u16_elements (scm_t_array_handle *h); |
83 | SCM_API scm_t_uint16 *scm_array_handle_u16_writable_elements (scm_t_array_handle *h); | |
84 | SCM_API const scm_t_uint16 *scm_u16vector_elements (SCM uvec, | |
85 | scm_t_array_handle *h, | |
86 | size_t *lenp, | |
87 | ssize_t *incp); | |
88 | SCM_API scm_t_uint16 *scm_u16vector_writable_elements (SCM uvec, | |
89 | scm_t_array_handle *h, | |
90 | size_t *lenp, | |
91 | ssize_t *incp); | |
f8579182 MV |
92 | |
93 | SCM_API SCM scm_s16vector_p (SCM obj); | |
94 | SCM_API SCM scm_make_s16vector (SCM n, SCM fill); | |
ab7acbb7 | 95 | SCM_API SCM scm_take_s16vector (scm_t_int16 *data, size_t n); |
f8579182 MV |
96 | SCM_API SCM scm_s16vector (SCM l); |
97 | SCM_API SCM scm_s16vector_length (SCM uvec); | |
98 | SCM_API SCM scm_s16vector_ref (SCM uvec, SCM index); | |
99 | SCM_API SCM scm_s16vector_set_x (SCM uvec, SCM index, SCM value); | |
100 | SCM_API SCM scm_s16vector_to_list (SCM uvec); | |
101 | SCM_API SCM scm_list_to_s16vector (SCM l); | |
90d4368c | 102 | SCM_API SCM scm_any_to_s16vector (SCM obj); |
6e708ef2 MV |
103 | SCM_API const scm_t_int16 *scm_array_handle_s16_elements (scm_t_array_handle *h); |
104 | SCM_API scm_t_int16 *scm_array_handle_s16_writable_elements (scm_t_array_handle *h); | |
105 | SCM_API const scm_t_int16 *scm_s16vector_elements (SCM uvec, | |
106 | scm_t_array_handle *h, | |
107 | size_t *lenp, ssize_t *incp); | |
108 | SCM_API scm_t_int16 *scm_s16vector_writable_elements (SCM uvec, | |
109 | scm_t_array_handle *h, | |
110 | size_t *lenp, | |
111 | ssize_t *incp); | |
f8579182 MV |
112 | |
113 | SCM_API SCM scm_u32vector_p (SCM obj); | |
114 | SCM_API SCM scm_make_u32vector (SCM n, SCM fill); | |
ab7acbb7 | 115 | SCM_API SCM scm_take_u32vector (scm_t_uint32 *data, size_t n); |
f8579182 MV |
116 | SCM_API SCM scm_u32vector (SCM l); |
117 | SCM_API SCM scm_u32vector_length (SCM uvec); | |
118 | SCM_API SCM scm_u32vector_ref (SCM uvec, SCM index); | |
119 | SCM_API SCM scm_u32vector_set_x (SCM uvec, SCM index, SCM value); | |
120 | SCM_API SCM scm_u32vector_to_list (SCM uvec); | |
121 | SCM_API SCM scm_list_to_u32vector (SCM l); | |
90d4368c | 122 | SCM_API SCM scm_any_to_u32vector (SCM obj); |
6e708ef2 MV |
123 | SCM_API const scm_t_uint32 *scm_array_handle_u32_elements (scm_t_array_handle *h); |
124 | SCM_API scm_t_uint32 *scm_array_handle_u32_writable_elements (scm_t_array_handle *h); | |
125 | SCM_API const scm_t_uint32 *scm_u32vector_elements (SCM uvec, | |
126 | scm_t_array_handle *h, | |
127 | size_t *lenp, | |
128 | ssize_t *incp); | |
129 | SCM_API scm_t_uint32 *scm_u32vector_writable_elements (SCM uvec, | |
130 | scm_t_array_handle *h, | |
131 | size_t *lenp, | |
132 | ssize_t *incp); | |
f8579182 MV |
133 | |
134 | SCM_API SCM scm_s32vector_p (SCM obj); | |
135 | SCM_API SCM scm_make_s32vector (SCM n, SCM fill); | |
ab7acbb7 | 136 | SCM_API SCM scm_take_s32vector (scm_t_int32 *data, size_t n); |
f8579182 MV |
137 | SCM_API SCM scm_s32vector (SCM l); |
138 | SCM_API SCM scm_s32vector_length (SCM uvec); | |
139 | SCM_API SCM scm_s32vector_ref (SCM uvec, SCM index); | |
140 | SCM_API SCM scm_s32vector_set_x (SCM uvec, SCM index, SCM value); | |
141 | SCM_API SCM scm_s32vector_to_list (SCM uvec); | |
142 | SCM_API SCM scm_list_to_s32vector (SCM l); | |
90d4368c | 143 | SCM_API SCM scm_any_to_s32vector (SCM obj); |
6e708ef2 MV |
144 | SCM_API const scm_t_int32 *scm_array_handle_s32_elements (scm_t_array_handle *h); |
145 | SCM_API scm_t_int32 *scm_array_handle_s32_writable_elements (scm_t_array_handle *h); | |
146 | SCM_API const scm_t_int32 *scm_s32vector_elements (SCM uvec, | |
147 | scm_t_array_handle *h, | |
148 | size_t *lenp, ssize_t *incp); | |
149 | SCM_API scm_t_int32 *scm_s32vector_writable_elements (SCM uvec, | |
150 | scm_t_array_handle *h, | |
151 | size_t *lenp, | |
152 | ssize_t *incp); | |
f8579182 MV |
153 | |
154 | SCM_API SCM scm_u64vector_p (SCM obj); | |
155 | SCM_API SCM scm_make_u64vector (SCM n, SCM fill); | |
156 | SCM_API SCM scm_u64vector (SCM l); | |
157 | SCM_API SCM scm_u64vector_length (SCM uvec); | |
158 | SCM_API SCM scm_u64vector_ref (SCM uvec, SCM index); | |
159 | SCM_API SCM scm_u64vector_set_x (SCM uvec, SCM index, SCM value); | |
160 | SCM_API SCM scm_u64vector_to_list (SCM uvec); | |
161 | SCM_API SCM scm_list_to_u64vector (SCM l); | |
90d4368c | 162 | SCM_API SCM scm_any_to_u64vector (SCM obj); |
00c17d45 | 163 | |
ab7acbb7 | 164 | SCM_API SCM scm_take_u64vector (scm_t_uint64 *data, size_t n); |
6e708ef2 MV |
165 | SCM_API const scm_t_uint64 *scm_array_handle_u64_elements (scm_t_array_handle *h); |
166 | SCM_API scm_t_uint64 *scm_array_handle_u64_writable_elements (scm_t_array_handle *h); | |
167 | SCM_API const scm_t_uint64 *scm_u64vector_elements (SCM uvec, | |
168 | scm_t_array_handle *h, | |
169 | size_t *lenp, | |
170 | ssize_t *incp); | |
171 | SCM_API scm_t_uint64 *scm_u64vector_writable_elements (SCM uvec, | |
172 | scm_t_array_handle *h, | |
173 | size_t *lenp, | |
174 | ssize_t *incp); | |
f8579182 MV |
175 | |
176 | SCM_API SCM scm_s64vector_p (SCM obj); | |
177 | SCM_API SCM scm_make_s64vector (SCM n, SCM fill); | |
178 | SCM_API SCM scm_s64vector (SCM l); | |
179 | SCM_API SCM scm_s64vector_length (SCM uvec); | |
180 | SCM_API SCM scm_s64vector_ref (SCM uvec, SCM index); | |
181 | SCM_API SCM scm_s64vector_set_x (SCM uvec, SCM index, SCM value); | |
182 | SCM_API SCM scm_s64vector_to_list (SCM uvec); | |
183 | SCM_API SCM scm_list_to_s64vector (SCM l); | |
90d4368c | 184 | SCM_API SCM scm_any_to_s64vector (SCM obj); |
00c17d45 | 185 | |
ab7acbb7 | 186 | SCM_API SCM scm_take_s64vector (scm_t_int64 *data, size_t n); |
6e708ef2 MV |
187 | SCM_API const scm_t_int64 *scm_array_handle_s64_elements (scm_t_array_handle *h); |
188 | SCM_API scm_t_int64 *scm_array_handle_s64_writable_elements (scm_t_array_handle *h); | |
189 | SCM_API const scm_t_int64 *scm_s64vector_elements (SCM uvec, | |
190 | scm_t_array_handle *h, | |
191 | size_t *lenp, ssize_t *incp); | |
192 | SCM_API scm_t_int64 *scm_s64vector_writable_elements (SCM uvec, | |
193 | scm_t_array_handle *h, | |
194 | size_t *lenp, | |
195 | ssize_t *incp); | |
f8579182 MV |
196 | |
197 | SCM_API SCM scm_f32vector_p (SCM obj); | |
198 | SCM_API SCM scm_make_f32vector (SCM n, SCM fill); | |
ab7acbb7 | 199 | SCM_API SCM scm_take_f32vector (float *data, size_t n); |
f8579182 MV |
200 | SCM_API SCM scm_f32vector (SCM l); |
201 | SCM_API SCM scm_f32vector_length (SCM uvec); | |
202 | SCM_API SCM scm_f32vector_ref (SCM uvec, SCM index); | |
203 | SCM_API SCM scm_f32vector_set_x (SCM uvec, SCM index, SCM value); | |
204 | SCM_API SCM scm_f32vector_to_list (SCM uvec); | |
205 | SCM_API SCM scm_list_to_f32vector (SCM l); | |
90d4368c | 206 | SCM_API SCM scm_any_to_f32vector (SCM obj); |
6e708ef2 MV |
207 | SCM_API const float *scm_array_handle_f32_elements (scm_t_array_handle *h); |
208 | SCM_API float *scm_array_handle_f32_writable_elements (scm_t_array_handle *h); | |
209 | SCM_API const float *scm_f32vector_elements (SCM uvec, | |
210 | scm_t_array_handle *h, | |
211 | size_t *lenp, ssize_t *incp); | |
212 | SCM_API float *scm_f32vector_writable_elements (SCM uvec, | |
213 | scm_t_array_handle *h, | |
214 | size_t *lenp, | |
215 | ssize_t *incp); | |
f8579182 MV |
216 | |
217 | SCM_API SCM scm_f64vector_p (SCM obj); | |
218 | SCM_API SCM scm_make_f64vector (SCM n, SCM fill); | |
ab7acbb7 | 219 | SCM_API SCM scm_take_f64vector (double *data, size_t n); |
f8579182 MV |
220 | SCM_API SCM scm_f64vector (SCM l); |
221 | SCM_API SCM scm_f64vector_length (SCM uvec); | |
222 | SCM_API SCM scm_f64vector_ref (SCM uvec, SCM index); | |
223 | SCM_API SCM scm_f64vector_set_x (SCM uvec, SCM index, SCM value); | |
224 | SCM_API SCM scm_f64vector_to_list (SCM uvec); | |
225 | SCM_API SCM scm_list_to_f64vector (SCM l); | |
90d4368c | 226 | SCM_API SCM scm_any_to_f64vector (SCM obj); |
6e708ef2 MV |
227 | SCM_API const double *scm_array_handle_f64_elements (scm_t_array_handle *h); |
228 | SCM_API double *scm_array_handle_f64_writable_elements (scm_t_array_handle *h); | |
229 | SCM_API const double *scm_f64vector_elements (SCM uvec, | |
230 | scm_t_array_handle *h, | |
231 | size_t *lenp, ssize_t *incp); | |
232 | SCM_API double *scm_f64vector_writable_elements (SCM uvec, | |
233 | scm_t_array_handle *h, | |
234 | size_t *lenp, | |
235 | ssize_t *incp); | |
f8579182 | 236 | |
cbdc8379 MV |
237 | SCM_API SCM scm_c32vector_p (SCM obj); |
238 | SCM_API SCM scm_make_c32vector (SCM n, SCM fill); | |
ab7acbb7 | 239 | SCM_API SCM scm_take_c32vector (float *data, size_t n); |
cbdc8379 MV |
240 | SCM_API SCM scm_c32vector (SCM l); |
241 | SCM_API SCM scm_c32vector_length (SCM uvec); | |
242 | SCM_API SCM scm_c32vector_ref (SCM uvec, SCM index); | |
243 | SCM_API SCM scm_c32vector_set_x (SCM uvec, SCM index, SCM value); | |
244 | SCM_API SCM scm_c32vector_to_list (SCM uvec); | |
245 | SCM_API SCM scm_list_to_c32vector (SCM l); | |
90d4368c | 246 | SCM_API SCM scm_any_to_c32vector (SCM obj); |
6e708ef2 MV |
247 | SCM_API const float *scm_array_handle_c32_elements (scm_t_array_handle *h); |
248 | SCM_API float *scm_array_handle_c32_writable_elements (scm_t_array_handle *h); | |
249 | SCM_API const float *scm_c32vector_elements (SCM uvec, | |
250 | scm_t_array_handle *h, | |
251 | size_t *lenp, ssize_t *incp); | |
252 | SCM_API float *scm_c32vector_writable_elements (SCM uvec, | |
253 | scm_t_array_handle *h, | |
254 | size_t *lenp, | |
255 | ssize_t *incp); | |
cbdc8379 MV |
256 | |
257 | SCM_API SCM scm_c64vector_p (SCM obj); | |
258 | SCM_API SCM scm_make_c64vector (SCM n, SCM fill); | |
ab7acbb7 | 259 | SCM_API SCM scm_take_c64vector (double *data, size_t n); |
cbdc8379 MV |
260 | SCM_API SCM scm_c64vector (SCM l); |
261 | SCM_API SCM scm_c64vector_length (SCM uvec); | |
262 | SCM_API SCM scm_c64vector_ref (SCM uvec, SCM index); | |
263 | SCM_API SCM scm_c64vector_set_x (SCM uvec, SCM index, SCM value); | |
264 | SCM_API SCM scm_c64vector_to_list (SCM uvec); | |
265 | SCM_API SCM scm_list_to_c64vector (SCM l); | |
90d4368c | 266 | SCM_API SCM scm_any_to_c64vector (SCM obj); |
6e708ef2 MV |
267 | SCM_API const double *scm_array_handle_c64_elements (scm_t_array_handle *h); |
268 | SCM_API double *scm_array_handle_c64_writable_elements (scm_t_array_handle *h); | |
269 | SCM_API const double *scm_c64vector_elements (SCM uvec, | |
270 | scm_t_array_handle *h, | |
271 | size_t *lenp, ssize_t *incp); | |
272 | SCM_API double *scm_c64vector_writable_elements (SCM uvec, | |
273 | scm_t_array_handle *h, | |
274 | size_t *lenp, | |
275 | ssize_t *incp); | |
cbdc8379 | 276 | |
102dbb6f LC |
277 | SCM_INTERNAL SCM scm_i_generalized_vector_type (SCM vec); |
278 | SCM_INTERNAL const char *scm_i_uniform_vector_tag (SCM uvec); | |
279 | SCM_INTERNAL scm_i_t_array_ref scm_i_uniform_vector_ref_proc (SCM uvec); | |
280 | SCM_INTERNAL scm_i_t_array_set scm_i_uniform_vector_set_proc (SCM uvec); | |
e0e49670 | 281 | |
ec313f0e MV |
282 | #if SCM_ENABLE_DEPRECATED |
283 | ||
284 | /* Deprecated because we want people to use the scm_t_array_handle | |
285 | interface. | |
286 | */ | |
287 | ||
0eb934f1 | 288 | SCM_DEPRECATED size_t scm_uniform_element_size (SCM obj); |
f8579182 | 289 | |
ec313f0e MV |
290 | #endif |
291 | ||
102dbb6f | 292 | SCM_INTERNAL void scm_init_srfi_4 (void); |
f8579182 MV |
293 | |
294 | #endif /* SCM_SRFI_4_H */ |