Mercurial > octave-nkf
annotate src/ov-list.cc @ 8874:bd1b1fe9c6e9 ss-3-1-53
bump version info for snapshot
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 25 Feb 2009 18:35:47 -0500 |
parents | 280fae940bb0 |
children | eb63fbe60fab |
rev | line source |
---|---|
2882 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1996, 1997, 1998, 2000, 2002, 2003, 2004, 2005, 2006, |
4 2007 John W. Eaton | |
2882 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
2882 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
2882 | 21 |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 #include <config.h> | |
26 #endif | |
27 | |
3503 | 28 #include <iostream> |
5765 | 29 #include <sstream> |
2882 | 30 |
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 { | |
8679
280fae940bb0
optimize scalar indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8290
diff
changeset
|
75 Cell tmp = data.index (tmp_idx (0)); |
4842 | 76 |
4994 | 77 retval(0) = octave_value (new octave_list (tmp)); |
3933 | 78 } |
79 else | |
80 error ("only one index allowed for lists"); | |
81 } | |
82 break; | |
83 | |
84 case '{': | |
85 { | |
86 octave_value_list tmp_idx = idx.front (); | |
87 | |
88 if (tmp_idx.length () == 1) | |
89 { | |
8679
280fae940bb0
optimize scalar indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8290
diff
changeset
|
90 Cell tmp = data.index (tmp_idx (0)); |
3933 | 91 |
92 if (tmp.length () == 1) | |
4994 | 93 retval(0) = tmp(0); |
4842 | 94 else |
4994 | 95 retval(0) = octave_value (tmp, true); |
3933 | 96 } |
97 else | |
98 error ("only one index allowed for lists"); | |
99 } | |
100 break; | |
101 | |
102 case '.': | |
103 { | |
104 std::string nm = type_name (); | |
105 error ("%s cannot be indexed with %c", nm.c_str (), type[0]); | |
106 } | |
107 break; | |
108 | |
109 default: | |
110 panic_impossible (); | |
111 } | |
112 | |
5775 | 113 // FIXME -- perhaps there should be an |
4994 | 114 // octave_value_list::next_subsref member function? See also |
115 // octave_user_function::subsref. | |
116 | |
117 if (idx.size () > 1) | |
118 retval = retval(0).next_subsref (nargout, type, idx); | |
119 | |
120 return retval; | |
3933 | 121 } |
122 | |
123 octave_value | |
5885 | 124 octave_list::do_index_op (const octave_value_list& idx, bool resize_ok) |
2882 | 125 { |
126 octave_value retval; | |
127 | |
128 if (idx.length () == 1) | |
129 { | |
8679
280fae940bb0
optimize scalar indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8290
diff
changeset
|
130 Cell tcell = data.index (idx (0), resize_ok); |
5757 | 131 |
132 octave_value_list result; | |
133 | |
134 octave_idx_type n = tcell.numel (); | |
135 | |
136 result.resize (n); | |
137 | |
138 for (octave_idx_type i = 0; i < n; i++) | |
139 result(i) = tcell(i); | |
140 | |
141 retval = result; | |
2882 | 142 } |
143 else | |
5757 | 144 error ("only one index allowed for lists"); |
2882 | 145 |
146 return retval; | |
147 } | |
148 | |
3933 | 149 octave_value |
4247 | 150 octave_list::subsasgn (const std::string& type, |
4219 | 151 const std::list<octave_value_list>& idx, |
3933 | 152 const octave_value& rhs) |
153 { | |
154 octave_value retval; | |
155 | |
5275 | 156 octave_idx_type n = type.length (); |
3933 | 157 |
158 octave_value t_rhs = rhs; | |
159 | |
160 if (n > 1) | |
161 { | |
162 switch (type[0]) | |
163 { | |
164 case '(': | |
165 { | |
166 octave_value tmp = do_index_op (idx.front (), true); | |
167 | |
168 if (! tmp.is_defined ()) | |
169 tmp = octave_value::empty_conv (type.substr (1), rhs); | |
170 | |
171 if (! error_state) | |
172 { | |
4219 | 173 std::list<octave_value_list> next_idx (idx); |
3933 | 174 |
4219 | 175 next_idx.erase (next_idx.begin ()); |
3933 | 176 |
177 t_rhs = tmp.subsasgn (type.substr (1), next_idx, rhs); | |
178 } | |
179 } | |
180 break; | |
181 | |
182 case '{': | |
183 case '.': | |
184 { | |
185 std::string nm = type_name (); | |
186 error ("%s cannot be indexed with %c", nm.c_str (), type[0]); | |
187 } | |
188 break; | |
189 | |
190 default: | |
191 panic_impossible (); | |
192 } | |
193 } | |
194 | |
3940 | 195 if (! error_state) |
3933 | 196 { |
3940 | 197 switch (type[0]) |
198 { | |
199 case '(': | |
200 { | |
201 octave_value_list i = idx.front (); | |
3933 | 202 |
8290
7cbe01c21986
improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
203 data.assign (i, Cell (t_rhs), Cell::resize_fill_value ()); |
3933 | 204 |
5759 | 205 count++; |
206 retval = octave_value (this); | |
3940 | 207 } |
208 break; | |
3933 | 209 |
3940 | 210 case '{': |
211 case '.': | |
212 { | |
213 std::string nm = type_name (); | |
214 error ("%s cannot be indexed with %c", nm.c_str (), type[0]); | |
215 } | |
216 break; | |
3933 | 217 |
3940 | 218 default: |
219 panic_impossible (); | |
220 } | |
3933 | 221 } |
222 | |
223 return retval; | |
224 } | |
225 | |
2882 | 226 void |
3196 | 227 octave_list::assign (const octave_value_list& idx, const octave_value& rhs) |
228 { | |
229 if (idx.length () == 1) | |
230 { | |
3202 | 231 int i = idx(0).int_value (true); |
3196 | 232 |
233 if (! error_state) | |
234 { | |
5275 | 235 octave_idx_type n = data.length (); |
3196 | 236 |
4461 | 237 if (i > 0) |
238 { | |
5781 | 239 if (i > n) |
240 warning_with_id ("Octave:resize-on-range-error", | |
241 "list index = %d out of range", i); | |
4461 | 242 |
4591 | 243 data(i-1) = rhs; |
4461 | 244 } |
3196 | 245 else |
3202 | 246 error ("list index = %d out of range", i); |
3196 | 247 } |
3202 | 248 else |
249 error ("list index must be an integer"); | |
3196 | 250 } |
251 else | |
252 error ("lists may only be indexed by a single scalar"); | |
253 } | |
254 | |
4791 | 255 size_t |
256 octave_list::byte_size (void) const | |
257 { | |
258 size_t retval = 0; | |
259 | |
5275 | 260 for (octave_idx_type i = 0; i < numel (); i++) |
4791 | 261 retval += data(i).byte_size (); |
262 | |
263 return retval; | |
264 } | |
265 | |
4591 | 266 octave_value_list |
267 octave_list::list_value (void) const | |
268 { | |
269 octave_value_list retval; | |
270 | |
5275 | 271 octave_idx_type n = data.length (); |
4591 | 272 |
273 retval.resize (n); | |
274 | |
5275 | 275 for (octave_idx_type i = 0; i < n; i++) |
4591 | 276 retval(i) = data(i); |
277 | |
278 return retval; | |
279 } | |
280 | |
3196 | 281 void |
3523 | 282 octave_list::print (std::ostream& os, bool) const |
2901 | 283 { |
284 print_raw (os); | |
285 } | |
286 | |
287 void | |
3523 | 288 octave_list::print_raw (std::ostream& os, bool) const |
2882 | 289 { |
2985 | 290 unwind_protect::begin_frame ("octave_list_print"); |
2882 | 291 |
5275 | 292 octave_idx_type n = data.length (); |
2882 | 293 |
3196 | 294 if (n > 0) |
2882 | 295 { |
3196 | 296 indent (os); |
297 os << "("; | |
298 newline (os); | |
299 | |
300 increment_indent_level (); | |
2916 | 301 |
5275 | 302 for (octave_idx_type i = 0; i < n; i++) |
3196 | 303 { |
5765 | 304 std::ostringstream buf; |
4051 | 305 |
5765 | 306 buf << "[" << i+1 << "]"; |
2882 | 307 |
4591 | 308 octave_value val = data(i); |
2916 | 309 |
5765 | 310 val.print_with_name (os, buf.str ()); |
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 | |
5823 | 388 print_usage (); |
3219 | 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\ | |
6666 | 396 Return a new list created by appending @var{a1}, @var{a2}, @dots{}, to\n\ |
3447 | 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 | |
5823 | 435 print_usage (); |
2882 | 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 | |
5823 | 458 print_usage (); |
2882 | 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 | |
5823 | 524 print_usage (); |
3196 | 525 |
526 return retval; | |
527 } | |
528 | |
4687 | 529 bool |
6974 | 530 octave_list::save_ascii (std::ostream& os) |
4687 | 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? | |
5717 | 538 |
5765 | 539 std::ostringstream buf; |
540 buf << "_" << i; | |
541 std::string s = buf.str (); | |
5717 | 542 |
6974 | 543 bool b = save_ascii_data (os, lst (i), s.c_str (), false, 0); |
4687 | 544 |
545 if (! b) | |
546 return false; | |
547 } | |
548 | |
549 return true; | |
550 } | |
551 | |
552 bool | |
553 octave_list::load_ascii (std::istream& is) | |
554 { | |
555 int len = 0; | |
556 bool success = true; | |
557 | |
558 if (extract_keyword (is, "length", len) && len >= 0) | |
559 { | |
560 if (len > 0) | |
561 { | |
562 octave_value_list lst; | |
563 | |
564 for (int j = 0; j < len; j++) | |
565 { | |
566 octave_value t2; | |
567 bool dummy; | |
568 | |
569 // recurse to read list elements | |
570 std::string nm | |
5757 | 571 = read_ascii_data (is, std::string (), dummy, t2, j); |
4687 | 572 |
573 if (!is) | |
574 break; | |
575 | |
576 lst.append (t2); | |
577 } | |
578 | |
579 if (is) | |
580 data = lst; | |
581 else | |
582 { | |
583 error ("load: failed to load list"); | |
584 success = false; | |
585 } | |
586 } | |
587 else if (len == 0 ) | |
588 data = Cell (0, 0); | |
589 else | |
590 panic_impossible (); | |
591 } | |
592 else { | |
593 error ("load: failed to extract number of elements in list"); | |
594 success = false; | |
595 } | |
596 | |
597 return success; | |
598 } | |
599 | |
600 bool | |
601 octave_list::save_binary (std::ostream& os, bool& save_as_floats) | |
602 { | |
603 octave_value_list lst = list_value (); | |
604 | |
5828 | 605 int32_t len = lst.length(); |
5760 | 606 os.write (reinterpret_cast<char *> (&len), 4); |
4687 | 607 |
608 for (int i = 0; i < lst.length (); i++) | |
609 { | |
610 // should we use lst.name_tags () to label the elements? | |
5717 | 611 |
5765 | 612 std::ostringstream buf; |
613 buf << "_" << i; | |
614 std::string s = buf.str (); | |
4687 | 615 |
616 // Recurse to print sub-value. | |
5717 | 617 bool b = save_binary_data (os, lst(i), s.c_str (), "", 0, |
618 save_as_floats); | |
4687 | 619 |
620 if (! b) | |
621 return false; | |
622 } | |
623 | |
624 return true; | |
625 } | |
626 | |
627 bool | |
628 octave_list::load_binary (std::istream& is, bool swap, | |
5760 | 629 oct_mach_info::float_format fmt) |
4687 | 630 { |
5828 | 631 int32_t len; |
5760 | 632 if (! is.read (reinterpret_cast<char *> (&len), 4)) |
4687 | 633 return false; |
634 if (swap) | |
4944 | 635 swap_bytes<4> (&len); |
4687 | 636 |
637 if (len > 0) | |
638 { | |
639 octave_value_list lst; | |
640 | |
5275 | 641 for (octave_idx_type i = 0; i < len; i++) |
4687 | 642 { |
643 octave_value t2; | |
644 bool dummy; | |
645 std::string doc; | |
646 | |
647 // recurse to read list elements | |
648 std::string nm = read_binary_data (is, swap, fmt, std::string (), | |
649 dummy, t2, doc); | |
650 | |
651 if (!is) | |
652 return false; | |
653 | |
654 lst.append(t2); | |
655 } | |
656 | |
657 if (is) | |
658 data = lst; | |
659 else | |
660 { | |
661 error ("load: failed to load list"); | |
662 return false; | |
663 } | |
664 | |
665 } | |
666 else if (len == 0 ) | |
667 data = Cell (0, 0); | |
668 else | |
669 return false; | |
670 | |
671 return true; | |
672 } | |
673 | |
674 #if defined (HAVE_HDF5) | |
4944 | 675 |
4687 | 676 bool |
677 octave_list::save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats) | |
678 { | |
679 hid_t data_hid = -1; | |
680 | |
681 data_hid = H5Gcreate (loc_id, name, 0); | |
682 if (data_hid < 0) return false; | |
683 | |
684 // recursively add each element of the list to this group | |
685 octave_value_list lst = list_value (); | |
686 | |
5275 | 687 for (octave_idx_type i = 0; i < lst.length (); ++i) |
4687 | 688 { |
689 // should we use lst.name_tags () to label the elements? | |
5717 | 690 |
5765 | 691 std::ostringstream buf; |
692 buf << "_" << i; | |
693 std::string s = buf.str (); | |
5717 | 694 |
695 bool retval2 = add_hdf5_data (data_hid, lst (i), s.c_str (), "", | |
4687 | 696 false, save_as_floats); |
697 if (! retval2) | |
698 break; | |
699 } | |
700 | |
701 H5Gclose (data_hid); | |
4837 | 702 |
4687 | 703 return true; |
704 } | |
705 | |
706 bool | |
707 octave_list::load_hdf5 (hid_t loc_id, const char *name, | |
708 bool have_h5giterate_bug) | |
709 { | |
710 bool retval = false; | |
711 | |
712 hdf5_callback_data dsub; | |
713 | |
4696 | 714 herr_t retval2 = -1; |
4687 | 715 octave_value_list lst; |
716 int current_item = 0; | |
4696 | 717 #ifdef HAVE_H5GGET_NUM_OBJS |
718 hsize_t num_obj = 0; | |
5060 | 719 hid_t group_id = H5Gopen (loc_id, name); |
720 H5Gget_num_objs (group_id, &num_obj); | |
721 H5Gclose (group_id); | |
4696 | 722 |
723 while (current_item < static_cast<int> (num_obj) | |
724 && (retval2 = H5Giterate (loc_id, name, ¤t_item, | |
725 hdf5_read_next_data, &dsub)) > 0) | |
726 #else | |
4687 | 727 while ((retval2 = H5Giterate (loc_id, name, ¤t_item, |
728 hdf5_read_next_data, &dsub)) > 0) | |
4696 | 729 #endif |
4687 | 730 { |
731 lst.append (dsub.tc); | |
732 | |
733 if (have_h5giterate_bug) | |
734 current_item++; // H5Giterate returned the last index processed | |
735 } | |
736 | |
737 if (retval2 >= 0) | |
738 { | |
739 data = lst; | |
740 retval = true; | |
741 } | |
742 | |
743 return retval; | |
744 } | |
4944 | 745 |
4687 | 746 #endif |
747 | |
2882 | 748 /* |
749 ;;; Local Variables: *** | |
750 ;;; mode: C++ *** | |
751 ;;; End: *** | |
752 */ |