2376
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
2376
|
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 |
4192
|
23 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
2376
|
24 #pragma implementation |
|
25 #endif |
|
26 |
|
27 #ifdef HAVE_CONFIG_H |
|
28 #include <config.h> |
|
29 #endif |
|
30 |
3503
|
31 #include <iostream> |
2376
|
32 |
3933
|
33 #include "Cell.h" |
4358
|
34 #include "defun.h" |
2376
|
35 #include "error.h" |
4358
|
36 #include "gripes.h" |
2979
|
37 #include "oct-lvalue.h" |
3932
|
38 #include "ov-list.h" |
2376
|
39 #include "ov-struct.h" |
|
40 #include "unwind-prot.h" |
2948
|
41 #include "variables.h" |
2376
|
42 |
4687
|
43 #include "byte-swap.h" |
|
44 #include "ls-oct-ascii.h" |
|
45 #include "ls-oct-binary.h" |
|
46 #include "ls-hdf5.h" |
|
47 #include "ls-utils.h" |
|
48 |
3219
|
49 DEFINE_OCTAVE_ALLOCATOR(octave_struct); |
2376
|
50 |
4612
|
51 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_struct, "struct", "struct"); |
2376
|
52 |
4513
|
53 Cell |
3933
|
54 octave_struct::dotref (const octave_value_list& idx) |
2962
|
55 { |
4513
|
56 Cell retval; |
3933
|
57 |
|
58 assert (idx.length () == 1); |
2962
|
59 |
3933
|
60 std::string nm = idx(0).string_value (); |
|
61 |
4219
|
62 Octave_map::const_iterator p = map.seek (nm); |
2376
|
63 |
4219
|
64 if (p != map.end ()) |
3933
|
65 retval = map.contents (p); |
|
66 else |
2376
|
67 error ("structure has no member `%s'", nm.c_str ()); |
|
68 |
|
69 return retval; |
|
70 } |
|
71 |
4513
|
72 #if 0 |
3933
|
73 static void |
|
74 gripe_invalid_index (void) |
|
75 { |
|
76 error ("invalid index for structure array"); |
|
77 } |
4513
|
78 #endif |
3933
|
79 |
|
80 static void |
|
81 gripe_invalid_index_for_assignment (void) |
|
82 { |
|
83 error ("invalid index for structure array assignment"); |
|
84 } |
|
85 |
|
86 static void |
|
87 gripe_invalid_index_type (const std::string& nm, char t) |
|
88 { |
|
89 error ("%s cannot be indexed with %c", nm.c_str (), t); |
|
90 } |
|
91 |
|
92 static void |
|
93 gripe_failed_assignment (void) |
|
94 { |
|
95 error ("assignment to structure element failed"); |
|
96 } |
|
97 |
|
98 octave_value |
4247
|
99 octave_struct::subsref (const std::string& type, |
4219
|
100 const std::list<octave_value_list>& idx) |
3933
|
101 { |
|
102 octave_value retval; |
|
103 |
|
104 int skip = 1; |
|
105 |
|
106 switch (type[0]) |
|
107 { |
|
108 case '(': |
|
109 { |
|
110 if (type.length () > 1 && type[1] == '.') |
|
111 { |
4219
|
112 std::list<octave_value_list>::const_iterator p = idx.begin (); |
|
113 octave_value_list key_idx = *++p; |
3933
|
114 |
4513
|
115 Cell tmp = dotref (key_idx); |
3933
|
116 |
|
117 if (! error_state) |
|
118 { |
4513
|
119 Cell t = tmp.index (idx.front ()); |
3933
|
120 |
4513
|
121 retval = (t.length () == 1) ? t(0) : octave_value (t, true); |
3933
|
122 |
4513
|
123 // We handled two index elements, so tell |
|
124 // next_subsref to skip both of them. |
3933
|
125 |
4513
|
126 skip++; |
3933
|
127 } |
|
128 } |
|
129 else |
4513
|
130 retval = map.index (idx.front ()); |
3933
|
131 } |
|
132 break; |
|
133 |
|
134 case '.': |
|
135 { |
4513
|
136 Cell t = dotref (idx.front ()); |
3933
|
137 |
4499
|
138 retval = (t.length () == 1) ? t(0) : octave_value (t, true); |
3933
|
139 } |
|
140 break; |
|
141 |
|
142 case '{': |
|
143 gripe_invalid_index_type (type_name (), type[0]); |
|
144 break; |
|
145 |
|
146 default: |
|
147 panic_impossible (); |
|
148 } |
|
149 |
|
150 if (! error_state) |
|
151 retval = retval.next_subsref (type, idx, skip); |
|
152 |
|
153 return retval; |
|
154 } |
|
155 |
|
156 octave_value |
4513
|
157 octave_struct::numeric_conv (const Cell& val, |
3933
|
158 const std::string& type) |
|
159 { |
|
160 octave_value retval; |
|
161 |
|
162 if (val.length () == 1) |
|
163 { |
|
164 retval = val(0); |
|
165 |
|
166 if (type.length () > 0 && type[0] == '.' && ! retval.is_map ()) |
|
167 retval = Octave_map (); |
|
168 } |
|
169 else |
|
170 gripe_invalid_index_for_assignment (); |
|
171 |
|
172 return retval; |
|
173 } |
|
174 |
|
175 octave_value |
4247
|
176 octave_struct::subsasgn (const std::string& type, |
4219
|
177 const std::list<octave_value_list>& idx, |
3933
|
178 const octave_value& rhs) |
2376
|
179 { |
3933
|
180 octave_value retval; |
|
181 |
|
182 int n = type.length (); |
|
183 |
|
184 octave_value t_rhs = rhs; |
|
185 |
|
186 if (n > 1 && ! (type.length () == 2 && type[0] == '(' && type[1] == '.')) |
|
187 { |
|
188 switch (type[0]) |
|
189 { |
|
190 case '(': |
|
191 { |
|
192 if (type.length () > 1 && type[1] == '.') |
|
193 { |
4219
|
194 std::list<octave_value_list>::const_iterator p = idx.begin (); |
|
195 octave_value_list t_idx = *p; |
3933
|
196 |
4513
|
197 octave_value_list key_idx = *++p; |
|
198 |
|
199 assert (key_idx.length () == 1); |
3933
|
200 |
4513
|
201 std::string key = key_idx(0).string_value (); |
3933
|
202 |
4513
|
203 octave_value u; |
3933
|
204 |
4513
|
205 if (! map.contains (key)) |
|
206 u = octave_value::empty_conv (type.substr (2), rhs); |
|
207 else |
|
208 { |
4675
|
209 Cell map_val = map.contents (key); |
3933
|
210 |
4513
|
211 Cell map_elt = map_val.index (idx.front (), true); |
3933
|
212 |
4513
|
213 u = numeric_conv (map_elt, type.substr (2)); |
|
214 } |
3933
|
215 |
4513
|
216 if (! error_state) |
|
217 { |
|
218 std::list<octave_value_list> next_idx (idx); |
3933
|
219 |
4513
|
220 // We handled two index elements, so subsasgn to |
|
221 // needs to skip both of them. |
3933
|
222 |
4513
|
223 next_idx.erase (next_idx.begin ()); |
|
224 next_idx.erase (next_idx.begin ()); |
4059
|
225 |
4513
|
226 u.make_unique (); |
|
227 |
|
228 t_rhs = u.subsasgn (type.substr (2), next_idx, rhs); |
3933
|
229 } |
|
230 } |
|
231 else |
|
232 gripe_invalid_index_for_assignment (); |
|
233 } |
|
234 break; |
|
235 |
|
236 case '.': |
|
237 { |
|
238 octave_value_list key_idx = idx.front (); |
|
239 |
|
240 assert (key_idx.length () == 1); |
|
241 |
|
242 std::string key = key_idx(0).string_value (); |
|
243 |
|
244 octave_value u; |
|
245 |
|
246 if (! map.contains (key)) |
|
247 u = octave_value::empty_conv (type.substr (1), rhs); |
|
248 else |
|
249 { |
4675
|
250 Cell map_val = map.contents (key); |
3933
|
251 |
|
252 u = numeric_conv (map_val, type.substr (1)); |
|
253 } |
|
254 |
|
255 if (! error_state) |
|
256 { |
4219
|
257 std::list<octave_value_list> next_idx (idx); |
3933
|
258 |
4219
|
259 next_idx.erase (next_idx.begin ()); |
3933
|
260 |
4059
|
261 u.make_unique (); |
|
262 |
3933
|
263 t_rhs = u.subsasgn (type.substr (1), next_idx, rhs); |
|
264 } |
|
265 } |
|
266 break; |
|
267 |
|
268 case '{': |
|
269 gripe_invalid_index_type (type_name (), type[0]); |
|
270 break; |
|
271 |
|
272 default: |
|
273 panic_impossible (); |
|
274 } |
|
275 } |
|
276 |
|
277 if (! error_state) |
|
278 { |
|
279 switch (type[0]) |
|
280 { |
|
281 case '(': |
|
282 { |
|
283 if (n > 1 && type[1] == '.') |
|
284 { |
4219
|
285 std::list<octave_value_list>::const_iterator p = idx.begin (); |
|
286 octave_value_list key_idx = *++p; |
3933
|
287 |
|
288 assert (key_idx.length () == 1); |
|
289 |
|
290 std::string key = key_idx(0).string_value (); |
|
291 |
|
292 if (! error_state) |
|
293 { |
4513
|
294 map.assign (idx.front (), key, t_rhs); |
3933
|
295 |
4513
|
296 if (! error_state) |
|
297 retval = octave_value (this, count + 1); |
3933
|
298 else |
4513
|
299 gripe_failed_assignment (); |
3933
|
300 } |
|
301 else |
|
302 gripe_failed_assignment (); |
|
303 } |
|
304 else |
4197
|
305 { |
4513
|
306 Octave_map rhs_map = t_rhs.map_value (); |
4197
|
307 |
4513
|
308 if (! error_state) |
4197
|
309 { |
4513
|
310 map.assign (idx.front (), rhs_map); |
4197
|
311 |
|
312 if (! error_state) |
4513
|
313 retval = octave_value (this, count + 1); |
4197
|
314 else |
4513
|
315 gripe_failed_assignment (); |
4197
|
316 } |
4513
|
317 else |
|
318 error ("invalid structure assignment"); |
4197
|
319 } |
3933
|
320 } |
|
321 break; |
|
322 |
|
323 case '.': |
|
324 { |
|
325 octave_value_list key_idx = idx.front (); |
|
326 |
|
327 assert (key_idx.length () == 1); |
|
328 |
|
329 std::string key = key_idx(0).string_value (); |
|
330 |
|
331 map.assign (key, t_rhs); |
|
332 |
|
333 if (! error_state) |
|
334 retval = octave_value (this, count + 1); |
|
335 else |
|
336 gripe_failed_assignment (); |
|
337 } |
|
338 break; |
|
339 |
|
340 case '{': |
|
341 gripe_invalid_index_type (type_name (), type[0]); |
|
342 break; |
|
343 |
|
344 default: |
|
345 panic_impossible (); |
|
346 } |
|
347 } |
|
348 else |
|
349 gripe_failed_assignment (); |
|
350 |
|
351 return retval; |
2376
|
352 } |
|
353 |
|
354 void |
3523
|
355 octave_struct::print (std::ostream& os, bool) const |
2901
|
356 { |
|
357 print_raw (os); |
|
358 } |
|
359 |
|
360 void |
3523
|
361 octave_struct::print_raw (std::ostream& os, bool) const |
2376
|
362 { |
|
363 // XXX FIXME XXX -- would be nice to print the output in some |
|
364 // standard order. Maybe all substructures first, maybe |
|
365 // alphabetize entries, etc. |
|
366 |
2985
|
367 unwind_protect::begin_frame ("octave_struct_print"); |
2376
|
368 |
|
369 unwind_protect_int (Vstruct_levels_to_print); |
|
370 |
3961
|
371 if (Vstruct_levels_to_print >= 0) |
2376
|
372 { |
3961
|
373 bool print_keys_only = (Vstruct_levels_to_print == 0); |
|
374 |
|
375 Vstruct_levels_to_print--; |
|
376 |
2901
|
377 indent (os); |
|
378 os << "{"; |
|
379 newline (os); |
2376
|
380 |
2901
|
381 increment_indent_level (); |
2376
|
382 |
4561
|
383 int n = map.numel (); |
3932
|
384 |
4604
|
385 if (n > 1 && print_keys_only) |
|
386 { |
|
387 indent (os); |
|
388 dim_vector dv = dims (); |
|
389 os << dv.str () << " struct array containing the fields:"; |
|
390 newline (os); |
|
391 newline (os); |
|
392 |
|
393 increment_indent_level (); |
|
394 } |
|
395 |
4219
|
396 for (Octave_map::const_iterator p = map.begin (); p != map.end (); p++) |
2376
|
397 { |
3523
|
398 std::string key = map.key (p); |
4513
|
399 Cell val = map.contents (p); |
2376
|
400 |
4499
|
401 octave_value tmp = (n == 1) ? val(0) : octave_value (val, true); |
3961
|
402 |
|
403 if (print_keys_only) |
3932
|
404 { |
3961
|
405 indent (os); |
4604
|
406 os << key; |
|
407 if (n == 1) |
|
408 { |
|
409 dim_vector dv = tmp.dims (); |
|
410 os << ": " << dv.str () << " " << tmp.type_name (); |
|
411 } |
3961
|
412 newline (os); |
3932
|
413 } |
3961
|
414 else |
4121
|
415 tmp.print_with_name (os, key); |
2376
|
416 } |
|
417 |
4604
|
418 if (n > 1 && print_keys_only) |
|
419 decrement_indent_level (); |
|
420 |
2901
|
421 decrement_indent_level (); |
2376
|
422 |
2901
|
423 indent (os); |
|
424 os << "}"; |
|
425 newline (os); |
2376
|
426 } |
|
427 else |
2901
|
428 { |
3961
|
429 indent (os); |
|
430 os << "<structure>"; |
2901
|
431 newline (os); |
|
432 } |
2376
|
433 |
2985
|
434 unwind_protect::run_frame ("octave_struct_print"); |
2376
|
435 } |
|
436 |
2901
|
437 bool |
3523
|
438 octave_struct::print_name_tag (std::ostream& os, const std::string& name) const |
2901
|
439 { |
3961
|
440 bool retval = false; |
|
441 |
2901
|
442 indent (os); |
3961
|
443 |
|
444 if (Vstruct_levels_to_print < 0) |
|
445 os << name << " = "; |
|
446 else |
|
447 { |
|
448 os << name << " ="; |
|
449 newline (os); |
|
450 retval = true; |
|
451 } |
|
452 |
|
453 return retval; |
2901
|
454 } |
|
455 |
4358
|
456 DEFUN (isstruct, args, , |
|
457 "-*- texinfo -*-\n\ |
|
458 @deftypefn {Built-in Function} {} isstruct (@var{expr})\n\ |
|
459 Return 1 if the value of the expression @var{expr} is a structure.\n\ |
|
460 @end deftypefn") |
|
461 { |
|
462 octave_value retval; |
|
463 |
|
464 if (args.length () == 1) |
|
465 retval = args(0).is_map (); |
|
466 else |
|
467 print_usage ("isstruct"); |
|
468 |
|
469 return retval; |
|
470 } |
|
471 |
|
472 DEFUN (fieldnames, args, , |
|
473 "-*- texinfo -*-\n\ |
|
474 @deftypefn {Built-in Function} {} fieldnames (@var{struct})\n\ |
|
475 Return a cell array of strings naming the elements of the structure\n\ |
|
476 @var{struct}. It is an error to call @code{fieldnames} with an\n\ |
|
477 argument that is not a structure.\n\ |
|
478 @end deftypefn") |
|
479 { |
|
480 octave_value retval; |
|
481 |
|
482 int nargin = args.length (); |
|
483 |
|
484 if (nargin == 1) |
|
485 { |
|
486 if (args(0).is_map ()) |
|
487 { |
|
488 Octave_map m = args(0).map_value (); |
|
489 retval = Cell (m.keys ()); |
|
490 } |
|
491 else |
|
492 gripe_wrong_type_arg ("fieldnames", args(0)); |
|
493 } |
|
494 else |
|
495 print_usage ("fieldnames"); |
|
496 |
|
497 return retval; |
|
498 } |
|
499 |
|
500 DEFUN (isfield, args, , |
|
501 "-*- texinfo -*-\n\ |
|
502 @deftypefn {Built-in Function} {} isfield (@var{expr}, @var{name})\n\ |
|
503 Return true if the expression @var{expr} is a structure and it includes an\n\ |
|
504 element named @var{name}. The first argument must be a structure and\n\ |
|
505 the second must be a string.\n\ |
|
506 @end deftypefn") |
|
507 { |
|
508 octave_value retval; |
|
509 |
|
510 int nargin = args.length (); |
|
511 |
|
512 if (nargin == 2) |
|
513 { |
|
514 retval = false; |
|
515 |
|
516 // XXX FIXME XXX -- should this work for all types that can do |
|
517 // structure reference operations? |
|
518 |
|
519 if (args(0).is_map () && args(1).is_string ()) |
|
520 { |
|
521 std::string key = args(1).string_value (); |
|
522 |
|
523 Octave_map m = args(0).map_value (); |
|
524 |
|
525 retval = m.contains (key) != 0; |
|
526 } |
|
527 else |
|
528 print_usage ("isfield"); |
|
529 } |
|
530 else |
|
531 print_usage ("isfield"); |
|
532 |
|
533 return retval; |
|
534 } |
|
535 |
4687
|
536 bool |
|
537 octave_struct::save_ascii (std::ostream& os, bool& infnan_warned, |
|
538 bool strip_nan_and_inf) |
|
539 { |
|
540 Octave_map m = map_value (); |
|
541 os << "# length: " << m.length () << "\n"; |
|
542 |
|
543 Octave_map::iterator i = m.begin (); |
|
544 while (i != m.end ()) |
|
545 { |
|
546 Cell val = map.contents (i); |
|
547 octave_value tmp = (map.numel () == 1) ? val(0) : |
|
548 octave_value (val, true); |
|
549 |
|
550 bool b = save_ascii_data (os, tmp, m.key (i), infnan_warned, |
|
551 strip_nan_and_inf, 0, 0); |
|
552 |
|
553 if (! b) |
|
554 return os; |
|
555 |
|
556 i++; |
|
557 } |
|
558 |
|
559 return true; |
|
560 } |
|
561 |
|
562 bool |
|
563 octave_struct::load_ascii (std::istream& is) |
|
564 { |
|
565 int len = 0; |
|
566 bool success = true; |
|
567 |
|
568 if (extract_keyword (is, "length", len) && len >= 0) |
|
569 { |
|
570 if (len > 0) |
|
571 { |
|
572 Octave_map m (map); |
|
573 |
|
574 for (int j = 0; j < len; j++) |
|
575 { |
|
576 octave_value t2; |
|
577 bool dummy; |
|
578 |
|
579 // recurse to read cell elements |
|
580 std::string nm |
|
581 = read_ascii_data (is, std::string (), dummy, t2, count); |
|
582 |
|
583 if (!is) |
|
584 break; |
|
585 |
|
586 m.assign (nm, t2); |
|
587 } |
|
588 |
|
589 if (is) |
|
590 map = m; |
|
591 else |
|
592 { |
|
593 error ("load: failed to load structure"); |
|
594 success = false; |
|
595 } |
|
596 } |
|
597 else if (len == 0 ) |
|
598 map = Octave_map (); |
|
599 else |
|
600 panic_impossible (); |
|
601 } |
|
602 else { |
|
603 error ("load: failed to extract number of elements in structure"); |
|
604 success = false; |
|
605 } |
|
606 |
|
607 return success; |
|
608 } |
|
609 |
|
610 bool |
|
611 octave_struct::save_binary (std::ostream& os, bool& save_as_floats) |
|
612 { |
|
613 Octave_map m = map_value (); |
|
614 |
|
615 FOUR_BYTE_INT len = m.length(); |
|
616 os.write (X_CAST (char *, &len), 4); |
|
617 |
|
618 Octave_map::iterator i = m.begin (); |
|
619 while (i != m.end ()) |
|
620 { |
|
621 Cell val = map.contents (i); |
|
622 octave_value tmp = (map.numel () == 1) ? val(0) : |
|
623 octave_value (val, true); |
|
624 |
|
625 bool b = save_binary_data (os, tmp, m.key (i), "", 0, save_as_floats); |
|
626 |
|
627 if (! b) |
|
628 return os; |
|
629 |
|
630 i++; |
|
631 } |
|
632 |
|
633 return true; |
|
634 } |
|
635 |
|
636 bool |
|
637 octave_struct::load_binary (std::istream& is, bool swap, |
|
638 oct_mach_info::float_format fmt) |
|
639 { |
|
640 bool success = true; |
|
641 FOUR_BYTE_INT len; |
|
642 if (! is.read (X_CAST (char *, &len), 4)) |
|
643 return false; |
|
644 if (swap) |
|
645 swap_4_bytes (X_CAST (char *, &len)); |
|
646 |
|
647 if (len > 0) |
|
648 { |
|
649 Octave_map m (map); |
|
650 |
|
651 for (int j = 0; j < len; j++) |
|
652 { |
|
653 octave_value t2; |
|
654 bool dummy; |
|
655 std::string doc; |
|
656 |
|
657 // recurse to read cell elements |
|
658 std::string nm = read_binary_data (is, swap, fmt, std::string (), |
|
659 dummy, t2, doc); |
|
660 |
|
661 if (!is) |
|
662 break; |
|
663 |
|
664 m.assign (nm, t2); |
|
665 } |
|
666 |
|
667 if (is) |
|
668 map = m; |
|
669 else |
|
670 { |
|
671 error ("load: failed to load structure"); |
|
672 success = false; |
|
673 } |
|
674 } |
|
675 else if (len == 0 ) |
|
676 map = Octave_map (); |
|
677 else |
|
678 panic_impossible (); |
|
679 |
|
680 return success; |
|
681 } |
|
682 |
|
683 #if defined (HAVE_HDF5) |
|
684 bool |
|
685 octave_struct::save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats) |
|
686 { |
|
687 hid_t data_hid = -1; |
|
688 |
|
689 data_hid = H5Gcreate (loc_id, name, 0); |
|
690 if (data_hid < 0) return false; |
|
691 |
|
692 // recursively add each element of the structure to this group |
|
693 Octave_map m = map_value (); |
|
694 Octave_map::iterator i = m.begin (); |
|
695 while (i != m.end ()) |
|
696 { |
|
697 Cell val = map.contents (i); |
|
698 octave_value tmp = (map.numel () == 1) ? val(0) : |
|
699 octave_value (val, true); |
|
700 |
|
701 bool retval2 = add_hdf5_data (data_hid, tmp, m.key (i), "", false, |
|
702 save_as_floats); |
|
703 |
|
704 if (! retval2) |
|
705 break; |
|
706 |
|
707 i++; |
|
708 } |
|
709 |
|
710 H5Gclose (data_hid); |
|
711 return true; |
|
712 } |
|
713 |
|
714 bool |
|
715 octave_struct::load_hdf5 (hid_t loc_id, const char *name, |
|
716 bool have_h5giterate_bug) |
|
717 { |
|
718 bool retval = false; |
|
719 |
|
720 hdf5_callback_data dsub; |
|
721 |
|
722 herr_t retval2; |
|
723 Octave_map m; |
|
724 int current_item = 0; |
4696
|
725 #ifdef HAVE_H5GGET_NUM_OBJS |
|
726 hsize_t num_obj = 0; |
|
727 H5Gget_num_objs (loc_id, &num_obj); |
|
728 |
|
729 while (current_item < static_cast<int> (num_obj) |
|
730 && (retval2 = H5Giterate (loc_id, name, ¤t_item, |
|
731 hdf5_read_next_data, &dsub)) > 0) |
|
732 #else |
4687
|
733 while ((retval2 = H5Giterate (loc_id, name, ¤t_item, |
|
734 hdf5_read_next_data, &dsub)) > 0) |
4696
|
735 #endif |
4687
|
736 { |
|
737 m.assign (dsub.name, dsub.tc); |
|
738 |
|
739 if (have_h5giterate_bug) |
|
740 current_item++; // H5Giterate returned the last index processed |
|
741 } |
|
742 |
|
743 if (retval2 >= 0) |
|
744 { |
|
745 map = m; |
|
746 retval = true; |
|
747 } |
|
748 |
|
749 return retval; |
|
750 } |
|
751 #endif |
|
752 |
2376
|
753 /* |
|
754 ;;; Local Variables: *** |
|
755 ;;; mode: C++ *** |
|
756 ;;; End: *** |
|
757 */ |