From fb762aa6b01d50f18534f447459e0b3557d9fea6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 17 Feb 2012 16:41:58 -0500 Subject: [svn-r21953] HDDFV-7560: h5dump refactoring Tested: local linux --- MANIFEST | 8 + tools/h5dump/CMakeLists.txt | 6 +- tools/h5dump/h5dump.c | 7562 ++++-------------------------- tools/h5dump/h5dump.h | 217 +- tools/h5dump/h5dump_ddl.c | 1931 ++++++++ tools/h5dump/h5dump_ddl.h | 50 + tools/h5dump/h5dump_defines.h | 54 + tools/h5dump/h5dump_extern.h | 112 + tools/h5dump/h5dump_xml.c | 4456 ++++++++++++++++++ tools/h5dump/h5dump_xml.h | 128 + tools/h5ls/h5ls.c | 1540 +++++- tools/lib/CMakeLists.txt | 2 + tools/lib/Makefile.am | 2 +- tools/lib/h5tools.c | 2726 +---------- tools/lib/h5tools.h | 89 +- tools/lib/h5tools_dump.c | 3920 ++++++++++++++++ tools/lib/h5tools_dump.h | 85 + tools/lib/h5tools_str.c | 97 +- tools/lib/h5tools_utils.c | 5 +- tools/lib/h5tools_utils.h | 32 +- tools/lib/ph5diff.h | 6 + tools/testfiles/file_space.ddl | 6 +- tools/testfiles/filter_fail.ddl | 2 +- tools/testfiles/tall-2A.h5.xml | 91 +- tools/testfiles/tall-2B.ddl | 4 +- tools/testfiles/tall.h5.xml | 251 +- tools/testfiles/tallfilters.ddl | 4 +- tools/testfiles/tarray1.h5.xml | 9 +- tools/testfiles/tarray2.h5.xml | 56 +- tools/testfiles/tarray3.h5.xml | 116 +- tools/testfiles/tarray6.h5.xml | 12 +- tools/testfiles/tarray7.h5.xml | 36 +- tools/testfiles/tattr-1.ddl | 10 +- tools/testfiles/tattr-2.ddl | 10 +- tools/testfiles/tattr-3.ddl | 4 +- tools/testfiles/tattr-4_be.ddl | 90 +- tools/testfiles/tattr.h5.xml | 48 +- tools/testfiles/tattr2.ls | 447 +- tools/testfiles/tattrregR.ddl | 2 +- tools/testfiles/tattrreg_le.ls | 1 + tools/testfiles/tbitfields.h5.xml | 61 +- tools/testfiles/tboot1.ddl | 6 +- tools/testfiles/tboot2.ddl | 6 +- tools/testfiles/tchar1.ddl | 10 +- tools/testfiles/tchunked.ddl | 4 +- tools/testfiles/tcompact.ddl | 2 +- tools/testfiles/tcompound.h5.xml | 152 +- tools/testfiles/tcompound2.h5.xml | 36 +- tools/testfiles/tcompound_complex.h5.xml | 46 +- tools/testfiles/tcontiguos.ddl | 2 +- tools/testfiles/tdatareg.h5.xml | 118 +- tools/testfiles/tdataregR.ddl | 2 +- tools/testfiles/tdeflate.ddl | 4 +- tools/testfiles/tdset.h5.xml | 898 +++- tools/testfiles/tdset2.h5.xml | 544 ++- tools/testfiles/tempty-dtd-2.h5.xml | 45 +- tools/testfiles/tempty-dtd-uri.h5.xml | 45 +- tools/testfiles/tempty-dtd.h5.xml | 45 +- tools/testfiles/tempty-nons-2.h5.xml | 45 +- tools/testfiles/tempty-nons-uri.h5.xml | 45 +- tools/testfiles/tempty-nons.h5.xml | 45 +- tools/testfiles/tempty-ns-2.h5.xml | 45 +- tools/testfiles/tempty-ns.h5.xml | 45 +- tools/testfiles/tempty.h5.xml | 45 +- tools/testfiles/tenum.h5.xml | 28 +- tools/testfiles/texternal.ddl | 2 +- tools/testfiles/textlinkfar.ddl | 1 - tools/testfiles/textlinksrc.ddl | 1 - tools/testfiles/tfill.ddl | 18 +- tools/testfiles/tfletcher32.ddl | 4 +- tools/testfiles/tfpformat.ddl | 14 +- tools/testfiles/tfpformat.h5.xml | 22 +- tools/testfiles/thlink.h5.xml | 14 +- tools/testfiles/tloop.h5.xml | 4 +- tools/testfiles/tloop2.h5.xml | 2 +- tools/testfiles/tmany.h5.xml | 396 +- tools/testfiles/tname-amp.h5.xml | 125 +- tools/testfiles/tname-apos.h5.xml | 125 +- tools/testfiles/tname-gt.h5.xml | 125 +- tools/testfiles/tname-lt.h5.xml | 125 +- tools/testfiles/tname-quot.h5.xml | 125 +- tools/testfiles/tname-sp.h5.xml | 125 +- tools/testfiles/tnamed_dtype_attr.ddl | 2 - tools/testfiles/tnamed_dtype_attr.h5.xml | 4 +- tools/testfiles/tnbit.ddl | 4 +- tools/testfiles/tnestedcomp.h5.xml | 19 +- tools/testfiles/tnodata.h5.xml | 10 +- tools/testfiles/tobjref.h5.xml | 22 +- tools/testfiles/topaque.h5.xml | 4 +- tools/testfiles/torderattr1.ddl | 2 - tools/testfiles/torderattr1.h5.xml | 8 +- tools/testfiles/torderattr2.ddl | 2 - tools/testfiles/torderattr2.h5.xml | 8 +- tools/testfiles/torderattr3.ddl | 2 - tools/testfiles/torderattr3.h5.xml | 8 +- tools/testfiles/torderattr4.ddl | 2 - tools/testfiles/torderattr4.h5.xml | 8 +- tools/testfiles/tref-escapes-at.h5.xml | 137 +- tools/testfiles/tref-escapes.h5.xml | 67 +- tools/testfiles/tref.h5.xml | 22 +- tools/testfiles/treference.ddl | 276 +- tools/testfiles/tsaf.h5.xml | 6735 ++++++++++++++++++++++++-- tools/testfiles/tscaleoffset.ddl | 4 +- tools/testfiles/tshuffle.ddl | 4 +- tools/testfiles/tsplit_file.ddl | 10 +- tools/testfiles/tstr-1.ddl | 40 +- tools/testfiles/tstr-2.ddl | 70 +- tools/testfiles/tstr.h5.xml | 218 +- tools/testfiles/tstr2.h5.xml | 24 +- tools/testfiles/tstring-at.h5.xml | 4 +- tools/testfiles/tstring.ddl | 20 +- tools/testfiles/tstring.h5.xml | 4 +- tools/testfiles/tstring2.ddl | 4 +- tools/testfiles/tstringe.ddl | 20 +- tools/testfiles/tszip.ddl | 4 +- tools/testfiles/tuserfilter.ddl | 17 +- tools/testfiles/tvldtypes1.h5.xml | 22 +- tools/testfiles/tvldtypes2.h5.xml | 8 +- tools/testfiles/tvldtypes3.h5.xml | 9 +- tools/testfiles/tvldtypes4.h5.xml | 14 +- tools/testfiles/tvldtypes5.h5.xml | 15 +- tools/testfiles/tvlstr.ddl | 21 +- tools/testfiles/tvlstr.h5.xml | 10 +- 123 files changed, 23689 insertions(+), 11974 deletions(-) create mode 100644 tools/h5dump/h5dump_ddl.c create mode 100644 tools/h5dump/h5dump_ddl.h create mode 100644 tools/h5dump/h5dump_defines.h create mode 100644 tools/h5dump/h5dump_extern.h create mode 100644 tools/h5dump/h5dump_xml.c create mode 100644 tools/h5dump/h5dump_xml.h create mode 100644 tools/lib/h5tools_dump.c create mode 100644 tools/lib/h5tools_dump.h diff --git a/MANIFEST b/MANIFEST index 1bc50d3..b201902 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1107,6 +1107,12 @@ ./tools/h5dump/Makefile.in ./tools/h5dump/h5dump.c ./tools/h5dump/h5dump.h +./tools/h5dump/h5dump_defines.h +./tools/h5dump/h5dump_extern.h +./tools/h5dump/h5dump_ddl.c +./tools/h5dump/h5dump_ddl.h +./tools/h5dump/h5dump_xml.c +./tools/h5dump/h5dump_xml.h ./tools/h5dump/h5dumpgentest.c ./tools/h5dump/testh5dump.sh.in ./tools/h5dump/testh5dumpxml.sh.in @@ -1214,6 +1220,8 @@ ./tools/lib/h5trav.h ./tools/lib/h5tools.c ./tools/lib/h5tools.h +./tools/lib/h5tools_dump.c +./tools/lib/h5tools_dump.h ./tools/lib/h5tools_filters.c ./tools/lib/h5tools_str.c ./tools/lib/h5tools_str.h diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index 9bbdf1b..652fe83 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -10,7 +10,11 @@ INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- # Add the h5dump executables # -------------------------------------------------------------------- -ADD_EXECUTABLE (h5dump ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dump.c) +ADD_EXECUTABLE (h5dump + ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dump.c + ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dump_ddl.c + ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dump_xml.c +) TARGET_NAMING (h5dump ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5dump ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) SET_TARGET_PROPERTIES (h5dump PROPERTIES FOLDER tools) diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 61a9607..7421ddd 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -16,384 +16,46 @@ #include #include "h5dump.h" -#include "H5private.h" -#include "h5tools.h" -#include "h5tools_utils.h" -#include "h5tools_ref.h" -#include "h5trav.h" +#include "h5dump_ddl.h" +#include "h5dump_xml.h" /* Name of tool */ #define PROGRAMNAME "h5dump" -/* Macros for displaying objects */ -#define begin_obj(obj,name,begin) \ - do { \ - if (name) \ - HDfprintf(stdout, "%s \"%s\" %s\n", (obj), (name), (begin)); \ - else \ - HDfprintf(stdout, "%s %s\n", (obj), (begin)); \ - } while(0); - -#define end_obj(obj,end) \ - do { \ - if(HDstrlen(end)) { \ - HDfprintf(stdout, "%s", end); \ - if(HDstrlen(obj)) \ - HDfprintf(stdout, " "); \ - } \ - if(HDstrlen(obj)) \ - HDfprintf(stdout, "%s", obj); \ - HDfprintf(stdout, "\n"); \ - } while(0); - -/* 3 private values: can't be set, but can be read. - Note: these are defined in H5Zprivate, they are - duplicated here. - */ -#define H5_SZIP_LSB_OPTION_MASK 8 -#define H5_SZIP_MSB_OPTION_MASK 16 -#define H5_SZIP_RAW_OPTION_MASK 128 - -/* List of table structures. There is one table structure for each file */ -typedef struct h5dump_table_list_t { - size_t nalloc; - size_t nused; - struct { - unsigned long fileno; /* File number that these tables refer to */ - hid_t oid; /* ID of an object in this file, held open so fileno is consistent */ - table_t *group_table; /* Table of groups */ - table_t *dset_table; /* Table of datasets */ - table_t *type_table; /* Table of datatypes */ - } *tables; -} h5dump_table_list_t; - -static int unamedtype = 0; /* shared datatype with no name */ -static h5dump_table_list_t table_list = {0, 0, NULL}; -static table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL; -static hbool_t hit_elink = FALSE; /* whether we have traversed an external link */ -static size_t prefix_len = 1024; -static char *prefix = NULL; static const char *driver = NULL; /* The driver to open the file with. */ -static const h5dump_header_t *dump_header_format; -static const char *fp_format = NULL; const char *outfname=NULL; - - -/* things to display or which are set via command line parameters */ -static int display_all = TRUE; -static int display_oid = FALSE; -static int display_data = TRUE; -static int display_attr_data = TRUE; -static int display_char = FALSE; /*print 1-byte numbers as ASCII */ -static int usingdasho = FALSE; -static int display_bb = FALSE; /*superblock */ -static int display_dcpl = FALSE; /*dcpl */ -static int display_fi = FALSE; /*file index */ -static int display_ai = TRUE; /*array index */ -static int display_escape = FALSE; /*escape non printable characters */ -static int display_region = FALSE; /*print region reference data */ -static int enable_error_stack= FALSE; /* re-enable error stack */ -static int disable_compact_subset= FALSE; /* disable compact form of subset notation */ -static int display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/ - -/* sort parameters */ -static H5_index_t sort_by = H5_INDEX_NAME; /*sort_by [creation_order | name] */ -static H5_iter_order_t sort_order = H5_ITER_INC; /*sort_order [ascending | descending] */ - -#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */ -#define PACKED_BITS_SIZE_MAX 8*sizeof(long long) /* Maximum bits size of integer types of packed-bits */ -/* mask list for packed bits */ -static unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */ - -/* packed bits display parameters */ -static int packed_offset[PACKED_BITS_MAX]; -static int packed_length[PACKED_BITS_MAX]; - -/** - ** Added for XML ** - **/ +static int doxml = 0; +static int useschema = 1; +static const char *xml_dtd_uri = NULL; /* module-scoped variables for XML option */ #define DEFAULT_XSD "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd" #define DEFAULT_DTD "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.dtd" -static int doxml = 0; -static int useschema = 1; -static const char *xml_dtd_uri = NULL; -static const char *xmlnsprefix="hdf5:"; -static int indent; /*how far in to indent the line */ - -/** end XML **/ - -/* internal functions */ -static hid_t h5_fileaccess(void); -static void dump_oid(hid_t oid); -static void dump_packed_bits(unsigned int packed_index, hid_t type); -static void print_enum(hid_t type); -static int xml_name_to_XID(const char *, char *, int , int ); -static void init_prefix(char **prfx, size_t prfx_len); -static void add_prefix(char **prfx, size_t *prfx_len, const char *name); -/* callback function used by H5Literate() */ -static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void *op_data); -static int dump_extlink(hid_t group, const char *linkname, const char *objname); - - - -static h5tool_format_t dataformat = { - 0, /*raw */ - - "", /*fmt_raw */ - "%d", /*fmt_int */ - "%u", /*fmt_uint */ -#ifdef H5_VMS - "%hd", /*fmt_schar */ -#else - "%hhd", /*fmt_schar */ -#endif - "%u", /*fmt_uchar */ - "%d", /*fmt_short */ - "%u", /*fmt_ushort */ - "%ld", /*fmt_long */ - "%lu", /*fmt_ulong */ - NULL, /*fmt_llong */ - NULL, /*fmt_ullong */ - "%g", /*fmt_double */ - "%g", /*fmt_float */ - - 0, /*ascii */ - 0, /*str_locale */ - 0, /*str_repeat */ - - "[ ", /*arr_pre */ - ",", /*arr_sep */ - " ]", /*arr_suf */ - 1, /*arr_linebreak */ - - "", /*cmpd_name */ - ",\n", /*cmpd_sep */ - "{\n", /*cmpd_pre */ - "}", /*cmpd_suf */ - "\n", /*cmpd_end */ - - ", ", /*vlen_sep */ - "(", /*vlen_pre */ - ")", /*vlen_suf */ - "", /*vlen_end */ - - "%s", /*elmt_fmt */ - ",", /*elmt_suf1 */ - " ", /*elmt_suf2 */ - - "", /*idx_n_fmt */ - "", /*idx_sep */ - "", /*idx_fmt */ - - 80, /*line_ncols *//*standard default columns */ - 0, /*line_per_line */ - "", /*line_pre */ - "%s", /*line_1st */ - "%s", /*line_cont */ - "", /*line_suf */ - "", /*line_sep */ - 1, /*line_multi_new */ - " ", /*line_indent */ - - 1, /*skip_first */ - - 1, /*obj_hidefileno */ - " "H5_PRINTF_HADDR_FMT, /*obj_format */ - - 1, /*dset_hidefileno */ - "DATASET %s ", /*dset_format */ - "%s", /*dset_blockformat_pre */ - "%s", /*dset_ptformat_pre */ - "%s", /*dset_ptformat */ - 1, /*array indices */ - 1 /*escape non printable characters */ -}; - -/** - ** Added for XML ** - **/ -/* - * Alternative formating for data dumped to XML - * In general, the numbers are the same, but separators - * except spaces are not used. - * - * Some of these are not used, as some kinds of data are - * dumped in completely new subroutines. - * - * Some of this formatting may yet need to change. - * - * This table only affects XML output. - */ -static h5tool_format_t xml_dataformat = { - 0, /*raw */ - - "", /*fmt_raw */ - "%d", /*fmt_int */ - "%u", /*fmt_uint */ -#ifdef H5_VMS - "%hd", /*fmt_schar */ -#else - "%hhd", /*fmt_schar */ -#endif - "%u", /*fmt_uchar */ - "%d", /*fmt_short */ - "%u", /*fmt_ushort */ - "%ld", /*fmt_long */ - "%lu", /*fmt_ulong */ - NULL, /*fmt_llong */ - NULL, /*fmt_ullong */ - "%g", /*fmt_double */ - "%g", /*fmt_float */ - - 0, /*ascii */ - 0, /*str_locale */ - 0, /*str_repeat */ - - " ", /*arr_pre */ - "", /*arr_sep */ - "", /*arr_suf */ - 1, /*arr_linebreak */ - - "", /*cmpd_name */ - " ", /*cmpd_sep */ - "", /*cmpd_pre */ - "", /*cmpd_suf */ - "", /*cmpd_end */ - - " ", /*vlen_sep */ - " ", /*vlen_pre */ - "", /*vlen_suf */ - "", /*vlen_end */ - - "%s", /*elmt_fmt */ - "", /*elmt_suf1 */ - " ", /*elmt_suf2 */ - - "", /*idx_n_fmt */ - "", /*idx_sep */ - "", /*idx_fmt */ - - 80, /*line_ncols *//*standard default columns */ - 0, /*line_per_line */ - "", /*line_pre */ - "%s", /*line_1st */ - "%s", /*line_cont */ - "", /*line_suf */ - "", /*line_sep */ - 1, /*line_multi_new */ - " ", /*line_indent */ - - 1, /*skip_first */ - - 1, /*obj_hidefileno */ - " "H5_PRINTF_HADDR_FMT, /*obj_format */ - - 1, /*dset_hidefileno */ - "DATASET %s ", /*dset_format */ - "%s", /*dset_blockformat_pre */ - "%s", /*dset_ptformat_pre */ - "%s", /*dset_ptformat */ - 0, /*array indices */ - 0 /*escape non printable characters */ +/* Standard DDL output */ +static const dump_functions ddl_function_table = { + dump_group, + dump_named_datatype, + dump_dataset, + dump_dataspace, + dump_datatype, + dump_attr_cb, + dump_data }; -/** XML **/ - -static const h5dump_header_t standardformat = { - "standardformat", /*name */ - "HDF5", /*fileebgin */ - "", /*fileend */ - SUPER_BLOCK, /*bootblockbegin */ - "", /*bootblockend */ - H5_TOOLS_GROUP, /*groupbegin */ - "", /*groupend */ - H5_TOOLS_DATASET, /*datasetbegin */ - "", /*datasetend */ - ATTRIBUTE, /*attributebegin */ - "", /*attributeend */ - H5_TOOLS_DATATYPE, /*datatypebegin */ - "", /*datatypeend */ - DATASPACE, /*dataspacebegin */ - "", /*dataspaceend */ - DATA, /*databegin */ - "", /*dataend */ - SOFTLINK, /*softlinkbegin */ - "", /*softlinkend */ - EXTLINK, /*extlinkbegin */ - "", /*extlinkend */ - UDLINK, /*udlinkbegin */ - "", /*udlinkend */ - SUBSET, /*subsettingbegin */ - "", /*subsettingend */ - START, /*startbegin */ - "", /*startend */ - STRIDE, /*stridebegin */ - "", /*strideend */ - COUNT, /*countbegin */ - "", /*countend */ - BLOCK, /*blockbegin */ - "", /*blockend */ - - "{", /*fileblockbegin */ - "}", /*fileblockend */ - "{", /*bootblockblockbegin */ - "}", /*bootblockblockend */ - "{", /*groupblockbegin */ - "}", /*groupblockend */ - "{", /*datasetblockbegin */ - "}", /*datasetblockend */ - "{", /*attributeblockbegin */ - "}", /*attributeblockend */ - "", /*datatypeblockbegin */ - "", /*datatypeblockend */ - "", /*dataspaceblockbegin */ - "", /*dataspaceblockend */ - "{", /*datablockbegin */ - "}", /*datablockend */ - "{", /*softlinkblockbegin */ - "}", /*softlinkblockend */ - "{", /*extlinkblockbegin */ - "}", /*extlinkblockend */ - "{", /*udlinkblockbegin */ - "}", /*udlinkblockend */ - "{", /*strblockbegin */ - "}", /*strblockend */ - "{", /*enumblockbegin */ - "}", /*enumblockend */ - "{", /*structblockbegin */ - "}", /*structblockend */ - "{", /*vlenblockbegin */ - "}", /*vlenblockend */ - "{", /*subsettingblockbegin */ - "}", /*subsettingblockend */ - "(", /*startblockbegin */ - ");", /*startblockend */ - "(", /*strideblockbegin */ - ");", /*strideblockend */ - "(", /*countblockbegin */ - ");", /*countblockend */ - "(", /*blockblockbegin */ - ");", /*blockblockend */ - - "", /*dataspacedescriptionbegin */ - "", /*dataspacedescriptionend */ - "(", /*dataspacedimbegin */ - ")", /*dataspacedimend */ +/* XML output */ +static const dump_functions xml_function_table = { + xml_dump_group, + xml_dump_named_datatype, + xml_dump_dataset, + xml_dump_dataspace, + xml_dump_datatype, + xml_dump_attr, + xml_dump_data }; -/** - ** Added for XML ** - **/ -/* internal functions used by XML option */ -static void xml_print_datatype(hid_t, unsigned); -static void xml_print_enum(hid_t); -static int xml_print_refs(hid_t, int); -static int xml_print_strs(hid_t, int); -static char *xml_escape_the_string(const char *, int); -static char *xml_escape_the_name(const char *); +/* internal functions */ +static void init_prefix(char **prfx, size_t prfx_len); /* a structure for handling the order command-line parameters come in */ struct handler_t { @@ -528,90 +190,6 @@ static struct long_options l_opts[] = { { NULL, 0, '\0' } }; - -/** - ** Change for XML ** - ** - ** The 'dump_xxx' functions have two versions, standard and XML. - ** - ** They are called indirectly through the 'dump_function_table'. - ** e.g., dump_group(...) becomes dump_functions->dump_group(...); - ** - ** The standard functions are unchanged except for the way - ** they are called - **/ - -/* The dump functions of the dump_function_table */ - -/* standard format: no change */ -static void dump_group(hid_t, const char *); -static void dump_named_datatype(hid_t, const char *); -static void dump_dataset(hid_t, const char *, struct subset_t *); -static void dump_dataspace(hid_t space); -static void dump_datatype(hid_t type); -static void dump_data(hid_t, int, struct subset_t *, int); -static void dump_dcpl(hid_t dcpl, hid_t type_id, hid_t obj_id); -static void dump_comment(hid_t obj_id); -static void dump_fcpl(hid_t fid); -static void dump_fcontents(hid_t fid); -/* callback function used by H5Aiterate2() */ -static herr_t dump_attr_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, void *_op_data); - - -/* XML format: same interface, alternative output */ - -static void xml_dump_group(hid_t, const char *); -static void xml_dump_named_datatype(hid_t, const char *); -static void xml_dump_dataset(hid_t, const char *, struct subset_t *); -static void xml_dump_dataspace(hid_t space); -static void xml_dump_datatype(hid_t type); -static herr_t xml_dump_attr(hid_t, const char *, const H5A_info_t *, void *); -static void xml_dump_data(hid_t, int, struct subset_t *, int); - -/** - ** Added for XML ** - ** - ** This is the global dispatch table for the dump functions. - **/ -/* the table of dump functions */ -typedef struct dump_functions_t { - void (*dump_group_function) (hid_t, const char *); - void (*dump_named_datatype_function) (hid_t, const char *); - void (*dump_dataset_function) (hid_t, const char *, struct subset_t *); - void (*dump_dataspace_function) (hid_t); - void (*dump_datatype_function) (hid_t); - herr_t (*dump_attribute_function) (hid_t, const char *, const H5A_info_t *, void *); - void (*dump_data_function) (hid_t, int, struct subset_t *, int); -} dump_functions; - -/* Standard DDL output */ -static const dump_functions ddl_function_table = { - dump_group, - dump_named_datatype, - dump_dataset, - dump_dataspace, - dump_datatype, - dump_attr_cb, - dump_data -}; - -/* XML output */ -static const dump_functions xml_function_table = { - xml_dump_group, - xml_dump_named_datatype, - xml_dump_dataset, - xml_dump_dataspace, - xml_dump_datatype, - xml_dump_attr, - xml_dump_data -}; - -/* - * The global table is set to either ddl_function_table or - * xml_function_table in the initialization. - */ -static const dump_functions *dump_function_table; - /*------------------------------------------------------------------------- * Function: leave @@ -768,7 +346,7 @@ usage(const char *prog) * *------------------------------------------------------------------------- */ -static ssize_t +ssize_t table_list_add(hid_t oid, unsigned long file_no) { size_t idx; /* Index of table to use */ @@ -821,7 +399,7 @@ table_list_add(hid_t oid, unsigned long file_no) * *------------------------------------------------------------------------- */ -static ssize_t +ssize_t table_list_visited(unsigned long file_no) { size_t u; /* Local index variable */ @@ -878,6436 +456,1108 @@ table_list_free(void) /*------------------------------------------------------------------------- - * Function: print_datatype + * Function: set_output_file * - * Purpose: print the datatype. + * Purpose: Open fname as the output file for dataset raw data. + * Set rawdatastream as its file stream. * - * Return: void + * Return: 0 -- succeeded + * negative -- failed * - * Programmer: Ruey-Hsia Li + * Programmer: Albert Cheng, 2000/09/30 * - * Modifications: pvn, March 28, 2006 - * print information about type when a native match is not possible + * Modifications: + * pvn June, 1, 2006. Add a switch for binary output * *------------------------------------------------------------------------- */ -static void -print_datatype(hid_t type,unsigned in_group) +static int +set_output_file(const char *fname, int is_bin) { - char *mname; - hid_t mtype, str_type; - unsigned nmembers; - unsigned ndims; - unsigned i; - size_t size=0; - hsize_t dims[H5DUMP_MAX_RANK]; - H5T_str_t str_pad; - H5T_cset_t cset; - H5T_order_t order; - hid_t super; - hid_t tmp_type; - htri_t is_vlstr=FALSE; - const char *order_s=NULL; /* byte order string */ - H5T_sign_t sign; /* sign scheme value */ - const char *sign_s=NULL; /* sign scheme string */ - - if (!in_group && H5Tcommitted(type) > 0) { - H5O_info_t oinfo; - obj_t *obj; /* Found object */ - - H5Oget_info(type, &oinfo); - obj = search_obj(type_table, oinfo.addr); - - if(obj) { - if(!obj->recorded) - HDfprintf(stdout,"\"/#%a\"", obj->objno); - else - HDfprintf(stdout, "\"%s\"", obj->objname); - } - else { - error_msg("unknown committed type.\n"); - h5tools_setstatus(EXIT_FAILURE); - } - } - else { - switch(H5Tget_class(type)) { - case H5T_INTEGER: - if(H5Tequal(type, H5T_STD_I8BE) == TRUE) { - HDfprintf(stdout, "H5T_STD_I8BE"); - } - else if(H5Tequal(type, H5T_STD_I8LE) == TRUE) { - HDfprintf(stdout, "H5T_STD_I8LE"); - } - else if(H5Tequal(type, H5T_STD_I16BE) == TRUE) { - HDfprintf(stdout, "H5T_STD_I16BE"); - } - else if(H5Tequal(type, H5T_STD_I16LE) == TRUE) { - HDfprintf(stdout, "H5T_STD_I16LE"); - } - else if(H5Tequal(type, H5T_STD_I32BE) == TRUE) { - HDfprintf(stdout, "H5T_STD_I32BE"); - } - else if(H5Tequal(type, H5T_STD_I32LE) == TRUE) { - HDfprintf(stdout, "H5T_STD_I32LE"); - } - else if(H5Tequal(type, H5T_STD_I64BE) == TRUE) { - HDfprintf(stdout, "H5T_STD_I64BE"); - } - else if(H5Tequal(type, H5T_STD_I64LE) == TRUE) { - HDfprintf(stdout, "H5T_STD_I64LE"); - } - else if(H5Tequal(type, H5T_STD_U8BE) == TRUE) { - HDfprintf(stdout, "H5T_STD_U8BE"); - } - else if(H5Tequal(type, H5T_STD_U8LE) == TRUE) { - HDfprintf(stdout, "H5T_STD_U8LE"); - } - else if(H5Tequal(type, H5T_STD_U16BE) == TRUE) { - HDfprintf(stdout, "H5T_STD_U16BE"); - } - else if(H5Tequal(type, H5T_STD_U16LE) == TRUE) { - HDfprintf(stdout, "H5T_STD_U16LE"); - } - else if(H5Tequal(type, H5T_STD_U32BE) == TRUE) { - HDfprintf(stdout, "H5T_STD_U32BE"); - } - else if(H5Tequal(type, H5T_STD_U32LE) == TRUE) { - HDfprintf(stdout, "H5T_STD_U32LE"); - } - else if(H5Tequal(type, H5T_STD_U64BE) == TRUE) { - HDfprintf(stdout, "H5T_STD_U64BE"); - } - else if(H5Tequal(type, H5T_STD_U64LE) == TRUE) { - HDfprintf(stdout, "H5T_STD_U64LE"); - } - else if(H5Tequal(type, H5T_NATIVE_SCHAR) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_SCHAR"); - } - else if(H5Tequal(type, H5T_NATIVE_UCHAR) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_UCHAR"); - } - else if(H5Tequal(type, H5T_NATIVE_SHORT) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_SHORT"); - } - else if(H5Tequal(type, H5T_NATIVE_USHORT) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_USHORT"); - } - else if(H5Tequal(type, H5T_NATIVE_INT) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_INT"); - } - else if(H5Tequal(type, H5T_NATIVE_UINT) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_UINT"); - } - else if(H5Tequal(type, H5T_NATIVE_LONG) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_LONG"); - } - else if(H5Tequal(type, H5T_NATIVE_ULONG) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_ULONG"); - } - else if(H5Tequal(type, H5T_NATIVE_LLONG) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_LLONG"); - } - else if(H5Tequal(type, H5T_NATIVE_ULLONG) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_ULLONG"); - } - else { - - /* byte order */ - if(H5Tget_size(type) > 1) { - order = H5Tget_order(type); - if (H5T_ORDER_LE == order) { - order_s = " little-endian"; - } - else if (H5T_ORDER_BE == order) { - order_s = " big-endian"; - } - else if (H5T_ORDER_VAX == order) { - order_s = " mixed-endian"; - } - else { - order_s = " unknown-byte-order"; - } - } - else { - order_s = ""; - } /* end of if(H5Tget_size(type) > 1) */ - - /* sign */ - if ((sign = H5Tget_sign(type)) >= 0) { - if (H5T_SGN_NONE == sign) { - sign_s = " unsigned"; - } - else if (H5T_SGN_2 == sign) { - sign_s = ""; - } - else { - sign_s = " unknown-sign"; - } - } - else { - sign_s = " unknown-sign"; - } /* end of if ((sign = H5Tget_sign(type)) >= 0) */ - - /* print size, order, and sign */ - HDfprintf(stdout, "%lu-bit%s%s integer", (unsigned long)(8*H5Tget_size(type)), order_s, sign_s); - } /* end of if(H5Tequal(...) */ - break; - - case H5T_FLOAT: - if(H5Tequal(type, H5T_IEEE_F32BE) == TRUE) { - HDfprintf(stdout, "H5T_IEEE_F32BE"); - } - else if(H5Tequal(type, H5T_IEEE_F32LE) == TRUE) { - HDfprintf(stdout, "H5T_IEEE_F32LE"); - } - else if(H5Tequal(type, H5T_IEEE_F64BE) == TRUE) { - HDfprintf(stdout, "H5T_IEEE_F64BE"); - } - else if(H5Tequal(type, H5T_IEEE_F64LE) == TRUE) { - HDfprintf(stdout, "H5T_IEEE_F64LE"); - } - else if(H5Tequal(type, H5T_VAX_F32) == TRUE) { - HDfprintf(stdout, "H5T_VAX_F32"); - } - else if(H5Tequal(type, H5T_VAX_F64) == TRUE) { - HDfprintf(stdout, "H5T_VAX_F64"); - } - else if(H5Tequal(type, H5T_NATIVE_FLOAT) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_FLOAT"); - } - else if(H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_DOUBLE"); -#if H5_SIZEOF_LONG_DOUBLE !=0 - } - else if(H5Tequal(type, H5T_NATIVE_LDOUBLE) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_LDOUBLE"); -#endif - } - else { - /* byte order */ - if(H5Tget_size(type) > 1) { - order = H5Tget_order(type); - if (H5T_ORDER_LE == order) { - order_s = " little-endian"; - } - else if (H5T_ORDER_BE == order) { - order_s = " big-endian"; - } - else if (H5T_ORDER_VAX == order) { - order_s = " mixed-endian"; - } - else { - order_s = " unknown-byte-order"; - } - } - else { - order_s = ""; - } /* end of if(H5Tget_size(type) > 1) */ - - /* print size and byte order */ - HDfprintf(stdout, "%lu-bit%s floating-point", (unsigned long)(8*H5Tget_size(type)), order_s); - } /* end of if(H5Tequal(...) */ - break; - - case H5T_TIME: - HDfprintf(stdout, "H5T_TIME: not yet implemented"); - break; - - case H5T_STRING: - /* Make a copy of type in memory in case when TYPE is on disk, the size - * will be bigger than in memory. This makes it easier to compare - * types in memory. */ - tmp_type = H5Tcopy(type); - size = H5Tget_size(tmp_type); - str_pad = H5Tget_strpad(tmp_type); - cset = H5Tget_cset(tmp_type); - is_vlstr = H5Tis_variable_str(tmp_type); - - HDfprintf(stdout, "H5T_STRING %s\n", dump_header_format->strblockbegin); - indent += COL; - - indentation(indent + COL); - if(is_vlstr) - HDfprintf(stdout, "%s H5T_VARIABLE;\n", STRSIZE); - else - HDfprintf(stdout, "%s %d;\n", STRSIZE, (int) size); - - indentation(indent + COL); - HDfprintf(stdout, "%s ", STRPAD); - if (str_pad == H5T_STR_NULLTERM) - HDfprintf(stdout, "H5T_STR_NULLTERM;\n"); - else if (str_pad == H5T_STR_NULLPAD) - HDfprintf(stdout, "H5T_STR_NULLPAD;\n"); - else if (str_pad == H5T_STR_SPACEPAD) - HDfprintf(stdout, "H5T_STR_SPACEPAD;\n"); - else - HDfprintf(stdout, "H5T_STR_ERROR;\n"); - - indentation(indent + COL); - HDfprintf(stdout, "%s ", CSET); - - if (cset == H5T_CSET_ASCII) - HDfprintf(stdout, "H5T_CSET_ASCII;\n"); - else - HDfprintf(stdout, "unknown_cset;\n"); - - str_type = H5Tcopy(H5T_C_S1); - if(is_vlstr) - H5Tset_size(str_type, H5T_VARIABLE); - else - H5Tset_size(str_type, size); - H5Tset_cset(str_type, cset); - H5Tset_strpad(str_type, str_pad); - - indentation(indent + COL); - HDfprintf(stdout, "%s ", CTYPE); - - /* Check C variable-length string first. Are the two types equal? */ - if (H5Tequal(tmp_type, str_type)) { - HDfprintf(stdout, "H5T_C_S1;\n"); - goto done; - } - - /* Change the endianness and see if they're equal. */ - order = H5Tget_order(tmp_type); - if(order == H5T_ORDER_LE) - H5Tset_order(str_type, H5T_ORDER_LE); - else if(order == H5T_ORDER_BE) - H5Tset_order(str_type, H5T_ORDER_BE); - - if (H5Tequal(tmp_type, str_type)) { - HDfprintf(stdout, "H5T_C_S1;\n"); - goto done; - } - - /* If not equal to C variable-length string, check Fortran type. */ - H5Tclose(str_type); - str_type = H5Tcopy(H5T_FORTRAN_S1); - H5Tset_cset(str_type, cset); - H5Tset_size(str_type, size); - H5Tset_strpad(str_type, str_pad); - - /* Are the two types equal? */ - if (H5Tequal(tmp_type, str_type)) { - HDfprintf(stdout, "H5T_FORTRAN_S1;\n"); - goto done; - } - - /* Change the endianness and see if they're equal. */ - order = H5Tget_order(tmp_type); - if(order == H5T_ORDER_LE) - H5Tset_order(str_type, H5T_ORDER_LE); - else if(order == H5T_ORDER_BE) - H5Tset_order(str_type, H5T_ORDER_BE); - - if (H5Tequal(tmp_type, str_type)) { - HDfprintf(stdout, "H5T_FORTRAN_S1;\n"); - goto done; - } - - /* Type doesn't match any of above. */ - HDfprintf(stdout, "unknown_one_character_type;\n "); - h5tools_setstatus(EXIT_FAILURE); - - done: - H5Tclose(str_type); - H5Tclose(tmp_type); - - indent -= COL; - indentation(indent + COL); - HDfprintf(stdout, "%s", dump_header_format->strblockend); - break; - - case H5T_BITFIELD: - if (H5Tequal(type, H5T_STD_B8BE)==TRUE) { - HDfprintf(stdout, "H5T_STD_B8BE"); - } - else if (H5Tequal(type, H5T_STD_B8LE)==TRUE) { - HDfprintf(stdout, "H5T_STD_B8LE"); - } - else if (H5Tequal(type, H5T_STD_B16BE)==TRUE) { - HDfprintf(stdout, "H5T_STD_B16BE"); - } - else if (H5Tequal(type, H5T_STD_B16LE)==TRUE) { - HDfprintf(stdout, "H5T_STD_B16LE"); - } - else if (H5Tequal(type, H5T_STD_B32BE)==TRUE) { - HDfprintf(stdout, "H5T_STD_B32BE"); - } - else if (H5Tequal(type, H5T_STD_B32LE)==TRUE) { - HDfprintf(stdout, "H5T_STD_B32LE"); - } - else if (H5Tequal(type, H5T_STD_B64BE)==TRUE) { - HDfprintf(stdout, "H5T_STD_B64BE"); - } - else if (H5Tequal(type, H5T_STD_B64LE)==TRUE) { - HDfprintf(stdout, "H5T_STD_B64LE"); - } - else { - HDfprintf(stdout, "undefined bitfield"); - h5tools_setstatus(EXIT_FAILURE); - } /* end of if(H5Tequal(...) */ - break; - - case H5T_OPAQUE: - HDfprintf(stdout, "\n"); - indentation(indent + COL); - HDfprintf(stdout, "H5T_OPAQUE;\n"); - indentation(indent + COL); - mname = H5Tget_tag(type); - HDfprintf(stdout, "OPAQUE_TAG \"%s\";\n", mname); - free(mname); - indentation(indent); - break; - - case H5T_COMPOUND: - nmembers = H5Tget_nmembers(type); - HDfprintf(stdout, "H5T_COMPOUND %s\n", dump_header_format->structblockbegin); - - for (i = 0; i < nmembers; i++) { - mname = H5Tget_member_name(type, i); - mtype = H5Tget_member_type(type, i); - indentation(indent + COL); - - if (H5Tget_class(mtype) == H5T_COMPOUND) - indent += COL; - - print_datatype(mtype,0); - - if (H5Tget_class(mtype) == H5T_COMPOUND) - indent -= COL; - - HDfprintf(stdout, " \"%s\";\n", mname); - free(mname); - } /* end of for (i = 0; i < nmembers; i++) */ - - indentation(indent); - HDfprintf(stdout, "%s", dump_header_format->structblockend); - break; - - case H5T_REFERENCE: - HDfprintf(stdout, "H5T_REFERENCE"); - /* The BNF document states that the type of reference should be - * displayed after "H5T_REFERENCE". */ - if (H5Tequal(type, H5T_STD_REF_DSETREG)==TRUE) { - HDfprintf(stdout, " { H5T_STD_REF_DSETREG }"); - } - else { - HDfprintf(stdout, " { H5T_STD_REF_OBJECT }"); - } - break; - - case H5T_ENUM: - HDfprintf(stdout, "H5T_ENUM %s\n", dump_header_format->enumblockbegin); - indent += COL; - indentation(indent + COL); - super = H5Tget_super(type); - print_datatype(super,0); - HDfprintf(stdout, ";\n"); - print_enum(type); - indent -= COL; - indentation(indent + COL); - HDfprintf(stdout, "%s", dump_header_format->enumblockend); - break; - - case H5T_VLEN: - HDfprintf(stdout, "H5T_VLEN %s ", dump_header_format->vlenblockbegin); - super = H5Tget_super(type); - print_datatype(super,0); - H5Tclose(super); - - /* Print closing */ - HDfprintf(stdout, "%s", dump_header_format->vlenblockend); - break; - - case H5T_ARRAY: - /* Get array base type */ - super = H5Tget_super(type); - - /* Print lead-in */ - HDfprintf(stdout, "H5T_ARRAY { "); - - /* Get array information */ - ndims = H5Tget_array_ndims(type); - H5Tget_array_dims2(type, dims); - - /* Print array dimensions */ - for (i = 0; i < ndims; i++) - HDfprintf(stdout, "[%d]", (int) dims[i]); - - HDfprintf(stdout, " "); - - /* Print base type */ - print_datatype(super,0); - - /* Close array base type */ - H5Tclose(super); - - /* Print closing */ - HDfprintf(stdout, " }"); + FILE *f; /* temporary holding place for the stream pointer + * so that rawdatastream is changed only when succeeded */ - break; + if (rawdatastream && rawdatastream != stdout) { + if (fclose(rawdatastream)) + perror("closing rawdatastream"); + else + rawdatastream = NULL; + } - default: - HDfprintf(stdout, "unknown datatype"); - h5tools_setstatus(EXIT_FAILURE); - break; + /* binary output */ + if (is_bin) { + if ((f = fopen(fname, "wb")) != NULL) { + rawdatastream = f; + return 0; } - } /* end else */ -} + } + else { + if ((f = fopen(fname, "w")) != NULL) { + rawdatastream = f; + return 0; + } + } + return -1; +} /*------------------------------------------------------------------------- - * Function: dump_datatype + * Function: set_binary_form * - * Purpose: Dump the datatype. Datatype can be HDF5 predefined - * atomic datatype or committed/transient datatype. + * Purpose: set the binary form of output by translating from a string input + * parameter to a integer return value * - * Return: void + * Return: integer form of binary output or -1 if none found * - * Programmer: Ruey-Hsia Li + * Programmer: Pedro Vicente Nunes + * June 28, 2006 * * Modifications: * *------------------------------------------------------------------------- */ -static void -dump_datatype(hid_t type) +static int +set_binary_form(const char *form) { - indent += COL; - - indentation(indent); - HDfprintf(stdout, "%s %s ", dump_header_format->datatypebegin, dump_header_format->datatypeblockbegin); + int bform = -1; - print_datatype(type,0); + if (strcmp(form,"NATIVE") == 0 || strcmp(form,"MEMORY") == 0) { + /* native form */ + bform = 0; + } + else if (strcmp(form,"FILE") == 0) /* file type form */ + bform = 1; + else if (strcmp(form,"LE") == 0) /* convert to little endian */ + bform = 2; + else if (strcmp(form,"BE") == 0) /* convert to big endian */ + bform = 3; - end_obj(dump_header_format->datatypeend, dump_header_format->datatypeblockend); - indent -= COL; + return bform; } /*------------------------------------------------------------------------- - * Function: dump_dataspace + * Function: set_sort_by * - * Purpose: Dump the dataspace. Dataspace can be named dataspace, - * array, or others. + * Purpose: set the "by" form of sorting by translating from a string input + * parameter to a H5_index_t return value + * current sort values are [creation_order | name] * - * Return: void + * Return: H5_index_t form of sort or H5_INDEX_UNKNOWN if none found * - * Programmer: Ruey-Hsia Li + * Programmer: Pedro Vicente Nunes + * October 1, 2007 * * Modifications: * *------------------------------------------------------------------------- */ -static void -dump_dataspace(hid_t space) +static H5_index_t +set_sort_by(const char *form) { - hsize_t size[H5DUMP_MAX_RANK]; - hsize_t maxsize[H5DUMP_MAX_RANK]; - int i; - - int ndims = H5Sget_simple_extent_dims(space, size, maxsize); - H5S_class_t space_type = H5Sget_simple_extent_type(space); - - indentation(indent + COL); - HDfprintf(stdout, "%s ", dump_header_format->dataspacebegin); - - switch(space_type) { - case H5S_SCALAR: - /* scalar dataspace */ - HDfprintf(stdout, "%s %s", dump_header_format->dataspacedescriptionbegin, S_SCALAR); - break; - - case H5S_SIMPLE: - /* simple dataspace */ - HDfprintf(stdout, "%s %s { %s %Hu", - dump_header_format->dataspacedescriptionbegin, S_SIMPLE, - dump_header_format->dataspacedimbegin, size[0]); - - for(i = 1; i < ndims; i++) - HDfprintf(stdout, ", %Hu", size[i]); - - HDfprintf(stdout, " %s / ", dump_header_format->dataspacedimend); - - if(maxsize[0] == H5S_UNLIMITED) - HDfprintf(stdout, "%s %s", dump_header_format->dataspacedimbegin, "H5S_UNLIMITED"); - else - HDfprintf(stdout, "%s %Hu", dump_header_format->dataspacedimbegin, maxsize[0]); - - for(i = 1; i < ndims; i++) - if(maxsize[i] == H5S_UNLIMITED) - HDfprintf(stdout, ", %s", "H5S_UNLIMITED"); - else - HDfprintf(stdout, ", %Hu", maxsize[i]); - - HDfprintf(stdout, " %s }", dump_header_format->dataspacedimend); - break; - - case H5S_NULL: - /* null dataspace */ - HDfprintf(stdout, "%s %s", dump_header_format->dataspacedescriptionbegin, S_NULL); - break; + H5_index_t idx_type = H5_INDEX_UNKNOWN; - case H5S_NO_CLASS: - default: - HDfprintf(stdout, "%s unknown dataspace %s\n", BEGIN, END); - break; - } /* end switch */ + if (strcmp(form,"name")==0) /* H5_INDEX_NAME */ + idx_type = H5_INDEX_NAME; + else if (strcmp(form,"creation_order")==0) /* H5_INDEX_CRT_ORDER */ + idx_type = H5_INDEX_CRT_ORDER; - end_obj(dump_header_format->dataspaceend, dump_header_format->dataspaceblockend); + return idx_type; } - /*------------------------------------------------------------------------- - * Function: dump_attr_cb - * - * Purpose: attribute function callback called by H5Aiterate2, displays the attribute + * Function: set_sort_order * - * Return: Success: SUCCEED + * Purpose: set the order of sorting by translating from a string input + * parameter to a H5_iter_order_t return value + * current order values are [ascending | descending ] * - * Failure: FAIL + * Return: H5_iter_order_t form of order or H5_ITER_UNKNOWN if none found * - * Programmer: Ruey-Hsia Li + * Programmer: Pedro Vicente Nunes + * October 1, 2007 * - * Modifications: Pedro Vicente, October 4, 2007 - * Added H5A_info_t parameter to conform with H5Aiterate2 + * Modifications: * *------------------------------------------------------------------------- */ -static herr_t -dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t UNUSED *info, void UNUSED *_op_data) +static H5_iter_order_t +set_sort_order(const char *form) { - hid_t attr_id; - herr_t ret = SUCCEED; - - indentation(indent); - begin_obj(dump_header_format->attributebegin, attr_name, dump_header_format->attributeblockbegin); - - if((attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT)) < 0) { - indentation(indent + COL); - error_msg("unable to open attribute \"%s\"\n", attr_name); - indentation(indent); - end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - else { - hid_t type, space; - - type = H5Aget_type(attr_id); - space = H5Aget_space(attr_id); - dump_datatype(type); - dump_dataspace(space); - - if(display_oid) - dump_oid(attr_id); - - if(display_data || display_attr_data) - dump_data(attr_id, ATTRIBUTE_DATA, NULL, display_ai); - - H5Tclose(type); - H5Sclose(space); - H5Aclose(attr_id); + H5_iter_order_t iter_order = H5_ITER_UNKNOWN; - indentation(indent); - end_obj(dump_header_format->attributeend,dump_header_format->attributeblockend); - } + if (strcmp(form,"ascending")==0) /* H5_ITER_INC */ + iter_order = H5_ITER_INC; + else if (strcmp(form,"descending")==0) /* H5_ITER_DEC */ + iter_order = H5_ITER_DEC; - return ret; + return iter_order; } /*------------------------------------------------------------------------- - * Function: dump_selected_attr - * - * Purpose: dump the selected attribute + * Function: parse_hsize_list * - * Return: Success: SUCCEED + * Purpose: Parse a list of comma or space separated integers and return + * them in a list. The string being passed into this function + * should be at the start of the list you want to parse. You are + * responsible for freeing the array returned from here. * - * Failure: FAIL + * Lists in the so-called "terse" syntax are separated by + * semicolons (;). The lists themselves can be separated by + * either commas (,) or white spaces. * - * Programmer: Ruey-Hsia Li + * Return: * - * Modifications: + * Programmer: Bill Wendling + * Tuesday, 6. February 2001 * *------------------------------------------------------------------------- */ -static herr_t -dump_selected_attr(hid_t loc_id, const char *name) +static void +parse_hsize_list(const char *h_list, subset_d *d) { - hid_t oid = -1; - hid_t attr_id = -1; - char *obj_name; - const char *attr_name; - int j; - - j = (int)HDstrlen(name) - 1; - obj_name = (char *)HDmalloc((size_t)j + 2); - if(obj_name == NULL) - goto error; - - /* find the last / */ - while(j >= 0) { - if (name[j] == '/') - break; - j--; - } - - /* object name */ - if(j == -1) - HDstrcpy(obj_name, "/"); - else { - HDstrncpy(obj_name, name, (size_t)j + 1); - obj_name[j + 1] = '\0'; - } /* end else */ - - attr_name = name + j + 1; - begin_obj(dump_header_format->attributebegin, name, - dump_header_format->attributeblockbegin); - - /* Open the object with the attribute */ - if((oid = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) { - indentation(COL); - error_msg("unable to open object \"%s\"\n", obj_name); - end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); - goto error; - } /* end if */ - - if((attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT)) >= 0) { - hid_t type, space; - - type = H5Aget_type(attr_id); - space = H5Aget_space(attr_id); - dump_datatype(type); - dump_dataspace(space); - - if(display_oid) - dump_oid(attr_id); + hsize_t *p_list; + const char *ptr; + unsigned int size_count = 0; + unsigned int i = 0; + unsigned int last_digit = 0; - if(display_data || display_attr_data) - dump_data(attr_id, ATTRIBUTE_DATA, NULL, display_ai); + if (!h_list || !*h_list || *h_list == ';') + return; - H5Tclose(type); - H5Sclose(space); - H5Aclose(attr_id); - end_obj(dump_header_format->attributeend, - dump_header_format->attributeblockend); - } - else { - indentation(COL); - error_msg("unable to open attribute \"%s\"\n", obj_name); - end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); - goto error; - } + /* count how many integers do we have */ + for (ptr = h_list; ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) + if (isdigit(*ptr)) { + if (!last_digit) + /* the last read character wasn't a digit */ + size_count++; - /* Close object */ - if(H5Oclose(oid) < 0) { - goto error; - } /* end if */ + last_digit = 1; + } + else { + last_digit = 0; + } - HDfree(obj_name); - return SUCCEED; - -error: - h5tools_setstatus(EXIT_FAILURE); - if(obj_name) - HDfree(obj_name); + if (size_count == 0) + /* there aren't any integers to read */ + return; + + /* allocate an array for the integers in the list */ + p_list = (hsize_t *)calloc(size_count, sizeof(hsize_t)); + + for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) + if(isdigit(*ptr)) { + /* we should have an integer now */ + p_list[i++] = (hsize_t)atof(ptr); + + while (isdigit(*ptr)) + /* scroll to end of integer */ + ptr++; + } + d->data = p_list; + d->len = size_count; - H5E_BEGIN_TRY { - H5Oclose(oid); - H5Aclose(attr_id); - } H5E_END_TRY; - return FAIL; + return; } /*------------------------------------------------------------------------- - * Function: dump_all_cb - * - * Purpose: function callback called by H5Literate, - * displays everything in the specified object + * Function: parse_subset_params * - * Return: Success: SUCCEED + * Purpose: Parse the so-called "terse" syntax for specifying subsetting + * parameters. * - * Failure: FAIL + * Return: Success: struct subset_t object + * Failure: NULL * - * Programmer: Ruey-Hsia Li + * Programmer: Bill Wendling + * Tuesday, 6. February 2001 * * Modifications: - * RMcG, November 2000 - * Added XML support. Also, optionally checks the op_data argument - * - * PVN, May 2008 - * Dump external links * *------------------------------------------------------------------------- */ -static herr_t -dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED *op_data) +static struct subset_t * +parse_subset_params(char *dset) { - hid_t obj; - herr_t ret = SUCCEED; - char *obj_path = NULL; /* Full path of object */ - - /* Build the object's path name */ - obj_path = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); - if(!obj_path) { - ret = FAIL; - goto done; - } - - HDstrcpy(obj_path, prefix); - HDstrcat(obj_path, "/"); - HDstrcat(obj_path, name); - - if(linfo->type == H5L_TYPE_HARD) { - H5O_info_t oinfo; - - /* Stat the object */ - if(H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) { - error_msg("unable to get object information for \"%s\"\n", name); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - goto done; - } /* end if */ - - switch(oinfo.type) { - case H5O_TYPE_GROUP: - if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) { - error_msg("unable to dump group \"%s\"\n", name); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - else { - char *old_prefix; /* Pointer to previous prefix */ - - /* Keep copy of prefix before iterating into group */ - old_prefix = HDstrdup(prefix); - HDassert(old_prefix); + struct subset_t *s = NULL; + register char *brace; - /* Append group name to prefix */ - add_prefix(&prefix, &prefix_len, name); + if (!disable_compact_subset && ((brace = strrchr(dset, '[')) != NULL)) { + *brace++ = '\0'; - /* Iterate into group */ - dump_function_table->dump_group_function(obj, name); + s = (struct subset_t *)calloc(1, sizeof(struct subset_t)); + parse_hsize_list(brace, &s->start); - /* Restore old prefix name */ - HDstrcpy(prefix, old_prefix); - HDfree(old_prefix); + while (*brace && *brace != ';') + brace++; - /* Close group */ - H5Gclose(obj); - } - break; + if (*brace) brace++; - case H5O_TYPE_DATASET: - if((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) { - if(oinfo.rc > 1 || hit_elink) { - obj_t *found_obj; /* Found object */ - - found_obj = search_obj(dset_table, oinfo.addr); - - if(found_obj == NULL) { - indentation(indent); - begin_obj(dump_header_format->datasetbegin, name, dump_header_format->datasetblockbegin); - indentation(indent + COL); - error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); - indentation(indent); - end_obj(dump_header_format->datasetend, dump_header_format->datasetblockend); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - H5Dclose(obj); - goto done; - } - else if(found_obj->displayed) { - indentation(indent); - - if(!doxml) { - begin_obj(dump_header_format->datasetbegin, name, dump_header_format->datasetblockbegin); - indentation(indent + COL); - HDfprintf(stdout, "%s \"%s\"\n", HARDLINK, found_obj->objname); - indentation(indent); - end_obj(dump_header_format->datasetend, dump_header_format->datasetblockend); - } - else { - /* the XML version */ - char *t_obj_path = xml_escape_the_name(obj_path); - char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); - char *t_name = xml_escape_the_name(name); - char *t_objname = xml_escape_the_name(found_obj->objname); - char dsetxid[100]; - char parentxid[100]; - char pointerxid[100]; - - /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(obj_path, dsetxid, sizeof(dsetxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); - - HDfprintf(stdout, "<%sDataset Name=\"%s\" OBJ-XID=\"%s-%d\" " - "H5Path=\"%s\" Parents=\"%s\" " - "H5ParentPaths=\"%s\">\n", - xmlnsprefix, - t_name, /* Dataset Name */ - dsetxid, get_next_xid(), /* OBJ-XID */ - t_obj_path, /* H5Path */ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - - indentation(indent + COL); - xml_name_to_XID(found_obj->objname, pointerxid, sizeof(pointerxid), 1); - HDfprintf(stdout, "<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>\n", - xmlnsprefix, - pointerxid,t_objname); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - - HDfree(t_name); - HDfree(t_obj_path); - HDfree(t_prefix); - HDfree(t_objname); - } - - H5Dclose(obj); - goto done; - } - else { - found_obj->displayed = TRUE; - } - } /* end if */ - - dump_function_table->dump_dataset_function(obj, name, NULL); - H5Dclose(obj); - } - else { - error_msg("unable to dump dataset \"%s\"\n", name); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - break; - - case H5O_TYPE_NAMED_DATATYPE: - if((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) { - error_msg("unable to dump datatype \"%s\"\n", name); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - else { - dump_function_table->dump_named_datatype_function(obj, name); - H5Tclose(obj); - } - break; + parse_hsize_list(brace, &s->stride); - default: - error_msg("unknown object \"%s\"\n", name); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - } /* end if */ - else { - char *targbuf; + while (*brace && *brace != ';') + brace++; - switch(linfo->type) { - case H5L_TYPE_SOFT: - indentation(indent); - targbuf = (char *)HDmalloc(linfo->u.val_size); - HDassert(targbuf); + if (*brace) brace++; - if(!doxml) { - begin_obj(dump_header_format->softlinkbegin, name, dump_header_format->softlinkblockbegin); - indentation(indent + COL); - } + parse_hsize_list(brace, &s->count); - if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { - error_msg("unable to get link value\n"); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - else { - /* print the value of a soft link */ - if (!doxml) { - /* Standard DDL: no modification */ - HDfprintf(stdout, "LINKTARGET \"%s\"\n", targbuf); - } - else { - /* XML */ - char linkxid[100]; - char parentxid[100]; - char targetxid[100]; - char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); - char *t_name = xml_escape_the_name(name); - char *t_targbuf = xml_escape_the_name(targbuf); - char *t_obj_path = xml_escape_the_name(obj_path); - char *t_link_path; - int res; - - t_link_path = (char *)HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1); - if(targbuf[0] == '/') - HDstrcpy(t_link_path, targbuf); - else { - HDstrcpy(t_link_path, prefix); - HDstrcat(HDstrcat(t_link_path, "/"), targbuf); - } /* end else */ - - /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); - - /* Try to create an OBJ-XID for the object pointed to */ - res = xml_name_to_XID(t_link_path, targetxid, sizeof(targetxid), 0); - if (res == 0) { - /* target obj found */ - HDfprintf(stdout, "<%sSoftLink LinkName=\"%s\" " - "OBJ-XID=\"%s\" " - "H5SourcePath=\"%s\" " - "TargetPath=\"%s\" TargetObj=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", - xmlnsprefix, - t_name, /* LinkName */ - linkxid, /* OBJ-XID */ - t_obj_path, /* H5SourcePath */ - t_targbuf, /* TargetPath */ - targetxid, /* TargetObj */ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - } - else { - /* dangling link -- omit from xml attributes */ - HDfprintf(stdout, "<%sSoftLink LinkName=\"%s\" " - "OBJ-XID=\"%s\" " - "H5SourcePath=\"%s\" " - "TargetPath=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", - xmlnsprefix, - t_name, /* LinkName */ - linkxid, /* OBJ-XID */ - t_obj_path, /* H5SourcePath */ - t_targbuf, /* TargetPath */ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - } - - HDfree(t_prefix); - HDfree(t_name); - HDfree(t_targbuf); - HDfree(t_obj_path); - HDfree(t_link_path); - } - } + while (*brace && *brace != ';') + brace++; - if (!doxml) { - indentation(indent); - end_obj(dump_header_format->softlinkend, dump_header_format->softlinkblockend); - } + if (*brace) brace++; - HDfree(targbuf); - break; - - case H5L_TYPE_EXTERNAL: - targbuf = (char *)HDmalloc(linfo->u.val_size); - HDassert(targbuf); - - indentation(indent); - if(!doxml) - begin_obj(dump_header_format->extlinkbegin, name, dump_header_format->extlinkblockbegin); - - if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { - error_msg("unable to get external link value\n"); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } /* end if */ - else { - const char *filename; - const char *targname; - - if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) { - error_msg("unable to unpack external link value\n"); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } /* end if */ - else { - if(!doxml) { - indentation(indent + COL); - HDfprintf(stdout, "TARGETFILE \"%s\"\n", filename); - indentation(indent + COL); - HDfprintf(stdout, "TARGETPATH \"%s\"\n", targname); - - /* dump the external link */ - dump_extlink(group, name, targname); - } /* end if */ - /* XML */ - else { - char linkxid[100]; - char parentxid[100]; - char *t_name = xml_escape_the_name(name); - char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); - char *t_obj_path = xml_escape_the_name(obj_path); - char *t_filename = xml_escape_the_name(filename); - char *t_targname = xml_escape_the_name(targname); - - /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); - - HDfprintf(stdout, "<%sExternalLink LinkName=\"%s\" " - "OBJ-XID=\"%s\" " - "H5SourcePath=\"%s\" " - "TargetFilename=\"%s\" " - "TargetPath=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", - xmlnsprefix, - t_name, /* LinkName */ - linkxid, /* OBJ-XID */ - t_obj_path, /* H5SourcePath */ - filename, /* TargetFilename */ - targname, /* TargetPath*/ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - HDfree(t_prefix); - HDfree(t_name); - HDfree(t_filename); - HDfree(t_targname); - HDfree(t_obj_path); - } /* end else */ - } /* end else */ - } /* end else */ - if(!doxml) { - indentation(indent); - end_obj(dump_header_format->extlinkend, dump_header_format->extlinkblockend); - } /* end if */ - HDfree(targbuf); - break; - - default: - indentation(indent); - if(!doxml) { - begin_obj(dump_header_format->udlinkbegin, name, dump_header_format->udlinkblockbegin); - indentation(indent + COL); - HDfprintf(stdout, "LINKCLASS %d\n", linfo->type); - indentation(indent); - end_obj(dump_header_format->udlinkend, dump_header_format->udlinkblockend); - } /* end if */ - /* XML */ - else { - char linkxid[100]; - char parentxid[100]; - char *t_name = xml_escape_the_name(name); - char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); - char *t_obj_path = xml_escape_the_name(obj_path); - - /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); - - HDfprintf(stdout, "<%sUserDefined LinkName=\"%s\" " - "OBJ-XID=\"%s\" " - "H5SourcePath=\"%s\" " - "LinkClass=\"%d\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", - xmlnsprefix, - t_name, /* LinkName */ - linkxid, /* OBJ-XID */ - t_obj_path, /* H5SourcePath */ - linfo->type, /* LinkClass */ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - HDfree(t_prefix); - HDfree(t_name); - HDfree(t_obj_path); - } /* end else */ - break; - } /* end switch */ - } /* end else */ + parse_hsize_list(brace, &s->block); + } -done: - if(obj_path) - HDfree(obj_path); - return ret; + return s; } /*------------------------------------------------------------------------- - * Function: dump_named_datatype + * Function: parse_mask_list * - * Purpose: Dump named datatype + * Purpose: Parse a list of comma or space separated integers and fill + * the packed_bits list and counter. The string being passed into this function + * should be at the start of the list you want to parse. * - * Return: void + * Return: Success: SUCCEED * - * Programmer: Ruey-Hsia Li + * Failure: FAIL * - * Modifications: - * Pedro Vicente, March 27, 2006 - * added display of attributes - * Pedro Vicente, October 4, 2007, added parameters to H5Aiterate2() to allow for - * other iteration orders * *------------------------------------------------------------------------- */ -static void -dump_named_datatype(hid_t tid, const char *name) +static int +parse_mask_list(const char *h_list) { - H5O_info_t oinfo; - unsigned attr_crt_order_flags; - hid_t tcpl_id; /* datatype creation property list ID */ - - - if ((tcpl_id = H5Tget_create_plist(tid)) < 0) { - error_msg("error in getting creation property list ID\n"); - h5tools_setstatus(EXIT_FAILURE); - } - - /* query the creation properties for attributes */ - if (H5Pget_attr_creation_order(tcpl_id, &attr_crt_order_flags) < 0) { - error_msg("error in getting creation properties\n"); - h5tools_setstatus(EXIT_FAILURE); - } + int offset_value; + int length_value; + unsigned long long temp_mask; + const char *ptr = NULL; - if(H5Pclose(tcpl_id) < 0) { - error_msg("error in closing creation property list ID\n"); - h5tools_setstatus(EXIT_FAILURE); - } + /* sanity check */ + HDassert(h_list); + HDmemset(packed_mask,0,sizeof(packed_mask)); - indentation(indent); - HDfprintf(stdout, "%s \"%s\" %s", dump_header_format->datatypebegin, name, - dump_header_format->datatypeblockbegin); + packed_bits_num = 0; + /* scan in pair of offset,length separated by commas. */ + ptr = h_list; + while (*ptr) { + /* scan for an offset which is an unsigned int */ + if (!HDisdigit(*ptr)) { + error_msg("Bad mask list(%s)\n", h_list); + return FAIL; + } + offset_value = HDatoi(ptr); + if (offset_value < 0 || offset_value >= PACKED_BITS_SIZE_MAX) { + error_msg("Packed Bit offset value(%d) must be between 0 and %d\n", + offset_value, PACKED_BITS_SIZE_MAX - 1); + return FAIL; + } - H5Oget_info(tid, &oinfo); + /* skip to end of integer */ + while (HDisdigit(*++ptr)) + ; + /* Look for the common separator */ + if (*ptr++ != ',') { + error_msg("Bad mask list(%s), missing expected comma separator.\n", h_list); + return FAIL; + } - /* Must check for uniqueness of all objects if we've traversed an elink, - * otherwise only check if the reference count > 1. - */ - if(oinfo.rc > 1 || hit_elink) { - obj_t *found_obj; /* Found object */ + /* scan for a length which is a positive int */ + if (!HDisdigit(*ptr)) { + error_msg("Bad mask list(%s)\n", h_list); + return FAIL; + } + length_value = HDatoi(ptr); + if (length_value <= 0) { + error_msg("Packed Bit length value(%d) must be positive.\n", length_value); + return FAIL; + } + if ((offset_value + length_value) > PACKED_BITS_SIZE_MAX){ + error_msg("Packed Bit offset+length value(%d) too large. Max is %d\n", + offset_value+length_value, PACKED_BITS_SIZE_MAX); + return FAIL; + } - found_obj = search_obj(type_table, oinfo.addr); + /* skip to end of int */ + while (HDisdigit(*++ptr)) + ; - if (found_obj == NULL) { - error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); - h5tools_setstatus(EXIT_FAILURE); - goto done; + /* store the offset,length pair */ + if (packed_bits_num >= PACKED_BITS_MAX) { + /* too many requests */ + error_msg("Too many masks requested (max. %d). Mask list(%s)\n", PACKED_BITS_MAX, h_list); + return FAIL; } - else if (found_obj->displayed) { - HDfprintf(stdout, "%s \"%s\"\n", HARDLINK, found_obj->objname); - goto done; + packed_offset[packed_bits_num] = offset_value; + packed_length[packed_bits_num] = length_value; + /* create the bit mask by left shift 1's by length, then negate it. */ + /* After packed_mask is calculated, packed_length is not needed but */ + /* keep it for debug purpose. */ + temp_mask = ~0L; + if(length_value<8*sizeof(unsigned long long)) { + temp_mask = temp_mask << length_value; + packed_mask[packed_bits_num] = ~temp_mask; } else - found_obj->displayed = TRUE; - } /* end if */ - - print_datatype(tid, 1); - if(H5Tget_class(tid) != H5T_COMPOUND) - HDfprintf(stdout, ";\n"); - - /* print attributes */ - indent += COL; - - /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set - in the datatype's create property list for attributes, then, sort by creation order, otherwise by name */ - - if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { - if(H5Aiterate2(tid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end if */ - else { - if(H5Aiterate2(tid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end else */ - - indent -= COL; + packed_mask[packed_bits_num] = temp_mask; + packed_bits_num++; -done: - end_obj(dump_header_format->datatypeend, dump_header_format->datatypeblockend); + /* skip a possible comma separator */ + if (*ptr == ',') { + if (!(*++ptr)) { + /* unexpected end of string */ + error_msg("Bad mask list(%s), unexpected end of string.\n", h_list); + return FAIL; + } + } + } + HDassert(packed_bits_num <= PACKED_BITS_MAX); + if (packed_bits_num == 0) { + /* got no masks! */ + error_msg("Bad mask list(%s)\n", h_list); + return FAIL; + } + return SUCCEED; } + /*------------------------------------------------------------------------- - * Function: dump_group + * Function: free_handler * - * Purpose: Dump everything within the specified group + * Purpose: Convenience function to free the handler_t structures. Needs a + * length variable (LEN) to know how many in the array it needs + * to free * - * Return: void + * Return: Nothing * - * Programmer: Ruey-Hsia Li + * Programmer: Bill Wendling + * Tuesday, 20. February 2001 * * Modifications: * - * Call to dump_all_cb -- add parameter to select everything. - * - * Pedro Vicente, October 1, 2007 - * handle several iteration orders for attributes and groups - * *------------------------------------------------------------------------- */ static void -dump_group(hid_t gid, const char *name) +free_handler(struct handler_t *hand, int len) { - H5O_info_t oinfo; - hid_t dset; - hid_t type; - hid_t gcpl_id; - unsigned crt_order_flags; - unsigned attr_crt_order_flags; - char type_name[1024]; - char *tmp = NULL; - - if ((gcpl_id = H5Gget_create_plist(gid)) < 0) { - error_msg("error in getting group creation property list ID\n"); - h5tools_setstatus(EXIT_FAILURE); - } - - /* query the group creation properties for attributes */ - if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0) { - error_msg("error in getting group creation properties\n"); - h5tools_setstatus(EXIT_FAILURE); - } - - /* query the group creation properties */ - if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) { - error_msg("error in getting group creation properties\n"); - h5tools_setstatus(EXIT_FAILURE); - } - - if(H5Pclose(gcpl_id) < 0) { - error_msg("error in closing group creation property list ID\n"); - h5tools_setstatus(EXIT_FAILURE); - } - - tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); - HDstrcpy(tmp, prefix); - indentation(indent); - begin_obj(dump_header_format->groupbegin, name, dump_header_format->groupblockbegin); - indent += COL; - - if(display_oid) - dump_oid(gid); - - dump_comment(gid); - - if(!HDstrcmp(name, "/") && unamedtype) { - unsigned u; /* Local index variable */ - - /* dump unamed type in root group */ - for(u = 0; u < type_table->nobjs; u++) - if(!type_table->objs[u].recorded) { - dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); - type = H5Dget_type(dset); - sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); - dump_function_table->dump_named_datatype_function(type, type_name); - H5Tclose(type); - H5Dclose(dset); + register int i; + + if(hand) { + for (i = 0; i < len; i++) { + if(hand[i].obj) { + free(hand[i].obj); + hand[i].obj=NULL; } - } /* end if */ - - H5Oget_info(gid, &oinfo); - /* Must check for uniqueness of all objects if we've traversed an elink, - * otherwise only check if the reference count > 1. - */ - if(oinfo.rc > 1 || hit_elink) { - obj_t *found_obj; /* Found object */ - - found_obj = search_obj(group_table, oinfo.addr); - - if (found_obj == NULL) { - indentation(indent); - error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); - h5tools_setstatus(EXIT_FAILURE); - } - else if (found_obj->displayed) { - indentation(indent); - HDfprintf(stdout, "%s \"%s\"\n", HARDLINK, found_obj->objname); - } - else { - found_obj->displayed = TRUE; - /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set - in the group for attributes, then, sort by creation order, otherwise by name */ - - if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { - if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end if */ - else { - if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end else */ - - /* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set - in the group, then, sort by creation order, otherwise by name */ + if (hand[i].subset_info) { + if(hand[i].subset_info->start.data) + free(hand[i].subset_info->start.data); + if(hand[i].subset_info->stride.data) + free(hand[i].subset_info->stride.data); + if(hand[i].subset_info->count.data) + free(hand[i].subset_info->count.data); + if(hand[i].subset_info->block.data) + free(hand[i].subset_info->block.data); - if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) - H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); - else - H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); + free(hand[i].subset_info); + hand[i].subset_info=NULL; + } } - } - - else { - /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set - in the group for attributes, then, sort by creation order, otherwise by name */ - - if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { - if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end if */ - else { - if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end else */ - /* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set - in the group, then, sort by creation order, otherwise by name */ - - if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) - H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); - else - H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); + free(hand); } - - indent -= COL; - indentation(indent); - end_obj(dump_header_format->groupend, dump_header_format->groupblockend); - free(tmp); } + /*------------------------------------------------------------------------- - * Function: dump_dataset + * Function: parse_command_line * - * Purpose: Dump the specified data set + * Purpose: Parse the command line for the h5dumper. * - * Return: void + * Return: Success: A pointer to an array of handler_t structures. + * These contain all the information needed to dump + * the necessary object. * - * Programmer: Ruey-Hsia Li + * Failure: Exits program with EXIT_FAILURE value. + * + * Programmer: Bill Wendling + * Tuesday, 20. February 2001 * * Modifications: - * Pedro Vicente, 2004, added dataset creation property list display - * Pedro Vicente, October 4, 2007, added parameters to H5Aiterate2() to allow for - * other iteration orders + * pvn June, 1, 2006. Add a switch for binary output * *------------------------------------------------------------------------- */ -static void -dump_dataset(hid_t did, const char *name, struct subset_t *sset) +static struct handler_t * +parse_command_line(int argc, const char *argv[]) { - hid_t type, space; - unsigned attr_crt_order_flags; - hid_t dcpl_id; /* dataset creation property list ID */ + struct handler_t *hand = NULL; + struct handler_t *last_dset = NULL; + int i; + int opt; + int last_was_dset = FALSE; - if ((dcpl_id = H5Dget_create_plist(did)) < 0) { - error_msg("error in getting creation property list ID\n"); - h5tools_setstatus(EXIT_FAILURE); + /* no arguments */ + if (argc == 1) { + usage(h5tools_getprogname()); + goto error; } - /* query the creation properties for attributes */ - if (H5Pget_attr_creation_order(dcpl_id, &attr_crt_order_flags) < 0) { - error_msg("error in getting creation properties\n"); - h5tools_setstatus(EXIT_FAILURE); + /* this will be plenty big enough to hold the info */ + if((hand = (struct handler_t *)calloc((size_t)argc, sizeof(struct handler_t)))==NULL) { + goto error; } - indentation(indent); - begin_obj(dump_header_format->datasetbegin, name, dump_header_format->datasetblockbegin); - - type = H5Dget_type(did); - space = H5Dget_space(did); - - dump_comment(did); - dump_datatype(type); - dump_dataspace(space); - - if(display_oid) - dump_oid(did); - - if(display_dcpl) - dump_dcpl(dcpl_id, type, did); + /* parse command line options */ + while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { +parse_start: + switch ((char)opt) { + case 'R': + display_region = TRUE; + region_output = TRUE; + break; + case 'B': + display_bb = TRUE; + last_was_dset = FALSE; + break; + case 'n': + display_fi = TRUE; + last_was_dset = FALSE; + break; + case 'p': + display_dcpl = TRUE; + break; + case 'y': + display_ai = FALSE; + break; + case 'e': + display_escape = TRUE; + break; + case 'H': + display_data = FALSE; + display_attr_data = FALSE; + last_was_dset = FALSE; + break; + case 'A': + display_data = FALSE; + display_attr_data = TRUE; + last_was_dset = FALSE; + break; + case 'i': + display_oid = TRUE; + last_was_dset = FALSE; + break; + case 'r': + display_char = TRUE; + break; + case 'V': + print_version(h5tools_getprogname()); + free_handler(hand, argc); + hand = NULL; + h5tools_setstatus(EXIT_SUCCESS); + goto done; + break; + case 'w': + h5tools_nCols = HDatoi(opt_arg); + last_was_dset = FALSE; + break; + case 'a': + display_all = 0; - if(display_data) { - int data_loop = 1; - int i; - if(display_packed_bits) - data_loop = packed_bits_num; - for(i=0; idatasetend,dump_header_format->datasetblockend); -} + last_was_dset = FALSE; + break; + case 't': + display_all = 0; -/*------------------------------------------------------------------------- - * Function: dump_dims - * - * Purpose: Dump the dimensions handed to it in a comma separated list - * - * Return: void - * - * Programmer: Bill Wendling - * Tuesday, 27. February 2001 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -dump_dims(hsize_t *s, int dims) -{ - int i; + for (i = 0; i < argc; i++) + if (!hand[i].func) { + hand[i].func = handle_datatypes; + hand[i].obj = HDstrdup(opt_arg); + break; + } - for (i = 0; i < dims; i++) { - printf(HSIZE_T_FORMAT, s[i]); + last_was_dset = FALSE; + break; - if (i + 1 != dims) HDfprintf(stdout, ", "); - } -} + case 'o': + if ( bin_output ) { + if (set_output_file(opt_arg, 1) < 0) { + usage(h5tools_getprogname()); + goto error; + } + } + else { + if (set_output_file(opt_arg, 0) < 0) { + usage(h5tools_getprogname()); + goto error; + } + } -/*------------------------------------------------------------------------- - * Function: dump_subsetting_header - * - * Purpose: Dump the subsetting header like specified in the DDL. - * - * Return: void - * - * Programmer: Bill Wendling - * Tuesday, 27. February 2001 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -dump_subsetting_header(struct subset_t *sset, int dims) -{ - indentation(indent); - HDfprintf(stdout, "%s %s\n", dump_header_format->subsettingbegin, dump_header_format->subsettingblockbegin); + usingdasho = TRUE; + last_was_dset = FALSE; + outfname = opt_arg; + break; - indent += COL; - indentation(indent); - HDfprintf(stdout, "%s %s ", dump_header_format->startbegin, dump_header_format->startblockbegin); - dump_dims(sset->start.data, dims); - HDfprintf(stdout, "%s %s\n", dump_header_format->startend, dump_header_format->startblockend); + case 'b': + if ( opt_arg != NULL) { + if ( ( bin_form = set_binary_form(opt_arg)) < 0) { + /* failed to set binary form */ + usage(h5tools_getprogname()); + goto error; + } + } + bin_output = TRUE; + if (outfname!=NULL) { + if (set_output_file(outfname, 1) < 0) { + /* failed to set output file */ + usage(h5tools_getprogname()); + goto error; + } - indentation(indent); - HDfprintf(stdout, "%s %s ", dump_header_format->stridebegin, dump_header_format->strideblockbegin); - dump_dims(sset->stride.data, dims); - HDfprintf(stdout, "%s %s\n", dump_header_format->strideend, dump_header_format->strideblockend); + last_was_dset = FALSE; + } + break; - indentation(indent); - HDfprintf(stdout, "%s %s ", dump_header_format->countbegin, dump_header_format->countblockbegin); + case 'q': + if ( ( sort_by = set_sort_by(opt_arg)) < 0) { + /* failed to set "sort by" form */ + usage(h5tools_getprogname()); + goto error; + } + break; - if(sset->count.data) - dump_dims(sset->count.data, dims); - else - HDfprintf(stdout, "DEFAULT"); + case 'z': + if ( ( sort_order = set_sort_order(opt_arg)) < 0) { + /* failed to set "sort order" form */ + usage(h5tools_getprogname()); + goto error; + } + break; - HDfprintf(stdout, "%s %s\n", dump_header_format->countend, dump_header_format->countblockend); - - indentation(indent); - HDfprintf(stdout, "%s %s ", dump_header_format->blockbegin, dump_header_format->blockblockbegin); - - if(sset->block.data) - dump_dims(sset->block.data, dims); - else - HDfprintf(stdout, "DEFAULT"); - - HDfprintf(stdout, "%s %s\n", dump_header_format->blockend, dump_header_format->blockblockend); -} - -/*------------------------------------------------------------------------- - * Function: dump_data - * - * Purpose: Dump attribute or dataset data - * - * Return: void - * - * Programmer: Ruey-Hsia Li - * - * Modifications: pvn, print the matrix indices - * Albert Cheng, 2004/11/18 - * Add --string printing for attributes too. - * - *------------------------------------------------------------------------- - */ -static void -dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index) -{ - H5S_class_t space_type; - int ndims; - int i; - hid_t space; - hid_t type; - hid_t p_type; - hsize_t size[64]; - hsize_t alloc_size; - hsize_t nelmts = 1; - int depth; - int stdindent = COL; /* should be 3 */ - int status = -1; - void *buf = NULL; - h5tool_format_t *outputformat = &dataformat; - - if (fp_format) { - outputformat->fmt_double = fp_format; - outputformat->fmt_float = fp_format; - } - - if (nCols==0) { - outputformat->line_ncols = 65535; - outputformat->line_per_line = 1; - } - else - outputformat->line_ncols = nCols; - outputformat->do_escape=display_escape; - /* print the matrix indices */ - outputformat->pindex=display_index; - - /* do not print indices for regions */ - if(obj_data == DATASET_DATA) { - hid_t f_type = H5Dget_type(obj_id); - - if (H5Tequal(f_type, H5T_STD_REF_DSETREG)) { - /* For the region option, correct the display of indices */ - if (display_region) { - if (display_index) { - outputformat->pindex = 1; - outputformat->idx_fmt = "(%s): "; - outputformat->idx_n_fmt = HSIZE_T_FORMAT; - outputformat->idx_sep = ","; - outputformat->line_pre = "%s"; - } - else { - outputformat->pindex = 0; - outputformat->idx_fmt = ""; - outputformat->idx_n_fmt = ""; - outputformat->idx_sep = ""; - outputformat->line_pre = ""; - } - } - else - outputformat->pindex = 0; - } - H5Tclose(f_type); - } - - if (outputformat->pindex) { - outputformat->idx_fmt = "(%s): "; - outputformat->idx_n_fmt = HSIZE_T_FORMAT; - outputformat->idx_sep = ","; - outputformat->line_pre = "%s"; - } - - indent += COL; - - /* - * the depth will tell us how far we need to indent extra. we use to just - * use indent but with the merging of the tools lib we have to do - * something different for the lib funtions... the normal indentation is 6 - * so when we don't need any extra indentation, depth will be 0. - */ - depth = indent / stdindent + 1; - - if (sset && obj_data == DATASET_DATA) { - hid_t f_space = H5Dget_space(obj_id); - - dump_subsetting_header(sset, H5Sget_simple_extent_ndims(f_space)); - H5Sclose(f_space); - - /* recalculate the depth of the data */ - depth = indent / stdindent + 1; - } - - indentation(indent); - begin_obj(dump_header_format->databegin, (const char *)NULL, dump_header_format->datablockbegin); - - /* Print all the values. */ - if(obj_data == DATASET_DATA) { - h5tool_format_t string_dataformat; - char string_prefix[64]; - hid_t f_type = H5Dget_type(obj_id); - - if((display_char && H5Tget_size(f_type) == 1) && (H5Tget_class(f_type) == H5T_INTEGER)) { - /* - * Print 1-byte integer data as an ASCII character string - * instead of integers if the `-r' or `--string' command-line - * option was given. - * - * We don't want to modify the global dataformat, so make a - * copy of it instead. - */ - string_dataformat = *outputformat; - string_dataformat.idx_fmt = " "; - string_dataformat.line_multi_new = 1; - string_dataformat.line_1st = " %s\""; - string_dataformat.line_pre = " %s"; - string_dataformat.line_cont = " %s"; - string_dataformat.str_repeat = 8; - string_dataformat.ascii = TRUE; - string_dataformat.elmt_suf1 = ""; - string_dataformat.elmt_suf2 = ""; - string_dataformat.line_indent = ""; - strcpy(string_prefix, string_dataformat.line_pre); - strcat(string_prefix, "\""); - string_dataformat.line_pre = string_prefix; - string_dataformat.line_suf = "\""; - outputformat = &string_dataformat; - } - - status = h5tools_dump_dset(stdout, outputformat, obj_id, -1, sset, depth); - - H5Tclose(f_type); - } - else { - /* need to call h5tools_dump_mem for the attribute data */ - space = H5Aget_space(obj_id); - space_type = H5Sget_simple_extent_type(space); - if(space_type == H5S_NULL || space_type == H5S_NO_CLASS) { - status = SUCCEED; - } - else { - char string_prefix[64]; - h5tool_format_t string_dataformat; - /* VL data special information */ - unsigned int vl_data = 0; /* contains VL datatypes */ - - type = H5Aget_type(obj_id); - p_type = h5tools_get_native_type(type); - - ndims = H5Sget_simple_extent_dims(space, size, NULL); - - /* Check if we have VL data in the dataset's datatype */ - if (h5tools_detect_vlen_str(p_type) == TRUE) - vl_data = TRUE; - if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) - vl_data = TRUE; - - for (i = 0; i < ndims; i++) - nelmts *= size[i]; - - alloc_size = nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)); - assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ - - if(alloc_size) { - buf = malloc((size_t)alloc_size); - assert(buf); - - if (H5Aread(obj_id, p_type, buf) >= 0) - if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) { - /* - * Print 1-byte integer data as an ASCII character string - * instead of integers if the `-r' or `--string' command-line - * option was given. - * - * We don't want to modify the global dataformat, so make a - * copy of it instead. - */ - string_dataformat = *outputformat; - string_dataformat.idx_fmt = " "; - string_dataformat.line_multi_new = 1; - string_dataformat.line_1st = " %s\""; - string_dataformat.line_pre = " %s"; - string_dataformat.line_cont = " %s"; - string_dataformat.str_repeat = 8; - string_dataformat.ascii = TRUE; - string_dataformat.elmt_suf1 = ""; - string_dataformat.elmt_suf2 = ""; - string_dataformat.line_indent = ""; - strcpy(string_prefix, string_dataformat.line_pre); - strcat(string_prefix, "\""); - string_dataformat.line_pre = string_prefix; - string_dataformat.line_suf = "\""; - outputformat = &string_dataformat; - } - - status = h5tools_dump_mem(stdout, outputformat, obj_id, p_type, space, buf, depth); - - /* Reclaim any VL memory, if necessary */ - if (vl_data) - H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf); - - free(buf); - } - else - status = SUCCEED; - - H5Tclose(p_type); - H5Tclose(type); - } - H5Sclose(space); - } - - if (status == FAIL) { - indentation(indent + COL); - error_msg("unable to print data\n"); - h5tools_setstatus(EXIT_FAILURE); - } - - indentation(indent); - end_obj(dump_header_format->dataend, dump_header_format->datablockend); - indent -= COL; - - if (sset && obj_data == DATASET_DATA) { - indentation(indent); - end_obj(dump_header_format->subsettingend, dump_header_format->subsettingblockend); - indent -= COL; - } -} - -/*------------------------------------------------------------------------- - * Function: dump_oid - * - * Purpose: Prints the object ids - * - * Return: void - * - * Programmer: Patrick Lu - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -dump_oid(hid_t oid) -{ - indentation(indent + COL); - HDfprintf(stdout, "%s %s %d %s\n", OBJID, BEGIN, oid, END); -} - -/*------------------------------------------------------------------------- - * Function: dump_packed_bits - * - * Purpose: Prints the packed bits offset and length - * - * Return: void - * - *------------------------------------------------------------------------- - */ -static void -dump_packed_bits(unsigned int packed_index, hid_t type) -{ - int packed_bits_size = 0; - - hid_t n_type = h5tools_get_native_type(type); - if(H5Tget_class(n_type)==H5T_INTEGER) { - if(H5Tequal(n_type, H5T_NATIVE_SCHAR) == TRUE) { - packed_bits_size = 8 * sizeof(char); - } - else if(H5Tequal(n_type, H5T_NATIVE_UCHAR) == TRUE) { - packed_bits_size = 8 * sizeof(unsigned char); - } - else if(H5Tequal(n_type, H5T_NATIVE_SHORT) == TRUE) { - packed_bits_size = 8 * sizeof(short); - } - else if(H5Tequal(n_type, H5T_NATIVE_USHORT) == TRUE) { - packed_bits_size = 8 * sizeof(unsigned short); - } - else if(H5Tequal(n_type, H5T_NATIVE_INT) == TRUE) { - packed_bits_size = 8 * sizeof(int); - } - else if(H5Tequal(n_type, H5T_NATIVE_UINT) == TRUE) { - packed_bits_size = 8 * sizeof(unsigned int); - } - else if(H5Tequal(n_type, H5T_NATIVE_LONG) == TRUE) { - packed_bits_size = 8 * sizeof(long); - } - else if(H5Tequal(n_type, H5T_NATIVE_ULONG) == TRUE) { - packed_bits_size = 8 * sizeof(unsigned long); - } - else if(H5Tequal(n_type, H5T_NATIVE_LLONG) == TRUE) { - packed_bits_size = 8 * sizeof(long long); - } - else if(H5Tequal(n_type, H5T_NATIVE_ULLONG) == TRUE) { - packed_bits_size = 8 * sizeof(unsigned long long); - } - else - error_msg("Packed Bit not valid for this datatype"); - } - indentation(indent + COL); - if ((packed_bits_size>0) && (packed_offset[packed_index] + packed_length[packed_index]) > packed_bits_size) { - error_msg("Packed Bit offset+length value(%d) too large. Max is %d\n", - packed_offset[packed_index]+packed_length[packed_index], packed_bits_size); - packed_mask[packed_index] = 0; - }; - HDfprintf(stdout, "%s %s=%d %s=%d\n", PACKED_BITS, PACKED_OFFSET, packed_offset[packed_index], PACKED_LENGTH, packed_length[packed_index]); -} - -/*------------------------------------------------------------------------- - * Function: dump_comment - * - * Purpose: prints the comment for the the object name - * - * Return: void - * - * Programmer: pvn - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -dump_comment(hid_t obj_id) -{ - size_t buf_size = 0; - ssize_t cmt_bufsize = -1; - char *comment = NULL; - - cmt_bufsize = H5Oget_comment(obj_id, comment, buf_size); - - /* call H5Oget_comment again with the correct value. - * If the call to H5Oget_comment returned an error, skip this block */ - if (cmt_bufsize > 0) { - comment = (char *)HDmalloc((size_t)(cmt_bufsize+1)); /* new_size including null terminator */ - if(comment) { - cmt_bufsize = H5Oget_comment(obj_id, comment, cmt_bufsize); - if(cmt_bufsize > 0) { - comment[cmt_bufsize] = '\0'; /* necessary because null char is not returned */ - indentation(indent); - HDfprintf(stdout, "COMMENT \"%s\"\n", comment); - } /* end if */ - HDfree(comment); - } - } - -} /* end dump_comment() */ - - -/*------------------------------------------------------------------------- - * Function: dump_fill_value - * - * Purpose: prints the fill value - * - * Return: void - * - * Programmer: pvn - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void dump_fill_value(hid_t dcpl,hid_t type_id, hid_t obj_id) -{ - h5tools_context_t ctx; /* print context */ - size_t size; - hid_t n_type; - hsize_t nelmts = 1; - void *buf = NULL; - h5tool_format_t *outputformat = &dataformat; - - memset(&ctx, 0, sizeof(ctx)); - ctx.indent_level=2; - - n_type = h5tools_get_native_type(type_id); - - size = H5Tget_size(n_type); - buf = malloc(size); - - H5Pget_fill_value(dcpl, n_type, buf); - - h5tools_dump_simple_data(stdout, outputformat, obj_id, &ctx, START_OF_DATA | END_OF_DATA, nelmts, n_type, buf); - - H5Tclose(n_type); - - if (buf) - free (buf); -} - - -/*------------------------------------------------------------------------- - * Function: dump_dcpl - * - * Purpose: prints several dataset create property list properties - * - * Return: void - * - * Programmer: pvn - * - * Modifications: pvn, March 28, 2008 - * Add a COMPRESSION ratio information for cases when filters are present - * - *------------------------------------------------------------------------- - */ -static void -dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) -{ - int nfilters; /* number of filters */ - unsigned filt_flags; /* filter flags */ - H5Z_filter_t filtn; /* filter identification number */ - unsigned cd_values[20]; /* filter client data values */ - size_t cd_nelmts; /* filter client number of values */ - char f_name[256]; /* filter name */ - unsigned szip_options_mask; - unsigned szip_pixels_per_block; - hsize_t chsize[64]; /* chunk size in elements */ - int rank; /* rank */ - char name[256]; /* external file name */ - off_t offset; /* offset of external file */ - hsize_t size; /* size of external file */ - H5D_fill_value_t fvstatus; - H5D_alloc_time_t at; - H5D_fill_time_t ft; - hsize_t storage_size; - haddr_t ioffset; - int i; - unsigned j; - - storage_size = H5Dget_storage_size(obj_id); - nfilters = H5Pget_nfilters(dcpl_id); - ioffset = H5Dget_offset(obj_id); - HDstrcpy(f_name,"\0"); - - /*------------------------------------------------------------------------- - * STORAGE_LAYOUT - *------------------------------------------------------------------------- - */ - indentation(indent + COL); - HDfprintf(stdout, "%s %s\n", STORAGE_LAYOUT, BEGIN); - - if (H5D_CHUNKED == H5Pget_layout(dcpl_id)) { - /*start indent */ - indent += COL; - indentation(indent + COL); - HDfprintf(stdout, "%s ", CHUNKED); - - rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize); - HDfprintf(stdout,"%s %Hu", dump_header_format->dataspacedimbegin, chsize[0]); - for (i=1; idataspacedimend); - indentation(indent + COL); - - /* if there are filters, print a compression ratio */ - if (nfilters) { - hsize_t dims[H5S_MAX_RANK]; - hsize_t nelmts = 1; - double ratio = 0; - int ok = 0; - - hid_t tid = H5Dget_type(obj_id); - hid_t sid = H5Dget_space(obj_id); - size_t datum_size = H5Tget_size(tid); - int ndims = H5Sget_simple_extent_dims(sid, dims, NULL); - - /* only print the compression ratio for these filters */ - for (i = 0; i < nfilters; i++) { - cd_nelmts = NELMTS(cd_values); - filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, - cd_values, sizeof(f_name), f_name, NULL); - - switch (filtn) { - case H5Z_FILTER_DEFLATE: - case H5Z_FILTER_SZIP: - case H5Z_FILTER_NBIT: - case H5Z_FILTER_SCALEOFFSET: - ok = 1; - break; - } - } - - if (ndims && ok) { - hsize_t uncomp_size; - - for (i = 0; i < ndims; i++) { - nelmts *= dims[i]; - } - uncomp_size = nelmts * datum_size; - - /* compression ratio = uncompressed size / compressed size */ - - if (storage_size != 0) - ratio = (double) uncomp_size / (double) storage_size; - - HDfprintf(stdout, "SIZE %Hu (%.3f:1 COMPRESSION)\n ", storage_size, ratio); - - } - else - HDfprintf(stdout, "SIZE %Hu\n ", storage_size); - - H5Sclose(sid); - H5Tclose(tid); - - } - else { - HDfprintf(stdout, "SIZE %Hu\n ", storage_size); - } - - /*end indent */ - indent -= COL; - indentation(indent + COL); - HDfprintf(stdout, "%s\n",END); - } - else if (H5D_COMPACT == H5Pget_layout(dcpl_id)) { - /*start indent */ - indent += COL; - indentation(indent + COL); - HDfprintf(stdout, "%s\n", COMPACT); - - indentation(indent + COL); - HDfprintf(stdout, "SIZE %Hu\n", storage_size); - - /*end indent */ - indent -= COL; - indentation(indent + COL); - HDfprintf(stdout, "%s\n",END); - } - else if (H5D_CONTIGUOUS == H5Pget_layout(dcpl_id)) { - int next; - - next = H5Pget_external_count(dcpl_id); - - /*------------------------------------------------------------------------- - * EXTERNAL_FILE - *------------------------------------------------------------------------- - */ - if (next) { - /*start indent */ - indent += COL; - indentation(indent + COL); - HDfprintf(stdout, "%s\n", CONTIGUOUS); - - indentation(indent + COL); - HDfprintf(stdout, "%s %s\n", EXTERNAL, BEGIN); - - /*start indent */ - indent += COL; - for ( j=0; j<(unsigned)next; j++) { - H5Pget_external(dcpl_id,j,sizeof(name),name,&offset,&size); - indentation(indent + COL); - HDfprintf(stdout,"FILENAME %s SIZE %Hu OFFSET %ld\n",name,size,offset); - } - /*end indent */ - indent -= COL; - indentation(indent + COL); - HDfprintf(stdout, "%s\n",END); - - /*end indent */ - indent -= COL; - indentation(indent + COL); - HDfprintf(stdout, "%s\n",END); - } - else { - /*start indent */ - indent += COL; - indentation(indent + COL); - HDfprintf(stdout, "%s\n", CONTIGUOUS); - - indentation(indent + COL); - HDfprintf(stdout,"SIZE %Hu\n", storage_size); - indentation(indent + COL); - HDfprintf(stdout,"OFFSET %Hu\n", ioffset); - - /*end indent */ - indent -= COL; - indentation(indent + COL); - HDfprintf(stdout, "%s\n",END); - } - } - /*------------------------------------------------------------------------- - * FILTERS - *------------------------------------------------------------------------- - */ - indentation(indent + COL); - HDfprintf(stdout, "%s %s\n", FILTERS, BEGIN); - indent += COL; - - if (nfilters) { - for (i=0; inobjs; u++) { - if (!type_table->objs[u].recorded) - HDfprintf(stdout, " %-10s /#"H5_PRINTF_HADDR_FMT"\n", "datatype", type_table->objs[u].objno); - } - } - - /* print objects in the files */ - h5trav_print(fid); - - HDfprintf(stdout, " %s\n",END); -} - -/*------------------------------------------------------------------------- - * Function: set_output_file - * - * Purpose: Open fname as the output file for dataset raw data. - * Set rawdatastream as its file stream. - * - * Return: 0 -- succeeded - * negative -- failed - * - * Programmer: Albert Cheng, 2000/09/30 - * - * Modifications: - * pvn June, 1, 2006. Add a switch for binary output - * - *------------------------------------------------------------------------- - */ -static int -set_output_file(const char *fname, int is_bin) -{ - FILE *f; /* temporary holding place for the stream pointer - * so that rawdatastream is changed only when succeeded */ - - if (rawdatastream && rawdatastream != stdout) { - if (fclose(rawdatastream)) - perror("closing rawdatastream"); - else - rawdatastream = NULL; - } - - /* binary output */ - if (is_bin) { - if ((f = fopen(fname, "wb")) != NULL) { - rawdatastream = f; - return 0; - } - } - else { - if ((f = fopen(fname, "w")) != NULL) { - rawdatastream = f; - return 0; - } - } - - return -1; -} - -/*------------------------------------------------------------------------- - * Function: set_binary_form - * - * Purpose: set the binary form of output by translating from a string input - * parameter to a integer return value - * - * Return: integer form of binary output or -1 if none found - * - * Programmer: Pedro Vicente Nunes - * June 28, 2006 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static int -set_binary_form(const char *form) -{ - int bform = -1; - - if (strcmp(form,"NATIVE") == 0 || strcmp(form,"MEMORY") == 0) { - /* native form */ - bform = 0; - } - else if (strcmp(form,"FILE") == 0) /* file type form */ - bform = 1; - else if (strcmp(form,"LE") == 0) /* convert to little endian */ - bform = 2; - else if (strcmp(form,"BE") == 0) /* convert to big endian */ - bform = 3; - - return bform; -} - -/*------------------------------------------------------------------------- - * Function: set_sort_by - * - * Purpose: set the "by" form of sorting by translating from a string input - * parameter to a H5_index_t return value - * current sort values are [creation_order | name] - * - * Return: H5_index_t form of sort or H5_INDEX_UNKNOWN if none found - * - * Programmer: Pedro Vicente Nunes - * October 1, 2007 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static H5_index_t -set_sort_by(const char *form) -{ - H5_index_t idx_type = H5_INDEX_UNKNOWN; - - if (strcmp(form,"name")==0) /* H5_INDEX_NAME */ - idx_type = H5_INDEX_NAME; - else if (strcmp(form,"creation_order")==0) /* H5_INDEX_CRT_ORDER */ - idx_type = H5_INDEX_CRT_ORDER; - - return idx_type; -} - -/*------------------------------------------------------------------------- - * Function: set_sort_order - * - * Purpose: set the order of sorting by translating from a string input - * parameter to a H5_iter_order_t return value - * current order values are [ascending | descending ] - * - * Return: H5_iter_order_t form of order or H5_ITER_UNKNOWN if none found - * - * Programmer: Pedro Vicente Nunes - * October 1, 2007 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static H5_iter_order_t -set_sort_order(const char *form) -{ - H5_iter_order_t iter_order = H5_ITER_UNKNOWN; - - if (strcmp(form,"ascending")==0) /* H5_ITER_INC */ - iter_order = H5_ITER_INC; - else if (strcmp(form,"descending")==0) /* H5_ITER_DEC */ - iter_order = H5_ITER_DEC; - - return iter_order; -} - -/*------------------------------------------------------------------------- - * Function: handle_attributes - * - * Purpose: Handle the attributes from the command. - * - * Return: void - * - * Programmer: Bill Wendling - * Tuesday, 9. January 2001 - * - * Modifications: - * - * PVN, May 2008 - * add an extra parameter PE, to allow printing/not printing of error messages - * - *------------------------------------------------------------------------- - */ -static void -handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe, const char UNUSED *display_name) -{ - dump_selected_attr(fid, attr); -} - -/*------------------------------------------------------------------------- - * Function: parse_hsize_list - * - * Purpose: Parse a list of comma or space separated integers and return - * them in a list. The string being passed into this function - * should be at the start of the list you want to parse. You are - * responsible for freeing the array returned from here. - * - * Lists in the so-called "terse" syntax are separated by - * semicolons (;). The lists themselves can be separated by - * either commas (,) or white spaces. - * - * Return: - * - * Programmer: Bill Wendling - * Tuesday, 6. February 2001 - * - *------------------------------------------------------------------------- - */ -static void -parse_hsize_list(const char *h_list, subset_d *d) -{ - hsize_t *p_list; - const char *ptr; - unsigned int size_count = 0; - unsigned int i = 0; - unsigned int last_digit = 0; - - if (!h_list || !*h_list || *h_list == ';') - return; - - /* count how many integers do we have */ - for (ptr = h_list; ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) - if (isdigit(*ptr)) { - if (!last_digit) - /* the last read character wasn't a digit */ - size_count++; - - last_digit = 1; - } - else { - last_digit = 0; - } - - if (size_count == 0) - /* there aren't any integers to read */ - return; - - /* allocate an array for the integers in the list */ - p_list = (hsize_t *)calloc(size_count, sizeof(hsize_t)); - - for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) - if(isdigit(*ptr)) { - /* we should have an integer now */ - p_list[i++] = (hsize_t)atof(ptr); - - while (isdigit(*ptr)) - /* scroll to end of integer */ - ptr++; - } - d->data = p_list; - d->len = size_count; - - return; -} - -/*------------------------------------------------------------------------- - * Function: parse_subset_params - * - * Purpose: Parse the so-called "terse" syntax for specifying subsetting - * parameters. - * - * Return: Success: struct subset_t object - * Failure: NULL - * - * Programmer: Bill Wendling - * Tuesday, 6. February 2001 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static struct subset_t * -parse_subset_params(char *dset) -{ - struct subset_t *s = NULL; - register char *brace; - - if (!disable_compact_subset && ((brace = strrchr(dset, '[')) != NULL)) { - *brace++ = '\0'; - - s = (struct subset_t *)calloc(1, sizeof(struct subset_t)); - parse_hsize_list(brace, &s->start); - - while (*brace && *brace != ';') - brace++; - - if (*brace) brace++; - - parse_hsize_list(brace, &s->stride); - - while (*brace && *brace != ';') - brace++; - - if (*brace) brace++; - - parse_hsize_list(brace, &s->count); - - while (*brace && *brace != ';') - brace++; - - if (*brace) brace++; - - parse_hsize_list(brace, &s->block); - } - - return s; -} - -/*------------------------------------------------------------------------- - * Function: parse_mask_list - * - * Purpose: Parse a list of comma or space separated integers and fill - * the packed_bits list and counter. The string being passed into this function - * should be at the start of the list you want to parse. - * - * Return: Success: SUCCEED - * - * Failure: FAIL - * - * - *------------------------------------------------------------------------- - */ -static int -parse_mask_list(const char *h_list) -{ - int offset_value; - int length_value; - unsigned long long temp_mask; - const char *ptr = NULL; - - /* sanity check */ - HDassert(h_list); - - HDmemset(packed_mask,0,sizeof(packed_mask)); - - packed_bits_num = 0; - /* scan in pair of offset,length separated by commas. */ - ptr = h_list; - while (*ptr) { - /* scan for an offset which is an unsigned int */ - if (!HDisdigit(*ptr)) { - error_msg("Bad mask list(%s)\n", h_list); - return FAIL; - } - offset_value = HDatoi(ptr); - if (offset_value < 0 || offset_value >= PACKED_BITS_SIZE_MAX) { - error_msg("Packed Bit offset value(%d) must be between 0 and %d\n", - offset_value, PACKED_BITS_SIZE_MAX - 1); - return FAIL; - } - - /* skip to end of integer */ - while (HDisdigit(*++ptr)) - ; - /* Look for the common separator */ - if (*ptr++ != ',') { - error_msg("Bad mask list(%s), missing expected comma separator.\n", h_list); - return FAIL; - } - - /* scan for a length which is a positive int */ - if (!HDisdigit(*ptr)) { - error_msg("Bad mask list(%s)\n", h_list); - return FAIL; - } - length_value = HDatoi(ptr); - if (length_value <= 0) { - error_msg("Packed Bit length value(%d) must be positive.\n", length_value); - return FAIL; - } - if ((offset_value + length_value) > PACKED_BITS_SIZE_MAX){ - error_msg("Packed Bit offset+length value(%d) too large. Max is %d\n", - offset_value+length_value, PACKED_BITS_SIZE_MAX); - return FAIL; - } - - /* skip to end of int */ - while (HDisdigit(*++ptr)) - ; - - /* store the offset,length pair */ - if (packed_bits_num >= PACKED_BITS_MAX) { - /* too many requests */ - error_msg("Too many masks requested (max. %d). Mask list(%s)\n", PACKED_BITS_MAX, h_list); - return FAIL; - } - packed_offset[packed_bits_num] = offset_value; - packed_length[packed_bits_num] = length_value; - /* create the bit mask by left shift 1's by length, then negate it. */ - /* After packed_mask is calculated, packed_length is not needed but */ - /* keep it for debug purpose. */ - temp_mask = ~0L; - if(length_value<8*sizeof(unsigned long long)) { - temp_mask = temp_mask << length_value; - packed_mask[packed_bits_num] = ~temp_mask; - } - else - packed_mask[packed_bits_num] = temp_mask; - packed_bits_num++; - - /* skip a possible comma separator */ - if (*ptr == ',') { - if (!(*++ptr)) { - /* unexpected end of string */ - error_msg("Bad mask list(%s), unexpected end of string.\n", h_list); - return FAIL; - } - } - } - HDassert(packed_bits_num <= PACKED_BITS_MAX); - if (packed_bits_num == 0) { - /* got no masks! */ - error_msg("Bad mask list(%s)\n", h_list); - return FAIL; - } - return SUCCEED; -} - -/*------------------------------------------------------------------------- - * Function: handle_datasets - * - * Purpose: Handle the datasets from the command. - * - * Return: void - * - * Programmer: Bill Wendling - * Tuesday, 9. January 2001 - * - * Modifications: - * Pedro Vicente, Tuesday, January 15, 2008 - * check for block overlap\ - * - * Pedro Vicente, May 8, 2008 - * added a flag PE that prints/not prints error messages - * added for cases of external links not found, to avoid printing of - * objects not found, since external links are dumped on a trial error basis - * - *------------------------------------------------------------------------- - */ -static void -handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *display_name) -{ - H5O_info_t oinfo; - hid_t dsetid; - struct subset_t *sset = (struct subset_t *)data; - const char *real_name = display_name ? display_name : dset; - - if((dsetid = H5Dopen2(fid, dset, H5P_DEFAULT)) < 0) { - if (pe) { - begin_obj(dump_header_format->datasetbegin, real_name, dump_header_format->datasetblockbegin); - indentation(COL); - error_msg("unable to open dataset \"%s\"\n", real_name); - end_obj(dump_header_format->datasetend, dump_header_format->datasetblockend); - h5tools_setstatus(EXIT_FAILURE); - } - return; - } /* end if */ - - if(sset) { - unsigned int i; - hid_t sid = H5Dget_space(dsetid); - int ndims = H5Sget_simple_extent_ndims(sid); - - H5Sclose(sid); - if(ndims < 0) { - error_msg("H5Sget_simple_extent_ndims failed\n"); - h5tools_setstatus(EXIT_FAILURE); - return; - } - - if(!sset->start.data || !sset->stride.data || !sset->count.data || !sset->block.data) { - /* they didn't specify a ``stride'' or ``block''. default to 1 in all - * dimensions */ - if(!sset->start.data) { - /* default to (0, 0, ...) for the start coord */ - sset->start.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); - sset->start.len = ndims; - } - - if(!sset->stride.data) { - sset->stride.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); - sset->stride.len = ndims; - for (i = 0; i < ndims; i++) - sset->stride.data[i] = 1; - } - - if(!sset->count.data) { - sset->count.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); - sset->count.len = ndims; - for (i = 0; i < ndims; i++) - sset->count.data[i] = 1; - } - - if(!sset->block.data) { - sset->block.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); - sset->block.len = ndims; - for (i = 0; i < ndims; i++) - sset->block.data[i] = 1; - } - } - - /*------------------------------------------------------------------------- - * check for dimension overflow - *------------------------------------------------------------------------- - */ - if(sset->start.len > ndims) { - error_msg("number of start dims (%u) exceed dataset dims (%u)\n", sset->start.len, ndims); - h5tools_setstatus(EXIT_FAILURE); - return; - } - if(sset->stride.len > ndims) { - error_msg("number of stride dims (%u) exceed dataset dims (%u)\n", sset->stride.len, ndims); - h5tools_setstatus(EXIT_FAILURE); - return; - } - if(sset->count.len > ndims) { - error_msg("number of count dims (%u) exceed dataset dims (%u)\n", sset->count.len, ndims); - h5tools_setstatus(EXIT_FAILURE); - return; - } - if(sset->block.len > ndims) { - error_msg("number of block dims (%u) exceed dataset dims (%u)\n", sset->block.len, ndims); - h5tools_setstatus(EXIT_FAILURE); - return; - } - - /*------------------------------------------------------------------------- - * check for block overlap - *------------------------------------------------------------------------- - */ - for(i = 0; i < ndims; i++) { - if(sset->count.data[i] > 1) { - if(sset->stride.data[i] < sset->block.data[i]) { - error_msg("wrong subset selection; blocks overlap\n"); - h5tools_setstatus(EXIT_FAILURE); - return; - } /* end if */ - } /* end if */ - } /* end for */ - } /* end if */ - - - H5Oget_info(dsetid, &oinfo); - if(oinfo.rc > 1 || hit_elink) { - obj_t *found_obj; /* Found object */ - - found_obj = search_obj(dset_table, oinfo.addr); - - if(found_obj) { - if (found_obj->displayed) { - indentation(indent); - begin_obj(dump_header_format->datasetbegin, real_name, dump_header_format->datasetblockbegin); - indentation(indent + COL); - HDfprintf(stdout, "%s \"%s\"\n", HARDLINK, found_obj->objname); - indentation(indent); - end_obj(dump_header_format->datasetend, dump_header_format->datasetblockend); - } - else { - found_obj->displayed = TRUE; - dump_dataset(dsetid, real_name, sset); - } - } - else - h5tools_setstatus(EXIT_FAILURE); - } - else - dump_dataset(dsetid, real_name, sset); - - if(H5Dclose(dsetid) < 0) - h5tools_setstatus(EXIT_FAILURE); -} - -/*------------------------------------------------------------------------- - * Function: handle_groups - * - * Purpose: Handle the groups from the command. - * - * Return: void - * - * Programmer: Bill Wendling - * Tuesday, 9. January 2001 - * - * Modifications: Pedro Vicente, September 26, 2007 - * handle creation order - * - * Pedro Vicente, May 8, 2008 - * added a flag PE that prints/not prints error messages - * added for cases of external links not found, to avoid printing of - * objects not found, since external links are dumped on a trial error basis - * - *------------------------------------------------------------------------- - */ -static void -handle_groups(hid_t fid, const char *group, void UNUSED *data, int pe, const char *display_name) -{ - hid_t gid; - const char *real_name = display_name ? display_name : group; - - if((gid = H5Gopen2(fid, group, H5P_DEFAULT)) < 0) { - if (pe) { - begin_obj(dump_header_format->groupbegin, real_name, dump_header_format->groupblockbegin); - indentation(COL); - error_msg("unable to open group \"%s\"\n", real_name); - end_obj(dump_header_format->groupend, dump_header_format->groupblockend); - h5tools_setstatus(EXIT_FAILURE); - } - } - else { - size_t new_len = HDstrlen(group) + 1; - - if(prefix_len <= new_len) { - prefix_len = new_len; - prefix = (char *)HDrealloc(prefix, prefix_len); - } /* end if */ - - HDstrcpy(prefix, group); - - dump_group(gid, real_name); - - if(H5Gclose(gid) < 0) - h5tools_setstatus(EXIT_FAILURE); - } /* end else */ -} /* end handle_groups() */ - -/*------------------------------------------------------------------------- - * Function: handle_links - * - * Purpose: Handle soft or UD links from the command. - * - * Return: void - * - * Programmer: Bill Wendling - * Tuesday, 9. January 2001 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, const char UNUSED *display_name) -{ - H5L_info_t linfo; - - if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) { - error_msg("unable to get link info from \"%s\"\n", links); - h5tools_setstatus(EXIT_FAILURE); - } - else if(linfo.type == H5L_TYPE_HARD) { - error_msg("\"%s\" is a hard link\n", links); - h5tools_setstatus(EXIT_FAILURE); - } - else { - char *buf = (char *)HDmalloc(linfo.u.val_size); - - switch(linfo.type) { - case H5L_TYPE_SOFT: /* Soft link */ - begin_obj(dump_header_format->softlinkbegin, links, dump_header_format->softlinkblockbegin); - indentation(COL); - if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) - HDfprintf(stdout, "LINKTARGET \"%s\"\n", buf); - else { - error_msg("h5dump error: unable to get link value for \"%s\"\n", links); - h5tools_setstatus(EXIT_FAILURE); - } - end_obj(dump_header_format->softlinkend, dump_header_format->softlinkblockend); - break; - - case H5L_TYPE_EXTERNAL: - begin_obj(dump_header_format->udlinkbegin, links, dump_header_format->udlinkblockbegin); - indentation(COL); - begin_obj(dump_header_format->extlinkbegin, links, dump_header_format->extlinkblockbegin); - if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) { - const char *elink_file; - const char *elink_path; - - if(H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &elink_file, &elink_path)>=0) { - indentation(COL); - HDfprintf(stdout, "LINKCLASS %d\n", linfo.type); - indentation(COL); - HDfprintf(stdout, "TARGETFILE \"%s\"\n", elink_file); - indentation(COL); - HDfprintf(stdout, "TARGETPATH \"%s\"\n", elink_path); - } - else { - error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links); - h5tools_setstatus(EXIT_FAILURE); - } - } - else { - error_msg("h5dump error: unable to get external link value for \"%s\"\n", links); - h5tools_setstatus(EXIT_FAILURE); - } - end_obj(dump_header_format->extlinkend, dump_header_format->extlinkblockend); - break; - - default: - begin_obj(dump_header_format->udlinkbegin, links, dump_header_format->udlinkblockbegin); - indentation(COL); - begin_obj(dump_header_format->udlinkbegin, links, dump_header_format->udlinkblockbegin); - indentation(COL); - HDfprintf(stdout, "LINKCLASS %d\n", linfo.type); - end_obj(dump_header_format->udlinkend, dump_header_format->udlinkblockend); - break; - } /* end switch */ - HDfree(buf); - } /* end else */ -} - -/*------------------------------------------------------------------------- - * Function: handle_datatypes - * - * Purpose: Handle the datatypes from the command. - * - * Return: void - * - * Programmer: Bill Wendling - * Tuesday, 9. January 2001 - * - * Modifications: - * - * Pedro Vicente, May 8, 2008 - * added a flag PE that prints/not prints error messages - * added for cases of external links not found, to avoid printing of - * objects not found, since external links are dumped on a trial error basis - * - *------------------------------------------------------------------------- - */ -static void -handle_datatypes(hid_t fid, const char *type, void UNUSED * data, int pe, const char *display_name) -{ - hid_t type_id; - const char *real_name = display_name ? display_name : type; - - if((type_id = H5Topen2(fid, type, H5P_DEFAULT)) < 0) { - /* check if type is unamed datatype */ - unsigned idx = 0; - - while(idx < type_table->nobjs ) { - char name[128]; - - if(!type_table->objs[idx].recorded) { - /* unamed datatype */ - sprintf(name, "/#"H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno); - - if(!HDstrcmp(name, real_name)) - break; - } /* end if */ - - idx++; - } /* end while */ - - if(idx == type_table->nobjs) { - if (pe) { - /* unknown type */ - begin_obj(dump_header_format->datatypebegin, real_name, dump_header_format->datatypeblockbegin); - indentation(COL); - error_msg("unable to open datatype \"%s\"\n", real_name); - end_obj(dump_header_format->datatypeend, dump_header_format->datatypeblockend); - h5tools_setstatus(EXIT_FAILURE); - } - } - else { - hid_t dsetid = H5Dopen2(fid, type_table->objs[idx].objname, H5P_DEFAULT); - type_id = H5Dget_type(dsetid); - dump_named_datatype(type_id, real_name); - H5Tclose(type_id); - H5Dclose(dsetid); - } - } - else { - dump_named_datatype(type_id, real_name); - - if(H5Tclose(type_id) < 0) - h5tools_setstatus(EXIT_FAILURE); - } -} - - -/*------------------------------------------------------------------------- - * Function: free_handler - * - * Purpose: Convenience function to free the handler_t structures. Needs a - * length variable (LEN) to know how many in the array it needs - * to free - * - * Return: Nothing - * - * Programmer: Bill Wendling - * Tuesday, 20. February 2001 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -free_handler(struct handler_t *hand, int len) -{ - register int i; - - if(hand) { - for (i = 0; i < len; i++) { - if(hand[i].obj) { - free(hand[i].obj); - hand[i].obj=NULL; - } - - if (hand[i].subset_info) { - if(hand[i].subset_info->start.data) - free(hand[i].subset_info->start.data); - if(hand[i].subset_info->stride.data) - free(hand[i].subset_info->stride.data); - if(hand[i].subset_info->count.data) - free(hand[i].subset_info->count.data); - if(hand[i].subset_info->block.data) - free(hand[i].subset_info->block.data); - - free(hand[i].subset_info); - hand[i].subset_info=NULL; - } - } - - free(hand); - } -} - - -/*------------------------------------------------------------------------- - * Function: parse_command_line - * - * Purpose: Parse the command line for the h5dumper. - * - * Return: Success: A pointer to an array of handler_t structures. - * These contain all the information needed to dump - * the necessary object. - * - * Failure: Exits program with EXIT_FAILURE value. - * - * Programmer: Bill Wendling - * Tuesday, 20. February 2001 - * - * Modifications: - * pvn June, 1, 2006. Add a switch for binary output - * - *------------------------------------------------------------------------- - */ -static struct handler_t * -parse_command_line(int argc, const char *argv[]) -{ - struct handler_t *hand = NULL; - struct handler_t *last_dset = NULL; - int i; - int opt; - int last_was_dset = FALSE; - - /* no arguments */ - if (argc == 1) { - usage(h5tools_getprogname()); - goto error; - } - - /* this will be plenty big enough to hold the info */ - if((hand = (struct handler_t *)calloc((size_t)argc, sizeof(struct handler_t)))==NULL) { - goto error; - } - - /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { -parse_start: - switch ((char)opt) { - case 'R': - display_region = TRUE; - region_output = TRUE; - break; - case 'B': - display_bb = TRUE; - last_was_dset = FALSE; - break; - case 'n': - display_fi = TRUE; - last_was_dset = FALSE; - break; - case 'p': - display_dcpl = TRUE; - break; - case 'y': - display_ai = FALSE; - break; - case 'e': - display_escape = TRUE; - break; - case 'H': - display_data = FALSE; - display_attr_data = FALSE; - last_was_dset = FALSE; - break; - case 'A': - display_data = FALSE; - display_attr_data = TRUE; - last_was_dset = FALSE; - break; - case 'i': - display_oid = TRUE; - last_was_dset = FALSE; - break; - case 'r': - display_char = TRUE; - break; - case 'V': - print_version(h5tools_getprogname()); - free_handler(hand, argc); - hand = NULL; - h5tools_setstatus(EXIT_SUCCESS); - goto done; - break; - case 'w': - nCols = HDatoi(opt_arg); - last_was_dset = FALSE; - break; - case 'a': - display_all = 0; - - for (i = 0; i < argc; i++) - if (!hand[i].func) { - hand[i].func = handle_attributes; - hand[i].obj = HDstrdup(opt_arg); - break; - } - - last_was_dset = FALSE; - break; - case 'd': - display_all = 0; - - for (i = 0; i < argc; i++) - if (!hand[i].func) { - hand[i].func = handle_datasets; - hand[i].obj = HDstrdup(opt_arg); - hand[i].subset_info = parse_subset_params(hand[i].obj); - last_dset = &hand[i]; - break; - } - - last_was_dset = TRUE; - break; - case 'f': - driver = opt_arg; - break; - case 'g': - display_all = 0; - - for (i = 0; i < argc; i++) - if (!hand[i].func) { - hand[i].func = handle_groups; - hand[i].obj = HDstrdup(opt_arg); - break; - } - - last_was_dset = FALSE; - break; - case 'l': - display_all = 0; - - for (i = 0; i < argc; i++) - if (!hand[i].func) { - hand[i].func = handle_links; - hand[i].obj = HDstrdup(opt_arg); - break; - } - - last_was_dset = FALSE; - break; - case 't': - display_all = 0; - - for (i = 0; i < argc; i++) - if (!hand[i].func) { - hand[i].func = handle_datatypes; - hand[i].obj = HDstrdup(opt_arg); - break; - } - - last_was_dset = FALSE; - break; - - case 'o': - if ( bin_output ) { - if (set_output_file(opt_arg, 1) < 0) { - usage(h5tools_getprogname()); - goto error; - } - } - else { - if (set_output_file(opt_arg, 0) < 0) { - usage(h5tools_getprogname()); - goto error; - } - } - - usingdasho = TRUE; - last_was_dset = FALSE; - outfname = opt_arg; - break; - - case 'b': - if ( opt_arg != NULL) { - if ( ( bin_form = set_binary_form(opt_arg)) < 0) { - /* failed to set binary form */ - usage(h5tools_getprogname()); - goto error; - } - } - bin_output = TRUE; - if (outfname!=NULL) { - if (set_output_file(outfname, 1) < 0) { - /* failed to set output file */ - usage(h5tools_getprogname()); - goto error; - } - - last_was_dset = FALSE; - } - break; - - case 'q': - if ( ( sort_by = set_sort_by(opt_arg)) < 0) { - /* failed to set "sort by" form */ - usage(h5tools_getprogname()); - goto error; - } - break; - - case 'z': - if ( ( sort_order = set_sort_order(opt_arg)) < 0) { - /* failed to set "sort order" form */ - usage(h5tools_getprogname()); - goto error; - } - break; - - case 'M': - if (!last_was_dset) { - error_msg("option `-%c' can only be used after --dataset option\n", opt); - goto error; - } - if (parse_mask_list(opt_arg) != SUCCEED){ - usage(h5tools_getprogname()); - goto error; - } - display_packed_bits = TRUE; - break; - - /** begin XML parameters **/ - case 'x': - /* select XML output */ - doxml = TRUE; - useschema = TRUE; - dump_header_format = NULL; - dump_function_table = &xml_function_table; - break; - case 'u': - doxml = TRUE; - useschema = FALSE; - xmlnsprefix = ""; - dump_header_format = NULL; - dump_function_table = &xml_function_table; - break; - case 'D': - /* specify alternative XML DTD or schema */ - /* To Do: check format of this value? */ - xml_dtd_uri = opt_arg; - break; - - case 'm': - /* specify alternative floating point printing format */ - fp_format = opt_arg; - break; - - case 'X': - /* specify XML namespace (default="hdf5:"), or none */ - /* To Do: check format of this value? */ - if (!useschema) { - usage(h5tools_getprogname()); - goto error; - } - if (strcmp(opt_arg,":") == 0) { - xmlnsprefix = ""; - } - else { - xmlnsprefix = opt_arg; - } - break; - /** end XML parameters **/ - - /** begin subsetting parameters **/ - case 's': - case 'S': - case 'c': - case 'k': { - struct subset_t *s; - - if (!last_was_dset) { - error_msg("option `-%c' can only be used after --dataset option\n", opt); - goto error; - } - - if (last_dset->subset_info) { - /* - * This overrides the "terse" syntax if they actually mixed - * the two. - */ - s = last_dset->subset_info; - } - else { - last_dset->subset_info = s = (struct subset_t *)calloc(1, sizeof(struct subset_t)); - } - - /* - * slightly convoluted, but...we are only interested in options - * for subsetting: "--start", "--stride", "--count", and "--block" - * which can come in any order. If we run out of parameters (EOF) - * or run into one which isn't a subsetting parameter (NOT s, S, - * c, or K), then we exit the do-while look, set the subset_info - * to the structure we've been filling. If we've reached the end - * of the options, we exit the parsing (goto parse_end) otherwise, - * since we've "read" the next option, we need to parse it. So we - * jump to the beginning of the switch statement (goto parse_start). - */ - do { - switch ((char)opt) { - case 's': - if (s->start.data) { - free(s->start.data); - s->start.data = NULL; - } - parse_hsize_list(opt_arg, &s->start); - break; - case 'S': - if (s->stride.data) { - free(s->stride.data); - s->stride.data = NULL; - } - parse_hsize_list(opt_arg, &s->stride); - break; - case 'c': - if (s->count.data) { - free(s->count.data); - s->count.data = NULL; - } - parse_hsize_list(opt_arg, &s->count); - break; - case 'k': - if (s->block.data) { - free(s->block.data); - s->block.data = NULL; - } - parse_hsize_list(opt_arg, &s->block); - break; - default: - goto end_collect; - } - } while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF); - -end_collect: - last_was_dset = FALSE; - - if (opt != EOF) - goto parse_start; - else - goto parse_end; - } - /** end subsetting parameters **/ - - case 'E': - enable_error_stack = TRUE; - break; - case 'C': - disable_compact_subset = TRUE; - break; - case 'h': - usage(h5tools_getprogname()); - free_handler(hand, argc); - hand = NULL; - h5tools_setstatus(EXIT_SUCCESS); - goto done; - case '?': - default: - usage(h5tools_getprogname()); - goto error; - } - } - -parse_end: - /* check for file name to be processed */ - if (argc <= opt_ind) { - error_msg("missing file name\n"); - usage(h5tools_getprogname()); - goto error; - } -done: - return hand; - -error: - if (hand) { - free_handler(hand, argc); - hand = NULL; - } - h5tools_setstatus(EXIT_FAILURE); - - return hand; -} - -/*------------------------------------------------------------------------- - * Function: main - * - * Purpose: HDF5 dumper - * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: Ruey-Hsia Li - * - * Modifications: - * Albert Cheng - * 30. September 2000 - * Add the -o option--output file for datasets raw data - * - * REMcG - * November 2000 - * Changes to support XML. - * - * Bill Wendling - * Wednesday, 10. January 2001 - * Modified the way command line parameters are interpreted. They go - * through one function call now (get_option). - * - * Bill Wendling - * Tuesday, 20. February 2001 - * Moved command line parsing to separate function. Made various - * "display_*" flags global. - * - * REMcG - * August 2003 - * Major upgrade to XML support. - * - * Pedro Vicente - * September 2007 - * list objects in requested order (creation order or alphabetically) - * - *------------------------------------------------------------------------- - */ -int -main(int argc, const char *argv[]) -{ - hid_t fid = -1; - hid_t gid = -1; - H5E_auto2_t func; - H5O_info_t oi; - struct handler_t *hand; - int i; - unsigned u; - void *edata; - char *fname = NULL; - - h5tools_setprogname(PROGRAMNAME); - h5tools_setstatus(EXIT_SUCCESS); - dump_header_format = &standardformat; - dump_function_table = &ddl_function_table; - - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - /* Initialize h5tools lib */ - h5tools_init(); - if((hand = parse_command_line(argc, argv))==NULL) { - goto done; - } - - if (bin_output && outfname == NULL) { - error_msg("binary output requires a file name, use -o \n"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - - if (enable_error_stack) - H5Eset_auto2(H5E_DEFAULT, func, edata); - - /* Check for conflicting options */ - if (doxml) { - if (!display_all) { - error_msg("option \"%s\" not available for XML\n", - "to display selected objects"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - else if (display_bb) { - error_msg("option \"%s\" not available for XML\n", "--boot-block"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - else if (display_oid == 1) { - error_msg("option \"%s\" not available for XML\n", "--object-ids"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - else if (display_char == TRUE) { - error_msg("option \"%s\" not available for XML\n", "--string"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - else if (usingdasho) { - error_msg("option \"%s\" not available for XML\n", "--output"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - } - else { - if (xml_dtd_uri) { - warn_msg("option \"%s\" only applies with XML: %s\n", "--xml-dtd", xml_dtd_uri); - } - } - - if (argc <= opt_ind) { - error_msg("missing file name\n"); - usage(h5tools_getprogname()); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - fname = HDstrdup(argv[opt_ind]); - - fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, driver, NULL, 0); - - if (fid < 0) { - error_msg("unable to open file \"%s\"\n", fname); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - - /* allocate and initialize internal data structure */ - init_prefix(&prefix, prefix_len); - - /* Prepare to find objects that might be targets of a reference */ - fill_ref_path_table(fid); - - if(doxml) { - /* initialize XML */ - /* reset prefix! */ - HDstrcpy(prefix, ""); - - /* make sure the URI is initialized to something */ - if (xml_dtd_uri == NULL) { - if (useschema) { - xml_dtd_uri = DEFAULT_XSD; - } - else { - xml_dtd_uri = DEFAULT_DTD; - xmlnsprefix = ""; - } - } - else { - if (useschema && strcmp(xmlnsprefix,"")) { - error_msg("Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - } - } - - /* Get object info for root group */ - if(H5Oget_info_by_name(fid, "/", &oi, H5P_DEFAULT) < 0) { - error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - - /* Initialize object tables */ - if(table_list_add(fid, oi.fileno) < 0) { - error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - group_table = table_list.tables[0].group_table; - dset_table = table_list.tables[0].dset_table; - type_table = table_list.tables[0].type_table; - - /* does there exist unamed committed datatype */ - for (u = 0; u < type_table->nobjs; u++) - if (!type_table->objs[u].recorded) { - unamedtype = 1; - break; - } /* end if */ - - /* start to dump - display file header information */ - if (!doxml) { - begin_obj(dump_header_format->filebegin, fname, dump_header_format->fileblockbegin); - } - else { - HDfprintf(stdout, "\n"); - - /* alternative first element, depending on schema or DTD. */ - if (useschema) { - if (strcmp(xmlnsprefix,"") == 0) { - HDfprintf(stdout, "\n", - xml_dtd_uri); - } - else { -/* TO DO: make -url option work in this case (may need new option) */ - char *ns; - char *indx; - - ns = HDstrdup(xmlnsprefix); - indx = strrchr(ns,(int)':'); - if (indx) *indx = '\0'; - - HDfprintf(stdout, "<%sHDF5-File xmlns:%s=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File\" " - "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " - "xsi:schemaLocation=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File " - "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\">\n",xmlnsprefix,ns); - HDfree(ns); - } - } - else { - HDfprintf(stdout, "\n", xml_dtd_uri); - HDfprintf(stdout, "\n"); - } - } - - if (!doxml) { - if (display_fi) { - dump_fcontents(fid); - end_obj(dump_header_format->fileend,dump_header_format->fileblockend); - goto done; - } - - if (display_bb) - dump_fcpl(fid); - } - - if(display_all) { - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) - { - error_msg("unable to open root group\n"); - h5tools_setstatus(EXIT_FAILURE); - } - else { - dump_function_table->dump_group_function(gid, "/" ); - } - - if(H5Gclose(gid) < 0) { - error_msg("unable to close root group\n"); - h5tools_setstatus(EXIT_FAILURE); - } - - } - else { - /* Note: this option is not supported for XML */ - if(doxml) { - error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } /* end if */ - - for(i = 0; i < argc; i++) - if(hand[i].func) - hand[i].func(fid, hand[i].obj, hand[i].subset_info, 1, NULL); - } - - if (!doxml) { - end_obj(dump_header_format->fileend, dump_header_format->fileblockend); - } - else { - HDfprintf(stdout, "\n", xmlnsprefix); - } - -done: - /* Free tables for objects */ - table_list_free(); - - if(hand) - free_handler(hand, argc); - - if(fid >=0) - if (H5Fclose(fid) < 0) - h5tools_setstatus(EXIT_FAILURE); - - if(prefix) - HDfree(prefix); - if(fname) - HDfree(fname); - - /* To Do: clean up XML table */ - - H5Eset_auto2(H5E_DEFAULT, func, edata); - - leave(h5tools_getstatus()); -} - -/*------------------------------------------------------------------------- - * Function: print_enum - * - * Purpose: prints the enum data - * - * Return: void - * - * Programmer: Patrick Lu - * - * Modifications: - * - * NOTE: this function was taken from h5ls. should be moved into the toolslib - * - *-----------------------------------------------------------------------*/ -static void -print_enum(hid_t type) -{ - char **name = NULL; /*member names */ - unsigned char *value = NULL; /*value array */ - unsigned char *copy = NULL; /*a pointer to value array */ - unsigned nmembs; /*number of members */ - int nchars; /*number of output characters */ - hid_t super; /*enum base integer type */ - hid_t native = -1; /*native integer datatype */ - size_t dst_size; /*destination value type size */ - unsigned i; - - nmembs = (unsigned) H5Tget_nmembers(type); - super = H5Tget_super(type); - - /* - * Determine what datatype to use for the native values. To simplify - * things we entertain three possibilities: - * 1. long long -- the largest native signed integer - * 2. unsigned long long -- the largest native unsigned integer - * 3. raw format - */ - if (H5Tget_size(type) <= sizeof(long long)) { - dst_size = sizeof(long long); - - if (H5T_SGN_NONE == H5Tget_sign(type)) - native = H5T_NATIVE_ULLONG; - else - native = H5T_NATIVE_LLONG; - } /* end if */ - else - dst_size = H5Tget_size(type); - - /* Get the names and raw values of all members */ - name = (char **) calloc(nmembs, sizeof(char *)); - value = (unsigned char *) calloc(nmembs, MAX(H5Tget_size(type), dst_size)); - - for (i = 0; i < nmembs; i++) { - name[i] = H5Tget_member_name(type, i); - H5Tget_member_value(type, i, value + i * H5Tget_size(type)); - } - - /* Convert values to native datatype */ - if (native > 0) - H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT); - - /* - * Sort members by increasing value - * ***not implemented yet*** - */ - - /* Print members */ - for (i = 0; i < nmembs; i++) { - indentation(indent + COL); - nchars = HDfprintf(stdout, "\"%s\"", name[i]); - HDfprintf(stdout, "%*s ", MAX(0, 16 - nchars), ""); - - if (native < 0) { - size_t j; - - HDfprintf(stdout, "0x"); - - for (j = 0; j < dst_size; j++) - HDfprintf(stdout, "%02x", value[i * dst_size + j]); - } - else if (H5T_SGN_NONE == H5Tget_sign(native)) { - /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" - *strangely, unless use another pointer "copy".*/ - copy = value + i * dst_size; - HDfprintf(stdout, "%" H5_PRINTF_LL_WIDTH "u", *((unsigned long long *) ((void *) copy))); - } - else { - /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" - *strangely, unless use another pointer "copy".*/ - copy = value + i * dst_size; - HDfprintf(stdout, "%" H5_PRINTF_LL_WIDTH "d", *((long long *) ((void *) copy))); - } - - HDfprintf(stdout, ";\n"); - } - - /* Release resources */ - for (i = 0; i < nmembs; i++) - free(name[i]); - - free(name); - free(value); - H5Tclose(super); - - if (0 == nmembs) - HDfprintf(stdout, "\n%*s ", indent + 4, ""); -} - - -/* - * create a string suitable for and XML NCNAME. Uses the - * object reference to create the string. - * - * 'gen'; 0 - return null if not found - * 1 - generate a fake entry and return fake id. - */ -int -xml_name_to_XID(const char *str , char *outstr, int outlen, int gen) -{ - haddr_t objno; /* Object ID for object at path */ - - if (outlen < 22) return 1; - - objno = ref_path_table_lookup(str); - if (objno == HADDR_UNDEF) { - if (HDstrlen(str) == 0) { - objno = ref_path_table_lookup("/"); - if (objno == HADDR_UNDEF) { - if (gen) { - objno = ref_path_table_gen_fake(str); - sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); - return 0; - } - else { - return 1; - } - } - } - else { - if (gen) { - objno = ref_path_table_gen_fake(str); - sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); - return 0; - } - else { - return 1; - } - } - } - - sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); - - return(0); -} - -static const char *quote = """; -static const char *amp = "&"; -static const char *lt = "<"; -static const char *gt = ">"; -static const char *apos = "'"; - -/*------------------------------------------------------------------------- - * Function: xml_escape_the_name - * - * Purpose: Escape XML reserved chars in a name, so HDF5 strings - * and paths can be correctly read back in XML element. - * - * Return: The revised string. - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static char * -xml_escape_the_name(const char *str) -{ - size_t extra; - size_t len; - size_t i; - const char *cp; - char *ncp; - char *rcp; - - if (!str) - return NULL; - - cp = str; - len = strlen(str); - extra = 0; - - for (i = 0; i < len; i++) { - if (*cp == '\"') { - extra += (strlen(quote) - 1); - } - else if (*cp == '\'') { - extra += (strlen(apos) - 1); - } - else if (*cp == '<') { - extra += (strlen(lt) - 1); - } - else if (*cp == '>') { - extra += (strlen(gt) - 1); - } - else if (*cp == '&') { - extra += (strlen(amp) - 1); - } - - cp++; - } - - if (extra == 0) - return HDstrdup(str); - - cp = str; - rcp = ncp = (char *)HDmalloc(len + extra + 1); - - if (!ncp) - return NULL; /* ?? */ - - for (i = 0; i < len; i++) { - if (*cp == '\'') { - strncpy(ncp, apos, strlen(apos)); - ncp += strlen(apos); - cp++; - } - else if (*cp == '<') { - strncpy(ncp, lt, strlen(lt)); - ncp += strlen(lt); - cp++; - } - else if (*cp == '>') { - strncpy(ncp, gt, strlen(gt)); - ncp += strlen(gt); - cp++; - } - else if (*cp == '\"') { - strncpy(ncp, quote, strlen(quote)); - ncp += strlen(quote); - cp++; - } - else if (*cp == '&') { - strncpy(ncp, amp, strlen(amp)); - ncp += strlen(amp); - cp++; - } - else { - *ncp++ = *cp++; - } - } - - *ncp = '\0'; - return rcp; -} - -/*------------------------------------------------------------------------- - * Function: xml_escape_the_string - * - * Purpose: Escape XML reserved chars in a string, so HDF5 strings - * and paths can be correctly read back in XML CDATA. - * - * Return: The revised string. - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static char * -xml_escape_the_string(const char *str, int slen) -{ - size_t extra; - size_t len; - size_t i; - const char *cp; - char *ncp; - char *rcp; - - if (!str) - return NULL; - - cp = str; - - if (slen < 0) - len = strlen(str); - else - len = slen; - - extra = 0; - - for (i = 0; i < len; i++) { - if (*cp == '\\') { - extra++; - } - else if (*cp == '\"') { - extra++; - } - else if (*cp == '\'') { - extra += (strlen(apos) - 1); - } - else if (*cp == '<') { - extra += (strlen(lt) - 1); - } - else if (*cp == '>') { - extra += (strlen(gt) - 1); - } - else if (*cp == '&') { - extra += (strlen(amp) - 1); - } - cp++; - } - - cp = str; - rcp = ncp = (char *) calloc((len + extra + 1), sizeof(char)); - - if (ncp == NULL) - return NULL; /* ?? */ - - for (i = 0; i < len; i++) { - if (*cp == '\\') { - *ncp++ = '\\'; - *ncp++ = *cp++; - } - else if (*cp == '\"') { - *ncp++ = '\\'; - *ncp++ = *cp++; - } - else if (*cp == '\'') { - strncpy(ncp, apos, strlen(apos)); - ncp += strlen(apos); - cp++; - } - else if (*cp == '<') { - strncpy(ncp, lt, strlen(lt)); - ncp += strlen(lt); - cp++; - } - else if (*cp == '>') { - strncpy(ncp, gt, strlen(gt)); - ncp += strlen(gt); - cp++; - } - else if (*cp == '&') { - strncpy(ncp, amp, strlen(amp)); - ncp += strlen(amp); - cp++; - } - else { - *ncp++ = *cp++; - } - } - - *ncp = '\0'; - return rcp; -} - -/** - ** XML print functions--these replace some functions in the - ** h5tools.c suite. - **/ - -/*------------------------------------------------------------------------- - * Function: xml_print_datatype - * - * Purpose: Print description of a datatype in XML. - * Note: this is called inside a element. - * - * Return: void - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -xml_print_datatype(hid_t type, unsigned in_group) -{ - char *mname; - hid_t mtype; - unsigned nmembers; - unsigned ndims; - unsigned i; - size_t size; - hsize_t dims[H5DUMP_MAX_RANK]; - H5T_str_t str_pad; - H5T_cset_t cset; - hid_t super; - H5T_order_t ord; - H5T_sign_t sgn; - size_t sz; - size_t spos; - size_t epos; - size_t esize; - size_t mpos; - size_t msize; - int nmembs; - htri_t is_vlstr=FALSE; - - if(!in_group && H5Tcommitted(type) > 0) { - H5O_info_t oinfo; - obj_t *found_obj; /* Found object */ - - /* detect a shared datatype, output only once */ - H5Oget_info(type, &oinfo); - found_obj = search_obj(type_table, oinfo.addr); - - if(found_obj) { - /* This should be defined somewhere else */ - /* These 2 cases are handled the same right now, but - probably will have something different eventually */ - char * dtxid = (char *)malloc(100); - - xml_name_to_XID(found_obj->objname, dtxid, 100, 1); - if (!found_obj->recorded) { - /* 'anonymous' NDT. Use it's object num. - as it's name. */ - HDfprintf(stdout, "<%sNamedDataTypePtr OBJ-XID=\"/%s\"/>\n", - xmlnsprefix, dtxid); - } - else { - /* point to the NDT by name */ - char *t_objname = xml_escape_the_name(found_obj->objname); - - HDfprintf(stdout, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>\n", - xmlnsprefix, dtxid, t_objname); - free(t_objname); - } - free(dtxid); - } - else { - HDfprintf(stdout, "\n"); - h5tools_setstatus(EXIT_FAILURE); - } - } - else { - - switch (H5Tget_class(type)) { - case H5T_INTEGER: - indentation(indent); - HDfprintf(stdout, "<%sAtomicType>\n",xmlnsprefix); - indent += COL; - /* */ - ord = H5Tget_order(type); - sgn = H5Tget_sign(type); - indentation(indent); - HDfprintf(stdout, "<%sIntegerType ByteOrder=\"",xmlnsprefix); - switch (ord) { - case H5T_ORDER_LE: - HDfprintf(stdout, "LE"); - break; - case H5T_ORDER_BE: - HDfprintf(stdout, "BE"); - break; - case H5T_ORDER_VAX: - default: - HDfprintf(stdout, "ERROR_UNKNOWN"); - } - - HDfprintf(stdout, "\" Sign=\""); - - switch (sgn) { - case H5T_SGN_NONE: - HDfprintf(stdout, "false"); - break; - case H5T_SGN_2: - HDfprintf(stdout, "true"); - break; - default: - HDfprintf(stdout, "ERROR_UNKNOWN"); - } - - HDfprintf(stdout, "\" Size=\""); - sz = H5Tget_size(type); - HDfprintf(stdout, "%lu", (unsigned long)sz); - HDfprintf(stdout, "\" />\n"); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - - case H5T_FLOAT: - /* */ - ord = H5Tget_order(type); - indentation(indent); - HDfprintf(stdout, "<%sAtomicType>\n",xmlnsprefix); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sFloatType ByteOrder=\"",xmlnsprefix); - - switch (ord) { - case H5T_ORDER_LE: - HDfprintf(stdout, "LE"); - break; - case H5T_ORDER_BE: - HDfprintf(stdout, "BE"); - break; - case H5T_ORDER_VAX: - HDfprintf(stdout, "VAX"); - break; - default: - HDfprintf(stdout, "ERROR_UNKNOWN"); - } - - HDfprintf(stdout, "\" Size=\""); - sz = H5Tget_size(type); - HDfprintf(stdout, "%lu", (unsigned long)sz); - H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize); - HDfprintf(stdout, "\" SignBitLocation=\"%lu\" ", (unsigned long)spos); - HDfprintf(stdout, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos); - HDfprintf(stdout, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />\n", (unsigned long)msize, (unsigned long)mpos); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - - case H5T_TIME: - indentation(indent); - HDfprintf(stdout, "<%sAtomicType>\n",xmlnsprefix); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sTimeType />\n",xmlnsprefix); - HDfprintf(stdout, ""); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - - case H5T_STRING: - /* */ - size = H5Tget_size(type); - str_pad = H5Tget_strpad(type); - cset = H5Tget_cset(type); - is_vlstr = H5Tis_variable_str(type); - - indentation(indent); - HDfprintf(stdout, "<%sAtomicType>\n",xmlnsprefix); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sStringType Cset=\"",xmlnsprefix); - if (cset == H5T_CSET_ASCII) { - HDfprintf(stdout, "H5T_CSET_ASCII\" "); - } - else { - HDfprintf(stdout, "unknown_cset\" "); - } - if(is_vlstr) - HDfprintf(stdout, "StrSize=\"H5T_VARIABLE\" StrPad=\""); - else - HDfprintf(stdout, "StrSize=\"%d\" StrPad=\"", (int) size); - if (str_pad == H5T_STR_NULLTERM) { - HDfprintf(stdout, "H5T_STR_NULLTERM\"/>\n"); - } - else if (str_pad == H5T_STR_NULLPAD) { - HDfprintf(stdout, "H5T_STR_NULLPAD\"/>\n"); - } - else if (str_pad == H5T_STR_SPACEPAD) { - HDfprintf(stdout, "H5T_STR_SPACEPAD\"/>\n"); - } - else { - HDfprintf(stdout, "H5T_STR_ERROR\"/>\n"); - } - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - - case H5T_BITFIELD: - /* */ - ord = H5Tget_order(type); - indentation(indent); - HDfprintf(stdout, "<%sAtomicType>\n",xmlnsprefix); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sBitfieldType ByteOrder=\"",xmlnsprefix); - - switch (ord) { - case H5T_ORDER_LE: - HDfprintf(stdout, "LE"); - break; - case H5T_ORDER_BE: - HDfprintf(stdout, "BE"); - break; - case H5T_ORDER_VAX: - default: - HDfprintf(stdout, "ERROR_UNKNOWN"); + case 'M': + if (!last_was_dset) { + error_msg("option `-%c' can only be used after --dataset option\n", opt); + goto error; } - - size = H5Tget_size(type); - HDfprintf(stdout, "\" Size=\"%lu\"/>\n", (unsigned long)size); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - - case H5T_OPAQUE: - /* */ - indentation(indent); - HDfprintf(stdout, "<%sAtomicType>\n",xmlnsprefix); - indent += COL; - indentation(indent); - mname = H5Tget_tag(type); - HDfprintf(stdout, "<%sOpaqueType Tag=\"%s\" ",xmlnsprefix, mname); - free(mname); - size = H5Tget_size(type); - HDfprintf(stdout, "Size=\"%lu\"/>\n", (unsigned long)size); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - - case H5T_COMPOUND: - /* recursively describe the components of a compound datatype */ - - /* type of a dataset */ - nmembers = H5Tget_nmembers(type); - - indentation(indent); - HDfprintf(stdout, "<%sCompoundType>\n",xmlnsprefix); - - /* List each member Field of the type */ - /* */ - /* */ - indent += COL; - for (i = 0; i < nmembers; i++) { - char *t_fname; - - mname = H5Tget_member_name(type, i); - mtype = H5Tget_member_type(type, i); - indentation(indent); - t_fname = xml_escape_the_name(mname); - HDfprintf(stdout, "<%sField FieldName=\"%s\">\n",xmlnsprefix, t_fname); - - free(mname); - free(t_fname); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sDataType>\n",xmlnsprefix); - indent += COL; - xml_print_datatype(mtype,0); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - indent -= COL; - - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); + if (parse_mask_list(opt_arg) != SUCCEED){ + usage(h5tools_getprogname()); + goto error; } - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - - case H5T_REFERENCE: - indentation(indent); - HDfprintf(stdout, "<%sAtomicType>\n",xmlnsprefix); - indent += COL; - indentation(indent); - /* Only Object references supported at this time */ - HDfprintf(stdout, "<%sReferenceType>\n",xmlnsprefix); - indentation(indent + COL); - HDfprintf(stdout, "<%sObjectReferenceType />\n",xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); + display_packed_bits = TRUE; break; - case H5T_ENUM: - /* list Name, values of enum */ - nmembs = H5Tget_nmembers(type); - indentation(indent); - HDfprintf(stdout, "<%sAtomicType>\n",xmlnsprefix); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sEnumType Nelems=\"%d\">\n",xmlnsprefix, nmembs); - xml_print_enum(type); - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); + /** begin XML parameters **/ + case 'x': + /* select XML output */ + doxml = TRUE; + useschema = TRUE; + h5tools_dump_header_format = NULL; + dump_function_table = &xml_function_table; + h5tools_nCols = 0; break; - - case H5T_VLEN: - indentation(indent); - HDfprintf(stdout, "<%sVLType>\n",xmlnsprefix); - super = H5Tget_super(type); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sDataType>\n",xmlnsprefix); - indent += COL; - xml_print_datatype(super,0); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - H5Tclose(super); - + case 'u': + doxml = TRUE; + useschema = FALSE; + xmlnsprefix = ""; + h5tools_dump_header_format = NULL; + dump_function_table = &xml_function_table; + h5tools_nCols = 0; break; - - case H5T_ARRAY: - /* Get array base type */ - super = H5Tget_super(type); - - /* Print lead-in */ - indentation(indent); - HDfprintf(stdout, "<%sArrayType Ndims=\"",xmlnsprefix); - ndims = H5Tget_array_ndims(type); - HDfprintf(stdout, "%u\">\n", ndims); - - /* Get array information */ - H5Tget_array_dims2(type, dims); - - /* list of dimensions */ - indent += COL; - for (i = 0; i < ndims; i++) { - indentation(indent); - HDfprintf(stdout, "<%sArrayDimension DimSize=\"%u\"/>\n", xmlnsprefix, (int) dims[i]); - } - indent -= COL; - - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sDataType>\n",xmlnsprefix); - indent += COL; - xml_print_datatype(super,0); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - /* Close array base type */ - H5Tclose(super); + case 'D': + /* specify alternative XML DTD or schema */ + /* To Do: check format of this value? */ + xml_dtd_uri = opt_arg; + h5tools_nCols = 0; break; - default: - HDfprintf(stdout, ""); - h5tools_setstatus(EXIT_FAILURE); + case 'm': + /* specify alternative floating point printing format */ + fp_format = opt_arg; + h5tools_nCols = 0; break; - } - } /* end else */ -} - -/*------------------------------------------------------------------------- - * Function: xml_dump_datatype - * - * Purpose: Dump description of a datatype in XML. - * - * Return: void - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -xml_dump_datatype(hid_t type) -{ - indent += COL; - indentation(indent); - - if(H5Tcommitted(type) > 0) { - H5O_info_t oinfo; - obj_t *found_obj; /* Found object */ - - /* Datatype is a shared or named datatype */ - H5Oget_info(type, &oinfo); - found_obj = search_obj(type_table, oinfo.addr); - - if(found_obj) { - /* Shared datatype, must be entered as an object */ - /* These 2 cases are the same now, but may change */ - char *dtxid = (char *)malloc(100); - - xml_name_to_XID(found_obj->objname, dtxid, 100, 1); - if (!found_obj->recorded) { - /* anonymous stored datatype: - following the dumper's current - practice: - use it's object ref as its name - */ - HDfprintf(stdout, "<%sNamedDataTypePtr OBJ-XID=\"%s\"/>\n", - xmlnsprefix, dtxid); - } - else { - /* pointer to a named datatype already in XML */ - char *t_objname = xml_escape_the_name(found_obj->objname); - HDfprintf(stdout, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\" />\n", - xmlnsprefix, dtxid, t_objname); - free(t_objname); + case 'X': + /* specify XML namespace (default="hdf5:"), or none */ + /* To Do: check format of this value? */ + if (!useschema) { + usage(h5tools_getprogname()); + goto error; } - free(dtxid); - } - else { - HDfprintf(stdout, "\n"); - } - indent -= COL; - } - else { - HDfprintf(stdout, "<%sDataType>\n", xmlnsprefix); - indent += COL; - xml_print_datatype(type, 0); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - indent -= COL; - } -} - -/*------------------------------------------------------------------------- - * Function: xml_dump_dataspace - * - * Purpose: Dump description of a dataspace in XML. - * - * Return: void - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -xml_dump_dataspace(hid_t space) -{ - hsize_t size[H5DUMP_MAX_RANK]; - hsize_t maxsize[H5DUMP_MAX_RANK]; - int i; - - int ndims = H5Sget_simple_extent_dims(space, size, maxsize); - H5S_class_t space_type = H5Sget_simple_extent_type(space); - - indentation(indent + COL); - HDfprintf(stdout, "<%sDataspace>\n", xmlnsprefix); - indentation(indent + COL + COL); - - switch (space_type) { - case H5S_SCALAR: - /* scalar dataspace (just a tag, no XML attrs. defined */ - HDfprintf(stdout, "<%sScalarDataspace />\n",xmlnsprefix); - break; - - case H5S_SIMPLE: - /* simple dataspace */ - /* */ - HDfprintf(stdout, "<%sSimpleDataspace Ndims=\"%d\">\n",xmlnsprefix, ndims); - - /* print the elements */ - for (i = 0; i < ndims; i++) { - indentation(indent + COL + COL + COL); - if (maxsize[i] == H5S_UNLIMITED) { - HDfprintf(stdout, "<%sDimension DimSize=\"%Hu\" MaxDimSize=\"UNLIMITED\"/>\n", - xmlnsprefix,size[i]); - } - else if (maxsize[i] == (hsize_t) 0) { - HDfprintf(stdout, "<%sDimension DimSize=\"%Hu\" MaxDimSize=\"%Hu\"/>\n", - xmlnsprefix,size[i], size[i]); + if (strcmp(opt_arg,":") == 0) { + xmlnsprefix = ""; } else { - HDfprintf(stdout, "<%sDimension DimSize=\"%Hu\" MaxDimSize=\"%Hu\"/>\n", - xmlnsprefix, size[i], maxsize[i]); + xmlnsprefix = opt_arg; } - } - indentation(indent + COL + COL); - HDfprintf(stdout, "\n", xmlnsprefix ); - break; - -#ifdef TMP - /* Commented out: wait until the schema is updated first */ - case H5S_NULL: - /* null dataspace (just a tag, no XML attrs. defined */ - HDfprintf(stdout, "<%sNullDataspace />\n",xmlnsprefix); - break; -#endif /* TMP */ - - case H5S_NO_CLASS: - default: - HDfprintf(stdout, "\n"); - } - - indentation(indent + COL); - HDfprintf(stdout, "\n", xmlnsprefix); -} - -/*------------------------------------------------------------------------- - * Function: xml_dump_data - * - * Purpose: Dump description of data in XML. - * Note that this calls the h5dump_xxx calls in - * the h5tools library. - * - * Return: void - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNUSED pindex) -{ - hid_t space; - hid_t type; - hid_t p_type; - hsize_t size[64]; - hsize_t nelmts = 1; - int ndims; - int i; - int depth; - int status = -1; - int stdindent = COL; /* should be 3 */ - h5tool_format_t *outputformat = &xml_dataformat; - void *buf = NULL; - - if (fp_format) { - outputformat->fmt_double = fp_format; - outputformat->fmt_float = fp_format; - } - - if (nCols==0) { - outputformat->line_ncols = 65535; - outputformat->line_per_line = 1; - } - else - outputformat->line_ncols = nCols; - indent += COL; - - /* - * the depth will tell us how far we need to indent extra. we use to just - * use indent but with the merging of the tools lib we have to do - * something different for the lib funtions... the normal indentation is 6 - * so when we don't need any extra indentation, depth will be 0. - */ - depth = indent / stdindent + 1; - - /* Print all the values. */ - indentation(indent); - HDfprintf(stdout, "<%sData>\n", xmlnsprefix); - indentation(indent + COL); - HDfprintf(stdout, "<%sDataFromFile>\n",xmlnsprefix); - if (obj_data == DATASET_DATA) { - type = H5Dget_type(obj_id); - if (H5Tget_class(type) == H5T_REFERENCE) { - status = xml_print_refs(obj_id, DATASET_DATA); - } - else if (H5Tget_class(type) == H5T_STRING) { - status = xml_print_strs(obj_id, DATASET_DATA); - } - else { - status = h5tools_dump_dset(stdout, outputformat, obj_id, -1, NULL, depth); - } - } - else { - /* Attribute data */ - type = H5Aget_type(obj_id); - - if (H5Tget_class(type) == H5T_REFERENCE) { - /* references are done differently than - the standard output: - XML dumps a path to the object - referenced. - */ - status = xml_print_refs(obj_id, ATTRIBUTE_DATA); - H5Tclose(type); - } - else if (H5Tget_class(type) == H5T_STRING) { - status = xml_print_strs(obj_id, ATTRIBUTE_DATA); - } - else { /* all other data */ - /* VL data special information */ - unsigned int vl_data = 0; /* contains VL datatypes */ - - p_type = h5tools_get_native_type(type); - - /* Check if we have VL data in the dataset's datatype */ - if (h5tools_detect_vlen_str(p_type) == TRUE) - vl_data = TRUE; - if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) - vl_data = TRUE; - - H5Tclose(type); - - space = H5Aget_space(obj_id); - - ndims = H5Sget_simple_extent_dims(space, size, NULL); - - for (i = 0; i < ndims; i++) - nelmts *= size[i]; - - buf = malloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)))); - assert(buf); - - if (H5Aread(obj_id, p_type, buf) >= 0) - status = h5tools_dump_mem(stdout, outputformat, obj_id, p_type, space, buf, depth); - - /* Reclaim any VL memory, if necessary */ - if (vl_data) - H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf); - - free(buf); - H5Tclose(p_type); - H5Sclose(space); - H5Tclose(type); - } - } - - if (status == FAIL) { - indentation(indent + COL); - HDfprintf(stdout, "Unable to print data.\n"); - status = 1; - } + h5tools_nCols = 0; + break; + /** end XML parameters **/ - indentation(indent + COL); - HDfprintf(stdout, "\n",xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - indent -= COL; -} + /** begin subsetting parameters **/ + case 's': + case 'S': + case 'c': + case 'k': { + struct subset_t *s; -/*------------------------------------------------------------------------- - * Function: xml_dump_attr - * - * Purpose: Dump a description of an HDF5 attribute in XML. - * - * Return: herr_t - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, - void UNUSED * op_data) -{ - hid_t attr_id; - hid_t type; - hid_t space; - H5S_class_t space_type; - - char *t_aname = xml_escape_the_name(attr_name); - - indentation(indent); - HDfprintf(stdout, "<%sAttribute Name=\"%s\">\n", xmlnsprefix, t_aname); - free(t_aname); - - if ((attr_id = H5Aopen(attr, attr_name, H5P_DEFAULT)) >= 0) { - type = H5Aget_type(attr_id); - space = H5Aget_space(attr_id); - space_type = H5Sget_simple_extent_type(space); - - dump_function_table->dump_dataspace_function(space); - dump_function_table->dump_datatype_function(type); - - if (display_attr_data && space_type != H5S_NULL) { - switch (H5Tget_class(type)) { - case H5T_INTEGER: - case H5T_FLOAT: - case H5T_STRING: - case H5T_BITFIELD: - case H5T_OPAQUE: - case H5T_ENUM: - case H5T_ARRAY: - dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); - break; - - case H5T_TIME: - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sData>\n", xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "<%sNoData/>\n", xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\n"); - HDfprintf(stdout, "\n", xmlnsprefix); - indent -= COL; - break; - - case H5T_COMPOUND: - indentation(indent); - HDfprintf(stdout, "\n"); - dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); - break; - - case H5T_REFERENCE: - indentation(indent); - HDfprintf(stdout, "<%sData>\n", xmlnsprefix); - indentation(indent); - if (!H5Tequal(type, H5T_STD_REF_OBJ)) { - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "<%sNoData />\n", xmlnsprefix); - } - else { - HDfprintf(stdout, "<%sDataFromFile>\n", xmlnsprefix); - xml_print_refs(attr_id, ATTRIBUTE_DATA); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - } - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - break; - - case H5T_VLEN: - HDfprintf(stdout, "\n"); - dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); - break; - default: - indentation(indent); - HDfprintf(stdout, "<%sData>\n", xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\n", H5Tget_class(type)); - indentation(indent); - HDfprintf(stdout, "<%sNoData/>\n", xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - break; + if (!last_was_dset) { + error_msg("option `-%c' can only be used after --dataset option\n", opt); + goto error; } - } - else { - /* The case of an attribute never yet written ?? - * Or dataspace is H5S_NULL. */ - indentation(indent + COL); - HDfprintf(stdout, "<%sData>\n", xmlnsprefix); - indentation(indent + COL + COL); - HDfprintf(stdout, "<%sNoData/>\n", xmlnsprefix); - indentation(indent + COL); - HDfprintf(stdout, "\n", xmlnsprefix); - } - - H5Tclose(type); - H5Sclose(space); - H5Aclose(attr_id); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - return SUCCEED; - - } - else { - /* ?? failed */ - indentation(indent + COL); - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - h5tools_setstatus(EXIT_FAILURE); - return FAIL; - } -} - -/*------------------------------------------------------------------------- - * Function: xml_dump_named_datatype - * - * Purpose: Dump a description of an HDF5 NDT in XML. - * - * Return: herr_t - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -xml_dump_named_datatype(hid_t type, const char *name) -{ - char *tmp; - char *dtxid; - char *parentxid; - char *t_tmp; - char *t_prefix; - char *t_name; - - tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); - HDstrcpy(tmp, prefix); - HDstrcat(tmp, "/"); - HDstrcat(tmp, name); - - indentation(indent); - dtxid = (char *)HDmalloc(100); - parentxid = (char *)HDmalloc(100); - t_tmp = xml_escape_the_name(tmp); - t_prefix = xml_escape_the_name(prefix); - t_name = xml_escape_the_name(name); - - xml_name_to_XID(tmp, dtxid, 100, 1); - xml_name_to_XID(prefix, parentxid, 100, 1); - if(HDstrncmp(name, "#", 1) == 0) { - /* Special: this is an 'anonymous' NDT, deleted but - still in use. - We follow the dumper's undocumented practice, and - use its object id as its name. - Exactly the same as normal, but a separate case - in the event we want to do something else in - the future. - */ - HDfprintf(stdout, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\">\n", - xmlnsprefix, - name, dtxid, - parentxid, HDstrcmp(prefix,"") ? t_prefix : "/"); - } - else { - H5O_info_t oinfo; /* Object info */ - - HDfprintf(stdout, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" " - "H5Path=\"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">\n", - xmlnsprefix, - t_name, dtxid, - t_tmp, parentxid, (HDstrcmp(prefix, "") ? t_prefix : "/")); - - /* Check uniqueness of named datatype */ - H5Oget_info(type, &oinfo); - if(oinfo.rc > 1) { - obj_t *found_obj; /* Found object */ - /* Group with more than one link to it... */ - found_obj = search_obj(type_table, oinfo.addr); - - if (found_obj == NULL) { - indentation(indent); - error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - else if(found_obj->displayed) { - /* We have already printed this named datatype, print it as a - * NamedDatatypePtr + if (last_dset->subset_info) { + /* + * This overrides the "terse" syntax if they actually mixed + * the two. */ - char pointerxid[100]; - char *t_objname = xml_escape_the_name(found_obj->objname); - - indentation(indent + COL); - xml_name_to_XID(found_obj->objname, pointerxid, sizeof(pointerxid), 1); - HDfprintf(stdout, "<%sNamedDatatypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>\n", xmlnsprefix, pointerxid, t_objname); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - HDfree(t_objname); - goto done; + s = last_dset->subset_info; } - else - found_obj->displayed = TRUE; - } - } - - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sDataType>\n",xmlnsprefix); - - indent += COL; - xml_print_datatype(type,1); - - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - -done: - HDfree(dtxid); - HDfree(parentxid); - HDfree(t_tmp); - HDfree(t_prefix); - HDfree(t_name); - HDfree(tmp); -} - -/*------------------------------------------------------------------------- - * Function: xml_dump_group - * - * Purpose: Dump a description of an HDF5 Group (and its members) in XML. - * - * Return: void - * - * Programmer: REMcG - * - * Modifications: - * Pedro Vicente, October 9, 2007 - * added parameters to H5A(L)iterate to allow for other iteration orders - * - *------------------------------------------------------------------------- - */ -static void -xml_dump_group(hid_t gid, const char *name) -{ - H5O_info_t oinfo; - hid_t gcpl_id; - hid_t dset, type; - unsigned crt_order_flags; - unsigned attr_crt_order_flags; - int isRoot = 0; - char type_name[1024]; - char *t_objname = NULL; - char *par_name = NULL; - char *cp = NULL; - char *tmp = NULL; - char *par = NULL; - - - if ((gcpl_id = H5Gget_create_plist(gid)) < 0) { - error_msg("error in getting group creation property list ID\n"); - h5tools_setstatus(EXIT_FAILURE); - } - - /* query the group creation properties for attributes */ - if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0) { - error_msg("error in getting group creation properties\n"); - h5tools_setstatus(EXIT_FAILURE); - } - - /* query the group creation properties */ - if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) { - error_msg("error in getting group creation properties\n"); - h5tools_setstatus(EXIT_FAILURE); - } - - if(H5Pclose(gcpl_id) < 0) { - error_msg("error in closing group creation property list ID\n"); - h5tools_setstatus(EXIT_FAILURE); - } - - if(HDstrcmp(name, "/") == 0) { - isRoot = 1; - tmp = HDstrdup("/"); - } - else { - tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); - HDstrcpy(tmp, prefix); - par = HDstrdup(tmp); - cp = HDstrrchr(par, '/'); - if(cp) { - if((cp == par) && HDstrlen(par) > 1) - *(cp + 1) = '\0'; - else - *cp = '\0'; - } - } - - indentation(indent); - indent += COL; - - H5Oget_info(gid, &oinfo); - - if(oinfo.rc > 1) { - obj_t *found_obj; /* Found object */ - - /* Group with more than one link to it... */ - found_obj = search_obj(group_table, oinfo.addr); - - if (found_obj == NULL) { - indentation(indent); - error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); - h5tools_setstatus(EXIT_FAILURE); - } - else { - char *t_name = xml_escape_the_name(name); - char *grpxid = (char *)malloc(100); - char *parentxid = (char *)malloc(100); - - if(found_obj->displayed) { - char *ptrstr = (char *)malloc(100); - - /* already seen: enter a groupptr */ - if(isRoot) { - /* probably can't happen! */ - xml_name_to_XID("/", grpxid, 100, 1); - HDfprintf(stdout, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">\n", - xmlnsprefix, grpxid, "/"); - } - else { - t_objname = xml_escape_the_name(found_obj->objname); - par_name = xml_escape_the_name(par); - xml_name_to_XID(tmp, grpxid, 100, 1); - xml_name_to_XID(par, parentxid, 100, 1); - HDfprintf(stdout, "<%sGroup Name=\"%s\" OBJ-XID=\"%s-%d\" H5Path=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\">\n", - xmlnsprefix,t_name, grpxid, get_next_xid(), - t_objname, parentxid, par_name); - free(t_objname); - free(par_name); - - indentation(indent + COL); - t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */ - par_name = xml_escape_the_name(par); - xml_name_to_XID(found_obj->objname, ptrstr, 100, 1); - xml_name_to_XID(par, parentxid, 100, 1); - HDfprintf(stdout, "<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", - xmlnsprefix, - ptrstr, t_objname, parentxid, par_name); - free(t_objname); - free(par_name); - } - free(ptrstr); - } else { + last_dset->subset_info = s = (struct subset_t *)calloc(1, sizeof(struct subset_t)); + } - /* first time this group has been seen -- describe it */ - if(isRoot) { - xml_name_to_XID("/", grpxid, 100, 1); - HDfprintf(stdout, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">\n", - xmlnsprefix, grpxid, "/"); - } - else { - char *t_tmp = xml_escape_the_name(tmp); - - par_name = xml_escape_the_name(par); - xml_name_to_XID(tmp, grpxid, 100, 1); - xml_name_to_XID(par, parentxid, 100, 1); - HDfprintf(stdout, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" >\n", - xmlnsprefix,t_name, grpxid, t_tmp, parentxid, par_name); - free(t_tmp); - free(par_name); + /* + * slightly convoluted, but...we are only interested in options + * for subsetting: "--start", "--stride", "--count", and "--block" + * which can come in any order. If we run out of parameters (EOF) + * or run into one which isn't a subsetting parameter (NOT s, S, + * c, or K), then we exit the do-while look, set the subset_info + * to the structure we've been filling. If we've reached the end + * of the options, we exit the parsing (goto parse_end) otherwise, + * since we've "read" the next option, we need to parse it. So we + * jump to the beginning of the switch statement (goto parse_start). + */ + do { + switch ((char)opt) { + case 's': + if (s->start.data) { + free(s->start.data); + s->start.data = NULL; + } + parse_hsize_list(opt_arg, &s->start); + break; + case 'S': + if (s->stride.data) { + free(s->stride.data); + s->stride.data = NULL; + } + parse_hsize_list(opt_arg, &s->stride); + break; + case 'c': + if (s->count.data) { + free(s->count.data); + s->count.data = NULL; } - found_obj->displayed = TRUE; - - /* 1. do all the attributes of the group */ - - if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { - if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end if */ - else { - if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end else */ - - if(isRoot && unamedtype) { - unsigned u; - - /* Very special case: dump unamed type in root group */ - for(u = 0; u < type_table->nobjs; u++) { - if(!type_table->objs[u].recorded) { - dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); - type = H5Dget_type(dset); - sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); - dump_function_table->dump_named_datatype_function(type, type_name); - H5Tclose(type); - H5Dclose(dset); - } + parse_hsize_list(opt_arg, &s->count); + break; + case 'k': + if (s->block.data) { + free(s->block.data); + s->block.data = NULL; } + parse_hsize_list(opt_arg, &s->block); + break; + default: + goto end_collect; } + } while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF); - /* iterate through all the links */ - - if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) - H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); - else - H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); - - - } - free(t_name); - free(grpxid); - free(parentxid); - } - } - else { - - /* only link -- must be first time! */ - char *t_name = xml_escape_the_name(name); - char *grpxid = (char *)malloc(100); - char *parentxid = (char *)malloc(100); +end_collect: + last_was_dset = FALSE; - if(isRoot) { - xml_name_to_XID("/", grpxid, 100, 1); - HDfprintf(stdout, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">\n", xmlnsprefix, grpxid, "/"); - } - else { - char *t_tmp = xml_escape_the_name(tmp); - - par_name = xml_escape_the_name(par); - xml_name_to_XID(tmp, grpxid, 100, 1); - xml_name_to_XID(par, parentxid, 100, 1); - HDfprintf(stdout, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" >\n", - xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name); - free(t_tmp); - free(par_name); + if (opt != EOF) + goto parse_start; + else + goto parse_end; } - free(t_name); - free(grpxid); - free(parentxid); - - /* 1. do all the attributes of the group */ + /** end subsetting parameters **/ - if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { - if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end if */ - else { - if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end else */ - - - if(isRoot && unamedtype) { - unsigned u; - - /* Very special case: dump unamed type in root group */ - for(u = 0; u < type_table->nobjs; u++) { - if(!type_table->objs[u].recorded) { - dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); - type = H5Dget_type(dset); - sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); - dump_function_table->dump_named_datatype_function(type, type_name); - H5Tclose(type); - H5Dclose(dset); - } - } + case 'E': + enable_error_stack = TRUE; + break; + case 'C': + disable_compact_subset = TRUE; + break; + case 'h': + usage(h5tools_getprogname()); + free_handler(hand, argc); + hand = NULL; + h5tools_setstatus(EXIT_SUCCESS); + goto done; + case '?': + default: + usage(h5tools_getprogname()); + goto error; } + } - /* iterate through all the links */ +parse_end: + /* check for file name to be processed */ + if (argc <= opt_ind) { + error_msg("missing file name\n"); + usage(h5tools_getprogname()); + goto error; + } +done: + return hand; - if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) - H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); - else - H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); +error: + if (hand) { + free_handler(hand, argc); + hand = NULL; } + h5tools_setstatus(EXIT_FAILURE); - indent -= COL; - indentation(indent); - if(isRoot) - HDfprintf(stdout, "\n", xmlnsprefix); - else - HDfprintf(stdout, "\n", xmlnsprefix); - if(par) - free(par); - if(tmp) - free(tmp); + return hand; } - + /*------------------------------------------------------------------------- - * Function: xml_print_refs + * Function: main * - * Purpose: Print a path to the objects referenced by HDF5 Referneces. + * Purpose: HDF5 dumper * - * Return: void + * Return: Success: 0 + * Failure: 1 * - * Programmer: REMcG + * Programmer: Ruey-Hsia Li * * Modifications: + * Albert Cheng + * 30. September 2000 + * Add the -o option--output file for datasets raw data + * + * REMcG + * November 2000 + * Changes to support XML. + * + * Bill Wendling + * Wednesday, 10. January 2001 + * Modified the way command line parameters are interpreted. They go + * through one function call now (get_option). + * + * Bill Wendling + * Tuesday, 20. February 2001 + * Moved command line parsing to separate function. Made various + * "display_*" flags global. + * + * REMcG + * August 2003 + * Major upgrade to XML support. + * + * Pedro Vicente + * September 2007 + * list objects in requested order (creation order or alphabetically) * *------------------------------------------------------------------------- */ -static int -xml_print_refs(hid_t did, int source) +int +main(int argc, const char *argv[]) { - herr_t e; - hid_t type; - hid_t space; - hssize_t ssiz; - hsize_t i; - size_t tsiz; - hobj_ref_t *refbuf = NULL; - char *buf = NULL; - - if (source == DATASET_DATA) { - type = H5Dget_type(did); - } - else if (source == ATTRIBUTE_DATA) { - type = H5Aget_type(did); - } - else { - /* return an error */ - return FAIL; - } - if (H5Tget_class(type) != H5T_REFERENCE) { - /* return an error */ - goto error; - } - if (!H5Tequal(type, H5T_STD_REF_OBJ)) { - /* region ref not supported yet... */ - /* return an error */ - goto error; - } - if (source == DATASET_DATA) { - space = H5Dget_space(did); - if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0) - goto error; - if ((tsiz = H5Tget_size(type)) == 0) - goto error; + hid_t fid = -1; + hid_t gid = -1; + H5E_auto2_t func; + H5O_info_t oi; + struct handler_t *hand; + int i; + unsigned u; + void *edata; + char *fname = NULL; - buf = (char *) calloc((size_t)(ssiz * tsiz), sizeof(char)); - if (buf == NULL) - goto error; - e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - /* need to check result here */ - if (e < 0) { - goto error; - } - } - else if (source == ATTRIBUTE_DATA) { - space = H5Aget_space(did); - if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0) - goto error; - if ((tsiz = H5Tget_size(type)) == 0) - goto error; + h5tools_setprogname(PROGRAMNAME); + h5tools_setstatus(EXIT_SUCCESS); + h5tools_dump_header_format = &h5tools_standardformat; + dump_function_table = &ddl_function_table; + dump_indent = 0; - buf = (char *) calloc((size_t)(ssiz * tsiz), sizeof(char)); - if (buf == NULL) { - goto error; - } - e = H5Aread(did, H5T_STD_REF_OBJ, buf); - /* need to check the result here */ - if (e < 0) { - goto error; - } + /* Disable error reporting */ + H5Eget_auto2(H5E_DEFAULT, &func, &edata); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + + /* Initialize h5tools lib */ + h5tools_init(); + if((hand = parse_command_line(argc, argv))==NULL) { + goto done; } - refbuf = (hobj_ref_t *) buf; + if (bin_output && outfname == NULL) { + error_msg("binary output requires a file name, use -o \n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } - for (i = 0; i < ssiz; i++) { - const char *path = lookup_ref_path(*refbuf); - indentation(indent + COL); + if (enable_error_stack) + H5Eset_auto2(H5E_DEFAULT, func, edata); - if (!path) { - HDfprintf(stdout, "\"%s\"\n", "NULL"); + /* Check for conflicting options */ + if (doxml) { + if (!display_all) { + error_msg("option \"%s\" not available for XML\n", + "to display selected objects"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + else if (display_bb) { + error_msg("option \"%s\" not available for XML\n", "--boot-block"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + else if (display_oid == 1) { + error_msg("option \"%s\" not available for XML\n", "--object-ids"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + else if (display_char == TRUE) { + error_msg("option \"%s\" not available for XML\n", "--string"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + else if (usingdasho) { + error_msg("option \"%s\" not available for XML\n", "--output"); + h5tools_setstatus(EXIT_FAILURE); + goto done; } - else { - char *t_path = xml_escape_the_string(path, -1); - - HDfprintf(stdout, "\"%s\"\n", t_path); - free(t_path); + } + else { + if (xml_dtd_uri) { + warn_msg("option \"%s\" only applies with XML: %s\n", "--xml-dtd", xml_dtd_uri); } - - refbuf++; } - free(buf); - H5Tclose(type); - H5Sclose(space); - return SUCCEED; - -error: - if(buf) - free(buf); - - H5E_BEGIN_TRY { - H5Tclose(type); - H5Sclose(space); - } H5E_END_TRY; - return FAIL; -} - -/*------------------------------------------------------------------------- - * Function: xml_print_strs - * - * Purpose: Print strings. - * - * Return: void - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static int -xml_print_strs(hid_t did, int source) -{ - herr_t e; - hid_t type; - hid_t space; - hssize_t ssiz; - htri_t is_vlstr = FALSE; - size_t tsiz; - size_t i; - size_t str_size = 0; - char *bp = NULL; - char *onestring = NULL; - void *buf = NULL; - - if (source == DATASET_DATA) { - type = H5Dget_type(did); - } - else if (source == ATTRIBUTE_DATA) { - type = H5Aget_type(did); - } - else { - /* return an error */ - return FAIL; - } - if (H5Tget_class(type) != H5T_STRING) { - /* return an error */ - goto error; + if (argc <= opt_ind) { + error_msg("missing file name\n"); + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_FAILURE); + goto done; } - /* Check if we have VL data in the dataset's datatype */ - is_vlstr = H5Tis_variable_str(type); - - if (source == DATASET_DATA) { - space = H5Dget_space(did); - if((ssiz = H5Sget_simple_extent_npoints(space)) < 0) - goto error; - if((tsiz = H5Tget_size(type)) == 0) - goto error; + fname = HDstrdup(argv[opt_ind]); - buf = malloc((size_t)(ssiz * tsiz)); - if (buf == NULL) - goto error; + fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, driver, NULL, 0); - e = H5Dread(did, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - if (e < 0) { - goto error; - } + if (fid < 0) { + error_msg("unable to open file \"%s\"\n", fname); + h5tools_setstatus(EXIT_FAILURE); + goto done; } - else if (source == ATTRIBUTE_DATA) { - space = H5Aget_space(did); - if((ssiz = H5Sget_simple_extent_npoints(space)) < 0) - goto error; - if((tsiz = H5Tget_size(type)) == 0) - goto error; - buf = malloc((size_t)(ssiz * tsiz)); - if (buf == NULL) - goto error; - - e = H5Aread(did, type, buf); - if (e < 0) { - goto error; - } - } + /* allocate and initialize internal data structure */ + init_prefix(&prefix, prefix_len); - bp = (char*) buf; - if (!is_vlstr) - onestring = (char *) calloc(tsiz, sizeof(char)); + /* Prepare to find objects that might be targets of a reference */ + fill_ref_path_table(fid); - for (i = 0; i < ssiz; i++) { - if (is_vlstr) { - onestring = *(char **) bp; - if (onestring) - str_size = (size_t) HDstrlen(onestring); - } - else { - HDstrncpy(onestring, bp, tsiz); - str_size = tsiz; - } - indentation(indent + COL); + if(doxml) { + /* initialize XML */ + /* reset prefix! */ + HDstrcpy(prefix, ""); - if (!onestring) { - HDfprintf(stdout, "NULL\n"); - } + /* make sure the URI is initialized to something */ + if (xml_dtd_uri == NULL) { + if (useschema) { + xml_dtd_uri = DEFAULT_XSD; + } + else { + xml_dtd_uri = DEFAULT_DTD; + xmlnsprefix = ""; + } + } else { - char *t_onestring = xml_escape_the_string(onestring, (int) str_size); - if (t_onestring) { - HDfprintf(stdout, "\"%s\"\n", t_onestring); - free(t_onestring); + if (useschema && strcmp(xmlnsprefix,"")) { + error_msg("Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; } } + } - bp += tsiz; + /* Get object info for root group */ + if(H5Oget_info_by_name(fid, "/", &oi, H5P_DEFAULT) < 0) { + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + h5tools_setstatus(EXIT_FAILURE); + goto done; } - /* Reclaim any VL memory, if necessary */ - if (!is_vlstr) - if (onestring) - free(onestring); - if (buf) { - if (is_vlstr) - H5Dvlen_reclaim(type, space, H5P_DEFAULT, buf); - free(buf); + /* Initialize object tables */ + if(table_list_add(fid, oi.fileno) < 0) { + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + h5tools_setstatus(EXIT_FAILURE); + goto done; } - H5Tclose(type); - H5Sclose(space); - return SUCCEED; - -error: - if(buf) - free(buf); - - H5E_BEGIN_TRY { - H5Tclose(type); - H5Sclose(space); - } H5E_END_TRY; - return FAIL; -} + group_table = table_list.tables[0].group_table; + dset_table = table_list.tables[0].dset_table; + type_table = table_list.tables[0].type_table; -/*------------------------------------------------------------------------- - * Function: check_filters - * - * Purpose: private function to check for the filters and - * put tags in the XML. - * - * Return: void - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -check_filters(hid_t dcpl) -{ - int nfilt; - int i; - H5Z_filter_t filter; - char namebuf[120]; - size_t cd_nelmts = 20; - unsigned int cd_values[20]; - unsigned int flags; - - nfilt = H5Pget_nfilters(dcpl); - if (nfilt <= 0) - return; - for (i = 0; i < nfilt; i++) { - filter = H5Pget_filter2(dcpl, (unsigned) i, &flags, (size_t *) &cd_nelmts, cd_values, 120, namebuf, NULL); - if (filter == H5Z_FILTER_DEFLATE) { - indentation(indent + COL); - HDfprintf(stdout, "<%sDeflate Level=\"", xmlnsprefix); - if (cd_nelmts < 1) { - /* not sure what this means? */ - HDfprintf(stdout, "6"); - } - else { - HDfprintf(stdout, "%d", cd_values[0]); - } - HDfprintf(stdout, "\"/>\n"); - } - else if (filter == H5Z_FILTER_FLETCHER32) { - indentation(indent + COL); - HDfprintf(stdout, "<%sFletcher32 />", xmlnsprefix); - } - else if (filter == H5Z_FILTER_SHUFFLE) { - indentation(indent + COL); - HDfprintf(stdout, "<%sShuffle />", xmlnsprefix); - } - else if (filter == H5Z_FILTER_SZIP) { + /* does there exist unamed committed datatype */ + for (u = 0; u < type_table->nobjs; u++) + if (!type_table->objs[u].recorded) { + unamedtype = 1; + break; + } /* end if */ - indentation(indent + COL); - HDfprintf(stdout, "<%sSZIP ", xmlnsprefix); - if (cd_nelmts < 2) { - /* no pixels ? */ - HDfprintf(stdout, "Pixels_per_block=\"-1\" "); - } + /* start to dump - display file header information */ + if (!doxml) { + begin_obj(h5tools_dump_header_format->filebegin, fname, h5tools_dump_header_format->fileblockbegin); + } + else { + HDfprintf(stdout, "\n"); + + /* alternative first element, depending on schema or DTD. */ + if (useschema) { + if (strcmp(xmlnsprefix,"") == 0) { + HDfprintf(stdout, "\n", + xml_dtd_uri); + } else { - HDfprintf(stdout, "Pixels_per_block=\"%d\" ", cd_values[1]); - } - /* analyse the options mask */ - if (cd_values[0] & H5_SZIP_CHIP_OPTION_MASK) { - HDfprintf(stdout, "Mode =\"Hardware\" "); - } - else if (cd_values[0] & H5_SZIP_ALLOW_K13_OPTION_MASK) { - HDfprintf(stdout, "Mode =\"K13\" "); - } - HDfprintf(stdout, "Coding=\""); - if (cd_values[0] & H5_SZIP_EC_OPTION_MASK) { - HDfprintf(stdout, "Entropy"); - } - else if (cd_values[0] & H5_SZIP_NN_OPTION_MASK) { - HDfprintf(stdout, "NN"); - } - HDfprintf(stdout, "\" "); +/* TO DO: make -url option work in this case (may need new option) */ + char *ns; + char *indx; - HDfprintf(stdout, "ByteOrder=\""); - if (cd_values[0] & H5_SZIP_LSB_OPTION_MASK) { - HDfprintf(stdout, "LSB"); - } - else if (cd_values[0] & H5_SZIP_MSB_OPTION_MASK) { - HDfprintf(stdout, "MSB"); - } - HDfprintf(stdout, "\" "); + ns = HDstrdup(xmlnsprefix); + indx = strrchr(ns,(int)':'); + if (indx) *indx = '\0'; - if (cd_values[0] & H5_SZIP_RAW_OPTION_MASK) { - HDfprintf(stdout, "Header=\"Raw\""); + HDfprintf(stdout, "<%sHDF5-File xmlns:%s=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " + "xsi:schemaLocation=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File " + "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\">\n",xmlnsprefix,ns); + HDfree(ns); } - HDfprintf(stdout, "/>\n"); - } + } else { - /* unknown option */ + HDfprintf(stdout, "\n", xml_dtd_uri); + HDfprintf(stdout, "\n"); } } -} - -static void -xml_dump_fill_value(hid_t dcpl, hid_t type) -{ - size_t sz; - size_t i; - hsize_t space; - void *buf; - char *name; - - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sData>\n", xmlnsprefix); - indent += COL; - space = H5Tget_size(type); - buf = malloc((size_t) space); - - H5Pget_fill_value(dcpl, type, buf); + if (!doxml) { + if (display_fi) { + HDfprintf(stdout, "\n"); + dump_fcontents(fid); + end_obj(h5tools_dump_header_format->fileend,h5tools_dump_header_format->fileblockend); + HDfprintf(stdout, "\n"); + goto done; + } - if (H5Tget_class(type) == H5T_REFERENCE) { - const char * path = lookup_ref_path(*(hobj_ref_t *) buf); + if (display_bb) + dump_fcpl(fid); + } - indentation(indent); - HDfprintf(stdout, "<%sDataFromFile>\n", xmlnsprefix); - if (!path) { - HDfprintf(stdout, "\"%s\"\n", "NULL"); + if(display_all) { + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) { + error_msg("unable to open root group\n"); + h5tools_setstatus(EXIT_FAILURE); } else { - char *t_path = xml_escape_the_string(path, -1); - - HDfprintf(stdout, "\"%s\"\n", t_path); - free(t_path); - } - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - } - else if (H5Tget_class(type) == H5T_STRING) { - /* ????? */ - indentation(indent); - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "<%sNoData />\n", xmlnsprefix); - } - else { - /* all other data */ - switch (H5Tget_class(type)) { - case H5T_INTEGER: - indentation(indent); - HDfprintf(stdout, "<%sDataFromFile>\n", xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\"%d\"\n", *(int *) buf); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - break; - case H5T_FLOAT: - indentation(indent); - HDfprintf(stdout, "<%sDataFromFile>\n", xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\"%f\"\n", *(float *) buf); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - break; - case H5T_BITFIELD: - case H5T_OPAQUE: - indentation(indent); - HDfprintf(stdout, "<%sDataFromFile>\n", xmlnsprefix); - sz = H5Tget_size(type); - indentation(indent); - HDfprintf(stdout, "\""); - for (i = 0; i < sz; i++) { - HDfprintf(stdout, "%x ", *(unsigned int *) buf); - buf = (char *) buf + sizeof(unsigned int); - } - HDfprintf(stdout, "\"\n"); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - break; - case H5T_ENUM: - indentation(indent); - HDfprintf(stdout, "<%sDataFromFile>\n", xmlnsprefix); - name = H5Tget_member_name(type, *(unsigned *) buf); - indentation(indent); - HDfprintf(stdout, "\"%s\"\n", name); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - break; - case H5T_ARRAY: - indentation(indent); - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "<%sNoData />\n", xmlnsprefix); - break; - case H5T_TIME: - indentation(indent); - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "<%sNoData />\n", xmlnsprefix); - break; - case H5T_COMPOUND: - indentation(indent); - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "<%sNoData />\n", xmlnsprefix); - break; - case H5T_VLEN: - indentation(indent); - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "<%sNoData />\n", xmlnsprefix); - break; - default: - indentation(indent); - HDfprintf(stdout, "\n", H5Tget_class(type)); - indentation(indent); - HDfprintf(stdout, "<%sNoData/>\n", xmlnsprefix); - break; + if (!doxml) + dump_indent += COL; + dump_function_table->dump_group_function(gid, "/" ); + if (!doxml) + dump_indent -= COL; + HDfprintf(stdout, "\n"); } - } - free(buf); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - indent -= COL; -} -/*------------------------------------------------------------------------- - * Function: xml_dump_dataset - * - * Purpose: Dump a description of an HDF5 dataset in XML. - * - * Return: void - * - * Programmer: REMcG - * - * Modifications: - * Pedro Vicente, October 9, 2007 - * added parameters to H5Aiterate2 to allow for other iteration orders - * - *------------------------------------------------------------------------- - */ -static void -xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) -{ - hid_t type; - hid_t space; - hid_t dcpl; - H5D_fill_value_t fvstatus; - int maxdims; - hsize_t *chsize; - int ndims; - int i; - H5D_alloc_time_t at; - H5D_fill_time_t ft; - hsize_t tempi; - char *tmp; - char *t_name; - char *t_tmp; - char *t_prefix; - unsigned attr_crt_order_flags; - - char *rstr = (char*) HDmalloc(100); - char *pstr = (char*) HDmalloc(100); - - tmp = (char*) HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); - HDstrcpy(tmp, prefix); - HDstrcat(tmp, "/"); - HDstrcat(tmp, name); - indentation(indent); - - t_name = xml_escape_the_name(name); - t_tmp = xml_escape_the_name(tmp); - t_prefix = xml_escape_the_name(prefix); - - xml_name_to_XID(tmp, rstr, 100, 1); - xml_name_to_XID(prefix, pstr, 100, 1); - HDfprintf(stdout, "<%sDataset Name=\"%s\" OBJ-XID=\"%s\" H5Path= \"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">\n", - xmlnsprefix, t_name, rstr, t_tmp, pstr, - strcmp(prefix, "") ? t_prefix : "/"); - - HDfree(t_name); - HDfree(t_tmp); - HDfree(t_prefix); - HDfree(rstr); - HDfree(pstr); - HDfree(tmp); - - dcpl = H5Dget_create_plist(did); - type = H5Dget_type(did); - space = H5Dget_space(did); - - /* query the creation properties for attributes */ - H5Pget_attr_creation_order(dcpl, &attr_crt_order_flags); - - /* Print information about storage layout */ - if (H5D_CHUNKED == H5Pget_layout(dcpl)) { - maxdims = H5Sget_simple_extent_ndims(space); - chsize = (hsize_t *) malloc(maxdims * sizeof(hsize_t)); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sStorageLayout>\n", xmlnsprefix); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sChunkedLayout ", xmlnsprefix); - ndims = H5Pget_chunk(dcpl, maxdims, chsize); - HDfprintf(stdout, "Ndims=\"%d\">\n", ndims); - - indent += COL; - - for (i = 0; i < ndims; i++) { - indentation(indent); - HDfprintf(stdout, "<%sChunkDimension DimSize=\"%Hu\" />\n", xmlnsprefix, chsize[i]); + if(H5Gclose(gid) < 0) { + error_msg("unable to close root group\n"); + h5tools_setstatus(EXIT_FAILURE); } - indentation(indent); - HDfprintf(stdout, "<%sRequiredFilter>\n", xmlnsprefix); - indent += COL; - check_filters(dcpl); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - - indent -= COL; - - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - indent -= COL; - free(chsize); - } - else if (H5D_CONTIGUOUS == H5Pget_layout(dcpl)) { - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sStorageLayout>\n", xmlnsprefix); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sContiguousLayout/>\n", xmlnsprefix); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - indent -= COL; - indentation(indent); - } - else if (H5D_COMPACT == H5Pget_layout(dcpl)) { - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sStorageLayout>\n", xmlnsprefix); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sCompactLayout/>\n", xmlnsprefix); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - indent -= COL; - indentation(indent); - } - /* and check for external.... ?? */ - - /* fill value */ - - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sFillValueInfo ", xmlnsprefix); - H5Pget_fill_time(dcpl, &ft); - HDfprintf(stdout, "FillTime=\""); - switch (ft) { - case H5D_FILL_TIME_ALLOC: - HDfprintf(stdout, "FillOnAlloc"); - break; - case H5D_FILL_TIME_NEVER: - HDfprintf(stdout, "FillNever"); - break; - case H5D_FILL_TIME_IFSET: - HDfprintf(stdout, "FillIfSet"); - break; - default: - HDfprintf(stdout, "?"); - break; - } - HDfprintf(stdout, "\" "); - H5Pget_alloc_time(dcpl, &at); - HDfprintf(stdout, "AllocationTime=\""); - switch (at) { - case H5D_ALLOC_TIME_EARLY: - HDfprintf(stdout, "Early"); - break; - case H5D_ALLOC_TIME_INCR: - HDfprintf(stdout, "Incremental"); - break; - case H5D_ALLOC_TIME_LATE: - HDfprintf(stdout, "Late"); - break; - case H5D_ALLOC_TIME_DEFAULT: - default: - HDfprintf(stdout, "?"); - break; - } - HDfprintf(stdout, "\""); - HDfprintf(stdout, ">\n"); - - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sFillValue>\n", xmlnsprefix); - indent += COL; - H5Pfill_value_defined(dcpl, &fvstatus); - if (fvstatus == H5D_FILL_VALUE_UNDEFINED || - (fvstatus == H5D_FILL_VALUE_DEFAULT && ft == H5D_FILL_TIME_IFSET)) { - indentation(indent + COL); - HDfprintf(stdout, "<%sNoFill/>\n", xmlnsprefix); - } - else { - xml_dump_fill_value(dcpl, type); } - - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - indent -= COL; - - dump_function_table->dump_dataspace_function(space); - dump_function_table->dump_datatype_function(type); - - indent += COL; - - if ((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { - if (H5Aiterate2(did, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end if */ else { - if (H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { - error_msg("error getting attribute information\n"); + /* Note: this option is not supported for XML */ + if(doxml) { + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); h5tools_setstatus(EXIT_FAILURE); + goto done; } /* end if */ - } /* end else */ - - indent -= COL; - tempi = H5Dget_storage_size(did); - - if (display_data && (tempi > 0)) { - switch (H5Tget_class(type)) { - case H5T_INTEGER: - case H5T_FLOAT: - case H5T_STRING: - case H5T_BITFIELD: - case H5T_OPAQUE: - case H5T_ENUM: - case H5T_ARRAY: - dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0); - break; - - case H5T_TIME: - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sData>\n", xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "<%sNoData />\n", xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "<%sData>\n", xmlnsprefix); - indent -= COL; - break; - case H5T_COMPOUND: - indentation(indent); - HDfprintf(stdout, "\n"); - dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0); - break; - - case H5T_REFERENCE: - indentation(indent); - HDfprintf(stdout, "<%sData>\n", xmlnsprefix); - indentation(indent); - if (!H5Tequal(type, H5T_STD_REF_OBJ)) { - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "<%sNoData />\n", xmlnsprefix); - } - else { - HDfprintf(stdout, "<%sDataFromFile>\n", xmlnsprefix); - xml_print_refs(did, DATASET_DATA); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); + for(i = 0; i < argc; i++) { + if(hand[i].func) { + hand[i].func(fid, hand[i].obj, hand[i].subset_info, 1, NULL); } - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - break; - - case H5T_VLEN: - HDfprintf(stdout, "\n"); - dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0); - break; - default: - indentation(indent); - HDfprintf(stdout, "<%sData>\n", xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\n", H5Tget_class(type)); - indentation(indent); - HDfprintf(stdout, "<%sNoData/>\n", xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - break; } + HDfprintf(stdout, "\n"); } - else { - /* no data written */ - indentation(indent + COL); - HDfprintf(stdout, "<%sData>\n", xmlnsprefix); - indentation(indent + COL + COL); - HDfprintf(stdout, "<%sNoData/>\n", xmlnsprefix); - indentation(indent + COL); - HDfprintf(stdout, "\n", xmlnsprefix); - } - - H5Tclose(type); - H5Sclose(space); - H5Pclose(dcpl); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); -} -/*------------------------------------------------------------------------- - * Function: xml_print_enum - * - * Purpose: Print the values of an HDF5 ENUM in XML. - * Very similar to regular DDL output. - * - * Return: void - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -xml_print_enum(hid_t type) -{ - char **name = NULL; /*member names */ - unsigned char *value = NULL; /*value array */ - unsigned nmembs; /*number of members */ - hid_t super; /*enum base integer type */ - hid_t native = -1; /*native integer datatype */ - size_t dst_size; /*destination value type size */ - unsigned i; /*miscellaneous counters */ - size_t j; - - nmembs = (unsigned)H5Tget_nmembers(type); - super = H5Tget_super(type); - - indentation(indent); - HDfprintf(stdout, "<%sDataType>\n",xmlnsprefix); - xml_print_datatype(super,0); - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - - /* - * Determine what datatype to use for the native values. To simplify - * things we entertain three possibilities: - * 1. long long -- the largest native signed integer - * 2. unsigned long long -- the largest native unsigned integer - * 3. raw format - */ - if (H5Tget_size(type) <= sizeof(long long)) { - dst_size = sizeof(long long); - - if (H5T_SGN_NONE == H5Tget_sign(type)) { - native = H5T_NATIVE_ULLONG; - } - else { - native = H5T_NATIVE_LLONG; - } + if (!doxml) { + end_obj(h5tools_dump_header_format->fileend, h5tools_dump_header_format->fileblockend); + HDfprintf(stdout, "\n"); } else { - dst_size = H5Tget_size(type); + HDfprintf(stdout, "\n", xmlnsprefix); } - /* Get the names and raw values of all members */ - name = (char **)calloc(nmembs, sizeof(char *)); - value = (unsigned char *)calloc(nmembs, MAX(H5Tget_size(type), dst_size)); +done: + /* Free tables for objects */ + table_list_free(); - for (i = 0; i < nmembs; i++) { - name[i] = H5Tget_member_name(type, i); - H5Tget_member_value(type, i, value + i * H5Tget_size(type)); - } + if(hand) + free_handler(hand, argc); - /* Convert values to native datatype */ - if (native > 0) - H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT); - - /* Sort members by increasing value */ - /*not implemented yet */ - - /* Print members */ - indent += COL; - for (i = 0; i < nmembs; i++) { - char *t_name = xml_escape_the_name(name[i]); - - indentation(indent); - HDfprintf(stdout, "<%sEnumElement>\n",xmlnsprefix); - indentation(indent + COL); - HDfprintf(stdout, "%s\n", t_name); - free(t_name); - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "<%sEnumValue>\n",xmlnsprefix); - indentation(indent + COL); - if (native < 0) { - HDfprintf(stdout, "0x"); - - for (j = 0; j < dst_size; j++) - HDfprintf(stdout, "%02x", value[i * dst_size + j]); - } - else if (H5T_SGN_NONE == H5Tget_sign(native)) { - HDfprintf(stdout,"%" H5_PRINTF_LL_WIDTH "u", *((unsigned long long *) - ((void *) (value + i * dst_size)))); - } - else { - HDfprintf(stdout,"%" H5_PRINTF_LL_WIDTH "d", - *((long long *) ((void *) (value + i * dst_size)))); - } - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); + if(fid >=0) + if (H5Fclose(fid) < 0) + h5tools_setstatus(EXIT_FAILURE); + + if(prefix) + HDfree(prefix); + if(fname) + HDfree(fname); - } - indent -= COL; + /* To Do: clean up XML table */ - /* Release resources */ - for (i = 0; i < nmembs; i++) - free(name[i]); + H5Eset_auto2(H5E_DEFAULT, func, edata); - free(name); - free(value); - H5Tclose(super); + leave(h5tools_getstatus()); } - /*------------------------------------------------------------------------- * Function: h5_fileaccess * @@ -7326,7 +1576,7 @@ xml_print_enum(hid_t type) * *------------------------------------------------------------------------- */ -static hid_t +hid_t h5_fileaccess(void) { static const char *multi_letters = "msbrglo"; @@ -7452,7 +1702,7 @@ init_prefix(char **prfx, size_t prfx_len) * *------------------------------------------------------------------------- */ -static void +void add_prefix(char **prfx, size_t *prfx_len, const char *name) { size_t new_len = HDstrlen(*prfx) + HDstrlen(name) + 2; @@ -7467,103 +1717,3 @@ add_prefix(char **prfx, size_t *prfx_len, const char *name) HDstrcat(HDstrcat(*prfx, "/"), name); } /* end add_prefix */ - -/*------------------------------------------------------------------------- - * Function: dump_extlink - * - * made by: PVN - * - * Purpose: Dump an external link - * Since external links are soft links, they are dumped on a trial error - * basis, attempting to dump as a dataset, as a group and as a named datatype - * Error messages are supressed - * - * Modifications: - * Neil Fortner - * 13 October 2008 - * Function basically rewritten. No longer directly opens the target file, - * now initializes a new set of tables for the external file. No longer - * dumps on a trial and error basis, but errors are still suppressed. - * - *------------------------------------------------------------------------- - */ - - -static int dump_extlink(hid_t group, const char *linkname, const char *objname) -{ - hid_t oid; - H5O_info_t oi; - table_t *old_group_table = group_table; - table_t *old_dset_table = dset_table; - table_t *old_type_table = type_table; - hbool_t old_hit_elink; - ssize_t idx; - - /* Open target object */ - if ((oid = H5Oopen(group, linkname, H5P_DEFAULT)) < 0) - goto fail; - - /* Get object info */ - if (H5Oget_info(oid, &oi) < 0) { - H5Oclose(oid); - goto fail; - } - - /* Check if we have visited this file already */ - if ((idx = table_list_visited(oi.fileno)) < 0) { - /* We have not visited this file, build object tables */ - if ((idx = table_list_add(oid, oi.fileno)) < 0) { - H5Oclose(oid); - goto fail; - } - } - - /* Do not recurse through an external link into the original file (idx=0) */ - if (idx) { - /* Update table pointers */ - group_table = table_list.tables[idx].group_table; - dset_table = table_list.tables[idx].dset_table; - type_table = table_list.tables[idx].type_table; - - /* We will now traverse the external link, set this global to indicate this */ - old_hit_elink = hit_elink; - hit_elink = TRUE; - - /* add some indentation to distinguish that these objects are external */ - indent += 2*COL; - - /* Recurse into the external file */ - switch (oi.type) { - case H5O_TYPE_GROUP: - handle_groups(group, linkname, NULL, 0, objname); - break; - case H5O_TYPE_DATASET: - handle_datasets(group, linkname, NULL, 0, objname); - break; - case H5O_TYPE_NAMED_DATATYPE: - handle_datatypes(group, linkname, NULL, 0, objname); - break; - default: - h5tools_setstatus(EXIT_FAILURE); - } - - indent -= 2*COL; - - /* Reset table pointers */ - group_table = old_group_table; - dset_table = old_dset_table; - type_table = old_type_table; - - /* Reset hit_elink */ - hit_elink = old_hit_elink; - } /* end if */ - - if (H5Idec_ref(oid) < 0) - h5tools_setstatus(EXIT_FAILURE); - - return SUCCEED; - -fail: - return FAIL; -} - diff --git a/tools/h5dump/h5dump.h b/tools/h5dump/h5dump.h index be77002..7d4f460 100644 --- a/tools/h5dump/h5dump.h +++ b/tools/h5dump/h5dump.h @@ -16,148 +16,97 @@ #define H5DUMP_H__ #include "hdf5.h" +#include "H5private.h" +#include "h5tools.h" +#include "h5tools_utils.h" +#include "h5tools_ref.h" +#include "h5trav.h" +#include "h5dump_defines.h" -#define H5DUMP_MAX_RANK H5S_MAX_RANK +/** + ** This is the global dispatch table for the dump functions. + **/ +/* the table of dump functions */ +typedef struct dump_functions_t { + void (*dump_group_function) (hid_t, const char *); + void (*dump_named_datatype_function) (hid_t, const char *); + void (*dump_dataset_function) (hid_t, const char *, struct subset_t *); + void (*dump_dataspace_function) (hid_t); + void (*dump_datatype_function) (hid_t); + herr_t (*dump_attribute_function) (hid_t, const char *, const H5A_info_t *, void *); + void (*dump_data_function) (hid_t, int, struct subset_t *, int); +} dump_functions; -#define ATTRIBUTE_DATA 0 -#define DATASET_DATA 1 -#define ENUM_DATA 2 -#define COL 3 +/* List of table structures. There is one table structure for each file */ +typedef struct h5dump_table_list_t { + size_t nalloc; + size_t nused; + struct { + unsigned long fileno; /* File number that these tables refer to */ + hid_t oid; /* ID of an object in this file, held open so fileno is consistent */ + table_t *group_table; /* Table of groups */ + table_t *dset_table; /* Table of datasets */ + table_t *type_table; /* Table of datatypes */ + } *tables; +} h5dump_table_list_t; -/* Strings for output */ -#define ATTRIBUTE "ATTRIBUTE" -#define BLOCK "BLOCK" -#define SUPER_BLOCK "SUPER_BLOCK" -#define COMPRESSION "COMPRESSION" -#define CONCATENATOR "//" -#define COMPLEX "COMPLEX" -#define COUNT "COUNT" -#define CSET "CSET" -#define CTYPE "CTYPE" -#define DATA "DATA" -#define DATASPACE "DATASPACE" -#define EXTERNAL "EXTERNAL" -#define FILENO "FILENO" -#define HARDLINK "HARDLINK" -#define NLINK "NLINK" -#define OBJID "OBJECTID" -#define OBJNO "OBJNO" -#define S_SCALAR "SCALAR" -#define S_SIMPLE "SIMPLE" -#define S_NULL "NULL" -#define SOFTLINK "SOFTLINK" -#define EXTLINK "EXTERNAL_LINK" -#define UDLINK "USERDEFINED_LINK" -#define START "START" -#define STRIDE "STRIDE" -#define STRSIZE "STRSIZE" -#define STRPAD "STRPAD" -#define SUBSET "SUBSET" -#define FILTERS "FILTERS" -#define DEFLATE "COMPRESSION DEFLATE" -#define DEFLATE_LEVEL "LEVEL" -#define SHUFFLE "PREPROCESSING SHUFFLE" -#define FLETCHER32 "CHECKSUM FLETCHER32" -#define SZIP "COMPRESSION SZIP" -#define NBIT "COMPRESSION NBIT" -#define SCALEOFFSET "COMPRESSION SCALEOFFSET" -#define SCALEOFFSET_MINBIT "MIN BITS" -#define STORAGE_LAYOUT "STORAGE_LAYOUT" -#define CONTIGUOUS "CONTIGUOUS" -#define COMPACT "COMPACT" -#define CHUNKED "CHUNKED" -#define EXTERNAL_FILE "EXTERNAL_FILE" -#define FILLVALUE "FILLVALUE" -#define FILE_CONTENTS "FILE_CONTENTS" -#define PACKED_BITS "PACKED_BITS" -#define PACKED_OFFSET "OFFSET" -#define PACKED_LENGTH "LENGTH" +h5dump_table_list_t table_list = {0, 0, NULL}; +table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL; +int dump_indent = 0; /*how far in to indent the line */ -#define BEGIN "{" -#define END "}" +int unamedtype = 0; /* shared datatype with no name */ +hbool_t hit_elink = FALSE; /* whether we have traversed an external link */ +size_t prefix_len = 1024; +char *prefix = NULL; +const char *fp_format = NULL; -typedef struct h5dump_header_t { - const char *name; - const char *filebegin; - const char *fileend; - const char *bootblockbegin; - const char *bootblockend; - const char *groupbegin; - const char *groupend; - const char *datasetbegin; - const char *datasetend; - const char *attributebegin; - const char *attributeend; - const char *datatypebegin; - const char *datatypeend; - const char *dataspacebegin; - const char *dataspaceend; - const char *databegin; - const char *dataend; - const char *softlinkbegin; - const char *softlinkend; - const char *extlinkbegin; - const char *extlinkend; - const char *udlinkbegin; - const char *udlinkend; - const char *subsettingbegin; - const char *subsettingend; - const char *startbegin; - const char *startend; - const char *stridebegin; - const char *strideend; - const char *countbegin; - const char *countend; - const char *blockbegin; - const char *blockend; +/* things to display or which are set via command line parameters */ +int display_all = TRUE; +int display_oid = FALSE; +int display_data = TRUE; +int display_attr_data = TRUE; +int display_char = FALSE; /*print 1-byte numbers as ASCII */ +int usingdasho = FALSE; +int display_bb = FALSE; /*superblock */ +int display_dcpl = FALSE; /*dcpl */ +int display_fi = FALSE; /*file index */ +int display_ai = TRUE; /*array index */ +int display_escape = FALSE; /*escape non printable characters */ +int display_region = FALSE; /*print region reference data */ +int enable_error_stack= FALSE; /* re-enable error stack */ +int disable_compact_subset= FALSE; /* disable compact form of subset notation */ +int display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/ - const char *fileblockbegin; - const char *fileblockend; - const char *bootblockblockbegin; - const char *bootblockblockend; - const char *groupblockbegin; - const char *groupblockend; - const char *datasetblockbegin; - const char *datasetblockend; - const char *attributeblockbegin; - const char *attributeblockend; - const char *datatypeblockbegin; - const char *datatypeblockend; - const char *dataspaceblockbegin; - const char *dataspaceblockend; - const char *datablockbegin; - const char *datablockend; - const char *softlinkblockbegin; - const char *softlinkblockend; - const char *extlinkblockbegin; - const char *extlinkblockend; - const char *udlinkblockbegin; - const char *udlinkblockend; - const char *strblockbegin; - const char *strblockend; - const char *enumblockbegin; - const char *enumblockend; - const char *structblockbegin; - const char *structblockend; - const char *vlenblockbegin; - const char *vlenblockend; - const char *subsettingblockbegin; - const char *subsettingblockend; - const char *startblockbegin; - const char *startblockend; - const char *strideblockbegin; - const char *strideblockend; - const char *countblockbegin; - const char *countblockend; - const char *blockblockbegin; - const char *blockblockend; +/* sort parameters */ +H5_index_t sort_by = H5_INDEX_NAME; /*sort_by [creation_order | name] */ +H5_iter_order_t sort_order = H5_ITER_INC; /*sort_order [ascending | descending] */ - const char *dataspacedescriptionbegin; - const char *dataspacedescriptionend; - const char *dataspacedimbegin; - const char *dataspacedimend; +#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */ +#define PACKED_BITS_SIZE_MAX 8*sizeof(long long) /* Maximum bits size of integer types of packed-bits */ +/* mask list for packed bits */ +unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */ -} h5dump_header_t; +/* packed bits display parameters */ +int packed_offset[PACKED_BITS_MAX]; +int packed_length[PACKED_BITS_MAX]; +/* + * The global table is set to either ddl_function_table or + * xml_function_table in the initialization. + */ +const dump_functions *dump_function_table; + +#ifdef __cplusplus +"C" { +#endif + +void add_prefix(char **prfx, size_t *prfx_len, const char *name); +hid_t h5_fileaccess(void); +ssize_t table_list_add(hid_t oid, unsigned long file_no); +ssize_t table_list_visited(unsigned long file_no); + +#ifdef __cplusplus +} +#endif #endif /* !H5DUMP_H__ */ diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c new file mode 100644 index 0000000..48f1396 --- /dev/null +++ b/tools/h5dump/h5dump_ddl.c @@ -0,0 +1,1931 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include +#include + +#include "H5private.h" +#include "h5tools.h" +#include "h5tools_dump.h" +#include "h5tools_utils.h" +#include "h5tools_ref.h" +#include "h5trav.h" +#include "h5dump_extern.h" +#include "h5dump_ddl.h" + +/*------------------------------------------------------------------------- + * Function: dump_datatype + * + * Purpose: Dump the datatype. Datatype can be HDF5 predefined + * atomic datatype or committed/transient datatype. + * + * Return: void + * + * Programmer: Ruey-Hsia Li + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +dump_datatype(hid_t type) +{ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &h5tools_dataformat; + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + h5dump_type_table = type_table; + h5tools_dump_datatype(stdout, outputformat, &ctx, type); + h5dump_type_table = NULL; +} + +/*------------------------------------------------------------------------- + * Function: dump_dataspace + * + * Purpose: Dump the dataspace. Dataspace can be named dataspace, + * array, or others. + * + * Return: void + * + * Programmer: Ruey-Hsia Li + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +dump_dataspace(hid_t space) +{ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &h5tools_dataformat; + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + h5tools_dump_dataspace(stdout, outputformat, &ctx, space); +} + + +/*------------------------------------------------------------------------- + * Function: dump_attr_cb + * + * Purpose: attribute function callback called by H5Aiterate2, displays the attribute + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Ruey-Hsia Li + * + * Modifications: Pedro Vicente, October 4, 2007 + * Added H5A_info_t parameter to conform with H5Aiterate2 + * + *------------------------------------------------------------------------- + */ +herr_t +dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t UNUSED *info, void UNUSED *_op_data) +{ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &h5tools_dataformat; + h5tool_format_t string_dataformat; + + hid_t attr_id; + herr_t ret = SUCCEED; + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT); + oid_output = display_oid; + data_output = display_data; + attr_data_output = display_attr_data; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + h5dump_type_table = type_table; + h5tools_dump_attribute(stdout, outputformat, &ctx, oid, attr_name, attr_id, display_ai, display_char); + h5dump_type_table = NULL; + + if(attr_id < 0) { + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + + return ret; +} + +/*------------------------------------------------------------------------- + * Function: dump_all_cb + * + * Purpose: function callback called by H5Literate, + * displays everything in the specified object + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Ruey-Hsia Li + * + * Modifications: + * RMcG, November 2000 + * Added XML support. Also, optionally checks the op_data argument + * + * PVN, May 2008 + * Dump external links + * + *------------------------------------------------------------------------- + */ +herr_t +dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED *op_data) +{ + hid_t obj; + herr_t ret = SUCCEED; + char *obj_path = NULL; /* Full path of object */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &h5tools_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + memset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + /* Build the object's path name */ + obj_path = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + if(!obj_path) { + ret = FAIL; + goto done; + } + + HDstrcpy(obj_path, prefix); + HDstrcat(obj_path, "/"); + HDstrcat(obj_path, name); + + if(linfo->type == H5L_TYPE_HARD) { + H5O_info_t oinfo; + + /* Stat the object */ + if(H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) { + error_msg("unable to get object information for \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + goto done; + } /* end if */ + + switch(oinfo.type) { + case H5O_TYPE_GROUP: + if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) { + error_msg("unable to dump group \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + else { + char *old_prefix; /* Pointer to previous prefix */ + + /* Keep copy of prefix before iterating into group */ + old_prefix = HDstrdup(prefix); + HDassert(old_prefix); + + /* Append group name to prefix */ + add_prefix(&prefix, &prefix_len, name); + + /* Iterate into group */ + dump_function_table->dump_group_function(obj, name); + + /* Restore old prefix name */ + HDstrcpy(prefix, old_prefix); + HDfree(old_prefix); + + /* Close group */ + H5Gclose(obj); + } + break; + + case H5O_TYPE_DATASET: + if((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) { + if(oinfo.rc > 1 || hit_elink) { + obj_t *found_obj; /* Found object */ + + found_obj = search_obj(dset_table, oinfo.addr); + + if(found_obj == NULL) { + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->datasetbegin, name, + h5tools_dump_header_format->datasetblockbegin); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + if(strlen(h5tools_dump_header_format->datasetblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend); + if(strlen(h5tools_dump_header_format->datasetend)) + h5tools_str_append(&buffer, " "); + } + if(strlen(h5tools_dump_header_format->datasetend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + H5Dclose(obj); + goto done; + } + else if(found_obj->displayed) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->datasetbegin, name, + h5tools_dump_header_format->datasetblockbegin); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + if(strlen(h5tools_dump_header_format->datasetblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend); + if(strlen(h5tools_dump_header_format->datasetend)) + h5tools_str_append(&buffer, " "); + } + if(strlen(h5tools_dump_header_format->datasetend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + H5Dclose(obj); + goto done; + } + else { + found_obj->displayed = TRUE; + } + } /* end if */ + + dump_function_table->dump_dataset_function(obj, name, NULL); + H5Dclose(obj); + } + else { + error_msg("unable to dump dataset \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + break; + + case H5O_TYPE_NAMED_DATATYPE: + if((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) { + error_msg("unable to dump datatype \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + else { + dump_function_table->dump_named_datatype_function(obj, name); + H5Tclose(obj); + } + break; + + default: + error_msg("unknown object \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + } /* end if */ + else { + char *targbuf; + + switch(linfo->type) { + case H5L_TYPE_SOFT: + targbuf = (char *)HDmalloc(linfo->u.val_size); + HDassert(targbuf); + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->softlinkbegin, name, + h5tools_dump_header_format->softlinkblockbegin); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + + if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { + error_msg("unable to get link value\n"); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + else { + /* print the value of a soft link */ + /* Standard DDL: no modification */ + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "LINKTARGET \"%s\"", targbuf); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + if(strlen(h5tools_dump_header_format->softlinkblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkblockend); + if(strlen(h5tools_dump_header_format->softlinkend)) + h5tools_str_append(&buffer, " "); + } + if(strlen(h5tools_dump_header_format->softlinkend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkend); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + HDfree(targbuf); + break; + + case H5L_TYPE_EXTERNAL: + targbuf = (char *)HDmalloc(linfo->u.val_size); + HDassert(targbuf); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->extlinkbegin, name, + h5tools_dump_header_format->extlinkblockbegin); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { + indentation(dump_indent); + error_msg("unable to get external link value\n"); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } /* end if */ + else { + const char *filename; + const char *targname; + + if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) { + indentation(dump_indent); + error_msg("unable to unpack external link value\n"); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } /* end if */ + else { + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "TARGETFILE \"%s\"", filename); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "TARGETPATH \"%s\"", targname); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + /* dump the external link */ + dump_extlink(group, name, targname); + ctx.indent_level--; + } /* end else */ + } /* end else */ + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + if(strlen(h5tools_dump_header_format->extlinkblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkblockend); + if(strlen(h5tools_dump_header_format->extlinkend)) + h5tools_str_append(&buffer, " "); + } + if(strlen(h5tools_dump_header_format->extlinkend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkend); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + HDfree(targbuf); + break; + + default: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->udlinkbegin, name, + h5tools_dump_header_format->udlinkblockbegin); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "LINKCLASS %d", linfo->type); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + if(strlen(h5tools_dump_header_format->udlinkblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkblockend); + if(strlen(h5tools_dump_header_format->udlinkend)) + h5tools_str_append(&buffer, " "); + } + if(strlen(h5tools_dump_header_format->udlinkend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkend); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + break; + } /* end switch */ + } /* end else */ + +done: + + h5tools_str_close(&buffer); + + if(obj_path) + HDfree(obj_path); + return ret; +} + +/*------------------------------------------------------------------------- + * Function: dump_named_datatype + * + * Purpose: Dump named datatype + * + * Return: void + * + * Programmer: Ruey-Hsia Li + * + * Modifications: + * Pedro Vicente, March 27, 2006 + * added display of attributes + * Pedro Vicente, October 4, 2007, added parameters to H5Aiterate2() to allow for + * other iteration orders + * + *------------------------------------------------------------------------- + */ +void +dump_named_datatype(hid_t tid, const char *name) +{ + H5O_info_t oinfo; + unsigned attr_crt_order_flags; + hid_t tcpl_id = -1; /* datatype creation property list ID */ + hsize_t curr_pos = 0; /* total data element position */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &h5tools_dataformat; + h5tool_format_t string_dataformat; + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + memset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + if ((tcpl_id = H5Tget_create_plist(tid)) < 0) { + error_msg("error in getting creation property list ID\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + /* query the creation properties for attributes */ + if (H5Pget_attr_creation_order(tcpl_id, &attr_crt_order_flags) < 0) { + error_msg("error in getting creation properties\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + if(H5Pclose(tcpl_id) < 0) { + error_msg("error in closing creation property list ID\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->datatypebegin, name, + h5tools_dump_header_format->datatypeblockbegin); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + H5Oget_info(tid, &oinfo); + + /* Must check for uniqueness of all objects if we've traversed an elink, + * otherwise only check if the reference count > 1. + */ + if(oinfo.rc > 1 || hit_elink) { + obj_t *found_obj; /* Found object */ + + found_obj = search_obj(type_table, oinfo.addr); + + if (found_obj == NULL) { + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + else if (found_obj->displayed) { + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + goto done; + } + else + found_obj->displayed = TRUE; + } /* end if */ + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_print_datatype(stdout, &buffer, outputformat, &ctx, tid, FALSE); + + if(H5Tget_class(tid) != H5T_COMPOUND) { + h5tools_str_append(&buffer, ";"); + } + + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + /* print attributes */ + dump_indent += COL; + + /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set + in the datatype's create property list for attributes, then, sort by creation order, otherwise by name */ + + if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { + if(H5Aiterate2(tid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end if */ + else { + if(H5Aiterate2(tid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end else */ + + dump_indent -= COL; + +done: + /* Render the element */ + h5tools_str_reset(&buffer); + if(strlen(h5tools_dump_header_format->datatypeblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeblockend); + if(strlen(h5tools_dump_header_format->datatypeend)) + h5tools_str_append(&buffer, " "); + } + if(strlen(h5tools_dump_header_format->datatypeend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeend); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: dump_group + * + * Purpose: Dump everything within the specified group + * + * Return: void + * + * Programmer: Ruey-Hsia Li + * + * Modifications: + * + * Call to dump_all_cb -- add parameter to select everything. + * + * Pedro Vicente, October 1, 2007 + * handle several iteration orders for attributes and groups + * + *------------------------------------------------------------------------- + */ +void +dump_group(hid_t gid, const char *name) +{ + H5O_info_t oinfo; + hid_t dset; + hid_t type; + hid_t gcpl_id; + unsigned crt_order_flags; + unsigned attr_crt_order_flags; + char type_name[1024]; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &h5tools_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + if ((gcpl_id = H5Gget_create_plist(gid)) < 0) { + error_msg("error in getting group creation property list ID\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + /* query the group creation properties for attributes */ + if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0) { + error_msg("error in getting group creation properties\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + /* query the group creation properties */ + if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) { + error_msg("error in getting group creation properties\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + if(H5Pclose(gcpl_id) < 0) { + error_msg("error in closing group creation property list ID\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + memset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->groupbegin, name, + h5tools_dump_header_format->groupblockbegin); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + dump_indent += COL; + + if(!HDstrcmp(name, "/") && unamedtype) { + unsigned u; /* Local index variable */ + + /* dump unamed type in root group */ + for(u = 0; u < type_table->nobjs; u++) + if(!type_table->objs[u].recorded) { + dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); + type = H5Dget_type(dset); + sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); + dump_function_table->dump_named_datatype_function(type, type_name); + H5Tclose(type); + H5Dclose(dset); + } + } /* end if */ + + if(display_oid) { + h5tools_dump_oid(stdout, outputformat, &ctx, gid); + } + + h5tools_dump_comment(stdout, outputformat, &ctx, gid); + + H5Oget_info(gid, &oinfo); + + /* Must check for uniqueness of all objects if we've traversed an elink, + * otherwise only check if the reference count > 1. + */ + if(oinfo.rc > 1 || hit_elink) { + obj_t *found_obj; /* Found object */ + + found_obj = search_obj(group_table, oinfo.addr); + + if (found_obj == NULL) { + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + h5tools_setstatus(EXIT_FAILURE); + } + else if (found_obj->displayed) { + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + found_obj->displayed = TRUE; + /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set + in the group for attributes, then, sort by creation order, otherwise by name */ + + if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { + if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end if */ + else { + if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end else */ + + /* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set + in the group, then, sort by creation order, otherwise by name */ + if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) + H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); + else + H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); + } + } + else { + /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set + in the group for attributes, then, sort by creation order, otherwise by name */ + + if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { + if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end if */ + else { + if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end else */ + + /* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set + in the group, then, sort by creation order, otherwise by name */ + if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) + H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); + else + H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); + } + + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + if(strlen(h5tools_dump_header_format->groupblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->groupblockend); + if(strlen(h5tools_dump_header_format->groupend)) + h5tools_str_append(&buffer, " "); + } + if(strlen(h5tools_dump_header_format->groupend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->groupend); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: dump_dataset + * + * Purpose: Dump the specified data set + * + * Return: void + * + * Programmer: Ruey-Hsia Li + * + * Modifications: + * Pedro Vicente, 2004, added dataset creation property list display + * Pedro Vicente, October 4, 2007, added parameters to H5Aiterate2() to allow for + * other iteration orders + * + *------------------------------------------------------------------------- + */ +void +dump_dataset(hid_t did, const char *name, struct subset_t *sset) +{ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &h5tools_dataformat; + h5tool_format_t string_dataformat; + hid_t type, space; + unsigned attr_crt_order_flags; + hid_t dcpl_id; /* dataset creation property list ID */ + h5tools_str_t buffer; /* string into which to render */ + hsize_t curr_pos = 0; /* total data element position */ + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + if ((dcpl_id = H5Dget_create_plist(did)) < 0) { + error_msg("error in getting creation property list ID\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + /* query the creation properties for attributes */ + if (H5Pget_attr_creation_order(dcpl_id, &attr_crt_order_flags) < 0) { + error_msg("error in getting creation properties\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->datasetbegin, name, + h5tools_dump_header_format->datasetblockbegin); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_dump_comment(stdout, outputformat, &ctx, did); + + dump_indent += COL; + ctx.indent_level++; + + type = H5Dget_type(did); + h5dump_type_table = type_table; + h5tools_dump_datatype(stdout, outputformat, &ctx, type); + h5dump_type_table = NULL; + + space = H5Dget_space(did); + h5tools_dump_dataspace(stdout, outputformat, &ctx, space); + H5Sclose(space); + + if(display_oid) { + h5tools_dump_oid(stdout, outputformat, &ctx, did); + } + + if(display_dcpl) { + h5dump_type_table = type_table; + h5tools_dump_dcpl(stdout, outputformat, &ctx, dcpl_id, type, did); + h5dump_type_table = NULL; + } + H5Pclose(dcpl_id); + + if(display_data) { + int data_loop = 1; + int i; + if(display_packed_bits) + data_loop = packed_bits_num; + for(i=0; iline_ncols, 0, 0); + } + switch(H5Tget_class(type)) { + case H5T_TIME: + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "DATA{ not yet implemented.}"); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + break; + + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_COMPOUND: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + case H5T_ARRAY: + { + h5tools_dump_data(stdout, outputformat, &ctx, did, TRUE, sset, display_ai, display_char); + } + break; + + default: + break; + } /* end switch */ + } /* for(i=0;idatasetblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend); + if(strlen(h5tools_dump_header_format->datasetend)) + h5tools_str_append(&buffer, " "); + } + if(strlen(h5tools_dump_header_format->datasetend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: dump_data + * + * Purpose: Dump attribute or dataset data + * + * Return: void + * + * Programmer: Ruey-Hsia Li + * + * Modifications: pvn, print the matrix indices + * Albert Cheng, 2004/11/18 + * Add --string printing for attributes too. + * + *------------------------------------------------------------------------- + */ +void +dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index) +{ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &h5tools_dataformat; + h5tool_format_t string_dataformat; + int print_dataset = FALSE; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + if(obj_data == DATASET_DATA) + print_dataset = TRUE; + h5tools_dump_data(stdout, outputformat, &ctx, obj_id, print_dataset, sset, display_index, display_char); +} + + +/*------------------------------------------------------------------------- + * Function: dump_fcpl + * + * Purpose: prints file creation property list information + * + * Return: void + * + * Programmer: pvn + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +dump_fcpl(hid_t fid) +{ + hid_t fcpl; /* file creation property list ID */ + hsize_t userblock; /* userblock size retrieved from FCPL */ + size_t off_size; /* size of offsets in the file */ + size_t len_size; /* size of lengths in the file */ +#ifdef SHOW_FILE_DRIVER + hid_t fapl; /* file access property list ID */ + hid_t fdriver; /* file driver */ + char dname[32]; /* buffer to store driver name */ +#endif + unsigned sym_lk; /* symbol table B-tree leaf 'K' value */ + unsigned sym_ik; /* symbol table B-tree internal 'K' value */ + unsigned istore_ik; /* indexed storage B-tree internal 'K' value */ + H5F_file_space_type_t fs_strategy; /* file space strategy */ + hsize_t fs_threshold; /* free-space section threshold */ + H5F_info2_t finfo; /* file information */ + + fcpl=H5Fget_create_plist(fid); + H5Fget_info2(fid, &finfo); + H5Pget_userblock(fcpl,&userblock); + H5Pget_sizes(fcpl,&off_size,&len_size); + H5Pget_sym_k(fcpl,&sym_ik,&sym_lk); + H5Pget_istore_k(fcpl,&istore_ik); + H5Pget_file_space(fcpl, &fs_strategy, &fs_threshold); + H5Pclose(fcpl); +#ifdef SHOW_FILE_DRIVER + fapl=h5_fileaccess(); + fdriver=H5Pget_driver(fapl); + H5Pclose(fapl); +#endif + + /*------------------------------------------------------------------------- + * SUPER_BLOCK + *------------------------------------------------------------------------- + */ + HDfprintf(stdout, "\n%s %s\n",SUPER_BLOCK, BEGIN); + indentation(dump_indent + COL); + HDfprintf(stdout, "%s %u\n","SUPERBLOCK_VERSION", finfo.super.version); + indentation(dump_indent + COL); + HDfprintf(stdout, "%s %u\n","FREELIST_VERSION", finfo.free.version); + indentation(dump_indent + COL); + HDfprintf(stdout, "%s %u\n","SYMBOLTABLE_VERSION", 0); /* Retain this for backward compatibility, for now (QAK) */ + indentation(dump_indent + COL); + HDfprintf(stdout, "%s %u\n","OBJECTHEADER_VERSION", finfo.sohm.version); + indentation(dump_indent + COL); + HDfprintf(stdout,"%s %Hd\n","OFFSET_SIZE", (long long)off_size); + indentation(dump_indent + COL); + HDfprintf(stdout,"%s %Hd\n","LENGTH_SIZE", (long long)len_size); + indentation(dump_indent + COL); + HDfprintf(stdout, "%s %u\n","BTREE_RANK", sym_ik); + indentation(dump_indent + COL); + HDfprintf(stdout, "%s %d\n","BTREE_LEAF", sym_lk); + +#ifdef SHOW_FILE_DRIVER + if (H5FD_CORE==fdriver) + HDstrcpy(dname,"H5FD_CORE"); +#ifdef H5_HAVE_DIRECT + else if (H5FD_DIRECT==fdriver) + HDstrcpy(dname,"H5FD_DIRECT"); +#endif + else if (H5FD_FAMILY==fdriver) + HDstrcpy(dname,"H5FD_FAMILY"); + else if (H5FD_LOG==fdriver) + HDstrcpy(dname,"H5FD_LOG"); + else if (H5FD_MPIO==fdriver) + HDstrcpy(dname,"H5FD_MPIO"); + else if (H5FD_MULTI==fdriver) + HDstrcpy(dname,"H5FD_MULTI"); + else if (H5FD_SEC2==fdriver) + HDstrcpy(dname,"H5FD_SEC2"); + else if (H5FD_STDIO==fdriver) + HDstrcpy(dname,"H5FD_STDIO"); +#ifdef H5_HAVE_STREAM + else if (H5FD_STREAM==fdriver) + HDstrcpy(dname,"H5FD_STREAM"); +#endif + else + HDstrcpy(dname,"Unknown driver"); + + /* Take out this because the driver used can be different from the + * standard output. */ + /*indentation(dump_indent + COL); + HDfprintf(stdout, "%s %s\n","FILE_DRIVER", dname);*/ +#endif + indentation(dump_indent + COL); + HDfprintf(stdout, "%s %u\n","ISTORE_K", istore_ik); + + indentation(dump_indent + COL); + if(fs_strategy == H5F_FILE_SPACE_ALL_PERSIST) + HDfprintf(stdout, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_ALL_PERSIST"); + else if(fs_strategy == H5F_FILE_SPACE_ALL) + HDfprintf(stdout, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_ALL"); + else if(fs_strategy == H5F_FILE_SPACE_AGGR_VFD) + HDfprintf(stdout, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_AGGR_VFD"); + else if(fs_strategy == H5F_FILE_SPACE_VFD) + HDfprintf(stdout, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_VFD"); + else + HDfprintf(stdout, "%s %s\n", "FILE_SPACE_STRATEGY", "Unknown strategy"); + indentation(dump_indent + COL); + HDfprintf(stdout, "%s %Hu\n","FREE_SPACE_THRESHOLD", fs_threshold); + + /*------------------------------------------------------------------------- + * USER_BLOCK + *------------------------------------------------------------------------- + */ + indentation(dump_indent + COL); + HDfprintf(stdout, "USER_BLOCK %s\n",BEGIN); + indentation(dump_indent + COL + COL); + HDfprintf(stdout,"%s %Hu\n","USERBLOCK_SIZE", userblock); + indentation(dump_indent + COL); + HDfprintf(stdout, "%s\n",END); + + HDfprintf(stdout, "%s",END); +} + +/*------------------------------------------------------------------------- + * Function: dump_fcontents + * + * Purpose: prints all objects + * + * Return: void + * + * Programmer: pvn + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +dump_fcontents(hid_t fid) +{ + HDfprintf(stdout, "%s %s\n",FILE_CONTENTS, BEGIN); + + /* special case of unamed types in root group */ + if (unamedtype) { + unsigned u; + + for (u = 0; u < type_table->nobjs; u++) { + if (!type_table->objs[u].recorded) + HDfprintf(stdout, " %-10s /#"H5_PRINTF_HADDR_FMT"\n", "datatype", type_table->objs[u].objno); + } + } + + /* print objects in the files */ + h5trav_print(fid); + + HDfprintf(stdout, " %s\n",END); +} + +/*------------------------------------------------------------------------- + * Function: handle_attributes + * + * Purpose: Handle the attributes from the command. + * + * Return: void + * + * Programmer: Bill Wendling + * Tuesday, 9. January 2001 + * + * Modifications: + * + * PVN, May 2008 + * add an extra parameter PE, to allow printing/not printing of error messages + * + *------------------------------------------------------------------------- + */ +void +handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe, const char UNUSED *display_name) +{ + hid_t oid = -1; + hid_t attr_id = -1; + char *obj_name; + const char *attr_name; + int j; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &h5tools_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + j = (int)HDstrlen(attr) - 1; + obj_name = (char *)HDmalloc((size_t)j + 2); + if(obj_name == NULL) + goto error; + + /* find the last / */ + while(j >= 0) { + if (attr[j] == '/') + break; + j--; + } + + /* object name */ + if(j == -1) + HDstrcpy(obj_name, "/"); + else { + HDstrncpy(obj_name, attr, (size_t)j + 1); + obj_name[j + 1] = '\0'; + } /* end else */ + + dump_indent += COL; + memset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + attr_name = attr + j + 1; + + /* Open the object with the attribute */ + if((oid = H5Oopen(fid, obj_name, H5P_DEFAULT)) < 0) { + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->attributebegin, attr, + h5tools_dump_header_format->attributeblockbegin); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + error_msg("unable to open object \"%s\"\n", obj_name); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + if(strlen(h5tools_dump_header_format->attributeblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeblockend); + if(strlen(h5tools_dump_header_format->attributeend)) + h5tools_str_append(&buffer, " "); + } + if(strlen(h5tools_dump_header_format->attributeend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeend); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_str_close(&buffer); + + goto error; + } /* end if */ + + attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT); + oid_output = display_oid; + data_output = display_data; + attr_data_output = display_attr_data; + + h5dump_type_table = type_table; + h5tools_dump_attribute(stdout, outputformat, &ctx, oid, attr, attr_id, display_ai, display_char); + h5dump_type_table = NULL; + + if(attr_id < 0) { + goto error; + } + + /* Close object */ + if(H5Oclose(oid) < 0) { + goto error; + } /* end if */ + + HDfree(obj_name); + dump_indent -= COL; + return; + +error: + h5tools_setstatus(EXIT_FAILURE); + if(obj_name) + HDfree(obj_name); + + H5E_BEGIN_TRY { + H5Oclose(oid); + H5Aclose(attr_id); + } H5E_END_TRY; + dump_indent -= COL; +} + +/*------------------------------------------------------------------------- + * Function: handle_datasets + * + * Purpose: Handle the datasets from the command. + * + * Return: void + * + * Programmer: Bill Wendling + * Tuesday, 9. January 2001 + * + * Modifications: + * Pedro Vicente, Tuesday, January 15, 2008 + * check for block overlap\ + * + * Pedro Vicente, May 8, 2008 + * added a flag PE that prints/not prints error messages + * added for cases of external links not found, to avoid printing of + * objects not found, since external links are dumped on a trial error basis + * + *------------------------------------------------------------------------- + */ +void +handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *display_name) +{ + H5O_info_t oinfo; + hid_t dsetid; + struct subset_t *sset = (struct subset_t *)data; + const char *real_name = display_name ? display_name : dset; + + if((dsetid = H5Dopen2(fid, dset, H5P_DEFAULT)) < 0) { + if (pe) { + HDfprintf(stdout, "\n"); + begin_obj(h5tools_dump_header_format->datasetbegin, real_name, h5tools_dump_header_format->datasetblockbegin); + HDfprintf(stdout, "\n"); + indentation(COL); + error_msg("unable to open dataset \"%s\"\n", real_name); + end_obj(h5tools_dump_header_format->datasetend, h5tools_dump_header_format->datasetblockend); + h5tools_setstatus(EXIT_FAILURE); + } + return; + } /* end if */ + + if(sset) { + unsigned int i; + hid_t sid = H5Dget_space(dsetid); + int ndims = H5Sget_simple_extent_ndims(sid); + + H5Sclose(sid); + if(ndims < 0) { + error_msg("H5Sget_simple_extent_ndims failed\n"); + h5tools_setstatus(EXIT_FAILURE); + return; + } + + if(!sset->start.data || !sset->stride.data || !sset->count.data || !sset->block.data) { + /* they didn't specify a ``stride'' or ``block''. default to 1 in all + * dimensions */ + if(!sset->start.data) { + /* default to (0, 0, ...) for the start coord */ + sset->start.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); + sset->start.len = ndims; + } + + if(!sset->stride.data) { + sset->stride.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); + sset->stride.len = ndims; + for (i = 0; i < ndims; i++) + sset->stride.data[i] = 1; + } + + if(!sset->count.data) { + sset->count.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); + sset->count.len = ndims; + for (i = 0; i < ndims; i++) + sset->count.data[i] = 1; + } + + if(!sset->block.data) { + sset->block.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); + sset->block.len = ndims; + for (i = 0; i < ndims; i++) + sset->block.data[i] = 1; + } + } + + /*------------------------------------------------------------------------- + * check for dimension overflow + *------------------------------------------------------------------------- + */ + if(sset->start.len > ndims) { + error_msg("number of start dims (%u) exceed dataset dims (%u)\n", sset->start.len, ndims); + h5tools_setstatus(EXIT_FAILURE); + return; + } + if(sset->stride.len > ndims) { + error_msg("number of stride dims (%u) exceed dataset dims (%u)\n", sset->stride.len, ndims); + h5tools_setstatus(EXIT_FAILURE); + return; + } + if(sset->count.len > ndims) { + error_msg("number of count dims (%u) exceed dataset dims (%u)\n", sset->count.len, ndims); + h5tools_setstatus(EXIT_FAILURE); + return; + } + if(sset->block.len > ndims) { + error_msg("number of block dims (%u) exceed dataset dims (%u)\n", sset->block.len, ndims); + h5tools_setstatus(EXIT_FAILURE); + return; + } + + /*------------------------------------------------------------------------- + * check for block overlap + *------------------------------------------------------------------------- + */ + for(i = 0; i < ndims; i++) { + if(sset->count.data[i] > 1) { + if(sset->stride.data[i] < sset->block.data[i]) { + error_msg("wrong subset selection; blocks overlap\n"); + h5tools_setstatus(EXIT_FAILURE); + return; + } /* end if */ + } /* end if */ + } /* end for */ + } /* end if */ + + + H5Oget_info(dsetid, &oinfo); + if(oinfo.rc > 1 || hit_elink) { + obj_t *found_obj; /* Found object */ + + found_obj = search_obj(dset_table, oinfo.addr); + + if(found_obj) { + if (found_obj->displayed) { + HDfprintf(stdout, "\n"); + indentation(dump_indent); + begin_obj(h5tools_dump_header_format->datasetbegin, real_name, h5tools_dump_header_format->datasetblockbegin); + HDfprintf(stdout, "\n"); + indentation(dump_indent + COL); + HDfprintf(stdout, "%s \"%s\"\n", HARDLINK, found_obj->objname); + indentation(dump_indent); + end_obj(h5tools_dump_header_format->datasetend, h5tools_dump_header_format->datasetblockend); + } + else { + found_obj->displayed = TRUE; + dump_indent += COL; + dump_dataset(dsetid, real_name, sset); + dump_indent -= COL; + } + } + else + h5tools_setstatus(EXIT_FAILURE); + } + else { + dump_indent += COL; + dump_dataset(dsetid, real_name, sset); + dump_indent -= COL; + } + + if(H5Dclose(dsetid) < 0) + h5tools_setstatus(EXIT_FAILURE); +} + +/*------------------------------------------------------------------------- + * Function: handle_groups + * + * Purpose: Handle the groups from the command. + * + * Return: void + * + * Programmer: Bill Wendling + * Tuesday, 9. January 2001 + * + * Modifications: Pedro Vicente, September 26, 2007 + * handle creation order + * + * Pedro Vicente, May 8, 2008 + * added a flag PE that prints/not prints error messages + * added for cases of external links not found, to avoid printing of + * objects not found, since external links are dumped on a trial error basis + * + *------------------------------------------------------------------------- + */ +void +handle_groups(hid_t fid, const char *group, void UNUSED *data, int pe, const char *display_name) +{ + hid_t gid; + const char *real_name = display_name ? display_name : group; + + if((gid = H5Gopen2(fid, group, H5P_DEFAULT)) < 0) { + if (pe) { + HDfprintf(stdout, "\n"); + begin_obj(h5tools_dump_header_format->groupbegin, real_name, h5tools_dump_header_format->groupblockbegin); + HDfprintf(stdout, "\n"); + indentation(COL); + error_msg("unable to open group \"%s\"\n", real_name); + end_obj(h5tools_dump_header_format->groupend, h5tools_dump_header_format->groupblockend); + h5tools_setstatus(EXIT_FAILURE); + } + } + else { + size_t new_len = HDstrlen(group) + 1; + + if(prefix_len <= new_len) { + prefix_len = new_len; + prefix = (char *)HDrealloc(prefix, prefix_len); + } /* end if */ + + HDstrcpy(prefix, group); + + dump_indent += COL; + dump_group(gid, real_name); + dump_indent -= COL; + + if(H5Gclose(gid) < 0) + h5tools_setstatus(EXIT_FAILURE); + } /* end else */ +} /* end handle_groups() */ + +/*------------------------------------------------------------------------- + * Function: handle_links + * + * Purpose: Handle soft or UD links from the command. + * + * Return: void + * + * Programmer: Bill Wendling + * Tuesday, 9. January 2001 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, const char UNUSED *display_name) +{ + H5L_info_t linfo; + + if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) { + error_msg("unable to get link info from \"%s\"\n", links); + h5tools_setstatus(EXIT_FAILURE); + } + else if(linfo.type == H5L_TYPE_HARD) { + error_msg("\"%s\" is a hard link\n", links); + h5tools_setstatus(EXIT_FAILURE); + } + else { + char *buf = (char *)HDmalloc(linfo.u.val_size); + HDfprintf(stdout, "\n"); + + switch(linfo.type) { + case H5L_TYPE_SOFT: /* Soft link */ + begin_obj(h5tools_dump_header_format->softlinkbegin, links, h5tools_dump_header_format->softlinkblockbegin); + HDfprintf(stdout, "\n"); + indentation(COL); + if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) + HDfprintf(stdout, "LINKTARGET \"%s\"\n", buf); + else { + error_msg("h5dump error: unable to get link value for \"%s\"\n", links); + h5tools_setstatus(EXIT_FAILURE); + } + end_obj(h5tools_dump_header_format->softlinkend, h5tools_dump_header_format->softlinkblockend); + break; + + case H5L_TYPE_EXTERNAL: + begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); + HDfprintf(stdout, "\n"); + indentation(COL); + begin_obj(h5tools_dump_header_format->extlinkbegin, links, h5tools_dump_header_format->extlinkblockbegin); + HDfprintf(stdout, "\n"); + if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) { + const char *elink_file; + const char *elink_path; + + if(H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &elink_file, &elink_path)>=0) { + indentation(COL); + HDfprintf(stdout, "LINKCLASS %d\n", linfo.type); + indentation(COL); + HDfprintf(stdout, "TARGETFILE \"%s\"\n", elink_file); + indentation(COL); + HDfprintf(stdout, "TARGETPATH \"%s\"\n", elink_path); + } + else { + error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links); + h5tools_setstatus(EXIT_FAILURE); + } + } + else { + error_msg("h5dump error: unable to get external link value for \"%s\"\n", links); + h5tools_setstatus(EXIT_FAILURE); + } + end_obj(h5tools_dump_header_format->extlinkend, h5tools_dump_header_format->extlinkblockend); + break; + + default: + begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); + HDfprintf(stdout, "\n"); + indentation(COL); + begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); + HDfprintf(stdout, "\n"); + indentation(COL); + HDfprintf(stdout, "LINKCLASS %d\n", linfo.type); + end_obj(h5tools_dump_header_format->udlinkend, h5tools_dump_header_format->udlinkblockend); + break; + } /* end switch */ + HDfree(buf); + } /* end else */ +} + +/*------------------------------------------------------------------------- + * Function: handle_datatypes + * + * Purpose: Handle the datatypes from the command. + * + * Return: void + * + * Programmer: Bill Wendling + * Tuesday, 9. January 2001 + * + * Modifications: + * + * Pedro Vicente, May 8, 2008 + * added a flag PE that prints/not prints error messages + * added for cases of external links not found, to avoid printing of + * objects not found, since external links are dumped on a trial error basis + * + *------------------------------------------------------------------------- + */ +void +handle_datatypes(hid_t fid, const char *type, void UNUSED * data, int pe, const char *display_name) +{ + hid_t type_id; + const char *real_name = display_name ? display_name : type; + + if((type_id = H5Topen2(fid, type, H5P_DEFAULT)) < 0) { + /* check if type is unamed datatype */ + unsigned idx = 0; + + while(idx < type_table->nobjs ) { + char name[128]; + + if(!type_table->objs[idx].recorded) { + /* unamed datatype */ + sprintf(name, "/#"H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno); + + if(!HDstrcmp(name, real_name)) + break; + } /* end if */ + + idx++; + } /* end while */ + + if(idx == type_table->nobjs) { + if (pe) { + /* unknown type */ + HDfprintf(stdout, "\n"); + begin_obj(h5tools_dump_header_format->datatypebegin, real_name, h5tools_dump_header_format->datatypeblockbegin); + HDfprintf(stdout, "\n"); + indentation(COL); + error_msg("unable to open datatype \"%s\"\n", real_name); + end_obj(h5tools_dump_header_format->datatypeend, h5tools_dump_header_format->datatypeblockend); + h5tools_setstatus(EXIT_FAILURE); + } + } + else { + hid_t dsetid = H5Dopen2(fid, type_table->objs[idx].objname, H5P_DEFAULT); + type_id = H5Dget_type(dsetid); + + dump_indent += COL; + dump_named_datatype(type_id, real_name); + dump_indent -= COL; + + H5Tclose(type_id); + H5Dclose(dsetid); + } + } + else { + dump_indent += COL; + dump_named_datatype(type_id, real_name); + dump_indent -= COL; + + if(H5Tclose(type_id) < 0) + h5tools_setstatus(EXIT_FAILURE); + } +} + + +/*------------------------------------------------------------------------- + * Function: dump_extlink + * + * made by: PVN + * + * Purpose: Dump an external link + * Since external links are soft links, they are dumped on a trial error + * basis, attempting to dump as a dataset, as a group and as a named datatype + * Error messages are supressed + * + * Modifications: + * Neil Fortner + * 13 October 2008 + * Function basically rewritten. No longer directly opens the target file, + * now initializes a new set of tables for the external file. No longer + * dumps on a trial and error basis, but errors are still suppressed. + * + *------------------------------------------------------------------------- + */ + + +static int dump_extlink(hid_t group, const char *linkname, const char *objname) +{ + hid_t oid; + H5O_info_t oi; + table_t *old_group_table = group_table; + table_t *old_dset_table = dset_table; + table_t *old_type_table = type_table; + hbool_t old_hit_elink; + ssize_t idx; + + /* Open target object */ + if ((oid = H5Oopen(group, linkname, H5P_DEFAULT)) < 0) + goto fail; + + /* Get object info */ + if (H5Oget_info(oid, &oi) < 0) { + H5Oclose(oid); + goto fail; + } + + /* Check if we have visited this file already */ + if ((idx = table_list_visited(oi.fileno)) < 0) { + /* We have not visited this file, build object tables */ + if ((idx = table_list_add(oid, oi.fileno)) < 0) { + H5Oclose(oid); + goto fail; + } + } + + /* Do not recurse through an external link into the original file (idx=0) */ + if (idx) { + /* Update table pointers */ + group_table = table_list.tables[idx].group_table; + dset_table = table_list.tables[idx].dset_table; + type_table = table_list.tables[idx].type_table; + + /* We will now traverse the external link, set this global to indicate this */ + old_hit_elink = hit_elink; + hit_elink = TRUE; + + /* add some indentation to distinguish that these objects are external */ + dump_indent += COL; + + /* Recurse into the external file */ + switch (oi.type) { + case H5O_TYPE_GROUP: + handle_groups(group, linkname, NULL, 0, objname); + break; + case H5O_TYPE_DATASET: + handle_datasets(group, linkname, NULL, 0, objname); + break; + case H5O_TYPE_NAMED_DATATYPE: + handle_datatypes(group, linkname, NULL, 0, objname); + break; + default: + h5tools_setstatus(EXIT_FAILURE); + } + + dump_indent -= COL; + + /* Reset table pointers */ + group_table = old_group_table; + dset_table = old_dset_table; + type_table = old_type_table; + + /* Reset hit_elink */ + hit_elink = old_hit_elink; + } /* end if */ + + if (H5Idec_ref(oid) < 0) + h5tools_setstatus(EXIT_FAILURE); + + return SUCCEED; + +fail: + return FAIL; +} + diff --git a/tools/h5dump/h5dump_ddl.h b/tools/h5dump/h5dump_ddl.h new file mode 100644 index 0000000..c769194 --- /dev/null +++ b/tools/h5dump/h5dump_ddl.h @@ -0,0 +1,50 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#ifndef H5DUMP_DDL_H__ +#define H5DUMP_DDL_H__ + +/* callback function used by H5Literate() */ +static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void *op_data); +static int dump_extlink(hid_t group, const char *linkname, const char *objname); + +#ifdef __cplusplus +extern "C" { +#endif + +/* The dump functions of the dump_function_table */ +/* standard format: no change */ +void dump_group(hid_t, const char *); +void dump_named_datatype(hid_t, const char *); +void dump_dataset(hid_t, const char *, struct subset_t *); +void dump_dataspace(hid_t space); +void dump_datatype(hid_t type); +void dump_data(hid_t, int, struct subset_t *, int); +void dump_fcpl(hid_t fid); +void dump_fcontents(hid_t fid); + +/* callback function used by H5Aiterate2() */ +herr_t dump_attr_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, void *_op_data); + +void handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *display_name); +void handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe, const char UNUSED *display_name); +void handle_groups(hid_t fid, const char *group, void UNUSED *data, int pe, const char *display_name); +void handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, const char UNUSED *display_name); +void handle_datatypes(hid_t fid, const char *type, void UNUSED * data, int pe, const char *display_name); + +#ifdef __cplusplus +} +#endif + +#endif /* !H5DUMP_DDL_H__ */ diff --git a/tools/h5dump/h5dump_defines.h b/tools/h5dump/h5dump_defines.h new file mode 100644 index 0000000..a801cac --- /dev/null +++ b/tools/h5dump/h5dump_defines.h @@ -0,0 +1,54 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#ifndef H5DUMP_DEFINES_H__ +#define H5DUMP_DEFINES_H__ + +#define H5DUMP_MAX_RANK H5S_MAX_RANK + +#define ATTRIBUTE_DATA 0 +#define DATASET_DATA 1 +#define ENUM_DATA 2 +#define COL 3 + +/* Macros for displaying objects */ +#define begin_obj(obj,name,begin) \ + do { \ + if (name) \ + HDfprintf(stdout, "%s \"%s\" %s", (obj), (name), (begin)); \ + else \ + HDfprintf(stdout, "%s %s", (obj), (begin)); \ + } while(0); + +#define end_obj(obj,end) \ + do { \ + if(HDstrlen(end)) { \ + HDfprintf(stdout, "%s", end); \ + if(HDstrlen(obj)) \ + HDfprintf(stdout, " "); \ + } \ + if(HDstrlen(obj)) \ + HDfprintf(stdout, "%s", obj); \ + } while(0); + + +/* 3 private values: can't be set, but can be read. + Note: these are defined in H5Zprivate, they are + duplicated here. + */ +#define H5_SZIP_LSB_OPTION_MASK 8 +#define H5_SZIP_MSB_OPTION_MASK 16 +#define H5_SZIP_RAW_OPTION_MASK 128 + +#endif /* !H5DUMP_DEFINES_H__ */ diff --git a/tools/h5dump/h5dump_extern.h b/tools/h5dump/h5dump_extern.h new file mode 100644 index 0000000..5a0f2bd --- /dev/null +++ b/tools/h5dump/h5dump_extern.h @@ -0,0 +1,112 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#ifndef H5DUMP_EXTERN_H__ +#define H5DUMP_EXTERN_H__ + +#include "hdf5.h" +#include "H5private.h" +#include "h5tools.h" +#include "h5tools_utils.h" +#include "h5tools_ref.h" +#include "h5trav.h" +#include "h5dump_defines.h" + +/** + ** This is the global dispatch table for the dump functions. + **/ +/* the table of dump functions */ +typedef struct dump_functions_t { + void (*dump_group_function) (hid_t, const char *); + void (*dump_named_datatype_function) (hid_t, const char *); + void (*dump_dataset_function) (hid_t, const char *, struct subset_t *); + void (*dump_dataspace_function) (hid_t); + void (*dump_datatype_function) (hid_t); + herr_t (*dump_attribute_function) (hid_t, const char *, const H5A_info_t *, void *); + void (*dump_data_function) (hid_t, int, struct subset_t *, int); +} dump_functions; + +/* List of table structures. There is one table structure for each file */ +typedef struct h5dump_table_list_t { + size_t nalloc; + size_t nused; + struct { + unsigned long fileno; /* File number that these tables refer to */ + hid_t oid; /* ID of an object in this file, held open so fileno is consistent */ + table_t *group_table; /* Table of groups */ + table_t *dset_table; /* Table of datasets */ + table_t *type_table; /* Table of datatypes */ + } *tables; +} h5dump_table_list_t; + +extern h5dump_table_list_t table_list; +extern table_t *group_table, *dset_table, *type_table; +extern int dump_indent; /*how far in to indent the line */ + +extern int unamedtype; /* shared datatype with no name */ +extern hbool_t hit_elink; /* whether we have traversed an external link */ +extern size_t prefix_len; +extern char *prefix; +extern const char *fp_format; + +/* things to display or which are set via command line parameters */ +extern int display_all; +extern int display_oid; +extern int display_data; +extern int display_attr_data; +extern int display_char; /*print 1-byte numbers as ASCII */ +extern int usingdasho; +extern int display_bb; /*superblock */ +extern int display_dcpl; /*dcpl */ +extern int display_fi; /*file index */ +extern int display_ai; /*array index */ +extern int display_escape; /*escape non printable characters */ +extern int display_region; /*print region reference data */ +extern int enable_error_stack; /* re-enable error stack */ +extern int disable_compact_subset; /* disable compact form of subset notation */ +extern int display_packed_bits; /*print 1-8 byte numbers as packed bits*/ + +/* sort parameters */ +extern H5_index_t sort_by; /*sort_by [creation_order | name] */ +extern H5_iter_order_t sort_order; /*sort_order [ascending | descending] */ + +#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */ +#define PACKED_BITS_SIZE_MAX 8*sizeof(long long) /* Maximum bits size of integer types of packed-bits */ +/* mask list for packed bits */ +extern unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */ + +/* packed bits display parameters */ +extern int packed_offset[PACKED_BITS_MAX]; +extern int packed_length[PACKED_BITS_MAX]; + +/* + * The global table is set to either ddl_function_table or + * xml_function_table in the initialization. + */ +extern const dump_functions *dump_function_table; + +#ifdef __cplusplus +extern "C" { +#endif + +void add_prefix(char **prfx, size_t *prfx_len, const char *name); +hid_t h5_fileaccess(void); +ssize_t table_list_add(hid_t oid, unsigned long file_no); +ssize_t table_list_visited(unsigned long file_no); + +#ifdef __cplusplus +} +#endif + +#endif /* !H5DUMP_EXTERN_H__ */ diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c new file mode 100644 index 0000000..cc16463 --- /dev/null +++ b/tools/h5dump/h5dump_xml.c @@ -0,0 +1,4456 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include +#include + +#include "H5private.h" +#include "h5tools.h" +#include "h5tools_dump.h" +#include "h5tools_utils.h" +#include "h5tools_ref.h" +#include "h5trav.h" +#include "h5dump_extern.h" +#include "h5dump_xml.h" + +const char *xmlnsprefix="hdf5:"; + +/* internal functions */ +static int xml_name_to_XID(const char *, char *, int , int ); + +/* internal functions used by XML option */ +static void xml_print_datatype(hid_t, unsigned); +static void xml_print_enum(hid_t); +static int xml_print_refs(hid_t, int); +static int xml_print_strs(hid_t, int); +static char *xml_escape_the_string(const char *, int); +static char *xml_escape_the_name(const char *); + +/*------------------------------------------------------------------------- + * Function: dump_all_cb + * + * Purpose: function callback called by H5Literate, + * displays everything in the specified object + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Ruey-Hsia Li + * + * Modifications: + * RMcG, November 2000 + * Added XML support. Also, optionally checks the op_data argument + * + * PVN, May 2008 + * Dump external links + * + *------------------------------------------------------------------------- + */ +static herr_t +xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED *op_data) +{ + hid_t obj; + herr_t ret = SUCCEED; + char *obj_path = NULL; /* Full path of object */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + memset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + /* Build the object's path name */ + obj_path = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + if(!obj_path) { + ret = FAIL; + goto done; + } + + HDstrcpy(obj_path, prefix); + HDstrcat(obj_path, "/"); + HDstrcat(obj_path, name); + + if(linfo->type == H5L_TYPE_HARD) { + H5O_info_t oinfo; + + /* Stat the object */ + if(H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) { + error_msg("unable to get object information for \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + goto done; + } /* end if */ + + switch(oinfo.type) { + case H5O_TYPE_GROUP: + if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) { + error_msg("unable to dump group \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + else { + char *old_prefix; /* Pointer to previous prefix */ + + /* Keep copy of prefix before iterating into group */ + old_prefix = HDstrdup(prefix); + HDassert(old_prefix); + + /* Append group name to prefix */ + add_prefix(&prefix, &prefix_len, name); + + /* Iterate into group */ + dump_function_table->dump_group_function(obj, name); + + /* Restore old prefix name */ + HDstrcpy(prefix, old_prefix); + HDfree(old_prefix); + + /* Close group */ + H5Gclose(obj); + } + break; + + case H5O_TYPE_DATASET: + if((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) { + if(oinfo.rc > 1 || hit_elink) { + obj_t *found_obj; /* Found object */ + + found_obj = search_obj(dset_table, oinfo.addr); + + if(found_obj == NULL) { + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->datasetbegin, name, + h5tools_dump_header_format->datasetblockbegin); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + if(strlen(h5tools_dump_header_format->datasetblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend); + if(strlen(h5tools_dump_header_format->datasetend)) + h5tools_str_append(&buffer, " "); + } + if(strlen(h5tools_dump_header_format->datasetend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + H5Dclose(obj); + goto done; + } + else if(found_obj->displayed) { + /* the XML version */ + char *t_obj_path = xml_escape_the_name(obj_path); + char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); + char *t_name = xml_escape_the_name(name); + char *t_objname = xml_escape_the_name(found_obj->objname); + char dsetxid[100]; + char parentxid[100]; + char pointerxid[100]; + + /* Create OBJ-XIDs for the parent and object */ + xml_name_to_XID(obj_path, dsetxid, sizeof(dsetxid), 1); + xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataset Name=\"%s\" OBJ-XID=\"%s-%d\" " + "H5Path=\"%s\" Parents=\"%s\" " + "H5ParentPaths=\"%s\">", + xmlnsprefix, + t_name, /* Dataset Name */ + dsetxid, get_next_xid(), /* OBJ-XID */ + t_obj_path, /* H5Path */ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + xml_name_to_XID(found_obj->objname, pointerxid, sizeof(pointerxid), 1); + + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", + xmlnsprefix, + pointerxid,t_objname); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + HDfree(t_name); + HDfree(t_obj_path); + HDfree(t_prefix); + HDfree(t_objname); + + H5Dclose(obj); + goto done; + } + else { + found_obj->displayed = TRUE; + } + } /* end if */ + + dump_function_table->dump_dataset_function(obj, name, NULL); + H5Dclose(obj); + } + else { + error_msg("unable to dump dataset \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + break; + + case H5O_TYPE_NAMED_DATATYPE: + if((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) { + error_msg("unable to dump datatype \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + else { + dump_function_table->dump_named_datatype_function(obj, name); + H5Tclose(obj); + } + break; + + default: + error_msg("unknown object \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + } /* end if */ + else { + char *targbuf; + + switch(linfo->type) { + case H5L_TYPE_SOFT: + targbuf = (char *)HDmalloc(linfo->u.val_size); + HDassert(targbuf); + + if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { + error_msg("unable to get link value\n"); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + else { + /* print the value of a soft link */ + /* XML */ + char linkxid[100]; + char parentxid[100]; + char targetxid[100]; + char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); + char *t_name = xml_escape_the_name(name); + char *t_targbuf = xml_escape_the_name(targbuf); + char *t_obj_path = xml_escape_the_name(obj_path); + char *t_link_path; + int res; + + t_link_path = (char *)HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1); + if(targbuf[0] == '/') + HDstrcpy(t_link_path, targbuf); + else { + HDstrcpy(t_link_path, prefix); + HDstrcat(HDstrcat(t_link_path, "/"), targbuf); + } /* end else */ + + /* Create OBJ-XIDs for the parent and object */ + xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); + xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + + /* Try to create an OBJ-XID for the object pointed to */ + res = xml_name_to_XID(t_link_path, targetxid, sizeof(targetxid), 0); + if (res == 0) { + /* target obj found */ + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sSoftLink LinkName=\"%s\" " + "OBJ-XID=\"%s\" " + "H5SourcePath=\"%s\" " + "TargetPath=\"%s\" TargetObj=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />", + xmlnsprefix, + t_name, /* LinkName */ + linkxid, /* OBJ-XID */ + t_obj_path, /* H5SourcePath */ + t_targbuf, /* TargetPath */ + targetxid, /* TargetObj */ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + /* dangling link -- omit from xml attributes */ + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sSoftLink LinkName=\"%s\" " + "OBJ-XID=\"%s\" " + "H5SourcePath=\"%s\" " + "TargetPath=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />", + xmlnsprefix, + t_name, /* LinkName */ + linkxid, /* OBJ-XID */ + t_obj_path, /* H5SourcePath */ + t_targbuf, /* TargetPath */ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + + HDfree(t_prefix); + HDfree(t_name); + HDfree(t_targbuf); + HDfree(t_obj_path); + HDfree(t_link_path); + } + + HDfree(targbuf); + break; + + case H5L_TYPE_EXTERNAL: + targbuf = (char *)HDmalloc(linfo->u.val_size); + HDassert(targbuf); + + if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { + error_msg("unable to get external link value\n"); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } /* end if */ + else { + const char *filename; + const char *targname; + + if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) { + error_msg("unable to unpack external link value\n"); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } /* end if */ + else { + char linkxid[100]; + char parentxid[100]; + char *t_name = xml_escape_the_name(name); + char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); + char *t_obj_path = xml_escape_the_name(obj_path); + char *t_filename = xml_escape_the_name(filename); + char *t_targname = xml_escape_the_name(targname); + + /* Create OBJ-XIDs for the parent and object */ + xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); + xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sExternalLink LinkName=\"%s\" " + "OBJ-XID=\"%s\" " + "H5SourcePath=\"%s\" " + "TargetFilename=\"%s\" " + "TargetPath=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />", + xmlnsprefix, + t_name, /* LinkName */ + linkxid, /* OBJ-XID */ + t_obj_path, /* H5SourcePath */ + filename, /* TargetFilename */ + targname, /* TargetPath*/ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + HDfree(t_prefix); + HDfree(t_name); + HDfree(t_filename); + HDfree(t_targname); + HDfree(t_obj_path); + } /* end else */ + } /* end else */ + HDfree(targbuf); + break; + + default: + { + char linkxid[100]; + char parentxid[100]; + char *t_name = xml_escape_the_name(name); + char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); + char *t_obj_path = xml_escape_the_name(obj_path); + + /* Create OBJ-XIDs for the parent and object */ + xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); + xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sUserDefined LinkName=\"%s\" " + "OBJ-XID=\"%s\" " + "H5SourcePath=\"%s\" " + "LinkClass=\"%d\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />", + xmlnsprefix, + t_name, /* LinkName */ + linkxid, /* OBJ-XID */ + t_obj_path, /* H5SourcePath */ + linfo->type, /* LinkClass */ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + HDfree(t_prefix); + HDfree(t_name); + HDfree(t_obj_path); + } + break; + } /* end switch */ + } /* end else */ + +done: + + h5tools_str_close(&buffer); + + if(obj_path) + HDfree(obj_path); + return ret; +} + +/* + * create a string suitable for and XML NCNAME. Uses the + * object reference to create the string. + * + * 'gen'; 0 - return null if not found + * 1 - generate a fake entry and return fake id. + */ +int +xml_name_to_XID(const char *str , char *outstr, int outlen, int gen) +{ + haddr_t objno; /* Object ID for object at path */ + + if (outlen < 22) return 1; + + objno = ref_path_table_lookup(str); + if (objno == HADDR_UNDEF) { + if (HDstrlen(str) == 0) { + objno = ref_path_table_lookup("/"); + if (objno == HADDR_UNDEF) { + if (gen) { + objno = ref_path_table_gen_fake(str); + sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); + return 0; + } + else { + return 1; + } + } + } + else { + if (gen) { + objno = ref_path_table_gen_fake(str); + sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); + return 0; + } + else { + return 1; + } + } + } + + sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); + + return(0); +} + +static const char *quote = """; +static const char *amp = "&"; +static const char *lt = "<"; +static const char *gt = ">"; +static const char *apos = "'"; + +/*------------------------------------------------------------------------- + * Function: xml_escape_the_name + * + * Purpose: Escape XML reserved chars in a name, so HDF5 strings + * and paths can be correctly read back in XML element. + * + * Return: The revised string. + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static char * +xml_escape_the_name(const char *str) +{ + size_t extra; + size_t len; + size_t i; + const char *cp; + char *ncp; + char *rcp; + + if (!str) + return NULL; + + cp = str; + len = strlen(str); + extra = 0; + + for (i = 0; i < len; i++) { + if (*cp == '\"') { + extra += (strlen(quote) - 1); + } + else if (*cp == '\'') { + extra += (strlen(apos) - 1); + } + else if (*cp == '<') { + extra += (strlen(lt) - 1); + } + else if (*cp == '>') { + extra += (strlen(gt) - 1); + } + else if (*cp == '&') { + extra += (strlen(amp) - 1); + } + + cp++; + } + + if (extra == 0) + return HDstrdup(str); + + cp = str; + rcp = ncp = (char *)HDmalloc(len + extra + 1); + + if (!ncp) + return NULL; /* ?? */ + + for (i = 0; i < len; i++) { + if (*cp == '\'') { + strncpy(ncp, apos, strlen(apos)); + ncp += strlen(apos); + cp++; + } + else if (*cp == '<') { + strncpy(ncp, lt, strlen(lt)); + ncp += strlen(lt); + cp++; + } + else if (*cp == '>') { + strncpy(ncp, gt, strlen(gt)); + ncp += strlen(gt); + cp++; + } + else if (*cp == '\"') { + strncpy(ncp, quote, strlen(quote)); + ncp += strlen(quote); + cp++; + } + else if (*cp == '&') { + strncpy(ncp, amp, strlen(amp)); + ncp += strlen(amp); + cp++; + } + else { + *ncp++ = *cp++; + } + } + + *ncp = '\0'; + return rcp; +} + +/*------------------------------------------------------------------------- + * Function: xml_escape_the_string + * + * Purpose: Escape XML reserved chars in a string, so HDF5 strings + * and paths can be correctly read back in XML CDATA. + * + * Return: The revised string. + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static char * +xml_escape_the_string(const char *str, int slen) +{ + size_t extra; + size_t len; + size_t i; + const char *cp; + char *ncp; + char *rcp; + + if (!str) + return NULL; + + cp = str; + + if (slen < 0) + len = strlen(str); + else + len = slen; + + extra = 0; + + for (i = 0; i < len; i++) { + if (*cp == '\\') { + extra++; + } + else if (*cp == '\"') { + extra++; + } + else if (*cp == '\'') { + extra += (strlen(apos) - 1); + } + else if (*cp == '<') { + extra += (strlen(lt) - 1); + } + else if (*cp == '>') { + extra += (strlen(gt) - 1); + } + else if (*cp == '&') { + extra += (strlen(amp) - 1); + } + cp++; + } + + cp = str; + rcp = ncp = (char *) calloc((len + extra + 1), sizeof(char)); + + if (ncp == NULL) + return NULL; /* ?? */ + + for (i = 0; i < len; i++) { + if (*cp == '\\') { + *ncp++ = '\\'; + *ncp++ = *cp++; + } + else if (*cp == '\"') { + *ncp++ = '\\'; + *ncp++ = *cp++; + } + else if (*cp == '\'') { + strncpy(ncp, apos, strlen(apos)); + ncp += strlen(apos); + cp++; + } + else if (*cp == '<') { + strncpy(ncp, lt, strlen(lt)); + ncp += strlen(lt); + cp++; + } + else if (*cp == '>') { + strncpy(ncp, gt, strlen(gt)); + ncp += strlen(gt); + cp++; + } + else if (*cp == '&') { + strncpy(ncp, amp, strlen(amp)); + ncp += strlen(amp); + cp++; + } + else { + *ncp++ = *cp++; + } + } + + *ncp = '\0'; + return rcp; +} + +/** + ** XML print functions--these replace some functions in the + ** h5tools.c suite. + **/ + +/*------------------------------------------------------------------------- + * Function: xml_print_datatype + * + * Purpose: Print description of a datatype in XML. + * Note: this is called inside a element. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +xml_print_datatype(hid_t type, unsigned in_group) +{ + char *mname; + hid_t mtype; + unsigned nmembers; + unsigned ndims; + unsigned i; + size_t size; + hsize_t dims[H5DUMP_MAX_RANK]; + H5T_str_t str_pad; + H5T_cset_t cset; + hid_t super; + H5T_order_t ord; + H5T_sign_t sgn; + size_t sz; + size_t spos; + size_t epos; + size_t esize; + size_t mpos; + size_t msize; + int nmembs; + htri_t is_vlstr=FALSE; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + memset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + if(!in_group && H5Tcommitted(type) > 0) { + H5O_info_t oinfo; + obj_t *found_obj; /* Found object */ + + /* detect a shared datatype, output only once */ + H5Oget_info(type, &oinfo); + found_obj = search_obj(type_table, oinfo.addr); + + if(found_obj) { + /* This should be defined somewhere else */ + /* These 2 cases are handled the same right now, but + probably will have something different eventually */ + char * dtxid = (char *)malloc(100); + + xml_name_to_XID(found_obj->objname, dtxid, 100, 1); + if (!found_obj->recorded) { + /* 'anonymous' NDT. Use it's object num. + as it's name. */ + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"/%s\"/>", + xmlnsprefix, dtxid); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + /* point to the NDT by name */ + char *t_objname = xml_escape_the_name(found_obj->objname); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", + xmlnsprefix, dtxid, t_objname); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + free(t_objname); + } + free(dtxid); + } + else { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_setstatus(EXIT_FAILURE); + } + } + else { + + switch (H5Tget_class(type)) { + case H5T_INTEGER: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + + /* */ + ord = H5Tget_order(type); + sgn = H5Tget_sign(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sIntegerType ByteOrder=\"",xmlnsprefix); + switch (ord) { + case H5T_ORDER_LE: + h5tools_str_append(&buffer, "LE"); + break; + case H5T_ORDER_BE: + h5tools_str_append(&buffer, "BE"); + break; + case H5T_ORDER_VAX: + default: + h5tools_str_append(&buffer, "ERROR_UNKNOWN"); + } + + h5tools_str_append(&buffer, "\" Sign=\""); + + switch (sgn) { + case H5T_SGN_NONE: + h5tools_str_append(&buffer, "false"); + break; + case H5T_SGN_2: + h5tools_str_append(&buffer, "true"); + break; + default: + h5tools_str_append(&buffer, "ERROR_UNKNOWN"); + } + + h5tools_str_append(&buffer, "\" Size=\""); + sz = H5Tget_size(type); + h5tools_str_append(&buffer, "%lu", (unsigned long)sz); + h5tools_str_append(&buffer, "\" />"); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_FLOAT: + /* */ + ord = H5Tget_order(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sFloatType ByteOrder=\"",xmlnsprefix); + + switch (ord) { + case H5T_ORDER_LE: + h5tools_str_append(&buffer, "LE"); + break; + case H5T_ORDER_BE: + h5tools_str_append(&buffer, "BE"); + break; + case H5T_ORDER_VAX: + h5tools_str_append(&buffer, "VAX"); + break; + default: + h5tools_str_append(&buffer, "ERROR_UNKNOWN"); + } + + h5tools_str_append(&buffer, "\" Size=\""); + sz = H5Tget_size(type); + h5tools_str_append(&buffer, "%lu", (unsigned long)sz); + H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize); + h5tools_str_append(&buffer, "\" SignBitLocation=\"%lu\" ", (unsigned long)spos); + h5tools_str_append(&buffer, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos); + h5tools_str_append(&buffer, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />", (unsigned long)msize, (unsigned long)mpos); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_TIME: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sTimeType />",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_str_append(&buffer, ""); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_STRING: + /* */ + size = H5Tget_size(type); + str_pad = H5Tget_strpad(type); + cset = H5Tget_cset(type); + is_vlstr = H5Tis_variable_str(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sStringType Cset=\"",xmlnsprefix); + if (cset == H5T_CSET_ASCII) { + h5tools_str_append(&buffer, "H5T_CSET_ASCII\" "); + } + else { + h5tools_str_append(&buffer, "unknown_cset\" "); + } + if(is_vlstr) + h5tools_str_append(&buffer, "StrSize=\"H5T_VARIABLE\" StrPad=\""); + else + h5tools_str_append(&buffer, "StrSize=\"%d\" StrPad=\"", (int) size); + if (str_pad == H5T_STR_NULLTERM) { + h5tools_str_append(&buffer, "H5T_STR_NULLTERM\"/>"); + } + else if (str_pad == H5T_STR_NULLPAD) { + h5tools_str_append(&buffer, "H5T_STR_NULLPAD\"/>"); + } + else if (str_pad == H5T_STR_SPACEPAD) { + h5tools_str_append(&buffer, "H5T_STR_SPACEPAD\"/>"); + } + else { + h5tools_str_append(&buffer, "H5T_STR_ERROR\"/>"); + } + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_BITFIELD: + /* */ + ord = H5Tget_order(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sBitfieldType ByteOrder=\"",xmlnsprefix); + + switch (ord) { + case H5T_ORDER_LE: + h5tools_str_append(&buffer, "LE"); + break; + case H5T_ORDER_BE: + h5tools_str_append(&buffer, "BE"); + break; + case H5T_ORDER_VAX: + default: + h5tools_str_append(&buffer, "ERROR_UNKNOWN"); + } + + size = H5Tget_size(type); + h5tools_str_append(&buffer, "\" Size=\"%lu\"/>", (unsigned long)size); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_OPAQUE: + /* */ + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + mname = H5Tget_tag(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sOpaqueType Tag=\"%s\" ",xmlnsprefix, mname); + free(mname); + size = H5Tget_size(type); + h5tools_str_append(&buffer, "Size=\"%lu\"/>", (unsigned long)size); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_COMPOUND: + /* recursively describe the components of a compound datatype */ + + /* type of a dataset */ + nmembers = H5Tget_nmembers(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sCompoundType>",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + /* List each member Field of the type */ + /* */ + /* */ + ctx.indent_level++; + dump_indent += COL; + for (i = 0; i < nmembers; i++) { + char *t_fname; + + mname = H5Tget_member_name(type, i); + mtype = H5Tget_member_type(type, i); + t_fname = xml_escape_the_name(mname); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sField FieldName=\"%s\">",xmlnsprefix, t_fname); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + free(mname); + free(t_fname); + dump_indent += COL; + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + dump_indent += COL; + xml_print_datatype(mtype,0); + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_REFERENCE: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + /* Only Object references supported at this time */ + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sReferenceType>",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sObjectReferenceType />",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_ENUM: + /* list Name, values of enum */ + nmembs = H5Tget_nmembers(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + dump_indent += COL; + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sEnumType Nelems=\"%d\">",xmlnsprefix, nmembs); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + xml_print_enum(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_VLEN: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sVLType>",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + super = H5Tget_super(type); + dump_indent += COL; + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + dump_indent += COL; + ctx.indent_level++; + xml_print_datatype(super,0); + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + H5Tclose(super); + + break; + + case H5T_ARRAY: + /* Get array base type */ + super = H5Tget_super(type); + + /* Print lead-in */ + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sArrayType Ndims=\"",xmlnsprefix); + ndims = H5Tget_array_ndims(type); + h5tools_str_append(&buffer, "%u\">", ndims); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + /* Get array information */ + H5Tget_array_dims2(type, dims); + + /* list of dimensions */ + ctx.indent_level++; + for (i = 0; i < ndims; i++) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sArrayDimension DimSize=\"%u\"/>", xmlnsprefix, (int) dims[i]); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + ctx.indent_level--; + + dump_indent += COL; + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + dump_indent += COL; + ctx.indent_level++; + xml_print_datatype(super,0); + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + /* Close array base type */ + H5Tclose(super); + break; + + default: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_setstatus(EXIT_FAILURE); + break; + } + } /* end else */ + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: xml_dump_datatype + * + * Purpose: Dump description of a datatype in XML. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +xml_dump_datatype(hid_t type) +{ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + memset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + ctx.indent_level++; + dump_indent += COL; + + if(H5Tcommitted(type) > 0) { + H5O_info_t oinfo; + obj_t *found_obj; /* Found object */ + + /* Datatype is a shared or named datatype */ + H5Oget_info(type, &oinfo); + found_obj = search_obj(type_table, oinfo.addr); + + if(found_obj) { + /* Shared datatype, must be entered as an object */ + /* These 2 cases are the same now, but may change */ + char *dtxid = (char *)malloc(100); + + xml_name_to_XID(found_obj->objname, dtxid, 100, 1); + if (!found_obj->recorded) { + /* anonymous stored datatype: + following the dumper's current + practice: + use it's object ref as its name + */ + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\"/>", + xmlnsprefix, dtxid); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + /* pointer to a named datatype already in XML */ + char *t_objname = xml_escape_the_name(found_obj->objname); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\" />", + xmlnsprefix, dtxid, t_objname); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + free(t_objname); + } + free(dtxid); + } + else { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + } + else { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + dump_indent += COL; + xml_print_datatype(type, 0); + ctx.indent_level--; + dump_indent -= COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + ctx.indent_level--; + dump_indent -= COL; + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: xml_dump_dataspace + * + * Purpose: Dump description of a dataspace in XML. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +xml_dump_dataspace(hid_t space) +{ + hsize_t size[H5DUMP_MAX_RANK]; + hsize_t maxsize[H5DUMP_MAX_RANK]; + int i; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + int ndims = H5Sget_simple_extent_dims(space, size, maxsize); + H5S_class_t space_type = H5Sget_simple_extent_type(space); + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + memset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataspace>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + + switch (space_type) { + case H5S_SCALAR: + /* scalar dataspace (just a tag, no XML attrs. defined */ + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sScalarDataspace />",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5S_SIMPLE: + /* simple dataspace */ + /* */ + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sSimpleDataspace Ndims=\"%d\">",xmlnsprefix, ndims); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + /* print the elements */ + ctx.indent_level++; + for (i = 0; i < ndims; i++) { + if (maxsize[i] == H5S_UNLIMITED) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDimension DimSize=\"%lu\" MaxDimSize=\"UNLIMITED\"/>", + xmlnsprefix,size[i]); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else if (maxsize[i] == (hsize_t) 0) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDimension DimSize=\"%lu\" MaxDimSize=\"%lu\"/>", + xmlnsprefix,size[i], size[i]); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDimension DimSize=\"%lu\" MaxDimSize=\"%lu\"/>", + xmlnsprefix, size[i], maxsize[i]); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + } + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix ); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + +#ifdef TMP + /* Commented out: wait until the schema is updated first */ + case H5S_NULL: + /* null dataspace (just a tag, no XML attrs. defined */ + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNullDataspace />",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; +#endif /* TMP */ + + case H5S_NO_CLASS: + default: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: xml_dump_data + * + * Purpose: Dump description of data in XML. + * Note that this calls the h5dump_xxx calls in + * the h5tools library. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNUSED pindex) +{ + hid_t space = -1; + hid_t type = -1; + hid_t p_type = -1; + hsize_t size[64]; + hsize_t nelmts = 1; + int ndims; + int i; + int depth; + int status = -1; + int stdindent = COL; /* should be 3 */ + void *buf = NULL; + hsize_t curr_pos = 0; /* total data element position */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + /* Print all the values. */ + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + string_dataformat.cmpd_sep = " "; + string_dataformat.cmpd_pre = ""; + string_dataformat.cmpd_suf = ""; + string_dataformat.cmpd_end = ""; + string_dataformat.arr_linebreak = 0; + string_dataformat.arr_pre = ""; + outputformat = &string_dataformat; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + dump_indent += COL; + ctx.indent_level++; + + if (obj_data == DATASET_DATA) { + type = H5Dget_type(obj_id); + if (H5Tget_class(type) == H5T_REFERENCE) { + status = xml_print_refs(obj_id, DATASET_DATA); + } + else if (H5Tget_class(type) == H5T_STRING) { + status = xml_print_strs(obj_id, DATASET_DATA); + } + else { + h5tools_context_t datactx; + memset(&datactx, 0, sizeof(datactx)); + datactx.need_prefix = TRUE; + datactx.indent_level = ctx.indent_level; + datactx.cur_column = ctx.cur_column; + status = h5tools_dump_dset(stdout, outputformat, &datactx, obj_id, -1, NULL); + } + } + else { + /* Attribute data */ + type = H5Aget_type(obj_id); + + if (H5Tget_class(type) == H5T_REFERENCE) { + /* references are done differently than + the standard output: + XML dumps a path to the object + referenced. + */ + status = xml_print_refs(obj_id, ATTRIBUTE_DATA); + H5Tclose(type); + } + else if (H5Tget_class(type) == H5T_STRING) { + status = xml_print_strs(obj_id, ATTRIBUTE_DATA); + } + else { /* all other data */ + /* VL data special information */ + unsigned int vl_data = 0; /* contains VL datatypes */ + + p_type = h5tools_get_native_type(type); + + /* Check if we have VL data in the dataset's datatype */ + if (h5tools_detect_vlen_str(p_type) == TRUE) + vl_data = TRUE; + if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) + vl_data = TRUE; + + H5Tclose(type); + + space = H5Aget_space(obj_id); + + ndims = H5Sget_simple_extent_dims(space, size, NULL); + + for (i = 0; i < ndims; i++) + nelmts *= size[i]; + + buf = malloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)))); + assert(buf); + + if (H5Aread(obj_id, p_type, buf) >= 0) { + h5tools_context_t datactx; + memset(&datactx, 0, sizeof(datactx)); + datactx.need_prefix = TRUE; + datactx.indent_level = ctx.indent_level; + datactx.cur_column = ctx.cur_column; + status = h5tools_dump_mem(stdout, outputformat, &datactx, obj_id, p_type, space, buf); + } + /* Reclaim any VL memory, if necessary */ + if (vl_data) + H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf); + + free(buf); + H5Tclose(p_type); + H5Sclose(space); + H5Tclose(type); + } + } + + if (status == FAIL) { + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "Unable to print data."); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + status = 1; + } + ctx.indent_level--; + dump_indent -= COL; + + ctx.indent_level++; + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: xml_dump_attr + * + * Purpose: Dump a description of an HDF5 attribute in XML. + * + * Return: herr_t + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, + void UNUSED * op_data) +{ + hid_t attr_id = -1; + hid_t type = -1; + hid_t space = -1; + H5S_class_t space_type; + hsize_t curr_pos = 0; /* total data element position */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + + char *t_aname = xml_escape_the_name(attr_name); + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + memset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAttribute Name=\"%s\">", xmlnsprefix, t_aname); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + free(t_aname); + + if ((attr_id = H5Aopen(attr, attr_name, H5P_DEFAULT)) >= 0) { + type = H5Aget_type(attr_id); + space = H5Aget_space(attr_id); + space_type = H5Sget_simple_extent_type(space); + + dump_function_table->dump_dataspace_function(space); + dump_function_table->dump_datatype_function(type); + + ctx.indent_level++; + dump_indent += COL; + + if (display_attr_data && space_type != H5S_NULL) { + switch (H5Tget_class(type)) { + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_ENUM: + case H5T_ARRAY: + dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); + break; + + case H5T_TIME: + ctx.indent_level++; + dump_indent += COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + dump_indent -= COL; + break; + + case H5T_COMPOUND: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); + break; + + case H5T_REFERENCE: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + if (!H5Tequal(type, H5T_STD_REF_OBJ)) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + xml_print_refs(attr_id, ATTRIBUTE_DATA); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_VLEN: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); + break; + default: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", H5Tget_class(type)); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + } + } + else { + /* The case of an attribute never yet written ?? + * Or dataspace is H5S_NULL. */ + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + ctx.indent_level--; + dump_indent -= COL; + + H5Tclose(type); + H5Sclose(space); + H5Aclose(attr_id); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_str_close(&buffer); + return SUCCEED; + } + else { + /* ?? failed */ + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_str_close(&buffer); + + h5tools_setstatus(EXIT_FAILURE); + return FAIL; + } +} + +/*------------------------------------------------------------------------- + * Function: xml_dump_named_datatype + * + * Purpose: Dump a description of an HDF5 NDT in XML. + * + * Return: herr_t + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +xml_dump_named_datatype(hid_t type, const char *name) +{ + hsize_t curr_pos = 0; /* total data element position */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + char *tmp; + char *dtxid; + char *parentxid; + char *t_tmp; + char *t_prefix; + char *t_name; + + tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + HDstrcpy(tmp, prefix); + HDstrcat(tmp, "/"); + HDstrcat(tmp, name); + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + memset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + dtxid = (char *)HDmalloc(100); + parentxid = (char *)HDmalloc(100); + t_tmp = xml_escape_the_name(tmp); + t_prefix = xml_escape_the_name(prefix); + t_name = xml_escape_the_name(name); + + xml_name_to_XID(tmp, dtxid, 100, 1); + xml_name_to_XID(prefix, parentxid, 100, 1); + if(HDstrncmp(name, "#", 1) == 0) { + /* Special: this is an 'anonymous' NDT, deleted but + still in use. + We follow the dumper's undocumented practice, and + use its object id as its name. + Exactly the same as normal, but a separate case + in the event we want to do something else in + the future. + */ + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\">", + xmlnsprefix, + name, dtxid, + parentxid, HDstrcmp(prefix,"") ? t_prefix : "/"); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + H5O_info_t oinfo; /* Object info */ + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" " + "H5Path=\"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">", + xmlnsprefix, + t_name, dtxid, + t_tmp, parentxid, (HDstrcmp(prefix, "") ? t_prefix : "/")); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + /* Check uniqueness of named datatype */ + H5Oget_info(type, &oinfo); + if(oinfo.rc > 1) { + obj_t *found_obj; /* Found object */ + + /* Group with more than one link to it... */ + found_obj = search_obj(type_table, oinfo.addr); + + if (found_obj == NULL) { + indentation(dump_indent); + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + else if(found_obj->displayed) { + /* We have already printed this named datatype, print it as a + * NamedDatatypePtr + */ + char pointerxid[100]; + char *t_objname = xml_escape_the_name(found_obj->objname); + + ctx.indent_level++; + + xml_name_to_XID(found_obj->objname, pointerxid, sizeof(pointerxid), 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNamedDatatypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix, pointerxid, t_objname); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + HDfree(t_objname); + goto done; + } + else + found_obj->displayed = TRUE; + } + } + + ctx.indent_level++; + dump_indent += COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + dump_indent += COL; + xml_print_datatype(type,1); + ctx.indent_level--; + dump_indent -= COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + dump_indent -= COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + +done: + + h5tools_str_close(&buffer); + + HDfree(dtxid); + HDfree(parentxid); + HDfree(t_tmp); + HDfree(t_prefix); + HDfree(t_name); + HDfree(tmp); +} + +/*------------------------------------------------------------------------- + * Function: xml_dump_group + * + * Purpose: Dump a description of an HDF5 Group (and its members) in XML. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * Pedro Vicente, October 9, 2007 + * added parameters to H5A(L)iterate to allow for other iteration orders + * + *------------------------------------------------------------------------- + */ +void +xml_dump_group(hid_t gid, const char *name) +{ + H5O_info_t oinfo; + hid_t gcpl_id; + hid_t dset, type; + unsigned crt_order_flags; + unsigned attr_crt_order_flags; + int isRoot = 0; + char type_name[1024]; + char *t_objname = NULL; + char *par_name = NULL; + char *cp = NULL; + char *tmp = NULL; + char *par = NULL; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + if ((gcpl_id = H5Gget_create_plist(gid)) < 0) { + error_msg("error in getting group creation property list ID\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + /* query the group creation properties for attributes */ + if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0) { + error_msg("error in getting group creation properties\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + /* query the group creation properties */ + if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) { + error_msg("error in getting group creation properties\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + if(H5Pclose(gcpl_id) < 0) { + error_msg("error in closing group creation property list ID\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + memset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + if(HDstrcmp(name, "/") == 0) { + isRoot = 1; + tmp = HDstrdup("/"); + } + else { + tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + HDstrcpy(tmp, prefix); + par = HDstrdup(tmp); + cp = HDstrrchr(par, '/'); + if(cp) { + if((cp == par) && HDstrlen(par) > 1) + *(cp + 1) = '\0'; + else + *cp = '\0'; + } + } + + H5Oget_info(gid, &oinfo); + + if(oinfo.rc > 1) { + obj_t *found_obj; /* Found object */ + + /* Group with more than one link to it... */ + found_obj = search_obj(group_table, oinfo.addr); + + if (found_obj == NULL) { + indentation(dump_indent); + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + h5tools_setstatus(EXIT_FAILURE); + } + else { + char *t_name = xml_escape_the_name(name); + char *grpxid = (char *)malloc(100); + char *parentxid = (char *)malloc(100); + + if(found_obj->displayed) { + char *ptrstr = (char *)malloc(100); + + /* already seen: enter a groupptr */ + if(isRoot) { + /* probably can't happen! */ + xml_name_to_XID("/", grpxid, 100, 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", + xmlnsprefix, grpxid, "/"); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + t_objname = xml_escape_the_name(found_obj->objname); + par_name = xml_escape_the_name(par); + xml_name_to_XID(tmp, grpxid, 100, 1); + xml_name_to_XID(par, parentxid, 100, 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s-%d\" H5Path=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\">", + xmlnsprefix,t_name, grpxid, get_next_xid(), + t_objname, parentxid, par_name); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + free(t_objname); + free(par_name); + + ctx.indent_level++; + + t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */ + par_name = xml_escape_the_name(par); + xml_name_to_XID(found_obj->objname, ptrstr, 100, 1); + xml_name_to_XID(par, parentxid, 100, 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />", + xmlnsprefix, + ptrstr, t_objname, parentxid, par_name); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + free(t_objname); + free(par_name); + } + free(ptrstr); + } + else { + + /* first time this group has been seen -- describe it */ + if(isRoot) { + xml_name_to_XID("/", grpxid, 100, 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", + xmlnsprefix, grpxid, "/"); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + char *t_tmp = xml_escape_the_name(tmp); + + par_name = xml_escape_the_name(par); + xml_name_to_XID(tmp, grpxid, 100, 1); + xml_name_to_XID(par, parentxid, 100, 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" >", + xmlnsprefix,t_name, grpxid, t_tmp, parentxid, par_name); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + free(t_tmp); + free(par_name); + } + found_obj->displayed = TRUE; + + /* 1. do all the attributes of the group */ + + ctx.indent_level++; + dump_indent += COL; + + if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { + if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end if */ + else { + if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end else */ + + if(isRoot && unamedtype) { + unsigned u; + + /* Very special case: dump unamed type in root group */ + for(u = 0; u < type_table->nobjs; u++) { + if(!type_table->objs[u].recorded) { + dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); + type = H5Dget_type(dset); + sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); + dump_function_table->dump_named_datatype_function(type, type_name); + H5Tclose(type); + H5Dclose(dset); + } + } + } + + /* iterate through all the links */ + + if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) + H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL); + else + H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL); + + dump_indent -= COL; + ctx.indent_level--; + } + free(t_name); + free(grpxid); + free(parentxid); + } + } + else { + /* only link -- must be first time! */ + char *t_name = xml_escape_the_name(name); + char *grpxid = (char *)malloc(100); + char *parentxid = (char *)malloc(100); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + + if(isRoot) { + xml_name_to_XID("/", grpxid, 100, 1); + h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid, "/"); + } + else { + char *t_tmp = xml_escape_the_name(tmp); + + par_name = xml_escape_the_name(par); + xml_name_to_XID(tmp, grpxid, 100, 1); + xml_name_to_XID(par, parentxid, 100, 1); + h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" >", + xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name); + free(t_tmp); + free(par_name); + } + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + free(t_name); + free(grpxid); + free(parentxid); + + /* 1. do all the attributes of the group */ + + ctx.indent_level++; + dump_indent += COL; + + if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { + if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end if */ + else { + if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end else */ + + if(isRoot && unamedtype) { + unsigned u; + + /* Very special case: dump unamed type in root group */ + for(u = 0; u < type_table->nobjs; u++) { + if(!type_table->objs[u].recorded) { + dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); + type = H5Dget_type(dset); + sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); + dump_function_table->dump_named_datatype_function(type, type_name); + H5Tclose(type); + H5Dclose(dset); + } + } + } + + /* iterate through all the links */ + + if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) + H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL); + else + H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL); + + dump_indent -= COL; + ctx.indent_level--; + } + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + if(isRoot) + h5tools_str_append(&buffer, "", xmlnsprefix); + else + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_str_close(&buffer); + + if(par) + free(par); + if(tmp) + free(tmp); +} + +/*------------------------------------------------------------------------- + * Function: xml_print_refs + * + * Purpose: Print a path to the objects referenced by HDF5 Referneces. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +xml_print_refs(hid_t did, int source) +{ + herr_t e; + hid_t type; + hid_t space; + hssize_t ssiz; + hsize_t i; + size_t tsiz; + hobj_ref_t *refbuf = NULL; + char *buf = NULL; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + if (source == DATASET_DATA) { + type = H5Dget_type(did); + } + else if (source == ATTRIBUTE_DATA) { + type = H5Aget_type(did); + } + else { + /* return an error */ + return FAIL; + } + if (H5Tget_class(type) != H5T_REFERENCE) { + /* return an error */ + goto error; + } + if (!H5Tequal(type, H5T_STD_REF_OBJ)) { + /* region ref not supported yet... */ + /* return an error */ + goto error; + } + if (source == DATASET_DATA) { + space = H5Dget_space(did); + if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0) + goto error; + if ((tsiz = H5Tget_size(type)) == 0) + goto error; + + buf = (char *) calloc((size_t)(ssiz * tsiz), sizeof(char)); + if (buf == NULL) + goto error; + e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + /* need to check result here */ + if (e < 0) { + goto error; + } + } + else if (source == ATTRIBUTE_DATA) { + space = H5Aget_space(did); + if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0) + goto error; + if ((tsiz = H5Tget_size(type)) == 0) + goto error; + + buf = (char *) calloc((size_t)(ssiz * tsiz), sizeof(char)); + if (buf == NULL) { + goto error; + } + e = H5Aread(did, H5T_STD_REF_OBJ, buf); + /* need to check the result here */ + if (e < 0) { + goto error; + } + } + + refbuf = (hobj_ref_t *) buf; + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + memset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + for (i = 0; i < ssiz; i++) { + const char *path = lookup_ref_path(*refbuf); + ctx.indent_level++; + + if (!path) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%s\"", "NULL"); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + char *t_path = xml_escape_the_string(path, -1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%s\"", t_path); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + free(t_path); + } + ctx.indent_level--; + + refbuf++; + } + + h5tools_str_close(&buffer); + + free(buf); + H5Tclose(type); + H5Sclose(space); + return SUCCEED; + +error: + if(buf) + free(buf); + + H5E_BEGIN_TRY { + H5Tclose(type); + H5Sclose(space); + } H5E_END_TRY; + return FAIL; +} + +/*------------------------------------------------------------------------- + * Function: xml_print_strs + * + * Purpose: Print strings. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +xml_print_strs(hid_t did, int source) +{ + herr_t e; + hid_t type; + hid_t space; + hssize_t ssiz; + htri_t is_vlstr = FALSE; + size_t tsiz; + size_t i; + size_t str_size = 0; + char *bp = NULL; + char *onestring = NULL; + void *buf = NULL; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + if (source == DATASET_DATA) { + type = H5Dget_type(did); + } + else if (source == ATTRIBUTE_DATA) { + type = H5Aget_type(did); + } + else { + /* return an error */ + return FAIL; + } + if (H5Tget_class(type) != H5T_STRING) { + /* return an error */ + goto error; + } + /* Check if we have VL data in the dataset's datatype */ + is_vlstr = H5Tis_variable_str(type); + + if (source == DATASET_DATA) { + space = H5Dget_space(did); + if((ssiz = H5Sget_simple_extent_npoints(space)) < 0) + goto error; + if((tsiz = H5Tget_size(type)) == 0) + goto error; + + buf = malloc((size_t)(ssiz * tsiz)); + if (buf == NULL) + goto error; + + e = H5Dread(did, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + if (e < 0) { + goto error; + } + } + else if (source == ATTRIBUTE_DATA) { + space = H5Aget_space(did); + if((ssiz = H5Sget_simple_extent_npoints(space)) < 0) + goto error; + if((tsiz = H5Tget_size(type)) == 0) + goto error; + + buf = malloc((size_t)(ssiz * tsiz)); + if (buf == NULL) + goto error; + + e = H5Aread(did, type, buf); + if (e < 0) { + goto error; + } + } + + bp = (char*) buf; + if (!is_vlstr) + onestring = (char *) calloc(tsiz, sizeof(char)); + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + memset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + for (i = 0; i < ssiz; i++) { + if (is_vlstr) { + onestring = *(char **) bp; + if (onestring) + str_size = (size_t) HDstrlen(onestring); + } + else { + HDstrncpy(onestring, bp, tsiz); + str_size = tsiz; + } + + if (!onestring) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "NULL"); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + char *t_onestring = xml_escape_the_string(onestring, (int) str_size); + if (t_onestring) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%s\"", t_onestring); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + free(t_onestring); + } + } + bp += tsiz; + } + + h5tools_str_close(&buffer); + + /* Reclaim any VL memory, if necessary */ + if (!is_vlstr) + if (onestring) + free(onestring); + if (buf) { + if (is_vlstr) + H5Dvlen_reclaim(type, space, H5P_DEFAULT, buf); + free(buf); + } + H5Tclose(type); + H5Sclose(space); + return SUCCEED; + +error: + if(buf) + free(buf); + + H5E_BEGIN_TRY { + H5Tclose(type); + H5Sclose(space); + } H5E_END_TRY; + return FAIL; +} + +/*------------------------------------------------------------------------- + * Function: check_filters + * + * Purpose: private function to check for the filters and + * put tags in the XML. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +check_filters(hid_t dcpl) +{ + int nfilt; + int i; + H5Z_filter_t filter; + char namebuf[120]; + size_t cd_nelmts = 20; + unsigned int cd_values[20]; + unsigned int flags; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + memset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + nfilt = H5Pget_nfilters(dcpl); + if (nfilt <= 0) + return; + for (i = 0; i < nfilt; i++) { + filter = H5Pget_filter2(dcpl, (unsigned) i, &flags, (size_t *) &cd_nelmts, cd_values, 120, namebuf, NULL); + if (filter == H5Z_FILTER_DEFLATE) { + ctx.indent_level++; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDeflate Level=\"", xmlnsprefix); + if (cd_nelmts < 1) { + /* not sure what this means? */ + h5tools_str_append(&buffer, "6"); + } + else { + h5tools_str_append(&buffer, "%d", cd_values[0]); + } + h5tools_str_append(&buffer, "\"/>"); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + } + else if (filter == H5Z_FILTER_FLETCHER32) { + ctx.indent_level++; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sFletcher32 />", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + } + else if (filter == H5Z_FILTER_SHUFFLE) { + ctx.indent_level++; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sShuffle />", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + } + else if (filter == H5Z_FILTER_SZIP) { + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sSZIP ", xmlnsprefix); + if (cd_nelmts < 2) { + /* no pixels ? */ + h5tools_str_append(&buffer, "Pixels_per_block=\"-1\" "); + } + else { + h5tools_str_append(&buffer, "Pixels_per_block=\"%d\" ", cd_values[1]); + } + /* analyse the options mask */ + if (cd_values[0] & H5_SZIP_CHIP_OPTION_MASK) { + h5tools_str_append(&buffer, "Mode =\"Hardware\" "); + } + else if (cd_values[0] & H5_SZIP_ALLOW_K13_OPTION_MASK) { + h5tools_str_append(&buffer, "Mode =\"K13\" "); + } + h5tools_str_append(&buffer, "Coding=\""); + if (cd_values[0] & H5_SZIP_EC_OPTION_MASK) { + h5tools_str_append(&buffer, "Entropy"); + } + else if (cd_values[0] & H5_SZIP_NN_OPTION_MASK) { + h5tools_str_append(&buffer, "NN"); + } + h5tools_str_append(&buffer, "\" "); + + h5tools_str_append(&buffer, "ByteOrder=\""); + if (cd_values[0] & H5_SZIP_LSB_OPTION_MASK) { + h5tools_str_append(&buffer, "LSB"); + } + else if (cd_values[0] & H5_SZIP_MSB_OPTION_MASK) { + h5tools_str_append(&buffer, "MSB"); + } + h5tools_str_append(&buffer, "\" "); + + if (cd_values[0] & H5_SZIP_RAW_OPTION_MASK) { + h5tools_str_append(&buffer, "Header=\"Raw\""); + } + h5tools_str_append(&buffer, "/>"); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + } + else { + /* unknown option */ + } + } + + h5tools_str_close(&buffer); +} + +static void +xml_dump_fill_value(hid_t dcpl, hid_t type) +{ + size_t sz; + size_t i; + hsize_t space; + void *buf; + char *name; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + memset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + ctx.indent_level++; + dump_indent += COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + dump_indent += COL; + + space = H5Tget_size(type); + buf = malloc((size_t) space); + + H5Pget_fill_value(dcpl, type, buf); + + if (H5Tget_class(type) == H5T_REFERENCE) { + const char * path = lookup_ref_path(*(hobj_ref_t *) buf); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + if (!path) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%s\"", "NULL"); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + char *t_path = xml_escape_the_string(path, -1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%s\"", t_path); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + free(t_path); + } + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else if (H5Tget_class(type) == H5T_STRING) { + /* ????? */ + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + /* all other data */ + switch (H5Tget_class(type)) { + case H5T_INTEGER: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%d\"", *(int *) buf); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + case H5T_FLOAT: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%f\"", *(float *) buf); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + case H5T_BITFIELD: + case H5T_OPAQUE: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + sz = H5Tget_size(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\""); + for (i = 0; i < sz; i++) { + h5tools_str_append(&buffer, "%x ", *(unsigned int *) buf); + buf = (char *) buf + sizeof(unsigned int); + } + h5tools_str_append(&buffer, "\""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + case H5T_ENUM: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + name = H5Tget_member_name(type, *(unsigned *) buf); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%s\"", name); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + case H5T_ARRAY: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + case H5T_TIME: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + case H5T_COMPOUND: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + case H5T_VLEN: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + default: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", H5Tget_class(type)); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + } + } + free(buf); + ctx.indent_level--; + dump_indent -= COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + dump_indent -= COL; + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: xml_dump_dataset + * + * Purpose: Dump a description of an HDF5 dataset in XML. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * Pedro Vicente, October 9, 2007 + * added parameters to H5Aiterate2 to allow for other iteration orders + * + *------------------------------------------------------------------------- + */ +void +xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) +{ + hid_t type; + hid_t space; + hid_t dcpl; + H5D_fill_value_t fvstatus; + int maxdims; + hsize_t *chsize; + int ndims; + int i; + H5D_alloc_time_t at; + H5D_fill_time_t ft; + hsize_t tempi; + char *tmp; + char *t_name; + char *t_tmp; + char *t_prefix; + unsigned attr_crt_order_flags; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + char *rstr = (char*) HDmalloc(100); + char *pstr = (char*) HDmalloc(100); + + tmp = (char*) HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + HDstrcpy(tmp, prefix); + HDstrcat(tmp, "/"); + HDstrcat(tmp, name); + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + memset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + t_name = xml_escape_the_name(name); + t_tmp = xml_escape_the_name(tmp); + t_prefix = xml_escape_the_name(prefix); + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + xml_name_to_XID(tmp, rstr, 100, 1); + xml_name_to_XID(prefix, pstr, 100, 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataset Name=\"%s\" OBJ-XID=\"%s\" H5Path= \"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">", + xmlnsprefix, t_name, rstr, t_tmp, pstr, + strcmp(prefix, "") ? t_prefix : "/"); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + HDfree(t_name); + HDfree(t_tmp); + HDfree(t_prefix); + HDfree(rstr); + HDfree(pstr); + HDfree(tmp); + + dcpl = H5Dget_create_plist(did); + type = H5Dget_type(did); + space = H5Dget_space(did); + + /* query the creation properties for attributes */ + H5Pget_attr_creation_order(dcpl, &attr_crt_order_flags); + + /* Print information about storage layout */ + if (H5D_CHUNKED == H5Pget_layout(dcpl)) { + maxdims = H5Sget_simple_extent_ndims(space); + chsize = (hsize_t *) malloc(maxdims * sizeof(hsize_t)); + ctx.indent_level++; + dump_indent += COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + dump_indent += COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sChunkedLayout ", xmlnsprefix); + ndims = H5Pget_chunk(dcpl, maxdims, chsize); + h5tools_str_append(&buffer, "Ndims=\"%d\">", ndims); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + dump_indent += COL; + + for (i = 0; i < ndims; i++) { + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sChunkDimension DimSize=\"%lu\" />", xmlnsprefix, chsize[i]); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sRequiredFilter>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + dump_indent += COL; + check_filters(dcpl); + ctx.indent_level--; + dump_indent -= COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + dump_indent -= COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + dump_indent -= COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + dump_indent -= COL; + free(chsize); + } + else if (H5D_CONTIGUOUS == H5Pget_layout(dcpl)) { + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sContiguousLayout/>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + } + else if (H5D_COMPACT == H5Pget_layout(dcpl)) { + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sCompactLayout/>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + } + /* and check for external.... ?? */ + + /* fill value */ + + ctx.indent_level++; + dump_indent += COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sFillValueInfo ", xmlnsprefix); + H5Pget_fill_time(dcpl, &ft); + h5tools_str_append(&buffer, "FillTime=\""); + switch (ft) { + case H5D_FILL_TIME_ALLOC: + h5tools_str_append(&buffer, "FillOnAlloc"); + break; + case H5D_FILL_TIME_NEVER: + h5tools_str_append(&buffer, "FillNever"); + break; + case H5D_FILL_TIME_IFSET: + h5tools_str_append(&buffer, "FillIfSet"); + break; + default: + h5tools_str_append(&buffer, "?"); + break; + } + h5tools_str_append(&buffer, "\" "); + H5Pget_alloc_time(dcpl, &at); + h5tools_str_append(&buffer, "AllocationTime=\""); + switch (at) { + case H5D_ALLOC_TIME_EARLY: + h5tools_str_append(&buffer, "Early"); + break; + case H5D_ALLOC_TIME_INCR: + h5tools_str_append(&buffer, "Incremental"); + break; + case H5D_ALLOC_TIME_LATE: + h5tools_str_append(&buffer, "Late"); + break; + case H5D_ALLOC_TIME_DEFAULT: + default: + h5tools_str_append(&buffer, "?"); + break; + } + h5tools_str_append(&buffer, "\""); + h5tools_str_append(&buffer, ">"); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + dump_indent += COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sFillValue>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + H5Pfill_value_defined(dcpl, &fvstatus); + if (fvstatus == H5D_FILL_VALUE_UNDEFINED || (fvstatus == H5D_FILL_VALUE_DEFAULT && ft == H5D_FILL_TIME_IFSET)) { + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoFill/>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + } + else { + xml_dump_fill_value(dcpl, type); + } + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + dump_indent -= COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + dump_indent -= COL; + + dump_function_table->dump_dataspace_function(space); + dump_function_table->dump_datatype_function(type); + + ctx.indent_level++; + dump_indent += COL; + + if ((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { + if (H5Aiterate2(did, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end if */ + else { + if (H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end else */ + + ctx.indent_level--; + dump_indent -= COL; + tempi = H5Dget_storage_size(did); + + if (display_data && (tempi > 0)) { + switch (H5Tget_class(type)) { + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_ENUM: + case H5T_ARRAY: + ctx.indent_level++; + dump_indent += COL; + dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0); + ctx.indent_level--; + dump_indent -= COL; + break; + + case H5T_TIME: + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + break; + + case H5T_COMPOUND: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + dump_indent += COL; + dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0); + ctx.indent_level--; + dump_indent -= COL; + break; + + case H5T_REFERENCE: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + if (!H5Tequal(type, H5T_STD_REF_OBJ)) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + xml_print_refs(did, DATASET_DATA); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_VLEN: + ctx.indent_level--; + dump_indent -= COL; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + dump_indent += COL; + + ctx.indent_level++; + dump_indent += COL; + dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0); + ctx.indent_level--; + dump_indent -= COL; + break; + default: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", H5Tget_class(type)); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + } + } + else { + /* no data written */ + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + } + + H5Tclose(type); + H5Sclose(space); + H5Pclose(dcpl); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: xml_print_enum + * + * Purpose: Print the values of an HDF5 ENUM in XML. + * Very similar to regular DDL output. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +xml_print_enum(hid_t type) +{ + char **name = NULL; /*member names */ + unsigned char *value = NULL; /*value array */ + unsigned nmembs; /*number of members */ + hid_t super; /*enum base integer type */ + hid_t native = -1; /*native integer datatype */ + size_t dst_size; /*destination value type size */ + unsigned i; /*miscellaneous counters */ + size_t j; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + memset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + nmembs = (unsigned)H5Tget_nmembers(type); + super = H5Tget_super(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + xml_print_datatype(super,0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + /* + * Determine what datatype to use for the native values. To simplify + * things we entertain three possibilities: + * 1. long long -- the largest native signed integer + * 2. unsigned long long -- the largest native unsigned integer + * 3. raw format + */ + if (H5Tget_size(type) <= sizeof(long long)) { + dst_size = sizeof(long long); + + if (H5T_SGN_NONE == H5Tget_sign(type)) { + native = H5T_NATIVE_ULLONG; + } + else { + native = H5T_NATIVE_LLONG; + } + } + else { + dst_size = H5Tget_size(type); + } + + /* Get the names and raw values of all members */ + name = (char **)calloc(nmembs, sizeof(char *)); + value = (unsigned char *)calloc(nmembs, MAX(H5Tget_size(type), dst_size)); + + for (i = 0; i < nmembs; i++) { + name[i] = H5Tget_member_name(type, i); + H5Tget_member_value(type, i, value + i * H5Tget_size(type)); + } + + /* Convert values to native datatype */ + if (native > 0) + H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT); + + /* Sort members by increasing value */ + /*not implemented yet */ + + /* Print members */ + ctx.indent_level++; + dump_indent += COL; + for (i = 0; i < nmembs; i++) { + char *t_name = xml_escape_the_name(name[i]); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sEnumElement>",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s", t_name); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + free(t_name); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sEnumValue>",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + if (native < 0) { + h5tools_str_append(&buffer, "0x"); + + for (j = 0; j < dst_size; j++) + h5tools_str_append(&buffer, "%02x", value[i * dst_size + j]); + } + else if (H5T_SGN_NONE == H5Tget_sign(native)) { + h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "u", *((unsigned long long *) + ((void *) (value + i * dst_size)))); + } + else { + h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "d", + *((long long *) ((void *) (value + i * dst_size)))); + } + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + ctx.indent_level--; + dump_indent -= COL; + + h5tools_str_close(&buffer); + + /* Release resources */ + for (i = 0; i < nmembs; i++) + free(name[i]); + + free(name); + free(value); + H5Tclose(super); +} + diff --git a/tools/h5dump/h5dump_xml.h b/tools/h5dump/h5dump_xml.h new file mode 100644 index 0000000..28485f8 --- /dev/null +++ b/tools/h5dump/h5dump_xml.h @@ -0,0 +1,128 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#ifndef H5DUMP_XML_H__ +#define H5DUMP_XML_H__ + +extern const char *xmlnsprefix; + +/* + * Alternative formating for data dumped to XML + * In general, the numbers are the same, but separators + * except spaces are not used. + * + * Some of these are not used, as some kinds of data are + * dumped in completely new subroutines. + * + * Some of this formatting may yet need to change. + * + * This table only affects XML output. + */ +static h5tool_format_t xml_dataformat = { + 0, /*raw */ + + "", /*fmt_raw */ + "%d", /*fmt_int */ + "%u", /*fmt_uint */ + "%hhd", /*fmt_schar */ + "%u", /*fmt_uchar */ + "%d", /*fmt_short */ + "%u", /*fmt_ushort */ + "%ld", /*fmt_long */ + "%lu", /*fmt_ulong */ + NULL, /*fmt_llong */ + NULL, /*fmt_ullong */ + "%g", /*fmt_double */ + "%g", /*fmt_float */ + + 0, /*ascii */ + 0, /*str_locale */ + 0, /*str_repeat */ + + "", /*arr_pre */ + "", /*arr_sep */ + "", /*arr_suf */ + 1, /*arr_linebreak */ + + "", /*cmpd_name */ + "", /*cmpd_sep */ + "", /*cmpd_pre */ + "", /*cmpd_suf */ + "", /*cmpd_end */ + + " ", /*vlen_sep */ + " ", /*vlen_pre */ + "", /*vlen_suf */ + "", /*vlen_end */ + + "%s", /*elmt_fmt */ + "", /*elmt_suf1 */ + " ", /*elmt_suf2 */ + + "", /*idx_n_fmt */ + "", /*idx_sep */ + "", /*idx_fmt */ + + 80, /*line_ncols *//*standard default columns */ + 0, /*line_per_line */ + "", /*line_pre */ + "%s", /*line_1st */ + "%s", /*line_cont */ + "", /*line_suf */ + "", /*line_sep */ + 1, /*line_multi_new */ + " ", /*line_indent */ + + 1, /*skip_first */ + + 1, /*obj_hidefileno */ + " "H5_PRINTF_HADDR_FMT, /*obj_format */ + + 1, /*dset_hidefileno */ + "DATASET %s ", /*dset_format */ + "%s", /*dset_blockformat_pre */ + "%s", /*dset_ptformat_pre */ + "%s", /*dset_ptformat */ + 0, /*array indices */ + 0 /*escape non printable characters */ +}; + +#ifdef __cplusplus +extern "C" { +#endif + +/* internal functions used by XML option */ +static void xml_print_datatype(hid_t, unsigned); +static void xml_print_enum(hid_t); +static int xml_print_refs(hid_t, int); +static int xml_print_strs(hid_t, int); +static char *xml_escape_the_string(const char *, int); +static char *xml_escape_the_name(const char *); + +/* The dump functions of the dump_function_table */ +/* XML format: same interface, alternative output */ + +void xml_dump_group(hid_t, const char *); +void xml_dump_named_datatype(hid_t, const char *); +void xml_dump_dataset(hid_t, const char *, struct subset_t *); +void xml_dump_dataspace(hid_t space); +void xml_dump_datatype(hid_t type); +herr_t xml_dump_attr(hid_t, const char *, const H5A_info_t *, void *); +void xml_dump_data(hid_t, int, struct subset_t *, int); + +#ifdef __cplusplus +} +#endif + +#endif /* !H5DUMP_XML_H__ */ diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 66e588f..6b4d5f0 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -27,12 +27,86 @@ #include "H5private.h" #include "h5tools.h" #include "h5tools_utils.h" +#include "h5tools_dump.h" #include "h5trav.h" /* Name of tool */ #define PROGRAMNAME "h5ls" #define NAME_BUF_SIZE 2048 +/* + * Alternative formating for data dumped by H5LS + * + * This table only affects H5LS output. + */ +static h5tool_format_t ls_dataformat = { + 0, /*raw */ + + "", /*fmt_raw */ + "%d", /*fmt_int */ + "%u", /*fmt_uint */ + "%hhd", /*fmt_schar */ + "%u", /*fmt_uchar */ + "%d", /*fmt_short */ + "%u", /*fmt_ushort */ + "%ld", /*fmt_long */ + "%lu", /*fmt_ulong */ + NULL, /*fmt_llong */ + NULL, /*fmt_ullong */ + "%g", /*fmt_double */ + "%g", /*fmt_float */ + + 0, /*ascii */ + 0, /*str_locale */ + 0, /*str_repeat */ + + "[", /*arr_pre */ + ",", /*arr_sep */ + "]", /*arr_suf */ + 1, /*arr_linebreak */ + + "", /*cmpd_name */ + ",", /*cmpd_sep */ + "{", /*cmpd_pre */ + "}", /*cmpd_suf */ + "", /*cmpd_end */ + + ",", /*vlen_sep */ + "(", /*vlen_pre */ + ")", /*vlen_suf */ + "", /*vlen_end */ + + "%s", /*elmt_fmt */ + ",", /*elmt_suf1 */ + " ", /*elmt_suf2 */ + + "%lu", /*idx_n_fmt */ + ",", /*idx_sep */ + "(%s)", /*idx_fmt */ + + 65535, /*line_ncols *//*standard default columns */ + 0, /*line_per_line */ + "", /*line_pre */ + "%s", /*line_1st */ + "%s", /*line_cont */ + "", /*line_suf */ + "", /*line_sep */ + 1, /*line_multi_new */ + "", /*line_indent */ + + 0, /*skip_first */ + + 0, /*obj_hidefileno */ + "-%lu:"H5_PRINTF_HADDR_FMT, /*obj_format */ + + 0, /*dset_hidefileno */ + "DSET-%s ", /*dset_format */ + "%sBlk%lu: ", /*dset_blockformat_pre */ + "%sPt%lu: ", /*dset_ptformat_pre */ + "%s", /*dset_ptformat */ + 1, /*array indices */ + 1 /*escape non printable characters */ +}; /* Struct to pass through to visitors */ typedef struct { @@ -81,6 +155,7 @@ static struct dispatch_t { } static void display_type(hid_t type, int ind); +static void print_type(h5tools_str_t *buffer, hid_t type, int ind); static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter); @@ -1229,232 +1304,1362 @@ display_type(hid_t type, int ind) (unsigned long)H5Tget_size(type), (unsigned)data_class); } - + /*------------------------------------------------------------------------- - * Function: dump_dataset_values + * Function: print_string * - * Purpose: Prints all values of a dataset. + * Purpose: Print a string value by escaping unusual characters. If + * STREAM is null then we only count how large the output would + * be. * - * Return: void + * Return: Number of characters printed. * * Programmer: Robb Matzke - * Tuesday, July 21, 1998 + * Thursday, November 5, 1998 * * Modifications: - * Robb Matzke, 1999-09-27 - * Understands the simple_output_g switch which causes data to - * be displayed in a more machine-readable format. + * *------------------------------------------------------------------------- */ -static void -dump_dataset_values(hid_t dset) +static int +print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces) { - hid_t f_type = H5Dget_type(dset); - size_t size = H5Tget_size(f_type); - h5tool_format_t info; - char string_prefix[64]; - static char fmt_double[16], fmt_float[16]; - - /* Set to all default values and then override */ - memset(&info, 0, sizeof info); - - if (simple_output_g) { - info.idx_fmt = ""; - info.line_ncols = 65535; /*something big*/ - info.line_per_line = 1; - info.line_multi_new = 0; - info.line_pre = " "; - info.line_cont = " "; - - info.arr_pre = ""; - info.arr_suf = ""; - info.arr_sep = " "; - - if (label_g) - { - info.cmpd_pre = "{"; - info.cmpd_suf = "}"; - } - else - { - info.cmpd_pre = ""; - info.cmpd_suf = ""; - } - info.cmpd_sep = " "; - - if (label_g) info.cmpd_name = "%s="; - - info.elmt_suf1 = " "; - info.str_locale = ESCAPE_HTML; + int nprint=0; - } else { - info.idx_fmt = "(%s)"; - if (no_line_wrap_g) { - info.line_ncols = 65535; - info.line_per_line = 1; + for (/*void*/; s && *s; s++) { + switch (*s) { + case '"': + h5tools_str_append(buffer, "\\\""); + nprint += 2; + break; + case '\\': + h5tools_str_append(buffer, "\\\\"); + nprint += 2; + break; + case '\b': + h5tools_str_append(buffer, "\\b"); + nprint += 2; + break; + case '\f': + h5tools_str_append(buffer, "\\f"); + nprint += 2; + break; + case '\n': + h5tools_str_append(buffer, "\\n"); + nprint += 2; + break; + case '\r': + h5tools_str_append(buffer, "\\r"); + nprint += 2; + break; + case '\t': + h5tools_str_append(buffer, "\\t"); + nprint += 2; + break; + case ' ': + if (escape_spaces) { + h5tools_str_append(buffer, "\\ "); + nprint += 2; + } + else { + h5tools_str_append(buffer, " "); + nprint++; + } + break; + default: + if (isprint((int)*s)) { + h5tools_str_append(buffer, "%c", *s); + nprint++; + } else { + h5tools_str_append(buffer, "\\%03o", *((const unsigned char*)s)); + nprint += 4; + } + break; } - else - info.line_ncols = width_g; - info.line_multi_new = 1; - if (label_g) info.cmpd_name = "%s="; - info.line_pre = " %s "; - info.line_cont = " %s "; - info.str_repeat = 8; } + return nprint; +} - /* Floating point types should display full precision */ - sprintf(fmt_float, "%%1.%dg", FLT_DIG); - info.fmt_float = fmt_float; - sprintf(fmt_double, "%%1.%dg", DBL_DIG); - info.fmt_double = fmt_double; + +/*------------------------------------------------------------------------- + * Function: print_obj_name + * + * Purpose: Print an object name and another string. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Quincey Koziol + * Tuesday, November 6, 2007 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +print_obj_name(h5tools_str_t *buffer, const iter_t *iter, const char *oname, + const char *s) +{ + static char fullname[NAME_BUF_SIZE]; /* Buffer for file and/or object name */ + const char *name = fullname; /* Pointer to buffer for printing */ + int n; - info.dset_format = "DSET-%s "; - info.dset_hidefileno = 0; + if(show_file_name_g) + sprintf(fullname, "%s/%s", iter->fname, oname + iter->name_start); + else + name = oname + iter->name_start; - info.obj_format = "-%lu:"H5_PRINTF_HADDR_FMT; - info.obj_hidefileno = 0; + /* Print the object name, either full name or base name */ + if(fullname_g) + n = print_string(buffer, name, TRUE); + else { + const char *last_sep; /* The location of the last group separator */ - info.dset_blockformat_pre = "%sBlk%lu: "; - info.dset_ptformat_pre = "%sPt%lu: "; + /* Find the last component of the path name */ + if(NULL == (last_sep = HDstrrchr(name, '/'))) + last_sep = name; + else { + last_sep++; + } /* end else */ + n = print_string(buffer, last_sep, TRUE); + } /* end else */ + h5tools_str_append(buffer, "%*s ", MAX(0, (24 - n)), s); - info.line_indent = ""; + return TRUE; +} - if (hexdump_g) { - /* Print all data in hexadecimal format if the `-x' or `--hexdump' - * command line switch was given. */ - info.raw = TRUE; - } else if (string_g && 1==size && H5T_INTEGER==H5Tget_class(f_type)) { - /* Print 1-byte integer data as an ASCI character string instead of - * integers if the `-s' or `--string' command-line option was given. */ - info.ascii = TRUE; - info.elmt_suf1 = ""; - info.elmt_suf2 = ""; - strcpy(string_prefix, info.line_pre); - strcat(string_prefix, "\""); - info.line_pre = string_prefix; - info.line_suf = "\""; + +/*------------------------------------------------------------------------- + * Function: print_native_type + * + * Purpose: Prints the name of a native C data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed. + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * Robb Matzke, 1999-06-11 + * Added the C9x types, but we still prefer to display the types + * from the C language itself (like `int' vs. `int32_t'). + * + *------------------------------------------------------------------------- + */ +static hbool_t +print_native_type(h5tools_str_t *buffer, hid_t type, int UNUSED ind) +{ + if (H5Tequal(type, H5T_NATIVE_SCHAR)==TRUE) { + h5tools_str_append(buffer, "native signed char"); + } else if (H5Tequal(type, H5T_NATIVE_UCHAR)==TRUE) { + h5tools_str_append(buffer, "native unsigned char"); + } else if (H5Tequal(type, H5T_NATIVE_INT)==TRUE) { + h5tools_str_append(buffer, "native int"); + } else if (H5Tequal(type, H5T_NATIVE_UINT)==TRUE) { + h5tools_str_append(buffer, "native unsigned int"); + } else if (H5Tequal(type, H5T_NATIVE_SHORT)==TRUE) { + h5tools_str_append(buffer, "native short"); + } else if (H5Tequal(type, H5T_NATIVE_USHORT)==TRUE) { + h5tools_str_append(buffer, "native unsigned short"); + } else if (H5Tequal(type, H5T_NATIVE_LONG)==TRUE) { + h5tools_str_append(buffer, "native long"); + } else if (H5Tequal(type, H5T_NATIVE_ULONG)==TRUE) { + h5tools_str_append(buffer, "native unsigned long"); + } else if (H5Tequal(type, H5T_NATIVE_LLONG)==TRUE) { + h5tools_str_append(buffer, "native long long"); + } else if (H5Tequal(type, H5T_NATIVE_ULLONG)==TRUE) { + h5tools_str_append(buffer, "native unsigned long long"); + } else if (H5Tequal(type, H5T_NATIVE_FLOAT)==TRUE) { + h5tools_str_append(buffer, "native float"); + } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)==TRUE) { + h5tools_str_append(buffer, "native double"); +#if H5_SIZEOF_LONG_DOUBLE !=0 + } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)==TRUE) { + h5tools_str_append(buffer, "native long double"); +#endif + } else if (H5Tequal(type, H5T_NATIVE_INT8)==TRUE) { + h5tools_str_append(buffer, "native int8_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT8)==TRUE) { + h5tools_str_append(buffer, "native uint8_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT16)==TRUE) { + h5tools_str_append(buffer, "native int16_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT16)==TRUE) { + h5tools_str_append(buffer, "native uint16_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT32)==TRUE) { + h5tools_str_append(buffer, "native int32_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT32)==TRUE) { + h5tools_str_append(buffer, "native uint32_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT64)==TRUE) { + h5tools_str_append(buffer, "native int64_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT64)==TRUE) { + h5tools_str_append(buffer, "native uint64_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST8)==TRUE) { + h5tools_str_append(buffer, "native int_least8_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST8)==TRUE) { + h5tools_str_append(buffer, "native uint_least8_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST16)==TRUE) { + h5tools_str_append(buffer, "native int_least16_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST16)==TRUE) { + h5tools_str_append(buffer, "native uint_least16_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST32)==TRUE) { + h5tools_str_append(buffer, "native int_least32_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST32)==TRUE) { + h5tools_str_append(buffer, "native uint_least32_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST64)==TRUE) { + h5tools_str_append(buffer, "native int_least64_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST64)==TRUE) { + h5tools_str_append(buffer, "native uint_least64_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_FAST8)==TRUE) { + h5tools_str_append(buffer, "native int_fast8_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST8)==TRUE) { + h5tools_str_append(buffer, "native uint_fast8_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_FAST16)==TRUE) { + h5tools_str_append(buffer, "native int_fast16_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST16)==TRUE) { + h5tools_str_append(buffer, "native uint_fast16_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_FAST32)==TRUE) { + h5tools_str_append(buffer, "native int_fast32_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST32)==TRUE) { + h5tools_str_append(buffer, "native uint_fast32_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_FAST64)==TRUE) { + h5tools_str_append(buffer, "native int_fast64_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST64)==TRUE) { + h5tools_str_append(buffer, "native uint_fast64_t"); + } else if (H5Tequal(type, H5T_NATIVE_B8)==TRUE) { + h5tools_str_append(buffer, "native 8-bit field"); + } else if (H5Tequal(type, H5T_NATIVE_B16)==TRUE) { + h5tools_str_append(buffer, "native 16-bit field"); + } else if (H5Tequal(type, H5T_NATIVE_B32)==TRUE) { + h5tools_str_append(buffer, "native 32-bit field"); + } else if (H5Tequal(type, H5T_NATIVE_B64)==TRUE) { + h5tools_str_append(buffer, "native 64-bit field"); + } else if (H5Tequal(type, H5T_NATIVE_HSIZE)==TRUE) { + h5tools_str_append(buffer, "native hsize_t"); + } else if (H5Tequal(type, H5T_NATIVE_HSSIZE)==TRUE) { + h5tools_str_append(buffer, "native hssize_t"); + } else if (H5Tequal(type, H5T_NATIVE_HERR)==TRUE) { + h5tools_str_append(buffer, "native herr_t"); + } else if (H5Tequal(type, H5T_NATIVE_HBOOL)==TRUE) { + h5tools_str_append(buffer, "native hbool_t"); + } else { + return FALSE; } - - /* Print all the values. */ - printf(" Data:\n"); - if (h5tools_dump_dset(stdout, &info, dset, -1, NULL, -1) < 0) - printf(" Unable to print data.\n"); - - H5Tclose(f_type); + return TRUE; } /*------------------------------------------------------------------------- - * Function: list_attr + * Function: print_ieee_type * - * Purpose: Prints information about attributes. + * Purpose: Print the name of an IEEE floating-point data type. * - * Return: Success: 0 + * Return: Success: TRUE * - * Failure: -1 + * Failure: FALSE, nothing printed * * Programmer: Robb Matzke - * Friday, June 5, 1998 + * Thursday, November 5, 1998 * * Modifications: * *------------------------------------------------------------------------- */ -static herr_t -list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, - void UNUSED *op_data) +static hbool_t +print_ieee_type(h5tools_str_t *buffer, hid_t type, int UNUSED ind) { - hid_t attr, space, type, p_type; - hsize_t size[H5S_MAX_RANK], nelmts = 1; - int ndims, i, n; - size_t need; - hsize_t temp_need; - void *buf; - h5tool_format_t info; - H5S_class_t space_type; - - printf(" Attribute: "); - n = display_string(stdout, attr_name, TRUE); - printf("%*s", MAX(0, (9 - n)), ""); + if (H5Tequal(type, H5T_IEEE_F32BE)==TRUE) { + h5tools_str_append(buffer, "IEEE 32-bit big-endian float"); + } + else if (H5Tequal(type, H5T_IEEE_F32LE)==TRUE) { + h5tools_str_append(buffer, "IEEE 32-bit little-endian float"); + } + else if (H5Tequal(type, H5T_IEEE_F64BE)==TRUE) { + h5tools_str_append(buffer, "IEEE 64-bit big-endian float"); + } + else if (H5Tequal(type, H5T_IEEE_F64LE)==TRUE) { + h5tools_str_append(buffer, "IEEE 64-bit little-endian float"); + } + else { + return FALSE; + } + return TRUE; +} - if((attr = H5Aopen(obj, attr_name, H5P_DEFAULT))) { - space = H5Aget_space(attr); - type = H5Aget_type(attr); + +/*------------------------------------------------------------------------- + * Function: print_precision + * + * Purpose: Prints information on the next line about precision and + * padding if the precision is less than the total data type + * size. + * + * Return: void + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +print_precision(h5tools_str_t *buffer, hid_t type, int ind) +{ + size_t prec; /* precision */ + H5T_pad_t plsb, pmsb; /* lsb and msb padding */ + const char *plsb_s=NULL; /* lsb padding string */ + const char *pmsb_s=NULL; /* msb padding string */ + size_t nbits; /* number of bits */ - /* Data space */ - ndims = H5Sget_simple_extent_dims(space, size, NULL); - space_type = H5Sget_simple_extent_type(space); - switch(space_type) { - case H5S_SCALAR: - /* scalar dataspace */ - puts(" scalar"); - break; + /* If the precision is less than the total size then show the precision + * and offset on the following line. Also display the padding + * information. */ + if (8*H5Tget_size(type)!=(prec=H5Tget_precision(type))) { + h5tools_str_append(buffer, "\n%*s(%lu bit%s of precision beginning at bit %lu)", + ind, "", (unsigned long)prec, 1==prec?"":"s", + (unsigned long)H5Tget_offset(type)); + + H5Tget_pad(type, &plsb, &pmsb); + if (H5Tget_offset(type)>0) { + switch (plsb) { + case H5T_PAD_ZERO: + plsb_s = "zero"; + break; + case H5T_PAD_ONE: + plsb_s = "one"; + break; + case H5T_PAD_BACKGROUND: + plsb_s = "bkg"; + break; + case H5T_PAD_ERROR: + case H5T_NPAD: + plsb_s = "unknown"; + break; + default: + ; + break; + } + } + if (H5Tget_offset(type)+prec<8*H5Tget_size(type)) { + switch (pmsb) { + case H5T_PAD_ZERO: + pmsb_s = "zero"; + break; + case H5T_PAD_ONE: + pmsb_s = "one"; + break; + case H5T_PAD_BACKGROUND: + pmsb_s = "bkg"; + break; + case H5T_PAD_ERROR: + case H5T_NPAD: + pmsb_s = "unknown"; + break; + default: + ; + break; + } + } + if (plsb_s || pmsb_s) { + h5tools_str_append(buffer, "\n%*s(", ind, ""); + if (plsb_s) { + nbits = H5Tget_offset(type); + h5tools_str_append(buffer, "%lu %s bit%s at bit 0", + (unsigned long)nbits, plsb_s, 1==nbits?"":"s"); + } + if (plsb_s && pmsb_s) h5tools_str_append(buffer, ", "); + if (pmsb_s) { + nbits = 8*H5Tget_size(type)-(H5Tget_offset(type)+prec); + h5tools_str_append(buffer, "%lu %s bit%s at bit %lu", + (unsigned long)nbits, pmsb_s, 1==nbits?"":"s", + (unsigned long)(8*H5Tget_size(type)-nbits)); + } + h5tools_str_append(buffer, ")"); + } + } +} + + +/*------------------------------------------------------------------------- + * Function: print_int_type + * + * Purpose: Print the name of an integer data type. Common information + * like number of bits, byte order, and sign scheme appear on + * the first line. Additional information might appear in + * parentheses on the following lines. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +print_int_type(h5tools_str_t *buffer, hid_t type, int ind) +{ + H5T_order_t order; /* byte order value */ + const char *order_s=NULL; /* byte order string */ + H5T_sign_t sign; /* sign scheme value */ + const char *sign_s=NULL; /* sign scheme string */ + + if (H5T_INTEGER!=H5Tget_class(type)) return FALSE; + + /* Byte order */ + if (H5Tget_size(type)>1) { + order = H5Tget_order(type); + if (H5T_ORDER_LE==order) { + order_s = " little-endian"; + } + else if (H5T_ORDER_BE==order) { + order_s = " big-endian"; + } + else if (H5T_ORDER_VAX==order) { + order_s = " mixed-endian"; + } + else { + order_s = " unknown-byte-order"; + } + } + else { + order_s = ""; + } + + /* Sign */ + if ((sign=H5Tget_sign(type))>=0) { + if (H5T_SGN_NONE==sign) { + sign_s = " unsigned"; + } + else if (H5T_SGN_2==sign) { + sign_s = ""; + } + else { + sign_s = " unknown-sign"; + } + } + else { + sign_s = " unknown-sign"; + } + + /* Print size, order, and sign on first line, precision and padding + * information on the subsequent lines */ + h5tools_str_append(buffer, "%lu-bit%s%s integer", + (unsigned long)(8*H5Tget_size(type)), order_s, sign_s); + print_precision(buffer, type, ind); + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: print_float_type + * + * Purpose: Print info about a floating point data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +print_float_type(h5tools_str_t *buffer, hid_t type, int ind) +{ + H5T_order_t order; /* byte order value */ + const char *order_s=NULL; /* byte order string */ + size_t spos; /* sign bit position */ + size_t esize, epos; /* exponent size and position */ + size_t msize, mpos; /* significand size and position */ + size_t ebias; /* exponent bias */ + H5T_norm_t norm; /* significand normalization */ + const char *norm_s=NULL; /* normalization string */ + H5T_pad_t pad; /* internal padding value */ + const char *pad_s=NULL; /* internal padding string */ + + if (H5T_FLOAT!=H5Tget_class(type)) return FALSE; + + /* Byte order */ + if (H5Tget_size(type)>1) { + order = H5Tget_order(type); + if (H5T_ORDER_LE==order) { + order_s = " little-endian"; + } + else if (H5T_ORDER_BE==order) { + order_s = " big-endian"; + } + else if (H5T_ORDER_VAX==order) { + order_s = " mixed-endian"; + } + else { + order_s = " unknown-byte-order"; + } + } + else { + order_s = ""; + } + + /* Print size and byte order on first line, precision and padding on + * subsequent lines. */ + h5tools_str_append(buffer, "%lu-bit%s floating-point", + (unsigned long)(8*H5Tget_size(type)), order_s); + print_precision(buffer, type, ind); + + /* Print sizes, locations, and other information about each field */ + H5Tget_fields (type, &spos, &epos, &esize, &mpos, &msize); + ebias = H5Tget_ebias(type); + norm = H5Tget_norm(type); + switch (norm) { + case H5T_NORM_IMPLIED: + norm_s = ", msb implied"; + break; + case H5T_NORM_MSBSET: + norm_s = ", msb always set"; + break; + case H5T_NORM_NONE: + norm_s = ", no normalization"; + break; + case H5T_NORM_ERROR: + norm_s = ", unknown normalization"; + break; + default: + ; + break; + } + h5tools_str_append(buffer, "\n%*s(significant for %lu bit%s at bit %lu%s)", ind, "", + (unsigned long)msize, 1==msize?"":"s", (unsigned long)mpos, + norm_s); + h5tools_str_append(buffer, "\n%*s(exponent for %lu bit%s at bit %lu, bias is 0x%lx)", + ind, "", (unsigned long)esize, 1==esize?"":"s", + (unsigned long)epos, (unsigned long)ebias); + h5tools_str_append(buffer, "\n%*s(sign bit at %lu)", ind, "", (unsigned long)spos); + + /* Display internal padding */ + if (1+esize+msize0); + super = H5Tget_super(type); + h5tools_str_append(buffer, "enum "); + print_type(buffer, super, ind+4); + h5tools_str_append(buffer, " {"); + + /* Determine what data type to use for the native values. To simplify + * things we entertain three possibilities: + * 1. long long -- the largest native signed integer + * 2. unsigned long long -- the largest native unsigned integer + * 3. raw format */ + if (H5Tget_size(type)<=sizeof(long long)) { + dst_size = sizeof(long long); + if (H5T_SGN_NONE==H5Tget_sign(type)) { + native = H5T_NATIVE_ULLONG; + } else { + native = H5T_NATIVE_LLONG; + } + } else { + dst_size = H5Tget_size(type); + } + + /* Get the names and raw values of all members */ + name = calloc(nmembs, sizeof(char*)); + value = (unsigned char *)calloc(nmembs, MAX(H5Tget_size(type), dst_size)); + for (i=0; i0) H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT); + + /* Sort members by increasing value */ + /*not implemented yet*/ + + /* Print members */ + for (i=0; i", ind+4, ""); + h5tools_str_append(buffer, "\n%*s}", ind, ""); + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: print_string_type + * + * Purpose: Print information about a string data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +print_string_type(h5tools_str_t *buffer, hid_t type, int UNUSED ind) +{ + H5T_str_t pad; + const char *pad_s=NULL; + H5T_cset_t cset; + const char *cset_s=NULL; + + if (H5T_STRING!=H5Tget_class(type)) return FALSE; + + /* Padding */ + pad = H5Tget_strpad(type); + switch (pad) { + case H5T_STR_NULLTERM: + pad_s = "null-terminated"; + break; + case H5T_STR_NULLPAD: + pad_s = "null-padded"; + break; + case H5T_STR_SPACEPAD: + pad_s = "space-padded"; + break; + case H5T_STR_RESERVED_3: + case H5T_STR_RESERVED_4: + case H5T_STR_RESERVED_5: + case H5T_STR_RESERVED_6: + case H5T_STR_RESERVED_7: + case H5T_STR_RESERVED_8: + case H5T_STR_RESERVED_9: + case H5T_STR_RESERVED_10: + case H5T_STR_RESERVED_11: + case H5T_STR_RESERVED_12: + case H5T_STR_RESERVED_13: + case H5T_STR_RESERVED_14: + case H5T_STR_RESERVED_15: + case H5T_STR_ERROR: + pad_s = "unknown-format"; + break; + default: + ; + break; + } + + /* Character set */ + cset = H5Tget_cset(type); + switch (cset) { + case H5T_CSET_ASCII: + cset_s = "ASCII"; + break; + case H5T_CSET_UTF8: + cset_s = "UTF-8"; + break; + case H5T_CSET_RESERVED_2: + case H5T_CSET_RESERVED_3: + case H5T_CSET_RESERVED_4: + case H5T_CSET_RESERVED_5: + case H5T_CSET_RESERVED_6: + case H5T_CSET_RESERVED_7: + case H5T_CSET_RESERVED_8: + case H5T_CSET_RESERVED_9: + case H5T_CSET_RESERVED_10: + case H5T_CSET_RESERVED_11: + case H5T_CSET_RESERVED_12: + case H5T_CSET_RESERVED_13: + case H5T_CSET_RESERVED_14: + case H5T_CSET_RESERVED_15: + case H5T_CSET_ERROR: + cset_s = "unknown-character-set"; + break; + default: + ; + break; + } + + if (H5Tis_variable_str(type)) { + h5tools_str_append(buffer, "variable-length"); + } + else { + h5tools_str_append(buffer, "%lu-byte", (unsigned long)H5Tget_size(type)); + } + h5tools_str_append(buffer, " %s %s string", pad_s, cset_s); + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: print_reference_type + * + * Purpose: Prints information about a reference data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * Robb Matzke, 1999-06-04 + * Knows about object and dataset region references. + * + *------------------------------------------------------------------------- + */ +static hbool_t +print_reference_type(h5tools_str_t *buffer, hid_t type, int UNUSED ind) +{ + if (H5T_REFERENCE!=H5Tget_class(type)) return FALSE; + + if (H5Tequal(type, H5T_STD_REF_OBJ)==TRUE) { + h5tools_str_append(buffer, "object reference"); + } + else if (H5Tequal(type, H5T_STD_REF_DSETREG)==TRUE) { + h5tools_str_append(buffer, "dataset region reference"); + } + else { + h5tools_str_append(buffer, "%lu-byte unknown reference", + (unsigned long)H5Tget_size(type)); + } + + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: print_opaque_type + * + * Purpose: Prints information about an opaque data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Monday, June 7, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +print_opaque_type(h5tools_str_t *buffer, hid_t type, int ind) +{ + char *tag; + size_t size; + + if (H5T_OPAQUE!=H5Tget_class(type)) return FALSE; + + size = H5Tget_size(type); + h5tools_str_append(buffer, "%lu-byte opaque type", (unsigned long)size); + if ((tag=H5Tget_tag(type))) { + h5tools_str_append(buffer, "\n%*s(tag = \"", ind, ""); + print_string(buffer, tag, FALSE); + h5tools_str_append(buffer, "\")"); + free(tag); + } + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: print_vlen_type + * + * Purpose: Print information about a variable-length type + * + * Return: Success: TRUE + * + * Failure: FALSE + * + * Programmer: Robb Matzke + * Friday, December 1, 2000 + * + * Modifications: + *------------------------------------------------------------------------- + */ +static hbool_t +print_vlen_type(h5tools_str_t *buffer, hid_t type, int ind) +{ + hid_t super; + + if (H5T_VLEN!=H5Tget_class(type)) return FALSE; + + h5tools_str_append(buffer, "variable length of\n%*s", ind+4, ""); + super = H5Tget_super(type); + print_type(buffer, super, ind+4); + H5Tclose(super); + return TRUE; +} + + +/*--------------------------------------------------------------------------- + * Purpose: Print information about an array type + * + * Return: Success: TRUE + * + * Failure: FALSE + * + * Programmer: Robb Matzke + * Thursday, January 31, 2002 + * + * Modifications: + *--------------------------------------------------------------------------- + */ +static hbool_t +print_array_type(h5tools_str_t *buffer, hid_t type, int ind) +{ + hid_t super; + int ndims, i; + hsize_t *dims=NULL; + + if (H5T_ARRAY!=H5Tget_class(type)) return FALSE; + ndims = H5Tget_array_ndims(type); + if (ndims) { + dims = (hsize_t *)malloc(ndims*sizeof(dims[0])); + H5Tget_array_dims2(type, dims); + + /* Print dimensions */ + for (i=0; i1) { + order = H5Tget_order(type); + if (H5T_ORDER_LE==order) { + order_s = " little-endian"; + } else if (H5T_ORDER_BE==order) { + order_s = " big-endian"; + } else if (H5T_ORDER_VAX==order) { + order_s = " mixed-endian"; + } else { + order_s = "unknown-byte-order"; + } + } else { + order_s = ""; + } + + h5tools_str_append(buffer, "%lu-bit%s bitfield", + (unsigned long)(8*H5Tget_size(type)), order_s); + print_precision(buffer, type, ind); + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: print_type + * + * Purpose: Prints a data type definition. The definition is printed + * without any leading space or trailing line-feed (although + * there might be line-feeds inside the type definition). The + * first line is assumed to have IND characters before it on + * the same line (printed by the caller). + * + * Return: void + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * Robb Matzke, 1999-06-11 + * Prints the OID of shared data types. + * + *------------------------------------------------------------------------- + */ +static void +print_type(h5tools_str_t *buffer, hid_t type, int ind) +{ + H5T_class_t data_class = H5Tget_class(type); + + /* Bad data type */ + if (type<0) { + h5tools_str_append(buffer,""); + return; + } + + /* Shared? If so then print the type's OID */ + if(H5Tcommitted(type)) { + H5O_info_t oi; + + if(H5Oget_info(type, &oi) >= 0) + h5tools_str_append(buffer,"shared-%lu:"H5_PRINTF_HADDR_FMT" ", + oi.fileno, oi.addr); + else + h5tools_str_append(buffer,"shared "); + } /* end if */ + + /* Print the type */ + if((!simple_output_g && print_native_type(buffer, type, ind)) || + print_ieee_type(buffer, type, ind) || + print_int_type(buffer, type, ind) || + print_float_type(buffer, type, ind) || + print_cmpd_type(buffer, type, ind) || + print_enum_type(buffer, type, ind) || + print_string_type(buffer, type, ind) || + print_reference_type(buffer, type, ind) || + print_vlen_type(buffer, type, ind) || + print_array_type(buffer, type, ind) || + print_opaque_type(buffer, type, ind) || + print_bitfield_type(buffer, type, ind)) + return; + + /* Unknown type */ + h5tools_str_append(buffer,"%lu-byte class-%u unknown", + (unsigned long)H5Tget_size(type), (unsigned)data_class); +} + + +/*------------------------------------------------------------------------- + * Function: dump_dataset_values + * + * Purpose: Prints all values of a dataset. + * + * Return: void + * + * Programmer: Robb Matzke + * Tuesday, July 21, 1998 + * + * Modifications: + * Robb Matzke, 1999-09-27 + * Understands the simple_output_g switch which causes data to + * be displayed in a more machine-readable format. + *------------------------------------------------------------------------- + */ +static void +dump_dataset_values(hid_t dset) +{ + char string_prefix[64]; + static char fmt_double[16]; + static char fmt_float[16]; + hsize_t curr_pos = 0; /* total data element position */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t outputformat; + h5tool_format_t *info = &ls_dataformat; + + hid_t f_type = H5Dget_type(dset); + size_t size = H5Tget_size(f_type); + + HDmemset(&ctx, 0, sizeof(ctx)); + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + outputformat = *info; + outputformat.line_1st = NULL; + if (simple_output_g) { + outputformat.idx_fmt = ""; + outputformat.line_per_line = 1; + outputformat.line_multi_new = 0; + outputformat.line_pre = " "; + outputformat.line_cont = " "; + + outputformat.arr_pre = ""; + outputformat.arr_suf = ""; + outputformat.arr_sep = " "; + + if (!label_g) { + outputformat.cmpd_pre = ""; + outputformat.cmpd_suf = ""; + } + outputformat.cmpd_sep = " "; + + if (label_g) outputformat.cmpd_name = "%s="; + + outputformat.elmt_suf1 = " "; + outputformat.str_locale = ESCAPE_HTML; + + } + else { + if (no_line_wrap_g) { + outputformat.line_per_line = 1; + } + else { + outputformat.line_ncols = width_g; + } + if (label_g) outputformat.cmpd_name = "%s="; + outputformat.line_pre = " %s "; + outputformat.line_cont = " %s "; + outputformat.str_repeat = 8; + + outputformat.arr_pre = NULL; + outputformat.arr_suf = NULL; + outputformat.arr_sep = NULL; + + outputformat.cmpd_pre = NULL; + outputformat.cmpd_suf = NULL; + outputformat.cmpd_sep = NULL; + + outputformat.vlen_sep = NULL; + outputformat.vlen_pre = NULL; + outputformat.vlen_suf = NULL; + outputformat.vlen_end = NULL; + } + outputformat.arr_linebreak = 0; + /* Floating point types should display full precision */ + sprintf(fmt_float, "%%1.%dg", FLT_DIG); + outputformat.fmt_float = fmt_float; + sprintf(fmt_double, "%%1.%dg", DBL_DIG); + outputformat.fmt_double = fmt_double; + + if (hexdump_g) { + /* Print all data in hexadecimal format if the `-x' or `--hexdump' + * command line switch was given. */ + outputformat.raw = TRUE; + } + else if (string_g && 1==size && H5T_INTEGER==H5Tget_class(f_type)) { + /* Print 1-byte integer data as an ASCI character string instead of + * integers if the `-s' or `--string' command-line option was given. */ + outputformat.ascii = TRUE; + outputformat.elmt_suf1 = ""; + outputformat.elmt_suf2 = ""; + strcpy(string_prefix, outputformat.line_pre); + strcat(string_prefix, "\""); + outputformat.line_pre = string_prefix; + outputformat.line_suf = "\""; + } + info = &outputformat; + + ctx.indent_level = 2; + ctx.cur_column = curr_pos; + /* Print all the values. */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, " Data:\n"); + h5tools_render_element(stdout, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + ctx.need_prefix = TRUE; + ctx.cur_column = curr_pos; + if (h5tools_dump_dset(stdout, info, &ctx, dset, -1, NULL) < 0) { + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, " Unable to print data."); + h5tools_render_element(stdout, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + } + + H5Tclose(f_type); + + fprintf(stdout, "\n"); + + h5tools_str_close(&buffer); +} + + +/*------------------------------------------------------------------------- + * Function: list_attr + * + * Purpose: Prints information about attributes. + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Robb Matzke + * Friday, June 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, + void UNUSED *op_data) +{ + hid_t attr = -1; + hid_t space = -1; + hid_t type = -1; + hid_t p_type = -1; + hsize_t size[H5S_MAX_RANK]; + hsize_t nelmts = 1; + hsize_t temp_need; + size_t need; + int ndims; + int i; + int n; + void *buf; + H5S_class_t space_type; + hsize_t curr_pos = 0; /* total data element position */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *info = &ls_dataformat; + h5tool_format_t outputformat; + + HDmemset(&ctx, 0, sizeof(ctx)); + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, " Attribute: "); + + n = print_string(&buffer, attr_name, TRUE); + + if((attr = H5Aopen(obj, attr_name, H5P_DEFAULT))) { + space = H5Aget_space(attr); + type = H5Aget_type(attr); + + /* Data space */ + ndims = H5Sget_simple_extent_dims(space, size, NULL); + space_type = H5Sget_simple_extent_type(space); + switch(space_type) { + case H5S_SCALAR: + /* scalar dataspace */ + h5tools_str_append(&buffer, " scalar\n"); + h5tools_render_element(stdout, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + break; case H5S_SIMPLE: /* simple dataspace */ - printf(" {"); + h5tools_str_append(&buffer, " {"); for (i=0; iline_ncols, 0, 0); break; case H5S_NULL: /* null dataspace */ - puts(" null"); + h5tools_str_append(&buffer, " null\n"); + h5tools_render_element(stdout, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); break; default: /* Unknown dataspace type */ - puts(" unknown"); + h5tools_str_append(&buffer, " unknown\n"); + h5tools_render_element(stdout, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); break; } /* end switch */ /* Data type */ - printf(" Type: "); - display_type(type, 15); - putchar('\n'); + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, " Type: "); + print_type(&buffer, type, 15); + h5tools_str_append(&buffer, "\n"); + h5tools_render_element(stdout, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); /* Data */ - memset(&info, 0, sizeof info); - info.line_multi_new = 1; + outputformat = *info; + if(nelmts < 5) { - info.idx_fmt = ""; - info.line_1st = " Data: "; - info.line_pre = " "; - info.line_cont = " "; - info.str_repeat = 8; + outputformat.idx_fmt = ""; + outputformat.line_1st = " Data: "; + outputformat.line_pre = " "; + outputformat.line_cont = " "; + outputformat.str_repeat = 8; - } else { - printf(" Data:\n"); - info.idx_fmt = "(%s)"; - info.line_pre = " %s "; - info.line_cont = " %s "; - info.str_repeat = 8; + } + else { + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, " Data:\n"); + h5tools_render_element(stdout, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + outputformat.line_1st = NULL; + outputformat.line_pre = " %s "; + outputformat.line_cont = " %s "; + outputformat.str_repeat = 8; } - info.line_ncols = width_g; + outputformat.line_ncols = width_g; if(label_g) - info.cmpd_name = "%s="; + outputformat.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_pre = " %s \""; - info.line_suf = "\""; + outputformat.ascii = TRUE; + outputformat.elmt_suf1 = ""; + outputformat.elmt_suf2 = ""; + outputformat.line_pre = " %s \""; + outputformat.line_suf = "\""; } /* end if */ - /* values of reference type formats */ - info.dset_format = "DSET-%s "; - info.dset_hidefileno = 1; - info.dset_blockformat_pre = "%sBlk%lu: "; - info.dset_ptformat_pre = "%sPt%lu: "; - info.obj_format = "-%lu:"H5_PRINTF_HADDR_FMT; - info.obj_hidefileno = 0; + outputformat.arr_pre = NULL; + outputformat.arr_suf = NULL; + outputformat.arr_sep = NULL; + + outputformat.cmpd_pre = NULL; + outputformat.cmpd_suf = NULL; + outputformat.cmpd_sep = NULL; + + outputformat.vlen_sep = NULL; + outputformat.vlen_pre = NULL; + outputformat.vlen_suf = NULL; + outputformat.vlen_end = NULL; + + info = &outputformat; if(hexdump_g) p_type = H5Tcopy(type); @@ -1474,8 +2679,12 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, need = (size_t)temp_need; buf = malloc(need); assert(buf); - if(H5Aread(attr, p_type, buf) >= 0) - h5tools_dump_mem(stdout, &info, attr, p_type, space, buf, -1); + if(H5Aread(attr, p_type, buf) >= 0) { + ctx.need_prefix = TRUE; + ctx.indent_level = 2; + ctx.cur_column = curr_pos; + h5tools_dump_mem(stdout, info, &ctx, attr, p_type, space, buf); + } /* Reclaim any VL memory, if necessary */ if (vl_data) @@ -1484,12 +2693,17 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, free(buf); H5Tclose(p_type); } /* end if */ + fprintf(stdout, "\n"); H5Sclose(space); H5Tclose(type); H5Aclose(attr); - } else - putchar('\n'); + } + else { + fprintf(stdout, "\n"); + } + + h5tools_str_close(&buffer); return 0; } diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 2337985..a75596d 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -14,6 +14,7 @@ SET (H5_TOOLS_LIB_SRCS ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff_dset.c ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff_util.c ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools.c + ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_dump.c ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_filters.c ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_ref.c ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_str.c @@ -25,6 +26,7 @@ SET (H5_TOOLS_LIB_SRCS SET (H5_TOOLS_LIB_HDRS ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5trav.h ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools.h + ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_dump.h ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_utils.h ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_str.h ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_ref.h diff --git a/tools/lib/Makefile.am b/tools/lib/Makefile.am index 43ee863..e364b47 100644 --- a/tools/lib/Makefile.am +++ b/tools/lib/Makefile.am @@ -26,7 +26,7 @@ INCLUDES=-I$(top_srcdir)/src # This is our main target, the h5tools library. noinst_LTLIBRARIES=libh5tools.la -libh5tools_la_SOURCES=h5tools.c h5tools_str.c h5tools_utils.c h5diff.c \ +libh5tools_la_SOURCES=h5tools.c h5tools_dump.c h5tools_str.c h5tools_utils.c h5diff.c \ h5diff_array.c h5diff_attr.c h5diff_dset.c h5diff_util.c h5trav.c \ h5tools_filters.c h5tools_ref.c h5tools_type.c diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index e963aea..fdc2e4d 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -25,6 +25,7 @@ #include #include "h5tools.h" +#include "h5tools_dump.h" #include "h5tools_ref.h" #include "h5tools_utils.h" #include "H5private.h" @@ -38,223 +39,18 @@ hid_t H5tools_ERR_CLS_g = -1; hid_t H5E_tools_g = -1; hid_t H5E_tools_min_id_g = -1; int compound_data; -FILE *rawdatastream; /* should initialize to stdout but gcc moans about it */ -int bin_output; /* binary output */ -int bin_form; /* binary form */ -int region_output; /* region output */ -int packed_bits_num; /* number of packed bits to display */ +FILE *rawdatastream; /* should initialize to stdout but gcc moans about it */ +int bin_output; /* binary output */ +int bin_form; /* binary form */ +int region_output; /* region output */ +int oid_output; /* oid output */ +int data_output; /* data output */ +int attr_data_output; /* attribute data output */ +int packed_bits_num; /* number of packed bits to display */ int packed_data_offset; /* offset of packed bits to display */ +int packed_data_length; /* lengtht of packed bits to display */ unsigned long long packed_data_mask; /* mask in which packed bits to display */ -static h5tool_format_t h5tools_dataformat = { -0, /*raw */ - -"", /*fmt_raw */ -"%d", /*fmt_int */ -"%u", /*fmt_uint */ -#ifdef H5_VMS -"%hd",/*fmt_schar */ -#else -"%hhd",/*fmt_schar */ -#endif -"%u", /*fmt_uchar */ -"%d", /*fmt_short */ -"%u", /*fmt_ushort */ -"%ld", /*fmt_long */ -"%lu", /*fmt_ulong */ -NULL, /*fmt_llong */ -NULL, /*fmt_ullong */ -"%g", /*fmt_double */ -"%g", /*fmt_float */ - -0, /*ascii */ -0, /*str_locale */ -0, /*str_repeat */ - -"[ ", /*arr_pre */ -",", /*arr_sep */ -" ]", /*arr_suf */ -1, /*arr_linebreak */ - -"", /*cmpd_name */ -",\n", /*cmpd_sep */ -"{\n", /*cmpd_pre */ -"}", /*cmpd_suf */ -"\n", /*cmpd_end */ - -", ", /*vlen_sep */ -"(", /*vlen_pre */ -")", /*vlen_suf */ -"", /*vlen_end */ - -"%s", /*elmt_fmt */ -",", /*elmt_suf1 */ -" ", /*elmt_suf2 */ - -"", /*idx_n_fmt */ -"", /*idx_sep */ -"", /*idx_fmt */ - -80, /*line_ncols *//*standard default columns */ -0, /*line_per_line */ -"", /*line_pre */ -"%s", /*line_1st */ -"%s", /*line_cont */ -"", /*line_suf */ -"", /*line_sep */ -1, /*line_multi_new */ -" ", /*line_indent */ - -1, /*skip_first */ - -1, /*obj_hidefileno */ -" "H5_PRINTF_HADDR_FMT, /*obj_format */ - -1, /*dset_hidefileno */ -"DATASET %s ", /*dset_format */ -"%s", /*dset_blockformat_pre */ -"%s", /*dset_ptformat_pre */ -"%s", /*dset_ptformat */ -1, /*array indices */ -1 /*escape non printable characters */ -}; - -static const h5tools_dump_header_t h5tools_standardformat = { -"standardformat", /*name */ -"HDF5", /*fileebgin */ -"", /*fileend */ -SUPER_BLOCK, /*bootblockbegin */ -"", /*bootblockend */ -H5_TOOLS_GROUP, /*groupbegin */ -"", /*groupend */ -H5_TOOLS_DATASET, /*datasetbegin */ -"", /*datasetend */ -ATTRIBUTE, /*attributebegin */ -"", /*attributeend */ -H5_TOOLS_DATATYPE, /*datatypebegin */ -"", /*datatypeend */ -DATASPACE, /*dataspacebegin */ -"", /*dataspaceend */ -DATA, /*databegin */ -"", /*dataend */ -SOFTLINK, /*softlinkbegin */ -"", /*softlinkend */ -EXTLINK, /*extlinkbegin */ -"", /*extlinkend */ -UDLINK, /*udlinkbegin */ -"", /*udlinkend */ -SUBSET, /*subsettingbegin */ -"", /*subsettingend */ -START, /*startbegin */ -"", /*startend */ -STRIDE, /*stridebegin */ -"", /*strideend */ -COUNT, /*countbegin */ -"", /*countend */ -BLOCK, /*blockbegin */ -"", /*blockend */ - -"{", /*fileblockbegin */ -"}", /*fileblockend */ -"{", /*bootblockblockbegin */ -"}", /*bootblockblockend */ -"{", /*groupblockbegin */ -"}", /*groupblockend */ -"{", /*datasetblockbegin */ -"}", /*datasetblockend */ -"{", /*attributeblockbegin */ -"}", /*attributeblockend */ -"", /*datatypeblockbegin */ -"", /*datatypeblockend */ -"", /*dataspaceblockbegin */ -"", /*dataspaceblockend */ -"{", /*datablockbegin */ -"}", /*datablockend */ -"{", /*softlinkblockbegin */ -"}", /*softlinkblockend */ -"{", /*extlinkblockbegin */ -"}", /*extlinkblockend */ -"{", /*udlinkblockbegin */ -"}", /*udlinkblockend */ -"{", /*strblockbegin */ -"}", /*strblockend */ -"{", /*enumblockbegin */ -"}", /*enumblockend */ -"{", /*structblockbegin */ -"}", /*structblockend */ -"{", /*vlenblockbegin */ -"}", /*vlenblockend */ -"{", /*subsettingblockbegin */ -"}", /*subsettingblockend */ -"(", /*startblockbegin */ -");", /*startblockend */ -"(", /*strideblockbegin */ -");", /*strideblockend */ -"(", /*countblockbegin */ -");", /*countblockend */ -"(", /*blockblockbegin */ -");", /*blockblockend */ - -"", /*dataspacedescriptionbegin */ -"", /*dataspacedescriptionend */ -"(", /*dataspacedimbegin */ -")", /*dataspacedimend */ -}; - -static const h5tools_dump_header_t * h5tools_dump_header_format; - -/* local prototypes */ -static int do_bin_output(FILE *stream, hid_t container, hsize_t nelmts, hid_t tid, void *_mem); -static int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem); -static int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, - hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata); -static hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id, - FILE *stream, hid_t container); -static hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id, - FILE *stream, hid_t container); -static hbool_t h5tools_is_zero(const void *_mem, size_t size); - -hbool_t h5tools_render_element(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, - h5tools_str_t *buffer/*string into which to render */, - hsize_t *curr_pos/*total data element position*/, - size_t ncols, hsize_t local_elmt_counter/*element counter*/, - hsize_t elmt_counter); - -hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, - h5tools_str_t *buffer/*string into which to render */, - hsize_t *curr_pos/*total data element position*/, - size_t ncols, hsize_t *ptdata, - hsize_t local_elmt_counter/*element counter*/, - hsize_t elmt_counter); - -static int h5tools_print_region_data_blocks(hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, - h5tools_str_t *buffer/*string into which to render */, size_t ncols, - int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata); - -hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, - h5tools_str_t *buffer/*string into which to render */, - hsize_t *curr_pos/*total data element position*/, - size_t ncols, hsize_t region_elmt_counter/*element counter*/, - hsize_t elmt_counter); - -int h5tools_print_region_data_points(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, - h5tools_str_t *buffer, size_t ncols, - int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata); - -hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, - h5tools_str_t *buffer/*string into which to render */, - hsize_t *curr_pos/*total data element position*/, - size_t ncols, hsize_t region_elmt_counter/*element counter*/, - hsize_t elmt_counter); - /* module-scoped variables */ static int h5tools_init_g; /* if h5tools lib has been initialized */ #ifdef H5_HAVE_PARALLEL @@ -322,7 +118,7 @@ h5tools_init(void) if (!rawdatastream) rawdatastream = stdout; - h5tools_dump_header_format = &h5tools_standardformat; + h5tools_dump_init(); h5tools_init_g++; } @@ -617,7 +413,7 @@ done: *------------------------------------------------------------------------- */ static size_t -h5tools_ncols(const char *s) +h5tools_count_ncols(const char *s) { register size_t i; @@ -743,7 +539,7 @@ done: * level before) *------------------------------------------------------------------------- */ -static void +void h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hsize_t elmtno, int secnum) { @@ -832,7 +628,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, * None *------------------------------------------------------------------------- */ -static void +void h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum) { @@ -912,159 +708,6 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, /*------------------------------------------------------------------------- * Audience: Public * Chapter: H5Tools Library - * Purpose: Prints NELMTS data elements to output STREAM. - * Description: - * Prints some (NELMTS) data elements to output STREAM. The elements are - * stored in _MEM as type TYPE and are printed according to the format - * described in INFO. The CTX struct contains context information shared - * between calls to this function. The FLAGS is a bit field that - * indicates whether the data supplied in this call falls at the - * beginning or end of the total data to be printed (START_OF_DATA and - * END_OF_DATA). - * Return: - * None - * Programmer: - * Robb Matzke, Monday, April 26, 1999 - * Modifications: - * Robb Matzke, 1999-06-04 - * The `container' argument is the optional dataset for reference types. - * - * Robb Matzke, 1999-09-29 - * Understands the `per_line' property which indicates that every Nth - * element should begin a new line. - * - * Robb Matzke, LLNL, 2003-06-05 - * Do not dereference the memory for a variable-length string here. - * Deref in h5tools_str_sprint() instead so recursive types are - * handled correctly. - * - * Pedro Vicente Nunes, The HDF Group, 2005-10-19 - * pass to the prefix in h5tools_simple_prefix the total position - * instead of the current stripmine position i; this is necessary - * to print the array indices - * new field sm_pos in h5tools_context_t, the current stripmine element position - *------------------------------------------------------------------------- - */ -void -h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container, - h5tools_context_t *ctx/*in,out*/, unsigned flags, - hsize_t nelmts, hid_t type, void *_mem) -{ - unsigned char *mem = (unsigned char*) _mem; - hsize_t i; /*element counter */ - size_t size; /*size of each datum */ - hid_t region_space; - hid_t region_id; - hbool_t dimension_break = TRUE; - H5S_sel_type region_type; - size_t ncols = 80; /*available output width */ - h5tools_str_t buffer; /*string into which to render */ - hsize_t curr_pos; /* total data element position */ - hsize_t elmt_counter = 0;/*counts the # elements printed. - *I (ptl?) needed something that - *isn't going to get reset when a new - *line is formed. I'm going to use - *this var to count elements and - *break after we see a number equal - *to the ctx->size_last_dim. */ - - /* binary dump */ - if (bin_output) { - do_bin_output(rawdatastream, container, nelmts, type, _mem); - } /* end if */ - else { - /* setup */ - HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - size = H5Tget_size(type); - - if (info->line_ncols > 0) - ncols = info->line_ncols; - - /* pass to the prefix in h5tools_simple_prefix the total position - * instead of the current stripmine position i; this is necessary - * to print the array indices - */ - curr_pos = ctx->sm_pos; - - for (i = 0; i < nelmts; i++, ctx->cur_elmt++, elmt_counter++) { - void* memref = mem + i * size; - if (region_output && H5Tequal(type, H5T_STD_REF_DSETREG)) { - char ref_name[1024]; - - /* region data */ - region_id = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, memref); - if (region_id >= 0) { - region_space = H5Rget_region(container, H5R_DATASET_REGION, memref); - if (region_space >= 0) { - if (h5tools_is_zero(memref, H5Tget_size(type))) { - h5tools_str_append(&buffer, "NULL"); - } - else { - if(H5Rget_name(region_id, H5R_DATASET_REGION, memref, (char*) ref_name, 1024)<0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_name failed"); - - /* Render the region element begin */ - h5tools_str_reset(&buffer); - - h5tools_str_append(&buffer, info->dset_format, ref_name); - - dimension_break = h5tools_render_element(stdout, info, - ctx, &buffer, &curr_pos, ncols, i, elmt_counter); - - region_type = H5Sget_select_type(region_space); - if(region_type==H5S_SEL_POINTS) - /* Print point information */ - dimension_break = h5tools_dump_region_data_points( - region_space, region_id, stdout, info, ctx, - &buffer, &curr_pos, ncols, i, elmt_counter); - else if(region_type==H5S_SEL_HYPERSLABS) - /* Print block information */ - dimension_break = h5tools_dump_region_data_blocks( - region_space, region_id, stdout, info, ctx, - &buffer, &curr_pos, ncols, i, elmt_counter); - else - HERROR(H5E_tools_g, H5E_tools_min_id_g, "invalid region type"); - /* Render the region element end */ - - } /* end else to if (h5tools_is_zero(... */ - if(H5Sclose(region_space) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - } /* end if (region_space >= 0) */ - else - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_region failed"); - if(H5Dclose(region_id) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed"); - - } /* if (region_id >= 0) */ - else - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference2 failed"); - - ctx->need_prefix = TRUE; - } /* end if (region_output... */ - else { - /* Render the data element begin*/ - h5tools_str_reset(&buffer); - h5tools_str_sprint(&buffer, info, container, type, memref, ctx); - - if (i + 1 < nelmts || (flags & END_OF_DATA) == 0) - h5tools_str_append(&buffer, "%s", OPT(info->elmt_suf1, ",")); - - dimension_break = h5tools_render_element(stream, info, ctx, &buffer, - &curr_pos, ncols, i, elmt_counter); - /* Render the data element end*/ - - } - if(FALSE==dimension_break) - elmt_counter = 0; - } /* end for (i = 0; i < nelmts... */ - - h5tools_str_close(&buffer); - }/* else bin */ -} - -/*------------------------------------------------------------------------- - * Audience: Public - * Chapter: H5Tools Library * Purpose: Render an element to output STREAM. * Description: * Prints the string buffer to the output STREAM. The string is @@ -1105,7 +748,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, * current location... */ if (info->line_multi_new == 1 && - (ctx->cur_column + h5tools_ncols(s) + + (ctx->cur_column + h5tools_count_ncols(s) + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) > ncols) { if (ctx->prev_multiline) { @@ -1115,7 +758,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, */ ctx->need_prefix = TRUE; } - else if ((ctx->prev_prefix_len + h5tools_ncols(s) + + else if ((ctx->prev_prefix_len + h5tools_count_ncols(s) + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) <= ncols) { /* @@ -1150,7 +793,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, if (info->line_multi_new == 1 && ctx->prev_multiline && (ctx->cur_column + - h5tools_ncols(s) + + h5tools_count_ncols(s) + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = TRUE; @@ -1259,7 +902,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, * current location... */ if (info->line_multi_new == 1 && - (ctx->cur_column + h5tools_ncols(s) + + (ctx->cur_column + h5tools_count_ncols(s) + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) > ncols) { if (ctx->prev_multiline) { @@ -1269,7 +912,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, */ ctx->need_prefix = TRUE; } - else if ((ctx->prev_prefix_len + h5tools_ncols(s) + + else if ((ctx->prev_prefix_len + h5tools_count_ncols(s) + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) <= ncols) { /* @@ -1304,7 +947,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, if (info->line_multi_new == 1 && ctx->prev_multiline && (ctx->cur_column + - h5tools_ncols(s) + + h5tools_count_ncols(s) + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = TRUE; @@ -1372,2319 +1015,69 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, } /*------------------------------------------------------------------------- - * Audience: Public - * Chapter: H5Tools Library - * Purpose: Print the data values from a dataset referenced by region blocks. - * - * Description: - * This is a special case subfunction to print the data in a region reference of type blocks. + * Function: init_acc_pos * - * Return: - * The function returns FAIL if there was an error, otherwise SUCEED + * Purpose: initialize accumulator and matrix position * - * Parameters Description: - * h5tools_str_t *buffer is the string into which to render - * size_t ncols - * int ndims is the number of dimensions of the region element - * hssize_t nblocks is the number of blocks in the region + * Return: void *------------------------------------------------------------------------- */ -static int -h5tools_print_region_data_blocks(hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, - h5tools_str_t *buffer/*string into which to render */, size_t ncols, - int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) +void +init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) { - hbool_t dimension_break = TRUE; - hsize_t *dims1 = NULL; - hsize_t *start = NULL; - hsize_t *count = NULL; - size_t numelem; - hsize_t total_size[H5S_MAX_RANK]; - hsize_t elmtno; /* elemnt index */ - unsigned int region_flags; /* buffer extent flags */ - hsize_t curr_pos; - size_t jndx; - int indx; - int type_size; - hid_t mem_space = -1; - void *region_buf = NULL; - hsize_t blkndx; - hid_t sid1 = -1; - int ret_value = SUCCEED; - h5tools_context_t ctx; - - assert(info); - assert(cur_ctx); - assert(buffer); - assert(ptdata); - - memset(&ctx, 0, sizeof(ctx)); - /* Get the dataspace of the dataset */ - if((sid1 = H5Dget_space(region_id)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + int i; - /* Allocate space for the dimension array */ - if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); + assert(ctx->ndims); - /* find the dimensions of each data space from the block coordinates */ - numelem = 1; - for (jndx = 0; jndx < ndims; jndx++) { - dims1[jndx] = ptdata[jndx + ndims] - ptdata[jndx] + 1; - numelem = dims1[jndx] * numelem; + ctx->acc[ctx->ndims - 1] = 1; + for (i = (ctx->ndims - 2); i >= 0; i--) { + ctx->acc[i] = ctx->acc[i + 1] * dims[i + 1]; } - - /* Create dataspace for reading buffer */ - if((mem_space = H5Screate_simple(ndims, dims1, NULL)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); - - if((type_size = H5Tget_size(type_id)) == 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - - if((region_buf = HDmalloc(type_size * numelem)) == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate region buffer"); - - /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */ - /* 1 2 n 1 2 n */ - if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for start"); - - if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for count"); - - curr_pos = 0; - ctx.indent_level = cur_ctx->indent_level; - ctx.cur_column = cur_ctx->cur_column; - ctx.prev_multiline = cur_ctx->prev_multiline; - ctx.ndims = ndims; - for (blkndx = 0; blkndx < nblocks; blkndx++) { - ctx.need_prefix = TRUE; - ctx.cur_elmt = 0; - for (indx = 0; indx < ndims; indx++) { - start[indx] = ptdata[indx + blkndx * ndims * 2]; - count[indx] = dims1[indx]; - } - - if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); - - if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dread failed"); - - ctx.indent_level++; - if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - - /* assume entire data space to be printed */ - for (indx = 0; indx < (size_t) ctx.ndims; indx++) - ctx.p_min_idx[indx] = start[indx]; - init_acc_pos(&ctx, total_size); - - /* print the data */ - region_flags = START_OF_DATA; - if (blkndx == nblocks - 1) - region_flags |= END_OF_DATA; - - for (indx = 0; indx < (size_t)ctx.ndims; indx++) - ctx.p_max_idx[indx] = dims1[indx]; - - curr_pos = 0; - ctx.sm_pos = blkndx*2*ndims; - ctx.size_last_dim = dims1[ndims-1]; - - h5tools_region_simple_prefix(stream, info, &ctx, curr_pos, ptdata, 0); - - elmtno = 0; - for (jndx = 0; jndx < numelem; jndx++, elmtno++, ctx.cur_elmt++) { - /* Render the region data element begin */ - h5tools_str_reset(buffer); - - h5tools_str_append(buffer, "%s", jndx ? OPTIONAL_LINE_BREAK "" : ""); - h5tools_str_sprint(buffer, info, region_id, type_id, - ((char*)region_buf + jndx * type_size), &ctx); - - if (jndx + 1 < numelem || (region_flags & END_OF_DATA) == 0) - h5tools_str_append(buffer, "%s", OPT(info->elmt_suf1, ",")); - - dimension_break = h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos, - ncols, ptdata, jndx, elmtno); - /* Render the region data element end */ - - if(FALSE == dimension_break) - elmtno = 0; - } /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */ - - ctx.indent_level--; - } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */ - - done: - HDfree(start); - HDfree(count); - HDfree(region_buf); - HDfree(dims1); - - if(H5Sclose(mem_space) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - if(H5Sclose(sid1) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - - return ret_value; + for (i = 0; i < ctx->ndims; i++) + ctx->pos[i] = 0; } /*------------------------------------------------------------------------- - * Audience: Public - * Chapter: H5Tools Library - * Purpose: Print some values from a dataset referenced by region blocks. - * - * Description: - * This is a special case subfunction to dump a region reference using blocks. - * - * Return: - * The function returns False if the last dimension has been reached, otherwise True + * Function: do_bin_output * - * In/Out: - * h5tools_context_t *ctx - * hsize_t *curr_pos + * Purpose: Dump memory buffer to a binary file stream * - * Parameters Description: - * h5tools_str_t *buffer is the string into which to render - * hsize_t curr_pos is the total data element position - * size_t ncols - * hsize_t region_elmt_counter is the region element loop counter - * hsize_t elmt_count is the data element loop counter + * Return: Success: SUCCEED + * Failure: FAIL *------------------------------------------------------------------------- */ -hbool_t -h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, - h5tools_str_t *buffer/*string into which to render */, - hsize_t *curr_pos/*total data element position*/, - size_t ncols, hsize_t region_elmt_counter/*element counter*/, - hsize_t elmt_counter) +int +do_bin_output(FILE *stream, hid_t container, hsize_t nelmts, hid_t tid, void *_mem) { - HERR_INIT(hbool_t, TRUE) - hbool_t dimension_break = TRUE; - hssize_t nblocks; - hsize_t alloc_size; - hsize_t *ptdata = NULL; - int ndims; - hid_t dtype; - hid_t type_id; - int i; - - assert(info); - assert(ctx); - assert(buffer); - - if((nblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed"); - - /* Print block information */ - if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); - - /* Render the region { element begin */ - h5tools_str_reset(buffer); - - h5tools_str_append(buffer, "{"); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the region { element end */ - - /* Render the region datatype info and indices element begin */ - h5tools_str_reset(buffer); - - ctx->indent_level++; - ctx->need_prefix = TRUE; - h5tools_str_append(buffer, "REGION_TYPE BLOCK "); - - alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); - assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ - if((ptdata = (hsize_t*) malloc((size_t) alloc_size)) == NULL) - HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); - - H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t); - if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0) - HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Rget_select_hyper_blocklist failed"); - - for (i = 0; i < nblocks; i++) { - int j; - - h5tools_str_append(buffer, info->dset_blockformat_pre, - i ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long) i); - - /* Start coordinates and opposite corner */ - for (j = 0; j < ndims; j++) - h5tools_str_append(buffer, "%s%lu", j ? "," : "(", - (unsigned long) ptdata[i * 2 * ndims + j]); - - for (j = 0; j < ndims; j++) - h5tools_str_append(buffer, "%s%lu", j ? "," : ")-(", - (unsigned long) ptdata[i * 2 * ndims + j + ndims]); - - h5tools_str_append(buffer, ")"); - } /* end for (i = 0; i < nblocks; i++) */ - - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the region datatype info and indices element end */ - - ctx->need_prefix = TRUE; - - if((dtype = H5Dget_type(region_id)) < 0) - HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Dget_type failed"); - if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) - HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Tget_native_type failed"); - - /* Render the datatype element begin */ - h5tools_str_reset(buffer); - h5tools_str_append(buffer, "%s %s ", - h5tools_dump_header_format->datatypebegin, - h5tools_dump_header_format->datatypeblockbegin); - - h5tools_print_datatype(buffer, info, ctx, dtype); - - if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) { - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeblockend); - if (HDstrlen(h5tools_dump_header_format->datatypeend)) - h5tools_str_append(buffer, " "); - } - if (HDstrlen(h5tools_dump_header_format->datatypeend)) - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeend); - - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the datatype element end */ - - ctx->need_prefix = TRUE; - - /* Render the dataspace element begin */ - h5tools_str_reset(buffer); - - ctx->need_prefix = TRUE; - h5tools_str_append(buffer, "%s ", h5tools_dump_header_format->dataspacebegin); + HERR_INIT(int, SUCCEED) + unsigned char *mem = (unsigned char*)_mem; + size_t size; /* datum size */ + hsize_t i; /* element counter */ - h5tools_print_dataspace(buffer, region_space); + if((size = H5Tget_size(tid)) == 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); - if (HDstrlen(h5tools_dump_header_format->dataspaceend)) - h5tools_str_append(buffer, " "); + for (i = 0; i < nelmts; i++) { + if (render_bin_output(stream, container, tid, mem + i * size) < 0) { + printf("\nError in writing binary stream\n"); + return FAIL; + } } - if (HDstrlen(h5tools_dump_header_format->dataspaceend)) - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); - - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the dataspace element end */ - - ctx->need_prefix = TRUE; - - /* Render the databegin element begin */ - h5tools_str_reset(buffer); - - h5tools_str_append(buffer, "%s %s ", - h5tools_dump_header_format->databegin, - h5tools_dump_header_format->datablockbegin); - - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the databegin element end */ - - ctx->need_prefix = TRUE; - h5tools_print_region_data_blocks(region_id, rawdatastream, info, ctx, - buffer, ncols, ndims, type_id, nblocks, ptdata); - - done: - free(ptdata); - - if(H5Tclose(type_id) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - - if(H5Tclose(dtype) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - - ctx->need_prefix = TRUE; - - /* Render the dataend element begin */ - h5tools_str_reset(buffer); - h5tools_str_append(buffer, "%s %s ", - h5tools_dump_header_format->dataend, - h5tools_dump_header_format->datablockend); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, - ncols, region_elmt_counter, elmt_counter); - /* Render the dataend element end */ - - ctx->indent_level--; - ctx->need_prefix = TRUE; - - /* Render the region } element begin */ - h5tools_str_reset(buffer); - h5tools_str_append(buffer, "}"); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, - ncols, region_elmt_counter, elmt_counter); - /* Render the region } element end */ - - H5_LEAVE(dimension_break) - - CATCH +CATCH return ret_value; } /*------------------------------------------------------------------------- - * Audience: Public - * Chapter: H5Tools Library - * Purpose: Print the data values from a dataset referenced by region points. - * - * Description: - * This is a special case subfunction to print the data in a region reference of type points. + * Function: render_bin_output * - * Return: - * The function returns FAIL on error, otherwise SUCCEED - * - * Parameters Description: - * h5tools_str_t *buffer is the string into which to render - * size_t ncols - * int ndims is the number of dimensions of the region element - * hssize_t npoints is the number of points in the region - *------------------------------------------------------------------------- - */ -int -h5tools_print_region_data_points(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, - h5tools_str_t *buffer, size_t ncols, - int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata) -{ - hbool_t dimension_break = TRUE; - hsize_t *dims1 = NULL; - hsize_t elmtno; /* elemnt index */ - unsigned int region_flags; /* buffer extent flags */ - hsize_t curr_pos; - hsize_t total_size[H5S_MAX_RANK]; - int indx; - size_t jndx; - int type_size; - hid_t mem_space = -1; - void *region_buf = NULL; - int ret_value = SUCCEED; - h5tools_context_t ctx; - - assert(info); - assert(cur_ctx); - assert(buffer); - assert(ptdata); - - memset(&ctx, 0, sizeof(ctx)); - /* Allocate space for the dimension array */ - if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); - - dims1[0] = npoints; - - /* Create dataspace for reading buffer */ - if((mem_space = H5Screate_simple(1, dims1, NULL)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); - - if((type_size = H5Tget_size(type_id)) == 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - - if((region_buf = HDmalloc(type_size * npoints)) == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for region"); - - curr_pos = 0; - ctx.indent_level = cur_ctx->indent_level; - ctx.cur_column = cur_ctx->cur_column; - ctx.prev_multiline = cur_ctx->prev_multiline; - ctx.ndims = ndims; - - if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); - - elmtno = 0; - for (jndx = 0; jndx < npoints; jndx++, elmtno++) { - ctx.need_prefix = TRUE; - ctx.cur_elmt = 0; /* points are always 0 */ - - ctx.indent_level++; - if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - - /* assume entire data space to be printed */ - for (indx = 0; indx < (size_t) ctx.ndims; indx++) - ctx.p_min_idx[indx] = 0; - init_acc_pos(&ctx, total_size); - - /* print the data */ - region_flags = START_OF_DATA; - if (jndx == npoints - 1) - region_flags |= END_OF_DATA; - - for (indx = 0; indx < (size_t)ctx.ndims; indx++) - ctx.p_max_idx[indx] = cur_ctx->p_max_idx[indx]; - - ctx.sm_pos = jndx * ndims; - if (ctx.ndims > 0) { - ctx.size_last_dim = (int) (ctx.p_max_idx[ctx.ndims - 1]); - } - else - ctx.size_last_dim = 0; - - curr_pos = 0; /* points requires constant 0 */ - h5tools_region_simple_prefix(stream, info, &ctx, curr_pos, ptdata, 0); - - /* Render the point element begin */ - h5tools_str_reset(buffer); - - h5tools_str_append(buffer, "%s", jndx ? OPTIONAL_LINE_BREAK "" : ""); - h5tools_str_sprint(buffer, info, region_id, type_id, - ((char*)region_buf + jndx * type_size), &ctx); - - if (jndx + 1 < npoints || (region_flags & END_OF_DATA) == 0) - h5tools_str_append(buffer, "%s", OPT(info->elmt_suf1, ",")); - - dimension_break = h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos, - ncols, ptdata, (hsize_t)0, elmtno); - /* Render the point element end */ - if(FALSE == dimension_break) - elmtno = 0; - - ctx.indent_level--; - } /* end for (jndx = 0; jndx < npoints; jndx++, elmtno++) */ - - done: - HDfree(region_buf); - HDfree(dims1); - - if(H5Sclose(mem_space) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - - return ret_value; -} - -/*------------------------------------------------------------------------- - * Audience: Public - * Chapter: H5Tools Library - * Purpose: Print some values from a dataset referenced by region points. - * - * Description: - * This is a special case subfunction to dump a region reference using points. - * - * Return: - * The function returns False if the last dimension has been reached, otherwise True - * - * In/Out: - * h5tools_context_t *ctx - * hsize_t *curr_pos - * - * Parameters Description: - * h5tools_str_t *buffer is the string into which to render - * hsize_t curr_pos is the total data element position - * size_t ncols - * hsize_t region_elmt_counter is the region element loop counter - * hsize_t elmt_count is the data element loop counter - *------------------------------------------------------------------------- - */ -hbool_t -h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, - h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter, - hsize_t elmt_counter) { - HERR_INIT(hbool_t, TRUE) - hbool_t dimension_break = TRUE; - hssize_t npoints; - hsize_t alloc_size; - hsize_t *ptdata; - int ndims; - hssize_t indx; - hid_t dtype; - hid_t type_id; - - assert(info); - assert(ctx); - assert(buffer); - - if((npoints = H5Sget_select_elem_npoints(region_space)) <= 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed"); - - /* Allocate space for the dimension array */ - if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); - - /* Render the region { element begin */ - h5tools_str_reset(buffer); - - h5tools_str_append(buffer, "{"); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the region { element end */ - - /* Render the region datatype info and indices element begin */ - h5tools_str_reset(buffer); - - ctx->indent_level++; - ctx->need_prefix = TRUE; - h5tools_str_append(buffer, "REGION_TYPE POINT "); - - alloc_size = npoints * ndims * sizeof(ptdata[0]); - assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ - if(NULL == (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size))) - HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); - - H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t); - if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, (hsize_t) npoints, ptdata) < 0) - HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_pointlist failed"); - - for (indx = 0; indx < npoints; indx++) { - int loop_indx; - - h5tools_str_append(buffer, info->dset_ptformat_pre, - indx ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long) indx); - - for (loop_indx = 0; loop_indx < ndims; loop_indx++) - h5tools_str_append(buffer, "%s%lu", loop_indx ? "," : "(", - (unsigned long) (ptdata[indx * ndims + loop_indx])); - - h5tools_str_append(buffer, ")"); - } /* end for (indx = 0; indx < npoints; indx++) */ - - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the region datatype info and indices element end */ - - ctx->need_prefix = TRUE; - - if((dtype = H5Dget_type(region_id)) < 0) - HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Dget_type failed"); - - if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) - HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Tget_native_type failed"); - - /* Render the datatype element begin */ - h5tools_str_reset(buffer); - h5tools_str_append(buffer, "%s %s ", - h5tools_dump_header_format->datatypebegin, - h5tools_dump_header_format->datatypeblockbegin); - - h5tools_print_datatype(buffer, info, ctx, dtype); - - if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) { - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeblockend); - if (HDstrlen(h5tools_dump_header_format->datatypeend)) - h5tools_str_append(buffer, " "); - } - if (HDstrlen(h5tools_dump_header_format->datatypeend)) - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeend); - - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the datatype element end */ - - ctx->need_prefix = TRUE; - - /* Render the dataspace element begin */ - h5tools_str_reset(buffer); - - ctx->need_prefix = TRUE; - h5tools_str_append(buffer, "%s ", h5tools_dump_header_format->dataspacebegin); - - h5tools_print_dataspace(buffer, region_space); - - if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); - if (HDstrlen(h5tools_dump_header_format->dataspaceend)) - h5tools_str_append(buffer, " "); - } - if (HDstrlen(h5tools_dump_header_format->dataspaceend)) - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); - - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the dataspace element end */ - - ctx->need_prefix = TRUE; - - /* Render the databegin element begin */ - h5tools_str_reset(buffer); - - h5tools_str_append(buffer, "%s %s ", - h5tools_dump_header_format->databegin, - h5tools_dump_header_format->datablockbegin); - - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the databegin element end */ - - ctx->need_prefix = TRUE; - - h5tools_print_region_data_points(region_space, region_id, - rawdatastream, info, ctx, buffer, ncols, ndims, type_id, npoints, ptdata); - - done: - free(ptdata); - - if(H5Tclose(type_id) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - - if(H5Tclose(dtype) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - - ctx->need_prefix = TRUE; - - /* Render the dataend element begin */ - h5tools_str_reset(buffer); - h5tools_str_append(buffer, "%s %s ", - h5tools_dump_header_format->dataend, - h5tools_dump_header_format->datablockend); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, - ncols, region_elmt_counter, elmt_counter); - /* Render the dataend element end*/ - - ctx->indent_level--; - ctx->need_prefix = TRUE; - - /* Render the region } element begin */ - h5tools_str_reset(buffer); - h5tools_str_append(buffer, "}"); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, - ncols, region_elmt_counter, elmt_counter); - /* Render the region } element end */ - - H5_LEAVE(dimension_break) -CATCH - return ret_value; -} - -/*------------------------------------------------------------------------- - * Audience: Public - * Chapter: H5Tools Library - * Purpose: print out the data for a subset of a dataset. - * Description: - * - * Select a hyperslab from the dataset DSET using the parameters - * specified in SSET. Dump this out to STREAM. - * - * Hyperslabs select "count" blocks of size "block", spaced "stride" elements - * from each other, starting at coordinate "start". - * - * Return: - * On success, return SUCCEED. Otherwise, the function returns FAIL. - * - * Algorithm - * - * The parameters from SSET are translated into temporary - * variables so that 1 row is printed at a time (getting the coordinate indices - * at each row). - * We define the stride, count and block to be 1 in the row dimension to achieve - * this and advance until all points are printed. - * - * The element position is obtained from the matrix according to: - * Given an index I(z,y,x) its position from the beginning of an array - * of sizes A(size_z, size_y,size_x) is given by - * Position of I(z,y,x) = index_z * size_y * size_x - * + index_y * size_x - * + index_x - * - *------------------------------------------------------------------------- - */ -static herr_t -h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, - hid_t dset, hid_t p_type, struct subset_t *sset, - hid_t f_space, hsize_t hyperslab_count, - hsize_t *temp_start,/* start inside offset count loop */ - hsize_t *temp_count,/* count inside offset count loop */ - hsize_t *temp_block,/* block size used in loop */ - hsize_t *temp_stride,/* stride size used in loop */ - hsize_t *total_size,/* total size of dataset */ - unsigned int row_dim/* index of row_counter dimension */) -{ - HERR_INIT(herr_t, SUCCEED) - size_t i; /* counters */ - size_t j; /* counters */ - hsize_t zero[1] = {0}; /* vector of zeros */ - unsigned int flags; /* buffer extent flags */ - hsize_t elmtno; /* elemnt index */ - hsize_t low[H5S_MAX_RANK]; /* low bound of hyperslab */ - hsize_t high[H5S_MAX_RANK]; /* higher bound of hyperslab */ - size_t p_type_nbytes; /* size of memory type */ - hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */ - hsize_t sm_nbytes; /* bytes per stripmine */ - hssize_t ssm_nelmts; /* elements per stripmine*/ - hsize_t sm_nelmts; /* elements per stripmine*/ - unsigned char *sm_buf = NULL; /* buffer for raw data */ - hid_t sm_space = -1; /* stripmine data space */ - hsize_t size_row_block; /* size for blocks along rows */ - hsize_t row_counter = 0; - - /* VL data special information */ - unsigned int vl_data = 0; /* contains VL datatypes */ - - if ((size_t) ctx->ndims > NELMTS(sm_size)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "ndims and sm_size comparision failed"); - - if (ctx->ndims > 0) - init_acc_pos(ctx, total_size); - - size_row_block = sset->block.data[row_dim]; - - /* Check if we have VL data in the dataset's datatype */ - if (h5tools_detect_vlen_str(p_type) == TRUE) - vl_data = TRUE; - if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) - vl_data = TRUE; - - /* display loop */ - for (; hyperslab_count > 0; temp_start[row_dim] += temp_stride[row_dim], hyperslab_count--) { - /* jump rows if size of block exceeded - cases where block > 1 only and stride > block */ - if (size_row_block > 1 - && row_counter == size_row_block - && sset->stride.data[row_dim] > sset->block.data[row_dim]) { - - hsize_t increase_rows = sset->stride.data[row_dim] - sset->block.data[row_dim]; - temp_start[row_dim] += increase_rows; - row_counter = 0; - } - - row_counter++; - - /* calculate the potential number of elements we're going to print */ - if(H5Sselect_hyperslab(f_space, H5S_SELECT_SET, temp_start, temp_stride, temp_count, temp_block) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); - - if((ssm_nelmts = H5Sget_select_npoints(f_space)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed"); - sm_nelmts = (hsize_t)ssm_nelmts; - - if (sm_nelmts > 0) { - /* - * determine the strip mine size and allocate a buffer. the strip mine is - * a hyperslab whose size is manageable. - */ - if((sm_nbytes = p_type_nbytes = H5Tget_size(p_type)) == 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - - if (ctx->ndims > 0) - for (i = ctx->ndims; i > 0; --i) { - hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; - if (size == 0) /* datum size > H5TOOLS_BUFSIZE */ - size = 1; - sm_size[i - 1] = MIN(total_size[i - 1], size); - sm_nbytes *= sm_size[i - 1]; - assert(sm_nbytes > 0); - } - - assert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/ - if(NULL == (sm_buf = (unsigned char *)HDmalloc((size_t) sm_nelmts * p_type_nbytes))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine"); - - if((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); - - if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &sm_nelmts, NULL) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); - - /* read the data */ - if(H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed"); - - /* print the data */ - flags = START_OF_DATA; - - if (hyperslab_count == 1) - flags |= END_OF_DATA; - - for (i = 0; i < ctx->ndims; i++) - ctx->p_max_idx[i] = ctx->p_min_idx[i] + MIN(total_size[i], sm_size[i]); - - /* print array indices. get the lower bound of the hyperslab and calulate - the element position at the start of hyperslab */ - if(H5Sget_select_bounds(f_space, low, high) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed"); - - elmtno = 0; - for (i = 0; i < (size_t) ctx->ndims - 1; i++) { - hsize_t offset = 1; /* accumulation of the previous dimensions */ - for (j = i + 1; j < (size_t) ctx->ndims; j++) - offset *= total_size[j]; - elmtno += low[i] * offset; - } - elmtno += low[ctx->ndims - 1]; - - /* initialize the current stripmine position; this is necessary to print the array - indices */ - ctx->sm_pos = elmtno; - - h5tools_dump_simple_data(stream, info, dset, ctx, flags, sm_nelmts, p_type, sm_buf); - - /* Reclaim any VL memory, if necessary */ - if (vl_data) - H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf); - - if(H5Sclose(sm_space) < 0) - H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - if(sm_buf) - HDfree(sm_buf); - sm_buf = NULL; - } - else - H5E_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print"); - /* we need to jump to next line and update the index */ - ctx->need_prefix = 1; - - ctx->continuation++; - - } /* hyperslab_count loop */ - -CATCH - if(sm_buf) - HDfree(sm_buf); - - return ret_value; -} - -/*------------------------------------------------------------------------- - * Audience: Public - * Chapter: H5Tools Library - * Purpose: print out the data for a subset of a dataset. - * Description: - * - * Select a hyperslab from the dataset DSET using the parameters - * specified in SSET. Dump this out to STREAM. - * - * Hyperslabs select "count" blocks of size "block", spaced "stride" elements - * from each other, starting at coordinate "start". - * - * Return: - * On success, return SUCCEED. Otherwise, the function returns FAIL. - * - * Algorithm - * - * The parameters from SSET are translated into temporary - * variables so that 1 row is printed at a time (getting the coordinate indices - * at each row). - * We define the stride, count and block to be 1 in the row dimension to achieve - * this and advance until all points are printed. - * - * The element position is obtained from the matrix according to: - * Given an index I(z,y,x) its position from the beginning of an array - * of sizes A(size_z, size_y,size_x) is given by - * Position of I(z,y,x) = index_z * size_y * size_x - * + index_y * size_x - * + index_x - * - *------------------------------------------------------------------------- - */ -static herr_t -h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, - hid_t dset, hid_t p_type, struct subset_t *sset, - hid_t f_space, hsize_t *total_size) -{ - size_t i; /* counters */ - hsize_t n; /* counters */ - hsize_t count; /* hyperslab count */ - hsize_t outer_count; /* offset count */ - unsigned int row_dim; /* index of row_counter dimension */ - int current_outer_dim; /* dimension for start */ - hsize_t temp_start[H5S_MAX_RANK];/* temporary start inside offset count loop */ - hsize_t max_start[H5S_MAX_RANK]; /* maximum start inside offset count loop */ - hsize_t temp_count[H5S_MAX_RANK];/* temporary count inside offset count loop */ - hsize_t temp_block[H5S_MAX_RANK];/* temporary block size used in loop */ - hsize_t temp_stride[H5S_MAX_RANK];/* temporary stride size used in loop */ - int reset_dim; - herr_t ret_value = SUCCEED; - - if (ctx->ndims == 1) - row_dim = 0; - else - row_dim = ctx->ndims - 2; - - /* get the offset count */ - outer_count = 1; - if (ctx->ndims > 2) - for (i = 0; i < (size_t) ctx->ndims - 2; i++) { - /* block size is handled by containing h5tools_print_simple_subset call */ - outer_count = outer_count * sset->count.data[i]; - - } - - /* initialize temporary start, count and maximum start */ - for (i = 0; i < (size_t) ctx->ndims; i++) { - temp_start[i] = sset->start.data[i]; - temp_count[i] = sset->count.data[i]; - temp_block[i] = sset->block.data[i]; - temp_stride[i] = sset->stride.data[i]; - max_start[i] = 0; - } - - if (ctx->ndims > 2) { - for (i = 0; i < (size_t) ctx->ndims - 2; i++) { - max_start[i] = temp_start[i] + sset->count.data[i]; - temp_count[i] = 1; - - } - } - - /* offset loop */ - for (n = 0; n < outer_count; n++) { - /* number of read iterations in inner loop, read by rows, to match 2D display */ - if (ctx->ndims > 1) { - - /* count is the number of iterations to display all the rows, - the block size count times */ - count = sset->count.data[row_dim] * sset->block.data[row_dim]; - - /* always 1 row_counter at a time, that is a block of size 1, 1 time */ - temp_count[row_dim] = 1; - temp_block[row_dim] = 1; - - /* advance 1 row_counter at a time */ - if (sset->block.data[row_dim] > 1) - temp_stride[row_dim] = 1; - - } - /* for the 1D case */ - else { - count = 1; - } - - h5tools_print_simple_subset(stream, info, ctx, dset, p_type, sset, - f_space, count, temp_start, temp_count, - temp_block, temp_stride, total_size, row_dim); - - if (ctx->ndims > 2) { - /* dimension for start */ - current_outer_dim = (ctx->ndims - 2) - 1; - - /* set start to original from current_outer_dim up */ - for (i = current_outer_dim + 1; i < ctx->ndims; i++) { - temp_start[i] = sset->start.data[i]; - } - - /* increment start dimension */ - do { - reset_dim = 0; - temp_start[current_outer_dim]++; - if (temp_start[current_outer_dim] >= max_start[current_outer_dim]) { - temp_start[current_outer_dim] = sset->start.data[current_outer_dim]; - - /* consider block */ - if (sset->block.data[current_outer_dim] > 1) - temp_start[current_outer_dim]++; - - current_outer_dim--; - reset_dim = 1; - } - } while (current_outer_dim >= 0 && reset_dim); - - } /* ctx.ndims > 1 */ - - } /* outer_count */ - - return ret_value; -} - -/*------------------------------------------------------------------------- - * Audience: Public - * Chapter: H5Tools Library - * Purpose: Dump out a subset of a dataset. - * Description: - * - * Select a hyperslab from the dataset DSET using the parameters - * specified in SSET. Dump this out to STREAM. - * - * Hyperslabs select "count" blocks of size "block", spaced "stride" elements - * from each other, starting at coordinate "start". - * - * Return: - * On success, return SUCCEED. Otherwise, the function returns FAIL. - * - * Original programmer: - * Bill Wendling, Wednesday, March 07, 2001 - * - * Rewritten with modified algorithm by: - * Pedro Vicente, Wednesday, January 16, 2008, contributions from Quincey Koziol - * - * Algorithm - * - * In a inner loop, the parameters from SSET are translated into temporary - * variables so that 1 row is printed at a time (getting the coordinate indices - * at each row). - * We define the stride, count and block to be 1 in the row dimension to achieve - * this and advance until all points are printed. - * An outer loop for cases where dimensionality is greater than 2D is made. - * In each iteration, the 2D block is displayed in the inner loop. The remaining - * slower dimensions above the first 2 are incremented one at a time in the outer loop - * - * The element position is obtained from the matrix according to: - * Given an index I(z,y,x) its position from the beginning of an array - * of sizes A(size_z, size_y,size_x) is given by - * Position of I(z,y,x) = index_z * size_y * size_x - * + index_y * size_x - * + index_x - * - *------------------------------------------------------------------------- - */ -static herr_t -h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset, - hid_t p_type, struct subset_t *sset, int indentlevel) -{ - HERR_INIT(herr_t, SUCCEED) - int sndims; - hid_t f_space = -1; /* file data space */ - size_t i; /* counters */ - hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/ - h5tools_context_t ctx; /* print context */ - - if((f_space = H5Dget_space(dset)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); - - /* - * 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. - */ - memset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = indentlevel; - ctx.need_prefix = 1; - if((sndims = H5Sget_simple_extent_ndims(f_space)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); - ctx.ndims = (unsigned)sndims; - - /* assume entire data space to be printed */ - if (ctx.ndims > 0) - for (i = 0; i < (size_t) ctx.ndims; i++) - ctx.p_min_idx[i] = 0; - - if(H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - ctx.size_last_dim = total_size[ctx.ndims - 1]; - - h5tools_display_simple_subset(stream, info, &ctx, dset, p_type, sset, f_space, total_size); - - /* Terminate the output */ - if (ctx.cur_column) { - fputs(OPT(info->line_suf, ""), stdout); - putc('\n', stdout); - fputs(OPT(info->line_sep, ""), stdout); - } - -CATCH - if(f_space >= 0 && H5Sclose(f_space) < 0) - H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - - return ret_value; -} - -/*------------------------------------------------------------------------- - * Audience: Public - * Chapter: H5Tools Library - * Purpose: Print some values from a dataset with a simple data space. - * Description: - * This is a special case of h5tools_dump_dset(). This function only - * intended for dumping datasets -- it does strip mining and some other - * things which are unnecessary for smaller objects such as attributes - * (to print small objects like attributes simply read the attribute and - * call h5tools_dump_simple_mem()). - * Return: - * On success, the function returns SUCCEED. Otherwise, the function - * returns FAIL. - *------------------------------------------------------------------------- - */ -static int -h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, - hid_t dset, hid_t p_type, int indentlevel) -{ - hid_t f_space; /* file data space */ - hsize_t elmtno; /* counter */ - size_t i; /* counter */ - int carry; /* counter carry value */ - hsize_t zero[8]; /* vector of zeros */ - unsigned int flags; /* buffer extent flags */ - hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/ - - /* Print info */ - h5tools_context_t ctx; /* print context */ - size_t p_type_nbytes; /* size of memory type */ - hsize_t p_nelmts; /* total selected elmts */ - - /* Stripmine info */ - hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */ - hsize_t sm_nbytes; /* bytes per stripmine */ - hsize_t sm_nelmts; /* elements per stripmine*/ - unsigned char *sm_buf = NULL; /* buffer for raw data */ - hid_t sm_space; /* stripmine data space */ - - /* Hyperslab info */ - hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */ - hsize_t hs_size[H5S_MAX_RANK]; /* size this pass */ - hsize_t hs_nelmts; /* elements in request */ - - /* VL data special information */ - unsigned int vl_data = 0; /* contains VL datatypes */ - - f_space = H5Dget_space(dset); - - if (f_space == FAIL) - return FAIL; - - /* - * 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. - */ - memset(&ctx, 0, sizeof(ctx)); - ctx.ndims = H5Sget_simple_extent_ndims(f_space); - - if ((size_t)ctx.ndims > NELMTS(sm_size)) { - H5Sclose(f_space); - return FAIL; - } - - ctx.indent_level = indentlevel; - ctx.need_prefix = 1; - - /* Assume entire data space to be printed */ - if (ctx.ndims > 0) - for (i = 0; i < (size_t)ctx.ndims; i++) - ctx.p_min_idx[i] = 0; - - H5Sget_simple_extent_dims(f_space, total_size, NULL); - - /* calculate the number of elements we're going to print */ - p_nelmts = 1; - - if (ctx.ndims > 0) { - for (i = 0; i < ctx.ndims; i++) - p_nelmts *= total_size[i]; - ctx.size_last_dim = (total_size[ctx.ndims - 1]); - } /* end if */ - else - ctx.size_last_dim = 0; - - if (p_nelmts == 0) { - /* nothing to print */ - H5Sclose(f_space); - return SUCCEED; - } - - /* Check if we have VL data in the dataset's datatype */ - if (h5tools_detect_vlen_str(p_type) == TRUE) - vl_data = TRUE; - if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) - vl_data = TRUE; - - /* - * Determine the strip mine size and allocate a buffer. The strip mine is - * a hyperslab whose size is manageable. - */ - sm_nbytes = p_type_nbytes = H5Tget_size(p_type); - - if (ctx.ndims > 0) { - for (i = ctx.ndims; i > 0; --i) { - hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; - if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */ - size = 1; - sm_size[i - 1] = MIN(total_size[i - 1], size); - sm_nbytes *= sm_size[i - 1]; - assert(sm_nbytes > 0); - } - } - - if(!sm_nbytes) - goto done; - - assert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/ - sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes); - - sm_nelmts = sm_nbytes / p_type_nbytes; - sm_space = H5Screate_simple(1, &sm_nelmts, NULL); - - if (ctx.ndims > 0) - init_acc_pos(&ctx, total_size); - - /* The stripmine loop */ - memset(hs_offset, 0, sizeof hs_offset); - memset(zero, 0, sizeof zero); - - for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { - /* Calculate the hyperslab size */ - if (ctx.ndims > 0) { - for (i = 0, hs_nelmts = 1; i < ctx.ndims; i++) { - hs_size[i] = MIN(total_size[i] - hs_offset[i], sm_size[i]); - ctx.p_max_idx[i] = ctx.p_min_idx[i] + hs_size[i]; - hs_nelmts *= hs_size[i]; - } - - H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL); - H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL); - } - else { - H5Sselect_all(f_space); - H5Sselect_all(sm_space); - hs_nelmts = 1; - } - - /* Read the data */ - if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) { - H5Sclose(f_space); - H5Sclose(sm_space); - free(sm_buf); - return FAIL; - } - - /* Print the data */ - flags = (elmtno == 0) ? START_OF_DATA : 0; - flags |= ((elmtno + hs_nelmts) >= p_nelmts) ? END_OF_DATA : 0; - - /* initialize the current stripmine position; this is necessary to print the array - indices */ - ctx.sm_pos = elmtno; - - h5tools_dump_simple_data(stream, info, dset, &ctx, flags, hs_nelmts, p_type, sm_buf); - - /* Reclaim any VL memory, if necessary */ - if (vl_data) - H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf); - - /* Calculate the next hyperslab offset */ - for (i = ctx.ndims, carry = 1; i > 0 && carry; --i) { - ctx.p_min_idx[i - 1] = ctx.p_max_idx[i - 1]; - hs_offset[i - 1] += hs_size[i - 1]; - - if (hs_offset[i - 1] == total_size[i - 1]) - hs_offset[i - 1] = 0; - else - carry = 0; - } - - ctx.continuation++; - } - - /* Terminate the output */ - if (ctx.cur_column) { - fputs(OPT(info->line_suf, ""), stream); - putc('\n', stream); - fputs(OPT(info->line_sep, ""), stream); - } - - HDfree(sm_buf); - -done: - H5Sclose(sm_space); - H5Sclose(f_space); - - return SUCCEED; -} - -/*------------------------------------------------------------------------- - * Function: h5tools_dump_simple_mem - * - * Purpose: Print some values from memory with a simple data space. - * This is a special case of h5tools_dump_mem(). - * - * Return: Success: SUCCEED - * Failure: FAIL - * - *------------------------------------------------------------------------- - */ -static int -h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id, - hid_t type, hid_t space, void *mem, int indentlevel) -{ - int i; /*counters */ - hsize_t nelmts; /*total selected elmts */ - h5tools_context_t ctx; /*printing context */ - - /* - * 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. - */ - memset(&ctx, 0, sizeof(ctx)); - ctx.ndims = H5Sget_simple_extent_ndims(space); - - if ((size_t) ctx.ndims > NELMTS(ctx.p_min_idx)) - return FAIL; - - ctx.indent_level = indentlevel; - ctx.need_prefix = 1; - - /* Assume entire data space to be printed */ - for (i = 0; i < ctx.ndims; i++) - ctx.p_min_idx[i] = 0; - - H5Sget_simple_extent_dims(space, ctx.p_max_idx, NULL); - - for (i = 0, nelmts = 1; ctx.ndims != 0 && i < ctx.ndims; i++) - nelmts *= ctx.p_max_idx[i] - ctx.p_min_idx[i]; - - if (nelmts == 0) - return SUCCEED; /*nothing to print*/ - if (ctx.ndims > 0) { - assert(ctx.p_max_idx[ctx.ndims - 1] == (hsize_t) ((int) ctx.p_max_idx[ctx.ndims - 1])); - ctx.size_last_dim = (int) (ctx.p_max_idx[ctx.ndims - 1]); - } /* end if */ - else - ctx.size_last_dim = 0; - - if (ctx.ndims > 0) - init_acc_pos(&ctx, ctx.p_max_idx); - - /* Print it */ - h5tools_dump_simple_data(stream, info, obj_id, &ctx, START_OF_DATA | END_OF_DATA, nelmts, type, mem); - - /* Terminate the output */ - if (ctx.cur_column) { - fputs(OPT(info->line_suf, ""), stream); - putc('\n', stream); - fputs(OPT(info->line_sep, ""), stream); - } - - return SUCCEED; -} - -/*------------------------------------------------------------------------- - * Function: h5tools_dump_dset - * - * Purpose: Print some values from a dataset DSET to the file STREAM - * after converting all types to P_TYPE (which should be a - * native type). If P_TYPE is a negative value then it will be - * computed from the dataset type using only native types. - * - * Note: This function is intended only for datasets since it does - * some things like strip mining which are unnecessary for - * smaller objects such as attributes. The easiest way to print - * small objects is to read the object into memory and call - * h5tools_dump_mem(). - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Modifications: - * Robb Matzke, 1999-06-07 - * If info->raw is set then the memory datatype will be the same - * as the file datatype. - * - * Bill Wendling, 2001-02-27 - * Renamed to ``h5tools_dump_dset'' and added the subsetting - * parameter. - * - *------------------------------------------------------------------------- - */ -int -h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset, - hid_t _p_type, struct subset_t *sset, int indentlevel) -{ - hid_t f_space; - hid_t p_type = _p_type; - hid_t f_type; - H5S_class_t space_type; - int status = FAIL; - h5tool_format_t info_dflt; - /* Use default values */ - if (!stream) - stream = stdout; - - if (!info) { - memset(&info_dflt, 0, sizeof info_dflt); - info = &info_dflt; - } - - if (p_type < 0) { - f_type = H5Dget_type(dset); - - if (info->raw || bin_form == 1) - p_type = H5Tcopy(f_type); - else if (bin_form == 2) - p_type = h5tools_get_little_endian_type(f_type); - else if (bin_form == 3) - p_type = h5tools_get_big_endian_type(f_type); - else - p_type = h5tools_get_native_type(f_type); - - H5Tclose(f_type); - - if (p_type < 0) - goto done; - } - - /* Check the data space */ - f_space = H5Dget_space(dset); - - space_type = H5Sget_simple_extent_type(f_space); - - /* Print the data */ - if (space_type == H5S_SIMPLE || space_type == H5S_SCALAR) { - if(!sset) - status = h5tools_dump_simple_dset(rawdatastream, info, dset, p_type, indentlevel); - else - status = h5tools_dump_simple_subset(rawdatastream, info, dset, p_type, sset, indentlevel); - } - else - /* space is H5S_NULL */ - status = SUCCEED; - - /* Close the dataspace */ - H5Sclose(f_space); - -done: - if (p_type != _p_type) - H5Tclose(p_type); - - return status; -} - -/*------------------------------------------------------------------------- - * Function: h5tools_dump_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: SUCCEED - * Failure: FAIL - * - *------------------------------------------------------------------------- - */ -int -h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id, hid_t type, - hid_t space, void *mem, int indentlevel) -{ - HERR_INIT(int, SUCCEED) - h5tool_format_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) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sis_simple failed") - - H5_LEAVE(h5tools_dump_simple_mem(stream, info, obj_id, type, space, mem, indentlevel)) - -CATCH - return ret_value; -} - -/*------------------------------------------------------------------------- - * Function: print_datatype - * - * Purpose: print the datatype. - * - * Return: void - * - * In/Out: h5tools_str_t *buffer - * h5tools_context_t *ctx - * - *------------------------------------------------------------------------- - */ -int -h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info, - h5tools_context_t *ctx, hid_t type) -{ - HERR_INIT(int, SUCCEED) - char *mname; - hid_t mtype, str_type; - int snmembers; - unsigned nmembers; - int sndims; - unsigned i; - size_t size = 0; - hsize_t dims[H5TOOLS_DUMP_MAX_RANK]; - H5T_str_t str_pad; - H5T_cset_t cset; - H5T_order_t order; - H5T_class_t type_class; - hid_t super; - hid_t tmp_type; - htri_t is_vlstr = FALSE; - const char *order_s = NULL; /* byte order string */ - H5T_sign_t sign; /* sign scheme value */ - const char *sign_s = NULL; /* sign scheme string */ - - if((type_class = H5Tget_class(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed"); - switch (type_class) { - case H5T_INTEGER: - if (H5Tequal(type, H5T_STD_I8BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_I8BE"); - } - else if (H5Tequal(type, H5T_STD_I8LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_I8LE"); - } - else if (H5Tequal(type, H5T_STD_I16BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_I16BE"); - } - else if (H5Tequal(type, H5T_STD_I16LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_I16LE"); - } - else if (H5Tequal(type, H5T_STD_I32BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_I32BE"); - } - else if (H5Tequal(type, H5T_STD_I32LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_I32LE"); - } - else if (H5Tequal(type, H5T_STD_I64BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_I64BE"); - } - else if (H5Tequal(type, H5T_STD_I64LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_I64LE"); - } - else if (H5Tequal(type, H5T_STD_U8BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_U8BE"); - } - else if (H5Tequal(type, H5T_STD_U8LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_U8LE"); - } - else if (H5Tequal(type, H5T_STD_U16BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_U16BE"); - } - else if (H5Tequal(type, H5T_STD_U16LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_U16LE"); - } - else if (H5Tequal(type, H5T_STD_U32BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_U32BE"); - } - else if (H5Tequal(type, H5T_STD_U32LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_U32LE"); - } - else if (H5Tequal(type, H5T_STD_U64BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_U64BE"); - } - else if (H5Tequal(type, H5T_STD_U64LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_U64LE"); - } - else if (H5Tequal(type, H5T_NATIVE_SCHAR) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_SCHAR"); - } - else if (H5Tequal(type, H5T_NATIVE_UCHAR) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_UCHAR"); - } - else if (H5Tequal(type, H5T_NATIVE_SHORT) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_SHORT"); - } - else if (H5Tequal(type, H5T_NATIVE_USHORT) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_USHORT"); - } - else if (H5Tequal(type, H5T_NATIVE_INT) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_INT"); - } - else if (H5Tequal(type, H5T_NATIVE_UINT) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_UINT"); - } - else if (H5Tequal(type, H5T_NATIVE_LONG) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_LONG"); - } - else if (H5Tequal(type, H5T_NATIVE_ULONG) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_ULONG"); - } - else if (H5Tequal(type, H5T_NATIVE_LLONG) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_LLONG"); - } - else if (H5Tequal(type, H5T_NATIVE_ULLONG) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_ULLONG"); - } - else { - - /* byte order */ - if (H5Tget_size(type) > 1) { - order = H5Tget_order(type); - if (H5T_ORDER_LE == order) { - order_s = " little-endian"; - } - else if (H5T_ORDER_BE == order) { - order_s = " big-endian"; - } - else if (H5T_ORDER_VAX == order) { - order_s = " mixed-endian"; - } - else { - order_s = " unknown-byte-order"; - } - } - else { - order_s = ""; - } - - /* sign */ - if ((sign = H5Tget_sign(type)) >= 0) { - if (H5T_SGN_NONE == sign) { - sign_s = " unsigned"; - } - else if (H5T_SGN_2 == sign) { - sign_s = ""; - } - else { - sign_s = " unknown-sign"; - } - } - else { - sign_s = " unknown-sign"; - } - - /* print size, order, and sign */ - h5tools_str_append(buffer, "%lu-bit%s%s integer", - (unsigned long) (8 * H5Tget_size(type)), order_s, sign_s); - } - break; - - case H5T_FLOAT: - if (H5Tequal(type, H5T_IEEE_F32BE) == TRUE) { - h5tools_str_append(buffer, "H5T_IEEE_F32BE"); - } - else if (H5Tequal(type, H5T_IEEE_F32LE) == TRUE) { - h5tools_str_append(buffer, "H5T_IEEE_F32LE"); - } - else if (H5Tequal(type, H5T_IEEE_F64BE) == TRUE) { - h5tools_str_append(buffer, "H5T_IEEE_F64BE"); - } - else if (H5Tequal(type, H5T_IEEE_F64LE) == TRUE) { - h5tools_str_append(buffer, "H5T_IEEE_F64LE"); - } - else if (H5Tequal(type, H5T_VAX_F32) == TRUE) { - h5tools_str_append(buffer, "H5T_VAX_F32"); - } - else if (H5Tequal(type, H5T_VAX_F64) == TRUE) { - h5tools_str_append(buffer, "H5T_VAX_F64"); - } - else if (H5Tequal(type, H5T_NATIVE_FLOAT) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_FLOAT"); - } - else if (H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_DOUBLE"); -#if H5_SIZEOF_LONG_DOUBLE !=0 - } - else if (H5Tequal(type, H5T_NATIVE_LDOUBLE) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_LDOUBLE"); -#endif - } - else { - - /* byte order */ - if (H5Tget_size(type) > 1) { - order = H5Tget_order(type); - if (H5T_ORDER_LE == order) { - order_s = " little-endian"; - } - else if (H5T_ORDER_BE == order) { - order_s = " big-endian"; - } - else if (H5T_ORDER_VAX == order) { - order_s = " mixed-endian"; - } - else { - order_s = " unknown-byte-order"; - } - } - else { - order_s = ""; - } - - /* print size and byte order */ - h5tools_str_append(buffer, "%lu-bit%s floating-point", - (unsigned long) (8 * H5Tget_size(type)), order_s); - - } - break; - - case H5T_TIME: - h5tools_str_append(buffer, "H5T_TIME: not yet implemented"); - break; - - case H5T_STRING: - /* Make a copy of type in memory in case when TYPE is on disk, the size - * will be bigger than in memory. This makes it easier to compare - * types in memory. */ - tmp_type = H5Tcopy(type); - size = H5Tget_size(tmp_type); - str_pad = H5Tget_strpad(tmp_type); - cset = H5Tget_cset(tmp_type); - is_vlstr = H5Tis_variable_str(tmp_type); - - h5tools_str_append(buffer, "H5T_STRING %s\n", h5tools_dump_header_format->strblockbegin); - ctx->indent_level++; - - if (is_vlstr) - h5tools_str_append(buffer, "%s H5T_VARIABLE;\n", STRSIZE); - else - h5tools_str_append(buffer, "%s %d;\n", STRSIZE, (int) size); - - h5tools_str_append(buffer, "%s ", STRPAD); - if (str_pad == H5T_STR_NULLTERM) - h5tools_str_append(buffer, "H5T_STR_NULLTERM;\n"); - else if (str_pad == H5T_STR_NULLPAD) - h5tools_str_append(buffer, "H5T_STR_NULLPAD;\n"); - else if (str_pad == H5T_STR_SPACEPAD) - h5tools_str_append(buffer, "H5T_STR_SPACEPAD;\n"); - else - h5tools_str_append(buffer, "H5T_STR_ERROR;\n"); - - h5tools_str_append(buffer, "%s ", CSET); - - if (cset == H5T_CSET_ASCII) - h5tools_str_append(buffer, "H5T_CSET_ASCII;\n"); - else - h5tools_str_append(buffer, "unknown_cset;\n"); - - str_type = H5Tcopy(H5T_C_S1); - if (is_vlstr) - H5Tset_size(str_type, H5T_VARIABLE); - else - H5Tset_size(str_type, size); - H5Tset_cset(str_type, cset); - H5Tset_strpad(str_type, str_pad); - - h5tools_str_append(buffer, "%s ", CTYPE); - - /* Check C variable-length string first. Are the two types equal? */ - if (H5Tequal(tmp_type, str_type)) { - h5tools_str_append(buffer, "H5T_C_S1;\n"); - goto done; - } - - /* Change the endianness and see if they're equal. */ - order = H5Tget_order(tmp_type); - if (order == H5T_ORDER_LE) - H5Tset_order(str_type, H5T_ORDER_LE); - else if (order == H5T_ORDER_BE) - H5Tset_order(str_type, H5T_ORDER_BE); - - if (H5Tequal(tmp_type, str_type)) { - h5tools_str_append(buffer, "H5T_C_S1;\n"); - goto done; - } - - /* If not equal to C variable-length string, check Fortran type. */ - if(H5Tclose(str_type) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - str_type = H5Tcopy(H5T_FORTRAN_S1); - - H5Tset_cset(str_type, cset); - H5Tset_size(str_type, size); - H5Tset_strpad(str_type, str_pad); - - /* Are the two types equal? */ - if (H5Tequal(tmp_type, str_type)) { - h5tools_str_append(buffer, "H5T_FORTRAN_S1;\n"); - goto done; - } - - /* Change the endianness and see if they're equal. */ - order = H5Tget_order(tmp_type); - if (order == H5T_ORDER_LE) - H5Tset_order(str_type, H5T_ORDER_LE); - else if (order == H5T_ORDER_BE) - H5Tset_order(str_type, H5T_ORDER_BE); - - if (H5Tequal(tmp_type, str_type)) { - h5tools_str_append(buffer, "H5T_FORTRAN_S1;\n"); - goto done; - } - - /* Type doesn't match any of above. */ - h5tools_str_append(buffer, "unknown_one_character_type;\n "); - - done: - if(H5Tclose(str_type) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - if(H5Tclose(tmp_type) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - - ctx->indent_level--; - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->strblockend); - break; - - case H5T_BITFIELD: - if (H5Tequal(type, H5T_STD_B8BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_B8BE"); - } - else if (H5Tequal(type, H5T_STD_B8LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_B8LE"); - } - else if (H5Tequal(type, H5T_STD_B16BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_B16BE"); - } - else if (H5Tequal(type, H5T_STD_B16LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_B16LE"); - } - else if (H5Tequal(type, H5T_STD_B32BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_B32BE"); - } - else if (H5Tequal(type, H5T_STD_B32LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_B32LE"); - } - else if (H5Tequal(type, H5T_STD_B64BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_B64BE"); - } - else if (H5Tequal(type, H5T_STD_B64LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_B64LE"); - } - else { - h5tools_str_append(buffer, "undefined bitfield"); - } - break; - - case H5T_OPAQUE: - h5tools_str_append(buffer, "\n"); - h5tools_str_append(buffer, "H5T_OPAQUE;\n"); - { - char *ttag = H5Tget_tag(type); - h5tools_str_append(buffer, "OPAQUE_TAG \"%s\";\n", ttag); - if (ttag) - HDfree(ttag); - } - break; - - case H5T_COMPOUND: - if((snmembers = H5Tget_nmembers(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); - nmembers = (unsigned)snmembers; - - h5tools_str_append(buffer, "H5T_COMPOUND %s\n", h5tools_dump_header_format->structblockbegin); - - for (i = 0; i < nmembers; i++) { - mname = H5Tget_member_name(type, i); - if((mtype = H5Tget_member_type(type, i))>=0) { - if (H5Tget_class(mtype) == H5T_COMPOUND) - ctx->indent_level++; - - h5tools_print_datatype(buffer, info, ctx, mtype); - - if (H5Tget_class(mtype) == H5T_COMPOUND) - ctx->indent_level--; - - h5tools_str_append(buffer, " \"%s\";\n", mname); - if(H5Tclose(mtype) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - } - else - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_member_type failed"); - free(mname); - } - - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend); - break; - - case H5T_REFERENCE: - h5tools_str_append(buffer, "H5T_REFERENCE"); - if(region_output) { - if (H5Tequal(type, H5T_STD_REF_DSETREG) == TRUE) { - h5tools_str_append(buffer, " { H5T_STD_REF_DSETREG }"); - } - else { - h5tools_str_append(buffer, " { H5T_STD_REF_OBJECT }"); - } - } - break; - - case H5T_ENUM: - if((super = H5Tget_super(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); - - h5tools_str_append(buffer, "H5T_ENUM %s\n", h5tools_dump_header_format->enumblockbegin); - ctx->indent_level++; - - h5tools_print_datatype(buffer, info, ctx, super); - if(H5Tclose(super) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - - h5tools_str_append(buffer, ";\n"); - h5tools_print_enum(buffer, type); - - ctx->indent_level--; - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->enumblockend); - - break; - - case H5T_VLEN: - if((super = H5Tget_super(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); - - h5tools_str_append(buffer, "H5T_VLEN %s ", h5tools_dump_header_format->vlenblockbegin); - - h5tools_print_datatype(buffer, info, ctx, super); - if(H5Tclose(super) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->vlenblockend); - - break; - - case H5T_ARRAY: - h5tools_str_append(buffer, "H5T_ARRAY { "); - - /* Get array information */ - if((sndims = H5Tget_array_ndims(type)) >= 0) { - unsigned ndims = (unsigned)sndims; - - if(H5Tget_array_dims2(type, dims) >= 0) { - /* Print array dimensions */ - for (i = 0; i < ndims; i++) - h5tools_str_append(buffer, "[%d]", (int) dims[i]); - - h5tools_str_append(buffer, " "); - } - else - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_array_dims2 failed"); - } - else - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_array_ndims failed"); - - /* Get array base type */ - if((super = H5Tget_super(type)) >= 0) { - /* Print base type */ - h5tools_print_datatype(buffer, info, ctx, super); - /* Close array base type */ - if(H5Tclose(super) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - } - else - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_super failed"); - - h5tools_str_append(buffer, " }"); - - break; - - default: - h5tools_str_append(buffer, "unknown datatype"); - break; - } - -CATCH - return ret_value; -} - -/*------------------------------------------------------------------------- - * Function: print_dataspace - * - * Purpose: print the dataspace. - * - * Return: void - * - * In/Out: h5tools_str_t *buffer - * h5tools_context_t *ctx - * - *------------------------------------------------------------------------- - */ -int -h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space) -{ - HERR_INIT(int, SUCCEED) - hsize_t size[H5TOOLS_DUMP_MAX_RANK]; - hsize_t maxsize[H5TOOLS_DUMP_MAX_RANK]; - int ndims = -1; - H5S_class_t space_type = -1; - int i; - - if((ndims = H5Sget_simple_extent_dims(space, size, maxsize)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - - if((space_type = H5Sget_simple_extent_type(space)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_type failed"); - - switch(space_type) { - case H5S_SCALAR: - /* scalar dataspace */ - h5tools_str_append(buffer, "%s %s", h5tools_dump_header_format->dataspacedescriptionbegin, S_SCALAR); - break; - - case H5S_SIMPLE: - /* simple dataspace */ - h5tools_str_append(buffer, "%s %s { %s %" H5_PRINTF_LL_WIDTH "u", - h5tools_dump_header_format->dataspacedescriptionbegin, S_SIMPLE, - h5tools_dump_header_format->dataspacedimbegin, size[0]); - - for(i = 1; i < ndims; i++) - h5tools_str_append(buffer, ", %" H5_PRINTF_LL_WIDTH "u", size[i]); - - h5tools_str_append(buffer, " %s / ", h5tools_dump_header_format->dataspacedimend); - - if(maxsize[0] == H5S_UNLIMITED) - h5tools_str_append(buffer, "%s %s", - h5tools_dump_header_format->dataspacedimbegin, "H5S_UNLIMITED"); - else - h5tools_str_append(buffer, "%s %" H5_PRINTF_LL_WIDTH "u", - h5tools_dump_header_format->dataspacedimbegin, maxsize[0]); - - for(i = 1; i < ndims; i++) - if(maxsize[i] == H5S_UNLIMITED) - h5tools_str_append(buffer, ", %s", "H5S_UNLIMITED"); - else - h5tools_str_append(buffer, ", %" H5_PRINTF_LL_WIDTH "u", maxsize[i]); - - h5tools_str_append(buffer, " %s }", h5tools_dump_header_format->dataspacedimend); - break; - - case H5S_NULL: - /* null dataspace */ - h5tools_str_append(buffer, "%s %s", h5tools_dump_header_format->dataspacedescriptionbegin, S_NULL); - break; - - case H5S_NO_CLASS: - default: - h5tools_str_append(buffer, "%s unknown dataspace %s\n", BEGIN, END); - break; - } /* end switch */ - -CATCH - return ret_value; -} - - -/*------------------------------------------------------------------------- - * Function: print_enum - * - * Purpose: prints the enum data - * - * Return: void - * - * In/Out: h5tools_str_t *buffer - * h5tools_context_t *ctx - * - *-----------------------------------------------------------------------*/ -int -h5tools_print_enum(h5tools_str_t *buffer, hid_t type) -{ - HERR_INIT(int, SUCCEED) - char **name = NULL; /*member names */ - unsigned char *value = NULL; /*value array */ - unsigned char *copy = NULL; /*a pointer to value array */ - unsigned nmembs = 0; /*number of members */ - int nchars; /*number of output characters */ - hid_t super = -1; /*enum base integer type */ - hid_t native = -1; /*native integer datatype */ - H5T_sign_t sign_type; /*sign of value type */ - size_t type_size; /*value type size */ - size_t dst_size; /*destination value type size */ - int snmembs; - unsigned i; - - if((snmembs = H5Tget_nmembers(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); - nmembs = (unsigned)snmembs; - assert(nmembs > 0); - - if((super = H5Tget_super(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); - - if((type_size = H5Tget_size(type)) <= 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed"); - - /* - * Determine what datatype to use for the native values. To simplify - * things we entertain three possibilities: - * 1. long long -- the largest native signed integer - * 2. unsigned long long -- the largest native unsigned integer - * 3. raw format - */ - if(type_size <= sizeof(long long)) { - dst_size = sizeof(long long); - - if((sign_type = H5Tget_sign(type))<0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_sign failed"); - if(H5T_SGN_NONE == sign_type) - native = H5T_NATIVE_ULLONG; - else - native = H5T_NATIVE_LLONG; - } /* end if */ - else - dst_size = type_size; - - /* Get the names and raw values of all members */ - if(NULL == (name = (char **)HDcalloc(nmembs, sizeof(char *)))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name"); - if(NULL == (value = (unsigned char *)HDcalloc(nmembs, MAX(type_size, dst_size)))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value"); - - for (i = 0; i < nmembs; i++) { - name[i] = H5Tget_member_name(type, i); - if(H5Tget_member_value(type, i, value + i * type_size) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_member_value failed"); - } - - /* Convert values to native datatype */ - if (native > 0) - if(H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tconvert failed"); - - /* - * Sort members by increasing value - * ***not implemented yet*** - */ - - /* Print members */ - for (i = 0; i < nmembs; i++) { - h5tools_str_append(buffer, "\"%s\"", name[i]); - nchars = strlen(name[i]); - h5tools_str_append(buffer, "%*s ", MAX(0, 16 - nchars), ""); - - if (native < 0) { - size_t j; - - h5tools_str_append(buffer, "0x"); - - for (j = 0; j < dst_size; j++) - h5tools_str_append(buffer, "%02x", value[i * dst_size + j]); - } - else if (H5T_SGN_NONE == H5Tget_sign(native)) { - /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" - *strangely, unless use another pointer "copy".*/ - copy = value + i * dst_size; - h5tools_str_append(buffer, "%" H5_PRINTF_LL_WIDTH "u", *((unsigned long long *) ((void *) copy))); - } - else { - /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" - *strangely, unless use another pointer "copy".*/ - copy = value + i * dst_size; - h5tools_str_append(buffer, "%" H5_PRINTF_LL_WIDTH "d", *((long long *) ((void *) copy))); - } - - h5tools_str_append(buffer, ";\n"); - } - -CATCH - if(name) { - /* Release resources */ - for(i = 0; i < nmembs; i++) - if(name[i]) - free(name[i]); - free(name); - } /* end if */ - - if(value) - free(value); - - if(super >= 0 && H5Tclose(super) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not close datatype's super class"); - - if(0 == nmembs) - h5tools_str_append(buffer, "\n"); - - return ret_value; -} - -/*------------------------------------------------------------------------- - * Function: dump_datatype - * - * Purpose: Dump the datatype. Datatype can be HDF5 predefined - * atomic datatype or committed/transient datatype. - * - * Return: void - * - * In/Out: h5tools_context_t *ctx - *------------------------------------------------------------------------- - */ -void -h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx, hid_t type) -{ - size_t ncols = 80; /* available output width */ - h5tools_str_t buffer; /* string into which to render */ - hsize_t curr_pos; /* total data element position */ - hsize_t elmt_counter = 0;/* counts the # elements printed.*/ - - /* setup */ - HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - - if (info->line_ncols > 0) - ncols = info->line_ncols; - - /* pass to the prefix in h5tools_simple_prefix the total position - * instead of the current stripmine position i; this is necessary - * to print the array indices - */ - curr_pos = ctx->sm_pos; - - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); - /* Render the element */ - h5tools_str_reset(&buffer); - - ctx->indent_level++; - h5tools_str_append(&buffer, "%s %s ", - h5tools_dump_header_format->datatypebegin, - h5tools_dump_header_format->datatypeblockbegin); - - h5tools_print_datatype(&buffer, info, ctx, type); - - if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) { - h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeblockend); - if (HDstrlen(h5tools_dump_header_format->datatypeend)) - h5tools_str_append(&buffer, " "); - } - if (HDstrlen(h5tools_dump_header_format->datatypeend)) - h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeend); - h5tools_str_append(&buffer, "\n"); - - curr_pos = h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, - ncols, elmt_counter, 0); - - ctx->need_prefix = TRUE; - ctx->indent_level--; -} - -/*------------------------------------------------------------------------- - * Function: init_acc_pos - * - * Purpose: initialize accumulator and matrix position - * - * Return: void - *------------------------------------------------------------------------- - */ -void -init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) -{ - int i; - - assert(ctx->ndims); - - ctx->acc[ctx->ndims - 1] = 1; - for (i = (ctx->ndims - 2); i >= 0; i--) { - ctx->acc[i] = ctx->acc[i + 1] * dims[i + 1]; - } - for (i = 0; i < ctx->ndims; i++) - ctx->pos[i] = 0; -} - -/*------------------------------------------------------------------------- - * Function: do_bin_output - * - * Purpose: Dump memory buffer to a binary file stream - * - * Return: Success: SUCCEED - * Failure: FAIL - *------------------------------------------------------------------------- - */ -static -int do_bin_output(FILE *stream, hid_t container, hsize_t nelmts, hid_t tid, void *_mem) -{ - HERR_INIT(int, SUCCEED) - unsigned char *mem = (unsigned char*)_mem; - size_t size; /* datum size */ - hsize_t i; /* element counter */ - - if((size = H5Tget_size(tid)) == 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - - for (i = 0; i < nelmts; i++) { - if (render_bin_output(stream, container, tid, mem + i * size) < 0) { - printf("\nError in writing binary stream\n"); - return FAIL; - } - } - -CATCH - return ret_value; -} - -/*------------------------------------------------------------------------- - * Function: render_bin_output - * - * Purpose: Write one element of memory buffer to a binary file stream + * Purpose: Write one element of memory buffer to a binary file stream * * Return: Success: SUCCEED * Failure: FAIL *------------------------------------------------------------------------- */ -static int +int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem) { HERR_INIT(int, SUCCEED) @@ -4067,7 +1460,7 @@ CATCH * *------------------------------------------------------------------------- */ -static int +int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) { @@ -4167,7 +1560,7 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, * *------------------------------------------------------------------------- */ -static hbool_t +hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id, FILE *stream, hid_t container) { @@ -4294,7 +1687,7 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id, * *------------------------------------------------------------------------- */ -static hbool_t +hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container) { @@ -4353,8 +1746,8 @@ CATCH * Return: TRUE if all bytes are zero; FALSE otherwise *------------------------------------------------------------------------- */ -static -hbool_t h5tools_is_zero(const void *_mem, size_t size) +hbool_t +h5tools_is_zero(const void *_mem, size_t size) { const unsigned char *mem = (const unsigned char *) _mem; @@ -4385,7 +1778,8 @@ hbool_t h5tools_is_zero(const void *_mem, size_t size) * *------------------------------------------------------------------------- */ -hbool_t h5tools_is_obj_same(hid_t loc_id1, const char *name1, +hbool_t +h5tools_is_obj_same(hid_t loc_id1, const char *name1, hid_t loc_id2, const char *name2) { H5O_info_t oinfo1, oinfo2; diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 3470b20..30d5796 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -84,6 +84,9 @@ #define EXTERNAL_FILE "EXTERNAL_FILE" #define FILLVALUE "FILLVALUE" #define FILE_CONTENTS "FILE_CONTENTS" +#define PACKED_BITS "PACKED_BITS" +#define PACKED_OFFSET "OFFSET" +#define PACKED_LENGTH "LENGTH" #define BEGIN "{" #define END "}" @@ -509,17 +512,25 @@ struct subset_t { #include "h5tools_str.h" +extern h5tool_format_t h5tools_dataformat; +extern const h5tools_dump_header_t h5tools_standardformat; +extern const h5tools_dump_header_t* h5tools_dump_header_format; + #ifdef __cplusplus extern "C" { #endif -H5TOOLS_DLLVAR int packed_bits_num; /* number of packed bits to display */ -H5TOOLS_DLLVAR int packed_data_offset; /* offset of packed bits to display */ +H5TOOLS_DLLVAR int packed_bits_num; /* number of packed bits to display */ +H5TOOLS_DLLVAR int packed_data_offset; /* offset of packed bits to display */ +H5TOOLS_DLLVAR int packed_data_length; /* lengtht of packed bits to display */ H5TOOLS_DLLVAR unsigned long long packed_data_mask; /* mask in which packed bits to display */ H5TOOLS_DLLVAR FILE *rawdatastream; /* output stream for raw data */ H5TOOLS_DLLVAR int bin_output; /* binary output */ H5TOOLS_DLLVAR int bin_form; /* binary form */ H5TOOLS_DLLVAR int region_output; /* region output */ +H5TOOLS_DLLVAR int oid_output; /* oid output */ +H5TOOLS_DLLVAR int data_output; /* data output */ +H5TOOLS_DLLVAR int attr_data_output; /* attribute data output */ /* Strings for output */ #define H5_TOOLS_GROUP "GROUP" @@ -527,41 +538,45 @@ H5TOOLS_DLLVAR int region_output; /* region output */ #define H5_TOOLS_DATATYPE "DATATYPE" /* Definitions of useful routines */ -H5TOOLS_DLL void h5tools_init(void); -H5TOOLS_DLL void h5tools_close(void); -H5TOOLS_DLL hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl, - const char *driver, char *drivername, size_t drivername_len); -H5TOOLS_DLL int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset, - hid_t p_typ, struct subset_t *sset, int indentlevel); -H5TOOLS_DLL int h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id, - hid_t type, hid_t space, void *mem, int indentlevel); -H5TOOLS_DLL hid_t h5tools_get_native_type(hid_t type); -H5TOOLS_DLL hid_t h5tools_get_little_endian_type(hid_t type); -H5TOOLS_DLL hid_t h5tools_get_big_endian_type(hid_t type); - -H5TOOLS_DLL htri_t h5tools_detect_vlen(hid_t tid); -H5TOOLS_DLL htri_t h5tools_detect_vlen_str(hid_t tid); -H5TOOLS_DLL hbool_t h5tools_is_obj_same(hid_t loc_id1, const char *name1, hid_t loc_id2, const char *name2); - -H5TOOLS_DLL void h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container, - h5tools_context_t *ctx/*in,out*/, unsigned flags, - hsize_t nelmts, hid_t type, void *_mem); - -H5TOOLS_DLL int h5tools_canreadf(const char* name, - hid_t dcpl_id); -H5TOOLS_DLL int h5tools_can_encode(H5Z_filter_t filtn); - -void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims); -/* - * new functions needed to display region reference data - */ -void h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, hid_t type); -int h5tools_print_dataspace(h5tools_str_t *buffer/*in,out*/, hid_t space); -int h5tools_print_datatype(h5tools_str_t *buffer/*in,out*/, - const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, - hid_t type); -int h5tools_print_enum(h5tools_str_t *buffer/*in,out*/, hid_t type); +H5TOOLS_DLL void h5tools_init(void); +H5TOOLS_DLL void h5tools_close(void); +H5TOOLS_DLL hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl, + const char *driver, char *drivername, size_t drivername_len); +H5TOOLS_DLL hid_t h5tools_get_native_type(hid_t type); +H5TOOLS_DLL hid_t h5tools_get_little_endian_type(hid_t type); +H5TOOLS_DLL hid_t h5tools_get_big_endian_type(hid_t type); +H5TOOLS_DLL htri_t h5tools_detect_vlen(hid_t tid); +H5TOOLS_DLL htri_t h5tools_detect_vlen_str(hid_t tid); +H5TOOLS_DLL hbool_t h5tools_is_obj_same(hid_t loc_id1, const char *name1, hid_t loc_id2, const char *name2); +H5TOOLS_DLL void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims); +H5TOOLS_DLL hbool_t h5tools_is_zero(const void *_mem, size_t size); +H5TOOLS_DLL int h5tools_canreadf(const char* name, hid_t dcpl_id); +H5TOOLS_DLL int h5tools_can_encode(H5Z_filter_t filtn); + +H5TOOLS_DLL void h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hsize_t elmtno, int secnum); +H5TOOLS_DLL void h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum); + +H5TOOLS_DLL int do_bin_output(FILE *stream, hid_t container, hsize_t nelmts, hid_t tid, void *_mem); +H5TOOLS_DLL int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem); +H5TOOLS_DLL int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, + hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata); +H5TOOLS_DLL hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id, + FILE *stream, hid_t container); +H5TOOLS_DLL hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id, + FILE *stream, hid_t container); + +H5TOOLS_DLL hbool_t h5tools_render_element(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos, + size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter); +H5TOOLS_DLL hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, + h5tools_str_t *buffer/*string into which to render */, + hsize_t *curr_pos/*total data element position*/, + size_t ncols, hsize_t *ptdata, + hsize_t local_elmt_counter/*element counter*/, + hsize_t elmt_counter); #ifdef __cplusplus } diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c new file mode 100644 index 0000000..2e194be --- /dev/null +++ b/tools/lib/h5tools_dump.c @@ -0,0 +1,3920 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Robb Matzke + * Thursday, July 23, 1998 + * + * Purpose: A library for displaying the values of a dataset in a human + * readable format. + */ + +#include +#include + +#include "h5tools.h" +#include "h5tools_dump.h" +#include "h5tools_ref.h" +#include "h5tools_utils.h" +#include "H5private.h" + +#define SANITY_CHECK + +#define ALIGN(A,Z) ((((A) + (Z) - 1) / (Z)) * (Z)) + +h5tool_format_t h5tools_dataformat = { +0, /*raw */ + +"", /*fmt_raw */ +"%d", /*fmt_int */ +"%u", /*fmt_uint */ +"%hhd", /*fmt_schar */ +"%u", /*fmt_uchar */ +"%d", /*fmt_short */ +"%u", /*fmt_ushort */ +"%ld", /*fmt_long */ +"%lu", /*fmt_ulong */ +NULL, /*fmt_llong */ +NULL, /*fmt_ullong */ +"%g", /*fmt_double */ +"%g", /*fmt_float */ + +0, /*ascii */ +0, /*str_locale */ +0, /*str_repeat */ + +"[ ", /*arr_pre */ +",", /*arr_sep */ +" ]", /*arr_suf */ +1, /*arr_linebreak */ + +"", /*cmpd_name */ +",\n", /*cmpd_sep */ +"{", /*cmpd_pre */ +"}", /*cmpd_suf */ +"\n", /*cmpd_end */ + +", ", /*vlen_sep */ +"(", /*vlen_pre */ +")", /*vlen_suf */ +"", /*vlen_end */ + +"%s", /*elmt_fmt */ +",", /*elmt_suf1 */ +" ", /*elmt_suf2 */ + +"", /*idx_n_fmt */ +"", /*idx_sep */ +"", /*idx_fmt */ + +80, /*line_ncols *//*standard default columns */ +0, /*line_per_line */ +"", /*line_pre */ +"%s", /*line_1st */ +"%s", /*line_cont */ +"", /*line_suf */ +"", /*line_sep */ +1, /*line_multi_new */ +" ", /*line_indent */ + +1, /*skip_first */ + +1, /*obj_hidefileno */ +" "H5_PRINTF_HADDR_FMT, /*obj_format */ + +1, /*dset_hidefileno */ +"DATASET %s ", /*dset_format */ +"%s", /*dset_blockformat_pre */ +"%s", /*dset_ptformat_pre */ +"%s", /*dset_ptformat */ +1, /*array indices */ +1 /*escape non printable characters */ +}; + +const h5tools_dump_header_t h5tools_standardformat = { +"standardformat", /*name */ +"HDF5", /*fileebgin */ +"", /*fileend */ +SUPER_BLOCK, /*bootblockbegin */ +"", /*bootblockend */ +H5_TOOLS_GROUP, /*groupbegin */ +"", /*groupend */ +H5_TOOLS_DATASET, /*datasetbegin */ +"", /*datasetend */ +ATTRIBUTE, /*attributebegin */ +"", /*attributeend */ +H5_TOOLS_DATATYPE, /*datatypebegin */ +"", /*datatypeend */ +DATASPACE, /*dataspacebegin */ +"", /*dataspaceend */ +DATA, /*databegin */ +"", /*dataend */ +SOFTLINK, /*softlinkbegin */ +"", /*softlinkend */ +EXTLINK, /*extlinkbegin */ +"", /*extlinkend */ +UDLINK, /*udlinkbegin */ +"", /*udlinkend */ +SUBSET, /*subsettingbegin */ +"", /*subsettingend */ +START, /*startbegin */ +"", /*startend */ +STRIDE, /*stridebegin */ +"", /*strideend */ +COUNT, /*countbegin */ +"", /*countend */ +BLOCK, /*blockbegin */ +"", /*blockend */ + +"{", /*fileblockbegin */ +"}", /*fileblockend */ +"{", /*bootblockblockbegin */ +"}", /*bootblockblockend */ +"{", /*groupblockbegin */ +"}", /*groupblockend */ +"{", /*datasetblockbegin */ +"}", /*datasetblockend */ +"{", /*attributeblockbegin */ +"}", /*attributeblockend */ +"", /*datatypeblockbegin */ +"", /*datatypeblockend */ +"", /*dataspaceblockbegin */ +"", /*dataspaceblockend */ +"{", /*datablockbegin */ +"}", /*datablockend */ +"{", /*softlinkblockbegin */ +"}", /*softlinkblockend */ +"{", /*extlinkblockbegin */ +"}", /*extlinkblockend */ +"{", /*udlinkblockbegin */ +"}", /*udlinkblockend */ +"{", /*strblockbegin */ +"}", /*strblockend */ +"{", /*enumblockbegin */ +"}", /*enumblockend */ +"{", /*structblockbegin */ +"}", /*structblockend */ +"{", /*vlenblockbegin */ +"}", /*vlenblockend */ +"{", /*subsettingblockbegin */ +"}", /*subsettingblockend */ +"(", /*startblockbegin */ +");", /*startblockend */ +"(", /*strideblockbegin */ +");", /*strideblockend */ +"(", /*countblockbegin */ +");", /*countblockend */ +"(", /*blockblockbegin */ +");", /*blockblockend */ + +"", /*dataspacedescriptionbegin */ +"", /*dataspacedescriptionend */ +"(", /*dataspacedimbegin */ +")", /*dataspacedimend */ +}; + +const h5tools_dump_header_t* h5tools_dump_header_format; +table_t *h5dump_type_table = NULL; /*type table reference for datatype dump */ + +/* local prototypes */ + +hbool_t h5tools_render_element(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, + h5tools_str_t *buffer/*string into which to render */, + hsize_t *curr_pos/*total data element position*/, + size_t ncols, hsize_t local_elmt_counter/*element counter*/, + hsize_t elmt_counter); + +hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, + h5tools_str_t *buffer/*string into which to render */, + hsize_t *curr_pos/*total data element position*/, + size_t ncols, hsize_t *ptdata, + hsize_t local_elmt_counter/*element counter*/, + hsize_t elmt_counter); + +static int h5tools_print_region_data_blocks(hid_t region_id, + FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, + h5tools_str_t *buffer/*string into which to render */, size_t ncols, + int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata); + +hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, + FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, + h5tools_str_t *buffer/*string into which to render */, + hsize_t *curr_pos/*total data element position*/, + size_t ncols, hsize_t region_elmt_counter/*element counter*/, + hsize_t elmt_counter); + +int h5tools_print_region_data_points(hid_t region_space, hid_t region_id, + FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, + h5tools_str_t *buffer, size_t ncols, + int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata); + +hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, + FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, + h5tools_str_t *buffer/*string into which to render */, + hsize_t *curr_pos/*total data element position*/, + size_t ncols, hsize_t region_elmt_counter/*element counter*/, + hsize_t elmt_counter); +void +h5tools_dump_init(void) +{ + h5tools_dump_header_format = &h5tools_standardformat; +} + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: Prints NELMTS data elements to output STREAM. + * Description: + * Prints some (NELMTS) data elements to output STREAM. The elements are + * stored in _MEM as type TYPE and are printed according to the format + * described in INFO. The CTX struct contains context information shared + * between calls to this function. The FLAGS is a bit field that + * indicates whether the data supplied in this call falls at the + * beginning or end of the total data to be printed (START_OF_DATA and + * END_OF_DATA). + * Return: + * None + * Programmer: + * Robb Matzke, Monday, April 26, 1999 + * Modifications: + * Robb Matzke, 1999-06-04 + * The `container' argument is the optional dataset for reference types. + * + * Robb Matzke, 1999-09-29 + * Understands the `per_line' property which indicates that every Nth + * element should begin a new line. + * + * Robb Matzke, LLNL, 2003-06-05 + * Do not dereference the memory for a variable-length string here. + * Deref in h5tools_str_sprint() instead so recursive types are + * handled correctly. + * + * Pedro Vicente Nunes, The HDF Group, 2005-10-19 + * pass to the prefix in h5tools_simple_prefix the total position + * instead of the current stripmine position i; this is necessary + * to print the array indices + * new field sm_pos in h5tools_context_t, the current stripmine element position + *------------------------------------------------------------------------- + */ +void +h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container, + h5tools_context_t *ctx/*in,out*/, unsigned flags, + hsize_t nelmts, hid_t type, void *_mem) +{ + unsigned char *mem = (unsigned char*) _mem; + hsize_t i; /*element counter */ + size_t size; /*size of each datum */ + hid_t region_space = -1; + hid_t region_id = -1; + hbool_t dimension_break = TRUE; + H5S_sel_type region_type; + size_t ncols = 80; /*available output width */ + h5tools_str_t buffer; /*string into which to render */ + hsize_t curr_pos = 0; /* total data element position */ + hsize_t elmt_counter = 0;/*counts the # elements printed. + *I (ptl?) needed something that + *isn't going to get reset when a new + *line is formed. I'm going to use + *this var to count elements and + *break after we see a number equal + *to the ctx->size_last_dim. */ + + /* binary dump */ + if (bin_output) { + do_bin_output(rawdatastream, container, nelmts, type, _mem); + } /* end if */ + else { + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + size = H5Tget_size(type); + + if (info->line_ncols > 0) + ncols = info->line_ncols; + + /* pass to the prefix in h5tools_simple_prefix the total position + * instead of the current stripmine position i; this is necessary + * to print the array indices + */ + curr_pos = ctx->sm_pos; + + if (region_output && H5Tequal(type, H5T_STD_REF_DSETREG)) { + for (i = 0; i < nelmts; i++, ctx->cur_elmt++, elmt_counter++) { + void* memref = mem + i * size; + char ref_name[1024]; + + /* region data */ + region_id = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, memref); + if (region_id >= 0) { + region_space = H5Rget_region(container, H5R_DATASET_REGION, memref); + if (region_space >= 0) { + if (h5tools_is_zero(memref, H5Tget_size(type))) { + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + /* Render the region element begin */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "NULL"); + + dimension_break = h5tools_render_element(stream, info, + ctx, &buffer, &curr_pos, ncols, i, elmt_counter); + } + else { + if(H5Rget_name(region_id, H5R_DATASET_REGION, memref, (char*) ref_name, 1024)<0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_name failed"); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos+i, 0); + + /* Render the region element begin */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, info->dset_format, ref_name); + + dimension_break = h5tools_render_element(stream, info, + ctx, &buffer, &curr_pos, ncols, i, elmt_counter); + + region_type = H5Sget_select_type(region_space); + if(region_type == H5S_SEL_POINTS) + /* Print point information */ + dimension_break = h5tools_dump_region_data_points( + region_space, region_id, stream, info, ctx, + &buffer, &curr_pos, ncols, i, elmt_counter); + else if(region_type == H5S_SEL_HYPERSLABS) + /* Print block information */ + dimension_break = h5tools_dump_region_data_blocks( + region_space, region_id, stream, info, ctx, + &buffer, &curr_pos, ncols, i, elmt_counter); + else + HERROR(H5E_tools_g, H5E_tools_min_id_g, "invalid region type"); + /* Render the region element end */ + + } /* end else to if (h5tools_is_zero(... */ + if(H5Sclose(region_space) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + } /* end if (region_space >= 0) */ + else + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_region failed"); + if(H5Dclose(region_id) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed"); + + } /* if (region_id >= 0) */ + else + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference failed"); + + ctx->need_prefix = TRUE; + + if(FALSE == dimension_break) + elmt_counter = 0; + } /* end for (i = 0; i < nelmts... */ + } /* end if (region_output... */ + else { + for (i = 0; i < nelmts; i++, ctx->cur_elmt++, elmt_counter++) { + void* memref = mem + i * size; + /* Render the data element begin*/ + h5tools_str_reset(&buffer); + h5tools_str_sprint(&buffer, info, container, type, memref, ctx); + + if (i + 1 < nelmts || (flags & END_OF_DATA) == 0) + h5tools_str_append(&buffer, "%s", OPT(info->elmt_suf1, ",")); + + dimension_break = h5tools_render_element(stream, info, ctx, &buffer, + &curr_pos, ncols, i, elmt_counter); + /* Render the data element end*/ + if(FALSE == dimension_break) + elmt_counter = 0; + } /* end for (i = 0; i < nelmts... */ + } + + h5tools_str_close(&buffer); + }/* else bin */ +} + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: Print the data values from a dataset referenced by region blocks. + * + * Description: + * This is a special case subfunction to print the data in a region reference of type blocks. + * + * Return: + * The function returns FAIL if there was an error, otherwise SUCEED + * + * Parameters Description: + * h5tools_str_t *buffer is the string into which to render + * size_t ncols + * int ndims is the number of dimensions of the region element + * hssize_t nblocks is the number of blocks in the region + *------------------------------------------------------------------------- + */ +static int +h5tools_print_region_data_blocks(hid_t region_id, + FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, + h5tools_str_t *buffer/*string into which to render */, size_t ncols, + int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) +{ + hbool_t dimension_break = TRUE; + hsize_t *dims1 = NULL; + hsize_t *start = NULL; + hsize_t *count = NULL; + hsize_t blkndx; + hsize_t total_size[H5S_MAX_RANK]; + hsize_t elmtno; /* elemnt index */ + hsize_t curr_pos = 0; + unsigned int region_flags; /* buffer extent flags */ + size_t numelem; + size_t jndx; + int indx; + int type_size; + int ret_value = SUCCEED; + hid_t mem_space = -1; + hid_t sid1 = -1; + h5tools_context_t ctx; + void *region_buf = NULL; + + assert(info); + assert(cur_ctx); + assert(buffer); + assert(ptdata); + + memset(&ctx, 0, sizeof(ctx)); + /* Get the dataspace of the dataset */ + if((sid1 = H5Dget_space(region_id)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + + /* Allocate space for the dimension array */ + if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); + + /* find the dimensions of each data space from the block coordinates */ + numelem = 1; + for (jndx = 0; jndx < ndims; jndx++) { + dims1[jndx] = ptdata[jndx + ndims] - ptdata[jndx] + 1; + numelem = dims1[jndx] * numelem; + } + + /* Create dataspace for reading buffer */ + if((mem_space = H5Screate_simple(ndims, dims1, NULL)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); + + if((type_size = H5Tget_size(type_id)) == 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + + if((region_buf = HDmalloc(type_size * numelem)) == NULL) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate region buffer"); + + /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */ + /* 1 2 n 1 2 n */ + if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for start"); + + if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for count"); + + curr_pos = 0; + ctx.indent_level = cur_ctx->indent_level; + ctx.cur_column = cur_ctx->cur_column; + ctx.prev_multiline = cur_ctx->prev_multiline; + ctx.ndims = ndims; + for (blkndx = 0; blkndx < nblocks; blkndx++) { + ctx.need_prefix = TRUE; + ctx.cur_elmt = 0; + for (indx = 0; indx < ndims; indx++) { + start[indx] = ptdata[indx + blkndx * ndims * 2]; + count[indx] = dims1[indx]; + } + + if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + + if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dread failed"); + + ctx.indent_level++; + if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + + /* assume entire data space to be printed */ + for (indx = 0; indx < (size_t) ctx.ndims; indx++) + ctx.p_min_idx[indx] = start[indx]; + init_acc_pos(&ctx, total_size); + + /* print the data */ + region_flags = START_OF_DATA; + if (blkndx == nblocks - 1) + region_flags |= END_OF_DATA; + + for (indx = 0; indx < (size_t)ctx.ndims; indx++) + ctx.p_max_idx[indx] = dims1[indx]; + + curr_pos = 0; + ctx.sm_pos = blkndx*2*ndims; + ctx.size_last_dim = dims1[ndims-1]; + + h5tools_region_simple_prefix(stream, info, &ctx, curr_pos, ptdata, 0); + + elmtno = 0; + for (jndx = 0; jndx < numelem; jndx++, elmtno++, ctx.cur_elmt++) { + /* Render the region data element begin */ + h5tools_str_reset(buffer); + + h5tools_str_append(buffer, "%s", jndx ? OPTIONAL_LINE_BREAK "" : ""); + h5tools_str_sprint(buffer, info, region_id, type_id, + ((char*)region_buf + jndx * type_size), &ctx); + + if (jndx + 1 < numelem || (region_flags & END_OF_DATA) == 0) + h5tools_str_append(buffer, "%s", OPT(info->elmt_suf1, ",")); + + dimension_break = h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos, + ncols, ptdata, jndx, elmtno); + /* Render the region data element end */ + + if(FALSE == dimension_break) + elmtno = 0; + } /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */ + + ctx.indent_level--; + } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */ + + done: + HDfree(start); + HDfree(count); + HDfree(region_buf); + HDfree(dims1); + + if(H5Sclose(mem_space) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + if(H5Sclose(sid1) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + + return ret_value; +} + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: Print some values from a dataset referenced by region blocks. + * + * Description: + * This is a special case subfunction to dump a region reference using blocks. + * + * Return: + * The function returns False if the last dimension has been reached, otherwise True + * + * In/Out: + * h5tools_context_t *ctx + * hsize_t *curr_pos + * + * Parameters Description: + * h5tools_str_t *buffer is the string into which to render + * hsize_t curr_pos is the total data element position + * size_t ncols + * hsize_t region_elmt_counter is the region element loop counter + * hsize_t elmt_count is the data element loop counter + *------------------------------------------------------------------------- + */ +hbool_t +h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, + FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, + h5tools_str_t *buffer/*string into which to render */, + hsize_t *curr_pos/*total data element position*/, + size_t ncols, hsize_t region_elmt_counter/*element counter*/, + hsize_t elmt_counter) +{ + HERR_INIT(hbool_t, TRUE) + hbool_t dimension_break = TRUE; + hssize_t nblocks; + hsize_t alloc_size; + hsize_t *ptdata = NULL; + int ndims; + hid_t dtype = -1; + hid_t type_id = -1; + int i; + + assert(info); + assert(ctx); + assert(buffer); + + if((nblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0) + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed"); + + /* Print block information */ + if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + + /* Render the region { element begin */ + h5tools_str_reset(buffer); + + h5tools_str_append(buffer, "{"); + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + /* Render the region { element end */ + + ctx->indent_level++; + ctx->need_prefix = TRUE; + + /* Render the region datatype info and indices element begin */ + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "REGION_TYPE BLOCK "); + + alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); + assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ + if((ptdata = (hsize_t*) malloc((size_t) alloc_size)) == NULL) + HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); + + H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t); + if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0) + HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Rget_select_hyper_blocklist failed"); + + for (i = 0; i < nblocks; i++) { + int j; + + h5tools_str_append(buffer, info->dset_blockformat_pre, + i ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long) i); + + /* Start coordinates and opposite corner */ + for (j = 0; j < ndims; j++) + h5tools_str_append(buffer, "%s%lu", j ? "," : "(", + (unsigned long) ptdata[i * 2 * ndims + j]); + + for (j = 0; j < ndims; j++) + h5tools_str_append(buffer, "%s%lu", j ? "," : ")-(", + (unsigned long) ptdata[i * 2 * ndims + j + ndims]); + + h5tools_str_append(buffer, ")"); + } /* end for (i = 0; i < nblocks; i++) */ + + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + /* Render the region datatype info and indices element end */ + + ctx->need_prefix = TRUE; + + if((dtype = H5Dget_type(region_id)) < 0) + HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Dget_type failed"); + if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) + HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Tget_native_type failed"); + + /* Render the datatype element begin */ + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "%s %s ", + h5tools_dump_header_format->datatypebegin, + h5tools_dump_header_format->datatypeblockbegin); + + ctx->indent_level++; + h5tools_print_datatype(stream, buffer, info, ctx, dtype, TRUE); + ctx->indent_level--; + + if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) { + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeblockend); + if (HDstrlen(h5tools_dump_header_format->datatypeend)) + h5tools_str_append(buffer, " "); + } + if (HDstrlen(h5tools_dump_header_format->datatypeend)) + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeend); + + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + /* Render the datatype element end */ + + ctx->need_prefix = TRUE; + + /* Render the dataspace element begin */ + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "%s ", h5tools_dump_header_format->dataspacebegin); + + h5tools_print_dataspace(stream, buffer, info, ctx, region_space); + + if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); + if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + h5tools_str_append(buffer, " "); + } + if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); + + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + /* Render the dataspace element end */ + + ctx->need_prefix = TRUE; + + /* Render the databegin element begin */ + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "%s %s ", + h5tools_dump_header_format->databegin, + h5tools_dump_header_format->datablockbegin); + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + /* Render the databegin element end */ + + ctx->need_prefix = TRUE; + + h5tools_print_region_data_blocks(region_id, rawdatastream, info, ctx, + buffer, ncols, ndims, type_id, nblocks, ptdata); + + done: + free(ptdata); + + if(H5Tclose(type_id) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + + if(H5Tclose(dtype) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + + ctx->need_prefix = TRUE; + + /* Render the dataend element begin */ + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "%s %s ", + h5tools_dump_header_format->dataend, + h5tools_dump_header_format->datablockend); + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, + ncols, region_elmt_counter, elmt_counter); + /* Render the dataend element end */ + + ctx->indent_level--; + ctx->need_prefix = TRUE; + + /* Render the region } element begin */ + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "}"); + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, + ncols, region_elmt_counter, elmt_counter); + /* Render the region } element end */ + + H5_LEAVE(dimension_break) + + CATCH + return ret_value; +} + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: Print the data values from a dataset referenced by region points. + * + * Description: + * This is a special case subfunction to print the data in a region reference of type points. + * + * Return: + * The function returns FAIL on error, otherwise SUCCEED + * + * Parameters Description: + * h5tools_str_t *buffer is the string into which to render + * size_t ncols + * int ndims is the number of dimensions of the region element + * hssize_t npoints is the number of points in the region + *------------------------------------------------------------------------- + */ +int +h5tools_print_region_data_points(hid_t region_space, hid_t region_id, + FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, + h5tools_str_t *buffer, size_t ncols, + int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata) +{ + hbool_t dimension_break = TRUE; + hsize_t *dims1 = NULL; + hsize_t elmtno; /* elemnt index */ + hsize_t curr_pos = 0; + hsize_t total_size[H5S_MAX_RANK]; + size_t jndx; + int indx; + int type_size; + int ret_value = SUCCEED; + unsigned int region_flags; /* buffer extent flags */ + hid_t mem_space = -1; + void *region_buf = NULL; + h5tools_context_t ctx; + + assert(info); + assert(cur_ctx); + assert(buffer); + assert(ptdata); + + memset(&ctx, 0, sizeof(ctx)); + /* Allocate space for the dimension array */ + if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); + + dims1[0] = npoints; + + /* Create dataspace for reading buffer */ + if((mem_space = H5Screate_simple(1, dims1, NULL)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); + + if((type_size = H5Tget_size(type_id)) == 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + + if((region_buf = HDmalloc(type_size * npoints)) == NULL) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for region"); + + curr_pos = 0; + ctx.indent_level = cur_ctx->indent_level; + ctx.cur_column = cur_ctx->cur_column; + ctx.prev_multiline = cur_ctx->prev_multiline; + ctx.ndims = ndims; + + if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + + elmtno = 0; + for (jndx = 0; jndx < npoints; jndx++, elmtno++) { + ctx.need_prefix = TRUE; + ctx.cur_elmt = 0; /* points are always 0 */ + + ctx.indent_level++; + if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + + /* assume entire data space to be printed */ + for (indx = 0; indx < (size_t) ctx.ndims; indx++) + ctx.p_min_idx[indx] = 0; + init_acc_pos(&ctx, total_size); + + /* print the data */ + region_flags = START_OF_DATA; + if (jndx == npoints - 1) + region_flags |= END_OF_DATA; + + for (indx = 0; indx < (size_t)ctx.ndims; indx++) + ctx.p_max_idx[indx] = cur_ctx->p_max_idx[indx]; + + ctx.sm_pos = jndx * ndims; + if (ctx.ndims > 0) { + ctx.size_last_dim = (int) (ctx.p_max_idx[ctx.ndims - 1]); + } + else + ctx.size_last_dim = 0; + + curr_pos = 0; /* points requires constant 0 */ + h5tools_region_simple_prefix(stream, info, &ctx, curr_pos, ptdata, 0); + + /* Render the point element begin */ + h5tools_str_reset(buffer); + + h5tools_str_append(buffer, "%s", jndx ? OPTIONAL_LINE_BREAK "" : ""); + h5tools_str_sprint(buffer, info, region_id, type_id, + ((char*)region_buf + jndx * type_size), &ctx); + + if (jndx + 1 < npoints || (region_flags & END_OF_DATA) == 0) + h5tools_str_append(buffer, "%s", OPT(info->elmt_suf1, ",")); + + dimension_break = h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos, + ncols, ptdata, (hsize_t)0, elmtno); + /* Render the point element end */ + if(FALSE == dimension_break) + elmtno = 0; + + ctx.indent_level--; + } /* end for (jndx = 0; jndx < npoints; jndx++, elmtno++) */ + + done: + HDfree(region_buf); + HDfree(dims1); + + if(H5Sclose(mem_space) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + + return ret_value; +} + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: Print some values from a dataset referenced by region points. + * + * Description: + * This is a special case subfunction to dump a region reference using points. + * + * Return: + * The function returns False if the last dimension has been reached, otherwise True + * + * In/Out: + * h5tools_context_t *ctx + * hsize_t *curr_pos + * + * Parameters Description: + * h5tools_str_t *buffer is the string into which to render + * hsize_t curr_pos is the total data element position + * size_t ncols + * hsize_t region_elmt_counter is the region element loop counter + * hsize_t elmt_count is the data element loop counter + *------------------------------------------------------------------------- + */ +hbool_t +h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, + FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter, + hsize_t elmt_counter) { + HERR_INIT(hbool_t, TRUE) + hbool_t dimension_break = TRUE; + hssize_t npoints; + hsize_t alloc_size; + hsize_t *ptdata; + int ndims; + hssize_t indx; + hid_t dtype; + hid_t type_id; + + assert(info); + assert(ctx); + assert(buffer); + + if((npoints = H5Sget_select_elem_npoints(region_space)) <= 0) + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed"); + + /* Allocate space for the dimension array */ + if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + + /* Render the region { element begin */ + h5tools_str_reset(buffer); + + h5tools_str_append(buffer, "{"); + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + /* Render the region { element end */ + + /* Render the region datatype info and indices element begin */ + h5tools_str_reset(buffer); + + ctx->indent_level++; + ctx->need_prefix = TRUE; + h5tools_str_append(buffer, "REGION_TYPE POINT "); + + alloc_size = npoints * ndims * sizeof(ptdata[0]); + assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ + if(NULL == (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size))) + HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); + + H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t); + if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, (hsize_t) npoints, ptdata) < 0) + HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_pointlist failed"); + + for (indx = 0; indx < npoints; indx++) { + int loop_indx; + + h5tools_str_append(buffer, info->dset_ptformat_pre, + indx ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long) indx); + + for (loop_indx = 0; loop_indx < ndims; loop_indx++) + h5tools_str_append(buffer, "%s%lu", loop_indx ? "," : "(", + (unsigned long) (ptdata[indx * ndims + loop_indx])); + + h5tools_str_append(buffer, ")"); + } /* end for (indx = 0; indx < npoints; indx++) */ + + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + /* Render the region datatype info and indices element end */ + + ctx->need_prefix = TRUE; + + if((dtype = H5Dget_type(region_id)) < 0) + HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Dget_type failed"); + + if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) + HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Tget_native_type failed"); + + /* Render the datatype element begin */ + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "%s %s ", + h5tools_dump_header_format->datatypebegin, + h5tools_dump_header_format->datatypeblockbegin); + + ctx->indent_level++; + h5tools_print_datatype(stream, buffer, info, ctx, dtype, TRUE); + ctx->indent_level--; + + if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) { + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeblockend); + if (HDstrlen(h5tools_dump_header_format->datatypeend)) + h5tools_str_append(buffer, " "); + } + if (HDstrlen(h5tools_dump_header_format->datatypeend)) + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeend); + + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + /* Render the datatype element end */ + + ctx->need_prefix = TRUE; + + /* Render the dataspace element begin */ + h5tools_str_reset(buffer); + + ctx->need_prefix = TRUE; + h5tools_str_append(buffer, "%s ", h5tools_dump_header_format->dataspacebegin); + + h5tools_print_dataspace(stream, buffer, info, ctx, region_space); + + if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); + if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + h5tools_str_append(buffer, " "); + } + if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); + + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + /* Render the dataspace element end */ + + ctx->need_prefix = TRUE; + + /* Render the databegin element begin */ + h5tools_str_reset(buffer); + + h5tools_str_append(buffer, "%s %s ", + h5tools_dump_header_format->databegin, + h5tools_dump_header_format->datablockbegin); + + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + + ctx->need_prefix = TRUE; + + h5tools_print_region_data_points(region_space, region_id, + rawdatastream, info, ctx, buffer, ncols, ndims, type_id, npoints, ptdata); + + done: + free(ptdata); + + if(H5Tclose(type_id) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + + if(H5Tclose(dtype) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + + ctx->need_prefix = TRUE; + + /* Render the dataend element begin */ + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "%s %s ", + h5tools_dump_header_format->dataend, + h5tools_dump_header_format->datablockend); + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, + ncols, region_elmt_counter, elmt_counter); + /* Render the dataend element end*/ + + ctx->indent_level--; + ctx->need_prefix = TRUE; + + /* Render the region } element begin */ + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "}"); + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, + ncols, region_elmt_counter, elmt_counter); + /* Render the region } element end */ + + H5_LEAVE(dimension_break) +CATCH + return ret_value; +} + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: print out the data for a subset of a dataset. + * Description: + * + * Select a hyperslab from the dataset DSET using the parameters + * specified in SSET. Dump this out to STREAM. + * + * Hyperslabs select "count" blocks of size "block", spaced "stride" elements + * from each other, starting at coordinate "start". + * + * Return: + * On success, return SUCCEED. Otherwise, the function returns FAIL. + * + * Algorithm + * + * The parameters from SSET are translated into temporary + * variables so that 1 row is printed at a time (getting the coordinate indices + * at each row). + * We define the stride, count and block to be 1 in the row dimension to achieve + * this and advance until all points are printed. + * + * The element position is obtained from the matrix according to: + * Given an index I(z,y,x) its position from the beginning of an array + * of sizes A(size_z, size_y,size_x) is given by + * Position of I(z,y,x) = index_z * size_y * size_x + * + index_y * size_x + * + index_x + * + *------------------------------------------------------------------------- + */ +static herr_t +h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + hid_t dset, hid_t p_type, struct subset_t *sset, + hid_t f_space, hsize_t hyperslab_count, + hsize_t *temp_start,/* start inside offset count loop */ + hsize_t *temp_count,/* count inside offset count loop */ + hsize_t *temp_block,/* block size used in loop */ + hsize_t *temp_stride,/* stride size used in loop */ + hsize_t *total_size,/* total size of dataset */ + unsigned int row_dim/* index of row_counter dimension */) +{ + HERR_INIT(herr_t, SUCCEED) + size_t i; /* counters */ + size_t j; /* counters */ + hsize_t zero[1] = {0}; /* vector of zeros */ + unsigned int flags; /* buffer extent flags */ + hsize_t elmtno; /* elemnt index */ + hsize_t low[H5S_MAX_RANK]; /* low bound of hyperslab */ + hsize_t high[H5S_MAX_RANK]; /* higher bound of hyperslab */ + size_t p_type_nbytes; /* size of memory type */ + hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */ + hsize_t sm_nbytes; /* bytes per stripmine */ + hssize_t ssm_nelmts; /* elements per stripmine*/ + hsize_t sm_nelmts; /* elements per stripmine*/ + unsigned char *sm_buf = NULL; /* buffer for raw data */ + hid_t sm_space = -1; /* stripmine data space */ + hsize_t size_row_block; /* size for blocks along rows */ + hsize_t row_counter = 0; + + /* VL data special information */ + unsigned int vl_data = 0; /* contains VL datatypes */ + + if ((size_t) ctx->ndims > NELMTS(sm_size)) + H5E_THROW(FAIL, H5E_tools_min_id_g, "ndims and sm_size comparision failed"); + + if (ctx->ndims > 0) + init_acc_pos(ctx, total_size); + + size_row_block = sset->block.data[row_dim]; + + /* Check if we have VL data in the dataset's datatype */ + if (h5tools_detect_vlen_str(p_type) == TRUE) + vl_data = TRUE; + if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) + vl_data = TRUE; + + /* display loop */ + for (; hyperslab_count > 0; temp_start[row_dim] += temp_stride[row_dim], hyperslab_count--) { + /* jump rows if size of block exceeded + cases where block > 1 only and stride > block */ + if (size_row_block > 1 + && row_counter == size_row_block + && sset->stride.data[row_dim] > sset->block.data[row_dim]) { + + hsize_t increase_rows = sset->stride.data[row_dim] - sset->block.data[row_dim]; + temp_start[row_dim] += increase_rows; + row_counter = 0; + } + + row_counter++; + + /* calculate the potential number of elements we're going to print */ + if(H5Sselect_hyperslab(f_space, H5S_SELECT_SET, temp_start, temp_stride, temp_count, temp_block) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + + if((ssm_nelmts = H5Sget_select_npoints(f_space)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed"); + sm_nelmts = (hsize_t)ssm_nelmts; + + if (sm_nelmts > 0) { + /* + * determine the strip mine size and allocate a buffer. the strip mine is + * a hyperslab whose size is manageable. + */ + if((sm_nbytes = p_type_nbytes = H5Tget_size(p_type)) == 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + + if (ctx->ndims > 0) + for (i = ctx->ndims; i > 0; --i) { + hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; + if (size == 0) /* datum size > H5TOOLS_BUFSIZE */ + size = 1; + sm_size[i - 1] = MIN(total_size[i - 1], size); + sm_nbytes *= sm_size[i - 1]; + assert(sm_nbytes > 0); + } + + assert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/ + if(NULL == (sm_buf = (unsigned char *)HDmalloc((size_t) sm_nelmts * p_type_nbytes))) + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine"); + + if((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); + + if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &sm_nelmts, NULL) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + + /* read the data */ + if(H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + + /* print the data */ + flags = START_OF_DATA; + + if (hyperslab_count == 1) + flags |= END_OF_DATA; + + for (i = 0; i < ctx->ndims; i++) + ctx->p_max_idx[i] = ctx->p_min_idx[i] + MIN(total_size[i], sm_size[i]); + + /* print array indices. get the lower bound of the hyperslab and calulate + the element position at the start of hyperslab */ + if(H5Sget_select_bounds(f_space, low, high) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed"); + + elmtno = 0; + for (i = 0; i < (size_t) ctx->ndims - 1; i++) { + hsize_t offset = 1; /* accumulation of the previous dimensions */ + for (j = i + 1; j < (size_t) ctx->ndims; j++) + offset *= total_size[j]; + elmtno += low[i] * offset; + } + elmtno += low[ctx->ndims - 1]; + + /* initialize the current stripmine position; this is necessary to print the array + indices */ + ctx->sm_pos = elmtno; + + ctx->need_prefix = TRUE; + + h5tools_dump_simple_data(stream, info, dset, ctx, flags, sm_nelmts, p_type, sm_buf); + + /* Reclaim any VL memory, if necessary */ + if (vl_data) + H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf); + + if(H5Sclose(sm_space) < 0) + H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + if(sm_buf) + HDfree(sm_buf); + sm_buf = NULL; + } + else + H5E_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print"); + + ctx->continuation++; + + } /* hyperslab_count loop */ + +CATCH + if(sm_buf) + HDfree(sm_buf); + + return ret_value; +} + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: print out the data for a subset of a dataset. + * Description: + * + * Select a hyperslab from the dataset DSET using the parameters + * specified in SSET. Dump this out to STREAM. + * + * Hyperslabs select "count" blocks of size "block", spaced "stride" elements + * from each other, starting at coordinate "start". + * + * Return: + * On success, return SUCCEED. Otherwise, the function returns FAIL. + * + * Algorithm + * + * The parameters from SSET are translated into temporary + * variables so that 1 row is printed at a time (getting the coordinate indices + * at each row). + * We define the stride, count and block to be 1 in the row dimension to achieve + * this and advance until all points are printed. + * + * The element position is obtained from the matrix according to: + * Given an index I(z,y,x) its position from the beginning of an array + * of sizes A(size_z, size_y,size_x) is given by + * Position of I(z,y,x) = index_z * size_y * size_x + * + index_y * size_x + * + index_x + * + *------------------------------------------------------------------------- + */ +static herr_t +h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + hid_t dset, hid_t p_type, struct subset_t *sset, + hid_t f_space, hsize_t *total_size) +{ + size_t i; /* counters */ + hsize_t n; /* counters */ + hsize_t count; /* hyperslab count */ + hsize_t outer_count; /* offset count */ + unsigned int row_dim; /* index of row_counter dimension */ + int current_outer_dim; /* dimension for start */ + hsize_t temp_start[H5S_MAX_RANK];/* temporary start inside offset count loop */ + hsize_t max_start[H5S_MAX_RANK]; /* maximum start inside offset count loop */ + hsize_t temp_count[H5S_MAX_RANK];/* temporary count inside offset count loop */ + hsize_t temp_block[H5S_MAX_RANK];/* temporary block size used in loop */ + hsize_t temp_stride[H5S_MAX_RANK];/* temporary stride size used in loop */ + int reset_dim; + herr_t ret_value = SUCCEED; + + if (ctx->ndims == 1) + row_dim = 0; + else + row_dim = ctx->ndims - 2; + + /* get the offset count */ + outer_count = 1; + if (ctx->ndims > 2) + for (i = 0; i < (size_t) ctx->ndims - 2; i++) { + /* block size is handled by containing h5tools_print_simple_subset call */ + outer_count = outer_count * sset->count.data[i]; + } + + /* initialize temporary start, count and maximum start */ + for (i = 0; i < (size_t) ctx->ndims; i++) { + temp_start[i] = sset->start.data[i]; + temp_count[i] = sset->count.data[i]; + temp_block[i] = sset->block.data[i]; + temp_stride[i] = sset->stride.data[i]; + max_start[i] = 0; + } + + if (ctx->ndims > 2) { + for (i = 0; i < (size_t) ctx->ndims - 2; i++) { + max_start[i] = temp_start[i] + sset->count.data[i]; + temp_count[i] = 1; + } + } + + /* offset loop */ + for (n = 0; n < outer_count; n++) { + /* number of read iterations in inner loop, read by rows, to match 2D display */ + if (ctx->ndims > 1) { + /* count is the number of iterations to display all the rows, + the block size count times */ + count = sset->count.data[row_dim] * sset->block.data[row_dim]; + + /* always 1 row_counter at a time, that is a block of size 1, 1 time */ + temp_count[row_dim] = 1; + temp_block[row_dim] = 1; + + /* advance 1 row_counter at a time */ + if (sset->block.data[row_dim] > 1) + temp_stride[row_dim] = 1; + } + /* for the 1D case */ + else { + count = 1; + } + + h5tools_print_simple_subset(stream, info, ctx, dset, p_type, sset, + f_space, count, temp_start, temp_count, + temp_block, temp_stride, total_size, row_dim); + + if (ctx->ndims > 2) { + /* dimension for start */ + current_outer_dim = (ctx->ndims - 2) - 1; + + /* set start to original from current_outer_dim up */ + for (i = current_outer_dim + 1; i < ctx->ndims; i++) { + temp_start[i] = sset->start.data[i]; + } + + /* increment start dimension */ + do { + reset_dim = 0; + temp_start[current_outer_dim]++; + if (temp_start[current_outer_dim] >= max_start[current_outer_dim]) { + temp_start[current_outer_dim] = sset->start.data[current_outer_dim]; + + /* consider block */ + if (sset->block.data[current_outer_dim] > 1) + temp_start[current_outer_dim]++; + + current_outer_dim--; + reset_dim = 1; + } + } while (current_outer_dim >= 0 && reset_dim); + + } /* ctx.ndims > 1 */ + + } /* outer_count */ + + return ret_value; +} + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: Dump out a subset of a dataset. + * Description: + * + * Select a hyperslab from the dataset DSET using the parameters + * specified in SSET. Dump this out to STREAM. + * + * Hyperslabs select "count" blocks of size "block", spaced "stride" elements + * from each other, starting at coordinate "start". + * + * Return: + * On success, return SUCCEED. Otherwise, the function returns FAIL. + * + * Original programmer: + * Bill Wendling, Wednesday, March 07, 2001 + * + * Rewritten with modified algorithm by: + * Pedro Vicente, Wednesday, January 16, 2008, contributions from Quincey Koziol + * + * Algorithm + * + * In a inner loop, the parameters from SSET are translated into temporary + * variables so that 1 row is printed at a time (getting the coordinate indices + * at each row). + * We define the stride, count and block to be 1 in the row dimension to achieve + * this and advance until all points are printed. + * An outer loop for cases where dimensionality is greater than 2D is made. + * In each iteration, the 2D block is displayed in the inner loop. The remaining + * slower dimensions above the first 2 are incremented one at a time in the outer loop + * + * The element position is obtained from the matrix according to: + * Given an index I(z,y,x) its position from the beginning of an array + * of sizes A(size_z, size_y,size_x) is given by + * Position of I(z,y,x) = index_z * size_y * size_x + * + index_y * size_x + * + index_x + * + *------------------------------------------------------------------------- + */ +static herr_t +h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset, + hid_t p_type, struct subset_t *sset) +{ + HERR_INIT(herr_t, SUCCEED) + int sndims; + hid_t f_space = -1; /* file data space */ + size_t i; /* counters */ + hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/ + + if((f_space = H5Dget_space(dset)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + + if((sndims = H5Sget_simple_extent_ndims(f_space)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + ctx->ndims = (unsigned)sndims; + + /* assume entire data space to be printed */ + if (ctx->ndims > 0) + for (i = 0; i < (size_t) ctx->ndims; i++) + ctx->p_min_idx[i] = 0; + + if(H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + ctx->size_last_dim = total_size[ctx->ndims - 1]; + + h5tools_display_simple_subset(stream, info, ctx, dset, p_type, sset, f_space, total_size); + +CATCH + if(f_space >= 0 && H5Sclose(f_space) < 0) + H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + + return ret_value; +} + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: Print some values from a dataset with a simple data space. + * Description: + * This is a special case of h5tools_dump_dset(). This function only + * intended for dumping datasets -- it does strip mining and some other + * things which are unnecessary for smaller objects such as attributes + * (to print small objects like attributes simply read the attribute and + * call h5tools_dump_simple_mem()). + * Return: + * On success, the function returns SUCCEED. Otherwise, the function + * returns FAIL. + *------------------------------------------------------------------------- + */ +static int +h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + hid_t dset, hid_t p_type) +{ + hid_t f_space; /* file data space */ + hsize_t elmtno; /* counter */ + size_t i; /* counter */ + int carry; /* counter carry value */ + hsize_t zero[8]; /* vector of zeros */ + unsigned int flags; /* buffer extent flags */ + hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/ + + /* Print info */ + size_t p_type_nbytes; /* size of memory type */ + hsize_t p_nelmts; /* total selected elmts */ + + /* Stripmine info */ + hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */ + hsize_t sm_nbytes; /* bytes per stripmine */ + hsize_t sm_nelmts; /* elements per stripmine*/ + unsigned char *sm_buf = NULL; /* buffer for raw data */ + hid_t sm_space; /* stripmine data space */ + + /* Hyperslab info */ + hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */ + hsize_t hs_size[H5S_MAX_RANK]; /* size this pass */ + hsize_t hs_nelmts; /* elements in request */ + + /* VL data special information */ + unsigned int vl_data = 0; /* contains VL datatypes */ + + f_space = H5Dget_space(dset); + + if (f_space == FAIL) + return FAIL; + + ctx->ndims = H5Sget_simple_extent_ndims(f_space); + + if ((size_t)ctx->ndims > NELMTS(sm_size)) { + H5Sclose(f_space); + return FAIL; + } + + /* Assume entire data space to be printed */ + if (ctx->ndims > 0) + for (i = 0; i < (size_t)ctx->ndims; i++) + ctx->p_min_idx[i] = 0; + + H5Sget_simple_extent_dims(f_space, total_size, NULL); + + /* calculate the number of elements we're going to print */ + p_nelmts = 1; + + if (ctx->ndims > 0) { + for (i = 0; i < ctx->ndims; i++) + p_nelmts *= total_size[i]; + ctx->size_last_dim = (total_size[ctx->ndims - 1]); + } /* end if */ + else + ctx->size_last_dim = 0; + + if (p_nelmts == 0) { + /* nothing to print */ + H5Sclose(f_space); + return SUCCEED; + } + + /* Check if we have VL data in the dataset's datatype */ + if (h5tools_detect_vlen_str(p_type) == TRUE) + vl_data = TRUE; + if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) + vl_data = TRUE; + + /* + * Determine the strip mine size and allocate a buffer. The strip mine is + * a hyperslab whose size is manageable. + */ + sm_nbytes = p_type_nbytes = H5Tget_size(p_type); + + if (ctx->ndims > 0) { + for (i = ctx->ndims; i > 0; --i) { + hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; + if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */ + size = 1; + sm_size[i - 1] = MIN(total_size[i - 1], size); + sm_nbytes *= sm_size[i - 1]; + assert(sm_nbytes > 0); + } + } + + if(!sm_nbytes) + goto done; + + assert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/ + sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes); + + sm_nelmts = sm_nbytes / p_type_nbytes; + sm_space = H5Screate_simple(1, &sm_nelmts, NULL); + + if (ctx->ndims > 0) + init_acc_pos(ctx, total_size); + + /* The stripmine loop */ + memset(hs_offset, 0, sizeof hs_offset); + memset(zero, 0, sizeof zero); + + for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { + /* Calculate the hyperslab size */ + if (ctx->ndims > 0) { + for (i = 0, hs_nelmts = 1; i < ctx->ndims; i++) { + hs_size[i] = MIN(total_size[i] - hs_offset[i], sm_size[i]); + ctx->p_max_idx[i] = ctx->p_min_idx[i] + hs_size[i]; + hs_nelmts *= hs_size[i]; + } + + H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL); + H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL); + } + else { + H5Sselect_all(f_space); + H5Sselect_all(sm_space); + hs_nelmts = 1; + } + + /* Read the data */ + if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) { + H5Sclose(f_space); + H5Sclose(sm_space); + free(sm_buf); + return FAIL; + } + + /* Print the data */ + flags = (elmtno == 0) ? START_OF_DATA : 0; + flags |= ((elmtno + hs_nelmts) >= p_nelmts) ? END_OF_DATA : 0; + + /* initialize the current stripmine position; this is necessary to print the array + indices */ + ctx->sm_pos = elmtno; + + h5tools_dump_simple_data(stream, info, dset, ctx, flags, hs_nelmts, p_type, sm_buf); + + /* Reclaim any VL memory, if necessary */ + if (vl_data) + H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf); + + /* Calculate the next hyperslab offset */ + for (i = ctx->ndims, carry = 1; i > 0 && carry; --i) { + ctx->p_min_idx[i - 1] = ctx->p_max_idx[i - 1]; + hs_offset[i - 1] += hs_size[i - 1]; + + if (hs_offset[i - 1] == total_size[i - 1]) + hs_offset[i - 1] = 0; + else + carry = 0; + } + + ctx->continuation++; + } + + HDfree(sm_buf); + +done: + H5Sclose(sm_space); + H5Sclose(f_space); + + return SUCCEED; +} + +/*------------------------------------------------------------------------- + * Function: h5tools_dump_simple_mem + * + * Purpose: Print some values from memory with a simple data space. + * This is a special case of h5tools_dump_mem(). + * + * Return: Success: SUCCEED + * Failure: FAIL + * + *------------------------------------------------------------------------- + */ +static int +h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t obj_id, + hid_t type, hid_t space, void *mem) +{ + int i; /*counters */ + hsize_t nelmts; /*total selected elmts */ + + ctx->ndims = H5Sget_simple_extent_ndims(space); + + if ((size_t) ctx->ndims > NELMTS(ctx->p_min_idx)) + return FAIL; + + /* Assume entire data space to be printed */ + for (i = 0; i < ctx->ndims; i++) + ctx->p_min_idx[i] = 0; + + H5Sget_simple_extent_dims(space, ctx->p_max_idx, NULL); + + for (i = 0, nelmts = 1; ctx->ndims != 0 && i < ctx->ndims; i++) + nelmts *= ctx->p_max_idx[i] - ctx->p_min_idx[i]; + + if (nelmts == 0) + return SUCCEED; /*nothing to print*/ + if (ctx->ndims > 0) { + assert(ctx->p_max_idx[ctx->ndims - 1] == (hsize_t) ((int) ctx->p_max_idx[ctx->ndims - 1])); + ctx->size_last_dim = (int) (ctx->p_max_idx[ctx->ndims - 1]); + } /* end if */ + else + ctx->size_last_dim = 0; + + if (ctx->ndims > 0) + init_acc_pos(ctx, ctx->p_max_idx); + + h5tools_dump_simple_data(stream, info, obj_id, ctx, START_OF_DATA | END_OF_DATA, nelmts, type, mem); + + return SUCCEED; +} + +/*------------------------------------------------------------------------- + * Function: h5tools_dump_dset + * + * Purpose: Print some values from a dataset DSET to the file STREAM + * after converting all types to P_TYPE (which should be a + * native type). If P_TYPE is a negative value then it will be + * computed from the dataset type using only native types. + * + * Note: This function is intended only for datasets since it does + * some things like strip mining which are unnecessary for + * smaller objects such as attributes. The easiest way to print + * small objects is to read the object into memory and call + * h5tools_dump_mem(). + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Modifications: + * Robb Matzke, 1999-06-07 + * If info->raw is set then the memory datatype will be the same + * as the file datatype. + * + * Bill Wendling, 2001-02-27 + * Renamed to ``h5tools_dump_dset'' and added the subsetting + * parameter. + * + *------------------------------------------------------------------------- + */ +int +h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + hid_t dset, hid_t _p_type, struct subset_t *sset) +{ + hid_t f_space; + hid_t p_type = _p_type; + hid_t f_type; + H5S_class_t space_type; + int status = FAIL; + h5tool_format_t info_dflt; + /* Use default values */ + if (!stream) + stream = stdout; + + if (!info) { + memset(&info_dflt, 0, sizeof info_dflt); + info = &info_dflt; + } + + if (p_type < 0) { + f_type = H5Dget_type(dset); + + if (info->raw || bin_form == 1) + p_type = H5Tcopy(f_type); + else if (bin_form == 2) + p_type = h5tools_get_little_endian_type(f_type); + else if (bin_form == 3) + p_type = h5tools_get_big_endian_type(f_type); + else + p_type = h5tools_get_native_type(f_type); + + H5Tclose(f_type); + + if (p_type < 0) + goto done; + } + + /* Check the data space */ + f_space = H5Dget_space(dset); + + space_type = H5Sget_simple_extent_type(f_space); + + /* Print the data */ + if (space_type == H5S_SIMPLE || space_type == H5S_SCALAR) { + if(!sset) + status = h5tools_dump_simple_dset(rawdatastream, info, ctx, dset, p_type); + else + status = h5tools_dump_simple_subset(stream, info, ctx, dset, p_type, sset); + } + else + /* space is H5S_NULL */ + status = SUCCEED; + + /* Close the dataspace */ + H5Sclose(f_space); + +done: + if (p_type != _p_type) + H5Tclose(p_type); + + return status; +} + +/*------------------------------------------------------------------------- + * Function: h5tools_dump_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: SUCCEED + * Failure: FAIL + * + *------------------------------------------------------------------------- + */ +int +h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + hid_t obj_id, hid_t type, hid_t space, void *mem) +{ + HERR_INIT(int, SUCCEED) + h5tool_format_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) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sis_simple failed") + + H5_LEAVE(h5tools_dump_simple_mem(stream, info, ctx, obj_id, type, space, mem)) + +CATCH + return ret_value; +} + +/*------------------------------------------------------------------------- + * Function: print_datatype + * + * Purpose: print the datatype - do not prefix. + * + * Return: void + * + * In/Out: h5tools_str_t *buffer + * h5tools_context_t *ctx + * + *------------------------------------------------------------------------- + */ +int +h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t type, int object_search) +{ + HERR_INIT(int, SUCCEED) + char *mname; + hid_t mtype = -1; + hid_t str_type = -1; + hid_t super = -1; + hid_t tmp_type = -1; + int snmembers; + int sndims; + unsigned nmembers; + unsigned i; + size_t size = 0; + size_t ncols = 80; /*available output width */ + hsize_t dims[H5TOOLS_DUMP_MAX_RANK]; + hsize_t curr_pos = 0; /* total data element position */ + H5T_str_t str_pad; + H5T_cset_t cset; + H5T_order_t order; + H5T_class_t type_class; + H5T_sign_t sign; /* sign scheme value */ + htri_t is_vlstr = FALSE; + const char *sign_s = NULL; /* sign scheme string */ + const char *order_s = NULL; /* byte order string */ + + if((type_class = H5Tget_class(type)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed"); + if (object_search && H5Tcommitted(type) > 0) { + H5O_info_t oinfo; + obj_t *obj = NULL; /* Found object */ + + H5Oget_info(type, &oinfo); + obj = search_obj(h5dump_type_table, oinfo.addr); + + if(obj) { + if(!obj->recorded) { + h5tools_str_append(buffer,"\"/#"H5_PRINTF_HADDR_FMT"\"", obj->objno); + } + else + h5tools_str_append(buffer, "\"%s\"", obj->objname); + } + else { + error_msg("unknown committed type.\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + return ret_value; + } + + if (info->line_ncols > 0) + ncols = info->line_ncols; + + switch (type_class) { + case H5T_INTEGER: + if (H5Tequal(type, H5T_STD_I8BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_I8BE"); + } + else if (H5Tequal(type, H5T_STD_I8LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_I8LE"); + } + else if (H5Tequal(type, H5T_STD_I16BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_I16BE"); + } + else if (H5Tequal(type, H5T_STD_I16LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_I16LE"); + } + else if (H5Tequal(type, H5T_STD_I32BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_I32BE"); + } + else if (H5Tequal(type, H5T_STD_I32LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_I32LE"); + } + else if (H5Tequal(type, H5T_STD_I64BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_I64BE"); + } + else if (H5Tequal(type, H5T_STD_I64LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_I64LE"); + } + else if (H5Tequal(type, H5T_STD_U8BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_U8BE"); + } + else if (H5Tequal(type, H5T_STD_U8LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_U8LE"); + } + else if (H5Tequal(type, H5T_STD_U16BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_U16BE"); + } + else if (H5Tequal(type, H5T_STD_U16LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_U16LE"); + } + else if (H5Tequal(type, H5T_STD_U32BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_U32BE"); + } + else if (H5Tequal(type, H5T_STD_U32LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_U32LE"); + } + else if (H5Tequal(type, H5T_STD_U64BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_U64BE"); + } + else if (H5Tequal(type, H5T_STD_U64LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_U64LE"); + } + else if (H5Tequal(type, H5T_NATIVE_SCHAR) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_SCHAR"); + } + else if (H5Tequal(type, H5T_NATIVE_UCHAR) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_UCHAR"); + } + else if (H5Tequal(type, H5T_NATIVE_SHORT) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_SHORT"); + } + else if (H5Tequal(type, H5T_NATIVE_USHORT) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_USHORT"); + } + else if (H5Tequal(type, H5T_NATIVE_INT) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_INT"); + } + else if (H5Tequal(type, H5T_NATIVE_UINT) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_UINT"); + } + else if (H5Tequal(type, H5T_NATIVE_LONG) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_LONG"); + } + else if (H5Tequal(type, H5T_NATIVE_ULONG) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_ULONG"); + } + else if (H5Tequal(type, H5T_NATIVE_LLONG) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_LLONG"); + } + else if (H5Tequal(type, H5T_NATIVE_ULLONG) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_ULLONG"); + } + else { + + /* byte order */ + if (H5Tget_size(type) > 1) { + order = H5Tget_order(type); + if (H5T_ORDER_LE == order) { + order_s = " little-endian"; + } + else if (H5T_ORDER_BE == order) { + order_s = " big-endian"; + } + else if (H5T_ORDER_VAX == order) { + order_s = " mixed-endian"; + } + else { + order_s = " unknown-byte-order"; + } + } + else { + order_s = ""; + } + + /* sign */ + if ((sign = H5Tget_sign(type)) >= 0) { + if (H5T_SGN_NONE == sign) { + sign_s = " unsigned"; + } + else if (H5T_SGN_2 == sign) { + sign_s = ""; + } + else { + sign_s = " unknown-sign"; + } + } + else { + sign_s = " unknown-sign"; + } + + /* print size, order, and sign */ + h5tools_str_append(buffer, "%lu-bit%s%s integer", + (unsigned long) (8 * H5Tget_size(type)), order_s, sign_s); + } + break; + + case H5T_FLOAT: + if (H5Tequal(type, H5T_IEEE_F32BE) == TRUE) { + h5tools_str_append(buffer, "H5T_IEEE_F32BE"); + } + else if (H5Tequal(type, H5T_IEEE_F32LE) == TRUE) { + h5tools_str_append(buffer, "H5T_IEEE_F32LE"); + } + else if (H5Tequal(type, H5T_IEEE_F64BE) == TRUE) { + h5tools_str_append(buffer, "H5T_IEEE_F64BE"); + } + else if (H5Tequal(type, H5T_IEEE_F64LE) == TRUE) { + h5tools_str_append(buffer, "H5T_IEEE_F64LE"); + } + else if (H5Tequal(type, H5T_VAX_F32) == TRUE) { + h5tools_str_append(buffer, "H5T_VAX_F32"); + } + else if (H5Tequal(type, H5T_VAX_F64) == TRUE) { + h5tools_str_append(buffer, "H5T_VAX_F64"); + } + else if (H5Tequal(type, H5T_NATIVE_FLOAT) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_FLOAT"); + } + else if (H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_DOUBLE"); +#if H5_SIZEOF_LONG_DOUBLE !=0 + } + else if (H5Tequal(type, H5T_NATIVE_LDOUBLE) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_LDOUBLE"); +#endif + } + else { + + /* byte order */ + if (H5Tget_size(type) > 1) { + order = H5Tget_order(type); + if (H5T_ORDER_LE == order) { + order_s = " little-endian"; + } + else if (H5T_ORDER_BE == order) { + order_s = " big-endian"; + } + else if (H5T_ORDER_VAX == order) { + order_s = " mixed-endian"; + } + else { + order_s = " unknown-byte-order"; + } + } + else { + order_s = ""; + } + + /* print size and byte order */ + h5tools_str_append(buffer, "%lu-bit%s floating-point", + (unsigned long) (8 * H5Tget_size(type)), order_s); + + } + break; + + case H5T_TIME: + h5tools_str_append(buffer, "H5T_TIME: not yet implemented"); + break; + + case H5T_STRING: + /* Make a copy of type in memory in case when TYPE is on disk, the size + * will be bigger than in memory. This makes it easier to compare + * types in memory. */ + tmp_type = H5Tcopy(type); + size = H5Tget_size(tmp_type); + str_pad = H5Tget_strpad(tmp_type); + cset = H5Tget_cset(tmp_type); + is_vlstr = H5Tis_variable_str(tmp_type); + + curr_pos = ctx->cur_column; + h5tools_str_append(buffer, "H5T_STRING %s", h5tools_dump_header_format->strblockbegin); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + + if (is_vlstr) + h5tools_str_append(buffer, "%s H5T_VARIABLE;", STRSIZE); + else + h5tools_str_append(buffer, "%s %d;", STRSIZE, (int) size); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + + h5tools_str_append(buffer, "%s ", STRPAD); + if (str_pad == H5T_STR_NULLTERM) + h5tools_str_append(buffer, "H5T_STR_NULLTERM;"); + else if (str_pad == H5T_STR_NULLPAD) + h5tools_str_append(buffer, "H5T_STR_NULLPAD;"); + else if (str_pad == H5T_STR_SPACEPAD) + h5tools_str_append(buffer, "H5T_STR_SPACEPAD;"); + else + h5tools_str_append(buffer, "H5T_STR_ERROR;"); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + + h5tools_str_append(buffer, "%s ", CSET); + + if (cset == H5T_CSET_ASCII) + h5tools_str_append(buffer, "H5T_CSET_ASCII;"); + else + h5tools_str_append(buffer, "unknown_cset;"); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + + str_type = H5Tcopy(H5T_C_S1); + if (is_vlstr) + H5Tset_size(str_type, H5T_VARIABLE); + else + H5Tset_size(str_type, size); + H5Tset_cset(str_type, cset); + H5Tset_strpad(str_type, str_pad); + + h5tools_str_append(buffer, "%s ", CTYPE); + + /* Check C variable-length string first. Are the two types equal? */ + if (H5Tequal(tmp_type, str_type)) { + h5tools_str_append(buffer, "H5T_C_S1;"); + goto done; + } + + /* Change the endianness and see if they're equal. */ + order = H5Tget_order(tmp_type); + if (order == H5T_ORDER_LE) + H5Tset_order(str_type, H5T_ORDER_LE); + else if (order == H5T_ORDER_BE) + H5Tset_order(str_type, H5T_ORDER_BE); + + if (H5Tequal(tmp_type, str_type)) { + h5tools_str_append(buffer, "H5T_C_S1;"); + goto done; + } + + /* If not equal to C variable-length string, check Fortran type. */ + if(H5Tclose(str_type) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + str_type = H5Tcopy(H5T_FORTRAN_S1); + + H5Tset_cset(str_type, cset); + H5Tset_size(str_type, size); + H5Tset_strpad(str_type, str_pad); + + /* Are the two types equal? */ + if (H5Tequal(tmp_type, str_type)) { + h5tools_str_append(buffer, "H5T_FORTRAN_S1;"); + goto done; + } + + /* Change the endianness and see if they're equal. */ + order = H5Tget_order(tmp_type); + if (order == H5T_ORDER_LE) + H5Tset_order(str_type, H5T_ORDER_LE); + else if (order == H5T_ORDER_BE) + H5Tset_order(str_type, H5T_ORDER_BE); + + if (H5Tequal(tmp_type, str_type)) { + h5tools_str_append(buffer, "H5T_FORTRAN_S1;"); + goto done; + } + + /* Type doesn't match any of above. */ + h5tools_str_append(buffer, "unknown_one_character_type;"); + + done: + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + if(H5Tclose(str_type) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + if(H5Tclose(tmp_type) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->strblockend); + break; + + case H5T_BITFIELD: + if (H5Tequal(type, H5T_STD_B8BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_B8BE"); + } + else if (H5Tequal(type, H5T_STD_B8LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_B8LE"); + } + else if (H5Tequal(type, H5T_STD_B16BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_B16BE"); + } + else if (H5Tequal(type, H5T_STD_B16LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_B16LE"); + } + else if (H5Tequal(type, H5T_STD_B32BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_B32BE"); + } + else if (H5Tequal(type, H5T_STD_B32LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_B32LE"); + } + else if (H5Tequal(type, H5T_STD_B64BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_B64BE"); + } + else if (H5Tequal(type, H5T_STD_B64LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_B64LE"); + } + else { + h5tools_str_append(buffer, "undefined bitfield"); + } + break; + + case H5T_OPAQUE: + h5tools_str_append(buffer, "H5T_OPAQUE %s", h5tools_dump_header_format->structblockbegin); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + ctx->indent_level++; + { + char *ttag = H5Tget_tag(type); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "OPAQUE_TAG \"%s\";", ttag); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + + if (ttag) + HDfree(ttag); + } + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend); + break; + + case H5T_COMPOUND: + if((snmembers = H5Tget_nmembers(type)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + nmembers = (unsigned)snmembers; + + h5tools_str_append(buffer, "H5T_COMPOUND %s", h5tools_dump_header_format->structblockbegin); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level++; + for (i = 0; i < nmembers; i++) { + mname = H5Tget_member_name(type, i); + if((mtype = H5Tget_member_type(type, i))>=0) { + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + h5tools_print_datatype(stream, buffer, info, ctx, mtype, TRUE); + + h5tools_str_append(buffer, " \"%s\";", mname); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + if(H5Tclose(mtype) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + } + else + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_member_type failed"); + free(mname); + } + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend); + break; + + case H5T_REFERENCE: + h5tools_str_append(buffer, "H5T_REFERENCE"); + if (H5Tequal(type, H5T_STD_REF_DSETREG) == TRUE) { + h5tools_str_append(buffer, " { H5T_STD_REF_DSETREG }"); + } + else { + h5tools_str_append(buffer, " { H5T_STD_REF_OBJECT }"); + } + break; + + case H5T_ENUM: + if((super = H5Tget_super(type)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + + h5tools_str_append(buffer, "H5T_ENUM %s", h5tools_dump_header_format->enumblockbegin); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE); + + if(H5Tclose(super) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + + h5tools_str_append(buffer, ";"); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + + h5tools_print_enum(stream, buffer, info, ctx, type); + + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->enumblockend); + + break; + + case H5T_VLEN: + if((super = H5Tget_super(type)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + + h5tools_str_append(buffer, "H5T_VLEN %s ", h5tools_dump_header_format->vlenblockbegin); + + h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE); + + if(H5Tclose(super) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->vlenblockend); + + break; + + case H5T_ARRAY: + h5tools_str_append(buffer, "H5T_ARRAY { "); + + /* Get array information */ + if((sndims = H5Tget_array_ndims(type)) >= 0) { + unsigned ndims = (unsigned)sndims; + + if(H5Tget_array_dims2(type, dims) >= 0) { + /* Print array dimensions */ + for (i = 0; i < ndims; i++) + h5tools_str_append(buffer, "[%d]", (int) dims[i]); + + h5tools_str_append(buffer, " "); + } + else + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_array_dims2 failed"); + } + else + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_array_ndims failed"); + + /* Get array base type */ + if((super = H5Tget_super(type)) >= 0) { + /* Print base type */ + h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE); + /* Close array base type */ + if(H5Tclose(super) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + } + else + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_super failed"); + + h5tools_str_append(buffer, " }"); + + break; + + default: + h5tools_str_append(buffer, "unknown datatype"); + break; + } + +CATCH + return ret_value; +} + +/*------------------------------------------------------------------------- + * Function: print_dataspace + * + * Purpose: print the dataspace. + * + * Return: void + * + * In/Out: h5tools_str_t *buffer + * h5tools_context_t *ctx + * + *------------------------------------------------------------------------- + */ +int +h5tools_print_dataspace(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t space) +{ + HERR_INIT(int, SUCCEED) + hsize_t size[H5TOOLS_DUMP_MAX_RANK]; + hsize_t maxsize[H5TOOLS_DUMP_MAX_RANK]; + int ndims = -1; + H5S_class_t space_type = -1; + int i; + + if((ndims = H5Sget_simple_extent_dims(space, size, maxsize)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + + if((space_type = H5Sget_simple_extent_type(space)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_type failed"); + + switch(space_type) { + case H5S_SCALAR: + /* scalar dataspace */ + h5tools_str_append(buffer, "%s %s", h5tools_dump_header_format->dataspacedescriptionbegin, S_SCALAR); + break; + + case H5S_SIMPLE: + /* simple dataspace */ + h5tools_str_append(buffer, "%s %s { %s %" H5_PRINTF_LL_WIDTH "u", + h5tools_dump_header_format->dataspacedescriptionbegin, S_SIMPLE, + h5tools_dump_header_format->dataspacedimbegin, size[0]); + + for(i = 1; i < ndims; i++) + h5tools_str_append(buffer, ", %" H5_PRINTF_LL_WIDTH "u", size[i]); + + h5tools_str_append(buffer, " %s / ", h5tools_dump_header_format->dataspacedimend); + + if(maxsize[0] == H5S_UNLIMITED) + h5tools_str_append(buffer, "%s %s", + h5tools_dump_header_format->dataspacedimbegin, "H5S_UNLIMITED"); + else + h5tools_str_append(buffer, "%s %" H5_PRINTF_LL_WIDTH "u", + h5tools_dump_header_format->dataspacedimbegin, maxsize[0]); + + for(i = 1; i < ndims; i++) + if(maxsize[i] == H5S_UNLIMITED) + h5tools_str_append(buffer, ", %s", "H5S_UNLIMITED"); + else + h5tools_str_append(buffer, ", %" H5_PRINTF_LL_WIDTH "u", maxsize[i]); + + h5tools_str_append(buffer, " %s }", h5tools_dump_header_format->dataspacedimend); + break; + + case H5S_NULL: + /* null dataspace */ + h5tools_str_append(buffer, "%s %s", h5tools_dump_header_format->dataspacedescriptionbegin, S_NULL); + break; + + case H5S_NO_CLASS: + default: + h5tools_str_append(buffer, "%s unknown dataspace %s\n", BEGIN, END); + break; + } /* end switch */ + +CATCH + return ret_value; +} + + +/*------------------------------------------------------------------------- + * Function: print_enum + * + * Purpose: prints the enum data + * + * Return: void + * + * In/Out: h5tools_str_t *buffer + * h5tools_context_t *ctx + * + *-----------------------------------------------------------------------*/ +int +h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t type) +{ + HERR_INIT(int, SUCCEED) + char **name = NULL; /*member names */ + unsigned char *value = NULL; /*value array */ + unsigned char *copy = NULL; /*a pointer to value array */ + unsigned i; + unsigned nmembs = 0; /*number of members */ + int snmembs; + int nchars; /*number of output characters */ + hid_t super = -1; /*enum base integer type */ + hid_t native = -1; /*native integer datatype */ + H5T_sign_t sign_type; /*sign of value type */ + size_t type_size; /*value type size */ + size_t dst_size; /*destination value type size */ + size_t ncols = 80; /*available output width */ + hsize_t curr_pos = 0; /* total data element position */ + + if (info->line_ncols > 0) + ncols = info->line_ncols; + + if((snmembs = H5Tget_nmembers(type)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + nmembs = (unsigned)snmembs; + assert(nmembs > 0); + + if((super = H5Tget_super(type)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); + + if((type_size = H5Tget_size(type)) <= 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed"); + + /* + * Determine what datatype to use for the native values. To simplify + * things we entertain three possibilities: + * 1. long long -- the largest native signed integer + * 2. unsigned long long -- the largest native unsigned integer + * 3. raw format + */ + if(type_size <= sizeof(long long)) { + dst_size = sizeof(long long); + + if((sign_type = H5Tget_sign(type))<0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_sign failed"); + if(H5T_SGN_NONE == sign_type) + native = H5T_NATIVE_ULLONG; + else + native = H5T_NATIVE_LLONG; + } /* end if */ + else + dst_size = type_size; + + /* Get the names and raw values of all members */ + if(NULL == (name = (char **)HDcalloc(nmembs, sizeof(char *)))) + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name"); + if(NULL == (value = (unsigned char *)HDcalloc(nmembs, MAX(type_size, dst_size)))) + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value"); + + for (i = 0; i < nmembs; i++) { + name[i] = H5Tget_member_name(type, i); + if(H5Tget_member_value(type, i, value + i * type_size) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_member_value failed"); + } + + /* Convert values to native datatype */ + if (native > 0) + if(H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tconvert failed"); + + /* + * Sort members by increasing value + * ***not implemented yet*** + */ + + /* Print members */ + for (i = 0; i < nmembs; i++) { + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "\"%s\"", name[i]); + nchars = strlen(name[i]); + h5tools_str_append(buffer, "%*s ", MAX(0, 16 - nchars), ""); + + if (native < 0) { + size_t j; + + h5tools_str_append(buffer, "0x"); + + for (j = 0; j < dst_size; j++) + h5tools_str_append(buffer, "%02x", value[i * dst_size + j]); + } + else if (H5T_SGN_NONE == H5Tget_sign(native)) { + /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" + *strangely, unless use another pointer "copy".*/ + copy = value + i * dst_size; + h5tools_str_append(buffer, "%" H5_PRINTF_LL_WIDTH "u", *((unsigned long long *) ((void *) copy))); + } + else { + /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" + *strangely, unless use another pointer "copy".*/ + copy = value + i * dst_size; + h5tools_str_append(buffer, "%" H5_PRINTF_LL_WIDTH "d", *((long long *) ((void *) copy))); + } + + h5tools_str_append(buffer, ";"); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + } + +CATCH + if(name) { + /* Release resources */ + for(i = 0; i < nmembs; i++) + if(name[i]) + free(name[i]); + free(name); + } /* end if */ + + if(value) + free(value); + + if(super >= 0 && H5Tclose(super) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not close datatype's super class"); + + if(0 == nmembs) + h5tools_str_append(buffer, "\n"); + + return ret_value; +} + +/*------------------------------------------------------------------------- + * Function: dump_datatype + * + * Purpose: Dump the datatype. Datatype can be HDF5 predefined + * atomic datatype or committed/transient datatype. + * + * Return: void + * + * In/Out: h5tools_context_t *ctx + *------------------------------------------------------------------------- + */ +void +h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t type) +{ + h5tools_str_t buffer; /* string into which to render */ + size_t ncols = 80; /* available output width */ + hsize_t curr_pos = ctx->sm_pos; /* total data element position */ + /* pass to the prefix in h5tools_simple_prefix the total position + * instead of the current stripmine position i; this is necessary + * to print the array indices + */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + if (info->line_ncols > 0) + ncols = info->line_ncols; + + ctx->need_prefix = TRUE; + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s ", + h5tools_dump_header_format->datatypebegin, + h5tools_dump_header_format->datatypeblockbegin); + h5tools_print_datatype(stream, &buffer, info, ctx, type, TRUE); + if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeblockend); + if (HDstrlen(h5tools_dump_header_format->datatypeend)) + h5tools_str_append(&buffer, " "); + } + if (HDstrlen(h5tools_dump_header_format->datatypeend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeend); + + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: dump_dataspace + * + * Purpose: Dump the dataspace. + * + * Return: void + * + * In/Out: h5tools_context_t *ctx + *------------------------------------------------------------------------- + */ +void +h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t type) +{ + h5tools_str_t buffer; /* string into which to render */ + size_t ncols = 80; /* available output width */ + hsize_t curr_pos = ctx->sm_pos; /* total data element position */ + /* pass to the prefix in h5tools_simple_prefix the total position + * instead of the current stripmine position i; this is necessary + * to print the array indices + */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + if (info->line_ncols > 0) + ncols = info->line_ncols; + + ctx->need_prefix = TRUE; + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s ", + h5tools_dump_header_format->dataspacebegin); + + h5tools_print_dataspace(stream, &buffer, info, ctx, type); + + if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->dataspaceblockend); + if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + h5tools_str_append(&buffer, " "); + } + if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->dataspaceend); + + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: dump_oid + * + * Purpose: Dump the oid. + * + * Return: void + * + * In/Out: h5tools_context_t *ctx + *------------------------------------------------------------------------- + */ +void +h5tools_dump_oid(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t oid) +{ + h5tools_str_t buffer; /* string into which to render */ + size_t ncols = 80; /* available output width */ + hsize_t curr_pos = ctx->sm_pos; /* total data element position */ + /* pass to the prefix in h5tools_simple_prefix the total position + * instead of the current stripmine position i; this is necessary + * to print the array indices + */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + if (info->line_ncols > 0) + ncols = info->line_ncols; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s %d %s", OBJID, BEGIN, oid, END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + h5tools_str_close(&buffer); +} + + +/*------------------------------------------------------------------------- + * Function: dump_fill_value + * + * Purpose: prints the fill value + * + * Return: void + * + * Programmer: pvn + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +h5tools_print_fill_value(h5tools_str_t *buffer/*in,out*/, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, hid_t dcpl, hid_t type_id, hid_t obj_id) +{ + size_t size; + hid_t n_type; + hsize_t nelmts = 1; + void *buf = NULL; + + n_type = h5tools_get_native_type(type_id); + + size = H5Tget_size(n_type); + buf = malloc(size); + + H5Pget_fill_value(dcpl, n_type, buf); + + h5tools_str_sprint(buffer, info, obj_id, n_type, buf, ctx); + + H5Tclose(n_type); + + if (buf) + free (buf); +} + +/*------------------------------------------------------------------------- + * Function: dump_dcpl + * + * Purpose: prints several dataset create property list properties + * + * Return: void + * + * Modifications: pvn, March 28, 2008 + * Add a COMPRESSION ratio information for cases when filters are present + * + *------------------------------------------------------------------------- + */ +void +h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t dcpl_id,hid_t type_id, hid_t obj_id) +{ + int nfilters; /* number of filters */ + int rank; /* rank */ + int i; + unsigned j; + unsigned filt_flags; /* filter flags */ + unsigned cd_values[20]; /* filter client data values */ + unsigned szip_options_mask; + unsigned szip_pixels_per_block; + H5Z_filter_t filtn; /* filter identification number */ + H5D_fill_value_t fvstatus; + H5D_alloc_time_t at; + H5D_fill_time_t ft; + size_t ncols = 80; /* available output width */ + size_t cd_nelmts; /* filter client number of values */ + off_t offset; /* offset of external file */ + char f_name[256]; /* filter name */ + char name[256]; /* external file name */ + hsize_t chsize[64]; /* chunk size in elements */ + hsize_t size; /* size of external file */ + hsize_t storage_size; + hsize_t curr_pos = 0; /* total data element position */ + hsize_t elmt_counter = 0;/* counts the # elements printed.*/ + haddr_t ioffset; + h5tools_str_t buffer; /* string into which to render */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + if (info->line_ncols > 0) + ncols = info->line_ncols; + + storage_size = H5Dget_storage_size(obj_id); + nfilters = H5Pget_nfilters(dcpl_id); + ioffset = H5Dget_offset(obj_id); + HDstrcpy(f_name,"\0"); + + /*------------------------------------------------------------------------- + * STORAGE_LAYOUT + *------------------------------------------------------------------------- + */ + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s", STORAGE_LAYOUT, BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + if(H5D_CHUNKED == H5Pget_layout(dcpl_id)) { + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s ", CHUNKED); + + rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize); + h5tools_str_append(&buffer, "%s %u", h5tools_dump_header_format->dataspacedimbegin, chsize[0]); + for(i = 1; i < rank; i++) + h5tools_str_append(&buffer, ", %u", chsize[i]); + h5tools_str_append(&buffer, " %s", h5tools_dump_header_format->dataspacedimend); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + + /* if there are filters, print a compression ratio */ + if(nfilters) { + hsize_t dims[H5S_MAX_RANK]; + hsize_t nelmts = 1; + double ratio = 0; + int ok = 0; + + hid_t tid = H5Dget_type(obj_id); + hid_t sid = H5Dget_space(obj_id); + size_t datum_size = H5Tget_size(tid); + int ndims = H5Sget_simple_extent_dims(sid, dims, NULL); + + /* only print the compression ratio for these filters */ + for(i = 0; i < nfilters; i++) { + cd_nelmts = NELMTS(cd_values); + filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, + cd_values, sizeof(f_name), f_name, NULL); + + switch(filtn) { + case H5Z_FILTER_DEFLATE: + case H5Z_FILTER_SZIP: + case H5Z_FILTER_NBIT: + case H5Z_FILTER_SCALEOFFSET: + ok = 1; + break; + } + } + + if(ndims && ok) { + hsize_t uncomp_size; + + for(i = 0; i < ndims; i++) { + nelmts *= dims[i]; + } + uncomp_size = nelmts * datum_size; + + /* compression ratio = uncompressed size / compressed size */ + + if(storage_size != 0) + ratio = (double) uncomp_size / (double) storage_size; + + h5tools_str_append(&buffer, "SIZE %u (%.3f:1 COMPRESSION)", storage_size, ratio); + + } + else + h5tools_str_append(&buffer, "SIZE %u", storage_size); + + H5Sclose(sid); + H5Tclose(tid); + + } + else { + h5tools_str_append(&buffer, "SIZE %u", storage_size); + } + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s",END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + else if(H5D_COMPACT == H5Pget_layout(dcpl_id)) { + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s", COMPACT); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "SIZE %u", storage_size); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s",END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + else if(H5D_CONTIGUOUS == H5Pget_layout(dcpl_id)) { + int next; + + next = H5Pget_external_count(dcpl_id); + + /*------------------------------------------------------------------------- + * EXTERNAL_FILE + *------------------------------------------------------------------------- + */ + if(next) { + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s", CONTIGUOUS); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s", EXTERNAL, BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level++; + for(j = 0; j < (unsigned)next; j++) { + H5Pget_external(dcpl_id, j, sizeof(name), name, &offset, &size); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "FILENAME %s SIZE %u OFFSET %ld", name, size, offset); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s",END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s",END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + else { + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s", CONTIGUOUS); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer,"SIZE %u", storage_size); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer,"OFFSET %u", ioffset); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s",END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + } + /*------------------------------------------------------------------------- + * FILTERS + *------------------------------------------------------------------------- + */ + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s", FILTERS, BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level++; + + if(nfilters) { + for(i = 0; i < nfilters; i++) { + cd_nelmts = NELMTS(cd_values); + filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, + cd_values, sizeof(f_name), f_name, NULL); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + switch(filtn) { + case H5Z_FILTER_DEFLATE: + h5tools_str_append(&buffer, "%s %s %s %d %s", DEFLATE, BEGIN, DEFLATE_LEVEL, cd_values[0], END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + break; + case H5Z_FILTER_SHUFFLE: + h5tools_str_append(&buffer, "%s", SHUFFLE); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + break; + case H5Z_FILTER_FLETCHER32: + h5tools_str_append(&buffer, "%s", FLETCHER32); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + break; + case H5Z_FILTER_SZIP: + { + szip_options_mask = cd_values[0];; + szip_pixels_per_block = cd_values[1]; + + h5tools_str_append(&buffer, "%s %s",SZIP, BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "PIXELS_PER_BLOCK %d", szip_pixels_per_block); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + if(szip_options_mask & H5_SZIP_CHIP_OPTION_MASK) + h5tools_str_append(&buffer, "MODE %s", "HARDWARE"); + else if(szip_options_mask & H5_SZIP_ALLOW_K13_OPTION_MASK) + h5tools_str_append(&buffer, "MODE %s", "K13"); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + if(szip_options_mask & H5_SZIP_EC_OPTION_MASK) + h5tools_str_append(&buffer, "CODING %s", "ENTROPY"); + else if(szip_options_mask & H5_SZIP_NN_OPTION_MASK) + h5tools_str_append(&buffer, "CODING %s", "NEAREST NEIGHBOUR"); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + if(szip_options_mask & H5_SZIP_LSB_OPTION_MASK) + h5tools_str_append(&buffer, "BYTE_ORDER %s", "LSB"); + else if(szip_options_mask & H5_SZIP_MSB_OPTION_MASK) + h5tools_str_append(&buffer, "BYTE_ORDER %s", "MSB"); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + if(szip_options_mask & H5_SZIP_RAW_OPTION_MASK) { + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "HEADER %s", "RAW"); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s",END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + break; + case H5Z_FILTER_NBIT: + h5tools_str_append(&buffer, "%s", NBIT); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + break; + case H5Z_FILTER_SCALEOFFSET: + h5tools_str_append(&buffer, "%s %s %s %d %s", SCALEOFFSET, BEGIN, SCALEOFFSET_MINBIT, cd_values[0], END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + break; + default: + if(H5Zfilter_avail(filtn)) + h5tools_str_append(&buffer, "%s %s", "USER_REGISTERED_FILTER", BEGIN); + else + h5tools_str_append(&buffer, "%s %s", "UNKNOWN_FILTER", BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "FILTER_ID %d", filtn); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + if(f_name[0] != '\0') { + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "COMMENT %s", f_name); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + if (cd_nelmts) { + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s ","PARAMS", BEGIN); + for (j=0; jindent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s",END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + break; + }/*switch*/ + } /*i*/ + }/*nfilters*/ + else { + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "NONE"); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s",END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + /*------------------------------------------------------------------------- + * FILLVALUE + *------------------------------------------------------------------------- + */ + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s", FILLVALUE, BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "FILL_TIME "); + + H5Pget_fill_time(dcpl_id, &ft); + switch(ft) { + case H5D_FILL_TIME_ALLOC: + h5tools_str_append(&buffer, "%s", "H5D_FILL_TIME_ALLOC"); + break; + case H5D_FILL_TIME_NEVER: + h5tools_str_append(&buffer, "%s", "H5D_FILL_TIME_NEVER"); + break; + case H5D_FILL_TIME_IFSET: + h5tools_str_append(&buffer, "%s", "H5D_FILL_TIME_IFSET"); + break; + default: + assert(0); + break; + } + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s ", "VALUE "); + H5Pfill_value_defined(dcpl_id, &fvstatus); + if(fvstatus == H5D_FILL_VALUE_UNDEFINED) + h5tools_str_append(&buffer, "%s", "H5D_FILL_VALUE_UNDEFINED"); + else { + ctx->indent_level--; + h5tools_print_fill_value(&buffer, info, ctx, dcpl_id, type_id, obj_id); + ctx->indent_level++; + } + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s", END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + /*------------------------------------------------------------------------- + * ALLOCATION_TIME + *------------------------------------------------------------------------- + */ + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "ALLOCATION_TIME %s", BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + H5Pget_alloc_time(dcpl_id, &at); + switch(at) { + case H5D_ALLOC_TIME_EARLY: + h5tools_str_append(&buffer, "%s", "H5D_ALLOC_TIME_EARLY"); + break; + case H5D_ALLOC_TIME_INCR: + h5tools_str_append(&buffer, "%s", "H5D_ALLOC_TIME_INCR"); + break; + case H5D_ALLOC_TIME_LATE: + h5tools_str_append(&buffer, "%s", "H5D_ALLOC_TIME_LATE"); + break; + default: + assert(0); + break; + } + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s", END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: dump_comment + * + * Purpose: prints the comment for the the object name + * + * Return: void + * + *------------------------------------------------------------------------- + */ +void +h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t obj_id) +{ + char *comment = NULL; + ssize_t cmt_bufsize = -1; + size_t buf_size = 0; + size_t ncols = 80; /* available output width */ + h5tools_str_t buffer; /* string into which to render */ + hsize_t elmt_counter = 0;/* counts the # elements printed.*/ + hsize_t curr_pos = ctx->sm_pos; /* total data element position */ + /* pass to the prefix in h5tools_simple_prefix the total position + * instead of the current stripmine position i; this is necessary + * to print the array indices + */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + if (info->line_ncols > 0) + ncols = info->line_ncols; + + cmt_bufsize = H5Oget_comment(obj_id, comment, buf_size); + + /* call H5Oget_comment again with the correct value. + * If the call to H5Oget_comment returned an error, skip this block */ + if (cmt_bufsize > 0) { + comment = (char *)HDmalloc((size_t)(cmt_bufsize+1)); /* new_size including null terminator */ + if(comment) { + cmt_bufsize = H5Oget_comment(obj_id, comment, cmt_bufsize); + if(cmt_bufsize > 0) { + comment[cmt_bufsize] = '\0'; /* necessary because null char is not returned */ + + ctx->need_prefix = TRUE; + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "COMMENT \"%s\"", comment); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + h5tools_str_close(&buffer); + } /* end if */ + HDfree(comment); + } + } +} /* end dump_comment() */ + +/*------------------------------------------------------------------------- + * Function: dump_attribute + * + * Purpose: Dump the attribute. + * + * Return: void + * + * In/Out: h5tools_context_t *ctx + *------------------------------------------------------------------------- + */ +void +h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t oid, const char *attr_name, hid_t attr_id, + int display_index, int display_char) +{ + h5tools_str_t buffer; /* string into which to render */ + size_t ncols = 80; /* available output width */ + hsize_t elmt_counter = 0;/* counts the # elements printed.*/ + hsize_t curr_pos = ctx->sm_pos; /* total data element position */ + /* pass to the prefix in h5tools_simple_prefix the total position + * instead of the current stripmine position i; this is necessary + * to print the array indices + */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + if (info->line_ncols > 0) + ncols = info->line_ncols; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->attributebegin, attr_name, + h5tools_dump_header_format->attributeblockbegin); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + if(attr_id < 0) { + error_msg("unable to open attribute \"%s\"\n", attr_name); + } + else { + hid_t type, space; + + ctx->indent_level++; + + type = H5Aget_type(attr_id); + h5tools_dump_datatype(stream, info, ctx, type); + + space = H5Aget_space(attr_id); + h5tools_dump_dataspace(stream, info, ctx, space); + + if(oid_output) + h5tools_dump_oid(stream, info, ctx, attr_id); + + if(data_output || attr_data_output) + h5tools_dump_data(stream, info, ctx, attr_id, FALSE, NULL, display_index, display_char); + + ctx->indent_level--; + + H5Tclose(type); + H5Sclose(space); + H5Aclose(attr_id); + } + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(&buffer); + + if (HDstrlen(h5tools_dump_header_format->attributeblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeblockend); + if (HDstrlen(h5tools_dump_header_format->attributeend)) + h5tools_str_append(&buffer, " "); + } + if (HDstrlen(h5tools_dump_header_format->attributeend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeend); + + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: dump_dims + * + * Purpose: Dump the dimensions handed to it in a comma separated list + * + * Return: void + * + * Programmer: Bill Wendling + * Tuesday, 27. February 2001 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +h5tools_print_dims(h5tools_str_t *buffer, hsize_t *s, int dims) +{ + int i; + + for (i = 0; i < dims; i++) { + h5tools_str_append(buffer, HSIZE_T_FORMAT, s[i]); + + if (i + 1 != dims) h5tools_str_append(buffer, ", "); + } +} + +/*------------------------------------------------------------------------- + * Function: print_packed_bits + * + * Purpose: Prints the packed bits offset and length + * + * Return: void + * + *------------------------------------------------------------------------- + */ +void +h5tools_print_packed_bits(h5tools_str_t *buffer, hid_t type) +{ + int packed_bits_size = 0; + + hid_t n_type = h5tools_get_native_type(type); + if(H5Tget_class(n_type)==H5T_INTEGER) { + if(H5Tequal(n_type, H5T_NATIVE_SCHAR) == TRUE) { + packed_bits_size = 8 * sizeof(char); + } + else if(H5Tequal(n_type, H5T_NATIVE_UCHAR) == TRUE) { + packed_bits_size = 8 * sizeof(unsigned char); + } + else if(H5Tequal(n_type, H5T_NATIVE_SHORT) == TRUE) { + packed_bits_size = 8 * sizeof(short); + } + else if(H5Tequal(n_type, H5T_NATIVE_USHORT) == TRUE) { + packed_bits_size = 8 * sizeof(unsigned short); + } + else if(H5Tequal(n_type, H5T_NATIVE_INT) == TRUE) { + packed_bits_size = 8 * sizeof(int); + } + else if(H5Tequal(n_type, H5T_NATIVE_UINT) == TRUE) { + packed_bits_size = 8 * sizeof(unsigned int); + } + else if(H5Tequal(n_type, H5T_NATIVE_LONG) == TRUE) { + packed_bits_size = 8 * sizeof(long); + } + else if(H5Tequal(n_type, H5T_NATIVE_ULONG) == TRUE) { + packed_bits_size = 8 * sizeof(unsigned long); + } + else if(H5Tequal(n_type, H5T_NATIVE_LLONG) == TRUE) { + packed_bits_size = 8 * sizeof(long long); + } + else if(H5Tequal(n_type, H5T_NATIVE_ULLONG) == TRUE) { + packed_bits_size = 8 * sizeof(unsigned long long); + } + else + error_msg("Packed Bit not valid for this datatype"); + } + + if ((packed_bits_size>0) && (packed_data_offset + packed_data_length) > packed_bits_size) { + error_msg("Packed Bit offset+length value(%d) too large. Max is %d\n", packed_data_offset+packed_data_length, packed_bits_size); + packed_data_mask = 0; + }; + h5tools_str_append(buffer, "%s %s=%d %s=%d", PACKED_BITS, PACKED_OFFSET, packed_data_offset, PACKED_LENGTH, packed_data_length); +} + +/*------------------------------------------------------------------------- + * Function: dump_subsetting_header + * + * Purpose: Dump the subsetting header like specified in the DDL. + * + * Return: void + * + * Programmer: Bill Wendling + * Tuesday, 27. February 2001 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, struct subset_t *sset, int dims) +{ + h5tools_str_t buffer; /* string into which to render */ + hsize_t curr_pos = 0; /* total data element position */ + size_t ncols = 80; /* available output width */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + if (info->line_ncols > 0) + ncols = info->line_ncols; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->subsettingbegin, h5tools_dump_header_format->subsettingblockbegin); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->startbegin, h5tools_dump_header_format->startblockbegin); + h5tools_print_dims(&buffer, sset->start.data, dims); + h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->startend, h5tools_dump_header_format->startblockend); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->stridebegin, h5tools_dump_header_format->strideblockbegin); + h5tools_print_dims(&buffer, sset->stride.data, dims); + h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->strideend, h5tools_dump_header_format->strideblockend); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->countbegin, h5tools_dump_header_format->countblockbegin); + + if(sset->count.data) + h5tools_print_dims(&buffer, sset->count.data, dims); + else + h5tools_str_append(&buffer, "DEFAULT"); + + h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->countend, h5tools_dump_header_format->countblockend); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->blockbegin, h5tools_dump_header_format->blockblockbegin); + + if(sset->block.data) + h5tools_print_dims(&buffer, sset->block.data, dims); + else + h5tools_str_append(&buffer, "DEFAULT"); + + h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->blockend, h5tools_dump_header_format->blockblockend); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level--; + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: dump_data + * + * Purpose: Dump attribute or dataset data + * + * Return: void + * + *------------------------------------------------------------------------- + */ +void +h5tools_dump_data(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t obj_id, int obj_data, struct subset_t *sset, + int display_index, int display_char) +{ + H5S_class_t space_type; + int ndims; + int i; + hid_t space; + hid_t type; + hid_t p_type; + hsize_t size[64]; + hsize_t alloc_size; + hsize_t nelmts = 1; + int status = -1; + void *buf = NULL; + h5tools_str_t buffer; /* string into which to render */ + hsize_t curr_pos = 0; /* total data element position */ + size_t ncols = 80; /* available output width */ + h5tool_format_t string_dataformat; + h5tool_format_t outputformat; + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + if (info->line_ncols > 0) + ncols = info->line_ncols; + + outputformat = *info; + string_dataformat = *info; + /* print the matrix indices */ + string_dataformat.pindex = display_index; + + /* do not print indices for regions */ + if(obj_data) { + hid_t f_type = H5Dget_type(obj_id); + + if (H5Tequal(f_type, H5T_STD_REF_DSETREG)) { + /* For the region option, correct the display of indices */ + if (region_output) { + if (!string_dataformat.pindex) { + string_dataformat.idx_fmt = ""; + string_dataformat.idx_n_fmt = ""; + string_dataformat.idx_sep = ""; + string_dataformat.line_pre = ""; + } + } + else + string_dataformat.pindex = 0; + } + H5Tclose(f_type); + } + + if (string_dataformat.pindex) { + string_dataformat.idx_fmt = "(%s): "; + string_dataformat.idx_n_fmt = HSIZE_T_FORMAT; + string_dataformat.idx_sep = ","; + string_dataformat.line_pre = "%s"; + } + info = &string_dataformat; + + if (sset && obj_data) { + hid_t f_space = H5Dget_space(obj_id); + + h5tools_dump_subsetting_header(stream, &outputformat, ctx, sset, H5Sget_simple_extent_ndims(f_space)); + H5Sclose(f_space); + + ctx->indent_level++; + } + + ctx->need_prefix = TRUE; + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->databegin, h5tools_dump_header_format->datablockbegin); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + + /* Print all the values. */ + if(obj_data) { + h5tools_context_t datactx = *ctx; /* print context */ + hid_t f_type = H5Dget_type(obj_id); + + if((display_char && H5Tget_size(f_type) == 1) && (H5Tget_class(f_type) == H5T_INTEGER)) { + /* + * Print 1-byte integer data as an ASCII character string + * instead of integers if the `-r' or `--string' command-line + * option was given. + * + * We don't want to modify the global dataformat, so make a + * copy of it instead. + */ + string_dataformat = *info; + string_dataformat.idx_fmt = "\""; + info = &string_dataformat; + datactx.indent_level++; + datactx.need_prefix = TRUE; + h5tools_simple_prefix(stream, info, &datactx, 0, 0); + + string_dataformat = *info; + string_dataformat.idx_fmt = "\""; + string_dataformat.line_multi_new = 1; + string_dataformat.str_repeat = 8; + string_dataformat.ascii = TRUE; + string_dataformat.elmt_suf1 = ""; + string_dataformat.elmt_suf2 = ""; + string_dataformat.line_suf = "\""; + info = &string_dataformat; + } + else + datactx.need_prefix = TRUE; + status = h5tools_dump_dset(stream, info, &datactx, obj_id, -1, sset); + if((display_char && H5Tget_size(f_type) == 1) && (H5Tget_class(f_type) == H5T_INTEGER)) { + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\""); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + H5Tclose(f_type); + } + else { + h5tools_context_t datactx = *ctx; /* print context */ + /* need to call h5tools_dump_mem for the attribute data */ + space = H5Aget_space(obj_id); + space_type = H5Sget_simple_extent_type(space); + if(space_type == H5S_NULL || space_type == H5S_NO_CLASS) { + status = SUCCEED; + } + else { + char string_prefix[64]; + /* VL data special information */ + unsigned int vl_data = 0; /* contains VL datatypes */ + + type = H5Aget_type(obj_id); + p_type = h5tools_get_native_type(type); + + ndims = H5Sget_simple_extent_dims(space, size, NULL); + + /* Check if we have VL data in the dataset's datatype */ + if (h5tools_detect_vlen_str(p_type) == TRUE) + vl_data = TRUE; + if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) + vl_data = TRUE; + + for (i = 0; i < ndims; i++) + nelmts *= size[i]; + + alloc_size = nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)); + assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ + + if(alloc_size) { + buf = malloc((size_t)alloc_size); + assert(buf); + + if (H5Aread(obj_id, p_type, buf) >= 0) + if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) { + /* + * Print 1-byte integer data as an ASCII character string + * instead of integers if the `-r' or `--string' command-line + * option was given. + * + * We don't want to modify the global dataformat, so make a + * copy of it instead. + */ + string_dataformat = *info; + string_dataformat.idx_fmt = "\""; + info = &string_dataformat; + datactx.indent_level++; + datactx.need_prefix = TRUE; + h5tools_simple_prefix(stream, info, &datactx, 0, 0); + + string_dataformat = *info; + string_dataformat.idx_fmt = "\""; + string_dataformat.line_multi_new = 1; + string_dataformat.str_repeat = 8; + string_dataformat.ascii = TRUE; + string_dataformat.elmt_suf1 = ""; + string_dataformat.elmt_suf2 = ""; + string_dataformat.line_suf = "\""; + info = &string_dataformat; + } + else + datactx.need_prefix = TRUE; + + status = h5tools_dump_mem(stream, info, &datactx, obj_id, p_type, space, buf); + if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) { + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\""); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + + /* Reclaim any VL memory, if necessary */ + if (vl_data) + H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf); + + free(buf); + } + else + status = SUCCEED; + + H5Tclose(p_type); + H5Tclose(type); + } + H5Sclose(space); + } + + if (status == FAIL) { + error_msg("unable to print data\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, &outputformat, ctx, 0, 0); + + h5tools_str_reset(&buffer); + if(strlen(h5tools_dump_header_format->datablockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datablockend); + if(strlen(h5tools_dump_header_format->dataend)) + h5tools_str_append(&buffer, " "); + } + if(strlen(h5tools_dump_header_format->dataend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->dataend); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + + if (sset && obj_data) { + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, &outputformat, ctx, 0, 0); + + h5tools_str_reset(&buffer); + if(strlen(h5tools_dump_header_format->subsettingblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->subsettingblockend); + if(strlen(h5tools_dump_header_format->subsettingend)) + h5tools_str_append(&buffer, " "); + } + if(strlen(h5tools_dump_header_format->subsettingend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->subsettingend); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + + h5tools_str_close(&buffer); +} + diff --git a/tools/lib/h5tools_dump.h b/tools/lib/h5tools_dump.h new file mode 100644 index 0000000..c94d0e1 --- /dev/null +++ b/tools/lib/h5tools_dump.h @@ -0,0 +1,85 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Support h5dump functions for the various tools. + */ +#ifndef H5TOOLS_DUMP_H__ +#define H5TOOLS_DUMP_H__ + +#include "h5tools_utils.h" + +/* 3 private values: can't be set, but can be read. + Note: these are defined in H5Zprivate, they are + duplicated here. + */ +#define H5_SZIP_LSB_OPTION_MASK 8 +#define H5_SZIP_MSB_OPTION_MASK 16 +#define H5_SZIP_RAW_OPTION_MASK 128 + +#ifdef __cplusplus +extern "C" { +#endif + +H5TOOLS_DLLVAR table_t *h5dump_type_table; /*type table reference for datatype dump */ + +/* Definitions of useful routines */ +H5TOOLS_DLL void h5tools_dump_init(void); + +H5TOOLS_DLL int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, hid_t dset, + hid_t p_typ, struct subset_t *sset); +H5TOOLS_DLL int h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, hid_t obj_id, + hid_t type, hid_t space, void *mem); +H5TOOLS_DLL void h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container, + h5tools_context_t *ctx/*in,out*/, unsigned flags, + hsize_t nelmts, hid_t type, void *_mem); +H5TOOLS_DLL void h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, hid_t type); +H5TOOLS_DLL void h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, hid_t space); +H5TOOLS_DLL void h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, hid_t oid, const char *attr_name, + hid_t attr_id, int display_index, int display_char); +H5TOOLS_DLL void h5tools_dump_oid(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, hid_t oid); +H5TOOLS_DLL void h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, hid_t dcpl, hid_t type_id, hid_t obj_id); +H5TOOLS_DLL void h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, hid_t obj_id); +H5TOOLS_DLL void h5tools_dump_data(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t obj_id, + int obj_data, struct subset_t *sset, int display_index, int display_char); + +H5TOOLS_DLL int h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer/*in,out*/, + const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + hid_t type, int object_search); +H5TOOLS_DLL int h5tools_print_dataspace(FILE *stream, h5tools_str_t *buffer/*in,out*/, + const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + hid_t space); +H5TOOLS_DLL int h5tools_print_enum(FILE *stream, h5tools_str_t *buffer/*in,out*/, + const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + hid_t type); +H5TOOLS_DLL void h5tools_print_fill_value(h5tools_str_t *buffer/*in,out*/, + const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + hid_t dcpl, hid_t type_id, hid_t obj_id); +H5TOOLS_DLL void h5tools_print_packed_bits(h5tools_str_t *buffer/*in,out*/, hid_t type); +#ifdef __cplusplus +} +#endif + +#endif /* H5TOOLS_DUMP_H__ */ + diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 205dffe..299f5bf 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -610,6 +610,32 @@ h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, char ch) } } } +void +h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info, + h5tools_context_t *ctx) +{ + int i, indentlevel = 0; + + /* Write new prefix */ + if (ctx->indent_level >= 0) { + indentlevel = ctx->indent_level; + } + else { + /* + * This is because sometimes we don't print out all the header + * info for the data (like the tattr-2.ddl example). If that happens + * the ctx->indent_level is negative so we need to skip the above and + * just print out the default indent levels. + */ + indentlevel = ctx->default_indent_level; + } + + for (i = 0; i < indentlevel; i++) { + h5tools_str_append(str, "%s", OPT(info->line_indent, "")); + } + +// ctx->need_prefix = 0; +} /*------------------------------------------------------------------------- * Function: h5tools_str_sprint @@ -951,25 +977,17 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai nmembs = H5Tget_nmembers(type); h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{")); + ctx->indent_level++; + for (j = 0; j < nmembs; j++) { if (j) - h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", " OPTIONAL_LINE_BREAK)); - - /* RPM 2000-10-31 - * If the previous character is a line-feed (which is true when - * h5dump is running) then insert some white space for - * indentation. Be warned that column number calculations will be - * incorrect and that object indices at the beginning of the line - * will be missing (h5dump doesn't display them anyway). */ - if (ctx->indent_level >= 0 && str->len && str->s[str->len - 1] == '\n') { - int x; - - h5tools_str_append(str, OPT(info->line_pre, ""), ""); - - for (x = 0; x < ctx->indent_level + 1; x++) - h5tools_str_append(str, "%s", OPT(info->line_indent, "")); - } + h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", "OPTIONAL_LINE_BREAK)); + else + h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); + if(info->arr_linebreak) + h5tools_str_indent(str, info, ctx); + /* The name */ name = H5Tget_member_name(type, j); h5tools_str_append(str, OPT(info->cmpd_name, ""), name); @@ -979,31 +997,19 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai offset = H5Tget_member_offset(type, j); memb = H5Tget_member_type(type, j); - ctx->indent_level++; h5tools_str_sprint(str, info, container, memb, cp_vp + offset, ctx); - ctx->indent_level--; H5Tclose(memb); } + ctx->indent_level--; - /* RPM 2000-10-31 - * If the previous character is a line feed (which is true when - * h5dump is running) then insert some white space for indentation. - * Be warned that column number calculations will be incorrect and - * that object indices at the beginning of the line will be missing - * (h5dump doesn't display them anyway). */ - h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); - - if (ctx->indent_level >= 0 && str->len && str->s[str->len - 1] == '\n') { - int x; - - h5tools_str_append(str, OPT(info->line_pre, ""), ""); - for (x = 0; x < ctx->indent_level; x++) - h5tools_str_append(str, "%s", OPT(info->line_indent, "")); + if(info->arr_linebreak) { + h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); + h5tools_str_indent(str, info, ctx); } - h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}")); + } else if (H5Tget_class(type) == H5T_ENUM) { char enum_name[1024]; @@ -1084,7 +1090,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai else if (H5Tget_class(type) == H5T_ARRAY) { int k, ndims; hsize_t i, dims[H5S_MAX_RANK], temp_nelmts; - static int is_next_arry_elmt=0; + static int is_next_arry_elmt = 0; /* Get the array's base datatype for each element */ memb = H5Tget_super(type); @@ -1103,6 +1109,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai /* Print the opening bracket */ h5tools_str_append(str, "%s", OPT(info->arr_pre, "[")); + ctx->indent_level++; + for (i = 0; i < nelmts; i++) { if (i) h5tools_str_append(str, "%s", OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK)); @@ -1111,14 +1119,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai int x; h5tools_str_append(str, "%s", "\n"); + h5tools_str_indent(str, info, ctx); - /* need to indent some more here*/ - if (ctx->indent_level >= 0) - if (!info->pindex) - h5tools_str_append(str, "%s", OPT(info->line_pre, "")); - - for (x = 0; x < ctx->indent_level + 1; x++) - h5tools_str_append(str, "%s", OPT(info->line_indent, "")); } /* end if */ else if (i && info->arr_sep) { /* if next element begin, add next line with indent */ @@ -1127,13 +1129,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai is_next_arry_elmt = 0; h5tools_str_append(str, "%s", "\n "); + h5tools_str_indent(str, info, ctx); - if (ctx->indent_level >= 0) - if (!info->pindex) - h5tools_str_append(str, "%s", OPT(info->line_pre, "")); - - for (x = 0; x < ctx->indent_level + 1; x++) - h5tools_str_append(str, "%s", OPT(info->line_indent, "")); } /* otherwise just add space */ else @@ -1141,15 +1138,13 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } /* end else if */ - ctx->indent_level++; - /* Dump values in an array element */ is_next_arry_elmt = 0; /* dump all values in the array element, so turn it off */ h5tools_str_sprint(str, info, container, memb, cp_vp + i * size, ctx); - - ctx->indent_level--; } /* end for */ + ctx->indent_level--; + /* Print the closing bracket */ h5tools_str_append(str, "%s", OPT(info->arr_suf, "]")); is_next_arry_elmt = 1; /* set for begining of next array element */ diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 3f89572..4d7b88e 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -33,8 +33,7 @@ #include "h5trav.h" /* global variables */ -int nCols = 80; - +int h5tools_nCols = 80; /* ``get_option'' variables */ int opt_err = 1; /*get_option prints errors if this is on */ int opt_ind = 1; /*token pointer */ @@ -393,7 +392,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti void indentation(int x) { - if (x < nCols) { + if (x < h5tools_nCols) { while (x-- > 0) printf(" "); } else { diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index 0f3acd1..3e628e2 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -29,19 +29,13 @@ extern "C" { #endif /* ``parallel_print'' information */ -#define PRINT_DATA_MAX_SIZE 512 -#define OUTBUFF_SIZE (PRINT_DATA_MAX_SIZE*4) +#define PRINT_DATA_MAX_SIZE 512 +#define OUTBUFF_SIZE (PRINT_DATA_MAX_SIZE*4) /* Maximum size used in a call to malloc for a dataset */ H5TOOLS_DLLVAR hsize_t H5TOOLS_MALLOCSIZE; /* size of hyperslab buffer when a dataset is bigger than H5TOOLS_MALLOCSIZE */ H5TOOLS_DLLVAR hsize_t H5TOOLS_BUFSIZE; -H5TOOLS_DLLVAR int g_nTasks; -H5TOOLS_DLLVAR unsigned char g_Parallel; -H5TOOLS_DLLVAR char outBuff[]; -H5TOOLS_DLLVAR int outBuffOffset; -H5TOOLS_DLLVAR FILE * overflow_file; - /* * begin get_option section */ @@ -51,7 +45,7 @@ H5TOOLS_DLLVAR const char *opt_arg; /* flag argument (or value) enum { no_arg = 0, /* doesn't take an argument */ - require_arg, /* requires an argument */ + require_arg, /* requires an argument */ optional_arg /* argument is optional */ }; @@ -62,23 +56,23 @@ enum { * the option. The long options are specified in the following way: * * struct long_options foo[] = { - * { "filename", require_arg, 'f' }, - * { "append", no_arg, 'a' }, - * { "width", require_arg, 'w' }, - * { NULL, 0, 0 } + * { "filename", require_arg, 'f' }, + * { "append", no_arg, 'a' }, + * { "width", require_arg, 'w' }, + * { NULL, 0, 0 } * }; * * Long named options can have arguments specified as either: * - * ``--param=arg'' or ``--param arg'' + * ``--param=arg'' or ``--param arg'' * * Short named options can have arguments specified as either: * - * ``-w80'' or ``-w 80'' + * ``-w80'' or ``-w 80'' * * and can have more than one short named option specified at one time: * - * -aw80 + * -aw80 * * in which case those options which expect an argument need to come at the * end. @@ -119,7 +113,7 @@ typedef struct find_objs_t { table_t *dset_table; } find_objs_t; -H5TOOLS_DLLVAR int nCols; /*max number of columns for outputting */ +H5TOOLS_DLLVAR int h5tools_nCols; /*max number of columns for outputting */ /* Definitions of useful routines */ H5TOOLS_DLL void indentation(int); @@ -136,7 +130,7 @@ H5TOOLS_DLL herr_t init_objs(hid_t fid, find_objs_t *info, table_t **group_table table_t **dset_table, table_t **type_table); H5TOOLS_DLL obj_t *search_obj(table_t *temp, haddr_t objno); #ifndef H5_HAVE_TMPFILE -H5TOOLS_DLL FILE * tmpfile(void); +H5TOOLS_DLL FILE * tmpfile(void); #endif /************************************************************* @@ -178,4 +172,4 @@ H5TOOLS_DLL int h5tools_getenv_update_hyperslab_bufsize(void); } #endif -#endif /* H5TOOLS_UTILS_H__ */ +#endif /* H5TOOLS_UTILS_H__ */ diff --git a/tools/lib/ph5diff.h b/tools/lib/ph5diff.h index becbd6c..b098082 100644 --- a/tools/lib/ph5diff.h +++ b/tools/lib/ph5diff.h @@ -30,6 +30,12 @@ #define MPI_TAG_END 7 #define MPI_TAG_PARALLEL 8 +H5TOOLS_DLLVAR int g_nTasks; +H5TOOLS_DLLVAR unsigned char g_Parallel; +H5TOOLS_DLLVAR char outBuff[]; +H5TOOLS_DLLVAR int outBuffOffset; +H5TOOLS_DLLVAR FILE * overflow_file; + struct diff_mpi_args { char name1[256]; diff --git a/tools/testfiles/file_space.ddl b/tools/testfiles/file_space.ddl index d278018..bed5349 100644 --- a/tools/testfiles/file_space.ddl +++ b/tools/testfiles/file_space.ddl @@ -11,9 +11,9 @@ SUPER_BLOCK { ISTORE_K 32 FILE_SPACE_STRATEGY H5F_FILE_SPACE_AGGR_VFD FREE_SPACE_THRESHOLD 10 -} -USER_BLOCK { - USERBLOCK_SIZE 0 + USER_BLOCK { + USERBLOCK_SIZE 0 + } } GROUP "/" { } diff --git a/tools/testfiles/filter_fail.ddl b/tools/testfiles/filter_fail.ddl index 1bb65ba..9cc2de5 100644 --- a/tools/testfiles/filter_fail.ddl +++ b/tools/testfiles/filter_fail.ddl @@ -4,7 +4,7 @@ GROUP "/" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 10 ) / ( 10 ) } DATA { - } + } } } } diff --git a/tools/testfiles/tall-2A.h5.xml b/tools/testfiles/tall-2A.h5.xml index a2da338..d118a69 100644 --- a/tools/testfiles/tall-2A.h5.xml +++ b/tools/testfiles/tall-2A.h5.xml @@ -14,7 +14,16 @@ - 97 98 99 100 101 102 103 104 105 0 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 0 @@ -32,8 +41,10 @@ - 0 1 - 2 3 + 0 + 1 + 2 + 3 @@ -43,9 +54,9 @@ - + - + @@ -72,8 +83,33 @@ - 49 115 116 32 97 116 116 114 105 98 117 116 101 32 111 102 32 - 100 115 101 116 49 46 49 46 49 0 + 49 + 115 + 116 + 32 + 97 + 116 + 116 + 114 + 105 + 98 + 117 + 116 + 101 + 32 + 111 + 102 + 32 + 100 + 115 + 101 + 116 + 49 + 46 + 49 + 46 + 49 + 0 @@ -90,8 +126,33 @@ - 50 110 100 32 97 116 116 114 105 98 117 116 101 32 111 102 32 - 100 115 101 116 49 46 49 46 49 0 + 50 + 110 + 100 + 32 + 97 + 116 + 116 + 114 + 105 + 98 + 117 + 116 + 101 + 32 + 111 + 102 + 32 + 100 + 115 + 101 + 116 + 49 + 46 + 49 + 46 + 49 + 0 @@ -103,9 +164,9 @@ - + - + @@ -135,9 +196,9 @@ - + - + @@ -158,9 +219,9 @@ - + - + diff --git a/tools/testfiles/tall-2B.ddl b/tools/testfiles/tall-2B.ddl index c9313b7..dc8aab7 100644 --- a/tools/testfiles/tall-2B.ddl +++ b/tools/testfiles/tall-2B.ddl @@ -24,14 +24,14 @@ GROUP "/" { DATATYPE H5T_STD_I8BE DATASPACE SIMPLE { ( 27 ) / ( 27 ) } DATA { - "1st attribute of dset1.1.1\000" + "1st attribute of dset1.1.1\000" } } ATTRIBUTE "attr2" { DATATYPE H5T_STD_I8BE DATASPACE SIMPLE { ( 27 ) / ( 27 ) } DATA { - "2nd attribute of dset1.1.1\000" + "2nd attribute of dset1.1.1\000" } } } diff --git a/tools/testfiles/tall.h5.xml b/tools/testfiles/tall.h5.xml index 0ab7e29..a74ccbe 100644 --- a/tools/testfiles/tall.h5.xml +++ b/tools/testfiles/tall.h5.xml @@ -14,7 +14,16 @@ - 97 98 99 100 101 102 103 104 105 0 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 0 @@ -32,8 +41,10 @@ - 0 1 - 2 3 + 0 + 1 + 2 + 3 @@ -43,9 +54,9 @@ - + - + @@ -72,8 +83,33 @@ - 49 115 116 32 97 116 116 114 105 98 117 116 101 32 111 102 32 - 100 115 101 116 49 46 49 46 49 0 + 49 + 115 + 116 + 32 + 97 + 116 + 116 + 114 + 105 + 98 + 117 + 116 + 101 + 32 + 111 + 102 + 32 + 100 + 115 + 101 + 116 + 49 + 46 + 49 + 46 + 49 + 0 @@ -90,23 +126,138 @@ - 50 110 100 32 97 116 116 114 105 98 117 116 101 32 111 102 32 - 100 115 101 116 49 46 49 46 49 0 + 50 + 110 + 100 + 32 + 97 + 116 + 116 + 114 + 105 + 98 + 117 + 116 + 101 + 32 + 111 + 102 + 32 + 100 + 115 + 101 + 116 + 49 + 46 + 49 + 46 + 49 + 0 - 0 0 0 0 0 0 0 0 0 0 - 0 1 2 3 4 5 6 7 8 9 - 0 2 4 6 8 10 12 14 16 18 - 0 3 6 9 12 15 18 21 24 27 - 0 4 8 12 16 20 24 28 32 36 - 0 5 10 15 20 25 30 35 40 45 - 0 6 12 18 24 30 36 42 48 54 - 0 7 14 21 28 35 42 49 56 63 - 0 8 16 24 32 40 48 56 64 72 - 0 9 18 27 36 45 54 63 72 81 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 2 + 4 + 6 + 8 + 10 + 12 + 14 + 16 + 18 + 0 + 3 + 6 + 9 + 12 + 15 + 18 + 21 + 24 + 27 + 0 + 4 + 8 + 12 + 16 + 20 + 24 + 28 + 32 + 36 + 0 + 5 + 10 + 15 + 20 + 25 + 30 + 35 + 40 + 45 + 0 + 6 + 12 + 18 + 24 + 30 + 36 + 42 + 48 + 54 + 0 + 7 + 14 + 21 + 28 + 35 + 42 + 49 + 56 + 63 + 0 + 8 + 16 + 24 + 32 + 40 + 48 + 56 + 64 + 72 + 0 + 9 + 18 + 27 + 36 + 45 + 54 + 63 + 72 + 81 @@ -114,9 +265,9 @@ - + - + @@ -131,7 +282,26 @@ - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 @@ -148,9 +318,9 @@ - + - + @@ -165,7 +335,16 @@ - 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 + 1 + 1.1 + 1.2 + 1.3 + 1.4 + 1.5 + 1.6 + 1.7 + 1.8 + 1.9 @@ -173,9 +352,9 @@ - + - + @@ -191,9 +370,21 @@ - 0 0.1 0.2 0.3 0.4 - 0 0.2 0.4 0.6 0.8 - 0 0.3 0.6 0.9 1.2 + 0 + 0.1 + 0.2 + 0.3 + 0.4 + 0 + 0.2 + 0.4 + 0.6 + 0.8 + 0 + 0.3 + 0.6 + 0.9 + 1.2 diff --git a/tools/testfiles/tallfilters.ddl b/tools/testfiles/tallfilters.ddl index c8e7b5f..ac6762a 100644 --- a/tools/testfiles/tallfilters.ddl +++ b/tools/testfiles/tallfilters.ddl @@ -5,7 +5,7 @@ DATASET "all" { STORAGE_LAYOUT { CHUNKED ( 10, 5 ) SIZE 458 (1.747:1 COMPRESSION) - } + } FILTERS { PREPROCESSING SHUFFLE COMPRESSION SZIP { @@ -21,7 +21,7 @@ DATASET "all" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tarray1.h5.xml b/tools/testfiles/tarray1.h5.xml index 01aeb3c..86db36f 100644 --- a/tools/testfiles/tarray1.h5.xml +++ b/tools/testfiles/tarray1.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -27,7 +27,10 @@ - 0 1 2 3 10 11 12 13 20 21 22 23 30 31 32 33 + 0 1 2 3 + 10 11 12 13 + 20 21 22 23 + 30 31 32 33 diff --git a/tools/testfiles/tarray2.h5.xml b/tools/testfiles/tarray2.h5.xml index ca253ae..7f89b9b 100644 --- a/tools/testfiles/tarray2.h5.xml +++ b/tools/testfiles/tarray2.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -29,54 +29,10 @@ - 0 1 2 3 4 - 10 11 12 13 14 - 20 21 22 23 24 - 30 31 32 33 34 - 100 101 102 103 104 - 110 111 112 113 114 - 120 121 122 123 124 - 130 131 132 133 134 - 200 201 202 203 204 - 210 211 212 213 214 - 220 221 222 223 224 - 230 231 232 233 234 - 1000 1001 1002 1003 1004 - 1010 1011 1012 1013 1014 - 1020 1021 1022 1023 1024 - 1030 1031 1032 1033 1034 - 1100 1101 1102 1103 1104 - 1110 1111 1112 1113 1114 - 1120 1121 1122 1123 1124 - 1130 1131 1132 1133 1134 - 1200 1201 1202 1203 1204 - 1210 1211 1212 1213 1214 - 1220 1221 1222 1223 1224 - 1230 1231 1232 1233 1234 - 2000 2001 2002 2003 2004 - 2010 2011 2012 2013 2014 - 2020 2021 2022 2023 2024 - 2030 2031 2032 2033 2034 - 2100 2101 2102 2103 2104 - 2110 2111 2112 2113 2114 - 2120 2121 2122 2123 2124 - 2130 2131 2132 2133 2134 - 2200 2201 2202 2203 2204 - 2210 2211 2212 2213 2214 - 2220 2221 2222 2223 2224 - 2230 2231 2232 2233 2234 - 3000 3001 3002 3003 3004 - 3010 3011 3012 3013 3014 - 3020 3021 3022 3023 3024 - 3030 3031 3032 3033 3034 - 3100 3101 3102 3103 3104 - 3110 3111 3112 3113 3114 - 3120 3121 3122 3123 3124 - 3130 3131 3132 3133 3134 - 3200 3201 3202 3203 3204 - 3210 3211 3212 3213 3214 - 3220 3221 3222 3223 3224 - 3230 3231 3232 3233 3234 + 0 1 2 3 4 10 11 12 13 14 20 21 22 23 24 30 31 32 33 34 100 101 102 103 104 110 111 112 113 114 120 121 122 123 124 130 131 132 133 134 200 201 202 203 204 210 211 212 213 214 220 221 222 223 224 230 231 232 233 234 + 1000 1001 1002 1003 1004 1010 1011 1012 1013 1014 1020 1021 1022 1023 1024 1030 1031 1032 1033 1034 1100 1101 1102 1103 1104 1110 1111 1112 1113 1114 1120 1121 1122 1123 1124 1130 1131 1132 1133 1134 1200 1201 1202 1203 1204 1210 1211 1212 1213 1214 1220 1221 1222 1223 1224 1230 1231 1232 1233 1234 + 2000 2001 2002 2003 2004 2010 2011 2012 2013 2014 2020 2021 2022 2023 2024 2030 2031 2032 2033 2034 2100 2101 2102 2103 2104 2110 2111 2112 2113 2114 2120 2121 2122 2123 2124 2130 2131 2132 2133 2134 2200 2201 2202 2203 2204 2210 2211 2212 2213 2214 2220 2221 2222 2223 2224 2230 2231 2232 2233 2234 + 3000 3001 3002 3003 3004 3010 3011 3012 3013 3014 3020 3021 3022 3023 3024 3030 3031 3032 3033 3034 3100 3101 3102 3103 3104 3110 3111 3112 3113 3114 3120 3121 3122 3123 3124 3130 3131 3132 3133 3134 3200 3201 3202 3203 3204 3210 3211 3212 3213 3214 3220 3221 3222 3223 3224 3230 3231 3232 3233 3234 diff --git a/tools/testfiles/tarray3.h5.xml b/tools/testfiles/tarray3.h5.xml index fb1ed07..0b74db8 100644 --- a/tools/testfiles/tarray3.h5.xml +++ b/tools/testfiles/tarray3.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -33,102 +33,22 @@ - 0 1 2 - 10 11 12 - 20 21 22 - 30 31 32 - 40 41 42 - 50 51 52 - 100 101 102 - 110 111 112 - 120 121 122 - 130 131 132 - 140 141 142 - 150 151 152 - 200 201 202 - 210 211 212 - 220 221 222 - 230 231 232 - 240 241 242 - 250 251 252 - 300 301 302 - 310 311 312 - 320 321 322 - 330 331 332 - 340 341 342 - 350 351 352 - 1000 1001 1002 - 1010 1011 1012 - 1020 1021 1022 - 1030 1031 1032 - 1040 1041 1042 - 1050 1051 1052 - 1100 1101 1102 - 1110 1111 1112 - 1120 1121 1122 - 1130 1131 1132 - 1140 1141 1142 - 1150 1151 1152 - 1200 1201 1202 - 1210 1211 1212 - 1220 1221 1222 - 1230 1231 1232 - 1240 1241 1242 - 1250 1251 1252 - 1300 1301 1302 - 1310 1311 1312 - 1320 1321 1322 - 1330 1331 1332 - 1340 1341 1342 - 1350 1351 1352 - 2000 2001 2002 - 2010 2011 2012 - 2020 2021 2022 - 2030 2031 2032 - 2040 2041 2042 - 2050 2051 2052 - 2100 2101 2102 - 2110 2111 2112 - 2120 2121 2122 - 2130 2131 2132 - 2140 2141 2142 - 2150 2151 2152 - 2200 2201 2202 - 2210 2211 2212 - 2220 2221 2222 - 2230 2231 2232 - 2240 2241 2242 - 2250 2251 2252 - 2300 2301 2302 - 2310 2311 2312 - 2320 2321 2322 - 2330 2331 2332 - 2340 2341 2342 - 2350 2351 2352 - 3000 3001 3002 - 3010 3011 3012 - 3020 3021 3022 - 3030 3031 3032 - 3040 3041 3042 - 3050 3051 3052 - 3100 3101 3102 - 3110 3111 3112 - 3120 3121 3122 - 3130 3131 3132 - 3140 3141 3142 - 3150 3151 3152 - 3200 3201 3202 - 3210 3211 3212 - 3220 3221 3222 - 3230 3231 3232 - 3240 3241 3242 - 3250 3251 3252 - 3300 3301 3302 - 3310 3311 3312 - 3320 3321 3322 - 3330 3331 3332 - 3340 3341 3342 - 3350 3351 3352 + 0 1 2 10 11 12 20 21 22 30 31 32 40 41 42 50 51 52 + 100 101 102 110 111 112 120 121 122 130 131 132 140 141 142 150 151 152 + 200 201 202 210 211 212 220 221 222 230 231 232 240 241 242 250 251 252 + 300 301 302 310 311 312 320 321 322 330 331 332 340 341 342 350 351 352 + 1000 1001 1002 1010 1011 1012 1020 1021 1022 1030 1031 1032 1040 1041 1042 1050 1051 1052 + 1100 1101 1102 1110 1111 1112 1120 1121 1122 1130 1131 1132 1140 1141 1142 1150 1151 1152 + 1200 1201 1202 1210 1211 1212 1220 1221 1222 1230 1231 1232 1240 1241 1242 1250 1251 1252 + 1300 1301 1302 1310 1311 1312 1320 1321 1322 1330 1331 1332 1340 1341 1342 1350 1351 1352 + 2000 2001 2002 2010 2011 2012 2020 2021 2022 2030 2031 2032 2040 2041 2042 2050 2051 2052 + 2100 2101 2102 2110 2111 2112 2120 2121 2122 2130 2131 2132 2140 2141 2142 2150 2151 2152 + 2200 2201 2202 2210 2211 2212 2220 2221 2222 2230 2231 2232 2240 2241 2242 2250 2251 2252 + 2300 2301 2302 2310 2311 2312 2320 2321 2322 2330 2331 2332 2340 2341 2342 2350 2351 2352 + 3000 3001 3002 3010 3011 3012 3020 3021 3022 3030 3031 3032 3040 3041 3042 3050 3051 3052 + 3100 3101 3102 3110 3111 3112 3120 3121 3122 3130 3131 3132 3140 3141 3142 3150 3151 3152 + 3200 3201 3202 3210 3211 3212 3220 3221 3222 3230 3231 3232 3240 3241 3242 3250 3251 3252 + 3300 3301 3302 3310 3311 3312 3320 3321 3322 3330 3331 3332 3340 3341 3342 3350 3351 3352 diff --git a/tools/testfiles/tarray6.h5.xml b/tools/testfiles/tarray6.h5.xml index 96fc69e..628a342 100644 --- a/tools/testfiles/tarray6.h5.xml +++ b/tools/testfiles/tarray6.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -31,10 +31,10 @@ - 0 10 11 20 21 22 30 31 32 33 - 100 101 110 111 112 120 121 122 123 130 131 132 133 134 - 200 201 202 210 211 212 213 220 221 222 223 224 230 231 232 233 234 235 - 300 301 302 303 310 311 312 313 314 320 321 322 323 324 325 330 331 332 333 334 335 336 + 0 10 11 20 21 22 30 31 32 33 + 100 101 110 111 112 120 121 122 123 130 131 132 133 134 + 200 201 202 210 211 212 213 220 221 222 223 224 230 231 232 233 234 235 + 300 301 302 303 310 311 312 313 314 320 321 322 323 324 325 330 331 332 333 334 335 336 diff --git a/tools/testfiles/tarray7.h5.xml b/tools/testfiles/tarray7.h5.xml index 6a0558c..dbf5ec5 100644 --- a/tools/testfiles/tarray7.h5.xml +++ b/tools/testfiles/tarray7.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -36,22 +36,22 @@ - 0 1 2 3 - 100 101 102 103 110 111 112 113 - 200 201 202 203 210 211 212 213 220 221 222 223 - 300 301 302 303 310 311 312 313 320 321 322 323 330 331 332 333 - 1000 1001 1002 1003 1010 1011 1012 1013 - 1100 1101 1102 1103 1110 1111 1112 1113 1120 1121 1122 1123 - 1200 1201 1202 1203 1210 1211 1212 1213 1220 1221 1222 1223 1230 1231 1232 1233 - 1300 1301 1302 1303 1310 1311 1312 1313 1320 1321 1322 1323 1330 1331 1332 1333 1340 1341 1342 1343 - 2000 2001 2002 2003 2010 2011 2012 2013 2020 2021 2022 2023 - 2100 2101 2102 2103 2110 2111 2112 2113 2120 2121 2122 2123 2130 2131 2132 2133 - 2200 2201 2202 2203 2210 2211 2212 2213 2220 2221 2222 2223 2230 2231 2232 2233 2240 2241 2242 2243 - 2300 2301 2302 2303 2310 2311 2312 2313 2320 2321 2322 2323 2330 2331 2332 2333 2340 2341 2342 2343 2350 2351 2352 2353 - 3000 3001 3002 3003 3010 3011 3012 3013 3020 3021 3022 3023 3030 3031 3032 3033 - 3100 3101 3102 3103 3110 3111 3112 3113 3120 3121 3122 3123 3130 3131 3132 3133 3140 3141 3142 3143 - 3200 3201 3202 3203 3210 3211 3212 3213 3220 3221 3222 3223 3230 3231 3232 3233 3240 3241 3242 3243 3250 3251 3252 3253 - 3300 3301 3302 3303 3310 3311 3312 3313 3320 3321 3322 3323 3330 3331 3332 3333 3340 3341 3342 3343 3350 3351 3352 3353 3360 3361 3362 3363 + 0 1 2 3 + 100 101 102 103 110 111 112 113 + 200 201 202 203 210 211 212 213 220 221 222 223 + 300 301 302 303 310 311 312 313 320 321 322 323 330 331 332 333 + 1000 1001 1002 1003 1010 1011 1012 1013 + 1100 1101 1102 1103 1110 1111 1112 1113 1120 1121 1122 1123 + 1200 1201 1202 1203 1210 1211 1212 1213 1220 1221 1222 1223 1230 1231 1232 1233 + 1300 1301 1302 1303 1310 1311 1312 1313 1320 1321 1322 1323 1330 1331 1332 1333 1340 1341 1342 1343 + 2000 2001 2002 2003 2010 2011 2012 2013 2020 2021 2022 2023 + 2100 2101 2102 2103 2110 2111 2112 2113 2120 2121 2122 2123 2130 2131 2132 2133 + 2200 2201 2202 2203 2210 2211 2212 2213 2220 2221 2222 2223 2230 2231 2232 2233 2240 2241 2242 2243 + 2300 2301 2302 2303 2310 2311 2312 2313 2320 2321 2322 2323 2330 2331 2332 2333 2340 2341 2342 2343 2350 2351 2352 2353 + 3000 3001 3002 3003 3010 3011 3012 3013 3020 3021 3022 3023 3030 3031 3032 3033 + 3100 3101 3102 3103 3110 3111 3112 3113 3120 3121 3122 3123 3130 3131 3132 3133 3140 3141 3142 3143 + 3200 3201 3202 3203 3210 3211 3212 3213 3220 3221 3222 3223 3230 3231 3232 3233 3240 3241 3242 3243 3250 3251 3252 3253 + 3300 3301 3302 3303 3310 3311 3312 3313 3320 3321 3322 3323 3330 3331 3332 3333 3340 3341 3342 3343 3350 3351 3352 3353 3360 3361 3362 3363 diff --git a/tools/testfiles/tattr-1.ddl b/tools/testfiles/tattr-1.ddl index 540c973..d353577 100644 --- a/tools/testfiles/tattr-1.ddl +++ b/tools/testfiles/tattr-1.ddl @@ -31,11 +31,11 @@ GROUP "/" { } ATTRIBUTE "attr5" { DATATYPE H5T_STRING { - STRSIZE 17; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 17; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "string attribute" diff --git a/tools/testfiles/tattr-2.ddl b/tools/testfiles/tattr-2.ddl index e4d40bd..79ba8c3 100644 --- a/tools/testfiles/tattr-2.ddl +++ b/tools/testfiles/tattr-2.ddl @@ -16,11 +16,11 @@ ATTRIBUTE "/attr4" { } ATTRIBUTE "/attr5" { DATATYPE H5T_STRING { - STRSIZE 17; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 17; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "string attribute" diff --git a/tools/testfiles/tattr-3.ddl b/tools/testfiles/tattr-3.ddl index a44be10..4eee317 100644 --- a/tools/testfiles/tattr-3.ddl +++ b/tools/testfiles/tattr-3.ddl @@ -4,6 +4,6 @@ ATTRIBUTE "/attr2" { DATASPACE SIMPLE { ( 10 ) / ( 10 ) } } ATTRIBUTE "/attr" { - } } -h5dump error: unable to open attribute "/" +} +h5dump error: unable to open attribute "/attr" diff --git a/tools/testfiles/tattr-4_be.ddl b/tools/testfiles/tattr-4_be.ddl index 9f2c547..8b8076e 100644 --- a/tools/testfiles/tattr-4_be.ddl +++ b/tools/testfiles/tattr-4_be.ddl @@ -2,11 +2,11 @@ HDF5 "tattr4_be.h5" { GROUP "/" { ATTRIBUTE "attr0" { DATATYPE H5T_STRING { - STRSIZE 4; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 4; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "1234" @@ -14,11 +14,11 @@ GROUP "/" { } ATTRIBUTE "attr1" { DATATYPE H5T_STRING { - STRSIZE 4; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 4; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "1234" @@ -26,11 +26,11 @@ GROUP "/" { } ATTRIBUTE "attr2" { DATATYPE H5T_STRING { - STRSIZE 4; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 4; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "1234" @@ -38,11 +38,11 @@ GROUP "/" { } ATTRIBUTE "attr3" { DATATYPE H5T_STRING { - STRSIZE 4; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 4; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "1234" @@ -50,11 +50,11 @@ GROUP "/" { } ATTRIBUTE "attr4" { DATATYPE H5T_STRING { - STRSIZE 4; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 4; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "1234" @@ -62,11 +62,11 @@ GROUP "/" { } ATTRIBUTE "attr5" { DATATYPE H5T_STRING { - STRSIZE 4; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 4; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "1234" @@ -74,11 +74,11 @@ GROUP "/" { } ATTRIBUTE "attr6" { DATATYPE H5T_STRING { - STRSIZE 4; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 4; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "1234" @@ -86,11 +86,11 @@ GROUP "/" { } ATTRIBUTE "attr7" { DATATYPE H5T_STRING { - STRSIZE 4; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 4; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "1234" @@ -98,11 +98,11 @@ GROUP "/" { } ATTRIBUTE "attr8" { DATATYPE H5T_STRING { - STRSIZE 4; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 4; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "1234" diff --git a/tools/testfiles/tattr.h5.xml b/tools/testfiles/tattr.h5.xml index 2d6a6fd..57fa276 100644 --- a/tools/testfiles/tattr.h5.xml +++ b/tools/testfiles/tattr.h5.xml @@ -14,8 +14,30 @@ - 97 116 116 114 105 98 117 116 101 32 111 102 32 114 111 111 116 32 103 - 114 111 117 112 0 + 97 + 116 + 116 + 114 + 105 + 98 + 117 + 116 + 101 + 32 + 111 + 102 + 32 + 114 + 111 + 111 + 116 + 32 + 103 + 114 + 111 + 117 + 112 + 0 @@ -32,7 +54,16 @@ - 1 2 3 4 5 6 7 8 9 10 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 @@ -49,7 +80,16 @@ - 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 + 0 + 0.1 + 0.2 + 0.3 + 0.4 + 0.5 + 0.6 + 0.7 + 0.8 + 0.9 diff --git a/tools/testfiles/tattr2.ls b/tools/testfiles/tattr2.ls index eb7c739..3c87360 100644 --- a/tools/testfiles/tattr2.ls +++ b/tools/testfiles/tattr2.ls @@ -1,34 +1,54 @@ Opened "tattr2.h5" with sec2 driver. dset Dataset {2/2} - Attribute: array {2} + Attribute: array {2} Type: [3] 32-bit little-endian integer Data: [1,2,3], [4,5,6] - Attribute: array2D {3, 2} + Attribute: array2D {3, 2} Type: [3] 32-bit little-endian integer Data: - (0,0) [1,2,3], [4,5,6], [7,8,9], [10,11,12], [13,14,15], [16,17,18] - Attribute: array3D {4, 3, 2} + (0,0) [1,2,3], [4,5,6], + (1,0) [7,8,9], [10,11,12], + (2,0) [13,14,15], [16,17,18] + Attribute: array3D {4, 3, 2} Type: [3] 32-bit little-endian integer Data: - (0,0,0) [1,2,3], [4,5,6], [7,8,9], [10,11,12], [13,14,15], - (0,2,1) [16,17,18], [19,20,21], [22,23,24], [25,26,27], [28,29,30], - (1,2,0) [31,32,33], [34,35,36], [37,38,39], [40,41,42], [43,44,45], - (2,1,1) [46,47,48], [49,50,51], [52,53,54], [55,56,57], [58,59,60], - (3,1,0) [61,62,63], [64,65,66], [67,68,69], [70,71,72] - Attribute: bitfield {2} + (0,0,0) [1,2,3], [4,5,6], + (0,1,0) [7,8,9], [10,11,12], + (0,2,0) [13,14,15], [16,17,18], + (1,0,0) [19,20,21], [22,23,24], + (1,1,0) [25,26,27], [28,29,30], + (1,2,0) [31,32,33], [34,35,36], + (2,0,0) [37,38,39], [40,41,42], + (2,1,0) [43,44,45], [46,47,48], + (2,2,0) [49,50,51], [52,53,54], + (3,0,0) [55,56,57], [58,59,60], + (3,1,0) [61,62,63], [64,65,66], + (3,2,0) [67,68,69], [70,71,72] + Attribute: bitfield {2} Type: 8-bit bitfield Data: 0x01, 0x02 Attribute: bitfield2D {3, 2} Type: 8-bit bitfield Data: - (0,0) 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 + (0,0) 0x01, 0x02, + (1,0) 0x03, 0x04, + (2,0) 0x05, 0x06 Attribute: bitfield3D {4, 3, 2} Type: 8-bit bitfield Data: - (0,0,0) 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, - (1,2,0) 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, - (3,1,0) 0x15, 0x16, 0x17, 0x18 - Attribute: compound {2} + (0,0,0) 0x01, 0x02, + (0,1,0) 0x03, 0x04, + (0,2,0) 0x05, 0x06, + (1,0,0) 0x07, 0x08, + (1,1,0) 0x09, 0x0a, + (1,2,0) 0x0b, 0x0c, + (2,0,0) 0x0d, 0x0e, + (2,1,0) 0x0f, 0x10, + (2,2,0) 0x11, 0x12, + (3,0,0) 0x13, 0x14, + (3,1,0) 0x15, 0x16, + (3,2,0) 0x17, 0x18 + Attribute: compound {2} Type: struct { "a" +0 8-bit integer "b" +4 IEEE 64-bit little-endian float @@ -40,160 +60,264 @@ dset Dataset {2/2} "b" +4 IEEE 64-bit little-endian float } 12 bytes Data: - (0,0) {1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12} + (0,0) {1, 2}, {3, 4}, + (1,0) {5, 6}, {7, 8}, + (2,0) {9, 10}, {11, 12} Attribute: compound3D {4, 3, 2} Type: struct { "a" +0 8-bit integer "b" +4 IEEE 64-bit little-endian float } 12 bytes Data: - (0,0,0) {1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}, {13, - (1,0,0) 14}, {15, 16}, {17, 18}, {19, 20}, {21, 22}, {23, 24}, - (2,0,0) {25, 26}, {27, 28}, {29, 30}, {31, 32}, {33, 34}, {35, 36}, - (3,0,0) {37, 38}, {39, 40}, {41, 42}, {43, 44}, {45, 46}, {47, 48} - Attribute: enum {2} + (0,0,0) {1, 2}, {3, 4}, + (0,1,0) {5, 6}, {7, 8}, + (0,2,0) {9, 10}, {11, 12}, + (1,0,0) {13, 14}, {15, 16}, + (1,1,0) {17, 18}, {19, 20}, + (1,2,0) {21, 22}, {23, 24}, + (2,0,0) {25, 26}, {27, 28}, + (2,1,0) {29, 30}, {31, 32}, + (2,2,0) {33, 34}, {35, 36}, + (3,0,0) {37, 38}, {39, 40}, + (3,1,0) {41, 42}, {43, 44}, + (3,2,0) {45, 46}, {47, 48} + Attribute: enum {2} Type: enum 32-bit little-endian integer { RED = 0 GREEN = 1 } Data: RED, RED - Attribute: enum2D {3, 2} + Attribute: enum2D {3, 2} Type: enum 32-bit little-endian integer { RED = 0 GREEN = 1 } Data: - (0,0) RED, RED, RED, RED, RED, RED - Attribute: enum3D {4, 3, 2} + (0,0) RED, RED, + (1,0) RED, RED, + (2,0) RED, RED + Attribute: enum3D {4, 3, 2} Type: enum 32-bit little-endian integer { RED = 0 GREEN = 1 } Data: - (0,0,0) RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, - (2,0,0) RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED - Attribute: float {2} + (0,0,0) RED, RED, + (0,1,0) RED, RED, + (0,2,0) RED, RED, + (1,0,0) RED, RED, + (1,1,0) RED, RED, + (1,2,0) RED, RED, + (2,0,0) RED, RED, + (2,1,0) RED, RED, + (2,2,0) RED, RED, + (3,0,0) RED, RED, + (3,1,0) RED, RED, + (3,2,0) RED, RED + Attribute: float {2} Type: IEEE 32-bit little-endian float Data: 1, 2 - Attribute: float2D {3, 2} + Attribute: float2D {3, 2} Type: IEEE 32-bit little-endian float Data: - (0,0) 1, 2, 3, 4, 5, 6 - Attribute: float3D {4, 3, 2} + (0,0) 1, 2, + (1,0) 3, 4, + (2,0) 5, 6 + Attribute: float3D {4, 3, 2} Type: IEEE 32-bit little-endian float Data: - (0,0,0) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - (2,2,1) 18, 19, 20, 21, 22, 23, 24 - Attribute: integer {2} + (0,0,0) 1, 2, + (0,1,0) 3, 4, + (0,2,0) 5, 6, + (1,0,0) 7, 8, + (1,1,0) 9, 10, + (1,2,0) 11, 12, + (2,0,0) 13, 14, + (2,1,0) 15, 16, + (2,2,0) 17, 18, + (3,0,0) 19, 20, + (3,1,0) 21, 22, + (3,2,0) 23, 24 + Attribute: integer {2} Type: 32-bit little-endian integer Data: 1, 2 Attribute: integer2D {3, 2} Type: 32-bit little-endian integer Data: - (0,0) 1, 2, 3, 4, 5, 6 + (0,0) 1, 2, + (1,0) 3, 4, + (2,0) 5, 6 Attribute: integer3D {4, 3, 2} Type: 32-bit little-endian integer Data: - (0,0,0) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - (2,2,1) 18, 19, 20, 21, 22, 23, 24 - Attribute: opaque {2} + (0,0,0) 1, 2, + (0,1,0) 3, 4, + (0,2,0) 5, 6, + (1,0,0) 7, 8, + (1,1,0) 9, 10, + (1,2,0) 11, 12, + (2,0,0) 13, 14, + (2,1,0) 15, 16, + (2,2,0) 17, 18, + (3,0,0) 19, 20, + (3,1,0) 21, 22, + (3,2,0) 23, 24 + Attribute: opaque {2} Type: 1-byte opaque type (tag = "1-byte opaque type") Data: 0x01, 0x02 - Attribute: opaque2D {3, 2} + Attribute: opaque2D {3, 2} Type: 1-byte opaque type (tag = "1-byte opaque type") Data: - (0,0) 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 - Attribute: opaque3D {4, 3, 2} + (0,0) 0x01, 0x02, + (1,0) 0x03, 0x04, + (2,0) 0x05, 0x06 + Attribute: opaque3D {4, 3, 2} Type: 1-byte opaque type (tag = "1-byte opaque type") Data: - (0,0,0) 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, - (1,2,0) 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, - (3,1,0) 0x15, 0x16, 0x17, 0x18 + (0,0,0) 0x01, 0x02, + (0,1,0) 0x03, 0x04, + (0,2,0) 0x05, 0x06, + (1,0,0) 0x07, 0x08, + (1,1,0) 0x09, 0x0a, + (1,2,0) 0x0b, 0x0c, + (2,0,0) 0x0d, 0x0e, + (2,1,0) 0x0f, 0x10, + (2,2,0) 0x11, 0x12, + (3,0,0) 0x13, 0x14, + (3,1,0) 0x15, 0x16, + (3,2,0) 0x17, 0x18 Attribute: reference {2} Type: object reference Data: DATASET-1:976, DATASET-1:976 Attribute: reference2D {3, 2} Type: object reference Data: - (0,0) DATASET-1:976, DATASET-1:976, DATASET-1:976, DATASET-1:976, + (0,0) DATASET-1:976, DATASET-1:976, + (1,0) DATASET-1:976, DATASET-1:976, (2,0) DATASET-1:976, DATASET-1:976 Attribute: reference3D {4, 3, 2} Type: object reference Data: - (0,0,0) DATASET-1:976, DATASET-1:976, DATASET-1:976, DATASET-1:976, - (0,2,0) DATASET-1:976, DATASET-1:976, DATASET-1:976, DATASET-1:976, - (1,1,0) DATASET-1:976, DATASET-1:976, DATASET-1:976, DATASET-1:976, - (2,0,0) DATASET-1:976, DATASET-1:976, DATASET-1:976, DATASET-1:976, - (2,2,0) DATASET-1:976, DATASET-1:976, DATASET-1:976, DATASET-1:976, - (3,1,0) DATASET-1:976, DATASET-1:976, DATASET-1:976, DATASET-1:976 - Attribute: string {2} + (0,0,0) DATASET-1:976, DATASET-1:976, + (0,1,0) DATASET-1:976, DATASET-1:976, + (0,2,0) DATASET-1:976, DATASET-1:976, + (1,0,0) DATASET-1:976, DATASET-1:976, + (1,1,0) DATASET-1:976, DATASET-1:976, + (1,2,0) DATASET-1:976, DATASET-1:976, + (2,0,0) DATASET-1:976, DATASET-1:976, + (2,1,0) DATASET-1:976, DATASET-1:976, + (2,2,0) DATASET-1:976, DATASET-1:976, + (3,0,0) DATASET-1:976, DATASET-1:976, + (3,1,0) DATASET-1:976, DATASET-1:976, + (3,2,0) DATASET-1:976, DATASET-1:976 + Attribute: string {2} Type: 2-byte null-terminated ASCII string Data: "ab", "de" - Attribute: string2D {3, 2} + Attribute: string2D {3, 2} Type: 2-byte null-terminated ASCII string Data: - (0,0) "ab", "cd", "ef", "gh", "ij", "kl" - Attribute: string3D {4, 3, 2} + (0,0) "ab", "cd", + (1,0) "ef", "gh", + (2,0) "ij", "kl" + Attribute: string3D {4, 3, 2} Type: 2-byte null-terminated ASCII string Data: - (0,0,0) "ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", - (1,2,0) "vw", "xz", "AB", "CD", "EF", "GH", "IJ", "KL", "MN", "PQ", - (3,1,0) "RS", "TU", "VW", "XZ" - Attribute: vlen {2} + (0,0,0) "ab", "cd", + (0,1,0) "ef", "gh", + (0,2,0) "ij", "kl", + (1,0,0) "mn", "pq", + (1,1,0) "rs", "tu", + (1,2,0) "vw", "xz", + (2,0,0) "AB", "CD", + (2,1,0) "EF", "GH", + (2,2,0) "IJ", "KL", + (3,0,0) "MN", "PQ", + (3,1,0) "RS", "TU", + (3,2,0) "VW", "XZ" + Attribute: vlen {2} Type: variable length of 32-bit little-endian integer Data: (1), (2,3) - Attribute: vlen2D {3, 2} + Attribute: vlen2D {3, 2} Type: variable length of 32-bit little-endian integer Data: - (0,0) (0), (1), (2,3), (4,5), (6,7,8), (9,10,11) - Attribute: vlen3D {4, 3, 2} + (0,0) (0), (1), + (1,0) (2,3), (4,5), + (2,0) (6,7,8), (9,10,11) + Attribute: vlen3D {4, 3, 2} Type: variable length of 32-bit little-endian integer Data: - (0,0,0) (0), (1), (2), (3), (4), (5), (6,7), (8,9), (10,11), - (1,1,1) (12,13), (14,15), (16,17), (18,19,20), (21,22,23), - (2,1,0) (24,25,26), (27,28,29), (30,31,32), (33,34,35), - (3,0,0) (36,37,38,39), (40,41,42,43), (44,45,46,47), (48,49,50,51), + (0,0,0) (0), (1), + (0,1,0) (2), (3), + (0,2,0) (4), (5), + (1,0,0) (6,7), (8,9), + (1,1,0) (10,11), (12,13), + (1,2,0) (14,15), (16,17), + (2,0,0) (18,19,20), (21,22,23), + (2,1,0) (24,25,26), (27,28,29), + (2,2,0) (30,31,32), (33,34,35), + (3,0,0) (36,37,38,39), (40,41,42,43), + (3,1,0) (44,45,46,47), (48,49,50,51), (3,2,0) (52,53,54,55), (56,57,58,59) Location: 1:976 Links: 1 Storage: 8 logical bytes, 0 allocated bytes Type: 32-bit little-endian integer g1 Group - Attribute: array {2} + Attribute: array {2} Type: [3] 32-bit little-endian integer Data: [1,2,3], [4,5,6] - Attribute: array2D {3, 2} + Attribute: array2D {3, 2} Type: [3] 32-bit little-endian integer Data: - (0,0) [1,2,3], [4,5,6], [7,8,9], [10,11,12], [13,14,15], [16,17,18] - Attribute: array3D {4, 3, 2} + (0,0) [1,2,3], [4,5,6], + (1,0) [7,8,9], [10,11,12], + (2,0) [13,14,15], [16,17,18] + Attribute: array3D {4, 3, 2} Type: [3] 32-bit little-endian integer Data: - (0,0,0) [1,2,3], [4,5,6], [7,8,9], [10,11,12], [13,14,15], - (0,2,1) [16,17,18], [19,20,21], [22,23,24], [25,26,27], [28,29,30], - (1,2,0) [31,32,33], [34,35,36], [37,38,39], [40,41,42], [43,44,45], - (2,1,1) [46,47,48], [49,50,51], [52,53,54], [55,56,57], [58,59,60], - (3,1,0) [61,62,63], [64,65,66], [67,68,69], [70,71,72] - Attribute: bitfield {2} + (0,0,0) [1,2,3], [4,5,6], + (0,1,0) [7,8,9], [10,11,12], + (0,2,0) [13,14,15], [16,17,18], + (1,0,0) [19,20,21], [22,23,24], + (1,1,0) [25,26,27], [28,29,30], + (1,2,0) [31,32,33], [34,35,36], + (2,0,0) [37,38,39], [40,41,42], + (2,1,0) [43,44,45], [46,47,48], + (2,2,0) [49,50,51], [52,53,54], + (3,0,0) [55,56,57], [58,59,60], + (3,1,0) [61,62,63], [64,65,66], + (3,2,0) [67,68,69], [70,71,72] + Attribute: bitfield {2} Type: 8-bit bitfield Data: 0x01, 0x02 Attribute: bitfield2D {3, 2} Type: 8-bit bitfield Data: - (0,0) 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 + (0,0) 0x01, 0x02, + (1,0) 0x03, 0x04, + (2,0) 0x05, 0x06 Attribute: bitfield3D {4, 3, 2} Type: 8-bit bitfield Data: - (0,0,0) 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, - (1,2,0) 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, - (3,1,0) 0x15, 0x16, 0x17, 0x18 - Attribute: compound {2} + (0,0,0) 0x01, 0x02, + (0,1,0) 0x03, 0x04, + (0,2,0) 0x05, 0x06, + (1,0,0) 0x07, 0x08, + (1,1,0) 0x09, 0x0a, + (1,2,0) 0x0b, 0x0c, + (2,0,0) 0x0d, 0x0e, + (2,1,0) 0x0f, 0x10, + (2,2,0) 0x11, 0x12, + (3,0,0) 0x13, 0x14, + (3,1,0) 0x15, 0x16, + (3,2,0) 0x17, 0x18 + Attribute: compound {2} Type: struct { "a" +0 8-bit integer "b" +4 IEEE 64-bit little-endian float @@ -205,108 +329,185 @@ g1 Group "b" +4 IEEE 64-bit little-endian float } 12 bytes Data: - (0,0) {1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12} + (0,0) {1, 2}, {3, 4}, + (1,0) {5, 6}, {7, 8}, + (2,0) {9, 10}, {11, 12} Attribute: compound3D {4, 3, 2} Type: struct { "a" +0 8-bit integer "b" +4 IEEE 64-bit little-endian float } 12 bytes Data: - (0,0,0) {1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}, {13, - (1,0,0) 14}, {15, 16}, {17, 18}, {19, 20}, {21, 22}, {23, 24}, - (2,0,0) {25, 26}, {27, 28}, {29, 30}, {31, 32}, {33, 34}, {35, 36}, - (3,0,0) {37, 38}, {39, 40}, {41, 42}, {43, 44}, {45, 46}, {47, 48} - Attribute: enum {2} + (0,0,0) {1, 2}, {3, 4}, + (0,1,0) {5, 6}, {7, 8}, + (0,2,0) {9, 10}, {11, 12}, + (1,0,0) {13, 14}, {15, 16}, + (1,1,0) {17, 18}, {19, 20}, + (1,2,0) {21, 22}, {23, 24}, + (2,0,0) {25, 26}, {27, 28}, + (2,1,0) {29, 30}, {31, 32}, + (2,2,0) {33, 34}, {35, 36}, + (3,0,0) {37, 38}, {39, 40}, + (3,1,0) {41, 42}, {43, 44}, + (3,2,0) {45, 46}, {47, 48} + Attribute: enum {2} Type: enum 32-bit little-endian integer { RED = 0 GREEN = 1 } Data: RED, RED - Attribute: enum2D {3, 2} + Attribute: enum2D {3, 2} Type: enum 32-bit little-endian integer { RED = 0 GREEN = 1 } Data: - (0,0) RED, RED, RED, RED, RED, RED - Attribute: enum3D {4, 3, 2} + (0,0) RED, RED, + (1,0) RED, RED, + (2,0) RED, RED + Attribute: enum3D {4, 3, 2} Type: enum 32-bit little-endian integer { RED = 0 GREEN = 1 } Data: - (0,0,0) RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, - (2,0,0) RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED - Attribute: float {2} + (0,0,0) RED, RED, + (0,1,0) RED, RED, + (0,2,0) RED, RED, + (1,0,0) RED, RED, + (1,1,0) RED, RED, + (1,2,0) RED, RED, + (2,0,0) RED, RED, + (2,1,0) RED, RED, + (2,2,0) RED, RED, + (3,0,0) RED, RED, + (3,1,0) RED, RED, + (3,2,0) RED, RED + Attribute: float {2} Type: IEEE 32-bit little-endian float Data: 1, 2 - Attribute: float2D {3, 2} + Attribute: float2D {3, 2} Type: IEEE 32-bit little-endian float Data: - (0,0) 1, 2, 3, 4, 5, 6 - Attribute: float3D {4, 3, 2} + (0,0) 1, 2, + (1,0) 3, 4, + (2,0) 5, 6 + Attribute: float3D {4, 3, 2} Type: IEEE 32-bit little-endian float Data: - (0,0,0) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - (2,2,1) 18, 19, 20, 21, 22, 23, 24 - Attribute: integer {2} + (0,0,0) 1, 2, + (0,1,0) 3, 4, + (0,2,0) 5, 6, + (1,0,0) 7, 8, + (1,1,0) 9, 10, + (1,2,0) 11, 12, + (2,0,0) 13, 14, + (2,1,0) 15, 16, + (2,2,0) 17, 18, + (3,0,0) 19, 20, + (3,1,0) 21, 22, + (3,2,0) 23, 24 + Attribute: integer {2} Type: 32-bit little-endian integer Data: 1, 2 Attribute: integer2D {3, 2} Type: 32-bit little-endian integer Data: - (0,0) 1, 2, 3, 4, 5, 6 + (0,0) 1, 2, + (1,0) 3, 4, + (2,0) 5, 6 Attribute: integer3D {4, 3, 2} Type: 32-bit little-endian integer Data: - (0,0,0) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - (2,2,1) 18, 19, 20, 21, 22, 23, 24 - Attribute: opaque {2} + (0,0,0) 1, 2, + (0,1,0) 3, 4, + (0,2,0) 5, 6, + (1,0,0) 7, 8, + (1,1,0) 9, 10, + (1,2,0) 11, 12, + (2,0,0) 13, 14, + (2,1,0) 15, 16, + (2,2,0) 17, 18, + (3,0,0) 19, 20, + (3,1,0) 21, 22, + (3,2,0) 23, 24 + Attribute: opaque {2} Type: 1-byte opaque type (tag = "1-byte opaque type") Data: 0x01, 0x02 - Attribute: opaque2D {3, 2} + Attribute: opaque2D {3, 2} Type: 1-byte opaque type (tag = "1-byte opaque type") Data: - (0,0) 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 - Attribute: opaque3D {4, 3, 2} + (0,0) 0x01, 0x02, + (1,0) 0x03, 0x04, + (2,0) 0x05, 0x06 + Attribute: opaque3D {4, 3, 2} Type: 1-byte opaque type (tag = "1-byte opaque type") Data: - (0,0,0) 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, - (1,2,0) 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, - (3,1,0) 0x15, 0x16, 0x17, 0x18 - Attribute: string {2} + (0,0,0) 0x01, 0x02, + (0,1,0) 0x03, 0x04, + (0,2,0) 0x05, 0x06, + (1,0,0) 0x07, 0x08, + (1,1,0) 0x09, 0x0a, + (1,2,0) 0x0b, 0x0c, + (2,0,0) 0x0d, 0x0e, + (2,1,0) 0x0f, 0x10, + (2,2,0) 0x11, 0x12, + (3,0,0) 0x13, 0x14, + (3,1,0) 0x15, 0x16, + (3,2,0) 0x17, 0x18 + Attribute: string {2} Type: 2-byte null-terminated ASCII string Data: "ab", "de" - Attribute: string2D {3, 2} + Attribute: string2D {3, 2} Type: 2-byte null-terminated ASCII string Data: - (0,0) "ab", "cd", "ef", "gh", "ij", "kl" - Attribute: string3D {4, 3, 2} + (0,0) "ab", "cd", + (1,0) "ef", "gh", + (2,0) "ij", "kl" + Attribute: string3D {4, 3, 2} Type: 2-byte null-terminated ASCII string Data: - (0,0,0) "ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", - (1,2,0) "vw", "xz", "AB", "CD", "EF", "GH", "IJ", "KL", "MN", "PQ", - (3,1,0) "RS", "TU", "VW", "XZ" - Attribute: vlen {2} + (0,0,0) "ab", "cd", + (0,1,0) "ef", "gh", + (0,2,0) "ij", "kl", + (1,0,0) "mn", "pq", + (1,1,0) "rs", "tu", + (1,2,0) "vw", "xz", + (2,0,0) "AB", "CD", + (2,1,0) "EF", "GH", + (2,2,0) "IJ", "KL", + (3,0,0) "MN", "PQ", + (3,1,0) "RS", "TU", + (3,2,0) "VW", "XZ" + Attribute: vlen {2} Type: variable length of 32-bit little-endian integer Data: (1), (2,3) - Attribute: vlen2D {3, 2} + Attribute: vlen2D {3, 2} Type: variable length of 32-bit little-endian integer Data: - (0,0) (0), (1), (2,3), (4,5), (6,7,8), (9,10,11) - Attribute: vlen3D {4, 3, 2} + (0,0) (0), (1), + (1,0) (2,3), (4,5), + (2,0) (6,7,8), (9,10,11) + Attribute: vlen3D {4, 3, 2} Type: variable length of 32-bit little-endian integer Data: - (0,0,0) (0), (1), (2), (3), (4), (5), (6,7), (8,9), (10,11), - (1,1,1) (12,13), (14,15), (16,17), (18,19,20), (21,22,23), - (2,1,0) (24,25,26), (27,28,29), (30,31,32), (33,34,35), - (3,0,0) (36,37,38,39), (40,41,42,43), (44,45,46,47), (48,49,50,51), + (0,0,0) (0), (1), + (0,1,0) (2), (3), + (0,2,0) (4), (5), + (1,0,0) (6,7), (8,9), + (1,1,0) (10,11), (12,13), + (1,2,0) (14,15), (16,17), + (2,0,0) (18,19,20), (21,22,23), + (2,1,0) (24,25,26), (27,28,29), + (2,2,0) (30,31,32), (33,34,35), + (3,0,0) (36,37,38,39), (40,41,42,43), + (3,1,0) (44,45,46,47), (48,49,50,51), (3,2,0) (52,53,54,55), (56,57,58,59) Location: 1:2176 Links: 1 diff --git a/tools/testfiles/tattrregR.ddl b/tools/testfiles/tattrregR.ddl index 9e6b421..1c661e4 100644 --- a/tools/testfiles/tattrregR.ddl +++ b/tools/testfiles/tattrregR.ddl @@ -22,7 +22,7 @@ GROUP "/" { (7,2): 216, 219, 222, 225, 228, 231 (0): } (0): } - (1): DATASET /Dataset2 { + (1): DATASET /Dataset2 { (1): REGION_TYPE POINT (6,9), (2,2), (8,4), (1,6), (2,8), (1): (3,2), (0,4), (9,0), (7,1), (3,3) (1): DATATYPE H5T_STD_U8BE diff --git a/tools/testfiles/tattrreg_le.ls b/tools/testfiles/tattrreg_le.ls index 2eafc07..dd0be49 100644 --- a/tools/testfiles/tattrreg_le.ls +++ b/tools/testfiles/tattrreg_le.ls @@ -10,6 +10,7 @@ Dataset1 Dataset {NULL} Storage: 0 logical bytes, 0 allocated bytes Type: native int Data: + Dataset2 Dataset {10/10, 10/10} Location: 1:800 Links: 1 diff --git a/tools/testfiles/tbitfields.h5.xml b/tools/testfiles/tbitfields.h5.xml index 62efbce..73365f0 100644 --- a/tools/testfiles/tbitfields.h5.xml +++ b/tools/testfiles/tbitfields.h5.xml @@ -6,9 +6,9 @@ - + - + @@ -23,9 +23,38 @@ - 0xff 0xfe 0xfd 0xfc 0xfb 0xfa 0xf9 0xf8 0xf7 0xf6 0xf5 0xf4 0xf3 - 0xf2 0xf1 0xf0 0xef 0xee 0xed 0xec 0xeb 0xea 0xe9 0xe8 0xe7 0xe6 - 0xe5 0xe4 0xe3 0xe2 0xe1 0xe0 + 0xff + 0xfe + 0xfd + 0xfc + 0xfb + 0xfa + 0xf9 + 0xf8 + 0xf7 + 0xf6 + 0xf5 + 0xf4 + 0xf3 + 0xf2 + 0xf1 + 0xf0 + 0xef + 0xee + 0xed + 0xec + 0xeb + 0xea + 0xe9 + 0xe8 + 0xe7 + 0xe6 + 0xe5 + 0xe4 + 0xe3 + 0xe2 + 0xe1 + 0xe0 @@ -33,9 +62,9 @@ - + - + @@ -50,8 +79,22 @@ - ff:fe fd:fc fb:fa f9:f8 f7:f6 f5:f4 f3:f2 f1:f0 ef:ee ed:ec eb:ea - e9:e8 e7:e6 e5:e4 e3:e2 e1:e0 + ff:fe + fd:fc + fb:fa + f9:f8 + f7:f6 + f5:f4 + f3:f2 + f1:f0 + ef:ee + ed:ec + eb:ea + e9:e8 + e7:e6 + e5:e4 + e3:e2 + e1:e0 diff --git a/tools/testfiles/tboot1.ddl b/tools/testfiles/tboot1.ddl index 7949693..4758948 100644 --- a/tools/testfiles/tboot1.ddl +++ b/tools/testfiles/tboot1.ddl @@ -11,9 +11,9 @@ SUPER_BLOCK { ISTORE_K 32 FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL FREE_SPACE_THRESHOLD 1 -} -USER_BLOCK { - USERBLOCK_SIZE 0 + USER_BLOCK { + USERBLOCK_SIZE 0 + } } DATASET "dset" { DATATYPE H5T_STD_I32BE diff --git a/tools/testfiles/tboot2.ddl b/tools/testfiles/tboot2.ddl index d90b881..d83b92b 100644 --- a/tools/testfiles/tboot2.ddl +++ b/tools/testfiles/tboot2.ddl @@ -11,9 +11,9 @@ SUPER_BLOCK { ISTORE_K 32 FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL FREE_SPACE_THRESHOLD 1 -} -USER_BLOCK { - USERBLOCK_SIZE 0 + USER_BLOCK { + USERBLOCK_SIZE 0 + } } GROUP "/" { } diff --git a/tools/testfiles/tchar1.ddl b/tools/testfiles/tchar1.ddl index a84906f..78acaf0 100644 --- a/tools/testfiles/tchar1.ddl +++ b/tools/testfiles/tchar1.ddl @@ -4,11 +4,11 @@ GROUP "/" { DATATYPE H5T_STD_I8LE DATASPACE SIMPLE { ( 308 ) / ( 308 ) } DATA { - "Four score and seven years ago our forefathers brought forth on this " - "continent a new nation, conceived in liberty and dedicated to the pro" - "position that all men are created equal. Now we are engaged in a grea" - "t civil war, testing whether that nation or any nation so conceived a" - "nd so dedicated can long endure." + "Four score and seven years ago our forefathers brought forth on th" + "is continent a new nation, conceived in liberty and dedicated to t" + "he proposition that all men are created equal. Now we are engaged " + "in a great civil war, testing whether that nation or any nation so" + " conceived and so dedicated can long endure." } } } diff --git a/tools/testfiles/tchunked.ddl b/tools/testfiles/tchunked.ddl index 2af1c0c..b68b233 100644 --- a/tools/testfiles/tchunked.ddl +++ b/tools/testfiles/tchunked.ddl @@ -6,13 +6,13 @@ COMMENT "This is a dataset with chunked storage" STORAGE_LAYOUT { CHUNKED ( 10, 5 ) SIZE 800 - } + } FILTERS { NONE } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tcompact.ddl b/tools/testfiles/tcompact.ddl index c9066a8..918e2eb 100644 --- a/tools/testfiles/tcompact.ddl +++ b/tools/testfiles/tcompact.ddl @@ -12,7 +12,7 @@ COMMENT "This is a dataset with compact storage" } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_EARLY diff --git a/tools/testfiles/tcompound.h5.xml b/tools/testfiles/tcompound.h5.xml index 6d7d7c8..10ef36e 100644 --- a/tools/testfiles/tcompound.h5.xml +++ b/tools/testfiles/tcompound.h5.xml @@ -25,9 +25,9 @@ - + - + @@ -63,7 +63,11 @@ - 0 0 1 1 1 0.5 2 4 0.333333 3 9 0.25 4 16 0.2 + 0 0 1 + 1 1 0.5 + 2 4 0.333333 + 3 9 0.25 + 4 16 0.2 @@ -72,9 +76,9 @@ - + - + @@ -86,7 +90,11 @@ - 0 0 1 1.1 2 2.2 3 3.3 4 4.4 + 0 0 + 1 1.1 + 2 2.2 + 3 3.3 + 4 4.4 @@ -94,9 +102,9 @@ - + - + @@ -109,96 +117,24 @@ - 0 1 2 3 1 2 3 4 5 6 - 2 3 4 5 6 7 - 3 4 5 6 7 8 - 4 5 6 7 8 9 - 5 6 7 8 9 10 - 1 2 3 4 2 3 4 5 6 7 - 3 4 5 6 7 8 - 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 2 3 4 5 3 4 5 6 7 8 - 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 3 4 5 6 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 4 5 6 7 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 9 10 11 12 13 14 - 5 6 7 8 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 9 10 11 12 13 14 - 10 11 12 13 14 15 - 1 2 3 4 2 3 4 5 6 7 - 3 4 5 6 7 8 - 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 2 3 4 5 3 4 5 6 7 8 - 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 3 4 5 6 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 4 5 6 7 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 9 10 11 12 13 14 - 5 6 7 8 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 9 10 11 12 13 14 - 10 11 12 13 14 15 - 6 7 8 9 7 8 9 10 11 12 - 8 9 10 11 12 13 - 9 10 11 12 13 14 - 10 11 12 13 14 15 - 11 12 13 14 15 16 - 2 3 4 5 3 4 5 6 7 8 - 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 3 4 5 6 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 4 5 6 7 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 9 10 11 12 13 14 - 5 6 7 8 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 9 10 11 12 13 14 - 10 11 12 13 14 15 - 6 7 8 9 7 8 9 10 11 12 - 8 9 10 11 12 13 - 9 10 11 12 13 14 - 10 11 12 13 14 15 - 11 12 13 14 15 16 - 7 8 9 10 8 9 10 11 12 13 - 9 10 11 12 13 14 - 10 11 12 13 14 15 - 11 12 13 14 15 16 - 12 13 14 15 16 17 + 0 1 2 3 1 2 3 4 5 6 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 + 1 2 3 4 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 + 2 3 4 5 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 + 3 4 5 6 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 + 4 5 6 7 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 9 10 11 12 13 14 + 5 6 7 8 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 9 10 11 12 13 14 10 11 12 13 14 15 + 1 2 3 4 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 + 2 3 4 5 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 + 3 4 5 6 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 + 4 5 6 7 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 9 10 11 12 13 14 + 5 6 7 8 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 9 10 11 12 13 14 10 11 12 13 14 15 + 6 7 8 9 7 8 9 10 11 12 8 9 10 11 12 13 9 10 11 12 13 14 10 11 12 13 14 15 11 12 13 14 15 16 + 2 3 4 5 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 + 3 4 5 6 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 + 4 5 6 7 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 9 10 11 12 13 14 + 5 6 7 8 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 9 10 11 12 13 14 10 11 12 13 14 15 + 6 7 8 9 7 8 9 10 11 12 8 9 10 11 12 13 9 10 11 12 13 14 10 11 12 13 14 15 11 12 13 14 15 16 + 7 8 9 10 8 9 10 11 12 13 9 10 11 12 13 14 10 11 12 13 14 15 11 12 13 14 15 16 12 13 14 15 16 17 @@ -206,9 +142,9 @@ - + - + @@ -220,7 +156,11 @@ - 0 3 1 4 2 5 3 6 4 7 + 0 3 + 1 4 + 2 5 + 3 6 + 4 7 @@ -250,9 +190,9 @@ - + - + @@ -264,7 +204,11 @@ - 0 0 1 0.1 2 0.2 3 0.3 4 0.4 + 0 0 + 1 0.1 + 2 0.2 + 3 0.3 + 4 0.4 diff --git a/tools/testfiles/tcompound2.h5.xml b/tools/testfiles/tcompound2.h5.xml index 6db1785..ac139d9 100644 --- a/tools/testfiles/tcompound2.h5.xml +++ b/tools/testfiles/tcompound2.h5.xml @@ -31,7 +31,7 @@ - + @@ -67,7 +67,12 @@ - 0 0 1 1 1 0.5 2 4 0.333333 3 9 0.25 4 16 0.2 5 25 0.166667 + 0 0 1 + 1 1 0.5 + 2 4 0.333333 + 3 9 0.25 + 4 16 0.2 + 5 25 0.166667 @@ -82,7 +87,7 @@ - + @@ -94,7 +99,12 @@ - 0 0 1 1.1 2 2.2 3 3.3 4 4.4 5 5.5 + 0 0 + 1 1.1 + 2 2.2 + 3 3.3 + 4 4.4 + 5 5.5 @@ -108,7 +118,7 @@ - + @@ -120,7 +130,12 @@ - 0 0 1 1 2 2 3 3 4 4 5 5 + 0 0 + 1 1 + 2 2 + 3 3 + 4 4 + 5 5 @@ -156,7 +171,7 @@ - + @@ -168,7 +183,12 @@ - 0 0 1 1 2 2 3 3 4 4 5 5 + 0 0 + 1 1 + 2 2 + 3 3 + 4 4 + 5 5 diff --git a/tools/testfiles/tcompound_complex.h5.xml b/tools/testfiles/tcompound_complex.h5.xml index bda8c94..b35193a 100644 --- a/tools/testfiles/tcompound_complex.h5.xml +++ b/tools/testfiles/tcompound_complex.h5.xml @@ -5,12 +5,12 @@ - + - - - - + + + + @@ -90,36 +90,12 @@ - 0 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 0 1 2 3 4 5 - 1 2 3 4 5 6 - 2 3 4 5 6 7 - 3 4 5 6 7 8 - 4 5 6 7 8 9 0 0 0 0 0 0 0 0 0 0 0 109 - 1 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 1 2 3 4 5 6 - 2 3 4 5 6 7 - 3 4 5 6 7 8 - 4 5 6 7 8 9 - 5 6 7 8 9 10 0.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 109 - 2 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 2 3 4 5 6 7 - 3 4 5 6 7 8 - 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 1.92 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 109 - 3 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 3 4 5 6 7 8 - 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 2.88 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 109 - 4 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 3.84 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 109 - 5 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 9 10 11 12 13 14 4.8 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 109 + 0 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 0 1 2 3 4 5 1 2 3 4 5 6 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 0 0 0 0 0 0 0 0 0 0 0 109 + 1 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 1 2 3 4 5 6 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 0.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 109 + 2 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 1.92 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 109 + 3 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 2.88 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 109 + 4 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 3.84 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 109 + 5 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 9 10 11 12 13 14 4.8 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 109 diff --git a/tools/testfiles/tcontiguos.ddl b/tools/testfiles/tcontiguos.ddl index 8800617..bda7ef7 100644 --- a/tools/testfiles/tcontiguos.ddl +++ b/tools/testfiles/tcontiguos.ddl @@ -13,7 +13,7 @@ COMMENT "This is a dataset with contiguous storage" } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE diff --git a/tools/testfiles/tdatareg.h5.xml b/tools/testfiles/tdatareg.h5.xml index 03188b8..327e213 100644 --- a/tools/testfiles/tdatareg.h5.xml +++ b/tools/testfiles/tdatareg.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -31,9 +31,9 @@ - + - + @@ -49,16 +49,106 @@ - 0 3 6 9 12 15 18 21 24 27 - 30 33 36 39 42 45 48 51 54 57 - 60 63 66 69 72 75 78 81 84 87 - 90 93 96 99 102 105 108 111 114 117 - 120 123 126 129 132 135 138 141 144 147 - 150 153 156 159 162 165 168 171 174 177 - 180 183 186 189 192 195 198 201 204 207 - 210 213 216 219 222 225 228 231 234 237 - 240 243 246 249 252 255 2 5 8 11 - 14 17 20 23 26 29 32 35 38 41 + 0 + 3 + 6 + 9 + 12 + 15 + 18 + 21 + 24 + 27 + 30 + 33 + 36 + 39 + 42 + 45 + 48 + 51 + 54 + 57 + 60 + 63 + 66 + 69 + 72 + 75 + 78 + 81 + 84 + 87 + 90 + 93 + 96 + 99 + 102 + 105 + 108 + 111 + 114 + 117 + 120 + 123 + 126 + 129 + 132 + 135 + 138 + 141 + 144 + 147 + 150 + 153 + 156 + 159 + 162 + 165 + 168 + 171 + 174 + 177 + 180 + 183 + 186 + 189 + 192 + 195 + 198 + 201 + 204 + 207 + 210 + 213 + 216 + 219 + 222 + 225 + 228 + 231 + 234 + 237 + 240 + 243 + 246 + 249 + 252 + 255 + 2 + 5 + 8 + 11 + 14 + 17 + 20 + 23 + 26 + 29 + 32 + 35 + 38 + 41 diff --git a/tools/testfiles/tdataregR.ddl b/tools/testfiles/tdataregR.ddl index 0f613dc..aaac92c 100644 --- a/tools/testfiles/tdataregR.ddl +++ b/tools/testfiles/tdataregR.ddl @@ -17,7 +17,7 @@ GROUP "/" { (7,2): 216, 219, 222, 225, 228, 231 (0): } (0): } - (1): DATASET /Dataset2 { + (1): DATASET /Dataset2 { (1): REGION_TYPE POINT (6,9), (2,2), (8,4), (1,6), (2,8), (3,2), (1): (0,4), (9,0), (7,1), (3,3) (1): DATATYPE H5T_STD_U8BE diff --git a/tools/testfiles/tdeflate.ddl b/tools/testfiles/tdeflate.ddl index e59d392..5603911 100644 --- a/tools/testfiles/tdeflate.ddl +++ b/tools/testfiles/tdeflate.ddl @@ -5,13 +5,13 @@ DATASET "deflate" { STORAGE_LAYOUT { CHUNKED ( 10, 5 ) SIZE 385 (2.078:1 COMPRESSION) - } + } FILTERS { COMPRESSION DEFLATE { LEVEL 9 } } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tdset.h5.xml b/tools/testfiles/tdset.h5.xml index 59719d3..e914bf6 100644 --- a/tools/testfiles/tdset.h5.xml +++ b/tools/testfiles/tdset.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -23,16 +23,206 @@ - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 - 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 - 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 - 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 - 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 - 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 - 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 - 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 - 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 @@ -40,9 +230,9 @@ - + - + @@ -58,86 +248,606 @@ - 0 0.0001 0.0002 0.0003 0.0004 0.0005 0.0006 0.0007 0.0008 0.0009 0.001 - 0.0011 0.0012 0.0013 0.0014 0.0015 0.0016 0.0017 0.0018 0.0019 - 1 1.0001 1.0002 1.0003 1.0004 1.0005 1.0006 1.0007 1.0008 1.0009 1.001 - 1.0011 1.0012 1.0013 1.0014 1.0015 1.0016 1.0017 1.0018 1.0019 - 2 2.0001 2.0002 2.0003 2.0004 2.0005 2.0006 2.0007 2.0008 2.0009 2.001 - 2.0011 2.0012 2.0013 2.0014 2.0015 2.0016 2.0017 2.0018 2.0019 - 3 3.0001 3.0002 3.0003 3.0004 3.0005 3.0006 3.0007 3.0008 3.0009 3.001 - 3.0011 3.0012 3.0013 3.0014 3.0015 3.0016 3.0017 3.0018 3.0019 - 4 4.0001 4.0002 4.0003 4.0004 4.0005 4.0006 4.0007 4.0008 4.0009 4.001 - 4.0011 4.0012 4.0013 4.0014 4.0015 4.0016 4.0017 4.0018 4.0019 - 5 5.0001 5.0002 5.0003 5.0004 5.0005 5.0006 5.0007 5.0008 5.0009 5.001 - 5.0011 5.0012 5.0013 5.0014 5.0015 5.0016 5.0017 5.0018 5.0019 - 6 6.0001 6.0002 6.0003 6.0004 6.0005 6.0006 6.0007 6.0008 6.0009 6.001 - 6.0011 6.0012 6.0013 6.0014 6.0015 6.0016 6.0017 6.0018 6.0019 - 7 7.0001 7.0002 7.0003 7.0004 7.0005 7.0006 7.0007 7.0008 7.0009 7.001 - 7.0011 7.0012 7.0013 7.0014 7.0015 7.0016 7.0017 7.0018 7.0019 - 8 8.0001 8.0002 8.0003 8.0004 8.0005 8.0006 8.0007 8.0008 8.0009 8.001 - 8.0011 8.0012 8.0013 8.0014 8.0015 8.0016 8.0017 8.0018 8.0019 - 9 9.0001 9.0002 9.0003 9.0004 9.0005 9.0006 9.0007 9.0008 9.0009 9.001 - 9.0011 9.0012 9.0013 9.0014 9.0015 9.0016 9.0017 9.0018 9.0019 - 10 10.0001 10.0002 10.0003 10.0004 10.0005 10.0006 10.0007 10.0008 - 10.0009 10.001 10.0011 10.0012 10.0013 10.0014 10.0015 10.0016 10.0017 - 10.0018 10.0019 - 11 11.0001 11.0002 11.0003 11.0004 11.0005 11.0006 11.0007 11.0008 - 11.0009 11.001 11.0011 11.0012 11.0013 11.0014 11.0015 11.0016 11.0017 - 11.0018 11.0019 - 12 12.0001 12.0002 12.0003 12.0004 12.0005 12.0006 12.0007 12.0008 - 12.0009 12.001 12.0011 12.0012 12.0013 12.0014 12.0015 12.0016 12.0017 - 12.0018 12.0019 - 13 13.0001 13.0002 13.0003 13.0004 13.0005 13.0006 13.0007 13.0008 - 13.0009 13.001 13.0011 13.0012 13.0013 13.0014 13.0015 13.0016 13.0017 - 13.0018 13.0019 - 14 14.0001 14.0002 14.0003 14.0004 14.0005 14.0006 14.0007 14.0008 - 14.0009 14.001 14.0011 14.0012 14.0013 14.0014 14.0015 14.0016 14.0017 - 14.0018 14.0019 - 15 15.0001 15.0002 15.0003 15.0004 15.0005 15.0006 15.0007 15.0008 - 15.0009 15.001 15.0011 15.0012 15.0013 15.0014 15.0015 15.0016 15.0017 - 15.0018 15.0019 - 16 16.0001 16.0002 16.0003 16.0004 16.0005 16.0006 16.0007 16.0008 - 16.0009 16.001 16.0011 16.0012 16.0013 16.0014 16.0015 16.0016 16.0017 - 16.0018 16.0019 - 17 17.0001 17.0002 17.0003 17.0004 17.0005 17.0006 17.0007 17.0008 - 17.0009 17.001 17.0011 17.0012 17.0013 17.0014 17.0015 17.0016 17.0017 - 17.0018 17.0019 - 18 18.0001 18.0002 18.0003 18.0004 18.0005 18.0006 18.0007 18.0008 - 18.0009 18.001 18.0011 18.0012 18.0013 18.0014 18.0015 18.0016 18.0017 - 18.0018 18.0019 - 19 19.0001 19.0002 19.0003 19.0004 19.0005 19.0006 19.0007 19.0008 - 19.0009 19.001 19.0011 19.0012 19.0013 19.0014 19.0015 19.0016 19.0017 - 19.0018 19.0019 - 20 20.0001 20.0002 20.0003 20.0004 20.0005 20.0006 20.0007 20.0008 - 20.0009 20.001 20.0011 20.0012 20.0013 20.0014 20.0015 20.0016 20.0017 - 20.0018 20.0019 - 21 21.0001 21.0002 21.0003 21.0004 21.0005 21.0006 21.0007 21.0008 - 21.0009 21.001 21.0011 21.0012 21.0013 21.0014 21.0015 21.0016 21.0017 - 21.0018 21.0019 - 22 22.0001 22.0002 22.0003 22.0004 22.0005 22.0006 22.0007 22.0008 - 22.0009 22.001 22.0011 22.0012 22.0013 22.0014 22.0015 22.0016 22.0017 - 22.0018 22.0019 - 23 23.0001 23.0002 23.0003 23.0004 23.0005 23.0006 23.0007 23.0008 - 23.0009 23.001 23.0011 23.0012 23.0013 23.0014 23.0015 23.0016 23.0017 - 23.0018 23.0019 - 24 24.0001 24.0002 24.0003 24.0004 24.0005 24.0006 24.0007 24.0008 - 24.0009 24.001 24.0011 24.0012 24.0013 24.0014 24.0015 24.0016 24.0017 - 24.0018 24.0019 - 25 25.0001 25.0002 25.0003 25.0004 25.0005 25.0006 25.0007 25.0008 - 25.0009 25.001 25.0011 25.0012 25.0013 25.0014 25.0015 25.0016 25.0017 - 25.0018 25.0019 - 26 26.0001 26.0002 26.0003 26.0004 26.0005 26.0006 26.0007 26.0008 - 26.0009 26.001 26.0011 26.0012 26.0013 26.0014 26.0015 26.0016 26.0017 - 26.0018 26.0019 - 27 27.0001 27.0002 27.0003 27.0004 27.0005 27.0006 27.0007 27.0008 - 27.0009 27.001 27.0011 27.0012 27.0013 27.0014 27.0015 27.0016 27.0017 - 27.0018 27.0019 - 28 28.0001 28.0002 28.0003 28.0004 28.0005 28.0006 28.0007 28.0008 - 28.0009 28.001 28.0011 28.0012 28.0013 28.0014 28.0015 28.0016 28.0017 - 28.0018 28.0019 - 29 29.0001 29.0002 29.0003 29.0004 29.0005 29.0006 29.0007 29.0008 - 29.0009 29.001 29.0011 29.0012 29.0013 29.0014 29.0015 29.0016 29.0017 - 29.0018 29.0019 + 0 + 0.0001 + 0.0002 + 0.0003 + 0.0004 + 0.0005 + 0.0006 + 0.0007 + 0.0008 + 0.0009 + 0.001 + 0.0011 + 0.0012 + 0.0013 + 0.0014 + 0.0015 + 0.0016 + 0.0017 + 0.0018 + 0.0019 + 1 + 1.0001 + 1.0002 + 1.0003 + 1.0004 + 1.0005 + 1.0006 + 1.0007 + 1.0008 + 1.0009 + 1.001 + 1.0011 + 1.0012 + 1.0013 + 1.0014 + 1.0015 + 1.0016 + 1.0017 + 1.0018 + 1.0019 + 2 + 2.0001 + 2.0002 + 2.0003 + 2.0004 + 2.0005 + 2.0006 + 2.0007 + 2.0008 + 2.0009 + 2.001 + 2.0011 + 2.0012 + 2.0013 + 2.0014 + 2.0015 + 2.0016 + 2.0017 + 2.0018 + 2.0019 + 3 + 3.0001 + 3.0002 + 3.0003 + 3.0004 + 3.0005 + 3.0006 + 3.0007 + 3.0008 + 3.0009 + 3.001 + 3.0011 + 3.0012 + 3.0013 + 3.0014 + 3.0015 + 3.0016 + 3.0017 + 3.0018 + 3.0019 + 4 + 4.0001 + 4.0002 + 4.0003 + 4.0004 + 4.0005 + 4.0006 + 4.0007 + 4.0008 + 4.0009 + 4.001 + 4.0011 + 4.0012 + 4.0013 + 4.0014 + 4.0015 + 4.0016 + 4.0017 + 4.0018 + 4.0019 + 5 + 5.0001 + 5.0002 + 5.0003 + 5.0004 + 5.0005 + 5.0006 + 5.0007 + 5.0008 + 5.0009 + 5.001 + 5.0011 + 5.0012 + 5.0013 + 5.0014 + 5.0015 + 5.0016 + 5.0017 + 5.0018 + 5.0019 + 6 + 6.0001 + 6.0002 + 6.0003 + 6.0004 + 6.0005 + 6.0006 + 6.0007 + 6.0008 + 6.0009 + 6.001 + 6.0011 + 6.0012 + 6.0013 + 6.0014 + 6.0015 + 6.0016 + 6.0017 + 6.0018 + 6.0019 + 7 + 7.0001 + 7.0002 + 7.0003 + 7.0004 + 7.0005 + 7.0006 + 7.0007 + 7.0008 + 7.0009 + 7.001 + 7.0011 + 7.0012 + 7.0013 + 7.0014 + 7.0015 + 7.0016 + 7.0017 + 7.0018 + 7.0019 + 8 + 8.0001 + 8.0002 + 8.0003 + 8.0004 + 8.0005 + 8.0006 + 8.0007 + 8.0008 + 8.0009 + 8.001 + 8.0011 + 8.0012 + 8.0013 + 8.0014 + 8.0015 + 8.0016 + 8.0017 + 8.0018 + 8.0019 + 9 + 9.0001 + 9.0002 + 9.0003 + 9.0004 + 9.0005 + 9.0006 + 9.0007 + 9.0008 + 9.0009 + 9.001 + 9.0011 + 9.0012 + 9.0013 + 9.0014 + 9.0015 + 9.0016 + 9.0017 + 9.0018 + 9.0019 + 10 + 10.0001 + 10.0002 + 10.0003 + 10.0004 + 10.0005 + 10.0006 + 10.0007 + 10.0008 + 10.0009 + 10.001 + 10.0011 + 10.0012 + 10.0013 + 10.0014 + 10.0015 + 10.0016 + 10.0017 + 10.0018 + 10.0019 + 11 + 11.0001 + 11.0002 + 11.0003 + 11.0004 + 11.0005 + 11.0006 + 11.0007 + 11.0008 + 11.0009 + 11.001 + 11.0011 + 11.0012 + 11.0013 + 11.0014 + 11.0015 + 11.0016 + 11.0017 + 11.0018 + 11.0019 + 12 + 12.0001 + 12.0002 + 12.0003 + 12.0004 + 12.0005 + 12.0006 + 12.0007 + 12.0008 + 12.0009 + 12.001 + 12.0011 + 12.0012 + 12.0013 + 12.0014 + 12.0015 + 12.0016 + 12.0017 + 12.0018 + 12.0019 + 13 + 13.0001 + 13.0002 + 13.0003 + 13.0004 + 13.0005 + 13.0006 + 13.0007 + 13.0008 + 13.0009 + 13.001 + 13.0011 + 13.0012 + 13.0013 + 13.0014 + 13.0015 + 13.0016 + 13.0017 + 13.0018 + 13.0019 + 14 + 14.0001 + 14.0002 + 14.0003 + 14.0004 + 14.0005 + 14.0006 + 14.0007 + 14.0008 + 14.0009 + 14.001 + 14.0011 + 14.0012 + 14.0013 + 14.0014 + 14.0015 + 14.0016 + 14.0017 + 14.0018 + 14.0019 + 15 + 15.0001 + 15.0002 + 15.0003 + 15.0004 + 15.0005 + 15.0006 + 15.0007 + 15.0008 + 15.0009 + 15.001 + 15.0011 + 15.0012 + 15.0013 + 15.0014 + 15.0015 + 15.0016 + 15.0017 + 15.0018 + 15.0019 + 16 + 16.0001 + 16.0002 + 16.0003 + 16.0004 + 16.0005 + 16.0006 + 16.0007 + 16.0008 + 16.0009 + 16.001 + 16.0011 + 16.0012 + 16.0013 + 16.0014 + 16.0015 + 16.0016 + 16.0017 + 16.0018 + 16.0019 + 17 + 17.0001 + 17.0002 + 17.0003 + 17.0004 + 17.0005 + 17.0006 + 17.0007 + 17.0008 + 17.0009 + 17.001 + 17.0011 + 17.0012 + 17.0013 + 17.0014 + 17.0015 + 17.0016 + 17.0017 + 17.0018 + 17.0019 + 18 + 18.0001 + 18.0002 + 18.0003 + 18.0004 + 18.0005 + 18.0006 + 18.0007 + 18.0008 + 18.0009 + 18.001 + 18.0011 + 18.0012 + 18.0013 + 18.0014 + 18.0015 + 18.0016 + 18.0017 + 18.0018 + 18.0019 + 19 + 19.0001 + 19.0002 + 19.0003 + 19.0004 + 19.0005 + 19.0006 + 19.0007 + 19.0008 + 19.0009 + 19.001 + 19.0011 + 19.0012 + 19.0013 + 19.0014 + 19.0015 + 19.0016 + 19.0017 + 19.0018 + 19.0019 + 20 + 20.0001 + 20.0002 + 20.0003 + 20.0004 + 20.0005 + 20.0006 + 20.0007 + 20.0008 + 20.0009 + 20.001 + 20.0011 + 20.0012 + 20.0013 + 20.0014 + 20.0015 + 20.0016 + 20.0017 + 20.0018 + 20.0019 + 21 + 21.0001 + 21.0002 + 21.0003 + 21.0004 + 21.0005 + 21.0006 + 21.0007 + 21.0008 + 21.0009 + 21.001 + 21.0011 + 21.0012 + 21.0013 + 21.0014 + 21.0015 + 21.0016 + 21.0017 + 21.0018 + 21.0019 + 22 + 22.0001 + 22.0002 + 22.0003 + 22.0004 + 22.0005 + 22.0006 + 22.0007 + 22.0008 + 22.0009 + 22.001 + 22.0011 + 22.0012 + 22.0013 + 22.0014 + 22.0015 + 22.0016 + 22.0017 + 22.0018 + 22.0019 + 23 + 23.0001 + 23.0002 + 23.0003 + 23.0004 + 23.0005 + 23.0006 + 23.0007 + 23.0008 + 23.0009 + 23.001 + 23.0011 + 23.0012 + 23.0013 + 23.0014 + 23.0015 + 23.0016 + 23.0017 + 23.0018 + 23.0019 + 24 + 24.0001 + 24.0002 + 24.0003 + 24.0004 + 24.0005 + 24.0006 + 24.0007 + 24.0008 + 24.0009 + 24.001 + 24.0011 + 24.0012 + 24.0013 + 24.0014 + 24.0015 + 24.0016 + 24.0017 + 24.0018 + 24.0019 + 25 + 25.0001 + 25.0002 + 25.0003 + 25.0004 + 25.0005 + 25.0006 + 25.0007 + 25.0008 + 25.0009 + 25.001 + 25.0011 + 25.0012 + 25.0013 + 25.0014 + 25.0015 + 25.0016 + 25.0017 + 25.0018 + 25.0019 + 26 + 26.0001 + 26.0002 + 26.0003 + 26.0004 + 26.0005 + 26.0006 + 26.0007 + 26.0008 + 26.0009 + 26.001 + 26.0011 + 26.0012 + 26.0013 + 26.0014 + 26.0015 + 26.0016 + 26.0017 + 26.0018 + 26.0019 + 27 + 27.0001 + 27.0002 + 27.0003 + 27.0004 + 27.0005 + 27.0006 + 27.0007 + 27.0008 + 27.0009 + 27.001 + 27.0011 + 27.0012 + 27.0013 + 27.0014 + 27.0015 + 27.0016 + 27.0017 + 27.0018 + 27.0019 + 28 + 28.0001 + 28.0002 + 28.0003 + 28.0004 + 28.0005 + 28.0006 + 28.0007 + 28.0008 + 28.0009 + 28.001 + 28.0011 + 28.0012 + 28.0013 + 28.0014 + 28.0015 + 28.0016 + 28.0017 + 28.0018 + 28.0019 + 29 + 29.0001 + 29.0002 + 29.0003 + 29.0004 + 29.0005 + 29.0006 + 29.0007 + 29.0008 + 29.0009 + 29.001 + 29.0011 + 29.0012 + 29.0013 + 29.0014 + 29.0015 + 29.0016 + 29.0017 + 29.0018 + 29.0019 diff --git a/tools/testfiles/tdset2.h5.xml b/tools/testfiles/tdset2.h5.xml index a407ae8..34f43e1 100644 --- a/tools/testfiles/tdset2.h5.xml +++ b/tools/testfiles/tdset2.h5.xml @@ -12,7 +12,7 @@ - + @@ -28,16 +28,206 @@ - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 @@ -52,7 +242,7 @@ - + @@ -68,36 +258,306 @@ - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 diff --git a/tools/testfiles/tempty-dtd-2.h5.xml b/tools/testfiles/tempty-dtd-2.h5.xml index cff16fd..a9b1d4f 100644 --- a/tools/testfiles/tempty-dtd-2.h5.xml +++ b/tools/testfiles/tempty-dtd-2.h5.xml @@ -6,9 +6,9 @@ - + - + @@ -28,7 +28,10 @@ - + + + + @@ -36,9 +39,9 @@ - + - + @@ -53,7 +56,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -61,9 +67,9 @@ - + - + @@ -78,7 +84,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -86,9 +95,9 @@ - + - + @@ -108,7 +117,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 @@ -116,9 +128,9 @@ - + - + @@ -154,7 +166,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 diff --git a/tools/testfiles/tempty-dtd-uri.h5.xml b/tools/testfiles/tempty-dtd-uri.h5.xml index 76beb0f..d3c5e81 100644 --- a/tools/testfiles/tempty-dtd-uri.h5.xml +++ b/tools/testfiles/tempty-dtd-uri.h5.xml @@ -6,9 +6,9 @@ - + - + @@ -28,7 +28,10 @@ - + + + + @@ -36,9 +39,9 @@ - + - + @@ -53,7 +56,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -61,9 +67,9 @@ - + - + @@ -78,7 +84,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -86,9 +95,9 @@ - + - + @@ -108,7 +117,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 @@ -116,9 +128,9 @@ - + - + @@ -154,7 +166,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 diff --git a/tools/testfiles/tempty-dtd.h5.xml b/tools/testfiles/tempty-dtd.h5.xml index cff16fd..a9b1d4f 100644 --- a/tools/testfiles/tempty-dtd.h5.xml +++ b/tools/testfiles/tempty-dtd.h5.xml @@ -6,9 +6,9 @@ - + - + @@ -28,7 +28,10 @@ - + + + + @@ -36,9 +39,9 @@ - + - + @@ -53,7 +56,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -61,9 +67,9 @@ - + - + @@ -78,7 +84,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -86,9 +95,9 @@ - + - + @@ -108,7 +117,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 @@ -116,9 +128,9 @@ - + - + @@ -154,7 +166,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 diff --git a/tools/testfiles/tempty-nons-2.h5.xml b/tools/testfiles/tempty-nons-2.h5.xml index c43c163..219dbfd 100644 --- a/tools/testfiles/tempty-nons-2.h5.xml +++ b/tools/testfiles/tempty-nons-2.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -27,7 +27,10 @@ - + + + + @@ -35,9 +38,9 @@ - + - + @@ -52,7 +55,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -60,9 +66,9 @@ - + - + @@ -77,7 +83,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -85,9 +94,9 @@ - + - + @@ -107,7 +116,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 @@ -115,9 +127,9 @@ - + - + @@ -153,7 +165,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 diff --git a/tools/testfiles/tempty-nons-uri.h5.xml b/tools/testfiles/tempty-nons-uri.h5.xml index 28df2e6..032de41 100644 --- a/tools/testfiles/tempty-nons-uri.h5.xml +++ b/tools/testfiles/tempty-nons-uri.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -27,7 +27,10 @@ - + + + + @@ -35,9 +38,9 @@ - + - + @@ -52,7 +55,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -60,9 +66,9 @@ - + - + @@ -77,7 +83,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -85,9 +94,9 @@ - + - + @@ -107,7 +116,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 @@ -115,9 +127,9 @@ - + - + @@ -153,7 +165,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 diff --git a/tools/testfiles/tempty-nons.h5.xml b/tools/testfiles/tempty-nons.h5.xml index c43c163..219dbfd 100644 --- a/tools/testfiles/tempty-nons.h5.xml +++ b/tools/testfiles/tempty-nons.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -27,7 +27,10 @@ - + + + + @@ -35,9 +38,9 @@ - + - + @@ -52,7 +55,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -60,9 +66,9 @@ - + - + @@ -77,7 +83,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -85,9 +94,9 @@ - + - + @@ -107,7 +116,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 @@ -115,9 +127,9 @@ - + - + @@ -153,7 +165,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 diff --git a/tools/testfiles/tempty-ns-2.h5.xml b/tools/testfiles/tempty-ns-2.h5.xml index 4504115..3476b60 100644 --- a/tools/testfiles/tempty-ns-2.h5.xml +++ b/tools/testfiles/tempty-ns-2.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -27,7 +27,10 @@ - + + + + @@ -35,9 +38,9 @@ - + - + @@ -52,7 +55,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -60,9 +66,9 @@ - + - + @@ -77,7 +83,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -85,9 +94,9 @@ - + - + @@ -107,7 +116,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 @@ -115,9 +127,9 @@ - + - + @@ -153,7 +165,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 diff --git a/tools/testfiles/tempty-ns.h5.xml b/tools/testfiles/tempty-ns.h5.xml index 4504115..3476b60 100644 --- a/tools/testfiles/tempty-ns.h5.xml +++ b/tools/testfiles/tempty-ns.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -27,7 +27,10 @@ - + + + + @@ -35,9 +38,9 @@ - + - + @@ -52,7 +55,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -60,9 +66,9 @@ - + - + @@ -77,7 +83,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -85,9 +94,9 @@ - + - + @@ -107,7 +116,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 @@ -115,9 +127,9 @@ - + - + @@ -153,7 +165,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 diff --git a/tools/testfiles/tempty.h5.xml b/tools/testfiles/tempty.h5.xml index e6981a5..d75bc70 100644 --- a/tools/testfiles/tempty.h5.xml +++ b/tools/testfiles/tempty.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -27,7 +27,10 @@ - + + + + @@ -35,9 +38,9 @@ - + - + @@ -52,7 +55,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -60,9 +66,9 @@ - + - + @@ -77,7 +83,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -85,9 +94,9 @@ - + - + @@ -107,7 +116,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 @@ -115,9 +127,9 @@ - + - + @@ -153,7 +165,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 diff --git a/tools/testfiles/tenum.h5.xml b/tools/testfiles/tenum.h5.xml index 93cbfc8..ecc7804 100644 --- a/tools/testfiles/tenum.h5.xml +++ b/tools/testfiles/tenum.h5.xml @@ -49,9 +49,9 @@ green - + - + @@ -62,10 +62,26 @@ green - RED GREEN\ngreen BLUE blue GREEN\ngreen WHITE \"white\" WHITE \"white\" - BLACK \'black\' GREEN\ngreen BLUE blue RED RED BLUE blue GREEN\ngreen - BLACK \'black\' WHITE \"white\" RED WHITE \"white\" GREEN\ngreen - GREEN\ngreen BLUE blue + RED + GREEN\ngreen + BLUE blue + GREEN\ngreen + WHITE \"white\" + WHITE \"white\" + BLACK \'black\' + GREEN\ngreen + BLUE blue + RED + RED + BLUE blue + GREEN\ngreen + BLACK \'black\' + WHITE \"white\" + RED + WHITE \"white\" + GREEN\ngreen + GREEN\ngreen + BLUE blue diff --git a/tools/testfiles/texternal.ddl b/tools/testfiles/texternal.ddl index 7f7b69a..279831a 100644 --- a/tools/testfiles/texternal.ddl +++ b/tools/testfiles/texternal.ddl @@ -14,7 +14,7 @@ DATASET "external" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE diff --git a/tools/testfiles/textlinkfar.ddl b/tools/testfiles/textlinkfar.ddl index 45f2145..32b2b49 100644 --- a/tools/testfiles/textlinkfar.ddl +++ b/tools/testfiles/textlinkfar.ddl @@ -66,7 +66,6 @@ GROUP "/" { TARGETFILE "textlinktar.h5" TARGETPATH "type" DATATYPE "type" H5T_STD_I32LE; - } EXTERNAL_LINK "ext_link4" { TARGETFILE "textlinktar.h5" diff --git a/tools/testfiles/textlinksrc.ddl b/tools/testfiles/textlinksrc.ddl index 942477e..6ef0b44 100644 --- a/tools/testfiles/textlinksrc.ddl +++ b/tools/testfiles/textlinksrc.ddl @@ -59,7 +59,6 @@ GROUP "/" { TARGETFILE "textlinktar.h5" TARGETPATH "type" DATATYPE "type" H5T_STD_I32LE; - } EXTERNAL_LINK "ext_link4" { TARGETFILE "textlinktar.h5" diff --git a/tools/testfiles/tfill.ddl b/tools/testfiles/tfill.ddl index 87f9ae5..45497fd 100644 --- a/tools/testfiles/tfill.ddl +++ b/tools/testfiles/tfill.ddl @@ -13,7 +13,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE [ 0, 0, 0 ] + VALUE [ 0, 0, 0 ] } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE @@ -39,9 +39,9 @@ GROUP "/" { FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET VALUE { - 1, - 2 - } + 1, + 2 + } } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE @@ -70,7 +70,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_ALLOC - VALUE -99 + VALUE -99 } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE @@ -92,7 +92,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE -99 + VALUE -99 } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE @@ -114,7 +114,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_NEVER - VALUE -99 + VALUE -99 } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE @@ -136,7 +136,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_ALLOC - VALUE () + VALUE () } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE @@ -158,7 +158,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE diff --git a/tools/testfiles/tfletcher32.ddl b/tools/testfiles/tfletcher32.ddl index 0b7b1b8..072ef23 100644 --- a/tools/testfiles/tfletcher32.ddl +++ b/tools/testfiles/tfletcher32.ddl @@ -5,13 +5,13 @@ DATASET "fletcher32" { STORAGE_LAYOUT { CHUNKED ( 10, 5 ) SIZE 816 - } + } FILTERS { CHECKSUM FLETCHER32 } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tfpformat.ddl b/tools/testfiles/tfpformat.ddl index 6f0281b..2830ad5 100644 --- a/tools/testfiles/tfpformat.ddl +++ b/tools/testfiles/tfpformat.ddl @@ -4,14 +4,24 @@ GROUP "/" { DATATYPE H5T_IEEE_F64LE DATASPACE SIMPLE { ( 6 ) / ( 6 ) } DATA { - (0): -0.1234567, 0.1234567, 0.0000000, 0.0000000, 0.0000000, 0.0000000 + (0): -0.1234567, + (1): 0.1234567, + (2): 0.0000000, + (3): 0.0000000, + (4): 0.0000000, + (5): 0.0000000 } } DATASET "float" { DATATYPE H5T_IEEE_F32LE DATASPACE SIMPLE { ( 6 ) / ( 6 ) } DATA { - (0): -0.1234567, 0.1234567, 0.0000000, 0.0000000, 0.0000000, 0.0000000 + (0): -0.1234567, + (1): 0.1234567, + (2): 0.0000000, + (3): 0.0000000, + (4): 0.0000000, + (5): 0.0000000 } } } diff --git a/tools/testfiles/tfpformat.h5.xml b/tools/testfiles/tfpformat.h5.xml index 34af79a..c2bd96f 100644 --- a/tools/testfiles/tfpformat.h5.xml +++ b/tools/testfiles/tfpformat.h5.xml @@ -6,9 +6,9 @@ - + - + @@ -23,7 +23,12 @@ - -0.1234567 0.1234567 0.0000000 0.0000000 0.0000000 0.0000000 + -0.1234567 + 0.1234567 + 0.0000000 + 0.0000000 + 0.0000000 + 0.0000000 @@ -31,9 +36,9 @@ - + - + @@ -48,7 +53,12 @@ - -0.1234567 0.1234567 0.0000000 0.0000000 0.0000000 0.0000000 + -0.1234567 + 0.1234567 + 0.0000000 + 0.0000000 + 0.0000000 + 0.0000000 diff --git a/tools/testfiles/thlink.h5.xml b/tools/testfiles/thlink.h5.xml index b726087..65d7f8a 100644 --- a/tools/testfiles/thlink.h5.xml +++ b/tools/testfiles/thlink.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -22,7 +22,11 @@ - 0 1 2 3 4 + 0 + 1 + 2 + 3 + 4 @@ -37,10 +41,10 @@ - + - + diff --git a/tools/testfiles/tloop.h5.xml b/tools/testfiles/tloop.h5.xml index 4be3290..36e8f1b 100644 --- a/tools/testfiles/tloop.h5.xml +++ b/tools/testfiles/tloop.h5.xml @@ -4,12 +4,12 @@ - + - + diff --git a/tools/testfiles/tloop2.h5.xml b/tools/testfiles/tloop2.h5.xml index ffaf089..185e08b 100644 --- a/tools/testfiles/tloop2.h5.xml +++ b/tools/testfiles/tloop2.h5.xml @@ -7,7 +7,7 @@ - + diff --git a/tools/testfiles/tmany.h5.xml b/tools/testfiles/tmany.h5.xml index 8fc5e59..8056783 100644 --- a/tools/testfiles/tmany.h5.xml +++ b/tools/testfiles/tmany.h5.xml @@ -13,7 +13,7 @@ - + @@ -83,7 +83,16 @@ - 97 98 99 100 101 102 103 104 105 0 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 0 @@ -101,8 +110,10 @@ - 0 1 - 2 3 + 0 + 1 + 2 + 3 @@ -119,145 +130,28 @@ - 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 + 0 + 0.1 + 0.2 + 0.3 + 0.4 + 0.5 + 0.6 + 0.7 + 0.8 + 0.9 - 0 1 - 0 1 - 0 1 - 0 1 - 0 1 - 0 1 - 0 1 - 0 1 0 1 - 0 1 - 0 1 - 0 1 - 0 1 - 0 1 - 0 1 - 0 1 6 7 - 6 7 - 6 7 - 6 7 - 6 7 - 6 7 - 6 7 - 6 7 - 1 2 - 1 2 - 1 2 - 1 2 - 1 2 - 1 2 - 1 2 - 1 2 1 2 - 1 2 - 1 2 - 1 2 - 1 2 - 1 2 - 1 2 - 1 2 7 8 - 7 8 - 7 8 - 7 8 - 7 8 - 7 8 - 7 8 - 7 8 - 2 3 - 2 3 - 2 3 - 2 3 - 2 3 - 2 3 - 2 3 - 2 3 2 3 - 2 3 - 2 3 - 2 3 - 2 3 - 2 3 - 2 3 - 2 3 8 9 - 8 9 - 8 9 - 8 9 - 8 9 - 8 9 - 8 9 - 8 9 - 3 4 - 3 4 - 3 4 - 3 4 - 3 4 - 3 4 - 3 4 - 3 4 3 4 - 3 4 - 3 4 - 3 4 - 3 4 - 3 4 - 3 4 - 3 4 9 10 - 9 10 - 9 10 - 9 10 - 9 10 - 9 10 - 9 10 - 9 10 - 4 5 - 4 5 - 4 5 - 4 5 - 4 5 - 4 5 - 4 5 - 4 5 4 5 - 4 5 - 4 5 - 4 5 - 4 5 - 4 5 - 4 5 - 4 5 10 11 - 10 11 - 10 11 - 10 11 - 10 11 - 10 11 - 10 11 - 10 11 - 5 6 - 5 6 - 5 6 - 5 6 - 5 6 - 5 6 - 5 6 - 5 6 5 6 - 5 6 - 5 6 - 5 6 - 5 6 - 5 6 - 5 6 - 5 6 11 12 - 11 12 - 11 12 - 11 12 - 11 12 - 11 12 - 11 12 - 11 12 + 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 + 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 + 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 8 9 8 9 8 9 8 9 8 9 8 9 8 9 8 9 + 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 + 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 10 11 10 11 10 11 10 11 10 11 10 11 10 11 10 11 + 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 11 12 11 12 11 12 11 12 11 12 11 12 11 12 11 12 @@ -276,9 +170,9 @@ - + - + @@ -294,16 +188,106 @@ - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 @@ -321,9 +305,9 @@ - + - + @@ -339,16 +323,106 @@ - 0 0 0 0 0 0 0 0 0 0 - 1 1 1 1 1 1 1 1 1 1 - 2 2 2 2 2 2 2 2 2 2 - 3 3 3 3 3 3 3 3 3 3 - 4 4 4 4 4 4 4 4 4 4 - 5 5 5 5 5 5 5 5 5 5 - 6 6 6 6 6 6 6 6 6 6 - 7 7 7 7 7 7 7 7 7 7 - 8 8 8 8 8 8 8 8 8 8 - 9 9 9 9 9 9 9 9 9 9 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 7 + 7 + 7 + 7 + 7 + 7 + 7 + 7 + 7 + 7 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 diff --git a/tools/testfiles/tname-amp.h5.xml b/tools/testfiles/tname-amp.h5.xml index 0893511..f28cdc5 100644 --- a/tools/testfiles/tname-amp.h5.xml +++ b/tools/testfiles/tname-amp.h5.xml @@ -14,7 +14,16 @@ - 97 98 99 100 101 102 103 104 105 0 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 0 @@ -23,9 +32,9 @@ - + - + @@ -41,16 +50,106 @@ - 0 0 0 0 0 0 0 0 0 0 - 0 1 2 3 4 5 6 7 8 9 - 0 2 4 6 8 10 12 14 16 18 - 0 3 6 9 12 15 18 21 24 27 - 0 4 8 12 16 20 24 28 32 36 - 0 5 10 15 20 25 30 35 40 45 - 0 6 12 18 24 30 36 42 48 54 - 0 7 14 21 28 35 42 49 56 63 - 0 8 16 24 32 40 48 56 64 72 - 0 9 18 27 36 45 54 63 72 81 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 2 + 4 + 6 + 8 + 10 + 12 + 14 + 16 + 18 + 0 + 3 + 6 + 9 + 12 + 15 + 18 + 21 + 24 + 27 + 0 + 4 + 8 + 12 + 16 + 20 + 24 + 28 + 32 + 36 + 0 + 5 + 10 + 15 + 20 + 25 + 30 + 35 + 40 + 45 + 0 + 6 + 12 + 18 + 24 + 30 + 36 + 42 + 48 + 54 + 0 + 7 + 14 + 21 + 28 + 35 + 42 + 49 + 56 + 63 + 0 + 8 + 16 + 24 + 32 + 40 + 48 + 56 + 64 + 72 + 0 + 9 + 18 + 27 + 36 + 45 + 54 + 63 + 72 + 81 diff --git a/tools/testfiles/tname-apos.h5.xml b/tools/testfiles/tname-apos.h5.xml index 47f55a2..2194971 100644 --- a/tools/testfiles/tname-apos.h5.xml +++ b/tools/testfiles/tname-apos.h5.xml @@ -14,7 +14,16 @@ - 97 98 99 100 101 102 103 104 105 0 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 0 @@ -23,9 +32,9 @@ - + - + @@ -41,16 +50,106 @@ - 0 0 0 0 0 0 0 0 0 0 - 0 1 2 3 4 5 6 7 8 9 - 0 2 4 6 8 10 12 14 16 18 - 0 3 6 9 12 15 18 21 24 27 - 0 4 8 12 16 20 24 28 32 36 - 0 5 10 15 20 25 30 35 40 45 - 0 6 12 18 24 30 36 42 48 54 - 0 7 14 21 28 35 42 49 56 63 - 0 8 16 24 32 40 48 56 64 72 - 0 9 18 27 36 45 54 63 72 81 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 2 + 4 + 6 + 8 + 10 + 12 + 14 + 16 + 18 + 0 + 3 + 6 + 9 + 12 + 15 + 18 + 21 + 24 + 27 + 0 + 4 + 8 + 12 + 16 + 20 + 24 + 28 + 32 + 36 + 0 + 5 + 10 + 15 + 20 + 25 + 30 + 35 + 40 + 45 + 0 + 6 + 12 + 18 + 24 + 30 + 36 + 42 + 48 + 54 + 0 + 7 + 14 + 21 + 28 + 35 + 42 + 49 + 56 + 63 + 0 + 8 + 16 + 24 + 32 + 40 + 48 + 56 + 64 + 72 + 0 + 9 + 18 + 27 + 36 + 45 + 54 + 63 + 72 + 81 diff --git a/tools/testfiles/tname-gt.h5.xml b/tools/testfiles/tname-gt.h5.xml index e21909e..6a56587 100644 --- a/tools/testfiles/tname-gt.h5.xml +++ b/tools/testfiles/tname-gt.h5.xml @@ -14,7 +14,16 @@ - 97 98 99 100 101 102 103 104 105 0 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 0 @@ -23,9 +32,9 @@ - + - + @@ -41,16 +50,106 @@ - 0 0 0 0 0 0 0 0 0 0 - 0 1 2 3 4 5 6 7 8 9 - 0 2 4 6 8 10 12 14 16 18 - 0 3 6 9 12 15 18 21 24 27 - 0 4 8 12 16 20 24 28 32 36 - 0 5 10 15 20 25 30 35 40 45 - 0 6 12 18 24 30 36 42 48 54 - 0 7 14 21 28 35 42 49 56 63 - 0 8 16 24 32 40 48 56 64 72 - 0 9 18 27 36 45 54 63 72 81 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 2 + 4 + 6 + 8 + 10 + 12 + 14 + 16 + 18 + 0 + 3 + 6 + 9 + 12 + 15 + 18 + 21 + 24 + 27 + 0 + 4 + 8 + 12 + 16 + 20 + 24 + 28 + 32 + 36 + 0 + 5 + 10 + 15 + 20 + 25 + 30 + 35 + 40 + 45 + 0 + 6 + 12 + 18 + 24 + 30 + 36 + 42 + 48 + 54 + 0 + 7 + 14 + 21 + 28 + 35 + 42 + 49 + 56 + 63 + 0 + 8 + 16 + 24 + 32 + 40 + 48 + 56 + 64 + 72 + 0 + 9 + 18 + 27 + 36 + 45 + 54 + 63 + 72 + 81 diff --git a/tools/testfiles/tname-lt.h5.xml b/tools/testfiles/tname-lt.h5.xml index 3738de9..a6d2480 100644 --- a/tools/testfiles/tname-lt.h5.xml +++ b/tools/testfiles/tname-lt.h5.xml @@ -14,7 +14,16 @@ - 97 98 99 100 101 102 103 104 105 0 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 0 @@ -23,9 +32,9 @@ - + - + @@ -41,16 +50,106 @@ - 0 0 0 0 0 0 0 0 0 0 - 0 1 2 3 4 5 6 7 8 9 - 0 2 4 6 8 10 12 14 16 18 - 0 3 6 9 12 15 18 21 24 27 - 0 4 8 12 16 20 24 28 32 36 - 0 5 10 15 20 25 30 35 40 45 - 0 6 12 18 24 30 36 42 48 54 - 0 7 14 21 28 35 42 49 56 63 - 0 8 16 24 32 40 48 56 64 72 - 0 9 18 27 36 45 54 63 72 81 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 2 + 4 + 6 + 8 + 10 + 12 + 14 + 16 + 18 + 0 + 3 + 6 + 9 + 12 + 15 + 18 + 21 + 24 + 27 + 0 + 4 + 8 + 12 + 16 + 20 + 24 + 28 + 32 + 36 + 0 + 5 + 10 + 15 + 20 + 25 + 30 + 35 + 40 + 45 + 0 + 6 + 12 + 18 + 24 + 30 + 36 + 42 + 48 + 54 + 0 + 7 + 14 + 21 + 28 + 35 + 42 + 49 + 56 + 63 + 0 + 8 + 16 + 24 + 32 + 40 + 48 + 56 + 64 + 72 + 0 + 9 + 18 + 27 + 36 + 45 + 54 + 63 + 72 + 81 diff --git a/tools/testfiles/tname-quot.h5.xml b/tools/testfiles/tname-quot.h5.xml index 9da93c5..96ad068 100644 --- a/tools/testfiles/tname-quot.h5.xml +++ b/tools/testfiles/tname-quot.h5.xml @@ -14,7 +14,16 @@ - 97 98 99 100 101 102 103 104 105 0 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 0 @@ -23,9 +32,9 @@ - + - + @@ -41,16 +50,106 @@ - 0 0 0 0 0 0 0 0 0 0 - 0 1 2 3 4 5 6 7 8 9 - 0 2 4 6 8 10 12 14 16 18 - 0 3 6 9 12 15 18 21 24 27 - 0 4 8 12 16 20 24 28 32 36 - 0 5 10 15 20 25 30 35 40 45 - 0 6 12 18 24 30 36 42 48 54 - 0 7 14 21 28 35 42 49 56 63 - 0 8 16 24 32 40 48 56 64 72 - 0 9 18 27 36 45 54 63 72 81 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 2 + 4 + 6 + 8 + 10 + 12 + 14 + 16 + 18 + 0 + 3 + 6 + 9 + 12 + 15 + 18 + 21 + 24 + 27 + 0 + 4 + 8 + 12 + 16 + 20 + 24 + 28 + 32 + 36 + 0 + 5 + 10 + 15 + 20 + 25 + 30 + 35 + 40 + 45 + 0 + 6 + 12 + 18 + 24 + 30 + 36 + 42 + 48 + 54 + 0 + 7 + 14 + 21 + 28 + 35 + 42 + 49 + 56 + 63 + 0 + 8 + 16 + 24 + 32 + 40 + 48 + 56 + 64 + 72 + 0 + 9 + 18 + 27 + 36 + 45 + 54 + 63 + 72 + 81 diff --git a/tools/testfiles/tname-sp.h5.xml b/tools/testfiles/tname-sp.h5.xml index 3bdc6a8..d6f8278 100644 --- a/tools/testfiles/tname-sp.h5.xml +++ b/tools/testfiles/tname-sp.h5.xml @@ -14,7 +14,16 @@ - 97 98 99 100 101 102 103 104 105 0 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 0 @@ -23,9 +32,9 @@ - + - + @@ -41,16 +50,106 @@ - 0 0 0 0 0 0 0 0 0 0 - 0 1 2 3 4 5 6 7 8 9 - 0 2 4 6 8 10 12 14 16 18 - 0 3 6 9 12 15 18 21 24 27 - 0 4 8 12 16 20 24 28 32 36 - 0 5 10 15 20 25 30 35 40 45 - 0 6 12 18 24 30 36 42 48 54 - 0 7 14 21 28 35 42 49 56 63 - 0 8 16 24 32 40 48 56 64 72 - 0 9 18 27 36 45 54 63 72 81 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 2 + 4 + 6 + 8 + 10 + 12 + 14 + 16 + 18 + 0 + 3 + 6 + 9 + 12 + 15 + 18 + 21 + 24 + 27 + 0 + 4 + 8 + 12 + 16 + 20 + 24 + 28 + 32 + 36 + 0 + 5 + 10 + 15 + 20 + 25 + 30 + 35 + 40 + 45 + 0 + 6 + 12 + 18 + 24 + 30 + 36 + 42 + 48 + 54 + 0 + 7 + 14 + 21 + 28 + 35 + 42 + 49 + 56 + 63 + 0 + 8 + 16 + 24 + 32 + 40 + 48 + 56 + 64 + 72 + 0 + 9 + 18 + 27 + 36 + 45 + 54 + 63 + 72 + 81 diff --git a/tools/testfiles/tnamed_dtype_attr.ddl b/tools/testfiles/tnamed_dtype_attr.ddl index 48afaf8..7cd14ef 100644 --- a/tools/testfiles/tnamed_dtype_attr.ddl +++ b/tools/testfiles/tnamed_dtype_attr.ddl @@ -22,9 +22,7 @@ GROUP "/" { (0): 8 } } - DATATYPE "Link_to_Datatype" HARDLINK "/Datatype" - GROUP "g1" { ATTRIBUTE "Attribute" { DATATYPE "/Datatype" diff --git a/tools/testfiles/tnamed_dtype_attr.h5.xml b/tools/testfiles/tnamed_dtype_attr.h5.xml index aee7915..199211c 100644 --- a/tools/testfiles/tnamed_dtype_attr.h5.xml +++ b/tools/testfiles/tnamed_dtype_attr.h5.xml @@ -5,9 +5,9 @@ - + - + diff --git a/tools/testfiles/tnbit.ddl b/tools/testfiles/tnbit.ddl index 85a0d9a..bd32eaa 100644 --- a/tools/testfiles/tnbit.ddl +++ b/tools/testfiles/tnbit.ddl @@ -5,13 +5,13 @@ DATASET "nbit" { STORAGE_LAYOUT { CHUNKED ( 10, 5 ) SIZE 76 (10.526:1 COMPRESSION) - } + } FILTERS { COMPRESSION NBIT } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tnestedcomp.h5.xml b/tools/testfiles/tnestedcomp.h5.xml index f5f9fea..2cae353 100644 --- a/tools/testfiles/tnestedcomp.h5.xml +++ b/tools/testfiles/tnestedcomp.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -68,11 +68,16 @@ - 0 0 1 "A" -100 100 1 1 0.5 "B" -100 100 2 4 0.333333 "C" -100 100 - 3 9 0.25 "D" -100 100 4 16 0.2 "E" -100 100 - 5 25 0.166667 "F" -100 100 6 36 0.142857 "G" -100 100 - 7 49 0.125 "H" -100 100 8 64 0.111111 "I" -100 100 - 9 81 0.1 "J" -100 100 + 0 0 1 "A" -100 100 + 1 1 0.5 "B" -100 100 + 2 4 0.333333 "C" -100 100 + 3 9 0.25 "D" -100 100 + 4 16 0.2 "E" -100 100 + 5 25 0.166667 "F" -100 100 + 6 36 0.142857 "G" -100 100 + 7 49 0.125 "H" -100 100 + 8 64 0.111111 "I" -100 100 + 9 81 0.1 "J" -100 100 diff --git a/tools/testfiles/tnodata.h5.xml b/tools/testfiles/tnodata.h5.xml index dc48c7a..17b4ac9 100644 --- a/tools/testfiles/tnodata.h5.xml +++ b/tools/testfiles/tnodata.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -22,7 +22,11 @@ - 0 0 0 0 0 + 0 + 0 + 0 + 0 + 0 diff --git a/tools/testfiles/tobjref.h5.xml b/tools/testfiles/tobjref.h5.xml index b8c7fc5..016b298 100644 --- a/tools/testfiles/tobjref.h5.xml +++ b/tools/testfiles/tobjref.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -36,9 +36,9 @@ - + - + @@ -53,7 +53,10 @@ - 0 3 6 9 + 0 + 3 + 6 + 9 @@ -61,9 +64,9 @@ - + - + @@ -78,7 +81,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 diff --git a/tools/testfiles/topaque.h5.xml b/tools/testfiles/topaque.h5.xml index 1e20336..314fd23 100644 --- a/tools/testfiles/topaque.h5.xml +++ b/tools/testfiles/topaque.h5.xml @@ -5,9 +5,9 @@ - + - + diff --git a/tools/testfiles/torderattr1.ddl b/tools/testfiles/torderattr1.ddl index f46354b..fb7fd70 100644 --- a/tools/testfiles/torderattr1.ddl +++ b/tools/testfiles/torderattr1.ddl @@ -85,7 +85,6 @@ GROUP "/" { DATATYPE H5T_STD_U8LE DATASPACE SCALAR } - DATATYPE "tt" H5T_STD_I32LE; ATTRIBUTE "a" { DATATYPE H5T_STD_U8LE @@ -99,6 +98,5 @@ GROUP "/" { DATATYPE H5T_STD_U8LE DATASPACE SCALAR } - } } diff --git a/tools/testfiles/torderattr1.h5.xml b/tools/testfiles/torderattr1.h5.xml index bfba4d0..027cd64 100644 --- a/tools/testfiles/torderattr1.h5.xml +++ b/tools/testfiles/torderattr1.h5.xml @@ -44,9 +44,9 @@ - + - + @@ -104,9 +104,9 @@ - + - + diff --git a/tools/testfiles/torderattr2.ddl b/tools/testfiles/torderattr2.ddl index 6cc1d41..dbf615b 100644 --- a/tools/testfiles/torderattr2.ddl +++ b/tools/testfiles/torderattr2.ddl @@ -25,7 +25,6 @@ GROUP "/" { DATATYPE H5T_STD_U8LE DATASPACE SCALAR } - DATATYPE "t" H5T_STD_I32LE; ATTRIBUTE "c" { DATATYPE H5T_STD_U8LE @@ -39,7 +38,6 @@ GROUP "/" { DATATYPE H5T_STD_U8LE DATASPACE SCALAR } - GROUP "gt" { ATTRIBUTE "c" { DATATYPE H5T_STD_U8LE diff --git a/tools/testfiles/torderattr2.h5.xml b/tools/testfiles/torderattr2.h5.xml index 11f2266..fe441da 100644 --- a/tools/testfiles/torderattr2.h5.xml +++ b/tools/testfiles/torderattr2.h5.xml @@ -140,9 +140,9 @@ - + - + @@ -200,9 +200,9 @@ - + - + diff --git a/tools/testfiles/torderattr3.ddl b/tools/testfiles/torderattr3.ddl index 2956886..a2990f7 100644 --- a/tools/testfiles/torderattr3.ddl +++ b/tools/testfiles/torderattr3.ddl @@ -85,7 +85,6 @@ GROUP "/" { DATATYPE H5T_STD_U8LE DATASPACE SCALAR } - DATATYPE "tt" H5T_STD_I32LE; ATTRIBUTE "c" { DATATYPE H5T_STD_U8LE @@ -99,6 +98,5 @@ GROUP "/" { DATATYPE H5T_STD_U8LE DATASPACE SCALAR } - } } diff --git a/tools/testfiles/torderattr3.h5.xml b/tools/testfiles/torderattr3.h5.xml index 10ea95e..38bbef7 100644 --- a/tools/testfiles/torderattr3.h5.xml +++ b/tools/testfiles/torderattr3.h5.xml @@ -44,9 +44,9 @@ - + - + @@ -104,9 +104,9 @@ - + - + diff --git a/tools/testfiles/torderattr4.ddl b/tools/testfiles/torderattr4.ddl index 090b44b..000a852 100644 --- a/tools/testfiles/torderattr4.ddl +++ b/tools/testfiles/torderattr4.ddl @@ -25,7 +25,6 @@ GROUP "/" { DATATYPE H5T_STD_U8LE DATASPACE SCALAR } - DATATYPE "t" H5T_STD_I32LE; ATTRIBUTE "c" { DATATYPE H5T_STD_U8LE @@ -39,7 +38,6 @@ GROUP "/" { DATATYPE H5T_STD_U8LE DATASPACE SCALAR } - GROUP "gt" { ATTRIBUTE "a" { DATATYPE H5T_STD_U8LE diff --git a/tools/testfiles/torderattr4.h5.xml b/tools/testfiles/torderattr4.h5.xml index 2546b30..0f90b22 100644 --- a/tools/testfiles/torderattr4.h5.xml +++ b/tools/testfiles/torderattr4.h5.xml @@ -140,9 +140,9 @@ - + - + @@ -200,9 +200,9 @@ - + - + diff --git a/tools/testfiles/tref-escapes-at.h5.xml b/tools/testfiles/tref-escapes-at.h5.xml index a136651..8126484 100644 --- a/tools/testfiles/tref-escapes-at.h5.xml +++ b/tools/testfiles/tref-escapes-at.h5.xml @@ -6,9 +6,9 @@ - + - + @@ -23,7 +23,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -31,9 +34,9 @@ - + - + @@ -48,7 +51,10 @@ - 0 3 6 9 + 0 + 3 + 6 + 9 @@ -56,9 +62,9 @@ - + - + @@ -73,7 +79,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -81,9 +90,9 @@ - + - + @@ -98,7 +107,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -106,9 +118,9 @@ - + - + @@ -123,7 +135,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -131,9 +146,9 @@ - + - + @@ -148,7 +163,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -156,9 +174,9 @@ - + - + @@ -173,7 +191,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -182,9 +203,9 @@ - + - + @@ -210,11 +231,11 @@ - - - "/Group1/Dataset&amp" - - + + + "/Group1/Dataset&amp" + + @@ -229,11 +250,11 @@ - - - "/Group1/Dataset'apos" - - + + + "/Group1/Dataset'apos" + + @@ -248,11 +269,11 @@ - - - "/Group1/Dataset>gt" - - + + + "/Group1/Dataset>gt" + + @@ -267,11 +288,11 @@ - - - "/Group1/Dataset<lt" - - + + + "/Group1/Dataset<lt" + + @@ -286,11 +307,11 @@ - - - "/Group1/Dataset\"quote" - - + + + "/Group1/Dataset\"quote" + + @@ -305,11 +326,11 @@ - - - "/Group1/Dataset\\slash" - - + + + "/Group1/Dataset\\slash" + + @@ -324,11 +345,11 @@ - - - "/Group1/Dataset space" - - + + + "/Group1/Dataset space" + + diff --git a/tools/testfiles/tref-escapes.h5.xml b/tools/testfiles/tref-escapes.h5.xml index c70793f..6c6455b 100644 --- a/tools/testfiles/tref-escapes.h5.xml +++ b/tools/testfiles/tref-escapes.h5.xml @@ -6,9 +6,9 @@ - + - + @@ -23,7 +23,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -31,9 +34,9 @@ - + - + @@ -48,7 +51,10 @@ - 0 3 6 9 + 0 + 3 + 6 + 9 @@ -56,9 +62,9 @@ - + - + @@ -73,7 +79,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -81,9 +90,9 @@ - + - + @@ -98,7 +107,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -106,9 +118,9 @@ - + - + @@ -123,7 +135,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -131,9 +146,9 @@ - + - + @@ -148,7 +163,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -156,9 +174,9 @@ - + - + @@ -173,7 +191,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -182,9 +203,9 @@ - + - + diff --git a/tools/testfiles/tref.h5.xml b/tools/testfiles/tref.h5.xml index e70e0c2..7ff360e 100644 --- a/tools/testfiles/tref.h5.xml +++ b/tools/testfiles/tref.h5.xml @@ -6,9 +6,9 @@ - + - + @@ -23,7 +23,10 @@ - 0 3 6 9 + 0 + 3 + 6 + 9 @@ -31,9 +34,9 @@ - + - + @@ -48,7 +51,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -57,9 +63,9 @@ - + - + diff --git a/tools/testfiles/treference.ddl b/tools/testfiles/treference.ddl index d99dc6f..4683ce5 100644 --- a/tools/testfiles/treference.ddl +++ b/tools/testfiles/treference.ddl @@ -225,10 +225,10 @@ GROUP "/" { } ATTRIBUTE "enum" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): RED, RED @@ -236,10 +236,10 @@ GROUP "/" { } ATTRIBUTE "enum2D" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): RED, RED, @@ -249,10 +249,10 @@ GROUP "/" { } ATTRIBUTE "enum3D" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): RED, RED, @@ -338,20 +338,18 @@ GROUP "/" { } } ATTRIBUTE "opaque" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): 0x01, 0x02 } } ATTRIBUTE "opaque2D" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): 0x01, 0x02, @@ -360,10 +358,9 @@ GROUP "/" { } } ATTRIBUTE "opaque3D" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): 0x01, 0x02, @@ -382,11 +379,11 @@ GROUP "/" { } ATTRIBUTE "string" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): "ab", "de" @@ -394,11 +391,11 @@ GROUP "/" { } ATTRIBUTE "string2D" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): "ab", "cd", @@ -408,11 +405,11 @@ GROUP "/" { } ATTRIBUTE "string3D" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): "ab", "cd", @@ -694,10 +691,10 @@ GROUP "/" { } ATTRIBUTE "enum" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): RED, RED @@ -705,10 +702,10 @@ GROUP "/" { } ATTRIBUTE "enum2D" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): RED, RED, @@ -718,10 +715,10 @@ GROUP "/" { } ATTRIBUTE "enum3D" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): RED, RED, @@ -807,20 +804,18 @@ GROUP "/" { } } ATTRIBUTE "opaque" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): 0x01, 0x02 } } ATTRIBUTE "opaque2D" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): 0x01, 0x02, @@ -829,10 +824,9 @@ GROUP "/" { } } ATTRIBUTE "opaque3D" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): 0x01, 0x02, @@ -885,11 +879,11 @@ GROUP "/" { } ATTRIBUTE "string" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): "ab", "de" @@ -897,11 +891,11 @@ GROUP "/" { } ATTRIBUTE "string2D" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): "ab", "cd", @@ -911,11 +905,11 @@ GROUP "/" { } ATTRIBUTE "string3D" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): "ab", "cd", @@ -1193,10 +1187,10 @@ GROUP "/" { } ATTRIBUTE "enum" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): RED, RED @@ -1204,10 +1198,10 @@ GROUP "/" { } ATTRIBUTE "enum2D" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): RED, RED, @@ -1217,10 +1211,10 @@ GROUP "/" { } ATTRIBUTE "enum3D" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): RED, RED, @@ -1306,20 +1300,18 @@ GROUP "/" { } } ATTRIBUTE "opaque" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): 0x01, 0x02 } } ATTRIBUTE "opaque2D" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): 0x01, 0x02, @@ -1328,10 +1320,9 @@ GROUP "/" { } } ATTRIBUTE "opaque3D" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): 0x01, 0x02, @@ -1350,11 +1341,11 @@ GROUP "/" { } ATTRIBUTE "string" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): "ab", "de" @@ -1362,11 +1353,11 @@ GROUP "/" { } ATTRIBUTE "string2D" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): "ab", "cd", @@ -1376,11 +1367,11 @@ GROUP "/" { } ATTRIBUTE "string3D" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): "ab", "cd", @@ -1658,10 +1649,10 @@ GROUP "/" { } DATASET "enum" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): RED, RED @@ -1669,10 +1660,10 @@ GROUP "/" { } DATASET "enum2D" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): RED, RED, @@ -1682,10 +1673,10 @@ GROUP "/" { } DATASET "enum3D" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): RED, RED, @@ -1771,20 +1762,18 @@ GROUP "/" { } } DATASET "opaque" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): 0x01, 0x02 } } DATASET "opaque2D" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): 0x01, 0x02, @@ -1793,10 +1782,9 @@ GROUP "/" { } } DATASET "opaque3D" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): 0x01, 0x02, @@ -1849,11 +1837,11 @@ GROUP "/" { } DATASET "string" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): "ab", "de" @@ -1861,11 +1849,11 @@ GROUP "/" { } DATASET "string2D" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): "ab", "cd", @@ -1875,11 +1863,11 @@ GROUP "/" { } DATASET "string3D" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): "ab", "cd", diff --git a/tools/testfiles/tsaf.h5.xml b/tools/testfiles/tsaf.h5.xml index 6b7f5c5..8da41b9 100644 --- a/tools/testfiles/tsaf.h5.xml +++ b/tools/testfiles/tsaf.h5.xml @@ -11,7 +11,7 @@ - + @@ -26,281 +26,5925 @@ - 47 32 67 79 78 84 65 73 78 69 82 10 47 46 97 116 116 114 105 98 117 116 - 101 115 32 67 79 78 84 65 73 78 69 82 10 47 46 97 116 116 114 105 98 - 117 116 101 115 47 100 97 116 97 98 97 115 101 32 67 79 78 84 65 73 78 - 69 82 10 47 46 97 116 116 114 105 98 117 116 101 115 47 100 97 116 97 - 98 97 115 101 47 46 83 65 70 95 68 98 80 114 111 112 115 32 68 65 84 65 - 83 69 84 32 115 116 114 117 99 116 32 83 65 70 95 68 98 80 114 111 112 - 115 123 105 110 116 32 109 97 103 105 99 59 99 104 97 114 32 83 70 105 - 108 101 68 105 114 91 49 48 50 52 93 59 99 104 97 114 32 73 109 112 111 - 114 116 70 105 108 101 91 49 48 50 52 93 59 105 110 116 32 112 97 114 - 97 108 108 101 108 59 115 116 114 117 99 116 32 83 65 70 95 86 101 114 - 115 105 111 110 73 110 102 111 123 105 110 116 32 118 109 97 106 111 - 114 59 105 110 116 32 118 109 105 110 111 114 59 105 110 116 32 114 101 - 108 59 99 104 97 114 32 97 110 110 111 116 91 49 48 93 59 125 115 97 - 102 97 112 105 59 115 116 114 117 99 116 32 83 65 70 95 86 101 114 115 - 105 111 110 73 110 102 111 123 105 110 116 32 118 109 97 106 111 114 59 - 105 110 116 32 118 109 105 110 111 114 59 105 110 116 32 114 101 108 59 - 99 104 97 114 32 97 110 110 111 116 91 49 48 93 59 125 115 97 102 108 - 105 98 59 115 116 114 117 99 116 32 83 65 70 95 86 101 114 115 105 111 - 110 73 110 102 111 123 105 110 116 32 118 109 97 106 111 114 59 105 110 - 116 32 118 109 105 110 111 114 59 105 110 116 32 114 101 108 59 99 104 - 97 114 32 97 110 110 111 116 91 49 48 93 59 125 118 98 116 59 115 116 - 114 117 99 116 32 83 65 70 95 86 101 114 115 105 111 110 73 110 102 111 - 123 105 110 116 32 118 109 97 106 111 114 59 105 110 116 32 118 109 105 - 110 111 114 59 105 110 116 32 114 101 108 59 99 104 97 114 32 97 110 - 110 111 116 91 49 48 93 59 125 100 115 108 59 115 116 114 117 99 116 32 - 83 65 70 95 86 101 114 115 105 111 110 73 110 102 111 123 105 110 116 - 32 118 109 97 106 111 114 59 105 110 116 32 118 109 105 110 111 114 59 - 105 110 116 32 114 101 108 59 99 104 97 114 32 97 110 110 111 116 91 49 - 48 93 59 125 104 100 102 53 59 115 116 114 117 99 116 32 83 65 70 95 86 - 101 114 115 105 111 110 73 110 102 111 123 105 110 116 32 118 109 97 - 106 111 114 59 105 110 116 32 118 109 105 110 111 114 59 105 110 116 32 - 114 101 108 59 99 104 97 114 32 97 110 110 111 116 91 49 48 93 59 125 - 109 112 105 59 105 110 116 32 68 111 84 111 99 59 105 110 116 32 82 101 - 97 100 79 110 108 121 59 105 110 116 32 67 108 111 98 98 101 114 59 105 - 110 116 32 79 83 77 111 100 101 115 59 125 59 10 47 115 115 114 101 108 - 45 95 48 48 48 48 32 68 65 84 65 83 69 84 32 105 110 116 59 10 47 115 - 115 114 101 108 45 95 48 48 48 49 32 68 65 84 65 83 69 84 32 105 110 - 116 59 10 47 115 115 114 101 108 45 95 48 48 48 50 32 68 65 84 65 83 69 - 84 32 105 110 116 59 10 47 115 115 114 101 108 45 95 48 48 48 51 32 68 - 65 84 65 83 69 84 32 105 110 116 59 10 47 115 115 114 101 108 45 95 48 - 48 48 52 32 68 65 84 65 83 69 84 32 105 110 116 59 10 47 115 115 114 - 101 108 45 95 48 48 48 53 32 68 65 84 65 83 69 84 32 105 110 116 59 10 - 47 115 115 114 101 108 45 95 48 48 48 54 32 68 65 84 65 83 69 84 32 105 - 110 116 59 10 47 115 115 114 101 108 45 95 48 48 48 55 32 68 65 84 65 - 83 69 84 32 105 110 116 59 10 47 115 115 114 101 108 45 95 48 48 48 56 - 32 68 65 84 65 83 69 84 32 105 110 116 59 10 47 115 115 114 101 108 45 - 95 48 48 48 57 32 68 65 84 65 83 69 84 32 105 110 116 59 10 47 115 115 - 114 101 108 45 95 48 48 49 48 32 68 65 84 65 83 69 84 32 105 110 116 59 - 10 47 115 115 114 101 108 45 95 48 48 49 49 32 68 65 84 65 83 69 84 32 - 105 110 116 59 10 47 115 115 114 101 108 45 95 48 48 49 50 32 68 65 84 - 65 83 69 84 32 105 110 116 59 10 47 116 111 112 111 114 101 108 45 95 - 48 48 49 55 32 68 65 84 65 83 69 84 32 105 110 116 59 10 47 116 111 112 - 111 114 101 108 45 95 48 48 49 56 32 68 65 84 65 83 69 84 32 105 110 - 116 59 10 47 116 111 112 111 114 101 108 45 95 48 48 49 57 32 68 65 84 - 65 83 69 84 32 105 110 116 59 10 47 116 111 112 111 114 101 108 45 95 - 48 48 50 48 32 68 65 84 65 83 69 84 32 105 110 116 59 10 47 102 105 101 - 108 100 45 99 111 111 114 100 115 95 48 48 48 50 32 68 65 84 65 83 69 - 84 32 102 108 111 97 116 59 10 47 102 105 101 108 100 45 100 105 115 - 116 114 105 98 117 116 105 111 110 95 102 97 99 116 111 114 115 95 48 - 48 48 51 32 68 65 84 65 83 69 84 32 102 108 111 97 116 59 10 47 102 105 - 101 108 100 45 116 101 109 112 101 114 97 116 117 114 101 95 48 48 48 - 52 32 68 65 84 65 83 69 84 32 102 108 111 97 116 59 10 47 102 105 101 - 108 100 45 100 105 115 112 108 97 99 101 109 101 110 116 115 95 48 48 - 48 55 32 68 65 84 65 83 69 84 32 102 108 111 97 116 59 10 47 102 105 - 101 108 100 45 115 116 114 101 115 115 95 48 48 49 49 32 68 65 84 65 83 - 69 84 32 102 108 111 97 116 59 10 47 102 105 101 108 100 45 116 101 109 - 112 101 114 97 116 117 114 101 95 48 48 49 50 32 68 65 84 65 83 69 84 - 32 102 108 111 97 116 59 10 47 102 105 101 108 100 45 112 114 101 115 - 115 117 114 101 95 48 48 49 51 32 68 65 84 65 83 69 84 32 102 108 111 - 97 116 59 10 47 66 108 111 98 32 68 65 84 65 83 69 84 32 115 116 114 - 117 99 116 32 66 108 111 98 123 68 83 76 95 79 102 102 115 101 116 32 - 102 105 108 101 95 105 100 59 68 83 76 95 79 102 102 115 101 116 32 100 - 97 116 97 115 101 116 95 105 100 59 68 83 76 95 79 102 102 115 101 116 - 32 111 102 102 115 101 116 59 68 83 76 95 79 102 102 115 101 116 32 115 - 116 114 105 100 101 59 68 83 76 95 79 102 102 115 101 116 32 99 111 117 - 110 116 59 68 83 76 95 79 102 102 115 101 116 32 98 97 115 101 95 105 - 100 59 68 83 76 95 79 102 102 115 101 116 32 110 117 109 95 114 101 99 - 115 59 125 59 10 47 73 110 100 101 120 83 112 101 99 32 68 65 84 65 83 - 69 84 32 115 116 114 117 99 116 32 73 110 100 101 120 83 112 101 99 123 - 105 110 116 32 110 100 105 109 115 59 105 110 116 32 111 114 105 103 - 105 110 115 91 56 93 59 105 110 116 32 115 105 122 101 115 91 56 93 59 - 105 110 116 32 111 114 100 101 114 91 56 93 59 101 110 117 109 32 73 - 110 100 101 120 84 121 112 101 123 86 66 84 95 73 78 68 69 88 95 84 89 - 80 69 95 67 95 79 82 68 69 82 61 48 44 86 66 84 95 73 78 68 69 88 95 84 - 89 80 69 95 70 95 79 82 68 69 82 61 49 44 86 66 84 95 73 78 68 69 88 95 - 84 89 80 69 95 65 78 89 61 45 49 44 86 66 84 95 73 78 68 69 88 95 84 89 - 80 69 95 73 78 86 65 76 73 68 61 45 50 44 86 66 84 95 73 78 68 69 88 95 - 84 89 80 69 95 78 65 61 45 51 44 86 66 84 95 73 78 68 69 88 95 84 89 80 - 69 95 85 78 75 78 79 87 78 61 45 52 125 105 110 100 101 120 95 116 121 - 112 101 59 68 83 76 95 79 102 102 115 101 116 32 98 97 115 101 95 105 - 100 59 68 83 76 95 79 102 102 115 101 116 32 110 117 109 95 114 101 99 - 115 59 125 59 10 47 67 97 116 32 68 65 84 65 83 69 84 32 115 116 114 - 117 99 116 32 67 97 116 123 99 104 97 114 32 110 97 109 101 91 54 52 93 - 59 101 110 117 109 32 82 111 108 101 123 86 66 84 95 82 79 76 69 95 84 - 79 80 79 61 48 44 86 66 84 95 82 79 76 69 95 66 78 68 61 49 44 86 66 84 - 95 82 79 76 69 95 80 82 79 67 61 50 44 86 66 84 95 82 79 76 69 95 68 79 - 77 78 61 51 44 86 66 84 95 82 79 76 69 95 66 76 79 67 75 61 52 44 86 66 - 84 95 82 79 76 69 95 65 83 83 89 61 53 44 86 66 84 95 82 79 76 69 95 77 - 65 84 61 54 44 86 66 84 95 82 79 76 69 95 88 80 82 79 68 61 55 44 86 66 - 84 95 82 79 76 69 95 85 83 69 82 68 61 56 44 86 66 84 95 82 79 76 69 95 - 65 78 89 61 45 49 44 86 66 84 95 82 79 76 69 95 73 78 86 65 76 73 68 61 - 45 50 44 86 66 84 95 82 79 76 69 95 78 65 61 45 51 44 86 66 84 95 82 79 - 76 69 95 85 78 75 78 79 87 78 61 45 52 125 114 111 108 101 59 105 110 - 116 32 116 100 105 109 59 68 83 76 95 79 102 102 115 101 116 32 98 97 - 115 101 95 105 100 59 68 83 76 95 79 102 102 115 101 116 32 110 117 109 - 95 114 101 99 115 59 125 59 10 47 83 101 116 32 68 65 84 65 83 69 84 32 - 115 116 114 117 99 116 32 83 101 116 123 105 110 116 32 117 115 101 114 - 95 105 100 59 99 104 97 114 32 110 97 109 101 91 54 52 93 59 105 110 - 116 32 116 100 105 109 59 101 110 117 109 32 83 105 108 82 111 108 101 - 123 86 66 84 95 83 82 79 76 69 95 84 73 77 69 61 48 44 86 66 84 95 83 - 82 79 76 69 95 83 80 65 67 69 61 49 44 86 66 84 95 83 82 79 76 69 95 83 - 84 65 84 69 61 50 44 86 66 84 95 83 82 79 76 69 95 80 65 82 65 77 61 51 - 44 86 66 84 95 83 82 79 76 69 95 67 84 89 80 69 61 52 44 86 66 84 95 83 - 82 79 76 69 95 65 84 89 80 69 61 53 44 86 66 84 95 83 82 79 76 69 95 85 - 83 69 82 68 61 54 44 86 66 84 95 83 82 79 76 69 95 65 78 89 61 45 49 44 - 86 66 84 95 83 82 79 76 69 95 73 78 86 65 76 73 68 61 45 50 44 86 66 84 - 95 83 82 79 76 69 95 78 65 61 45 51 44 86 66 84 95 83 82 79 76 69 95 85 - 78 75 78 79 87 78 61 45 52 125 115 114 111 108 101 59 68 83 76 95 79 - 102 102 115 101 116 32 99 111 108 108 95 105 100 115 91 49 54 93 59 105 - 110 116 32 105 115 95 116 111 112 59 105 110 116 32 105 115 95 101 120 - 116 101 110 100 105 98 108 101 59 68 83 76 95 79 102 102 115 101 116 32 - 100 102 108 116 95 99 111 111 114 100 102 108 100 95 105 100 59 68 83 - 76 95 79 102 102 115 101 116 32 98 110 100 95 115 101 116 95 105 100 59 - 68 83 76 95 79 102 102 115 101 116 32 98 97 115 101 95 105 100 59 68 83 - 76 95 79 102 102 115 101 116 32 110 117 109 95 114 101 99 115 59 125 59 - 10 47 67 111 108 108 101 99 116 105 111 110 32 68 65 84 65 83 69 84 32 - 115 116 114 117 99 116 32 67 111 108 108 101 99 116 105 111 110 123 68 - 83 76 95 79 102 102 115 101 116 32 99 111 110 116 97 105 110 105 110 - 103 95 115 101 116 95 105 100 59 68 83 76 95 79 102 102 115 101 116 32 - 99 97 116 95 105 100 59 101 110 117 109 32 67 101 108 108 84 121 112 - 101 123 86 66 84 95 67 69 76 76 95 84 89 80 69 95 78 79 78 69 61 48 44 - 86 66 84 95 67 69 76 76 95 84 89 80 69 95 80 79 73 78 84 61 49 44 86 66 - 84 95 67 69 76 76 95 84 89 80 69 95 76 73 78 69 61 50 44 86 66 84 95 67 - 69 76 76 95 84 89 80 69 95 84 82 73 61 51 44 86 66 84 95 67 69 76 76 95 - 84 89 80 69 95 81 85 65 68 61 52 44 86 66 84 95 67 69 76 76 95 84 89 80 - 69 95 84 69 84 61 53 44 86 66 84 95 67 69 76 76 95 84 89 80 69 95 80 89 - 82 65 77 73 68 61 54 44 86 66 84 95 67 69 76 76 95 84 89 80 69 95 80 82 - 73 83 77 61 55 44 86 66 84 95 67 69 76 76 95 84 89 80 69 95 72 69 88 61 - 56 44 86 66 84 95 67 69 76 76 95 84 89 80 69 95 77 73 88 69 68 61 57 44 - 86 66 84 95 67 69 76 76 95 84 89 80 69 95 65 82 66 61 49 48 44 86 66 84 - 95 67 69 76 76 95 84 89 80 69 95 49 66 65 76 76 61 49 49 44 86 66 84 95 - 67 69 76 76 95 84 89 80 69 95 50 66 65 76 76 61 49 50 44 86 66 84 95 67 - 69 76 76 95 84 89 80 69 95 51 66 65 76 76 61 49 51 44 86 66 84 95 67 69 - 76 76 95 84 89 80 69 95 49 83 72 69 76 76 61 49 52 44 86 66 84 95 67 69 - 76 76 95 84 89 80 69 95 50 83 72 69 76 76 61 49 53 44 86 66 84 95 67 69 - 76 76 95 84 89 80 69 95 65 78 89 61 45 49 44 86 66 84 95 67 69 76 76 95 - 84 89 80 69 95 73 78 86 65 76 73 68 61 45 50 44 86 66 84 95 67 69 76 76 - 95 84 89 80 69 95 78 65 61 45 51 44 86 66 84 95 67 69 76 76 95 84 89 80 - 69 95 85 78 75 78 79 87 78 61 45 52 125 99 101 108 108 95 116 121 112 - 101 59 105 110 116 32 99 111 117 110 116 59 68 83 76 95 79 102 102 115 - 101 116 32 105 110 100 101 120 105 110 103 95 105 100 59 105 110 116 32 - 105 115 95 100 101 99 111 109 112 59 68 83 76 95 79 102 102 115 101 116 - 32 109 101 109 98 101 114 115 95 98 108 111 98 95 105 100 59 68 83 76 - 95 79 102 102 115 101 116 32 98 97 115 101 95 105 100 59 68 83 76 95 79 - 102 102 115 101 116 32 110 117 109 95 114 101 99 115 59 125 59 10 47 82 - 101 108 97 116 105 111 110 32 68 65 84 65 83 69 84 32 115 116 114 117 - 99 116 32 82 101 108 97 116 105 111 110 123 68 83 76 95 79 102 102 115 - 101 116 32 115 117 98 95 105 100 59 68 83 76 95 79 102 102 115 101 116 - 32 115 117 98 95 99 97 116 95 105 100 59 68 83 76 95 79 102 102 115 101 - 116 32 115 117 98 95 100 101 99 111 109 112 95 99 97 116 95 105 100 59 - 68 83 76 95 79 102 102 115 101 116 32 115 117 112 95 105 100 59 68 83 - 76 95 79 102 102 115 101 116 32 115 117 112 95 99 97 116 95 105 100 59 - 68 83 76 95 79 102 102 115 101 116 32 115 117 112 95 100 101 99 111 109 - 112 95 99 97 116 95 105 100 59 101 110 117 109 32 82 101 108 75 105 110 - 100 123 86 66 84 95 82 69 76 75 73 78 68 95 83 85 66 83 69 84 61 48 44 - 86 66 84 95 82 69 76 75 73 78 68 95 83 85 80 83 69 84 61 49 44 86 66 84 - 95 82 69 76 75 73 78 68 95 66 79 85 78 68 61 50 44 86 66 84 95 82 69 76 - 75 73 78 68 95 80 69 82 77 85 84 69 61 51 44 86 66 84 95 82 69 76 75 73 - 78 68 95 78 69 73 71 72 66 79 82 61 52 44 86 66 84 95 82 69 76 75 73 78 - 68 95 67 79 80 89 61 53 44 86 66 84 95 82 69 76 75 73 78 68 95 69 81 85 - 65 76 61 54 44 86 66 84 95 82 69 76 75 73 78 68 95 65 78 89 61 45 49 44 - 86 66 84 95 82 69 76 75 73 78 68 95 73 78 86 65 76 73 68 61 45 50 44 86 - 66 84 95 82 69 76 75 73 78 68 95 78 65 61 45 51 44 86 66 84 95 82 69 76 - 75 73 78 68 95 85 78 75 78 79 87 78 61 45 52 125 107 105 110 100 59 101 - 110 117 109 32 82 101 108 82 101 112 123 86 66 84 95 82 69 76 82 69 80 - 95 73 68 69 78 84 73 84 89 61 48 44 86 66 84 95 82 69 76 82 69 80 95 72 - 76 73 83 84 61 49 44 86 66 84 95 82 69 76 82 69 80 95 84 76 73 83 84 61 - 50 44 86 66 84 95 82 69 76 82 69 80 95 84 76 73 83 84 95 49 61 51 44 86 - 66 84 95 82 69 76 82 69 80 95 69 76 73 83 84 61 52 44 86 66 84 95 82 69 - 76 82 69 80 95 83 84 82 85 67 84 85 82 69 68 61 53 44 86 66 84 95 82 69 - 76 82 69 80 95 85 78 83 84 82 85 67 84 85 82 69 68 61 54 44 86 66 84 95 - 82 69 76 82 69 80 95 65 82 66 73 84 82 65 82 89 95 82 61 55 44 86 66 84 - 95 82 69 76 82 69 80 95 65 82 66 73 84 82 65 82 89 95 68 82 61 56 44 86 - 66 84 95 82 69 76 82 69 80 95 65 78 89 61 45 49 44 86 66 84 95 82 69 76 - 82 69 80 95 73 78 86 65 76 73 68 61 45 50 44 86 66 84 95 82 69 76 82 69 - 80 95 78 65 61 45 51 44 86 66 84 95 82 69 76 82 69 80 95 85 78 75 78 79 - 87 78 61 45 52 125 114 101 112 95 116 121 112 101 59 68 83 76 95 79 102 - 102 115 101 116 32 100 95 98 108 111 98 95 105 100 59 68 83 76 95 79 - 102 102 115 101 116 32 114 95 98 108 111 98 95 105 100 59 68 83 76 95 - 79 102 102 115 101 116 32 98 97 115 101 95 105 100 59 68 83 76 95 79 - 102 102 115 101 116 32 110 117 109 95 114 101 99 115 59 125 59 10 47 70 - 105 101 108 100 84 109 112 108 32 68 65 84 65 83 69 84 32 115 116 114 - 117 99 116 32 70 105 101 108 100 84 109 112 108 123 99 104 97 114 32 - 110 97 109 101 91 54 52 93 59 68 83 76 95 79 102 102 115 101 116 32 98 - 97 115 101 95 115 112 97 99 101 95 105 100 59 101 110 117 109 32 65 108 - 103 101 98 114 97 105 99 84 121 112 101 123 86 66 84 95 65 76 71 69 66 - 82 65 73 67 95 84 89 80 69 95 67 79 78 83 84 65 78 84 61 48 44 86 66 84 - 95 65 76 71 69 66 82 65 73 67 95 84 89 80 69 95 67 79 77 80 79 78 69 78 - 84 61 49 44 86 66 84 95 65 76 71 69 66 82 65 73 67 95 84 89 80 69 95 83 - 67 65 76 65 82 61 50 44 86 66 84 95 65 76 71 69 66 82 65 73 67 95 84 89 - 80 69 95 86 69 67 84 79 82 61 51 44 86 66 84 95 65 76 71 69 66 82 65 73 - 67 95 84 89 80 69 95 84 69 78 83 79 82 61 52 44 86 66 84 95 65 76 71 69 - 66 82 65 73 67 95 84 89 80 69 95 83 89 77 95 84 69 78 83 79 82 61 53 44 - 86 66 84 95 65 76 71 69 66 82 65 73 67 95 84 89 80 69 95 70 73 69 76 68 - 61 54 44 86 66 84 95 65 76 71 69 66 82 65 73 67 95 84 89 80 69 95 83 84 - 65 84 69 61 55 44 86 66 84 95 65 76 71 69 66 82 65 73 67 95 84 89 80 69 - 95 84 85 80 76 69 61 56 44 86 66 84 95 65 76 71 69 66 82 65 73 67 95 84 - 89 80 69 95 65 78 89 61 45 49 44 86 66 84 95 65 76 71 69 66 82 65 73 67 - 95 84 89 80 69 95 73 78 86 65 76 73 68 61 45 50 44 86 66 84 95 65 76 71 - 69 66 82 65 73 67 95 84 89 80 69 95 78 65 61 45 51 44 86 66 84 95 65 76 - 71 69 66 82 65 73 67 95 84 89 80 69 95 85 78 75 78 79 87 78 61 45 52 - 125 97 108 103 95 116 121 112 101 59 101 110 117 109 32 66 97 115 105 - 115 84 121 112 101 123 86 66 84 95 66 65 83 73 83 95 84 89 80 69 95 85 - 78 73 84 89 61 48 44 86 66 84 95 66 65 83 73 83 95 84 89 80 69 95 67 65 - 82 84 69 83 73 65 78 61 49 44 86 66 84 95 66 65 83 73 83 95 84 89 80 69 - 95 83 80 72 69 82 73 67 65 76 61 50 44 86 66 84 95 66 65 83 73 83 95 84 - 89 80 69 95 67 89 76 73 78 68 82 73 67 65 76 61 51 44 86 66 84 95 66 65 - 83 73 83 95 84 89 80 69 95 85 80 80 69 82 95 84 82 73 61 52 44 86 66 84 - 95 66 65 83 73 83 95 84 89 80 69 95 70 79 85 82 73 69 82 61 53 44 86 66 - 84 95 66 65 83 73 83 95 84 89 80 69 95 86 65 82 73 65 66 76 69 61 54 44 - 86 66 84 95 66 65 83 73 83 95 84 89 80 69 95 65 78 89 61 45 49 44 86 66 - 84 95 66 65 83 73 83 95 84 89 80 69 95 73 78 86 65 76 73 68 61 45 50 44 - 86 66 84 95 66 65 83 73 83 95 84 89 80 69 95 78 65 61 45 51 44 86 66 84 - 95 66 65 83 73 83 95 84 89 80 69 95 85 78 75 78 79 87 78 61 45 52 125 - 98 97 115 105 115 59 68 83 76 95 79 102 102 115 101 116 32 113 117 97 - 110 116 105 116 121 95 105 100 59 105 110 116 32 110 117 109 95 99 111 - 109 112 115 59 68 83 76 95 79 102 102 115 101 116 32 102 116 109 112 - 108 95 105 100 115 95 98 108 111 98 95 105 100 59 68 83 76 95 79 102 - 102 115 101 116 32 98 97 115 101 95 105 100 59 68 83 76 95 79 102 102 - 115 101 116 32 110 117 109 95 114 101 99 115 59 125 59 10 47 70 105 101 - 108 100 32 68 65 84 65 83 69 84 32 115 116 114 117 99 116 32 70 105 101 - 108 100 123 68 83 76 95 79 102 102 115 101 116 32 102 116 109 112 108 - 95 105 100 59 99 104 97 114 32 110 97 109 101 91 54 52 93 59 68 83 76 - 95 79 102 102 115 101 116 32 117 110 105 116 115 95 105 100 59 68 83 76 - 95 79 102 102 115 101 116 32 115 116 111 114 97 103 101 95 100 101 99 - 111 109 112 95 99 97 116 95 105 100 59 101 110 117 109 32 73 110 116 - 101 114 108 101 97 118 101 123 86 66 84 95 73 78 84 69 82 76 69 65 86 - 69 95 67 79 77 80 79 78 69 78 84 61 48 44 86 66 84 95 73 78 84 69 82 76 - 69 65 86 69 95 86 69 67 84 79 82 61 49 44 86 66 84 95 73 78 84 69 82 76 - 69 65 86 69 95 73 78 68 69 80 69 78 68 69 78 84 61 50 44 86 66 84 95 73 - 78 84 69 82 76 69 65 86 69 95 78 79 78 69 61 51 44 86 66 84 95 73 78 84 - 69 82 76 69 65 86 69 95 65 78 89 61 45 49 44 86 66 84 95 73 78 84 69 82 - 76 69 65 86 69 95 73 78 86 65 76 73 68 61 45 50 44 86 66 84 95 73 78 84 - 69 82 76 69 65 86 69 95 78 65 61 45 51 44 86 66 84 95 73 78 84 69 82 76 - 69 65 86 69 95 85 78 75 78 79 87 78 61 45 52 125 99 111 109 112 95 105 - 110 116 108 118 59 68 83 76 95 79 102 102 115 101 116 32 105 110 100 - 101 120 105 110 103 95 105 100 59 68 83 76 95 79 102 102 115 101 116 32 - 100 111 102 95 97 115 115 111 99 95 99 97 116 95 105 100 59 105 110 116 - 32 97 115 115 111 99 95 114 97 116 105 111 59 68 83 76 95 79 102 102 - 115 101 116 32 101 118 97 108 95 100 101 99 111 109 112 95 99 97 116 95 - 105 100 59 101 110 117 109 32 69 118 97 108 70 117 110 99 123 86 66 84 - 95 69 86 65 76 95 70 85 78 67 95 67 79 78 83 84 65 78 84 61 48 44 86 66 - 84 95 69 86 65 76 95 70 85 78 67 95 85 78 73 70 79 82 77 61 49 44 86 66 - 84 95 69 86 65 76 95 70 85 78 67 95 80 87 67 79 78 83 84 61 50 44 86 66 - 84 95 69 86 65 76 95 70 85 78 67 95 80 87 76 73 78 69 65 82 61 51 44 86 - 66 84 95 69 86 65 76 95 70 85 78 67 95 65 78 89 61 45 49 44 86 66 84 95 - 69 86 65 76 95 70 85 78 67 95 73 78 86 65 76 73 68 61 45 50 44 86 66 84 - 95 69 86 65 76 95 70 85 78 67 95 78 65 61 45 51 44 86 66 84 95 69 86 65 - 76 95 70 85 78 67 95 85 78 75 78 79 87 78 61 45 52 125 101 118 97 108 - 95 102 117 110 99 59 105 110 116 32 105 115 95 104 111 109 111 103 101 - 110 101 111 117 115 59 105 110 116 32 105 115 95 99 111 111 114 100 95 - 102 105 101 108 100 59 68 83 76 95 79 102 102 115 101 116 32 99 111 109 - 112 95 105 100 115 95 98 108 111 98 95 105 100 59 68 83 76 95 79 102 - 102 115 101 116 32 99 111 109 112 95 111 114 100 101 114 95 98 108 111 - 98 95 105 100 59 68 83 76 95 79 102 102 115 101 116 32 118 98 97 115 - 105 115 95 98 108 111 98 95 105 100 59 68 83 76 95 79 102 102 115 101 - 116 32 100 111 102 95 98 108 111 98 95 105 100 59 68 83 76 95 79 102 - 102 115 101 116 32 98 97 115 101 95 105 100 59 68 83 76 95 79 102 102 - 115 101 116 32 110 117 109 95 114 101 99 115 59 125 59 10 47 109 101 - 116 97 98 108 111 98 48 48 48 48 48 46 105 110 100 101 120 32 68 65 84 - 65 83 69 84 32 115 116 114 117 99 116 32 73 110 100 101 120 80 97 105 - 114 123 68 83 76 95 79 102 102 115 101 116 32 105 110 100 101 120 59 - 105 110 116 32 108 101 110 103 116 104 59 125 59 10 47 109 101 116 97 - 98 108 111 98 48 48 48 48 48 46 98 108 111 98 32 68 65 84 65 83 69 84 - 32 68 83 76 95 79 102 102 115 101 116 59 10 + 47 + 32 + 67 + 79 + 78 + 84 + 65 + 73 + 78 + 69 + 82 + 10 + 47 + 46 + 97 + 116 + 116 + 114 + 105 + 98 + 117 + 116 + 101 + 115 + 32 + 67 + 79 + 78 + 84 + 65 + 73 + 78 + 69 + 82 + 10 + 47 + 46 + 97 + 116 + 116 + 114 + 105 + 98 + 117 + 116 + 101 + 115 + 47 + 100 + 97 + 116 + 97 + 98 + 97 + 115 + 101 + 32 + 67 + 79 + 78 + 84 + 65 + 73 + 78 + 69 + 82 + 10 + 47 + 46 + 97 + 116 + 116 + 114 + 105 + 98 + 117 + 116 + 101 + 115 + 47 + 100 + 97 + 116 + 97 + 98 + 97 + 115 + 101 + 47 + 46 + 83 + 65 + 70 + 95 + 68 + 98 + 80 + 114 + 111 + 112 + 115 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 83 + 65 + 70 + 95 + 68 + 98 + 80 + 114 + 111 + 112 + 115 + 123 + 105 + 110 + 116 + 32 + 109 + 97 + 103 + 105 + 99 + 59 + 99 + 104 + 97 + 114 + 32 + 83 + 70 + 105 + 108 + 101 + 68 + 105 + 114 + 91 + 49 + 48 + 50 + 52 + 93 + 59 + 99 + 104 + 97 + 114 + 32 + 73 + 109 + 112 + 111 + 114 + 116 + 70 + 105 + 108 + 101 + 91 + 49 + 48 + 50 + 52 + 93 + 59 + 105 + 110 + 116 + 32 + 112 + 97 + 114 + 97 + 108 + 108 + 101 + 108 + 59 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 83 + 65 + 70 + 95 + 86 + 101 + 114 + 115 + 105 + 111 + 110 + 73 + 110 + 102 + 111 + 123 + 105 + 110 + 116 + 32 + 118 + 109 + 97 + 106 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 118 + 109 + 105 + 110 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 114 + 101 + 108 + 59 + 99 + 104 + 97 + 114 + 32 + 97 + 110 + 110 + 111 + 116 + 91 + 49 + 48 + 93 + 59 + 125 + 115 + 97 + 102 + 97 + 112 + 105 + 59 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 83 + 65 + 70 + 95 + 86 + 101 + 114 + 115 + 105 + 111 + 110 + 73 + 110 + 102 + 111 + 123 + 105 + 110 + 116 + 32 + 118 + 109 + 97 + 106 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 118 + 109 + 105 + 110 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 114 + 101 + 108 + 59 + 99 + 104 + 97 + 114 + 32 + 97 + 110 + 110 + 111 + 116 + 91 + 49 + 48 + 93 + 59 + 125 + 115 + 97 + 102 + 108 + 105 + 98 + 59 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 83 + 65 + 70 + 95 + 86 + 101 + 114 + 115 + 105 + 111 + 110 + 73 + 110 + 102 + 111 + 123 + 105 + 110 + 116 + 32 + 118 + 109 + 97 + 106 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 118 + 109 + 105 + 110 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 114 + 101 + 108 + 59 + 99 + 104 + 97 + 114 + 32 + 97 + 110 + 110 + 111 + 116 + 91 + 49 + 48 + 93 + 59 + 125 + 118 + 98 + 116 + 59 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 83 + 65 + 70 + 95 + 86 + 101 + 114 + 115 + 105 + 111 + 110 + 73 + 110 + 102 + 111 + 123 + 105 + 110 + 116 + 32 + 118 + 109 + 97 + 106 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 118 + 109 + 105 + 110 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 114 + 101 + 108 + 59 + 99 + 104 + 97 + 114 + 32 + 97 + 110 + 110 + 111 + 116 + 91 + 49 + 48 + 93 + 59 + 125 + 100 + 115 + 108 + 59 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 83 + 65 + 70 + 95 + 86 + 101 + 114 + 115 + 105 + 111 + 110 + 73 + 110 + 102 + 111 + 123 + 105 + 110 + 116 + 32 + 118 + 109 + 97 + 106 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 118 + 109 + 105 + 110 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 114 + 101 + 108 + 59 + 99 + 104 + 97 + 114 + 32 + 97 + 110 + 110 + 111 + 116 + 91 + 49 + 48 + 93 + 59 + 125 + 104 + 100 + 102 + 53 + 59 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 83 + 65 + 70 + 95 + 86 + 101 + 114 + 115 + 105 + 111 + 110 + 73 + 110 + 102 + 111 + 123 + 105 + 110 + 116 + 32 + 118 + 109 + 97 + 106 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 118 + 109 + 105 + 110 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 114 + 101 + 108 + 59 + 99 + 104 + 97 + 114 + 32 + 97 + 110 + 110 + 111 + 116 + 91 + 49 + 48 + 93 + 59 + 125 + 109 + 112 + 105 + 59 + 105 + 110 + 116 + 32 + 68 + 111 + 84 + 111 + 99 + 59 + 105 + 110 + 116 + 32 + 82 + 101 + 97 + 100 + 79 + 110 + 108 + 121 + 59 + 105 + 110 + 116 + 32 + 67 + 108 + 111 + 98 + 98 + 101 + 114 + 59 + 105 + 110 + 116 + 32 + 79 + 83 + 77 + 111 + 100 + 101 + 115 + 59 + 125 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 48 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 49 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 50 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 51 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 52 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 53 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 54 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 55 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 56 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 57 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 49 + 48 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 49 + 49 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 49 + 50 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 116 + 111 + 112 + 111 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 49 + 55 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 116 + 111 + 112 + 111 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 49 + 56 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 116 + 111 + 112 + 111 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 49 + 57 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 116 + 111 + 112 + 111 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 50 + 48 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 102 + 105 + 101 + 108 + 100 + 45 + 99 + 111 + 111 + 114 + 100 + 115 + 95 + 48 + 48 + 48 + 50 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 102 + 108 + 111 + 97 + 116 + 59 + 10 + 47 + 102 + 105 + 101 + 108 + 100 + 45 + 100 + 105 + 115 + 116 + 114 + 105 + 98 + 117 + 116 + 105 + 111 + 110 + 95 + 102 + 97 + 99 + 116 + 111 + 114 + 115 + 95 + 48 + 48 + 48 + 51 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 102 + 108 + 111 + 97 + 116 + 59 + 10 + 47 + 102 + 105 + 101 + 108 + 100 + 45 + 116 + 101 + 109 + 112 + 101 + 114 + 97 + 116 + 117 + 114 + 101 + 95 + 48 + 48 + 48 + 52 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 102 + 108 + 111 + 97 + 116 + 59 + 10 + 47 + 102 + 105 + 101 + 108 + 100 + 45 + 100 + 105 + 115 + 112 + 108 + 97 + 99 + 101 + 109 + 101 + 110 + 116 + 115 + 95 + 48 + 48 + 48 + 55 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 102 + 108 + 111 + 97 + 116 + 59 + 10 + 47 + 102 + 105 + 101 + 108 + 100 + 45 + 115 + 116 + 114 + 101 + 115 + 115 + 95 + 48 + 48 + 49 + 49 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 102 + 108 + 111 + 97 + 116 + 59 + 10 + 47 + 102 + 105 + 101 + 108 + 100 + 45 + 116 + 101 + 109 + 112 + 101 + 114 + 97 + 116 + 117 + 114 + 101 + 95 + 48 + 48 + 49 + 50 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 102 + 108 + 111 + 97 + 116 + 59 + 10 + 47 + 102 + 105 + 101 + 108 + 100 + 45 + 112 + 114 + 101 + 115 + 115 + 117 + 114 + 101 + 95 + 48 + 48 + 49 + 51 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 102 + 108 + 111 + 97 + 116 + 59 + 10 + 47 + 66 + 108 + 111 + 98 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 66 + 108 + 111 + 98 + 123 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 102 + 105 + 108 + 101 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 100 + 97 + 116 + 97 + 115 + 101 + 116 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 111 + 102 + 102 + 115 + 101 + 116 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 115 + 116 + 114 + 105 + 100 + 101 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 99 + 111 + 117 + 110 + 116 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 97 + 115 + 101 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 110 + 117 + 109 + 95 + 114 + 101 + 99 + 115 + 59 + 125 + 59 + 10 + 47 + 73 + 110 + 100 + 101 + 120 + 83 + 112 + 101 + 99 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 73 + 110 + 100 + 101 + 120 + 83 + 112 + 101 + 99 + 123 + 105 + 110 + 116 + 32 + 110 + 100 + 105 + 109 + 115 + 59 + 105 + 110 + 116 + 32 + 111 + 114 + 105 + 103 + 105 + 110 + 115 + 91 + 56 + 93 + 59 + 105 + 110 + 116 + 32 + 115 + 105 + 122 + 101 + 115 + 91 + 56 + 93 + 59 + 105 + 110 + 116 + 32 + 111 + 114 + 100 + 101 + 114 + 91 + 56 + 93 + 59 + 101 + 110 + 117 + 109 + 32 + 73 + 110 + 100 + 101 + 120 + 84 + 121 + 112 + 101 + 123 + 86 + 66 + 84 + 95 + 73 + 78 + 68 + 69 + 88 + 95 + 84 + 89 + 80 + 69 + 95 + 67 + 95 + 79 + 82 + 68 + 69 + 82 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 68 + 69 + 88 + 95 + 84 + 89 + 80 + 69 + 95 + 70 + 95 + 79 + 82 + 68 + 69 + 82 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 68 + 69 + 88 + 95 + 84 + 89 + 80 + 69 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 68 + 69 + 88 + 95 + 84 + 89 + 80 + 69 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 68 + 69 + 88 + 95 + 84 + 89 + 80 + 69 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 68 + 69 + 88 + 95 + 84 + 89 + 80 + 69 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 105 + 110 + 100 + 101 + 120 + 95 + 116 + 121 + 112 + 101 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 97 + 115 + 101 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 110 + 117 + 109 + 95 + 114 + 101 + 99 + 115 + 59 + 125 + 59 + 10 + 47 + 67 + 97 + 116 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 67 + 97 + 116 + 123 + 99 + 104 + 97 + 114 + 32 + 110 + 97 + 109 + 101 + 91 + 54 + 52 + 93 + 59 + 101 + 110 + 117 + 109 + 32 + 82 + 111 + 108 + 101 + 123 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 84 + 79 + 80 + 79 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 66 + 78 + 68 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 80 + 82 + 79 + 67 + 61 + 50 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 68 + 79 + 77 + 78 + 61 + 51 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 66 + 76 + 79 + 67 + 75 + 61 + 52 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 65 + 83 + 83 + 89 + 61 + 53 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 77 + 65 + 84 + 61 + 54 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 88 + 80 + 82 + 79 + 68 + 61 + 55 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 85 + 83 + 69 + 82 + 68 + 61 + 56 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 114 + 111 + 108 + 101 + 59 + 105 + 110 + 116 + 32 + 116 + 100 + 105 + 109 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 97 + 115 + 101 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 110 + 117 + 109 + 95 + 114 + 101 + 99 + 115 + 59 + 125 + 59 + 10 + 47 + 83 + 101 + 116 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 83 + 101 + 116 + 123 + 105 + 110 + 116 + 32 + 117 + 115 + 101 + 114 + 95 + 105 + 100 + 59 + 99 + 104 + 97 + 114 + 32 + 110 + 97 + 109 + 101 + 91 + 54 + 52 + 93 + 59 + 105 + 110 + 116 + 32 + 116 + 100 + 105 + 109 + 59 + 101 + 110 + 117 + 109 + 32 + 83 + 105 + 108 + 82 + 111 + 108 + 101 + 123 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 84 + 73 + 77 + 69 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 83 + 80 + 65 + 67 + 69 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 83 + 84 + 65 + 84 + 69 + 61 + 50 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 80 + 65 + 82 + 65 + 77 + 61 + 51 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 67 + 84 + 89 + 80 + 69 + 61 + 52 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 65 + 84 + 89 + 80 + 69 + 61 + 53 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 85 + 83 + 69 + 82 + 68 + 61 + 54 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 115 + 114 + 111 + 108 + 101 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 99 + 111 + 108 + 108 + 95 + 105 + 100 + 115 + 91 + 49 + 54 + 93 + 59 + 105 + 110 + 116 + 32 + 105 + 115 + 95 + 116 + 111 + 112 + 59 + 105 + 110 + 116 + 32 + 105 + 115 + 95 + 101 + 120 + 116 + 101 + 110 + 100 + 105 + 98 + 108 + 101 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 100 + 102 + 108 + 116 + 95 + 99 + 111 + 111 + 114 + 100 + 102 + 108 + 100 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 110 + 100 + 95 + 115 + 101 + 116 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 97 + 115 + 101 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 110 + 117 + 109 + 95 + 114 + 101 + 99 + 115 + 59 + 125 + 59 + 10 + 47 + 67 + 111 + 108 + 108 + 101 + 99 + 116 + 105 + 111 + 110 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 67 + 111 + 108 + 108 + 101 + 99 + 116 + 105 + 111 + 110 + 123 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 99 + 111 + 110 + 116 + 97 + 105 + 110 + 105 + 110 + 103 + 95 + 115 + 101 + 116 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 99 + 97 + 116 + 95 + 105 + 100 + 59 + 101 + 110 + 117 + 109 + 32 + 67 + 101 + 108 + 108 + 84 + 121 + 112 + 101 + 123 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 78 + 79 + 78 + 69 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 80 + 79 + 73 + 78 + 84 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 76 + 73 + 78 + 69 + 61 + 50 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 84 + 82 + 73 + 61 + 51 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 81 + 85 + 65 + 68 + 61 + 52 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 84 + 69 + 84 + 61 + 53 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 80 + 89 + 82 + 65 + 77 + 73 + 68 + 61 + 54 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 80 + 82 + 73 + 83 + 77 + 61 + 55 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 72 + 69 + 88 + 61 + 56 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 77 + 73 + 88 + 69 + 68 + 61 + 57 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 65 + 82 + 66 + 61 + 49 + 48 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 49 + 66 + 65 + 76 + 76 + 61 + 49 + 49 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 50 + 66 + 65 + 76 + 76 + 61 + 49 + 50 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 51 + 66 + 65 + 76 + 76 + 61 + 49 + 51 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 49 + 83 + 72 + 69 + 76 + 76 + 61 + 49 + 52 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 50 + 83 + 72 + 69 + 76 + 76 + 61 + 49 + 53 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 99 + 101 + 108 + 108 + 95 + 116 + 121 + 112 + 101 + 59 + 105 + 110 + 116 + 32 + 99 + 111 + 117 + 110 + 116 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 105 + 110 + 100 + 101 + 120 + 105 + 110 + 103 + 95 + 105 + 100 + 59 + 105 + 110 + 116 + 32 + 105 + 115 + 95 + 100 + 101 + 99 + 111 + 109 + 112 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 109 + 101 + 109 + 98 + 101 + 114 + 115 + 95 + 98 + 108 + 111 + 98 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 97 + 115 + 101 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 110 + 117 + 109 + 95 + 114 + 101 + 99 + 115 + 59 + 125 + 59 + 10 + 47 + 82 + 101 + 108 + 97 + 116 + 105 + 111 + 110 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 82 + 101 + 108 + 97 + 116 + 105 + 111 + 110 + 123 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 115 + 117 + 98 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 115 + 117 + 98 + 95 + 99 + 97 + 116 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 115 + 117 + 98 + 95 + 100 + 101 + 99 + 111 + 109 + 112 + 95 + 99 + 97 + 116 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 115 + 117 + 112 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 115 + 117 + 112 + 95 + 99 + 97 + 116 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 115 + 117 + 112 + 95 + 100 + 101 + 99 + 111 + 109 + 112 + 95 + 99 + 97 + 116 + 95 + 105 + 100 + 59 + 101 + 110 + 117 + 109 + 32 + 82 + 101 + 108 + 75 + 105 + 110 + 100 + 123 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 83 + 85 + 66 + 83 + 69 + 84 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 83 + 85 + 80 + 83 + 69 + 84 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 66 + 79 + 85 + 78 + 68 + 61 + 50 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 80 + 69 + 82 + 77 + 85 + 84 + 69 + 61 + 51 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 78 + 69 + 73 + 71 + 72 + 66 + 79 + 82 + 61 + 52 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 67 + 79 + 80 + 89 + 61 + 53 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 69 + 81 + 85 + 65 + 76 + 61 + 54 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 107 + 105 + 110 + 100 + 59 + 101 + 110 + 117 + 109 + 32 + 82 + 101 + 108 + 82 + 101 + 112 + 123 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 73 + 68 + 69 + 78 + 84 + 73 + 84 + 89 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 72 + 76 + 73 + 83 + 84 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 84 + 76 + 73 + 83 + 84 + 61 + 50 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 84 + 76 + 73 + 83 + 84 + 95 + 49 + 61 + 51 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 69 + 76 + 73 + 83 + 84 + 61 + 52 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 83 + 84 + 82 + 85 + 67 + 84 + 85 + 82 + 69 + 68 + 61 + 53 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 85 + 78 + 83 + 84 + 82 + 85 + 67 + 84 + 85 + 82 + 69 + 68 + 61 + 54 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 65 + 82 + 66 + 73 + 84 + 82 + 65 + 82 + 89 + 95 + 82 + 61 + 55 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 65 + 82 + 66 + 73 + 84 + 82 + 65 + 82 + 89 + 95 + 68 + 82 + 61 + 56 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 114 + 101 + 112 + 95 + 116 + 121 + 112 + 101 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 100 + 95 + 98 + 108 + 111 + 98 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 114 + 95 + 98 + 108 + 111 + 98 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 97 + 115 + 101 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 110 + 117 + 109 + 95 + 114 + 101 + 99 + 115 + 59 + 125 + 59 + 10 + 47 + 70 + 105 + 101 + 108 + 100 + 84 + 109 + 112 + 108 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 70 + 105 + 101 + 108 + 100 + 84 + 109 + 112 + 108 + 123 + 99 + 104 + 97 + 114 + 32 + 110 + 97 + 109 + 101 + 91 + 54 + 52 + 93 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 97 + 115 + 101 + 95 + 115 + 112 + 97 + 99 + 101 + 95 + 105 + 100 + 59 + 101 + 110 + 117 + 109 + 32 + 65 + 108 + 103 + 101 + 98 + 114 + 97 + 105 + 99 + 84 + 121 + 112 + 101 + 123 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 67 + 79 + 78 + 83 + 84 + 65 + 78 + 84 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 67 + 79 + 77 + 80 + 79 + 78 + 69 + 78 + 84 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 83 + 67 + 65 + 76 + 65 + 82 + 61 + 50 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 86 + 69 + 67 + 84 + 79 + 82 + 61 + 51 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 84 + 69 + 78 + 83 + 79 + 82 + 61 + 52 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 83 + 89 + 77 + 95 + 84 + 69 + 78 + 83 + 79 + 82 + 61 + 53 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 70 + 73 + 69 + 76 + 68 + 61 + 54 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 83 + 84 + 65 + 84 + 69 + 61 + 55 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 84 + 85 + 80 + 76 + 69 + 61 + 56 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 97 + 108 + 103 + 95 + 116 + 121 + 112 + 101 + 59 + 101 + 110 + 117 + 109 + 32 + 66 + 97 + 115 + 105 + 115 + 84 + 121 + 112 + 101 + 123 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 85 + 78 + 73 + 84 + 89 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 67 + 65 + 82 + 84 + 69 + 83 + 73 + 65 + 78 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 83 + 80 + 72 + 69 + 82 + 73 + 67 + 65 + 76 + 61 + 50 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 67 + 89 + 76 + 73 + 78 + 68 + 82 + 73 + 67 + 65 + 76 + 61 + 51 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 85 + 80 + 80 + 69 + 82 + 95 + 84 + 82 + 73 + 61 + 52 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 70 + 79 + 85 + 82 + 73 + 69 + 82 + 61 + 53 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 86 + 65 + 82 + 73 + 65 + 66 + 76 + 69 + 61 + 54 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 98 + 97 + 115 + 105 + 115 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 113 + 117 + 97 + 110 + 116 + 105 + 116 + 121 + 95 + 105 + 100 + 59 + 105 + 110 + 116 + 32 + 110 + 117 + 109 + 95 + 99 + 111 + 109 + 112 + 115 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 102 + 116 + 109 + 112 + 108 + 95 + 105 + 100 + 115 + 95 + 98 + 108 + 111 + 98 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 97 + 115 + 101 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 110 + 117 + 109 + 95 + 114 + 101 + 99 + 115 + 59 + 125 + 59 + 10 + 47 + 70 + 105 + 101 + 108 + 100 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 70 + 105 + 101 + 108 + 100 + 123 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 102 + 116 + 109 + 112 + 108 + 95 + 105 + 100 + 59 + 99 + 104 + 97 + 114 + 32 + 110 + 97 + 109 + 101 + 91 + 54 + 52 + 93 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 117 + 110 + 105 + 116 + 115 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 115 + 116 + 111 + 114 + 97 + 103 + 101 + 95 + 100 + 101 + 99 + 111 + 109 + 112 + 95 + 99 + 97 + 116 + 95 + 105 + 100 + 59 + 101 + 110 + 117 + 109 + 32 + 73 + 110 + 116 + 101 + 114 + 108 + 101 + 97 + 118 + 101 + 123 + 86 + 66 + 84 + 95 + 73 + 78 + 84 + 69 + 82 + 76 + 69 + 65 + 86 + 69 + 95 + 67 + 79 + 77 + 80 + 79 + 78 + 69 + 78 + 84 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 84 + 69 + 82 + 76 + 69 + 65 + 86 + 69 + 95 + 86 + 69 + 67 + 84 + 79 + 82 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 84 + 69 + 82 + 76 + 69 + 65 + 86 + 69 + 95 + 73 + 78 + 68 + 69 + 80 + 69 + 78 + 68 + 69 + 78 + 84 + 61 + 50 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 84 + 69 + 82 + 76 + 69 + 65 + 86 + 69 + 95 + 78 + 79 + 78 + 69 + 61 + 51 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 84 + 69 + 82 + 76 + 69 + 65 + 86 + 69 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 84 + 69 + 82 + 76 + 69 + 65 + 86 + 69 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 84 + 69 + 82 + 76 + 69 + 65 + 86 + 69 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 84 + 69 + 82 + 76 + 69 + 65 + 86 + 69 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 99 + 111 + 109 + 112 + 95 + 105 + 110 + 116 + 108 + 118 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 105 + 110 + 100 + 101 + 120 + 105 + 110 + 103 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 100 + 111 + 102 + 95 + 97 + 115 + 115 + 111 + 99 + 95 + 99 + 97 + 116 + 95 + 105 + 100 + 59 + 105 + 110 + 116 + 32 + 97 + 115 + 115 + 111 + 99 + 95 + 114 + 97 + 116 + 105 + 111 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 101 + 118 + 97 + 108 + 95 + 100 + 101 + 99 + 111 + 109 + 112 + 95 + 99 + 97 + 116 + 95 + 105 + 100 + 59 + 101 + 110 + 117 + 109 + 32 + 69 + 118 + 97 + 108 + 70 + 117 + 110 + 99 + 123 + 86 + 66 + 84 + 95 + 69 + 86 + 65 + 76 + 95 + 70 + 85 + 78 + 67 + 95 + 67 + 79 + 78 + 83 + 84 + 65 + 78 + 84 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 69 + 86 + 65 + 76 + 95 + 70 + 85 + 78 + 67 + 95 + 85 + 78 + 73 + 70 + 79 + 82 + 77 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 69 + 86 + 65 + 76 + 95 + 70 + 85 + 78 + 67 + 95 + 80 + 87 + 67 + 79 + 78 + 83 + 84 + 61 + 50 + 44 + 86 + 66 + 84 + 95 + 69 + 86 + 65 + 76 + 95 + 70 + 85 + 78 + 67 + 95 + 80 + 87 + 76 + 73 + 78 + 69 + 65 + 82 + 61 + 51 + 44 + 86 + 66 + 84 + 95 + 69 + 86 + 65 + 76 + 95 + 70 + 85 + 78 + 67 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 69 + 86 + 65 + 76 + 95 + 70 + 85 + 78 + 67 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 69 + 86 + 65 + 76 + 95 + 70 + 85 + 78 + 67 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 69 + 86 + 65 + 76 + 95 + 70 + 85 + 78 + 67 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 101 + 118 + 97 + 108 + 95 + 102 + 117 + 110 + 99 + 59 + 105 + 110 + 116 + 32 + 105 + 115 + 95 + 104 + 111 + 109 + 111 + 103 + 101 + 110 + 101 + 111 + 117 + 115 + 59 + 105 + 110 + 116 + 32 + 105 + 115 + 95 + 99 + 111 + 111 + 114 + 100 + 95 + 102 + 105 + 101 + 108 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 99 + 111 + 109 + 112 + 95 + 105 + 100 + 115 + 95 + 98 + 108 + 111 + 98 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 99 + 111 + 109 + 112 + 95 + 111 + 114 + 100 + 101 + 114 + 95 + 98 + 108 + 111 + 98 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 118 + 98 + 97 + 115 + 105 + 115 + 95 + 98 + 108 + 111 + 98 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 100 + 111 + 102 + 95 + 98 + 108 + 111 + 98 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 97 + 115 + 101 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 110 + 117 + 109 + 95 + 114 + 101 + 99 + 115 + 59 + 125 + 59 + 10 + 47 + 109 + 101 + 116 + 97 + 98 + 108 + 111 + 98 + 48 + 48 + 48 + 48 + 48 + 46 + 105 + 110 + 100 + 101 + 120 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 73 + 110 + 100 + 101 + 120 + 80 + 97 + 105 + 114 + 123 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 105 + 110 + 100 + 101 + 120 + 59 + 105 + 110 + 116 + 32 + 108 + 101 + 110 + 103 + 116 + 104 + 59 + 125 + 59 + 10 + 47 + 109 + 101 + 116 + 97 + 98 + 108 + 111 + 98 + 48 + 48 + 48 + 48 + 48 + 46 + 98 + 108 + 111 + 98 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 59 + 10 @@ -310,9 +5954,9 @@ - + - + @@ -603,7 +6247,7 @@ - + @@ -667,12 +6311,30 @@ - -1 1 0 1 9 0 1 -1 2 0 1 4 1 1 -1 3 0 1 7 2 1 -1 4 0 1 4 3 1 - -1 5 0 1 5 4 1 -1 6 0 1 3 5 1 -1 7 0 1 4 6 1 -1 8 0 1 1 7 1 - -1 9 0 1 10 8 1 -1 10 0 1 4 9 1 -1 11 0 1 3 10 1 -1 12 0 1 5 11 1 - -1 13 0 1 5 12 1 -1 14 0 1 16 13 1 -1 15 0 1 9 14 1 -1 16 0 1 4 15 1 - -1 17 0 1 16 16 1 -1 18 0 1 36 17 1 -1 19 0 1 5 18 1 -1 20 0 1 5 19 1 - -1 21 0 1 36 20 1 -1 22 0 1 12 21 1 -1 23 0 1 7 22 1 -1 24 0 1 2 23 1 + -1 1 0 1 9 0 1 + -1 2 0 1 4 1 1 + -1 3 0 1 7 2 1 + -1 4 0 1 4 3 1 + -1 5 0 1 5 4 1 + -1 6 0 1 3 5 1 + -1 7 0 1 4 6 1 + -1 8 0 1 1 7 1 + -1 9 0 1 10 8 1 + -1 10 0 1 4 9 1 + -1 11 0 1 3 10 1 + -1 12 0 1 5 11 1 + -1 13 0 1 5 12 1 + -1 14 0 1 16 13 1 + -1 15 0 1 9 14 1 + -1 16 0 1 4 15 1 + -1 17 0 1 16 16 1 + -1 18 0 1 36 17 1 + -1 19 0 1 5 18 1 + -1 20 0 1 5 19 1 + -1 21 0 1 36 20 1 + -1 22 0 1 12 21 1 + -1 23 0 1 7 22 1 + -1 24 0 1 2 23 1 @@ -686,7 +6348,7 @@ - + @@ -820,8 +6482,11 @@ - "nodes" TOPO 0 0 1 "elems" TOPO 2 1 1 "edges" USERD 1 2 1 - "blocks" BLOCK 2 3 1 "side_sets" USERD 1 4 1 + "nodes" TOPO 0 0 1 + "elems" TOPO 2 1 1 + "edges" USERD 1 2 1 + "blocks" BLOCK 2 3 1 + "side_sets" USERD 1 4 1 @@ -835,7 +6500,7 @@ - + @@ -1039,15 +6704,30 @@ - 0 0 POINT 18 0 0 -2 0 1 0 1 MIXED 12 1 1 -2 1 1 0 3 NONE 4 2 1 0 2 1 - 0 4 NONE 2 3 0 1 3 1 1 0 POINT 9 4 0 -2 4 1 1 1 QUAD 4 5 1 -2 5 1 - 1 3 NONE 1 6 1 2 6 1 2 0 POINT 7 7 0 -2 7 1 2 1 MIXED 4 8 1 -2 8 1 - 2 3 NONE 2 9 1 3 9 1 3 0 POINT 10 10 0 -2 10 1 3 1 QUAD 4 11 1 -2 11 1 - 3 3 NONE 1 12 1 4 12 1 4 0 POINT 3 13 0 -2 13 1 4 2 LINE 2 14 1 -2 14 1 - 5 0 POINT 5 15 0 -2 15 1 5 2 LINE 4 16 1 -2 16 1 - 6 0 POINT 5 17 1 -2 17 1 7 0 POINT 5 18 0 -2 18 1 - 7 1 TRI 3 19 1 -2 19 1 7 3 NONE 1 20 1 5 20 1 8 0 POINT 4 21 0 -2 21 1 - 8 1 QUAD 1 22 1 -2 22 1 8 3 NONE 1 23 1 6 23 1 + 0 0 POINT 18 0 0 -2 0 1 + 0 1 MIXED 12 1 1 -2 1 1 + 0 3 NONE 4 2 1 0 2 1 + 0 4 NONE 2 3 0 1 3 1 + 1 0 POINT 9 4 0 -2 4 1 + 1 1 QUAD 4 5 1 -2 5 1 + 1 3 NONE 1 6 1 2 6 1 + 2 0 POINT 7 7 0 -2 7 1 + 2 1 MIXED 4 8 1 -2 8 1 + 2 3 NONE 2 9 1 3 9 1 + 3 0 POINT 10 10 0 -2 10 1 + 3 1 QUAD 4 11 1 -2 11 1 + 3 3 NONE 1 12 1 4 12 1 + 4 0 POINT 3 13 0 -2 13 1 + 4 2 LINE 2 14 1 -2 14 1 + 5 0 POINT 5 15 0 -2 15 1 + 5 2 LINE 4 16 1 -2 16 1 + 6 0 POINT 5 17 1 -2 17 1 + 7 0 POINT 5 18 0 -2 18 1 + 7 1 TRI 3 19 1 -2 19 1 + 7 3 NONE 1 20 1 5 20 1 + 8 0 POINT 4 21 0 -2 21 1 + 8 1 QUAD 1 22 1 -2 22 1 + 8 3 NONE 1 23 1 6 23 1 @@ -1061,7 +6741,7 @@ - + @@ -1337,7 +7017,7 @@ - + @@ -1592,7 +7272,7 @@ - + @@ -1731,30 +7411,30 @@ - 1 0 0 0 0 0 0 0 0 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 0 1 - 1 0 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 1 1 - 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 2 1 - 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 3 1 - 1 0 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 4 1 - 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 5 1 - 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 6 1 - 1 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 7 1 - 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 8 1 - 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 9 1 - 1 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 10 1 - 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 11 1 - 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 12 1 - 1 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 13 1 - 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 14 1 - 1 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 15 1 - 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 16 1 - 1 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 17 1 - 1 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 18 1 - 1 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 19 1 - 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 20 1 - 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 21 1 - 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 22 1 - 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 23 1 + 1 0 0 0 0 0 0 0 0 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 0 1 + 1 0 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 1 1 + 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 2 1 + 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 3 1 + 1 0 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 4 1 + 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 5 1 + 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 6 1 + 1 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 7 1 + 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 8 1 + 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 9 1 + 1 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 10 1 + 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 11 1 + 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 12 1 + 1 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 13 1 + 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 14 1 + 1 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 15 1 + 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 16 1 + 1 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 17 1 + 1 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 18 1 + 1 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 19 1 + 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 20 1 + 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 21 1 + 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 22 1 + 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 23 1 @@ -1768,7 +7448,7 @@ - + @@ -2023,11 +7703,16 @@ - 1 0 -2 0 0 -2 EQUAL TLIST -2 0 0 1 1 1 -2 0 1 -2 EQUAL TLIST -2 1 1 1 - 2 0 -2 0 0 -2 EQUAL TLIST -2 2 2 1 2 1 -2 0 1 -2 EQUAL TLIST -2 3 3 1 - 7 0 -2 0 0 -2 EQUAL TLIST -2 4 4 1 7 1 -2 0 1 -2 EQUAL TLIST -2 5 5 1 - 8 0 -2 0 0 -2 EQUAL TLIST -2 6 6 1 8 1 -2 0 1 -2 EQUAL TLIST -2 7 7 1 - 3 0 -2 0 0 -2 EQUAL TLIST -2 8 8 1 3 1 -2 0 1 -2 EQUAL TLIST -2 9 9 1 + 1 0 -2 0 0 -2 EQUAL TLIST -2 0 0 1 + 1 1 -2 0 1 -2 EQUAL TLIST -2 1 1 1 + 2 0 -2 0 0 -2 EQUAL TLIST -2 2 2 1 + 2 1 -2 0 1 -2 EQUAL TLIST -2 3 3 1 + 7 0 -2 0 0 -2 EQUAL TLIST -2 4 4 1 + 7 1 -2 0 1 -2 EQUAL TLIST -2 5 5 1 + 8 0 -2 0 0 -2 EQUAL TLIST -2 6 6 1 + 8 1 -2 0 1 -2 EQUAL TLIST -2 7 7 1 + 3 0 -2 0 0 -2 EQUAL TLIST -2 8 8 1 + 3 1 -2 0 1 -2 EQUAL TLIST -2 9 9 1 4 0 -2 0 0 -2 EQUAL TLIST -2 10 10 1 5 0 -2 0 0 -2 EQUAL TLIST -2 11 11 1 6 0 -2 0 0 -2 EQUAL TLIST -2 12 12 1 @@ -2052,7 +7737,7 @@ - + @@ -2227,15 +7912,15 @@ - 0 "TOP_CELL" 2 SPACE 0 1 -2 2 3 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 1 0 -2 -2 0 1 - 0 "CELL_1" 2 SPACE 4 5 -2 6 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 1 1 - 0 "CELL_2" 2 SPACE 7 8 -2 9 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 2 1 - 0 "CELL_3" 2 SPACE 10 11 -2 12 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 3 1 - 0 "SIDE_SET_1" 1 SPACE 13 -2 14 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 4 1 - 0 "SIDE_SET_2" 1 SPACE 15 -2 16 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 5 1 - 0 "NODE_SET_1" 0 SPACE 17 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 6 1 - 0 "CELL_2_TRIS" 2 SPACE 18 19 -2 20 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 7 1 - 0 "CELL_2_QUADS" 2 SPACE 21 22 -2 23 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 8 1 + 0 "TOP_CELL" 2 SPACE 0 1 -2 2 3 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 1 0 -2 -2 0 1 + 0 "CELL_1" 2 SPACE 4 5 -2 6 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 1 1 + 0 "CELL_2" 2 SPACE 7 8 -2 9 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 2 1 + 0 "CELL_3" 2 SPACE 10 11 -2 12 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 3 1 + 0 "SIDE_SET_1" 1 SPACE 13 -2 14 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 4 1 + 0 "SIDE_SET_2" 1 SPACE 15 -2 16 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 5 1 + 0 "NODE_SET_1" 0 SPACE 17 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 6 1 + 0 "CELL_2_TRIS" 2 SPACE 18 19 -2 20 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 7 1 + 0 "CELL_2_QUADS" 2 SPACE 21 22 -2 23 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 8 1 @@ -2243,9 +7928,9 @@ - + - + @@ -2260,8 +7945,42 @@ - 0 4 1 4 2 4 2.5 4 0 3 1 3 2 3 2.5 3 0 2 1 2 2 2 2.5 2 0 1 2 1 2.5 1 0 0 - 2 0 2.5 0 + 0 + 4 + 1 + 4 + 2 + 4 + 2.5 + 4 + 0 + 3 + 1 + 3 + 2 + 3 + 2.5 + 3 + 0 + 2 + 1 + 2 + 2 + 2 + 2.5 + 2 + 0 + 1 + 2 + 1 + 2.5 + 1 + 0 + 0 + 2 + 0 + 2.5 + 0 @@ -2269,9 +7988,9 @@ - + - + @@ -2286,9 +8005,42 @@ - 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 - 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 - 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 @@ -2296,9 +8048,9 @@ - + - + @@ -2313,7 +8065,11 @@ - 4 3 2 1 0 + 4 + 3 + 2 + 1 + 0 @@ -2321,9 +8077,9 @@ - + - + @@ -2338,7 +8094,8 @@ - 45 55 + 45 + 55 @@ -2346,9 +8103,9 @@ - + - + @@ -2363,7 +8120,18 @@ - 0.5 0.25 0.5 0.5 0.25 0.5 0.5 0.25 0.5 0.5 0.25 0.5 + 0.5 + 0.25 + 0.5 + 0.5 + 0.25 + 0.5 + 0.5 + 0.25 + 0.5 + 0.5 + 0.25 + 0.5 @@ -2371,9 +8139,9 @@ - + - + @@ -2388,7 +8156,11 @@ - 100 150 150 100 75 + 100 + 150 + 150 + 100 + 75 @@ -2396,9 +8168,9 @@ - + - + @@ -2413,7 +8185,13 @@ - 75 95 120 80 115 85 110 + 75 + 95 + 120 + 80 + 115 + 85 + 110 @@ -2427,7 +8205,7 @@ - + @@ -2442,7 +8220,25 @@ - 1 7 8 3 -2 -2 -2 -2 -2 -2 -2 -2 0 1 5 6 8 9 10 + 1 + 7 + 8 + 3 + -2 + -2 + -2 + -2 + -2 + -2 + -2 + -2 + 0 + 1 + 5 + 6 + 8 + 9 + 10 @@ -2456,7 +8252,7 @@ - + @@ -2485,7 +8281,16 @@ - 0 4 4 2 6 1 7 2 9 1 10 1 11 1 12 2 14 2 16 3 + 0 4 + 4 2 + 6 1 + 7 2 + 9 1 + 10 1 + 11 1 + 12 2 + 14 2 + 16 3 @@ -2493,9 +8298,9 @@ - + - + @@ -2510,7 +8315,15 @@ - 1 2 3 5 6 7 9 10 11 + 1 + 2 + 3 + 5 + 6 + 7 + 9 + 10 + 11 @@ -2518,9 +8331,9 @@ - + - + @@ -2535,7 +8348,10 @@ - 1 2 4 5 + 1 + 2 + 4 + 5 @@ -2543,9 +8359,9 @@ - + - + @@ -2560,7 +8376,13 @@ - 9 10 11 13 14 16 17 + 9 + 10 + 11 + 13 + 14 + 16 + 17 @@ -2568,9 +8390,9 @@ - + - + @@ -2585,7 +8407,10 @@ - 7 8 9 11 + 7 + 8 + 9 + 11 @@ -2593,9 +8418,9 @@ - + - + @@ -2610,7 +8435,11 @@ - 9 10 11 13 14 + 9 + 10 + 11 + 13 + 14 @@ -2618,9 +8447,9 @@ - + - + @@ -2635,7 +8464,9 @@ - 7 8 9 + 7 + 8 + 9 @@ -2643,9 +8474,9 @@ - + - + @@ -2660,7 +8491,10 @@ - 13 14 16 17 + 13 + 14 + 16 + 17 @@ -2668,9 +8502,9 @@ - + - + @@ -2693,9 +8527,9 @@ - + - + @@ -2710,7 +8544,16 @@ - 3 4 7 8 11 12 14 15 17 18 + 3 + 4 + 7 + 8 + 11 + 12 + 14 + 15 + 17 + 18 @@ -2718,9 +8561,9 @@ - + - + @@ -2735,7 +8578,10 @@ - 3 6 10 12 + 3 + 6 + 10 + 12 @@ -2743,9 +8589,9 @@ - + - + @@ -2760,7 +8606,9 @@ - 9 10 11 + 9 + 10 + 11 @@ -2768,9 +8616,9 @@ - + - + @@ -2785,7 +8633,11 @@ - 1 5 9 13 16 + 1 + 5 + 9 + 13 + 16 @@ -2793,9 +8645,9 @@ - + - + @@ -2810,7 +8662,11 @@ - 4 8 12 15 18 + 4 + 8 + 12 + 15 + 18 @@ -2818,9 +8674,9 @@ - + - + @@ -2835,7 +8691,22 @@ - 1 2 6 5 2 3 7 6 5 6 10 9 6 7 11 10 + 1 + 2 + 6 + 5 + 2 + 3 + 7 + 6 + 5 + 6 + 10 + 9 + 6 + 7 + 11 + 10 @@ -2843,9 +8714,9 @@ - + - + @@ -2860,7 +8731,15 @@ - 9 10 13 10 14 13 10 11 14 + 9 + 10 + 13 + 10 + 14 + 13 + 10 + 11 + 14 @@ -2868,9 +8747,9 @@ - + - + @@ -2885,7 +8764,10 @@ - 13 14 17 16 + 13 + 14 + 17 + 16 @@ -2893,9 +8775,9 @@ - + - + @@ -2910,7 +8792,22 @@ - 3 4 8 7 7 8 12 11 11 12 15 14 14 15 18 17 + 3 + 4 + 8 + 7 + 7 + 8 + 12 + 11 + 11 + 12 + 15 + 14 + 14 + 15 + 18 + 17 diff --git a/tools/testfiles/tscaleoffset.ddl b/tools/testfiles/tscaleoffset.ddl index 8000ef3..f1891da 100644 --- a/tools/testfiles/tscaleoffset.ddl +++ b/tools/testfiles/tscaleoffset.ddl @@ -5,13 +5,13 @@ DATASET "scaleoffset" { STORAGE_LAYOUT { CHUNKED ( 10, 5 ) SIZE 152 (5.263:1 COMPRESSION) - } + } FILTERS { COMPRESSION SCALEOFFSET { MIN BITS 4 } } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tshuffle.ddl b/tools/testfiles/tshuffle.ddl index 4f9559b..cd1b5f8 100644 --- a/tools/testfiles/tshuffle.ddl +++ b/tools/testfiles/tshuffle.ddl @@ -5,13 +5,13 @@ DATASET "shuffle" { STORAGE_LAYOUT { CHUNKED ( 10, 5 ) SIZE 800 - } + } FILTERS { PREPROCESSING SHUFFLE } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tsplit_file.ddl b/tools/testfiles/tsplit_file.ddl index 7e1c812..9a1e22d 100644 --- a/tools/testfiles/tsplit_file.ddl +++ b/tools/testfiles/tsplit_file.ddl @@ -2,11 +2,11 @@ HDF5 "tsplit_file" { GROUP "/" { ATTRIBUTE "Metadata" { DATATYPE H5T_STRING { - STRSIZE 35; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 35; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 1 ) / ( 1 ) } DATA { (0): "this is some metadata on this file" diff --git a/tools/testfiles/tstr-1.ddl b/tools/testfiles/tstr-1.ddl index 4d1905b..e43b732 100644 --- a/tools/testfiles/tstr-1.ddl +++ b/tools/testfiles/tstr-1.ddl @@ -250,11 +250,11 @@ GROUP "/" { } DATASET "string1" { DATATYPE H5T_STRING { - STRSIZE 5; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 5; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 3, 4 ) / ( 3, 4 ) } DATA { (0,0): "s1", "s2", "s3", "s4", @@ -264,11 +264,11 @@ GROUP "/" { } DATASET "string2" { DATATYPE H5T_STRING { - STRSIZE 11; - STRPAD H5T_STR_SPACEPAD; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 11; + STRPAD H5T_STR_SPACEPAD; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 20 ) / ( 20 ) } DATA { (0): "ab cd ef1 ", "ab cd ef2 ", "ab cd ef3 ", "ab cd ef4 ", @@ -280,11 +280,11 @@ GROUP "/" { } DATASET "string3" { DATATYPE H5T_STRING { - STRSIZE 8; - STRPAD H5T_STR_NULLPAD; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 8; + STRPAD H5T_STR_NULLPAD; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 27 ) / ( 27 ) } DATA { (0): "abcd0\000\000\000", "abcd1\000\000\000", "abcd2\000\000\000", @@ -300,11 +300,11 @@ GROUP "/" { } DATASET "string4" { DATATYPE H5T_STRING { - STRSIZE 168; - STRPAD H5T_STR_SPACEPAD; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 168; + STRPAD H5T_STR_SPACEPAD; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 3 ) / ( 3 ) } DATA { (0): "s1234567890123456789 ", diff --git a/tools/testfiles/tstr-2.ddl b/tools/testfiles/tstr-2.ddl index e887581..26425f6 100644 --- a/tools/testfiles/tstr-2.ddl +++ b/tools/testfiles/tstr-2.ddl @@ -3,11 +3,11 @@ GROUP "/" { GROUP "g1" { DATASET "dset1" { DATATYPE H5T_STRING { - STRSIZE 50; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 50; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 10 ) / ( 10 ) } DATA { (0): "This is row 0 of type H5T_STR_NULLTERM of", @@ -23,11 +23,11 @@ GROUP "/" { } ATTRIBUTE "attr1" { DATATYPE H5T_STRING { - STRSIZE 11; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 11; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 3 ) / ( 3 ) } DATA { (0): "0123456789", "abcdefghij", "ABCDEFGHIJ" @@ -38,11 +38,11 @@ GROUP "/" { GROUP "g2" { DATASET "dset2" { DATATYPE H5T_STRING { - STRSIZE 50; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 50; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 10 ) / ( 10 ) } DATA { (0): "This is row 0 of type H5T_STR_NULLTERM of string ", @@ -61,11 +61,11 @@ GROUP "/" { GROUP "g3" { DATASET "dset3" { DATATYPE H5T_STRING { - STRSIZE 50; - STRPAD H5T_STR_NULLPAD; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 50; + STRPAD H5T_STR_NULLPAD; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 10 ) / ( 10 ) } DATA { (0): "This is row 0 of type H5T_STR_NULLPAD of\000\000\000\000\000\000\000\000\000\000", @@ -84,11 +84,11 @@ GROUP "/" { GROUP "g4" { DATASET "dset4" { DATATYPE H5T_STRING { - STRSIZE 50; - STRPAD H5T_STR_NULLPAD; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 50; + STRPAD H5T_STR_NULLPAD; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 10 ) / ( 10 ) } DATA { (0): "This is row 0 of type H5T_STR_NULLPAD of string ar", @@ -107,11 +107,11 @@ GROUP "/" { GROUP "g5" { DATASET "dset5" { DATATYPE H5T_STRING { - STRSIZE 50; - STRPAD H5T_STR_SPACEPAD; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 50; + STRPAD H5T_STR_SPACEPAD; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 10 ) / ( 10 ) } DATA { (0): "This is row 0 of type H5T_STR_SPACEPAD of ", @@ -130,11 +130,11 @@ GROUP "/" { GROUP "g6" { DATASET "dset6" { DATATYPE H5T_STRING { - STRSIZE 50; - STRPAD H5T_STR_SPACEPAD; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 50; + STRPAD H5T_STR_SPACEPAD; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 10 ) / ( 10 ) } DATA { (0): "This is row 0 of type H5T_STR_SPACEPAD of string a", diff --git a/tools/testfiles/tstr.h5.xml b/tools/testfiles/tstr.h5.xml index ac9e268..d7214fd 100644 --- a/tools/testfiles/tstr.h5.xml +++ b/tools/testfiles/tstr.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -49,186 +49,24 @@ - 0 1 4 9 16 25 36 49 64 81 - 1 4 9 16 25 36 49 64 81 100 - 4 9 16 25 36 49 64 81 100 121 - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 1 4 9 16 25 36 49 64 81 100 - 4 9 16 25 36 49 64 81 100 121 - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 4 9 16 25 36 49 64 81 100 121 - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 - 100 121 144 169 196 225 256 289 324 361 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 - 100 121 144 169 196 225 256 289 324 361 - 121 144 169 196 225 256 289 324 361 400 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 - 100 121 144 169 196 225 256 289 324 361 - 121 144 169 196 225 256 289 324 361 400 - 144 169 196 225 256 289 324 361 400 441 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 0 1 4 9 16 25 36 49 64 81 - 1 4 9 16 25 36 49 64 81 100 - 4 9 16 25 36 49 64 81 100 121 - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 1 4 9 16 25 36 49 64 81 100 - 4 9 16 25 36 49 64 81 100 121 - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 4 9 16 25 36 49 64 81 100 121 - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 - 100 121 144 169 196 225 256 289 324 361 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 - 100 121 144 169 196 225 256 289 324 361 - 121 144 169 196 225 256 289 324 361 400 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 - 100 121 144 169 196 225 256 289 324 361 - 121 144 169 196 225 256 289 324 361 400 - 144 169 196 225 256 289 324 361 400 441 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 0 1 4 9 16 25 36 49 64 81 - 1 4 9 16 25 36 49 64 81 100 - 4 9 16 25 36 49 64 81 100 121 - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 1 4 9 16 25 36 49 64 81 100 - 4 9 16 25 36 49 64 81 100 121 - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 4 9 16 25 36 49 64 81 100 121 - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 - 100 121 144 169 196 225 256 289 324 361 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 - 100 121 144 169 196 225 256 289 324 361 - 121 144 169 196 225 256 289 324 361 400 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 - 100 121 144 169 196 225 256 289 324 361 - 121 144 169 196 225 256 289 324 361 400 - 144 169 196 225 256 289 324 361 400 441 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 0 1 4 9 16 25 36 49 64 81 1 4 9 16 25 36 49 64 81 100 4 9 16 25 36 49 64 81 100 121 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 1 4 9 16 25 36 49 64 81 100 4 9 16 25 36 49 64 81 100 121 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 4 9 16 25 36 49 64 81 100 121 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 100 121 144 169 196 225 256 289 324 361 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 100 121 144 169 196 225 256 289 324 361 121 144 169 196 225 256 289 324 361 400 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 100 121 144 169 196 225 256 289 324 361 121 144 169 196 225 256 289 324 361 400 144 169 196 225 256 289 324 361 400 441 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 0 1 4 9 16 25 36 49 64 81 1 4 9 16 25 36 49 64 81 100 4 9 16 25 36 49 64 81 100 121 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 1 4 9 16 25 36 49 64 81 100 4 9 16 25 36 49 64 81 100 121 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 4 9 16 25 36 49 64 81 100 121 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 100 121 144 169 196 225 256 289 324 361 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 100 121 144 169 196 225 256 289 324 361 121 144 169 196 225 256 289 324 361 400 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 100 121 144 169 196 225 256 289 324 361 121 144 169 196 225 256 289 324 361 400 144 169 196 225 256 289 324 361 400 441 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 0 1 4 9 16 25 36 49 64 81 1 4 9 16 25 36 49 64 81 100 4 9 16 25 36 49 64 81 100 121 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 1 4 9 16 25 36 49 64 81 100 4 9 16 25 36 49 64 81 100 121 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 4 9 16 25 36 49 64 81 100 121 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 100 121 144 169 196 225 256 289 324 361 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 100 121 144 169 196 225 256 289 324 361 121 144 169 196 225 256 289 324 361 400 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 100 121 144 169 196 225 256 289 324 361 121 144 169 196 225 256 289 324 361 400 144 169 196 225 256 289 324 361 400 441 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" @@ -236,9 +74,9 @@ - + - + @@ -273,9 +111,9 @@ - + - + @@ -317,9 +155,9 @@ - + - + @@ -368,9 +206,9 @@ - + - + diff --git a/tools/testfiles/tstr2.h5.xml b/tools/testfiles/tstr2.h5.xml index 3f691aa..26758b3 100644 --- a/tools/testfiles/tstr2.h5.xml +++ b/tools/testfiles/tstr2.h5.xml @@ -6,9 +6,9 @@ - + - + @@ -61,9 +61,9 @@ - + - + @@ -97,9 +97,9 @@ - + - + @@ -133,9 +133,9 @@ - + - + @@ -169,9 +169,9 @@ - + - + @@ -205,9 +205,9 @@ - + - + diff --git a/tools/testfiles/tstring-at.h5.xml b/tools/testfiles/tstring-at.h5.xml index b2bc39d..1962610 100644 --- a/tools/testfiles/tstring-at.h5.xml +++ b/tools/testfiles/tstring-at.h5.xml @@ -5,9 +5,9 @@ - + - + diff --git a/tools/testfiles/tstring.ddl b/tools/testfiles/tstring.ddl index 3469de7..398bf33 100644 --- a/tools/testfiles/tstring.ddl +++ b/tools/testfiles/tstring.ddl @@ -2,11 +2,11 @@ HDF5 "tstr3.h5" { GROUP "/" { DATASET "str1" { DATATYPE H5T_STRING { - STRSIZE 73; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 73; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 1 ) / ( 1 ) } DATA { (0): "quote " backspace form feed new line @@ -16,11 +16,11 @@ GROUP "/" { } DATASET "str2" { DATATYPE H5T_STRING { - STRSIZE H5T_VARIABLE; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE H5T_VARIABLE; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 4 ) / ( 4 ) } DATA { (0): "Four score and seven diff --git a/tools/testfiles/tstring.h5.xml b/tools/testfiles/tstring.h5.xml index 4f9d7b5..ebd0a3c 100644 --- a/tools/testfiles/tstring.h5.xml +++ b/tools/testfiles/tstring.h5.xml @@ -5,9 +5,9 @@ - + - + diff --git a/tools/testfiles/tstring2.ddl b/tools/testfiles/tstring2.ddl index 88996fd..cda2ed5 100644 --- a/tools/testfiles/tstring2.ddl +++ b/tools/testfiles/tstring2.ddl @@ -3,9 +3,9 @@ DATASET "str4" { DATATYPE H5T_STD_I8LE DATASPACE SIMPLE { ( 93 ) / ( 93 ) } DATA { - "Four score and seven + "Four score and seven years ago our forefathers brought fo" - "rth on this continent a new nation\000" + "rth on this continent a new nation\000" } } } diff --git a/tools/testfiles/tstringe.ddl b/tools/testfiles/tstringe.ddl index f7efcbf..d3f5181 100644 --- a/tools/testfiles/tstringe.ddl +++ b/tools/testfiles/tstringe.ddl @@ -2,11 +2,11 @@ HDF5 "tstr3.h5" { GROUP "/" { DATASET "str1" { DATATYPE H5T_STRING { - STRSIZE 73; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 73; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 1 ) / ( 1 ) } DATA { (0): "quote \" backspace\b form feed\f new line\n tab\t new line\n carriage return\r" @@ -14,11 +14,11 @@ GROUP "/" { } DATASET "str2" { DATATYPE H5T_STRING { - STRSIZE H5T_VARIABLE; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE H5T_VARIABLE; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 4 ) / ( 4 ) } DATA { (0): "Four score and seven\n years ago our forefathers brought forth on this continent a new nation,", diff --git a/tools/testfiles/tszip.ddl b/tools/testfiles/tszip.ddl index 08b714b..6fdd92f 100644 --- a/tools/testfiles/tszip.ddl +++ b/tools/testfiles/tszip.ddl @@ -5,7 +5,7 @@ DATASET "szip" { STORAGE_LAYOUT { CHUNKED ( 10, 5 ) SIZE 372 (2.151:1 COMPRESSION) - } + } FILTERS { COMPRESSION SZIP { PIXELS_PER_BLOCK 4 @@ -17,7 +17,7 @@ DATASET "szip" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tuserfilter.ddl b/tools/testfiles/tuserfilter.ddl index 29660a7..07b478f 100644 --- a/tools/testfiles/tuserfilter.ddl +++ b/tools/testfiles/tuserfilter.ddl @@ -5,19 +5,20 @@ DATASET "myfilter" { STORAGE_LAYOUT { CHUNKED ( 10, 5 ) SIZE 800 - } + } FILTERS { UNKNOWN_FILTER { FILTER_ID 405 COMMENT myfilter PARAMS { 5 6 } } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } +} } diff --git a/tools/testfiles/tvldtypes1.h5.xml b/tools/testfiles/tvldtypes1.h5.xml index 3ccd3b4..9c519f0 100644 --- a/tools/testfiles/tvldtypes1.h5.xml +++ b/tools/testfiles/tvldtypes1.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -27,7 +27,10 @@ - 0 10 11 20 21 22 30 31 32 33 + 0 + 10 11 + 20 21 22 + 30 31 32 33 @@ -35,9 +38,9 @@ - + - + @@ -57,7 +60,10 @@ - 0 10 10.1 20 20.1 20.2 30 30.1 30.2 30.3 + 0 + 10 10.1 + 20 20.1 20.2 + 30 30.1 30.2 30.3 @@ -65,9 +71,9 @@ - + - + diff --git a/tools/testfiles/tvldtypes2.h5.xml b/tools/testfiles/tvldtypes2.h5.xml index e0b44f3..9cabfdf 100644 --- a/tools/testfiles/tvldtypes2.h5.xml +++ b/tools/testfiles/tvldtypes2.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -31,7 +31,9 @@ - 0 100 110 111 200 210 211 220 221 222 + 0 + 100 110 111 + 200 210 211 220 221 222 300 310 311 320 321 322 330 331 332 333 diff --git a/tools/testfiles/tvldtypes3.h5.xml b/tools/testfiles/tvldtypes3.h5.xml index 902de03..811d536 100644 --- a/tools/testfiles/tvldtypes3.h5.xml +++ b/tools/testfiles/tvldtypes3.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -47,7 +47,10 @@ - 0 0 0 10 6.66667 10 11 20 13.3333 20 21 22 30 20 30 31 32 33 + 0 0 0 + 10 6.66667 10 11 + 20 13.3333 20 21 22 + 30 20 30 31 32 33 diff --git a/tools/testfiles/tvldtypes4.h5.xml b/tools/testfiles/tvldtypes4.h5.xml index 34cd2be..1d368ce 100644 --- a/tools/testfiles/tvldtypes4.h5.xml +++ b/tools/testfiles/tvldtypes4.h5.xml @@ -5,12 +5,12 @@ - + - - - - + + + + @@ -43,7 +43,9 @@ - 0 0 10 6.66667 11 7 20 13.3333 21 13.6667 22 14 + 0 0 + 10 6.66667 11 7 + 20 13.3333 21 13.6667 22 14 30 20 31 20.3333 32 20.6667 33 21 diff --git a/tools/testfiles/tvldtypes5.h5.xml b/tools/testfiles/tvldtypes5.h5.xml index d2d2bf6..d6ed774 100644 --- a/tools/testfiles/tvldtypes5.h5.xml +++ b/tools/testfiles/tvldtypes5.h5.xml @@ -5,12 +5,12 @@ - + - - - - + + + + @@ -30,7 +30,10 @@ - 0 2 4 6 8 0 2 4 6 8 10 12 + 0 2 4 6 8 + + 0 2 4 6 8 10 12 + diff --git a/tools/testfiles/tvlstr.ddl b/tools/testfiles/tvlstr.ddl index 2f1318c..dfce2eb 100644 --- a/tools/testfiles/tvlstr.ddl +++ b/tools/testfiles/tvlstr.ddl @@ -9,11 +9,11 @@ GROUP "/" { } DATASET "Dataset1" { DATATYPE H5T_STRING { - STRSIZE H5T_VARIABLE; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE H5T_VARIABLE; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 4 ) / ( 4 ) } DATA { (0): "Four score and seven years ago our forefathers brought forth on this continent a new nation,", @@ -22,11 +22,10 @@ GROUP "/" { } } DATATYPE "vl_string_type" H5T_STRING { - STRSIZE H5T_VARIABLE; - STRPAD H5T_STR_NULLPAD; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - }; - + STRSIZE H5T_VARIABLE; + STRPAD H5T_STR_NULLPAD; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + }; } } diff --git a/tools/testfiles/tvlstr.h5.xml b/tools/testfiles/tvlstr.h5.xml index 697aad5..e5ec1f3 100644 --- a/tools/testfiles/tvlstr.h5.xml +++ b/tools/testfiles/tvlstr.h5.xml @@ -16,12 +16,12 @@ - + - - - - + + + + -- cgit v0.12