4634
|
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 // Author: Steven G. Johnson <stevenj@alum.mit.edu> |
|
24 |
|
25 #ifdef HAVE_CONFIG_H |
|
26 #include <config.h> |
|
27 #endif |
|
28 |
|
29 #if defined (HAVE_HDF5) |
|
30 |
|
31 #include <cfloat> |
|
32 #include <cstring> |
|
33 #include <cctype> |
|
34 |
|
35 #include <fstream> |
|
36 #include <iomanip> |
|
37 #include <iostream> |
|
38 #include <memory> |
|
39 #include <string> |
|
40 |
|
41 #include <hdf5.h> |
|
42 |
|
43 #include "byte-swap.h" |
|
44 #include "data-conv.h" |
|
45 #include "file-ops.h" |
|
46 #include "glob-match.h" |
|
47 #include "lo-mappers.h" |
|
48 #include "lo-sstream.h" |
|
49 #include "mach-info.h" |
|
50 #include "oct-env.h" |
|
51 #include "oct-time.h" |
|
52 #include "quit.h" |
|
53 #include "str-vec.h" |
|
54 |
|
55 #include "Cell.h" |
|
56 #include "defun.h" |
|
57 #include "error.h" |
|
58 #include "gripes.h" |
|
59 #include "load-save.h" |
|
60 #include "oct-obj.h" |
|
61 #include "oct-map.h" |
|
62 #include "ov-cell.h" |
|
63 #include "pager.h" |
|
64 #include "pt-exp.h" |
|
65 #include "symtab.h" |
|
66 #include "sysdep.h" |
|
67 #include "unwind-prot.h" |
|
68 #include "utils.h" |
|
69 #include "variables.h" |
|
70 #include "version.h" |
|
71 #include "dMatrix.h" |
|
72 |
|
73 #include "ls-utils.h" |
|
74 #include "ls-hdf5.h" |
|
75 |
|
76 // this is only used for HDF5 import |
|
77 // try to convert s into a valid identifier, replacing invalid chars with "_": |
|
78 |
|
79 static std::string |
|
80 make_valid_identifier (const std::string& nm) |
|
81 { |
|
82 std::string retval; |
|
83 |
|
84 size_t nm_len = nm.length (); |
|
85 |
|
86 if (nm_len > 0) |
|
87 { |
|
88 if (! isalpha (nm[0])) |
|
89 retval += '_'; |
|
90 |
|
91 for (size_t i = 0; i < nm_len; i++) |
|
92 { |
|
93 char c = nm[i]; |
|
94 retval += (isalnum (c) || c == '_') ? c : '_'; |
|
95 } |
|
96 } |
|
97 |
|
98 return retval; |
|
99 } |
|
100 |
|
101 static bool |
|
102 ident_is_all_digits (const std::string& id) |
|
103 { |
|
104 bool retval = true; |
|
105 |
|
106 size_t len = 0; |
|
107 |
|
108 for (size_t i = 0; i < len; i++) |
|
109 { |
|
110 if (! isdigit (id[i])) |
|
111 { |
|
112 retval = false; |
|
113 break; |
|
114 } |
|
115 } |
|
116 |
|
117 return retval; |
|
118 } |
|
119 |
|
120 // Define this to 1 if/when HDF5 supports automatic conversion between |
|
121 // integer and floating-point binary data: |
|
122 #define HAVE_HDF5_INT2FLOAT_CONVERSIONS 0 |
|
123 |
|
124 // Given two compound types t1 and t2, determine whether they |
|
125 // are compatible for reading/writing. This function only |
|
126 // works for non-nested types composed of simple elements (ints, floats...), |
|
127 // which is all we need it for |
|
128 |
|
129 bool |
|
130 hdf5_types_compatible (hid_t t1, hid_t t2) |
|
131 { |
|
132 int n; |
|
133 if ((n = H5Tget_nmembers (t1)) != H5Tget_nmembers (t2)) |
|
134 return false; |
|
135 |
|
136 for (int i = 0; i < n; ++i) |
|
137 { |
|
138 hid_t mt1 = H5Tget_member_type (t1, i); |
|
139 hid_t mt2 = H5Tget_member_type (t2, i); |
|
140 |
|
141 if (H5Tget_class (mt1) != H5Tget_class (mt2)) |
|
142 return false; |
|
143 |
|
144 H5Tclose (mt2); |
|
145 H5Tclose (mt1); |
|
146 } |
|
147 |
|
148 return true; |
|
149 } |
|
150 |
|
151 // Import a multidimensional (rank >= 3) dataset whose id is data_id, into tc. |
|
152 // This works by calling itself recursively, building up lists of lists |
|
153 // of lists ... of 2d matrices. rank and dims are the rank and dimensions |
|
154 // of the dataset. type_id is the datatype to read into. If it is |
|
155 // H5T_NATIVE_DOUBLE, we are reading a real matrix. Otherwise, type_id |
|
156 // is assumed to be a complex type for reading a complex matrix. |
|
157 // |
|
158 // Upon entry, we should have curdim = rank - 1, start = an array |
|
159 // of length rank = all zeros, and count = an array of length rank = |
|
160 // all ones except for the first two dimensions which equal the corresponding |
|
161 // entries in dims[]. |
|
162 // |
|
163 // Note that we process the dimensions in reverse order, reflecting |
|
164 // the fact that Octave is uses column-major (Fortran-order) data while |
|
165 // HDF5 is row-major. This means that the HDF5 file is read |
|
166 // non-contiguously, but on the other hand means that for a 3d array |
|
167 // we get a list of xy-plane slices, which seems nice. We could change |
|
168 // this behavior without much trouble; what is the best thing to do? |
|
169 // |
|
170 // Returns a positive value upon success. |
|
171 |
|
172 static herr_t |
|
173 hdf5_import_multidim (hid_t data_id, hid_t space_id, hsize_t rank, |
|
174 const hsize_t *dims, hsize_t curdim, |
|
175 hssize_t *start, const hsize_t *count, |
|
176 hid_t type_id, octave_value &tc) |
|
177 { |
|
178 herr_t retval = 1; |
|
179 |
|
180 if (rank < 3 || curdim < 1 || curdim >= rank) |
|
181 return -1; |
|
182 |
|
183 if (curdim == 1) |
|
184 { |
|
185 // import 2d dataset for 1st 2 dims directly as a matrix |
|
186 int nr, nc; // rows and columns |
|
187 nc = dims[0]; // octave uses column-major & HDF5 uses row-major |
|
188 nr = dims[1]; |
|
189 |
|
190 hid_t mem_space_id = H5Screate_simple (2, dims, 0); |
|
191 |
|
192 if (mem_space_id < 0) |
|
193 return -1; |
|
194 |
|
195 if (H5Sselect_all (mem_space_id) < 0) |
|
196 return -1; |
|
197 |
|
198 if (H5Sselect_hyperslab (space_id, H5S_SELECT_SET, |
|
199 start, 0, count, 0) < 0) |
|
200 { |
|
201 H5Sclose (mem_space_id); |
|
202 return -1; |
|
203 } |
|
204 |
|
205 if (type_id == H5T_NATIVE_DOUBLE) |
|
206 { |
|
207 // real matrix |
|
208 Matrix m (nr, nc); |
|
209 double *re = m.fortran_vec (); |
|
210 if (H5Dread (data_id, type_id, mem_space_id, space_id, |
|
211 H5P_DEFAULT, (void *) re) < 0) |
|
212 retval = -1; // error |
|
213 else |
|
214 tc = m; |
|
215 } |
|
216 else |
|
217 { |
|
218 // assume that we are using complex numbers |
|
219 // complex matrix |
|
220 ComplexMatrix m (nr, nc); |
|
221 Complex *reim = m.fortran_vec (); |
|
222 if (H5Dread (data_id, type_id, mem_space_id, space_id, |
|
223 H5P_DEFAULT, (void *) X_CAST (double *, reim)) < 0) |
|
224 retval = -1; // error |
|
225 else |
|
226 tc = m; |
|
227 } |
|
228 |
|
229 H5Sclose (mem_space_id); |
|
230 |
|
231 } |
|
232 else |
|
233 { |
|
234 octave_value_list lst; |
|
235 |
|
236 for (hsize_t i = 0; i < dims[curdim]; ++i) |
|
237 { |
|
238 octave_value slice; |
|
239 start[curdim] = i; |
|
240 retval = hdf5_import_multidim (data_id, space_id, rank, |
|
241 dims, curdim-1, start, count, |
|
242 type_id, slice); |
|
243 if (retval < 0) |
|
244 break; |
|
245 lst.append (slice); |
|
246 } |
|
247 |
|
248 if (retval > 0) |
|
249 tc = octave_value (lst); |
|
250 } |
|
251 |
|
252 return retval; |
|
253 } |
|
254 |
|
255 // Return true if loc_id has the attribute named attr_name, and false |
|
256 // otherwise. |
|
257 |
|
258 bool |
|
259 hdf5_check_attr (hid_t loc_id, const char *attr_name) |
|
260 { |
|
261 bool retval = false; |
|
262 |
|
263 // we have to pull some shenanigans here to make sure |
|
264 // HDF5 doesn't print out all sorts of error messages if we |
|
265 // call H5Aopen for a non-existing attribute |
|
266 |
|
267 H5E_auto_t err_func; |
|
268 void *err_func_data; |
|
269 |
|
270 // turn off error reporting temporarily, but save the error |
|
271 // reporting function: |
|
272 |
|
273 H5Eget_auto (&err_func, &err_func_data); |
|
274 H5Eset_auto (0, 0); |
|
275 |
|
276 hid_t attr_id = H5Aopen_name (loc_id, attr_name); |
|
277 |
|
278 if (attr_id >= 0) |
|
279 { |
|
280 // successful |
|
281 retval = 1; |
|
282 H5Aclose (attr_id); |
|
283 } |
|
284 |
|
285 // restore error reporting: |
|
286 H5Eset_auto (err_func, err_func_data); |
|
287 |
|
288 return retval; |
|
289 } |
|
290 |
|
291 // The following two subroutines create HDF5 representations of the way |
|
292 // we will store Octave complex and range types (pairs and triplets of |
|
293 // floating-point numbers, respectively). NUM_TYPE is the HDF5 numeric |
|
294 // type to use for storage (e.g. H5T_NATIVE_DOUBLE to save as 'double'). |
|
295 // Note that any necessary conversions are handled automatically by HDF5. |
|
296 |
|
297 static hid_t |
|
298 hdf5_make_complex_type (hid_t num_type) |
|
299 { |
|
300 hid_t type_id = H5Tcreate (H5T_COMPOUND, sizeof (double) * 2); |
|
301 |
|
302 H5Tinsert (type_id, "real", 0 * sizeof (double), num_type); |
|
303 H5Tinsert (type_id, "imag", 1 * sizeof (double), num_type); |
|
304 |
|
305 return type_id; |
|
306 } |
|
307 |
|
308 static hid_t |
|
309 hdf5_make_range_type (hid_t num_type) |
|
310 { |
|
311 hid_t type_id = H5Tcreate (H5T_COMPOUND, sizeof (double) * 3); |
|
312 |
|
313 H5Tinsert (type_id, "base", 0 * sizeof (double), num_type); |
|
314 H5Tinsert (type_id, "limit", 1 * sizeof (double), num_type); |
|
315 H5Tinsert (type_id, "increment", 2 * sizeof (double), num_type); |
|
316 |
|
317 return type_id; |
|
318 } |
|
319 |
|
320 // Callback data structure for passing data to hdf5_read_next_data, below. |
|
321 |
|
322 struct |
|
323 hdf5_callback_data |
|
324 { |
|
325 hdf5_callback_data (void) |
|
326 : name (), global (false), tc (), doc (), |
|
327 complex_type (hdf5_make_complex_type (H5T_NATIVE_DOUBLE)), |
|
328 range_type (hdf5_make_range_type (H5T_NATIVE_DOUBLE)), |
|
329 import (false) { } |
|
330 |
|
331 // the following fields are set by hdf5_read_data on successful return: |
|
332 |
|
333 // the name of the variable |
|
334 std::string name; |
|
335 |
|
336 // whether it is global |
|
337 bool global; |
|
338 |
|
339 // the value of the variable, in Octave form |
|
340 octave_value tc; |
|
341 |
|
342 // a documentation string (NULL if none) |
|
343 std::string doc; |
|
344 |
|
345 // the following fields are input to hdf5_read_data: |
|
346 |
|
347 // HDF5 rep's of complex and range type |
|
348 hid_t complex_type, range_type; |
|
349 |
|
350 // whether to try extra hard to import "foreign" data |
|
351 bool import; |
|
352 }; |
|
353 |
|
354 // This variable, set in read_hdf5_data(), tells whether we are using |
|
355 // a version of HDF5 with a buggy H5Giterate (i.e. which neglects to |
|
356 // increment the index parameter to the next unread item). |
|
357 static bool have_h5giterate_bug = false; |
|
358 |
|
359 // This function is designed to be passed to H5Giterate, which calls it |
|
360 // on each data item in an HDF5 file. For the item whose name is NAME in |
|
361 // the group GROUP_ID, this function sets dv->tc to an Octave representation |
|
362 // of that item. (dv must be a pointer to hdf5_callback_data.) (It also |
|
363 // sets the other fields of dv). |
|
364 // |
|
365 // It returns 1 on success (in which case H5Giterate stops and returns), |
|
366 // -1 on error, and 0 to tell H5Giterate to continue on to the next item |
|
367 // (e.g. if NAME was a data type we don't recognize). |
|
368 |
|
369 static herr_t |
|
370 hdf5_read_next_data (hid_t group_id, const char *name, void *dv) |
|
371 { |
|
372 hdf5_callback_data *d = static_cast <hdf5_callback_data *> (dv); |
|
373 |
|
374 H5G_stat_t info; |
|
375 herr_t retval = 0; |
|
376 bool ident_valid = valid_identifier (name); |
|
377 |
|
378 std::string vname = name; |
|
379 |
|
380 // Allow identifiers as all digits so we can load lists saved by |
|
381 // earlier versions of Octave. |
|
382 |
|
383 if (! ident_valid && (d->import || ident_is_all_digits (vname))) |
|
384 { |
|
385 // fix the identifier, replacing invalid chars with underscores |
|
386 vname = make_valid_identifier (vname); |
|
387 |
|
388 // check again (in case vname was null, empty, or some such thing): |
|
389 ident_valid = valid_identifier (vname); |
|
390 } |
|
391 |
|
392 H5Gget_objinfo (group_id, name, 1, &info); |
|
393 |
|
394 if (info.type == H5G_DATASET && ident_valid) |
|
395 { |
|
396 retval = 1; |
|
397 |
|
398 hid_t data_id = H5Dopen (group_id, name); |
|
399 |
|
400 if (data_id < 0) |
|
401 { |
|
402 retval = data_id; |
|
403 |
|
404 goto done; |
|
405 } |
|
406 |
|
407 hid_t type_id = H5Dget_type (data_id); |
|
408 |
|
409 hid_t type_class_id = H5Tget_class (type_id); |
|
410 |
|
411 #if HAVE_HDF5_INT2FLOAT_CONVERSIONS |
|
412 if (type_class_id == H5T_INTEGER || type_class_id == H5T_FLOAT) |
|
413 { |
|
414 #else |
|
415 // hdf5 doesn't (yet) support automatic float/integer conversions |
|
416 if (type_class_id == H5T_FLOAT) |
|
417 { |
|
418 #endif |
|
419 // read real matrix or scalar variable |
|
420 |
|
421 hid_t space_id = H5Dget_space (data_id); |
|
422 |
|
423 hsize_t rank = H5Sget_simple_extent_ndims (space_id); |
|
424 |
|
425 if (rank == 0) |
|
426 { |
|
427 // real scalar: |
|
428 double dtmp; |
|
429 if (H5Dread (data_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, |
|
430 H5P_DEFAULT, (void *) &dtmp) < 0) |
|
431 retval = -1; // error |
|
432 else |
|
433 d->tc = dtmp; |
|
434 } |
|
435 else if (rank > 0 && rank <= 2) |
|
436 { |
|
437 // real matrix |
|
438 OCTAVE_LOCAL_BUFFER (hsize_t, dims, rank); |
|
439 OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank); |
|
440 |
|
441 H5Sget_simple_extent_dims (space_id, dims, maxdims); |
|
442 |
|
443 int nr, nc; // rows and columns |
|
444 // octave uses column-major & HDF5 uses row-major |
|
445 nc = dims[0]; |
|
446 nr = rank > 1 ? dims[1] : 1; |
|
447 Matrix m (nr, nc); |
|
448 double *re = m.fortran_vec (); |
|
449 if (H5Dread (data_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, |
|
450 H5P_DEFAULT, (void *) re) < 0) |
|
451 retval = -1; // error |
|
452 else |
|
453 d->tc = m; |
|
454 } |
|
455 else if (rank >= 3 && d->import) |
|
456 { |
|
457 OCTAVE_LOCAL_BUFFER (hsize_t, dims, rank); |
|
458 OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank); |
|
459 |
|
460 H5Sget_simple_extent_dims (space_id, dims, maxdims); |
|
461 |
|
462 OCTAVE_LOCAL_BUFFER (hssize_t, start, rank); |
|
463 OCTAVE_LOCAL_BUFFER (hsize_t, count, rank); |
|
464 |
|
465 for (hsize_t i = 0; i < rank; ++i) |
|
466 { |
|
467 start[i] = 0; |
|
468 count[i] = 1; |
|
469 } |
|
470 count[0] = dims[0]; |
|
471 count[1] = dims[1]; |
|
472 retval = hdf5_import_multidim (data_id, space_id, |
|
473 rank, dims, rank-1, |
|
474 start, count, |
|
475 H5T_NATIVE_DOUBLE, d->tc); |
|
476 } |
|
477 else |
|
478 { |
|
479 warning ("load: can't read %d-dim. hdf5 dataset %s", |
|
480 rank, name); |
|
481 retval = 0; // skip; we can't read 3+ dimensional datasets |
|
482 } |
|
483 |
|
484 H5Sclose (space_id); |
|
485 } |
|
486 else if (type_class_id == H5T_STRING) |
|
487 { |
|
488 // read string variable |
|
489 hid_t space_id = H5Dget_space (data_id); |
|
490 hsize_t rank = H5Sget_simple_extent_ndims (space_id); |
|
491 |
|
492 if (rank == 0) |
|
493 { |
|
494 // a single string: |
|
495 int slen = H5Tget_size (type_id); |
|
496 if (slen < 0) |
|
497 retval = -1; // error |
|
498 else |
|
499 { |
|
500 OCTAVE_LOCAL_BUFFER (char, s, slen); |
|
501 // create datatype for (null-terminated) string |
|
502 // to read into: |
|
503 hid_t st_id = H5Tcopy (H5T_C_S1); |
|
504 H5Tset_size (st_id, slen); |
|
505 if (H5Dread (data_id, st_id, H5S_ALL, H5S_ALL, |
|
506 H5P_DEFAULT, (void *) s) < 0) |
|
507 { |
|
508 retval = -1; // error |
|
509 } |
|
510 else |
|
511 d->tc = s; |
|
512 |
|
513 H5Tclose (st_id); |
|
514 } |
|
515 } |
|
516 else if (rank == 1) |
|
517 { |
|
518 // string vector |
|
519 hsize_t elements, maxdim; |
|
520 H5Sget_simple_extent_dims (space_id, &elements, &maxdim); |
|
521 int slen = H5Tget_size (type_id); |
|
522 if (slen < 0) |
|
523 retval = -1; // error |
|
524 else |
|
525 { |
|
526 // hdf5 string arrays store strings of all the |
|
527 // same physical length (I think), which is |
|
528 // slightly wasteful, but oh well. |
|
529 |
|
530 OCTAVE_LOCAL_BUFFER (char, s, elements * slen); |
|
531 |
|
532 // create datatype for (null-terminated) string |
|
533 // to read into: |
|
534 hid_t st_id = H5Tcopy (H5T_C_S1); |
|
535 H5Tset_size (st_id, slen); |
|
536 |
|
537 if (H5Dread (data_id, st_id, H5S_ALL, H5S_ALL, |
|
538 H5P_DEFAULT, (void *) s) < 0) |
|
539 retval = -1; // error |
|
540 else |
|
541 { |
|
542 charMatrix chm (elements, slen - 1); |
|
543 for (hsize_t i = 0; i < elements; ++i) |
|
544 { |
|
545 chm.insert (s + i*slen, i, 0); |
|
546 } |
|
547 d->tc = octave_value (chm, true); |
|
548 } |
|
549 |
|
550 H5Tclose (st_id); |
|
551 } |
|
552 } |
|
553 else |
|
554 { |
|
555 warning ("load: can't read %d-dim. hdf5 string vector %s", |
|
556 rank, name); |
|
557 // skip; we can't read higher-dimensional string vectors |
|
558 retval = 0; |
|
559 } |
|
560 } |
|
561 else if (type_class_id == H5T_COMPOUND) |
|
562 { |
|
563 // check for complex or range data: |
|
564 |
|
565 if (hdf5_types_compatible (type_id, d->complex_type)) |
|
566 { |
|
567 // read complex matrix or scalar variable |
|
568 |
|
569 hid_t space_id = H5Dget_space (data_id); |
|
570 hsize_t rank = H5Sget_simple_extent_ndims (space_id); |
|
571 |
|
572 if (rank == 0) |
|
573 { |
|
574 // complex scalar: |
|
575 Complex ctmp; |
|
576 if (H5Dread (data_id, d->complex_type, H5S_ALL, |
|
577 H5S_ALL, H5P_DEFAULT, |
|
578 (void *) X_CAST (double *, &ctmp)) < 0) |
|
579 retval = -1; // error |
|
580 else |
|
581 d->tc = ctmp; |
|
582 } |
|
583 else if (rank > 0 && rank <= 2) |
|
584 { |
|
585 // complex matrix |
|
586 OCTAVE_LOCAL_BUFFER (hsize_t, dims, rank); |
|
587 OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank); |
|
588 H5Sget_simple_extent_dims (space_id, dims, maxdims); |
|
589 int nr, nc; // rows and columns |
|
590 // octave uses column-major & HDF5 uses row-major |
|
591 nc = dims[0]; |
|
592 nr = rank > 1 ? dims[1] : 1; |
|
593 ComplexMatrix m (nr, nc); |
|
594 Complex *reim = m.fortran_vec (); |
|
595 if (H5Dread (data_id, d->complex_type, H5S_ALL, |
|
596 H5S_ALL, H5P_DEFAULT, |
|
597 (void *) X_CAST (double *, reim)) < 0) |
|
598 retval = -1; // error |
|
599 else |
|
600 d->tc = m; |
|
601 } |
|
602 else if (rank >= 3 && d->import) |
|
603 { |
|
604 OCTAVE_LOCAL_BUFFER (hsize_t, dims, rank); |
|
605 OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank); |
|
606 H5Sget_simple_extent_dims (space_id, dims, maxdims); |
|
607 OCTAVE_LOCAL_BUFFER (hssize_t, start, rank); |
|
608 OCTAVE_LOCAL_BUFFER (hsize_t, count, rank); |
|
609 for (hsize_t i = 0; i < rank; ++i) |
|
610 { |
|
611 start[i] = 0; |
|
612 count[i] = 1; |
|
613 } |
|
614 count[0] = dims[0]; |
|
615 count[1] = dims[1]; |
|
616 retval = hdf5_import_multidim (data_id, space_id, |
|
617 rank, dims, rank-1, |
|
618 start, count, |
|
619 d->complex_type, |
|
620 d->tc); |
|
621 } |
|
622 else |
|
623 { |
|
624 warning ("load: can't read %d-dim. hdf5 dataset %s", |
|
625 rank, name); |
|
626 // skip; we can't read 3+ dimensional datasets |
|
627 retval = 0; |
|
628 } |
|
629 H5Sclose (space_id); |
|
630 } |
|
631 else if (hdf5_types_compatible (type_id, d->range_type)) |
|
632 { |
|
633 // read range variable: |
|
634 hid_t space_id = H5Dget_space (data_id); |
|
635 hsize_t rank = H5Sget_simple_extent_ndims (space_id); |
|
636 |
|
637 if (rank == 0) |
|
638 { |
|
639 double rangevals[3]; |
|
640 if (H5Dread (data_id, d->range_type, H5S_ALL, H5S_ALL, |
|
641 H5P_DEFAULT, (void *) rangevals) < 0) |
|
642 retval = -1; // error |
|
643 else |
|
644 { |
|
645 Range r (rangevals[0], rangevals[1], rangevals[2]); |
|
646 d->tc = r; |
|
647 } |
|
648 } |
|
649 else |
|
650 { |
|
651 warning ("load: can't read range array `%s' in hdf5 file", |
|
652 name); |
|
653 // skip; we can't read arrays of range variables |
|
654 retval = 0; |
|
655 } |
|
656 |
|
657 H5Sclose (space_id); |
|
658 } |
|
659 else |
|
660 { |
|
661 warning ("load: can't read `%s' (unknown compound datatype)", |
|
662 name); |
|
663 retval = 0; // unknown datatype; skip. |
|
664 } |
|
665 } |
|
666 else |
|
667 { |
|
668 warning ("load: can't read `%s' (unknown datatype)", name); |
|
669 retval = 0; // unknown datatype; skip |
|
670 } |
|
671 |
|
672 H5Tclose (type_id); |
|
673 |
|
674 // check for OCTAVE_GLOBAL attribute: |
|
675 d->global = hdf5_check_attr (data_id, "OCTAVE_GLOBAL"); |
|
676 |
|
677 H5Dclose (data_id); |
|
678 } |
|
679 else if (info.type == H5G_GROUP && ident_valid) |
|
680 { |
|
681 // read in group as a list or a structure |
|
682 retval = 1; |
|
683 |
|
684 hid_t subgroup_id = H5Gopen (group_id, name); |
|
685 |
|
686 if (subgroup_id < 0) |
|
687 { |
|
688 retval = subgroup_id; |
|
689 goto done; |
|
690 } |
|
691 |
|
692 // an HDF5 group is treated as an octave structure by |
|
693 // default (since that preserves name information), and an |
|
694 // octave list otherwise. |
|
695 |
|
696 bool is_list = hdf5_check_attr (subgroup_id, "OCTAVE_LIST"); |
|
697 |
|
698 hdf5_callback_data dsub; |
|
699 |
|
700 dsub.complex_type = d->complex_type; |
|
701 dsub.range_type = d->range_type; |
|
702 dsub.import = d->import; |
|
703 |
|
704 herr_t retval2; |
|
705 octave_value_list lst; |
|
706 Octave_map m; |
|
707 int current_item = 0; |
|
708 while ((retval2 = H5Giterate (group_id, name, ¤t_item, |
|
709 hdf5_read_next_data, &dsub)) > 0) |
|
710 { |
|
711 if (is_list) |
|
712 lst.append (dsub.tc); |
|
713 else |
|
714 { |
|
715 octave_value ov = dsub.tc; |
|
716 |
|
717 if (ov.is_list ()) |
|
718 m [dsub.name] = ov.list_value (); |
|
719 else |
|
720 m [dsub.name] = ov; |
|
721 } |
|
722 |
|
723 if (have_h5giterate_bug) |
|
724 current_item++; // H5Giterate returned the last index processed |
|
725 } |
|
726 |
|
727 if (retval2 < 0) |
|
728 retval = retval2; |
|
729 else |
|
730 { |
|
731 d->global = hdf5_check_attr (group_id, "OCTAVE_GLOBAL"); |
|
732 |
|
733 if (is_list) |
|
734 d->tc = octave_value (lst); |
|
735 else |
|
736 d->tc = m; |
|
737 } |
|
738 |
|
739 H5Gclose (subgroup_id); |
|
740 } |
|
741 else if (! ident_valid) |
|
742 { |
|
743 // should we attempt to handle invalid identifiers by converting |
|
744 // bad characters to '_', say? |
|
745 warning ("load: skipping invalid identifier `%s' in hdf5 file", |
|
746 name); |
|
747 } |
|
748 |
|
749 done: |
|
750 |
|
751 if (retval < 0) |
|
752 error ("load: error while reading hdf5 item %s", name); |
|
753 |
|
754 if (retval > 0) |
|
755 { |
|
756 // get documentation string, if any: |
|
757 int comment_length = H5Gget_comment (group_id, name, 0, 0); |
|
758 |
|
759 if (comment_length > 1) |
|
760 { |
|
761 OCTAVE_LOCAL_BUFFER (char, tdoc, comment_length); |
|
762 H5Gget_comment (group_id, name, comment_length, tdoc); |
|
763 d->doc = tdoc; |
|
764 } |
|
765 else if (vname != name) |
|
766 { |
|
767 // the name was changed by import; store the original name |
|
768 // as the documentation string: |
|
769 d->doc = name; |
|
770 } |
|
771 |
|
772 // copy name (actually, vname): |
|
773 d->name = vname; |
|
774 } |
|
775 |
|
776 return retval; |
|
777 } |
|
778 |
|
779 // Read the next Octave variable from the stream IS, which must really be |
|
780 // an hdf5_ifstream. Return the variable value in tc, its doc string |
|
781 // in doc, and whether it is global in global. The return value is |
|
782 // the name of the variable, or NULL if none were found or there was |
|
783 // and error. If import is true, we try extra hard to import "foreign" |
|
784 // datasets (not created by Octave), although we usually do a reasonable |
|
785 // job anyway. (c.f. load -import documentation.) |
|
786 std::string |
|
787 read_hdf5_data (std::istream& is, |
|
788 const std::string& filename, bool& global, |
|
789 octave_value& tc, std::string& doc, bool import) |
|
790 { |
|
791 std::string retval; |
|
792 |
|
793 doc.resize (0); |
|
794 |
|
795 hdf5_ifstream& hs = (hdf5_ifstream&) is; |
|
796 hdf5_callback_data d; |
|
797 |
|
798 d.import = import; |
|
799 |
|
800 // Versions of HDF5 prior to 1.2.2 had a bug in H5Giterate where it |
|
801 // would return the index of the last item processed instead of the |
|
802 // next item to be processed, forcing us to increment the index manually. |
|
803 |
|
804 unsigned int vers_major, vers_minor, vers_release; |
|
805 |
|
806 H5get_libversion (&vers_major, &vers_minor, &vers_release); |
|
807 |
|
808 // XXX FIXME XXX -- this test looks wrong. |
|
809 have_h5giterate_bug |
|
810 = (vers_major < 1 |
|
811 || (vers_major == 1 && (vers_minor < 2 |
|
812 || (vers_minor == 2 && vers_release < 2)))); |
|
813 |
|
814 herr_t H5Giterate_retval = H5Giterate (hs.file_id, "/", &hs.current_item, |
|
815 hdf5_read_next_data, &d); |
|
816 |
|
817 if (have_h5giterate_bug) |
|
818 { |
|
819 // H5Giterate sets current_item to the last item processed; we want |
|
820 // the index of the next item (for the next call to read_hdf5_data) |
|
821 |
|
822 hs.current_item++; |
|
823 } |
|
824 |
|
825 if (H5Giterate_retval > 0) |
|
826 { |
|
827 global = d.global; |
|
828 tc = d.tc; |
|
829 doc = d.doc; |
|
830 } |
|
831 else |
|
832 { |
|
833 // an error occurred (H5Giterate_retval < 0) or there are no |
|
834 // more datasets print an error message if retval < 0? |
|
835 // hdf5_read_next_data already printed one, probably. |
|
836 } |
|
837 |
|
838 H5Tclose (d.complex_type); |
|
839 H5Tclose (d.range_type); |
|
840 |
|
841 if (! d.name.empty ()) |
|
842 retval = d.name; |
|
843 |
|
844 return retval; |
|
845 } |
|
846 |
|
847 // Add an attribute named attr_name to loc_id (a simple scalar |
|
848 // attribute with value 1). Return value is >= 0 on success. |
|
849 static herr_t |
|
850 hdf5_add_attr (hid_t loc_id, const char *attr_name) |
|
851 { |
|
852 herr_t retval = 0; |
|
853 |
|
854 hid_t as_id = H5Screate (H5S_SCALAR); |
|
855 |
|
856 if (as_id >= 0) |
|
857 { |
|
858 hid_t a_id = H5Acreate (loc_id, attr_name, |
|
859 H5T_NATIVE_UCHAR, as_id, H5P_DEFAULT); |
|
860 |
|
861 if (a_id >= 0) |
|
862 { |
|
863 unsigned char attr_val = 1; |
|
864 |
|
865 retval = H5Awrite (a_id, H5T_NATIVE_UCHAR, (void*) &attr_val); |
|
866 |
|
867 H5Aclose (a_id); |
|
868 } |
|
869 else |
|
870 retval = a_id; |
|
871 |
|
872 H5Sclose (as_id); |
|
873 } |
|
874 else |
|
875 retval = as_id; |
|
876 |
|
877 return retval; |
|
878 } |
|
879 |
|
880 |
|
881 // save_type_to_hdf5 is not currently used, since hdf5 doesn't yet support |
|
882 // automatic float<->integer conversions: |
|
883 |
|
884 #if HAVE_HDF5_INT2FLOAT_CONVERSIONS |
|
885 |
|
886 // return the HDF5 type id corresponding to the Octave save_type |
|
887 |
|
888 static hid_t |
|
889 save_type_to_hdf5 (save_type st) |
|
890 { |
|
891 switch (st) |
|
892 { |
|
893 case LS_U_CHAR: |
|
894 return H5T_NATIVE_UCHAR; |
|
895 |
|
896 case LS_U_SHORT: |
|
897 return H5T_NATIVE_USHORT; |
|
898 |
|
899 case LS_U_INT: |
|
900 return H5T_NATIVE_UINT; |
|
901 |
|
902 case LS_CHAR: |
|
903 return H5T_NATIVE_CHAR; |
|
904 |
|
905 case LS_SHORT: |
|
906 return H5T_NATIVE_SHORT; |
|
907 |
|
908 case LS_INT: |
|
909 return H5T_NATIVE_INT; |
|
910 |
|
911 case LS_FLOAT: |
|
912 return H5T_NATIVE_FLOAT; |
|
913 |
|
914 case LS_DOUBLE: |
|
915 default: |
|
916 return H5T_NATIVE_DOUBLE; |
|
917 } |
|
918 } |
|
919 #endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */ |
|
920 |
|
921 // Add the data from TC to the HDF5 location loc_id, which could |
|
922 // be either a file or a group within a file. Return true if |
|
923 // successful. This function calls itself recursively for lists |
|
924 // (stored as HDF5 groups). |
|
925 |
|
926 static bool |
|
927 add_hdf5_data (hid_t loc_id, const octave_value& tc, |
|
928 const std::string& name, const std::string& doc, |
|
929 bool mark_as_global, bool save_as_floats) |
|
930 { |
|
931 hsize_t dims[3]; |
|
932 hid_t type_id = -1, space_id = -1, data_id = -1; |
|
933 bool data_is_group = 0; |
|
934 bool retval = 0; |
|
935 |
|
936 if (tc.is_string ()) |
|
937 { |
|
938 int nr = tc.rows (); |
|
939 charMatrix chm = tc.char_matrix_value (); |
|
940 int nc = chm.cols (); |
|
941 |
|
942 // create datatype for (null-terminated) string to write from: |
|
943 type_id = H5Tcopy (H5T_C_S1); H5Tset_size (type_id, nc + 1); |
|
944 if (type_id < 0) |
|
945 goto error_cleanup; |
|
946 |
|
947 dims[0] = nr; |
|
948 space_id = H5Screate_simple (nr > 0 ? 1 : 0, dims, (hsize_t*) 0); |
|
949 if (space_id < 0) |
|
950 goto error_cleanup; |
|
951 |
|
952 data_id = H5Dcreate (loc_id, name.c_str (), |
|
953 type_id, space_id, H5P_DEFAULT); |
|
954 if (data_id < 0) |
|
955 goto error_cleanup; |
|
956 |
|
957 OCTAVE_LOCAL_BUFFER (char, s, nr * (nc + 1)); |
|
958 |
|
959 for (int i = 0; i < nr; ++i) |
|
960 { |
|
961 std::string tstr = chm.row_as_string (i); |
|
962 strcpy (s + i * (nc+1), tstr.c_str ()); |
|
963 } |
|
964 |
|
965 if (H5Dwrite (data_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, |
|
966 (void*) s) < 0) { |
|
967 goto error_cleanup; |
|
968 } |
|
969 } |
|
970 else if (tc.is_range ()) |
|
971 { |
|
972 space_id = H5Screate_simple (0, dims, (hsize_t*) 0); |
|
973 if (space_id < 0) |
|
974 goto error_cleanup; |
|
975 |
|
976 type_id = hdf5_make_range_type (H5T_NATIVE_DOUBLE); |
|
977 if (type_id < 0) |
|
978 goto error_cleanup; |
|
979 |
|
980 data_id = H5Dcreate (loc_id, name.c_str (), |
|
981 type_id, space_id, H5P_DEFAULT); |
|
982 if (data_id < 0) |
|
983 goto error_cleanup; |
|
984 |
|
985 Range r = tc.range_value (); |
|
986 double range_vals[3]; |
|
987 range_vals[0] = r.base (); |
|
988 range_vals[1] = r.limit (); |
|
989 range_vals[2] = r.inc (); |
|
990 |
|
991 if (H5Dwrite (data_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, |
|
992 (void*) range_vals) < 0) |
|
993 goto error_cleanup; |
|
994 } |
|
995 else if (tc.is_real_scalar ()) |
|
996 { |
|
997 space_id = H5Screate_simple (0, dims, (hsize_t*) 0); |
|
998 if (space_id < 0) goto error_cleanup; |
|
999 |
|
1000 data_id = H5Dcreate (loc_id, name.c_str (), |
|
1001 H5T_NATIVE_DOUBLE, space_id, H5P_DEFAULT); |
|
1002 if (data_id < 0) |
|
1003 goto error_cleanup; |
|
1004 |
|
1005 double tmp = tc.double_value (); |
|
1006 if (H5Dwrite (data_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, |
|
1007 H5P_DEFAULT, (void*) &tmp) < 0) |
|
1008 goto error_cleanup; |
|
1009 } |
|
1010 else if (tc.is_real_matrix ()) |
|
1011 { |
|
1012 Matrix m = tc.matrix_value (); |
|
1013 dims[1] = m.rows (); // Octave uses column-major, while |
|
1014 dims[0] = m.columns (); // HDF5 uses row-major ordering |
|
1015 |
|
1016 space_id = H5Screate_simple (dims[1] > 1 ?2:1, dims, (hsize_t*) 0); |
|
1017 if (space_id < 0) |
|
1018 goto error_cleanup; |
|
1019 |
|
1020 hid_t save_type_id = H5T_NATIVE_DOUBLE; |
|
1021 |
|
1022 if (save_as_floats) |
|
1023 { |
|
1024 if (m.too_large_for_float ()) |
|
1025 { |
|
1026 warning ("save: some values too large to save as floats --"); |
|
1027 warning ("save: saving as doubles instead"); |
|
1028 } |
|
1029 else |
|
1030 save_type_id = H5T_NATIVE_FLOAT; |
|
1031 } |
|
1032 #if HAVE_HDF5_INT2FLOAT_CONVERSIONS |
|
1033 // hdf5 currently doesn't support float/integer conversions |
|
1034 else |
|
1035 { |
|
1036 double max_val, min_val; |
|
1037 |
|
1038 if (m.all_integers (max_val, min_val)) |
|
1039 save_type_id |
|
1040 = save_type_to_hdf5 (get_save_type (max_val, min_val)); |
|
1041 } |
|
1042 #endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */ |
|
1043 |
|
1044 data_id = H5Dcreate (loc_id, name.c_str (), |
|
1045 save_type_id, space_id, H5P_DEFAULT); |
|
1046 if (data_id < 0) |
|
1047 goto error_cleanup; |
|
1048 |
|
1049 double *mtmp = m.fortran_vec (); |
|
1050 if (H5Dwrite (data_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, |
|
1051 H5P_DEFAULT, (void*) mtmp) < 0) |
|
1052 goto error_cleanup; |
|
1053 } |
|
1054 else if (tc.is_complex_scalar ()) |
|
1055 { |
|
1056 space_id = H5Screate_simple (0, dims, (hsize_t*) 0); |
|
1057 if (space_id < 0) |
|
1058 goto error_cleanup; |
|
1059 |
|
1060 type_id = hdf5_make_complex_type (H5T_NATIVE_DOUBLE); |
|
1061 if (type_id < 0) |
|
1062 goto error_cleanup; |
|
1063 |
|
1064 data_id = H5Dcreate (loc_id, name.c_str (), |
|
1065 type_id, space_id, H5P_DEFAULT); |
|
1066 if (data_id < 0) |
|
1067 goto error_cleanup; |
|
1068 |
|
1069 Complex tmp = tc.complex_value (); |
|
1070 if (H5Dwrite (data_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, |
|
1071 (void*) X_CAST (double*, &tmp)) < 0) |
|
1072 goto error_cleanup; |
|
1073 } |
|
1074 else if (tc.is_complex_matrix ()) |
|
1075 { |
|
1076 ComplexMatrix m = tc.complex_matrix_value (); |
|
1077 |
|
1078 dims[1] = m.rows (); // Octave uses column-major, while |
|
1079 dims[0] = m.columns (); // HDF5 uses row-major ordering |
|
1080 |
|
1081 space_id = H5Screate_simple (dims[1] > 1 ?2:1, dims, (hsize_t*) 0); |
|
1082 if (space_id < 0) |
|
1083 goto error_cleanup; |
|
1084 |
|
1085 hid_t save_type_id = H5T_NATIVE_DOUBLE; |
|
1086 |
|
1087 if (save_as_floats) |
|
1088 { |
|
1089 if (m.too_large_for_float ()) |
|
1090 { |
|
1091 warning ("save: some values too large to save as floats --"); |
|
1092 warning ("save: saving as doubles instead"); |
|
1093 } |
|
1094 else |
|
1095 save_type_id = H5T_NATIVE_FLOAT; |
|
1096 } |
|
1097 #if HAVE_HDF5_INT2FLOAT_CONVERSIONS |
|
1098 // hdf5 currently doesn't support float/integer conversions |
|
1099 else |
|
1100 { |
|
1101 double max_val, min_val; |
|
1102 |
|
1103 if (m.all_integers (max_val, min_val)) |
|
1104 save_type_id |
|
1105 = save_type_to_hdf5 (get_save_type (max_val, min_val)); |
|
1106 } |
|
1107 #endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */ |
|
1108 |
|
1109 type_id = hdf5_make_complex_type (save_type_id); |
|
1110 if (type_id < 0) goto error_cleanup; |
|
1111 |
|
1112 data_id = H5Dcreate (loc_id, name.c_str (), |
|
1113 type_id, space_id, H5P_DEFAULT); |
|
1114 if (data_id < 0) |
|
1115 goto error_cleanup; |
|
1116 |
|
1117 hid_t complex_type_id = hdf5_make_complex_type (H5T_NATIVE_DOUBLE); |
|
1118 if (complex_type_id < 0) |
|
1119 goto error_cleanup; |
|
1120 |
|
1121 Complex *mtmp = m.fortran_vec (); |
|
1122 if (H5Dwrite (data_id, complex_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, |
|
1123 (void*) X_CAST (double *, mtmp)) < 0) |
|
1124 { |
|
1125 H5Tclose (complex_type_id); |
|
1126 goto error_cleanup; |
|
1127 } |
|
1128 |
|
1129 H5Tclose (complex_type_id); |
|
1130 } |
|
1131 else if (tc.is_list ()) |
|
1132 { |
|
1133 data_id = H5Gcreate (loc_id, name.c_str (), 0); |
|
1134 if (data_id < 0) |
|
1135 goto error_cleanup; |
|
1136 |
|
1137 data_is_group = 1; |
|
1138 |
|
1139 // recursively add each element of the list to this group |
|
1140 octave_value_list lst = tc.list_value (); |
|
1141 |
|
1142 for (int i = 0; i < lst.length (); ++i) |
|
1143 { |
|
1144 // should we use lst.name_tags () to label the elements? |
|
1145 char s[20]; |
|
1146 sprintf (s, "_%d", i); |
|
1147 bool retval2 = add_hdf5_data (data_id, lst (i), s, "", |
|
1148 false, save_as_floats); |
|
1149 if (! retval2) |
|
1150 goto error_cleanup; |
|
1151 } |
|
1152 |
|
1153 // mark with an attribute "OCTAVE_LIST" with value 1 |
|
1154 // to distinguish from structures (also stored as HDF5 groups): |
|
1155 if (hdf5_add_attr (data_id, "OCTAVE_LIST") < 0) |
|
1156 goto error_cleanup; |
|
1157 } |
|
1158 else if (tc.is_map ()) |
|
1159 { |
|
1160 // an Octave structure |
|
1161 data_id = H5Gcreate (loc_id, name.c_str (), 0); |
|
1162 if (data_id < 0) |
|
1163 goto error_cleanup; |
|
1164 |
|
1165 data_is_group = 1; |
|
1166 |
|
1167 // recursively add each element of the structure to this group |
|
1168 Octave_map m = tc.map_value (); |
|
1169 Octave_map::iterator i = m.begin (); |
|
1170 while (i != m.end ()) |
|
1171 { |
|
1172 // XXX FIXME XXX -- if the length of the structure array is |
|
1173 // 1, should we really create a list object? |
|
1174 bool retval2 = add_hdf5_data (data_id, octave_value (m.contents (i)), |
|
1175 m.key (i), "", false, save_as_floats); |
|
1176 if (! retval2) |
|
1177 goto error_cleanup; |
|
1178 |
|
1179 i++; |
|
1180 } |
|
1181 } |
|
1182 else |
|
1183 { |
|
1184 gripe_wrong_type_arg ("save", tc, false); |
|
1185 goto error_cleanup; |
|
1186 } |
|
1187 |
|
1188 // attach doc string as comment: |
|
1189 if (doc.length () > 0 |
|
1190 && H5Gset_comment (loc_id, name.c_str (), doc.c_str ()) < 0) |
|
1191 goto error_cleanup; |
|
1192 |
|
1193 retval = 1; |
|
1194 |
|
1195 // if it's global, add an attribute "OCTAVE_GLOBAL" with value 1 |
|
1196 if (mark_as_global) |
|
1197 retval = hdf5_add_attr (data_id, "OCTAVE_GLOBAL") >= 0; |
|
1198 |
|
1199 error_cleanup: |
|
1200 |
|
1201 if (! retval) |
|
1202 error ("save: error while writing `%s' to hdf5 file", name.c_str ()); |
|
1203 |
|
1204 if (data_id >= 0) |
|
1205 { |
|
1206 if (data_is_group) |
|
1207 H5Gclose (data_id); |
|
1208 else |
|
1209 H5Dclose (data_id); |
|
1210 } |
|
1211 |
|
1212 if (space_id >= 0) |
|
1213 H5Sclose (space_id); |
|
1214 |
|
1215 if (type_id >= 0) |
|
1216 H5Tclose (type_id); |
|
1217 |
|
1218 return retval; |
|
1219 } |
|
1220 |
|
1221 // Write data from TC in HDF5 (binary) format to the stream OS, |
|
1222 // which must be an hdf5_ofstream, returning true on success. |
|
1223 |
|
1224 bool |
|
1225 save_hdf5_data (std::ostream& os, const octave_value& tc, |
|
1226 const std::string& name, const std::string& doc, |
|
1227 bool mark_as_global, bool save_as_floats) |
|
1228 { |
|
1229 hdf5_ofstream& hs = (hdf5_ofstream&) os; |
|
1230 |
|
1231 return add_hdf5_data (hs.file_id, tc, name, doc, |
|
1232 mark_as_global, save_as_floats); |
|
1233 } |
|
1234 |
|
1235 #endif |
|
1236 |
|
1237 /* |
|
1238 ;;; Local Variables: *** |
|
1239 ;;; mode: C++ *** |
|
1240 ;;; End: *** |
|
1241 */ |