diff options
-rw-r--r-- | src/.distdep | 96 | ||||
-rw-r--r-- | src/H5ACprivate.h | 4 | ||||
-rw-r--r-- | src/H5Apublic.h | 6 | ||||
-rw-r--r-- | src/H5Dprivate.h | 2 | ||||
-rw-r--r-- | src/H5Dpublic.h | 6 | ||||
-rw-r--r-- | src/H5Epublic.h | 3 | ||||
-rw-r--r-- | src/H5Flow.c | 2 | ||||
-rw-r--r-- | src/H5Fprivate.h | 39 | ||||
-rw-r--r-- | src/H5Fpublic.h | 7 | ||||
-rw-r--r-- | src/H5HGprivate.h | 7 | ||||
-rw-r--r-- | src/H5HLprivate.h | 6 | ||||
-rw-r--r-- | src/H5Oprivate.h | 20 | ||||
-rw-r--r-- | src/H5Ppublic.h | 85 | ||||
-rw-r--r-- | src/H5RApublic.h | 7 | ||||
-rw-r--r-- | src/H5Rpublic.h | 2 | ||||
-rw-r--r-- | src/H5Spublic.h | 20 | ||||
-rw-r--r-- | src/H5Tpkg.h | 7 | ||||
-rw-r--r-- | src/H5Tpublic.h | 35 | ||||
-rw-r--r-- | src/H5Vprivate.h | 22 | ||||
-rw-r--r-- | src/H5Zpublic.h | 3 | ||||
-rw-r--r-- | src/H5api_adpt.h | 2 | ||||
-rw-r--r-- | src/H5private.h | 5 | ||||
-rw-r--r-- | src/H5public.h | 7 | ||||
-rw-r--r-- | src/Makefile.in | 2 | ||||
-rw-r--r-- | test/.distdep | 61 | ||||
-rw-r--r-- | test/dtypes.c | 6 | ||||
-rw-r--r-- | tools/h5ls.c | 425 | ||||
-rw-r--r-- | tools/h5tools.c | 150 | ||||
-rw-r--r-- | tools/h5tools.h | 5 |
29 files changed, 766 insertions, 276 deletions
diff --git a/src/.distdep b/src/.distdep index 4dfd2fb..b3261e3 100644 --- a/src/.distdep +++ b/src/.distdep @@ -234,17 +234,6 @@ H5Fistore.o: \ H5Zpublic.h \ H5Eprivate.h \ H5Epublic.h -H5Flow.o: \ - H5Flow.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h H5Fmpio.o: \ H5Fmpio.c \ H5private.h \ @@ -304,42 +293,6 @@ H5Fstdio.o: \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h -H5G.o: \ - H5G.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Aprivate.h \ - H5Apublic.h \ - H5Ipublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5Dprivate.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Gpkg.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5HLprivate.h \ - H5HLpublic.h \ - H5Iprivate.h \ - H5MMprivate.h \ - H5MMpublic.h H5Gent.o: \ H5Gent.c \ H5private.h \ @@ -1251,3 +1204,52 @@ H5Z.o: \ H5Sprivate.h \ H5Spublic.h \ H5Zprivate.h +H5G.o: \ + H5G.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5api_adpt.h \ + H5Aprivate.h \ + H5Apublic.h \ + H5Ipublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Dprivate.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Gpkg.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5HLprivate.h \ + H5HLpublic.h \ + H5Iprivate.h \ + H5MMprivate.h \ + H5MMpublic.h +H5Flow.o: \ + H5Flow.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5api_adpt.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Ipublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 91cc2ca..5b6bb2b 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -113,8 +113,8 @@ void *H5AC_protect (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, const void *udata1, void *udata2); herr_t H5AC_unprotect (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, void *thing); -HDF5API herr_t H5AC_flush (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, - hbool_t destroy); +HDF5API herr_t H5AC_flush (H5F_t *f, const H5AC_class_t *type, + const haddr_t *addr, hbool_t destroy); herr_t H5AC_create (H5F_t *f, intn size_hint); herr_t H5AC_rename (H5F_t *f, const H5AC_class_t *type, const haddr_t *old_addr, const haddr_t *new_addr); diff --git a/src/H5Apublic.h b/src/H5Apublic.h index aa40778..4b14943 100644 --- a/src/H5Apublic.h +++ b/src/H5Apublic.h @@ -27,8 +27,8 @@ typedef int (*H5A_operator_t)(hid_t location_id/*in*/, const char *attr_name/*in*/, void *operator_data/*in,out*/); /* Public function prototypes */ -HDF5API hid_t H5Acreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, - hid_t plist_id); +HDF5API hid_t H5Acreate(hid_t loc_id, const char *name, hid_t type_id, + hid_t space_id, hid_t plist_id); HDF5API hid_t H5Aopen_name(hid_t loc_id, const char *name); HDF5API hid_t H5Aopen_idx(hid_t loc_id, unsigned idx); HDF5API herr_t H5Awrite(hid_t attr_id, hid_t type_id, void *buf); @@ -39,7 +39,7 @@ HDF5API hid_t H5Aget_type(hid_t attr_id); HDF5API hssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf); HDF5API int H5Aget_num_attrs(hid_t loc_id); HDF5API int H5Aiterate(hid_t loc_id, unsigned *attr_num, H5A_operator_t op, - void *op_data); + void *op_data); HDF5API herr_t H5Adelete(hid_t loc_id, const char *name); #ifdef __cplusplus diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 534ddf4..470368a 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -17,7 +17,7 @@ #define _H5Dprivate_H #include <H5Dpublic.h> -#include <H5api_adpt.h> + /* Private headers needed by this file */ #include <H5private.h> #include <H5Fprivate.h> /*for the H5F_t type */ diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index 26937ae..e355de5 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -44,16 +44,16 @@ extern "C" { #endif HDF5API hid_t H5Dcreate (hid_t file_id, const char *name, hid_t type_id, - hid_t space_id, hid_t plist_id); + hid_t space_id, hid_t plist_id); HDF5API hid_t H5Dopen (hid_t file_id, const char *name); HDF5API herr_t H5Dclose (hid_t dset_id); HDF5API hid_t H5Dget_space (hid_t dset_id); HDF5API hid_t H5Dget_type (hid_t dset_id); HDF5API hid_t H5Dget_create_plist (hid_t dset_id); HDF5API herr_t H5Dread (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, void *buf/*out*/); + hid_t file_space_id, hid_t plist_id, void *buf/*out*/); HDF5API herr_t H5Dwrite (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, const void *buf); + hid_t file_space_id, hid_t plist_id, const void *buf); HDF5API herr_t H5Dextend (hid_t dset_id, const hsize_t *size); #ifdef __cplusplus diff --git a/src/H5Epublic.h b/src/H5Epublic.h index 77fcca5..abaf7d7 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -179,7 +179,8 @@ HDF5API herr_t H5Eset_auto (H5E_auto_t func, void *client_data); HDF5API herr_t H5Eget_auto (H5E_auto_t *func, void **client_data); HDF5API herr_t H5Eclear (void); HDF5API herr_t H5Eprint (FILE *stream); -HDF5API herr_t H5Ewalk (H5E_direction_t direction, H5E_walk_t func, void *client_data); +HDF5API herr_t H5Ewalk (H5E_direction_t direction, H5E_walk_t func, + void *client_data); HDF5API herr_t H5Ewalk_cb (int n, H5E_error_t *err_desc, void *client_data); HDF5API const char *H5Eget_major (H5E_major_t major_number); HDF5API const char *H5Eget_minor (H5E_minor_t minor_number); diff --git a/src/H5Flow.c b/src/H5Flow.c index 68492de..29891c2 100644 --- a/src/H5Flow.c +++ b/src/H5Flow.c @@ -481,7 +481,9 @@ H5F_low_access(const H5F_low_class_t *type, const char *name, { htri_t ret_value; struct stat sb; +#ifdef WIN32 int fid; +#endif FUNC_ENTER(H5F_low_size, FAIL); assert(type); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 637df69..740670c 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -550,28 +550,33 @@ H5F_t *H5F_open(const char *name, uintn flags, const H5F_create_t *create_parms, const H5F_access_t *access_parms); herr_t H5F_close(H5F_t *f); -HDF5API herr_t H5F_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent, - intn fwidth); +HDF5API herr_t H5F_debug(H5F_t *f, const haddr_t *addr, FILE * stream, + intn indent, intn fwidth); HDF5API herr_t H5F_istore_debug(H5F_t *f, const haddr_t *addr, FILE * stream, - intn indent, intn fwidth, int ndims); + intn indent, intn fwidth, int ndims); herr_t H5F_mountpoint(struct H5G_entry_t *find/*in,out*/); /* Functions that operate on array storage */ -HDF5API herr_t H5F_arr_create(H5F_t *f, struct H5O_layout_t *layout /*in,out*/); +HDF5API herr_t H5F_arr_create(H5F_t *f, + struct H5O_layout_t *layout /*in,out*/); HDF5API herr_t H5F_arr_read (H5F_t *f, const struct H5D_xfer_t *xfer, - const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_fill_t *fill, - const struct H5O_efl_t *efl, const hsize_t _hslab_size[], - const hsize_t mem_size[], const hssize_t mem_offset[], - const hssize_t file_offset[], void *_buf/*out*/); + const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, + const struct H5O_fill_t *fill, + const struct H5O_efl_t *efl, + const hsize_t _hslab_size[], + const hsize_t mem_size[], + const hssize_t mem_offset[], + const hssize_t file_offset[], void *_buf/*out*/); HDF5API herr_t H5F_arr_write (H5F_t *f, const struct H5D_xfer_t *xfer, - const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, - const struct H5O_fill_t *fill, - const struct H5O_efl_t *efl, const hsize_t _hslab_size[], - const hsize_t mem_size[], const hssize_t mem_offset[], - const hssize_t file_offset[], const void *_buf); + const struct H5O_layout_t *layout, + const struct H5O_pline_t *pline, + const struct H5O_fill_t *fill, + const struct H5O_efl_t *efl, + const hsize_t _hslab_size[], + const hsize_t mem_size[], + const hssize_t mem_offset[], + const hssize_t file_offset[], const void *_buf); /* Functions that operate on indexed storage */ herr_t H5F_istore_init (H5F_t *f); @@ -600,7 +605,7 @@ herr_t H5F_istore_allocate (H5F_t *f, /* Functions that operate on contiguous storage wrt boot block */ HDF5API herr_t H5F_block_read(H5F_t *f, const haddr_t *addr, hsize_t size, - const H5D_transfer_t xfer_mode, void *buf); + const H5D_transfer_t xfer_mode, void *buf); herr_t H5F_block_write(H5F_t *f, const haddr_t *addr, hsize_t size, const H5D_transfer_t xfer_mode, const void *buf); diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 1244f6b..f9e797b 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -84,9 +84,10 @@ extern "C" { /* Functions in H5F.c */ HDF5API htri_t H5Fis_hdf5 (const char *filename); -HDF5API hid_t H5Fcreate (const char *filename, unsigned flags, hid_t create_plist, - hid_t access_plist); -HDF5API hid_t H5Fopen (const char *filename, unsigned flags, hid_t access_plist); +HDF5API hid_t H5Fcreate (const char *filename, unsigned flags, + hid_t create_plist, hid_t access_plist); +HDF5API hid_t H5Fopen (const char *filename, unsigned flags, + hid_t access_plist); HDF5API hid_t H5Freopen(hid_t file_id); HDF5API herr_t H5Fflush(hid_t object_id, H5F_scope_t scope); HDF5API herr_t H5Fclose (hid_t file_id); diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h index 8ac9e7b..a22f265 100644 --- a/src/H5HGprivate.h +++ b/src/H5HGprivate.h @@ -93,12 +93,13 @@ typedef struct H5HG_t { typedef struct H5HG_heap_t H5HG_heap_t; H5HG_heap_t *H5HG_create (H5F_t *f, size_t size); -HDF5API herr_t H5HG_insert (H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/); +HDF5API herr_t H5HG_insert (H5F_t *f, size_t size, void *obj, + H5HG_t *hobj/*out*/); void *H5HG_peek (H5F_t *f, H5HG_t *hobj); HDF5API void *H5HG_read (H5F_t *f, H5HG_t *hobj, void *object); intn H5HG_link (H5F_t *f, H5HG_t *hobj, intn adjust); HDF5API herr_t H5HG_remove (H5F_t *f, H5HG_t *hobj); -HDF5API herr_t H5HG_debug(H5F_t *f, const haddr_t *addr, FILE *stream, intn indent, - intn fwidth); +HDF5API herr_t H5HG_debug(H5F_t *f, const haddr_t *addr, FILE *stream, + intn indent, intn fwidth); #endif diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h index dad47f3..3ac2e7a 100644 --- a/src/H5HLprivate.h +++ b/src/H5HLprivate.h @@ -55,10 +55,10 @@ void *H5HL_read (H5F_t *f, const haddr_t *addr, size_t offset, size_t size, void *buf); HDF5API const void *H5HL_peek (H5F_t *f, const haddr_t *addr, size_t offset); HDF5API size_t H5HL_insert (H5F_t *f, const haddr_t *addr, size_t size, - const void *buf); + const void *buf); herr_t H5HL_write (H5F_t *f, const haddr_t *addr, size_t offset, size_t size, const void *buf); herr_t H5HL_remove (H5F_t *f, const haddr_t *addr, size_t offset, size_t size); -HDF5API herr_t H5HL_debug (H5F_t *f, const haddr_t *addr, FILE * stream, intn indent, - intn fwidth); +HDF5API herr_t H5HL_debug (H5F_t *f, const haddr_t *addr, FILE * stream, + intn indent, intn fwidth); #endif diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 76a7fdb..6c13966 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -18,7 +18,7 @@ #define _H5Oprivate_H #include <H5Opublic.h> -#include <H5api_adpt.h> + /* Private headers needed by this file */ #include <H5private.h> #include <H5Fprivate.h> @@ -268,25 +268,27 @@ typedef struct H5O_stab_t { } H5O_stab_t; /* General message operators */ -HDF5API herr_t H5O_create (H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/); +HDF5API herr_t H5O_create (H5F_t *f, size_t size_hint, + H5G_entry_t *ent/*out*/); herr_t H5O_open (H5G_entry_t *ent); HDF5API herr_t H5O_close (H5G_entry_t *ent); intn H5O_link (H5G_entry_t *ent, intn adjust); intn H5O_count (H5G_entry_t *ent, const H5O_class_t *type); htri_t H5O_exists(H5G_entry_t *ent, const H5O_class_t *type, intn sequence); -HDF5API void *H5O_read (H5G_entry_t *ent, const H5O_class_t *type, intn sequence, - void *mesg); -HDF5API intn H5O_modify (H5G_entry_t *ent, const H5O_class_t *type, intn overwrite, - uintn flags, const void *mesg); +HDF5API void *H5O_read (H5G_entry_t *ent, const H5O_class_t *type, + intn sequence, void *mesg); +HDF5API intn H5O_modify (H5G_entry_t *ent, const H5O_class_t *type, + intn overwrite, uintn flags, const void *mesg); herr_t H5O_touch(H5G_entry_t *ent, hbool_t force); -HDF5API herr_t H5O_remove (H5G_entry_t *ent, const H5O_class_t *type, intn sequence); +HDF5API herr_t H5O_remove (H5G_entry_t *ent, const H5O_class_t *type, + intn sequence); herr_t H5O_reset (const H5O_class_t *type, void *native); void *H5O_free (const H5O_class_t *type, void *mesg); void *H5O_copy (const H5O_class_t *type, const void *mesg, void *dst); herr_t H5O_share (H5F_t *f, const H5O_class_t *type, const void *mesg, H5HG_t *hobj/*out*/); -HDF5API herr_t H5O_debug (H5F_t *f, const haddr_t *addr, FILE * stream, intn indent, - intn fwidth); +HDF5API herr_t H5O_debug (H5F_t *f, const haddr_t *addr, FILE * stream, + intn indent, intn fwidth); /* EFL operators */ hsize_t H5O_efl_total_size (H5O_efl_t *efl); diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index bbbd9ab..d22ba2e 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -48,16 +48,19 @@ HDF5API hid_t H5Pcreate (H5P_class_t type); HDF5API herr_t H5Pclose (hid_t plist_id); HDF5API hid_t H5Pcopy (hid_t plist_id); HDF5API H5P_class_t H5Pget_class (hid_t plist_id); -HDF5API herr_t H5Pget_version (hid_t plist_id, int *boot/*out*/, int *freelist/*out*/, - int *stab/*out*/, int *shhdr/*out*/); +HDF5API herr_t H5Pget_version (hid_t plist_id, int *boot/*out*/, + int *freelist/*out*/, int *stab/*out*/, + int *shhdr/*out*/); HDF5API herr_t H5Pset_userblock (hid_t plist_id, hsize_t size); HDF5API herr_t H5Pget_userblock (hid_t plist_id, hsize_t *size); -HDF5API herr_t H5Pset_alignment (hid_t fapl_id, hsize_t threshold, hsize_t alignment); +HDF5API herr_t H5Pset_alignment (hid_t fapl_id, hsize_t threshold, + hsize_t alignment); HDF5API herr_t H5Pget_alignment (hid_t fapl_id, hsize_t *threshold/*out*/, - hsize_t *alignment/*out*/); -HDF5API herr_t H5Pset_sizes (hid_t plist_id, size_t sizeof_addr, size_t sizeof_size); + hsize_t *alignment/*out*/); +HDF5API herr_t H5Pset_sizes (hid_t plist_id, size_t sizeof_addr, + size_t sizeof_size); HDF5API herr_t H5Pget_sizes (hid_t plist_id, size_t *sizeof_addr/*out*/, - size_t *sizeof_size/*out*/); + size_t *sizeof_size/*out*/); HDF5API herr_t H5Pset_sym_k (hid_t plist_id, int ik, int lk); HDF5API herr_t H5Pget_sym_k (hid_t plist_id, int *ik/*out*/, int *lk/*out*/); HDF5API herr_t H5Pset_istore_k (hid_t plist_id, int ik); @@ -67,11 +70,11 @@ HDF5API H5D_layout_t H5Pget_layout (hid_t plist_id); HDF5API herr_t H5Pset_chunk (hid_t plist_id, int ndims, const hsize_t dim[]); HDF5API int H5Pget_chunk (hid_t plist_id, int max_ndims, hsize_t dim[]/*out*/); HDF5API herr_t H5Pset_external (hid_t plist_id, const char *name, off_t offset, - hsize_t size); + hsize_t size); HDF5API int H5Pget_external_count (hid_t plist_id); HDF5API herr_t H5Pget_external (hid_t plist_id, int idx, size_t name_size, - char *name/*out*/, off_t *offset/*out*/, - hsize_t *size/*out*/); + char *name/*out*/, off_t *offset/*out*/, + hsize_t *size/*out*/); HDF5API H5F_driver_t H5Pget_driver (hid_t plist_id); HDF5API herr_t H5Pset_stdio (hid_t plist_id); HDF5API herr_t H5Pget_stdio (hid_t plist_id); @@ -79,49 +82,61 @@ HDF5API herr_t H5Pset_sec2 (hid_t plist_id); HDF5API herr_t H5Pget_sec2 (hid_t plist_id); HDF5API herr_t H5Pset_core (hid_t plist_id, size_t increment); HDF5API herr_t H5Pget_core (hid_t plist_id, size_t *increment/*out*/); -HDF5API herr_t H5Pset_split (hid_t plist_id, const char *meta_ext, hid_t meta_plist_id, - const char *raw_ext, hid_t raw_plist_id); +HDF5API herr_t H5Pset_split (hid_t plist_id, const char *meta_ext, + hid_t meta_plist_id, const char *raw_ext, + hid_t raw_plist_id); HDF5API herr_t H5Pget_split (hid_t plist_id, size_t meta_ext_size, - char *meta_ext/*out*/, hid_t *meta_properties/*out*/, - size_t raw_ext_size, char *raw_ext/*out*/, - hid_t *raw_properties/*out*/); + char *meta_ext/*out*/, + hid_t *meta_properties/*out*/, + size_t raw_ext_size, char *raw_ext/*out*/, + hid_t *raw_properties/*out*/); -HDF5API herr_t H5Pset_family (hid_t plist_id, hsize_t memb_size, hid_t memb_plist_id); +HDF5API herr_t H5Pset_family (hid_t plist_id, hsize_t memb_size, + hid_t memb_plist_id); HDF5API herr_t H5Pget_family (hid_t plist_id, hsize_t *memb_size/*out*/, - hid_t *memb_plist_id/*out*/); -HDF5API herr_t H5Pset_buffer (hid_t plist_id, size_t size, void *tconv, void *bkg); -HDF5API size_t H5Pget_buffer (hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/); + hid_t *memb_plist_id/*out*/); +HDF5API herr_t H5Pset_buffer (hid_t plist_id, size_t size, void *tconv, + void *bkg); +HDF5API size_t H5Pget_buffer (hid_t plist_id, void **tconv/*out*/, + void **bkg/*out*/); HDF5API herr_t H5Pset_preserve (hid_t plist_id, hbool_t status); HDF5API int H5Pget_preserve (hid_t plist_id); -HDF5API herr_t H5Pset_filter (hid_t plist_id, H5Z_filter_t filter, unsigned int flags, - size_t cd_nelmts, const unsigned int c_values[]); +HDF5API herr_t H5Pset_filter (hid_t plist_id, H5Z_filter_t filter, + unsigned int flags, size_t cd_nelmts, + const unsigned int c_values[]); HDF5API int H5Pget_nfilters(hid_t plist_id); HDF5API H5Z_filter_t H5Pget_filter(hid_t plist_id, int filter, - unsigned int *flags/*out*/, - size_t *cd_nelmts/*out*/, - unsigned cd_values[]/*out*/, - size_t namelen, char name[]); + unsigned int *flags/*out*/, + size_t *cd_nelmts/*out*/, + unsigned cd_values[]/*out*/, + size_t namelen, char name[]); HDF5API herr_t H5Pset_deflate (hid_t plist_id, unsigned aggression); HDF5API herr_t H5Pset_cache (hid_t plist_id, int mdc_nelmts, int rdcc_nelmts, - size_t rdcc_nbytes, double rdcc_w0); + size_t rdcc_nbytes, double rdcc_w0); HDF5API herr_t H5Pget_cache (hid_t plist_id, int *mdc_nelmts/*out*/, - int *rdcc_nelmts/*out*/, size_t *rdcc_nbytes/*out*/, - double *rdcc_w0); -HDF5API herr_t H5Pset_hyper_cache(hid_t plist_id, unsigned cache, unsigned limit); -HDF5API herr_t H5Pget_hyper_cache(hid_t plist_id, unsigned *cache, unsigned *limit); + int *rdcc_nelmts/*out*/, + size_t *rdcc_nbytes/*out*/, double *rdcc_w0); +HDF5API herr_t H5Pset_hyper_cache(hid_t plist_id, unsigned cache, + unsigned limit); +HDF5API herr_t H5Pget_hyper_cache(hid_t plist_id, unsigned *cache, + unsigned *limit); HDF5API herr_t H5Pset_btree_ratios(hid_t plist_id, double left, double middle, - double right); + double right); HDF5API herr_t H5Pget_btree_ratios(hid_t plist_id, double *left/*out*/, - double *middle/*out*/, double *right/*out*/); -HDF5API herr_t H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value); -HDF5API herr_t H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/); + double *middle/*out*/, + double *right/*out*/); +HDF5API herr_t H5Pset_fill_value(hid_t plist_id, hid_t type_id, + const void *value); +HDF5API herr_t H5Pget_fill_value(hid_t plist_id, hid_t type_id, + void *value/*out*/); #ifdef HAVE_PARALLEL HDF5API herr_t H5Pset_mpi (hid_t plist_id, MPI_Comm comm, MPI_Info info); HDF5API herr_t H5Pget_mpi (hid_t plist_id, MPI_Comm *comm/*out*/, - MPI_Info *info/*out*/); + MPI_Info *info/*out*/); HDF5API herr_t H5Pset_xfer (hid_t plist_id, H5D_transfer_t data_xfer_mode); -HDF5API herr_t H5Pget_xfer (hid_t plist_id, H5D_transfer_t *data_xfer_mode/*out*/); +HDF5API herr_t H5Pget_xfer (hid_t plist_id, + H5D_transfer_t *data_xfer_mode/*out*/); #endif HDF5API herr_t H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref); diff --git a/src/H5RApublic.h b/src/H5RApublic.h index c246743..67ee710 100644 --- a/src/H5RApublic.h +++ b/src/H5RApublic.h @@ -14,13 +14,14 @@ extern "C" { #endif -HDF5API hid_t H5RAcreate(hid_t loc_id, const char *name, hid_t type_id, hid_t plist_id); +HDF5API hid_t H5RAcreate(hid_t loc_id, const char *name, hid_t type_id, + hid_t plist_id); HDF5API hid_t H5RAopen(hid_t loc_id, const char *name); HDF5API herr_t H5RAclose(hid_t array_id); HDF5API herr_t H5RAwrite(hid_t array_id, hssize_t start_row, hsize_t nrows, - hid_t type_id, hsize_t size[], void *buf[]); + hid_t type_id, hsize_t size[], void *buf[]); HDF5API herr_t H5RAread(hid_t array_id, hssize_t start_row, hsize_t nrows, - hid_t type_id, hsize_t size[], void *buf[]); + hid_t type_id, hsize_t size[], void *buf[]); #ifdef __cplusplus } diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h index 8a78e85..5e349a8 100644 --- a/src/H5Rpublic.h +++ b/src/H5Rpublic.h @@ -67,7 +67,7 @@ extern "C" { /* Functions in H5R.c */ HDF5API herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, - H5R_type_t ref_type, hid_t space_id); + H5R_type_t ref_type, hid_t space_id); HDF5API hid_t H5Rdereference(hid_t dataset, H5R_type_t ref_type, void *ref); HDF5API hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, void *ref); diff --git a/src/H5Spublic.h b/src/H5Spublic.h index ed25015..8beef9b 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -54,23 +54,27 @@ extern "C" { /* Functions in H5S.c */ HDF5API hid_t H5Screate(H5S_class_t type); HDF5API hid_t H5Screate_simple (int rank, const hsize_t dims[], - const hsize_t maxdims[]); -HDF5API herr_t H5Sset_extent_simple (hid_t space_id, int rank, const hsize_t dims[], - const hsize_t max[]); + const hsize_t maxdims[]); +HDF5API herr_t H5Sset_extent_simple (hid_t space_id, int rank, + const hsize_t dims[], + const hsize_t max[]); HDF5API hid_t H5Scopy (hid_t space_id); HDF5API herr_t H5Sclose (hid_t space_id); HDF5API hsize_t H5Sget_simple_extent_npoints (hid_t space_id); HDF5API int H5Sget_simple_extent_ndims (hid_t space_id); HDF5API int H5Sget_simple_extent_dims (hid_t space_id, hsize_t dims[], - hsize_t maxdims[]); + hsize_t maxdims[]); HDF5API htri_t H5Sis_simple (hid_t space_id); HDF5API herr_t H5Sset_space (hid_t space_id, int rank, const hsize_t *dims); HDF5API hssize_t H5Sget_select_npoints (hid_t spaceid); HDF5API herr_t H5Sselect_hyperslab (hid_t space_id, H5S_seloper_t op, - const hssize_t start[], const hsize_t _stride[], - const hsize_t count[], const hsize_t _block[]); -HDF5API herr_t H5Sselect_elements (hid_t space_id, H5S_seloper_t op, size_t num_elemn, - const hssize_t **coord); + const hssize_t start[], + const hsize_t _stride[], + const hsize_t count[], + const hsize_t _block[]); +HDF5API herr_t H5Sselect_elements (hid_t space_id, H5S_seloper_t op, + size_t num_elemn, + const hssize_t **coord); HDF5API H5S_class_t H5Sget_simple_extent_type (hid_t space_id); HDF5API herr_t H5Sset_extent_none (hid_t space_id); HDF5API herr_t H5Sextent_copy (hid_t dst_id,hid_t src_id); diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 071a9e4..462da57 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -366,12 +366,13 @@ herr_t H5T_conv_i32le_f64le (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /* Bit twiddling functions */ HDF5API void H5T_bit_copy (uint8_t *dst, size_t dst_offset, const uint8_t *src, - size_t src_offset, size_t size); -HDF5API void H5T_bit_set (uint8_t *buf, size_t offset, size_t size, hbool_t value); + size_t src_offset, size_t size); +HDF5API void H5T_bit_set (uint8_t *buf, size_t offset, size_t size, + hbool_t value); HDF5API hsize_t H5T_bit_get_d (uint8_t *buf, size_t offset, size_t size); void H5T_bit_set_d (uint8_t *buf, size_t offset, size_t size, hsize_t val); HDF5API ssize_t H5T_bit_find (uint8_t *buf, size_t offset, size_t size, - H5T_sdir_t direction, hbool_t value); + H5T_sdir_t direction, hbool_t value); htri_t H5T_bit_inc(uint8_t *buf, size_t start, size_t size); #endif diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index c6ebf1e..e6a84c4 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -395,16 +395,18 @@ HDF5API htri_t H5Tcommitted (hid_t type_id); /* Operations defined on compound data types */ HDF5API herr_t H5Tinsert (hid_t parent_id, const char *name, size_t offset, hid_t member_id); -HDF5API herr_t H5Tinsert_array (hid_t parent_id, const char *name, size_t offset, - int ndims, const size_t dim[], const int *perm, - hid_t member_id); +HDF5API herr_t H5Tinsert_array (hid_t parent_id, const char *name, + size_t offset, int ndims, const size_t dim[], + const int *perm, hid_t member_id); HDF5API herr_t H5Tpack (hid_t type_id); /* Operations defined on enumeration data types */ HDF5API hid_t H5Tenum_create(hid_t base_id); HDF5API herr_t H5Tenum_insert(hid_t type, const char *name, void *value); -HDF5API hid_t H5Tenum_nameof(hid_t type, void *value, char *name/*out*/, size_t size); -HDF5API hid_t H5Tenum_valueof(hid_t type, const char *name, void *value/*out*/); +HDF5API hid_t H5Tenum_nameof(hid_t type, void *value, char *name/*out*/, + size_t size); +HDF5API hid_t H5Tenum_valueof(hid_t type, const char *name, + void *value/*out*/); /* Querying property values */ HDF5API hid_t H5Tget_super(hid_t type); @@ -414,11 +416,11 @@ HDF5API H5T_order_t H5Tget_order(hid_t type_id); HDF5API size_t H5Tget_precision(hid_t type_id); HDF5API size_t H5Tget_offset(hid_t type_id); HDF5API herr_t H5Tget_pad(hid_t type_id, H5T_pad_t *lsb/*out*/, - H5T_pad_t *msb/*out*/); + H5T_pad_t *msb/*out*/); HDF5API H5T_sign_t H5Tget_sign(hid_t type_id); HDF5API herr_t H5Tget_fields(hid_t type_id, size_t *spos/*out*/, - size_t *epos/*out*/, size_t *esize/*out*/, - size_t *mpos/*out*/, size_t *msize/*out*/); + size_t *epos/*out*/, size_t *esize/*out*/, + size_t *mpos/*out*/, size_t *msize/*out*/); HDF5API size_t H5Tget_ebias(hid_t type_id); HDF5API H5T_norm_t H5Tget_norm(hid_t type_id); HDF5API H5T_pad_t H5Tget_inpad(hid_t type_id); @@ -427,9 +429,10 @@ HDF5API int H5Tget_nmembers(hid_t type_id); HDF5API char *H5Tget_member_name(hid_t type_id, int membno); HDF5API size_t H5Tget_member_offset(hid_t type_id, int membno); HDF5API int H5Tget_member_dims(hid_t type_id, int membno, size_t dims[]/*out*/, - int perm[]/*out*/); + int perm[]/*out*/); HDF5API hid_t H5Tget_member_type(hid_t type_id, int membno); -HDF5API herr_t H5Tget_member_value(hid_t type_id, int membno, void *value/*out*/); +HDF5API herr_t H5Tget_member_value(hid_t type_id, int membno, + void *value/*out*/); HDF5API H5T_cset_t H5Tget_cset(hid_t type_id); /* Setting property values */ @@ -439,8 +442,8 @@ HDF5API herr_t H5Tset_precision (hid_t type_id, size_t prec); HDF5API herr_t H5Tset_offset (hid_t type_id, size_t offset); HDF5API herr_t H5Tset_pad (hid_t type_id, H5T_pad_t lsb, H5T_pad_t msb); HDF5API herr_t H5Tset_sign (hid_t type_id, H5T_sign_t sign); -HDF5API herr_t H5Tset_fields (hid_t type_id, size_t spos, size_t epos, size_t esize, - size_t mpos, size_t msize); +HDF5API herr_t H5Tset_fields (hid_t type_id, size_t spos, size_t epos, + size_t esize, size_t mpos, size_t msize); HDF5API herr_t H5Tset_ebias (hid_t type_id, size_t ebias); HDF5API herr_t H5Tset_norm (hid_t type_id, H5T_norm_t norm); HDF5API herr_t H5Tset_inpad (hid_t type_id, H5T_pad_t pad); @@ -449,12 +452,12 @@ HDF5API herr_t H5Tset_strpad (hid_t type_id, H5T_str_t strpad); /* Type conversion database */ HDF5API herr_t H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, - hid_t dst_id, H5T_conv_t func); + hid_t dst_id, H5T_conv_t func); HDF5API herr_t H5Tunregister (H5T_pers_t pers, const char *name, hid_t src_id, - hid_t dst_id, H5T_conv_t func); + hid_t dst_id, H5T_conv_t func); HDF5API H5T_conv_t H5Tfind (hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata); -HDF5API herr_t H5Tconvert (hid_t src_id, hid_t dst_id, size_t nelmts, void *buf, - void *background); +HDF5API herr_t H5Tconvert (hid_t src_id, hid_t dst_id, size_t nelmts, + void *buf, void *background); HDF5API H5T_overflow_t H5Tget_overflow(void); HDF5API herr_t H5Tset_overflow(H5T_overflow_t func); diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h index 4e0ae3d..31178dd 100644 --- a/src/H5Vprivate.h +++ b/src/H5Vprivate.h @@ -9,7 +9,7 @@ #define H5Vprivate_H #include <H5private.h> -#include <H5api_adpt.h> + /* Vector comparison functions like Fortran66 comparison operators */ #define H5V_vector_eq_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)==0) #define H5V_vector_lt_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)<0) @@ -41,19 +41,21 @@ htri_t H5V_hyper_disjointp(intn n, const hssize_t *offset1, const hsize_t *size1, const hssize_t *offset2, const hsize_t *size2); htri_t H5V_hyper_eq(intn n, const hssize_t *offset1, const hsize_t *size1, - const hssize_t *offset2, const hsize_t *size2); -HDF5API herr_t H5V_hyper_fill(intn n, const hsize_t *_size, const hsize_t *total_size, - const hssize_t *offset, void *_dst, uintn fill_value); + const hssize_t *offset2, const hsize_t *size2); +HDF5API herr_t H5V_hyper_fill(intn n, const hsize_t *_size, + const hsize_t *total_size, + const hssize_t *offset, void *_dst, + uintn fill_value); HDF5API herr_t H5V_hyper_copy(intn n, const hsize_t *size, - const hsize_t *dst_total_size, - const hssize_t *dst_offset, void *_dst, - const hsize_t *src_total_size, - const hssize_t *src_offset, const void *_src); + const hsize_t *dst_total_size, + const hssize_t *dst_offset, void *_dst, + const hsize_t *src_total_size, + const hssize_t *src_offset, const void *_src); herr_t H5V_stride_fill(intn n, hsize_t elmt_size, const hsize_t *size, const hssize_t *stride, void *_dst, uintn fill_value); HDF5API herr_t H5V_stride_copy(intn n, hsize_t elmt_size, const hsize_t *_size, - const hssize_t *dst_stride, void *_dst, - const hssize_t *src_stride, const void *_src); + const hssize_t *dst_stride, void *_dst, + const hssize_t *src_stride, const void *_src); herr_t H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size, intn dst_n, const hsize_t *dst_size, const hssize_t *dst_stride, void *_dst, intn src_n, const hsize_t *src_size, diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h index deba4dc..89536d4 100644 --- a/src/H5Zpublic.h +++ b/src/H5Zpublic.h @@ -52,7 +52,8 @@ typedef size_t (*H5Z_func_t)(unsigned int flags, size_t cd_nelmts, extern "C" { #endif -HDF5API herr_t H5Zregister(H5Z_filter_t id, const char *comment, H5Z_func_t filter); +HDF5API herr_t H5Zregister(H5Z_filter_t id, const char *comment, + H5Z_func_t filter); #ifdef __cplusplus } diff --git a/src/H5api_adpt.h b/src/H5api_adpt.h index 0dc077a..603b9b5 100644 --- a/src/H5api_adpt.h +++ b/src/H5api_adpt.h @@ -22,4 +22,4 @@ #define HDF5GLOBAL extern #endif -#endif /* H5API_ADPT_H */
\ No newline at end of file +#endif /* H5API_ADPT_H */ diff --git a/src/H5private.h b/src/H5private.h index e44d6f8..61d6bbb 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -13,7 +13,7 @@ #ifndef _H5private_H #define _H5private_H #include <H5public.h> /* Include Public Definitions */ -#include <H5api_adpt.h> + /* * Include ANSI-C header files. */ @@ -404,7 +404,8 @@ typedef struct { HDF5API void H5_timer_reset (H5_timer_t *timer); HDF5API void H5_timer_begin (H5_timer_t *timer); -HDF5API void H5_timer_end (H5_timer_t *sum/*in,out*/, H5_timer_t *timer/*in,out*/); +HDF5API void H5_timer_end (H5_timer_t *sum/*in,out*/, + H5_timer_t *timer/*in,out*/); HDF5API void H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds); /* diff --git a/src/H5public.h b/src/H5public.h index 71d8651..8bf1b5c 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -35,6 +35,7 @@ static char RcsId[] = "@(#)$Revision$"; # include <mpio.h> #endif #include <H5api_adpt.h> + /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 1 /* For minor interface/format changes */ @@ -101,8 +102,10 @@ extern "C" { HDF5API herr_t H5open (void); HDF5API herr_t H5close (void); HDF5API herr_t H5dont_atexit (void); -HDF5API herr_t H5get_libversion (unsigned *majnum, unsigned *minnum, unsigned *relnum); -HDF5API herr_t H5check_version (unsigned majnum, unsigned minnum, unsigned relnum); +HDF5API herr_t H5get_libversion (unsigned *majnum, unsigned *minnum, + unsigned *relnum); +HDF5API herr_t H5check_version (unsigned majnum, unsigned minnum, + unsigned relnum); #ifdef __cplusplus } diff --git a/src/Makefile.in b/src/Makefile.in index d5c152e..ca2a302 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -33,7 +33,7 @@ PUB_HDR=H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5Dpublic.h \ H5Epublic.h H5Fpublic.h H5Gpublic.h H5HGpublic.h H5HLpublic.h \ H5Ipublic.h H5MFpublic.h H5MMpublic.h H5Opublic.h H5Ppublic.h \ H5Rpublic.h H5RApublic.h H5Spublic.h H5Tpublic.h H5Zpublic.h H5config.h \ - hdf5.h + hdf5.h H5api_adpt.h # Other header files (not to be installed)... PRIVATE_HDR=H5private.h H5Aprivate.h H5Apkg.h H5ACprivate.h H5Bprivate.h \ diff --git a/test/.distdep b/test/.distdep index 6645e72..9ef14ad 100644 --- a/test/.distdep +++ b/test/.distdep @@ -172,36 +172,6 @@ dsets.o: \ ../src/H5HGprivate.h \ ../src/H5Fprivate.h \ ../src/H5Rprivate.h -dtypes.o: \ - dtypes.c \ - h5test.h \ - ../src/hdf5.h \ - ../src/H5public.h \ - ../src/H5config.h \ - ../src/H5Ipublic.h \ - ../src/H5Apublic.h \ - ../src/H5ACpublic.h \ - ../src/H5Bpublic.h \ - ../src/H5Dpublic.h \ - ../src/H5Epublic.h \ - ../src/H5Fpublic.h \ - ../src/H5Gpublic.h \ - ../src/H5HGpublic.h \ - ../src/H5HLpublic.h \ - ../src/H5MFpublic.h \ - ../src/H5MMpublic.h \ - ../src/H5Opublic.h \ - ../src/H5Ppublic.h \ - ../src/H5Zpublic.h \ - ../src/H5Rpublic.h \ - ../src/H5RApublic.h \ - ../src/H5Spublic.h \ - ../src/H5Tpublic.h \ - ../src/H5private.h \ - ../src/H5Tpkg.h \ - ../src/H5HGprivate.h \ - ../src/H5Fprivate.h \ - ../src/H5Rprivate.h extend.o: \ extend.c \ h5test.h \ @@ -883,3 +853,34 @@ enum.o: \ ../src/H5HGprivate.h \ ../src/H5Fprivate.h \ ../src/H5Rprivate.h +dtypes.o: \ + dtypes.c \ + h5test.h \ + ../src/hdf5.h \ + ../src/H5public.h \ + ../src/H5config.h \ + ../src/H5api_adpt.h \ + ../src/H5Ipublic.h \ + ../src/H5Apublic.h \ + ../src/H5ACpublic.h \ + ../src/H5Bpublic.h \ + ../src/H5Dpublic.h \ + ../src/H5Epublic.h \ + ../src/H5Fpublic.h \ + ../src/H5Gpublic.h \ + ../src/H5HGpublic.h \ + ../src/H5HLpublic.h \ + ../src/H5MFpublic.h \ + ../src/H5MMpublic.h \ + ../src/H5Opublic.h \ + ../src/H5Ppublic.h \ + ../src/H5Zpublic.h \ + ../src/H5Rpublic.h \ + ../src/H5RApublic.h \ + ../src/H5Spublic.h \ + ../src/H5Tpublic.h \ + ../src/H5private.h \ + ../src/H5Tpkg.h \ + ../src/H5HGprivate.h \ + ../src/H5Fprivate.h \ + ../src/H5Rprivate.h diff --git a/test/dtypes.c b/test/dtypes.c index 108fcb2..22ebe2a 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -549,6 +549,8 @@ test_named (hid_t fapl) hid_t file=-1, type=-1, space=-1, dset=-1, t2=-1, attr1=-1; herr_t status; static hsize_t ds_size[2] = {10, 20}; + hsize_t i; + unsigned attr_data[10][20]; char filename[1024]; TESTING("named data types"); @@ -600,8 +602,10 @@ test_named (hid_t fapl) } /* It should be possible to define an attribute for the named type */ - if ((attr1=H5Acreate (type, "attr1", H5T_NATIVE_INT, space, + if ((attr1=H5Acreate (type, "attr1", H5T_NATIVE_UCHAR, space, H5P_DEFAULT))<0) goto error; + for (i=0; i<ds_size[0]*ds_size[1]; i++) attr_data[0][i] = i;/*tricky*/ + if (H5Awrite(attr1, H5T_NATIVE_UINT, attr_data)<0) goto error; if (H5Aclose (attr1)<0) goto error; /* diff --git a/tools/h5ls.c b/tools/h5ls.c index 918712c..9a386f0 100644 --- a/tools/h5ls.c +++ b/tools/h5ls.c @@ -10,7 +10,7 @@ /* * We include the private header file so we can get to the uniform * programming environment it declares. Other than that, h5ls only calls - * HDF5 API functions. + * HDF5 API functions (except for H5G_basename()) */ #include <H5private.h> #include <h5tools.h> @@ -21,6 +21,23 @@ static int width_g = 80; /*output width in characters */ static hbool_t dump_g = FALSE; /*display dataset values? */ static hbool_t label_g = FALSE; /*label compound values? */ static hbool_t string_g = FALSE; /*print 1-byte numbers as ASCII? */ +static hbool_t fullname_g = FALSE; /*print full path names */ +static hbool_t recursive_g = FALSE; /*recursive descent listing */ + +/* Info to pass to the iteration functions */ +typedef struct iter_t { + const char *container; /*full name of the container object */ +} iter_t; + +/* Table containing object id and object name */ +static struct { + int nalloc; /*number of slots allocated */ + int nobjs; /*number of objects */ + struct { + unsigned long id[2]; /*object number */ + char *name; /*full object name */ + } *obj; +} idtab_g; /* Information about how to display each type of object */ static struct dispatch_t { @@ -28,7 +45,7 @@ static struct dispatch_t { hid_t (*open)(hid_t loc, const char *name); herr_t (*close)(hid_t obj); herr_t (*list1)(hid_t obj); - herr_t (*list2)(hid_t obj); + herr_t (*list2)(hid_t obj, const char *name); } dispatch_g[H5G_NTYPES]; #define DISPATCH(TYPE,NAME,OPEN,CLOSE,LIST1,LIST2) { \ @@ -41,6 +58,7 @@ static struct dispatch_t { static herr_t list (hid_t group, const char *name, void *cd); static void display_type(hid_t type, int indent); +static char *fix_name(const char *path, const char *base); /*------------------------------------------------------------------------- @@ -65,7 +83,9 @@ usage: %s [OPTIONS] FILE [OBJECTS...]\n\ OPTIONS\n\ -h, -?, --help Print a usage message and exit\n\ -d, --dump Print the values of datasets\n\ + -f, --full Print full path names instead of base names\n\ -l, --label Label members of compound datasets\n\ + -r, --recursive List all groups recursively, avoiding cycles\n\ -s, --string Print 1-byte integer datasets as ASCII\n\ -wN, --width=N Set the number of columns of output\n\ -v, --verbose Generate more verbose output\n\ @@ -83,9 +103,84 @@ usage: %s [OPTIONS] FILE [OBJECTS...]\n\ /*------------------------------------------------------------------------- + * Function: sym_insert + * + * Purpose: Add a symbol to the table. + * + * Return: void + * + * Programmer: Robb Matzke + * Thursday, January 21, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +sym_insert(H5G_stat_t *sb, const char *name) +{ + int n; + + /* + * Don't add it if the link count is 1 because such an object can only + * have one name. + */ + if (sb->nlink<2) return; + + /* Extend the table */ + if (idtab_g.nobjs>=idtab_g.nalloc) { + idtab_g.nalloc = MAX(256, 2*idtab_g.nalloc); + idtab_g.obj = realloc(idtab_g.obj, + idtab_g.nalloc*sizeof(idtab_g.obj[0])); + } + + /* Insert the entry */ + n = idtab_g.nobjs++; + idtab_g.obj[n].id[0] = sb->objno[0]; + idtab_g.obj[n].id[1] = sb->objno[1]; + idtab_g.obj[n].name = malloc(strlen(name)+1); + strcpy(idtab_g.obj[n].name, name); +} + + +/*------------------------------------------------------------------------- + * Function: sym_lookup + * + * Purpose: Find another name for the specified object. + * + * Return: Success: Ptr to another name. + * + * Failure: NULL + * + * Programmer: Robb Matzke + * Thursday, January 21, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static char * +sym_lookup(H5G_stat_t *sb) +{ + int n; + + if (sb->nlink<2) return NULL; /*only one name possible*/ + for (n=0; n<idtab_g.nobjs; n++) { + if (idtab_g.obj[n].id[0]==sb->objno[0] && + idtab_g.obj[n].id[1]==sb->objno[1]) { + return idtab_g.obj[n].name; + } + } + return NULL; +} + + +/*------------------------------------------------------------------------- * Function: display_string * - * Purpose: Print a string value by escaping unusual characters. + * Purpose: Print a string value by escaping unusual characters. If + * STREAM is null then we only count how large the output would + * be. * * Return: Number of characters printed. * @@ -97,46 +192,57 @@ usage: %s [OPTIONS] FILE [OBJECTS...]\n\ *------------------------------------------------------------------------- */ static int -display_string(const char *s) +display_string(FILE *stream, const char *s, hbool_t escape_spaces) { int nprint=0; for (/*void*/; s && *s; s++) { switch (*s) { case '"': - printf("\\\""); + if (stream) fprintf(stream, "\\\""); nprint += 2; break; case '\\': - printf("\\\\"); + if (stream) fprintf(stream, "\\\\"); nprint += 2; break; case '\b': - printf("\\b"); + if (stream) fprintf(stream, "\\b"); nprint += 2; break; case '\f': - printf("\\f"); + if (stream) fprintf(stream, "\\f"); nprint += 2; break; case '\n': - printf("\\n"); + if (stream) fprintf(stream, "\\n"); nprint += 2; break; case '\r': - printf("\\r"); + if (stream) fprintf(stream, "\\r"); nprint += 2; break; case '\t': - printf("\\t"); + if (stream) fprintf(stream, "\\t"); nprint += 2; break; + case ' ': + if (escape_spaces) { + if (stream) fprintf(stream, "\\ "); + nprint += 2; + } else { + if (stream) fprintf(stream, " "); + nprint++; + } + break; default: if (isprint(*s)) { - putchar(*s); + if (stream) putc(*s, stream); nprint++; } else { - printf("\\%03o", *((const unsigned char*)s)); + if (stream) { + fprintf(stream, "\\%03o", *((const unsigned char*)s)); + } nprint += 4; } break; @@ -548,7 +654,7 @@ display_cmpd_type(hid_t type, int indent) /* Name and offset */ name = H5Tget_member_name(type, i); printf("\n%*s\"", indent+4, ""); - n = display_string(name); + n = display_string(stdout, name, FALSE); printf("\"%*s +%-4lu ", MAX(0, 16-n), "", (unsigned long)H5Tget_member_offset(type, i)); free(name); @@ -655,7 +761,7 @@ display_enum_type(hid_t type, int indent) /* Print members */ for (i=0; i<nmembs; i++) { printf("\n%*s", indent+4, ""); - nchars = display_string(name[i]); + nchars = display_string(stdout, name[i], TRUE); printf("%*s = ", MAX(0, 16-nchars), ""); if (native<0) { @@ -685,7 +791,7 @@ display_enum_type(hid_t type, int indent) /*------------------------------------------------------------------------- - * Function: display_string + * Function: display_string_type * * Purpose: Print information about a string data type. * @@ -895,7 +1001,7 @@ dump_dataset_values(hid_t dset) * Print all the values. */ printf(" Data:\n"); - if (h5dump(stdout, &info, dset, -1)<0) { + if (h5dump_dset(stdout, &info, dset, -1)<0) { printf(" Unable to print data.\n"); } @@ -922,24 +1028,65 @@ dump_dataset_values(hid_t dset) static herr_t list_attr (hid_t obj, const char *attr_name, void __unused__ *op_data) { - hid_t attr; - int i; - - printf(" %-10s %-10s", "Attribute:", attr_name); - if ((attr = H5Aopen_name (obj, attr_name))) { - hid_t space = H5Aget_space (attr); - hsize_t size[64]; - int ndims = H5Sget_simple_extent_dims (space, size, NULL); - H5Sclose (space); - printf (" {"); + hid_t attr, space, type, p_type; + hsize_t size[64], nelmts=1; + int ndims, i, n; + size_t need; + void *buf; + h5dump_t info; + + printf(" Attribute: "); + n = display_string(stdout, attr_name, TRUE); + printf("%*s", MAX(0, 10-n), ""); + if ((attr = H5Aopen_name(obj, attr_name))) { + space = H5Aget_space(attr); + type = H5Aget_type(attr); + + /* Data space */ + ndims = H5Sget_simple_extent_dims(space, size, NULL); + printf(" {"); for (i=0; i<ndims; i++) { - HDfprintf (stdout, "%s%Hu", i?", ":"", size[i]); + HDfprintf(stdout, "%s%Hu", i?", ":"", size[i]); + nelmts *= size[i]; + } + puts("}"); + + /* Data type */ + printf(" Type: "); + display_type(type, 15); + putchar('\n'); + + /* Data */ + memset(&info, 0, sizeof info); + info.idx_fmt = " (%s) "; + info.line_ncols = width_g; + if (label_g) info.cmpd_name = "%s="; + if (string_g && 1==H5Tget_size(type) && + H5T_INTEGER==H5Tget_class(type)) { + info.ascii = TRUE; + info.elmt_suf1 = ""; + info.elmt_suf2 = ""; + info.idx_fmt = " (%s) \""; + info.line_suf = "\""; + } + if ((p_type=h5dump_fixtype(type))>=0) { + need = nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)); + buf = malloc(need); + assert(buf); + if (H5Aread(attr, p_type, buf)>=0) { + h5dump_mem(stdout, &info, p_type, space, buf); + } + free(buf); + H5Tclose(p_type); } - putchar ('}'); - H5Aclose (attr); + + H5Sclose(space); + H5Tclose(type); + H5Aclose(attr); + } else { + putchar('\n'); } - putchar ('\n'); return 0; } @@ -1013,7 +1160,7 @@ dataset_list1(hid_t dset) *------------------------------------------------------------------------- */ static herr_t -dataset_list2(hid_t dset) +dataset_list2(hid_t dset, const char __unused__ *name) { hid_t dcpl; /*dataset creation property list*/ hid_t type; /*data type of dataset */ @@ -1031,6 +1178,7 @@ dataset_list2(hid_t dset) hsize_t total; /*total size or offset */ hsize_t chsize[64]; /*chunk size in elements */ int ndims; /*dimensionality */ + int n, max_len; /*max extern file name length */ int i; if (verbose_g>0) { @@ -1052,8 +1200,19 @@ dataset_list2(hid_t dset) /* Print information about external strorage */ if ((nf = H5Pget_external_count(dcpl))>0) { - printf(" %-10s %d external file%s (num/addr/offset/length)\n", + for (i=0, max_len=0; i<nf; i++) { + H5Pget_external(dcpl, i, sizeof(f_name), f_name, NULL, NULL); + n = display_string(NULL, f_name, TRUE); + max_len = MAX(max_len, n); + } + printf(" %-10s %d external file%s\n", "Extern:", nf, 1==nf?"":"s"); + printf(" %4s %10s %10s %10s %s\n", + "ID", "DSet-Addr", "File-Addr", "Bytes", "File"); + printf(" %4s %10s %10s %10s ", + "----", "----------", "----------", "----------"); + for (i=0; i<max_len; i++) putchar('-'); + putchar('\n'); for (i=0, total=0; i<nf; i++) { if (H5Pget_external(dcpl, i, sizeof(f_name), f_name, &f_offset, &f_size)<0) { @@ -1062,17 +1221,21 @@ dataset_list2(hid_t dset) i, total, "", "", i+1<nf?"Following addresses are incorrect":""); } else if (H5S_UNLIMITED==f_size) { - HDfprintf(stdout, " #%03d %10Hu %10Hu %10s \"", + HDfprintf(stdout, " #%03d %10Hu %10Hu %10s ", i, total, (hsize_t)f_offset, "INF"); - display_string(f_name); + display_string(stdout, f_name, TRUE); } else { - HDfprintf(stdout, " #%03d %10Hu %10Hu %10Hu \"", + HDfprintf(stdout, " #%03d %10Hu %10Hu %10Hu ", i, total, (hsize_t)f_offset, f_size); - display_string(f_name); + display_string(stdout, f_name, TRUE); } - printf("\"\n"); + putchar('\n'); total += f_size; } + printf(" %4s %10s %10s %10s ", + "----", "----------", "----------", "----------"); + for (i=0; i<max_len; i++) putchar('-'); + putchar('\n'); } /* Print information about raw data filters */ @@ -1111,6 +1274,36 @@ dataset_list2(hid_t dset) /*------------------------------------------------------------------------- + * Function: group_list2 + * + * Purpose: List information about a group which should appear after + * information which is general to all objects. + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Robb Matzke + * Thursday, January 21, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +group_list2(hid_t grp, const char *name) +{ + iter_t iter; + + if (recursive_g) { + iter.container = name; + H5Giterate(grp, ".", NULL, list, &iter); + } + return 0; +} + + +/*------------------------------------------------------------------------- * Function: datatype_list2 * * Purpose: List information about a data type which should appear after @@ -1128,7 +1321,7 @@ dataset_list2(hid_t dset) *------------------------------------------------------------------------- */ static herr_t -datatype_list2(hid_t type) +datatype_list2(hid_t type, const char __unused__ *name) { printf(" %-10s ", "Type:"); display_type(type, 15); @@ -1155,7 +1348,7 @@ datatype_list2(hid_t type) *------------------------------------------------------------------------- */ static herr_t -ragged_list2(hid_t __unused__ ra) +ragged_list2(hid_t __unused__ ra, const char __unused__ *name) { if (dump_g) { puts(" Data: Not implemented yet (see values of member"); @@ -1215,17 +1408,26 @@ link_open(hid_t location, const char *name) *------------------------------------------------------------------------- */ static herr_t -list (hid_t group, const char *name, void __unused__ *cd) +list (hid_t group, const char *name, void *_iter) { - hid_t obj; - char buf[512], comment[50]; + hid_t obj=-1; + char buf[512], comment[50], *fullname=NULL, *s=NULL; H5G_stat_t sb; struct tm *tm; herr_t status; + iter_t *iter = (iter_t*)_iter; + int n; - /* Print the object name */ - printf("%-25s ", name); - + /* Print the object name, either full name or base name */ + fullname = fix_name(iter->container, name); + if (fullname_g) { + n = display_string(stdout, fullname, TRUE); + printf("%*s", MAX(0, 25-n), ""); + } else { + n = display_string(stdout, name, TRUE); + printf("%*s", MAX(0, 25-n), ""); + } + /* Get object information */ H5E_BEGIN_TRY { status = H5Gget_objinfo(group, name, FALSE, &sb); @@ -1242,13 +1444,29 @@ list (hid_t group, const char *name, void __unused__ *cd) } /* + * If the object has already been printed then just show the object ID + * and return. + */ + if ((s=sym_lookup(&sb))) { + printf(", same as "); + display_string(stdout, s, TRUE); + printf("\n"); + goto done; + } else { + sym_insert(&sb, fullname); + } + + /* * Open the object. Not all objects can be opened. If this is the case * then return right away. */ if (sb.type>=0 && (NULL==dispatch_g[sb.type].open || - (obj=(dispatch_g[sb.type].open)(group, name))<0)) return 0; - + (obj=(dispatch_g[sb.type].open)(group, name))<0)) { + printf(" *ERROR*\n"); + goto done; + } + /* * List the first line of information for the object. */ @@ -1273,21 +1491,76 @@ list (hid_t group, const char *name, void __unused__ *cd) comment[0] = '\0'; H5Gget_comment(group, name, sizeof(comment), comment); strcpy(comment+sizeof(comment)-4, "..."); - if (comment[0]) printf(" %-10s %s\n", "Comment:", comment); + if (comment[0]) { + printf(" %-10s \"", "Comment:"); + display_string(stdout, comment, FALSE); + puts("\""); + } } if (sb.type>0 && dispatch_g[sb.type].list2) { - (dispatch_g[sb.type].list2)(obj); + (dispatch_g[sb.type].list2)(obj, fullname); } /* * Close the object. */ - if (sb.type>0) (dispatch_g[sb.type].close)(obj); + done: + if (sb.type>0 && obj>=0) (dispatch_g[sb.type].close)(obj); + if (fullname) free(fullname); return 0; } /*------------------------------------------------------------------------- + * Function: fix_name + * + * Purpose: Returns a malloc'd buffer that contains the PATH and BASE + * names separated by a single slash. It also removes duplicate + * and trailing slashes and insures that the name begins with a + * slash. + * + * Return: Success: Ptr to fixed name from malloc() + * + * Failure: NULL + * + * Programmer: Robb Matzke + * Thursday, January 21, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static char * +fix_name(const char *path, const char *base) +{ + size_t n = (path?strlen(path):0) + (base?strlen(base):0) + 3; + char *s = malloc(n), prev='\0'; + int len=0; + + if (path) { + /* Slash, followed by path, followed by slash */ + if ('/'!=*path) prev = s[len++] = '/'; + for (/*void*/; *path; path++) { + if ('/'!=*path || '/'!=prev) prev = s[len++] = *path; + } + if ('/'!=prev) prev = s[len++] = '/'; + } + + if (base) { + /* Base name w/o trailing slashes */ + const char *end = base + strlen(base); + while (end>base && '/'==end[-1]) --end; + for (/*void*/; base<end; base++) { + if ('/'!=*base || '/'!=prev) prev = s[len++] = *base; + } + } + + s[len] = '\0'; + return s; +} + + +/*------------------------------------------------------------------------- * Function: get_width * * Purpose: Figure out how wide the screen is. This is highly @@ -1395,14 +1668,15 @@ main (int argc, char *argv[]) const char *fname = NULL; const char *progname; const char *s; - char *rest; + char *rest, *container=NULL; int argno; H5G_stat_t sb; + iter_t iter; DISPATCH(H5G_DATASET, "Dataset", H5Dopen, H5Dclose, dataset_list1, dataset_list2); DISPATCH(H5G_GROUP, "Group", H5Gopen, H5Gclose, - NULL, NULL); + NULL, group_list2); DISPATCH(H5G_TYPE, "Type", H5Topen, H5Tclose, NULL, datatype_list2); DISPATCH(H5G_LINK, "-> ", link_open, NULL, @@ -1411,7 +1685,7 @@ main (int argc, char *argv[]) NULL, ragged_list2); /* Name of this program without the path */ - if ((progname=strrchr (argv[0], '/'))) progname++; + if ((progname=strrchr(argv[0], '/'))) progname++; else progname = argv[0]; /* Default output width */ @@ -1428,8 +1702,13 @@ main (int argc, char *argv[]) exit(0); } else if (!strcmp(argv[argno], "--dump")) { dump_g = TRUE; + } else if (!strcmp(argv[argno], "--full")) { + fullname_g = TRUE; } else if (!strcmp(argv[argno], "--label")) { label_g = TRUE; + } else if (!strcmp(argv[argno], "--recursive")) { + recursive_g = TRUE; + fullname_g = TRUE; } else if (!strcmp(argv[argno], "--string")) { string_g = TRUE; } else if (!strncmp(argv[argno], "--width=", 8)) { @@ -1469,9 +1748,16 @@ main (int argc, char *argv[]) case 'd': /* --dump */ dump_g++; break; + case 'f': /* --full */ + fullname_g = TRUE; + break; case 'l': /* --label */ label_g = TRUE; break; + case 'r': /* --recursive */ + recursive_g = TRUE; + fullname_g = TRUE; + break; case 's': /* --string */ string_g = TRUE; break; @@ -1504,27 +1790,42 @@ main (int argc, char *argv[]) usage(progname); exit(1); } - if (strchr (fname, '%')) { - plist = H5Pcreate (H5P_FILE_ACCESS); - H5Pset_family (plist, 0, H5P_DEFAULT); + if (strchr(fname, '%')) { + plist = H5Pcreate(H5P_FILE_ACCESS); + H5Pset_family(plist, 0, H5P_DEFAULT); } - if ((file = H5Fopen (fname, H5F_ACC_RDONLY, plist))<0) exit (1); + if ((file = H5Fopen(fname, H5F_ACC_RDONLY, plist))<0) exit (1); /* * The remaining optional arguments are the names of the objects to list. * If there are no arguments then list `/'. */ if (argno>=argc) { - H5Giterate(file, "/", NULL, list, NULL); + iter.container = "/"; + H5Giterate(file, "/", NULL, list, &iter); } else { for (/*void*/; argno<argc; argno++) { if (H5Gget_objinfo(file, argv[argno], TRUE, &sb)>=0 && + /* + * Specified name is a group. List the complete contents of + * the group. + */ H5G_GROUP==sb.type) { - H5Giterate(file, argv[argno], NULL, list, NULL); + iter.container = container = fix_name("", argv[argno]); + H5Giterate(file, argv[argno], NULL, list, &iter); + free(container); + } else if ((root=H5Gopen(file, "/"))<0) { - exit(1); + exit(1); /*major problem!*/ + } else { - list(root, argv[argno], NULL); + /* + * Specified name is a non-group object -- list that object. + * The container for the object is everything up to the base + * name. + */ + iter.container = "/"; + list(root, argv[argno], &iter); if (H5Gclose(root)<0) exit(1); } } diff --git a/tools/h5tools.c b/tools/h5tools.c index c1f889c..d69a280 100644 --- a/tools/h5tools.c +++ b/tools/h5tools.c @@ -331,10 +331,10 @@ h5dump_sprint(char *s/*out*/, const h5dump_t *info, hid_t type, void *vp) /*------------------------------------------------------------------------- - * Function: h5dump_simple + * Function: h5dump_simple_dset * * Purpose: Print some values from a dataset with a simple data space. - * This is a special case of h5dump(). + * This is a special case of h5dump_dset(). * * Return: Success: 0 * @@ -348,7 +348,8 @@ h5dump_sprint(char *s/*out*/, const h5dump_t *info, hid_t type, void *vp) *------------------------------------------------------------------------- */ static int -h5dump_simple(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type) +h5dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, + hid_t p_type) { hid_t f_space; /*file data space */ int ndims; /*dimensionality */ @@ -499,6 +500,104 @@ h5dump_simple(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type) /*------------------------------------------------------------------------- + * Function: h5dump_simple_mem + * + * Purpose: Print some values from memory with a simple data space. + * This is a special case of h5dump_mem(). + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Robb Matzke + * Thursday, July 23, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +h5dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t type, + hid_t space, void *_mem) +{ + unsigned char *mem = (unsigned char*)_mem; + int ndims; /*dimensionality */ + hsize_t i; /*counters */ + int need_prefix=1; /*indices need printing */ + + /* Print info */ + hsize_t p_min_idx[H5S_MAX_RANK];/*min selected index */ + hsize_t p_max_idx[H5S_MAX_RANK];/*max selected index */ + size_t p_type_nbytes; /*size of memory type */ + hsize_t p_nelmts; /*total selected elmts */ + char p_buf[8192]; /*output string */ + size_t p_column=0; /*output column */ + size_t p_ncolumns=80; /*default num columns */ + char p_prefix[1024]; /*line prefix string */ + + /* + * Check that everything looks okay. The dimensionality must not be too + * great and the dimensionality of the items selected for printing must + * match the dimensionality of the dataset. + */ + ndims = H5Sget_simple_extent_ndims(space); + if ((size_t)ndims>NELMTS(p_min_idx)) return -1; + + /* Assume entire data space to be printed */ + for (i=0; i<(hsize_t)ndims; i++) p_min_idx[i] = 0; + H5Sget_simple_extent_dims(space, p_max_idx, NULL); + for (i=0, p_nelmts=1; i<(hsize_t)ndims; i++) { + p_nelmts *= p_max_idx[i]-p_min_idx[i]; + } + if (0==p_nelmts) return 0; /*nothing to print*/ + p_type_nbytes = H5Tget_size(type); + + /* Local things */ + if (info->line_ncols>0) p_ncolumns = info->line_ncols; + + for (i=0; i<p_nelmts; i++) { + /* Render the element */ + h5dump_sprint(p_buf, info, type, mem+i*p_type_nbytes); + if (i+1<p_nelmts) { + strcat(p_buf, OPT(info->elmt_suf1, ",")); + } + + /* Print the prefix */ + if ((p_column + + strlen(p_buf) + + strlen(OPT(info->elmt_suf2, " ")) + + strlen(OPT(info->line_suf, ""))) > p_ncolumns) { + need_prefix = 1; + } + if (need_prefix) { + h5dump_prefix(p_prefix, info, i, ndims, p_min_idx, p_max_idx); + if (p_column) { + fputs(OPT(info->line_suf, ""), stream); + putc('\n', stream); + fputs(OPT(info->line_sep, ""), stream); + } + fputs(p_prefix, stream); + p_column = strlen(p_prefix); + need_prefix = 0; + } else { + fputs(OPT(info->elmt_suf2, " "), stream); + p_column += strlen(OPT(info->elmt_suf2, " ")); + } + + fputs(p_buf, stream); + p_column += strlen(p_buf); + } + + if (p_column) { + fputs(OPT(info->line_suf, ""), stream); + putc('\n', stream); + fputs(OPT(info->line_sep, ""), stream); + } + return 0; +} + + +/*------------------------------------------------------------------------- * Function: h5dump_fixtype * * Purpose: Given a file data type choose a memory data type which is @@ -515,7 +614,7 @@ h5dump_simple(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type) * *------------------------------------------------------------------------- */ -static hid_t +hid_t h5dump_fixtype(hid_t f_type) { hid_t m_type=-1, f_memb; @@ -652,7 +751,7 @@ h5dump_fixtype(hid_t f_type) /*------------------------------------------------------------------------- - * Function: h5dump + * Function: h5dump_dset * * Purpose: Print some values from a dataset DSET to the file STREAM * after converting all types to P_TYPE (which should be a @@ -671,7 +770,7 @@ h5dump_fixtype(hid_t f_type) *------------------------------------------------------------------------- */ int -h5dump(FILE *stream, const h5dump_t *info, hid_t dset, hid_t _p_type) +h5dump_dset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t _p_type) { hid_t f_space; hid_t p_type = _p_type; @@ -698,7 +797,44 @@ h5dump(FILE *stream, const h5dump_t *info, hid_t dset, hid_t _p_type) H5Sclose(f_space); /* Print the data */ - status = h5dump_simple(stream, info, dset, p_type); + status = h5dump_simple_dset(stream, info, dset, p_type); if (p_type!=_p_type) H5Tclose(p_type); return status; } + + +/*------------------------------------------------------------------------- + * Function: h5dump_mem + * + * Purpose: Displays the data contained in MEM. MEM must have the + * specified data TYPE and SPACE. Currently only simple data + * spaces are allowed and only the `all' selection. + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Robb Matzke + * Wednesday, January 20, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +int +h5dump_mem(FILE *stream, const h5dump_t *info, hid_t type, hid_t space, + void *mem) +{ + h5dump_t info_dflt; + + /* Use default values */ + if (!stream) stream = stdout; + if (!info) { + memset(&info_dflt, 0, sizeof info_dflt); + info = &info_dflt; + } + + /* Check the data space */ + if (H5Sis_simple(space)<=0) return -1; + return h5dump_simple_mem(stream, info, type, space, mem); +} diff --git a/tools/h5tools.h b/tools/h5tools.h index 54017aa..8b5cbfe 100644 --- a/tools/h5tools.h +++ b/tools/h5tools.h @@ -122,6 +122,9 @@ typedef struct h5dump_t { } h5dump_t; -int h5dump(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type); +hid_t h5dump_fixtype(hid_t f_type); +int h5dump_dset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type); +int h5dump_mem(FILE *stream, const h5dump_t *info, hid_t type, hid_t space, + void *mem); #endif |