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