2882
|
1 /* |
|
2 |
|
3 Copyright (C) 1996, 1997 John W. Eaton |
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #ifdef HAVE_CONFIG_H |
|
24 #include <config.h> |
|
25 #endif |
|
26 |
3503
|
27 #include <iostream> |
2882
|
28 |
4051
|
29 #include "lo-sstream.h" |
2882
|
30 #include "lo-utils.h" |
|
31 |
4513
|
32 #include "Cell.h" |
2882
|
33 #include "defun.h" |
|
34 #include "error.h" |
4994
|
35 #include "ov.h" |
2882
|
36 #include "ov-list.h" |
|
37 #include "unwind-prot.h" |
|
38 |
4687
|
39 #include "byte-swap.h" |
|
40 #include "ls-oct-ascii.h" |
|
41 #include "ls-oct-binary.h" |
|
42 #include "ls-hdf5.h" |
|
43 #include "ls-utils.h" |
|
44 |
3219
|
45 DEFINE_OCTAVE_ALLOCATOR (octave_list); |
2882
|
46 |
4612
|
47 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_list, "list", "list"); |
2882
|
48 |
4513
|
49 octave_list::octave_list (const Cell& c) |
4591
|
50 : octave_base_value (), data () |
4513
|
51 { |
5275
|
52 octave_idx_type n = c.length (); |
4513
|
53 |
4591
|
54 data.resize (dim_vector (1, n)); |
4513
|
55 |
5275
|
56 for (octave_idx_type i = 0; i < n; i++) |
4591
|
57 data(i) = c(i); |
4513
|
58 } |
|
59 |
4994
|
60 octave_value_list |
4247
|
61 octave_list::subsref (const std::string& type, |
4994
|
62 const std::list<octave_value_list>& idx, int nargout) |
3933
|
63 { |
4994
|
64 octave_value_list retval; |
3933
|
65 |
|
66 switch (type[0]) |
|
67 { |
|
68 case '(': |
|
69 { |
|
70 octave_value_list tmp_idx = idx.front (); |
|
71 |
|
72 if (tmp_idx.length () == 1) |
|
73 { |
|
74 idx_vector i = tmp_idx (0).index_vector (); |
|
75 |
4842
|
76 Cell tmp = data.index (i); |
|
77 |
4994
|
78 retval(0) = octave_value (new octave_list (tmp)); |
3933
|
79 } |
|
80 else |
|
81 error ("only one index allowed for lists"); |
|
82 } |
|
83 break; |
|
84 |
|
85 case '{': |
|
86 { |
|
87 octave_value_list tmp_idx = idx.front (); |
|
88 |
|
89 if (tmp_idx.length () == 1) |
|
90 { |
|
91 idx_vector i = tmp_idx (0).index_vector (); |
|
92 |
4591
|
93 Cell tmp = data.index (i); |
3933
|
94 |
|
95 if (tmp.length () == 1) |
4994
|
96 retval(0) = tmp(0); |
4842
|
97 else |
4994
|
98 retval(0) = octave_value (tmp, true); |
3933
|
99 } |
|
100 else |
|
101 error ("only one index allowed for lists"); |
|
102 } |
|
103 break; |
|
104 |
|
105 case '.': |
|
106 { |
|
107 std::string nm = type_name (); |
|
108 error ("%s cannot be indexed with %c", nm.c_str (), type[0]); |
|
109 } |
|
110 break; |
|
111 |
|
112 default: |
|
113 panic_impossible (); |
|
114 } |
|
115 |
4994
|
116 // XXX FIXME XXX -- perhaps there should be an |
|
117 // octave_value_list::next_subsref member function? See also |
|
118 // octave_user_function::subsref. |
|
119 |
|
120 if (idx.size () > 1) |
|
121 retval = retval(0).next_subsref (nargout, type, idx); |
|
122 |
|
123 return retval; |
3933
|
124 } |
|
125 |
|
126 octave_value |
|
127 octave_list::do_index_op (const octave_value_list& idx, int resize_ok) |
2882
|
128 { |
|
129 octave_value retval; |
|
130 |
|
131 if (idx.length () == 1) |
|
132 { |
3219
|
133 idx_vector i = idx (0).index_vector (); |
2882
|
134 |
4591
|
135 retval = octave_list (data.index (i, resize_ok)); |
2882
|
136 } |
|
137 else |
|
138 error ("lists may only be indexed by a single scalar"); |
|
139 |
|
140 return retval; |
|
141 } |
|
142 |
3933
|
143 octave_value |
4247
|
144 octave_list::subsasgn (const std::string& type, |
4219
|
145 const std::list<octave_value_list>& idx, |
3933
|
146 const octave_value& rhs) |
|
147 { |
|
148 octave_value retval; |
|
149 |
5275
|
150 octave_idx_type n = type.length (); |
3933
|
151 |
|
152 octave_value t_rhs = rhs; |
|
153 |
|
154 if (n > 1) |
|
155 { |
|
156 switch (type[0]) |
|
157 { |
|
158 case '(': |
|
159 { |
|
160 octave_value tmp = do_index_op (idx.front (), true); |
|
161 |
|
162 if (! tmp.is_defined ()) |
|
163 tmp = octave_value::empty_conv (type.substr (1), rhs); |
|
164 |
|
165 if (! error_state) |
|
166 { |
4219
|
167 std::list<octave_value_list> next_idx (idx); |
3933
|
168 |
4219
|
169 next_idx.erase (next_idx.begin ()); |
3933
|
170 |
|
171 t_rhs = tmp.subsasgn (type.substr (1), next_idx, rhs); |
|
172 } |
|
173 } |
|
174 break; |
|
175 |
|
176 case '{': |
|
177 case '.': |
|
178 { |
|
179 std::string nm = type_name (); |
|
180 error ("%s cannot be indexed with %c", nm.c_str (), type[0]); |
|
181 } |
|
182 break; |
|
183 |
|
184 default: |
|
185 panic_impossible (); |
|
186 } |
|
187 } |
|
188 |
3940
|
189 if (! error_state) |
3933
|
190 { |
3940
|
191 switch (type[0]) |
|
192 { |
|
193 case '(': |
|
194 { |
|
195 octave_value_list i = idx.front (); |
3933
|
196 |
5275
|
197 octave_idx_type len = i.length (); |
4769
|
198 |
5275
|
199 for (octave_idx_type k = 0; k < len; k++) |
4769
|
200 data.set_index (i(k).index_vector ()); |
|
201 |
|
202 ::assign (data, Cell (t_rhs), Cell::resize_fill_value ()); |
3933
|
203 |
3940
|
204 retval = octave_value (this, count + 1); |
|
205 } |
|
206 break; |
3933
|
207 |
3940
|
208 case '{': |
|
209 case '.': |
|
210 { |
|
211 std::string nm = type_name (); |
|
212 error ("%s cannot be indexed with %c", nm.c_str (), type[0]); |
|
213 } |
|
214 break; |
3933
|
215 |
3940
|
216 default: |
|
217 panic_impossible (); |
|
218 } |
3933
|
219 } |
|
220 |
|
221 return retval; |
|
222 } |
|
223 |
2882
|
224 void |
3196
|
225 octave_list::assign (const octave_value_list& idx, const octave_value& rhs) |
|
226 { |
|
227 if (idx.length () == 1) |
|
228 { |
3202
|
229 int i = idx(0).int_value (true); |
3196
|
230 |
|
231 if (! error_state) |
|
232 { |
5275
|
233 octave_idx_type n = data.length (); |
3196
|
234 |
4461
|
235 if (i > 0) |
|
236 { |
|
237 if (Vwarn_resize_on_range_error && i > n) |
|
238 warning ("list index = %d out of range", i); |
|
239 |
4591
|
240 data(i-1) = rhs; |
4461
|
241 } |
3196
|
242 else |
3202
|
243 error ("list index = %d out of range", i); |
3196
|
244 } |
3202
|
245 else |
|
246 error ("list index must be an integer"); |
3196
|
247 } |
|
248 else |
|
249 error ("lists may only be indexed by a single scalar"); |
|
250 } |
|
251 |
4791
|
252 size_t |
|
253 octave_list::byte_size (void) const |
|
254 { |
|
255 size_t retval = 0; |
|
256 |
5275
|
257 for (octave_idx_type i = 0; i < numel (); i++) |
4791
|
258 retval += data(i).byte_size (); |
|
259 |
|
260 return retval; |
|
261 } |
|
262 |
4591
|
263 octave_value_list |
|
264 octave_list::list_value (void) const |
|
265 { |
|
266 octave_value_list retval; |
|
267 |
5275
|
268 octave_idx_type n = data.length (); |
4591
|
269 |
|
270 retval.resize (n); |
|
271 |
5275
|
272 for (octave_idx_type i = 0; i < n; i++) |
4591
|
273 retval(i) = data(i); |
|
274 |
|
275 return retval; |
|
276 } |
|
277 |
3196
|
278 void |
3523
|
279 octave_list::print (std::ostream& os, bool) const |
2901
|
280 { |
|
281 print_raw (os); |
|
282 } |
|
283 |
|
284 void |
3523
|
285 octave_list::print_raw (std::ostream& os, bool) const |
2882
|
286 { |
2985
|
287 unwind_protect::begin_frame ("octave_list_print"); |
2882
|
288 |
5275
|
289 octave_idx_type n = data.length (); |
2882
|
290 |
3196
|
291 if (n > 0) |
2882
|
292 { |
3196
|
293 indent (os); |
|
294 os << "("; |
|
295 newline (os); |
|
296 |
|
297 increment_indent_level (); |
2916
|
298 |
5275
|
299 for (octave_idx_type i = 0; i < n; i++) |
3196
|
300 { |
4051
|
301 OSSTREAM buf; |
|
302 |
|
303 buf << "[" << i+1 << "]" << OSSTREAM_ENDS; |
2882
|
304 |
4591
|
305 octave_value val = data(i); |
2916
|
306 |
4051
|
307 val.print_with_name (os, OSSTREAM_STR (buf)); |
3196
|
308 |
4051
|
309 OSSTREAM_FREEZE (buf); |
3196
|
310 } |
2882
|
311 |
3196
|
312 decrement_indent_level (); |
2882
|
313 |
3196
|
314 indent (os); |
|
315 os << ")"; |
|
316 } |
|
317 else |
|
318 os << "()"; |
|
319 |
2901
|
320 newline (os); |
2882
|
321 |
2985
|
322 unwind_protect::run_frame ("octave_list_print"); |
2882
|
323 } |
|
324 |
2901
|
325 bool |
3523
|
326 octave_list::print_name_tag (std::ostream& os, const std::string& name) const |
2901
|
327 { |
|
328 indent (os); |
4591
|
329 if (data.length () == 0) |
3196
|
330 os << name << " = "; |
|
331 else |
|
332 { |
|
333 os << name << " ="; |
|
334 newline (os); |
|
335 } |
2901
|
336 return false; |
|
337 } |
|
338 |
2993
|
339 DEFUN (list, args, , |
3447
|
340 "-*- texinfo -*-\n\ |
3448
|
341 @deftypefn {Built-in Function} {} list (@var{a1}, @var{a2}, @dots{})\n\ |
3447
|
342 Create a new list with elements given by the arguments @var{a1},\n\ |
|
343 @var{a2}, @dots{}.\n\ |
|
344 @end deftypefn") |
2882
|
345 { |
4591
|
346 static bool warned = false; |
|
347 |
|
348 if (! warned) |
|
349 { |
|
350 warning ("list objects are deprecated; use cell arrays instead"); |
|
351 warned = true; |
|
352 } |
|
353 |
2882
|
354 return octave_value (args); |
|
355 } |
|
356 |
3219
|
357 DEFUN (nth, args, , |
3447
|
358 "-*- texinfo -*-\n\ |
|
359 @deftypefn {Built-in Function} {} nth (@var{list}, @var{n})\n\ |
|
360 Return the @var{n}-th element of @var{list}.\n\ |
|
361 @end deftypefn") |
3219
|
362 { |
|
363 octave_value retval; |
|
364 |
|
365 if (args.length () == 2) |
|
366 { |
|
367 octave_value_list lst = args(0).list_value (); |
|
368 |
|
369 if (! error_state) |
|
370 { |
|
371 int n = args(1).int_value (true); |
|
372 |
|
373 if (! error_state) |
|
374 { |
|
375 if (n > 0 && n <= lst.length ()) |
|
376 retval = lst(n-1); |
|
377 else |
|
378 error ("nth: index = %d out of range", n); |
|
379 } |
|
380 else |
|
381 error ("nth: second argument must be an integer"); |
|
382 } |
|
383 else |
|
384 error ("nth: first argument must be a list"); |
|
385 } |
|
386 else |
|
387 print_usage ("nth"); |
|
388 |
|
389 return retval; |
|
390 } |
|
391 |
2882
|
392 DEFUN (append, args, , |
3447
|
393 "-*- texinfo -*-\n\ |
|
394 @deftypefn {Built-in Function} {} append (@var{list}, @var{a1}, @var{a2}, @dots{})\n\ |
|
395 Return a new list created by appending @var{a1}, @var{a1}, @dots{}, to\n\ |
|
396 @var{list}. If any of the arguments to be appended is a list, its\n\ |
|
397 elements are appended individually. For example,\n\ |
2882
|
398 \n\ |
3447
|
399 @example\n\ |
|
400 x = list (1, 2);\n\ |
|
401 y = list (3, 4);\n\ |
|
402 append (x, y);\n\ |
|
403 @end example\n\ |
3219
|
404 \n\ |
3447
|
405 @noindent\n\ |
|
406 results in the list containing the four elements @samp{(1 2 3 4)}, not\n\ |
|
407 a list containing the three elements @samp{(1 2 (3 4))}.\n\ |
|
408 @end deftypefn") |
2882
|
409 { |
|
410 octave_value retval; |
|
411 |
|
412 int nargin = args.length (); |
|
413 |
|
414 if (nargin > 1) |
|
415 { |
|
416 octave_value_list tmp = args(0).list_value (); |
|
417 |
|
418 if (! error_state) |
|
419 { |
|
420 for (int i = 1; i < nargin; i++) |
3219
|
421 { |
|
422 octave_value ov = args(i); |
|
423 |
|
424 if (ov.is_list ()) |
|
425 tmp.append (ov.list_value ()); |
|
426 else |
|
427 tmp.append (ov); |
|
428 } |
2882
|
429 |
4233
|
430 retval = octave_value (tmp); |
2882
|
431 } |
|
432 } |
|
433 else |
|
434 print_usage ("append"); |
|
435 |
|
436 return retval; |
|
437 } |
|
438 |
|
439 DEFUN (reverse, args, , |
3447
|
440 "-*- texinfo -*-\n\ |
|
441 @deftypefn {Built-in Function} {} reverse (@var{list})\n\ |
|
442 Return a new list created by reversing the elements of @var{list}.\n\ |
|
443 @end deftypefn") |
2882
|
444 { |
|
445 octave_value retval; |
|
446 |
|
447 int nargin = args.length (); |
|
448 |
|
449 if (nargin == 1) |
|
450 { |
|
451 octave_value_list tmp = args(0).list_value (); |
|
452 |
|
453 if (! error_state) |
4233
|
454 retval = octave_value (tmp.reverse ()); |
2882
|
455 } |
|
456 else |
|
457 print_usage ("reverse"); |
|
458 |
|
459 return retval; |
|
460 } |
|
461 |
3196
|
462 DEFUN (splice, args, , |
3447
|
463 "-*- texinfo -*-\n\ |
|
464 @deftypefn {Built-in Function} {} splice (@var{list_1}, @var{offset}, @var{length}, @var{list_2})\n\ |
|
465 Replace @var{length} elements of @var{list_1} beginning at\n\ |
|
466 @var{offset} with the contents of @var{list_2} (if any). If\n\ |
|
467 @var{length} is omitted, all elements from @var{offset} to the end of\n\ |
|
468 @var{list_1} are replaced. As a special case, if @var{offset} is one\n\ |
|
469 greater than the length of @var{list_1} and @var{length} is 0, splice\n\ |
3448
|
470 is equivalent to @code{append (@var{list_1}, @var{list_2})}.\n\ |
3447
|
471 @end deftypefn") |
3196
|
472 { |
|
473 octave_value retval; |
|
474 |
|
475 int nargin = args.length (); |
|
476 |
|
477 if (nargin > 1 && nargin < 5) |
|
478 { |
|
479 octave_value_list list_1 = args(0).list_value (); |
|
480 |
|
481 if (! error_state) |
|
482 { |
3202
|
483 int offset = args(1).int_value (true); |
3196
|
484 |
|
485 if (! error_state) |
|
486 { |
3202
|
487 offset--; |
|
488 |
|
489 int length = 0; |
|
490 |
|
491 octave_value_list list_2; |
3196
|
492 |
3202
|
493 if (nargin < 3) |
|
494 length = list_1.length () - offset; |
|
495 else |
|
496 { |
|
497 length = args(2).int_value (true); |
3196
|
498 |
3202
|
499 if (! error_state) |
3196
|
500 { |
3202
|
501 if (nargin == 4) |
|
502 { |
|
503 list_2 = args(3).list_value (); |
3196
|
504 |
3202
|
505 if (error_state) |
|
506 error ("splice: fourth argument must be a list"); |
3196
|
507 } |
|
508 } |
3202
|
509 else |
|
510 error ("splice: LENGTH must be an integer"); |
|
511 } |
3196
|
512 |
3202
|
513 if (! error_state) |
4233
|
514 retval = octave_value (list_1.splice (offset, length, list_2)); |
3196
|
515 } |
|
516 else |
|
517 error ("splice: OFFSET must be an integer"); |
|
518 } |
|
519 else |
|
520 error ("splice: first argument must be a list"); |
|
521 } |
|
522 else |
|
523 print_usage ("splice"); |
|
524 |
|
525 return retval; |
|
526 } |
|
527 |
4687
|
528 bool |
|
529 octave_list::save_ascii (std::ostream& os, bool& infnan_warned, |
|
530 bool strip_nan_and_inf) |
|
531 { |
|
532 octave_value_list lst = list_value (); |
|
533 os << "# length: " << lst.length () << "\n"; |
|
534 |
|
535 for (int i = 0; i < lst.length (); ++i) |
|
536 { |
|
537 // should we use lst.name_tags () to label the elements? |
|
538 char s[20]; |
|
539 sprintf (s, "_%d", i); |
|
540 bool b = save_ascii_data (os, lst (i), s, infnan_warned, |
|
541 strip_nan_and_inf, 0, 0); |
|
542 |
|
543 if (! b) |
|
544 return false; |
|
545 } |
|
546 |
|
547 return true; |
|
548 } |
|
549 |
|
550 bool |
|
551 octave_list::load_ascii (std::istream& is) |
|
552 { |
|
553 int len = 0; |
|
554 bool success = true; |
|
555 |
|
556 if (extract_keyword (is, "length", len) && len >= 0) |
|
557 { |
|
558 if (len > 0) |
|
559 { |
|
560 octave_value_list lst; |
|
561 |
|
562 for (int j = 0; j < len; j++) |
|
563 { |
|
564 octave_value t2; |
|
565 bool dummy; |
|
566 |
|
567 // recurse to read list elements |
|
568 std::string nm |
|
569 = read_ascii_data (is, std::string (), dummy, t2, count); |
|
570 |
|
571 if (!is) |
|
572 break; |
|
573 |
|
574 lst.append (t2); |
|
575 } |
|
576 |
|
577 if (is) |
|
578 data = lst; |
|
579 else |
|
580 { |
|
581 error ("load: failed to load list"); |
|
582 success = false; |
|
583 } |
|
584 } |
|
585 else if (len == 0 ) |
|
586 data = Cell (0, 0); |
|
587 else |
|
588 panic_impossible (); |
|
589 } |
|
590 else { |
|
591 error ("load: failed to extract number of elements in list"); |
|
592 success = false; |
|
593 } |
|
594 |
|
595 return success; |
|
596 } |
|
597 |
|
598 bool |
|
599 octave_list::save_binary (std::ostream& os, bool& save_as_floats) |
|
600 { |
|
601 octave_value_list lst = list_value (); |
|
602 |
|
603 FOUR_BYTE_INT len = lst.length(); |
|
604 os.write (X_CAST (char *, &len), 4); |
|
605 |
|
606 for (int i = 0; i < lst.length (); i++) |
|
607 { |
|
608 // should we use lst.name_tags () to label the elements? |
|
609 char s[20]; |
|
610 sprintf (s, "_%d", i); |
|
611 |
|
612 // Recurse to print sub-value. |
|
613 bool b = save_binary_data (os, lst(i), s, "", 0, save_as_floats); |
|
614 |
|
615 if (! b) |
|
616 return false; |
|
617 } |
|
618 |
|
619 return true; |
|
620 } |
|
621 |
|
622 bool |
|
623 octave_list::load_binary (std::istream& is, bool swap, |
|
624 oct_mach_info::float_format fmt) |
|
625 { |
|
626 FOUR_BYTE_INT len; |
|
627 if (! is.read (X_CAST (char *, &len), 4)) |
|
628 return false; |
|
629 if (swap) |
4944
|
630 swap_bytes<4> (&len); |
4687
|
631 |
|
632 if (len > 0) |
|
633 { |
|
634 octave_value_list lst; |
|
635 |
5275
|
636 for (octave_idx_type i = 0; i < len; i++) |
4687
|
637 { |
|
638 octave_value t2; |
|
639 bool dummy; |
|
640 std::string doc; |
|
641 |
|
642 // recurse to read list elements |
|
643 std::string nm = read_binary_data (is, swap, fmt, std::string (), |
|
644 dummy, t2, doc); |
|
645 |
|
646 if (!is) |
|
647 return false; |
|
648 |
|
649 lst.append(t2); |
|
650 } |
|
651 |
|
652 if (is) |
|
653 data = lst; |
|
654 else |
|
655 { |
|
656 error ("load: failed to load list"); |
|
657 return false; |
|
658 } |
|
659 |
|
660 } |
|
661 else if (len == 0 ) |
|
662 data = Cell (0, 0); |
|
663 else |
|
664 return false; |
|
665 |
|
666 return true; |
|
667 } |
|
668 |
|
669 #if defined (HAVE_HDF5) |
4944
|
670 |
4687
|
671 bool |
|
672 octave_list::save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats) |
|
673 { |
|
674 hid_t data_hid = -1; |
|
675 |
|
676 data_hid = H5Gcreate (loc_id, name, 0); |
|
677 if (data_hid < 0) return false; |
|
678 |
|
679 // recursively add each element of the list to this group |
|
680 octave_value_list lst = list_value (); |
|
681 |
5275
|
682 for (octave_idx_type i = 0; i < lst.length (); ++i) |
4687
|
683 { |
|
684 // should we use lst.name_tags () to label the elements? |
|
685 char s[20]; |
|
686 sprintf (s, "_%d", i); |
|
687 bool retval2 = add_hdf5_data (data_hid, lst (i), s, "", |
|
688 false, save_as_floats); |
|
689 if (! retval2) |
|
690 break; |
|
691 } |
|
692 |
|
693 H5Gclose (data_hid); |
4837
|
694 |
4687
|
695 return true; |
|
696 } |
|
697 |
|
698 bool |
|
699 octave_list::load_hdf5 (hid_t loc_id, const char *name, |
|
700 bool have_h5giterate_bug) |
|
701 { |
|
702 bool retval = false; |
|
703 |
|
704 hdf5_callback_data dsub; |
|
705 |
4696
|
706 herr_t retval2 = -1; |
4687
|
707 octave_value_list lst; |
|
708 int current_item = 0; |
4696
|
709 #ifdef HAVE_H5GGET_NUM_OBJS |
|
710 hsize_t num_obj = 0; |
5060
|
711 hid_t group_id = H5Gopen (loc_id, name); |
|
712 H5Gget_num_objs (group_id, &num_obj); |
|
713 H5Gclose (group_id); |
4696
|
714 |
|
715 while (current_item < static_cast<int> (num_obj) |
|
716 && (retval2 = H5Giterate (loc_id, name, ¤t_item, |
|
717 hdf5_read_next_data, &dsub)) > 0) |
|
718 #else |
4687
|
719 while ((retval2 = H5Giterate (loc_id, name, ¤t_item, |
|
720 hdf5_read_next_data, &dsub)) > 0) |
4696
|
721 #endif |
4687
|
722 { |
|
723 lst.append (dsub.tc); |
|
724 |
|
725 if (have_h5giterate_bug) |
|
726 current_item++; // H5Giterate returned the last index processed |
|
727 } |
|
728 |
|
729 if (retval2 >= 0) |
|
730 { |
|
731 data = lst; |
|
732 retval = true; |
|
733 } |
|
734 |
|
735 return retval; |
|
736 } |
4944
|
737 |
4687
|
738 #endif |
|
739 |
2882
|
740 /* |
|
741 ;;; Local Variables: *** |
|
742 ;;; mode: C++ *** |
|
743 ;;; End: *** |
|
744 */ |