1 | /* ---------------- */ |
---|
2 | /* --- nrset1.c --- */ |
---|
3 | /* ---------------- */ |
---|
4 | |
---|
5 | /* |
---|
6 | * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved |
---|
7 | * Univ Paris Sud XI, CNRS |
---|
8 | * |
---|
9 | * Distributed under the Boost Software License, Version 1.0 |
---|
10 | * see accompanying file LICENSE.txt or copy it at |
---|
11 | * http://www.boost.org/LICENSE_1_0.txt |
---|
12 | */ |
---|
13 | |
---|
14 | /* |
---|
15 | * 2002/06/11 ajout des fonctions endline |
---|
16 | */ |
---|
17 | #include <stdio.h> |
---|
18 | #include <stddef.h> |
---|
19 | #include <stdlib.h> |
---|
20 | #include <math.h> // fabs |
---|
21 | |
---|
22 | #include "mypredef.h" |
---|
23 | #include "nrtype.h" |
---|
24 | #include "nrdef.h" |
---|
25 | #include "nrmacro.h" |
---|
26 | #include "nrkernel.h" |
---|
27 | |
---|
28 | #include "nrset1.h" |
---|
29 | |
---|
30 | #define isdigit(x) ((x) >= 0x30 && (x) <= 0x39) |
---|
31 | |
---|
32 | /* |
---|
33 | * ------------------- |
---|
34 | * --- zero_vector --- |
---|
35 | * ------------------- |
---|
36 | */ |
---|
37 | |
---|
38 | /* ------------------------------------------------------- */ |
---|
39 | IMAGE_EXPORT(void) zero_si8vector(sint8 *v, long nl, long nh) |
---|
40 | /* ------------------------------------------------------- */ |
---|
41 | { |
---|
42 | int i; |
---|
43 | for(i=nl; i<=nh; i++) v[i] = 0; |
---|
44 | } |
---|
45 | /* ------------------------------------------------------- */ |
---|
46 | IMAGE_EXPORT(void) zero_ui8vector(uint8 *v, long nl, long nh) |
---|
47 | /* ------------------------------------------------------- */ |
---|
48 | { |
---|
49 | int i; |
---|
50 | for(i=nl; i<=nh; i++) v[i] = 0; |
---|
51 | } |
---|
52 | /* --------------------------------------------------------- */ |
---|
53 | IMAGE_EXPORT(void) zero_si16vector(sint16 *v, long nl, long nh) |
---|
54 | /* --------------------------------------------------------- */ |
---|
55 | { |
---|
56 | int i; |
---|
57 | for(i=nl; i<=nh; i++) v[i] = 0; |
---|
58 | } |
---|
59 | /* --------------------------------------------------------- */ |
---|
60 | IMAGE_EXPORT(void) zero_ui16vector(uint16 *v, long nl, long nh) |
---|
61 | /* --------------------------------------------------------- */ |
---|
62 | { |
---|
63 | int i; |
---|
64 | for(i=nl; i<=nh; i++) v[i] = 0; |
---|
65 | } |
---|
66 | /* --------------------------------------------------------- */ |
---|
67 | IMAGE_EXPORT(void) zero_si32vector(sint32 *v, long nl, long nh) |
---|
68 | /* --------------------------------------------------------- */ |
---|
69 | { |
---|
70 | int i; |
---|
71 | for(i=nl; i<=nh; i++) v[i] = 0; |
---|
72 | } |
---|
73 | /* --------------------------------------------------------- */ |
---|
74 | IMAGE_EXPORT(void) zero_ui32vector(uint32 *v, long nl, long nh) |
---|
75 | /* --------------------------------------------------------- */ |
---|
76 | { |
---|
77 | int i; |
---|
78 | for(i=nl; i<=nh; i++) v[i] = 0; |
---|
79 | } |
---|
80 | /* --------------------------------------------------------- */ |
---|
81 | IMAGE_EXPORT(void) zero_si64vector(sint64 *v, long nl, long nh) |
---|
82 | /* --------------------------------------------------------- */ |
---|
83 | { |
---|
84 | int i; |
---|
85 | for(i=nl; i<=nh; i++) v[i] = 0; |
---|
86 | } |
---|
87 | /* --------------------------------------------------------- */ |
---|
88 | IMAGE_EXPORT(void) zero_ui64vector(uint64 *v, long nl, long nh) |
---|
89 | /* --------------------------------------------------------- */ |
---|
90 | { |
---|
91 | int i; |
---|
92 | for(i=nl; i<=nh; i++) v[i] = 0; |
---|
93 | } |
---|
94 | /* --------------------------------------------------------- */ |
---|
95 | IMAGE_EXPORT(void) zero_f32vector(float32 *v, long nl, long nh) |
---|
96 | /* --------------------------------------------------------- */ |
---|
97 | { |
---|
98 | int i; |
---|
99 | for(i=nl; i<=nh; i++) v[i] = 0; |
---|
100 | } |
---|
101 | /* --------------------------------------------------------- */ |
---|
102 | IMAGE_EXPORT(void) zero_f64vector(float64 *v, long nl, long nh) |
---|
103 | /* --------------------------------------------------------- */ |
---|
104 | { |
---|
105 | int i; |
---|
106 | for(i=nl; i<=nh; i++) v[i] = 0; |
---|
107 | } |
---|
108 | /* ------------------------------------------------------- */ |
---|
109 | IMAGE_EXPORT(void) zero_rgb8vector(rgb8 *v, long nl, long nh) |
---|
110 | /* ------------------------------------------------------- */ |
---|
111 | { |
---|
112 | int i; |
---|
113 | rgb8 z; |
---|
114 | z.r = 0; z.g = 0; z.b = 0; |
---|
115 | for(i=nl; i<=nh; i++) v[i] = z; |
---|
116 | } |
---|
117 | /* --------------------------------------------------------- */ |
---|
118 | IMAGE_EXPORT(void) zero_rgbx8vector(rgbx8 *v, long nl, long nh) |
---|
119 | /* --------------------------------------------------------- */ |
---|
120 | { |
---|
121 | int i; |
---|
122 | rgbx8 z; |
---|
123 | z.r = 0; z.g = 0; z.b = 0; z.x = 0; |
---|
124 | for(i=nl; i<=nh; i++) v[i] = z; |
---|
125 | } |
---|
126 | /* |
---|
127 | * ------------------ |
---|
128 | * --- set_vector --- |
---|
129 | * ------------------ |
---|
130 | */ |
---|
131 | |
---|
132 | /* -------------------------------------------------------------- */ |
---|
133 | IMAGE_EXPORT(void) set_si8vector(sint8 *v, long nl, long nh, sint8 x) |
---|
134 | /* -------------------------------------------------------------- */ |
---|
135 | { |
---|
136 | int i; |
---|
137 | for(i=nl; i<=nh; i++) |
---|
138 | v[i] = x; |
---|
139 | } |
---|
140 | /* --------------------------------------------------------------- */ |
---|
141 | IMAGE_EXPORT(void) set_ui8vector(uint8 *v, long nl, long nh, uint8 x) |
---|
142 | /* --------------------------------------------------------------- */ |
---|
143 | { |
---|
144 | int i; |
---|
145 | for(i=nl; i<=nh; i++) |
---|
146 | v[i] = x; |
---|
147 | } |
---|
148 | /* ------------------------------------------------------------------ */ |
---|
149 | IMAGE_EXPORT(void) set_si16vector(sint16 *v, long nl, long nh, sint16 x) |
---|
150 | /* ------------------------------------------------------------------ */ |
---|
151 | { |
---|
152 | int i; |
---|
153 | for(i=nl; i<=nh; i++) |
---|
154 | v[i] = x; |
---|
155 | } |
---|
156 | /* ------------------------------------------------------------------ */ |
---|
157 | IMAGE_EXPORT(void) set_ui16vector(uint16 *v, long nl, long nh, uint16 x) |
---|
158 | /* ------------------------------------------------------------------ */ |
---|
159 | { |
---|
160 | int i; |
---|
161 | for(i=nl; i<=nh; i++) |
---|
162 | v[i] = x; |
---|
163 | } |
---|
164 | /* ------------------------------------------------------------------ */ |
---|
165 | IMAGE_EXPORT(void) set_si32vector(sint32 *v, long nl, long nh, sint32 x) |
---|
166 | /* ------------------------------------------------------------------ */ |
---|
167 | { |
---|
168 | int i; |
---|
169 | for(i=nl; i<=nh; i++) |
---|
170 | v[i] = x; |
---|
171 | } |
---|
172 | /* ------------------------------------------------------------------ */ |
---|
173 | IMAGE_EXPORT(void) set_ui32vector(uint32 *v, long nl, long nh, uint32 x) |
---|
174 | /* ------------------------------------------------------------------ */ |
---|
175 | { |
---|
176 | int i; |
---|
177 | for(i=nl; i<=nh; i++) |
---|
178 | v[i] = x; |
---|
179 | } |
---|
180 | /* ----------------------------------------------------------------- */ |
---|
181 | IMAGE_EXPORT(void) set_si64vector(sint64 *v, long nl, long nh, sint64 x) |
---|
182 | /* ----------------------------------------------------------------- */ |
---|
183 | { |
---|
184 | int i; |
---|
185 | for(i=nl; i<=nh; i++) |
---|
186 | v[i] = x; |
---|
187 | } |
---|
188 | /* ------------------------------------------------------------------ */ |
---|
189 | IMAGE_EXPORT(void) set_ui64vector(uint64 *v, long nl, long nh, uint64 x) |
---|
190 | /* ------------------------------------------------------------------ */ |
---|
191 | { |
---|
192 | int i; |
---|
193 | for(i=nl; i<=nh; i++) |
---|
194 | v[i] = x; |
---|
195 | } |
---|
196 | /* ------------------------------------------------------------------- */ |
---|
197 | IMAGE_EXPORT(void) set_f32vector(float32 *v, long nl, long nh, float32 x) |
---|
198 | /* ------------------------------------------------------------------- */ |
---|
199 | { |
---|
200 | int i; |
---|
201 | for(i=nl; i<=nh; i++) |
---|
202 | v[i] = x; |
---|
203 | } |
---|
204 | /* ------------------------------------------------------------------- */ |
---|
205 | IMAGE_EXPORT(void) set_f64vector(float64 *v, long nl, long nh, float64 x) |
---|
206 | /* ------------------------------------------------------------------- */ |
---|
207 | { |
---|
208 | int i; |
---|
209 | for(i=nl; i<=nh; i++) |
---|
210 | v[i] = x; |
---|
211 | } |
---|
212 | /* -------------------------------------------------------------- */ |
---|
213 | IMAGE_EXPORT(void) set_rgb8vector(rgb8 *v, long nl, long nh, rgb8 x) |
---|
214 | /* -------------------------------------------------------------- */ |
---|
215 | { |
---|
216 | int i; |
---|
217 | |
---|
218 | for(i=nl; i<=nh; i++) |
---|
219 | v[i] = x; |
---|
220 | } |
---|
221 | /* ----------------------------------------------------------------- */ |
---|
222 | IMAGE_EXPORT(void) set_rgbx8vector(rgbx8 *v, long nl, long nh, rgbx8 x) |
---|
223 | /* ----------------------------------------------------------------- */ |
---|
224 | { |
---|
225 | int i; |
---|
226 | |
---|
227 | for(i=nl; i<=nh; i++) |
---|
228 | v[i] = x; |
---|
229 | } |
---|
230 | /* |
---|
231 | * ------------------------ |
---|
232 | * --- set_vector_param --- |
---|
233 | * ------------------------ |
---|
234 | */ |
---|
235 | /* ---------------------------------------------------------------------------- */ |
---|
236 | IMAGE_EXPORT(void) set_si8vector_param(sint8 *v, long nl, long nh, sint8 x, sint8 xstep) |
---|
237 | /* ---------------------------------------------------------------------------- */ |
---|
238 | { |
---|
239 | int i; |
---|
240 | for(i=nl; i<=nh; i++) { |
---|
241 | v[i] = x; |
---|
242 | x += xstep; |
---|
243 | } |
---|
244 | } |
---|
245 | /* ---------------------------------------------------------------------------- */ |
---|
246 | IMAGE_EXPORT(void) set_ui8vector_param(uint8 *v, long nl, long nh, uint8 x, uint8 xstep) |
---|
247 | /* ---------------------------------------------------------------------------- */ |
---|
248 | { |
---|
249 | int i; |
---|
250 | for(i=nl; i<=nh; i++) { |
---|
251 | v[i] = x; |
---|
252 | x += xstep; |
---|
253 | } |
---|
254 | } |
---|
255 | /* -------------------------------------------------------------------------------- */ |
---|
256 | IMAGE_EXPORT(void) set_si16vector_param(sint16 *v, long nl, long nh, sint16 x, sint16 xstep) |
---|
257 | /* -------------------------------------------------------------------------------- */ |
---|
258 | { |
---|
259 | int i; |
---|
260 | for(i=nl; i<=nh; i++) { |
---|
261 | v[i] = x; |
---|
262 | x += xstep; |
---|
263 | } |
---|
264 | } |
---|
265 | /* -------------------------------------------------------------------------------- */ |
---|
266 | IMAGE_EXPORT(void) set_ui16vector_param(uint16 *v, long nl, long nh, uint16 x, uint16 xstep) |
---|
267 | /* -------------------------------------------------------------------------------- */ |
---|
268 | { |
---|
269 | int i; |
---|
270 | for(i=nl; i<=nh; i++) { |
---|
271 | v[i] = x; |
---|
272 | x += xstep; |
---|
273 | } |
---|
274 | } |
---|
275 | /* -------------------------------------------------------------------------------- */ |
---|
276 | IMAGE_EXPORT(void) set_si32vector_param(sint32 *v, long nl, long nh, sint32 x, sint32 xstep) |
---|
277 | /* -------------------------------------------------------------------------------- */ |
---|
278 | { |
---|
279 | int i; |
---|
280 | for(i=nl; i<=nh; i++) { |
---|
281 | v[i] = x; |
---|
282 | x += xstep; |
---|
283 | } |
---|
284 | } |
---|
285 | /* -------------------------------------------------------------------------------- */ |
---|
286 | IMAGE_EXPORT(void) set_ui32vector_param(uint32 *v, long nl, long nh, uint32 x, uint32 xstep) |
---|
287 | /* -------------------------------------------------------------------------------- */ |
---|
288 | { |
---|
289 | int i; |
---|
290 | for(i=nl; i<=nh; i++) { |
---|
291 | v[i] = x; |
---|
292 | x += xstep; |
---|
293 | } |
---|
294 | } |
---|
295 | /* -------------------------------------------------------------------------------- */ |
---|
296 | IMAGE_EXPORT(void) set_si64vector_param(sint64 *v, long nl, long nh, sint64 x, sint64 xstep) |
---|
297 | /* -------------------------------------------------------------------------------- */ |
---|
298 | { |
---|
299 | int i; |
---|
300 | for(i=nl; i<=nh; i++) { |
---|
301 | v[i] = x; |
---|
302 | x += xstep; |
---|
303 | } |
---|
304 | } |
---|
305 | /* -------------------------------------------------------------------------------- */ |
---|
306 | IMAGE_EXPORT(void) set_ui64vector_param(uint64 *v, long nl, long nh, uint64 x, uint64 xstep) |
---|
307 | /* -------------------------------------------------------------------------------- */ |
---|
308 | { |
---|
309 | int i; |
---|
310 | for(i=nl; i<=nh; i++) { |
---|
311 | v[i] = x; |
---|
312 | x += xstep; |
---|
313 | } |
---|
314 | } |
---|
315 | /* --------------------------------------------------------------------------------- */ |
---|
316 | IMAGE_EXPORT(void) set_f32vector_param(float32 *v, long nl, long nh, float32 x, float32 xstep) |
---|
317 | /* ---------------------------------------------------------------------------------- */ |
---|
318 | { |
---|
319 | int i; |
---|
320 | for(i=nl; i<=nh; i++) { |
---|
321 | v[i] = x; |
---|
322 | x += xstep; |
---|
323 | } |
---|
324 | }/* --------------------------------------------------------------------------------- */ |
---|
325 | IMAGE_EXPORT(void) set_f64vector_param(float64 *v, long nl, long nh, float64 x, float64 xstep) |
---|
326 | /* --------------------------------------------------------------------------------- */ |
---|
327 | { |
---|
328 | int i; |
---|
329 | for(i=nl; i<=nh; i++) { |
---|
330 | v[i] = x; |
---|
331 | x += xstep; |
---|
332 | } |
---|
333 | }/* ------------------------------------------------------------------------- */ |
---|
334 | IMAGE_EXPORT(void) set_rgb8vector_param(rgb8 *v, long nl, long nh, rgb8 x, rgb8 xstep) |
---|
335 | /* ------------------------------------------------------------------------- */ |
---|
336 | { |
---|
337 | int i; |
---|
338 | for(i=nl; i<=nh; i++) { |
---|
339 | v[i] = x; |
---|
340 | RGB8_ADD(x, xstep, x); |
---|
341 | } |
---|
342 | }/* ----------------------------------------------------------------------------- */ |
---|
343 | IMAGE_EXPORT(void) set_rgbx8vector_param(rgbx8 *v, long nl, long nh, rgbx8 x, rgbx8 xstep) |
---|
344 | /* ------------------------------------------------------------------------------ */ |
---|
345 | { |
---|
346 | int i; |
---|
347 | |
---|
348 | for(i=nl; i<=nh; i++) { |
---|
349 | v[i] = x; |
---|
350 | RGB8_ADD(x, xstep, x); |
---|
351 | } |
---|
352 | } |
---|
353 | /* |
---|
354 | * -------------------- |
---|
355 | * --- set_vector_j --- |
---|
356 | * -------------------- |
---|
357 | */ |
---|
358 | /* -------------------------------------------------------- */ |
---|
359 | IMAGE_EXPORT(void) set_si8vector_j(sint8 *v, long nl, long nh) |
---|
360 | /* -------------------------------------------------------- */ |
---|
361 | { |
---|
362 | int i; |
---|
363 | |
---|
364 | for(i=nl; i<=nh; i++) |
---|
365 | v[i] = (sint8) i; |
---|
366 | } |
---|
367 | /* -------------------------------------------------------- */ |
---|
368 | IMAGE_EXPORT(void) set_ui8vector_j(uint8 *v, long nl, long nh) |
---|
369 | /* -------------------------------------------------------- */ |
---|
370 | { |
---|
371 | int i; |
---|
372 | |
---|
373 | for(i=nl; i<=nh; i++) |
---|
374 | v[i] = (uint8) i; |
---|
375 | } |
---|
376 | /* ---------------------------------------------------------- */ |
---|
377 | IMAGE_EXPORT(void) set_si16vector_j(sint16 *v, long nl, long nh) |
---|
378 | /* ---------------------------------------------------------- */ |
---|
379 | { |
---|
380 | int i; |
---|
381 | |
---|
382 | for(i=nl; i<=nh; i++) |
---|
383 | v[i] = (sint16) i; |
---|
384 | } |
---|
385 | /* ---------------------------------------------------------- */ |
---|
386 | IMAGE_EXPORT(void) set_ui16vector_j(uint16 *v, long nl, long nh) |
---|
387 | /* ---------------------------------------------------------- */ |
---|
388 | { |
---|
389 | int i; |
---|
390 | |
---|
391 | for(i=nl; i<=nh; i++) |
---|
392 | v[i] = (uint16) i; |
---|
393 | } |
---|
394 | /* ---------------------------------------------------------- */ |
---|
395 | IMAGE_EXPORT(void) set_si32vector_j(sint32 *v, long nl, long nh) |
---|
396 | /* ---------------------------------------------------------- */ |
---|
397 | { |
---|
398 | int i; |
---|
399 | |
---|
400 | for(i=nl; i<=nh; i++) |
---|
401 | v[i] = (sint32) i; |
---|
402 | } |
---|
403 | /* ---------------------------------------------------------- */ |
---|
404 | IMAGE_EXPORT(void) set_ui32vector_j(uint32 *v, long nl, long nh) |
---|
405 | /* ---------------------------------------------------------- */ |
---|
406 | { |
---|
407 | int i; |
---|
408 | |
---|
409 | for(i=nl; i<=nh; i++) |
---|
410 | v[i] = (uint32) i; |
---|
411 | } |
---|
412 | /* ---------------------------------------------------------- */ |
---|
413 | IMAGE_EXPORT(void) set_si64vector_j(sint64 *v, long nl, long nh) |
---|
414 | /* ---------------------------------------------------------- */ |
---|
415 | { |
---|
416 | int i; |
---|
417 | |
---|
418 | for(i=nl; i<=nh; i++) |
---|
419 | v[i] = (sint64) i; |
---|
420 | } |
---|
421 | /* ---------------------------------------------------------- */ |
---|
422 | IMAGE_EXPORT(void) set_ui64vector_j(uint64 *v, long nl, long nh) |
---|
423 | /* ---------------------------------------------------------- */ |
---|
424 | { |
---|
425 | int i; |
---|
426 | |
---|
427 | for(i=nl; i<=nh; i++) |
---|
428 | v[i] = (uint64) i; |
---|
429 | } |
---|
430 | /* ---------------------------------------------------------- */ |
---|
431 | IMAGE_EXPORT(void) set_f32vector_j(float32 *v, long nl, long nh) |
---|
432 | /* ---------------------------------------------------------- */ |
---|
433 | { |
---|
434 | int i; |
---|
435 | |
---|
436 | for(i=nl; i<=nh; i++) |
---|
437 | v[i] = (float32) i; |
---|
438 | } |
---|
439 | /* ---------------------------------------------------------- */ |
---|
440 | IMAGE_EXPORT(void) set_f64vector_j(float64 *v, long nl, long nh) |
---|
441 | /* ---------------------------------------------------------- */ |
---|
442 | { |
---|
443 | int i; |
---|
444 | |
---|
445 | for(i=nl; i<=nh; i++) |
---|
446 | v[i] = (float64) i; |
---|
447 | } |
---|
448 | /* -------------------------------------------------------- */ |
---|
449 | IMAGE_EXPORT(void) set_rgb8vector_j(rgb8 *v, long nl, long nh) |
---|
450 | /* -------------------------------------------------------- */ |
---|
451 | { |
---|
452 | int i; |
---|
453 | |
---|
454 | for(i=nl; i<=nh; i++) { |
---|
455 | v[i].r = (uint8) i; |
---|
456 | v[i].g = (uint8) i; |
---|
457 | v[i].b = (uint8) i; |
---|
458 | } |
---|
459 | } |
---|
460 | /* ---------------------------------------------------------- */ |
---|
461 | IMAGE_EXPORT(void) set_rgbx8vector_j(rgbx8 *v, long nl, long nh) |
---|
462 | /* ---------------------------------------------------------- */ |
---|
463 | { |
---|
464 | int i; |
---|
465 | |
---|
466 | for(i=nl; i<=nh; i++) { |
---|
467 | v[i].r = (uint8) i; |
---|
468 | v[i].g = (uint8) i; |
---|
469 | v[i].b = (uint8) i; |
---|
470 | v[i].x = (uint8) 255; |
---|
471 | } |
---|
472 | } |
---|
473 | |
---|
474 | /* |
---|
475 | * ---------------------- |
---|
476 | * --- set_vector_str --- |
---|
477 | * ---------------------- |
---|
478 | */ |
---|
479 | |
---|
480 | /* --------------------------------------------------------------------- */ |
---|
481 | IMAGE_EXPORT(void) set_si8vector_str(sint8 *v, long nl, long nh, char *str) |
---|
482 | /* --------------------------------------------------------------------- */ |
---|
483 | { |
---|
484 | int i; |
---|
485 | char c[1]; |
---|
486 | for(i=nl; i<=nh; i++) { |
---|
487 | |
---|
488 | *c = *str++; |
---|
489 | if(isdigit(*c)) |
---|
490 | v[i] = (sint8) atoi(c); |
---|
491 | else |
---|
492 | v[i] = (sint8) 0; |
---|
493 | } |
---|
494 | } |
---|
495 | /* --------------------------------------------------------------------- */ |
---|
496 | IMAGE_EXPORT(void) set_ui8vector_str(uint8 *v, long nl, long nh, char *str) |
---|
497 | /* --------------------------------------------------------------------- */ |
---|
498 | { |
---|
499 | int i; |
---|
500 | char c[1]; |
---|
501 | for(i=nl; i<=nh; i++) { |
---|
502 | |
---|
503 | *c = *str++; |
---|
504 | if(isdigit(*c)) |
---|
505 | v[i] = (uint8) atoi(c); |
---|
506 | else |
---|
507 | v[i] = (uint8) 0; |
---|
508 | } |
---|
509 | } |
---|
510 | /* ----------------------------------------------------------------------- */ |
---|
511 | IMAGE_EXPORT(void) set_si16vector_str(sint16 *v, long nl, long nh, char *str) |
---|
512 | /* ----------------------------------------------------------------------- */ |
---|
513 | { |
---|
514 | int i; |
---|
515 | char c[1]; |
---|
516 | for(i=nl; i<=nh; i++) { |
---|
517 | |
---|
518 | *c = *str++; |
---|
519 | if(isdigit(*c)) |
---|
520 | v[i] = (sint16) atoi(c); |
---|
521 | else |
---|
522 | v[i] = (sint16) 0; |
---|
523 | } |
---|
524 | } |
---|
525 | /* ----------------------------------------------------------------------- */ |
---|
526 | IMAGE_EXPORT(void) set_ui16vector_str(uint16 *v, long nl, long nh, char *str) |
---|
527 | /* ----------------------------------------------------------------------- */ |
---|
528 | { |
---|
529 | int i; |
---|
530 | char c[1]; |
---|
531 | for(i=nl; i<=nh; i++) { |
---|
532 | |
---|
533 | *c = *str++; |
---|
534 | if(isdigit(*c)) |
---|
535 | v[i] = (uint16) atoi(c); |
---|
536 | else |
---|
537 | v[i] = (uint16) 0; |
---|
538 | } |
---|
539 | } |
---|
540 | /* ----------------------------------------------------------------------- */ |
---|
541 | IMAGE_EXPORT(void) set_si32vector_str(sint32 *v, long nl, long nh, char *str) |
---|
542 | /* ----------------------------------------------------------------------- */ |
---|
543 | { |
---|
544 | int i; |
---|
545 | char c[1]; |
---|
546 | for(i=nl; i<=nh; i++) { |
---|
547 | |
---|
548 | *c = *str++; |
---|
549 | if(isdigit(*c)) |
---|
550 | v[i] = (sint32) atoi(c); |
---|
551 | else |
---|
552 | v[i] = (sint32) 0; |
---|
553 | } |
---|
554 | } |
---|
555 | /* ----------------------------------------------------------------------- */ |
---|
556 | IMAGE_EXPORT(void) set_ui32vector_str(uint32 *v, long nl, long nh, char *str) |
---|
557 | /* ----------------------------------------------------------------------- */ |
---|
558 | { |
---|
559 | int i; |
---|
560 | char c[1]; |
---|
561 | for(i=nl; i<=nh; i++) { |
---|
562 | |
---|
563 | *c = *str++; |
---|
564 | if(isdigit(*c)) |
---|
565 | v[i] = (uint32) atoi(c); |
---|
566 | else |
---|
567 | v[i] = (uint32) 0; |
---|
568 | } |
---|
569 | } |
---|