summaryrefslogtreecommitdiffstats
path: root/tools/h5tools.h
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1999-04-27 14:47:54 (GMT)
committerRobb Matzke <matzke@llnl.gov>1999-04-27 14:47:54 (GMT)
commit2dc738a321e45ce1e0c5edcc2bf7f3623e823c9e (patch)
treebd07d5bdb789fed39d8a77122ed0d5613c1cb0b9 /tools/h5tools.h
parenta66c628b3c5e06e5ab188400d18c7565e5a0d738 (diff)
downloadhdf5-2dc738a321e45ce1e0c5edcc2bf7f3623e823c9e.zip
hdf5-2dc738a321e45ce1e0c5edcc2bf7f3623e823c9e.tar.gz
hdf5-2dc738a321e45ce1e0c5edcc2bf7f3623e823c9e.tar.bz2
[svn-r1224] Changes since 19990426
---------------------- ./tools/h5tools.c ./tools/h5tools.h Finally fixed a long-standing bug that caused core dumps if a compound datum rendered to more than some number of characters (we kept bumping up the limit at the risk of violating stack size limits on some machines). The fix works only on systems that have the vsnprintf() function (otherwise a 4kB limit is imposed, which if violated probably dumps core). If vsnprintf() is present then the library dynamically allocates space for the output string. Also made it possible to control how compound data is rendered across multiple lines of output by allowing the caller to specify where optional line-breaks get inserted. The output functions split up the value at one or more optional line-breaks to prevent it from wrapping around the screen. If a datum doesn't fit on the current line but would fit on the next line then it is printed on the next line regardless of whether optional line-breaks would have prevent wrapping around the screen. This makes it easier to find the beginnings of compound data values. This feature is disabled by default but can be enabled by the application. If a datum doesn't fit on the current line and the previous datum also occupied more than one line then we move to the next line before printing. This makes it easier to find the beginnings of compound data values but prevents the output from looking fragmented if there are only a few long values among mostly short values. This feature is disabled by default but can be enabled by the application. The application can control the printf() formats used for all the native data types. The defaults are what the library used to use: %g, %ld, %lu, %d, and %u ./tools/h5ls.c Compound datatype values can now be split across multiple lines of output instead of just wrapping. Also, when lots of compound values are too long they all start at the beginning of a line. This only required about 10 lines of changes in the setup for tools library calls (I didn't modify the h5dump program because it uses its own version of the tools library that forked off long ago). Added code for Win32 which is unable to cast `unsigned long long' to `double'. If the dataset size exceeds (2^63)-1 then the percent utilization is not displayed (this is easily possible with chunked datasets). This is untested yet. ./configure.in ./src/H5config.h.in ./src/H5.c ./src/H5private.h Check for vsnprintf() and provide a simple, stupid definition if it isn't available. The stupid definition just calls vsprintf() and ignores the second argument. This can result in buffer overflows in h5ls and h5dump since vsprintf() is an unsafe function (and anyone can create an hdf5 file that runs an arbitrary command from h5ls and h5dump in that case)! ./config/conclude.in Remove more *.o files for `make clean' ./src/H5A.c ./src/H5D.c ./src/H5F.c ./src/H5I.c ./src/H5Iprivate.h ./src/H5P.c ./src/H5R.c ./src/H5RA.c ./src/H5S.c ./src/H5T.c ./src/H5TB.c Cleaned up a memory leak during H5_term_library() by allowing H5I_clear_group() to skip items that couldn't be freed. This allows the item to remain in the group until we can free it later. ./src/H5F.c The H5F_close_all() function fails if a file cannot be closed.
Diffstat (limited to 'tools/h5tools.h')
-rw-r--r--tools/h5tools.h125
1 files changed, 113 insertions, 12 deletions
diff --git a/tools/h5tools.h b/tools/h5tools.h
index 8b5cbfe..a6ed864 100644
--- a/tools/h5tools.h
+++ b/tools/h5tools.h
@@ -18,15 +18,84 @@
*/
typedef struct h5dump_t {
/*
+ * Fields associated with formatting numeric data. If a datatype matches
+ * multiple formats based on its size, then the first applicable format
+ * from this list is used.
+ *
+ * fmt_int: The printf() format to use when rendering data which is
+ * typed `int'. The default is `%d'.
+ *
+ * fmt_uint: The printf() format to use when rendering data which is
+ * typed `unsigned'. The default is `%u'.
+ *
+ * fmt_schar: The printf() format to use when rendering data which is
+ * typed `signed char'. The default is `%d'. This format is
+ * used ony if the `ascii' field is zero.
+ *
+ * fmt_uchar: The printf() format to use when rendering data which is
+ * typed `unsigned char'. The default is `%u'. This format
+ * is used only if the `ascii' field is zero.
+ *
+ * fmt_short: The printf() format to use when rendering data which is
+ * typed `short'. The default is `%d'.
+ *
+ * fmt_ushort: The printf() format to use when rendering data which is
+ * typed `unsigned short'. The default is `%u'.
+ *
+ * fmt_long: The printf() format to use when rendering data which is
+ * typed `long'. The default is `%ld'.
+ *
+ * fmt_ulong: The printf() format to use when rendering data which is
+ * typed `unsigned long'. The default is `%lu'.
+ *
+ * fmt_llong: The printf() format to use when rendering data which is
+ * typed `long long'. The default depends on what printf()
+ * format is available to print this datatype.
+ *
+ * fmt_ullong: The printf() format to use when rendering data which is
+ * typed `unsigned long long'. The default depends on what
+ * printf() format is available to print this datatype.
+ *
+ * fmt_double: The printf() format to use when rendering data which is
+ * typed `double'. The default is `%g'.
+ *
+ * fmt_float: The printf() format to use when rendering data which is
+ * typed `float'. The default is `%g'.
+ *
+ * ascii: If set then print 1-byte integer values as an ASCII
+ * character (no quotes). If the character is one of the
+ * standard C escapes then print the escaped version. If
+ * the character is unprintable then print a 3-digit octal
+ * escape. If `ascii' is zero then then 1-byte integers are
+ * printed as numeric values. The default is zero.
+ *
+ * Numeric data is also subject to the formats for individual elements.
+ */
+ const char *fmt_int;
+ const char *fmt_uint;
+ const char *fmt_schar;
+ const char *fmt_uchar;
+ const char *fmt_short;
+ const char *fmt_ushort;
+ const char *fmt_long;
+ const char *fmt_ulong;
+ const char *fmt_llong;
+ const char *fmt_ullong;
+ const char *fmt_double;
+ const char *fmt_float;
+ int ascii;
+
+ /*
* Fields associated with compound array members.
*
* pre: A string to print at the beginning of each array. The
* default value is the left square bracket `['.
*
* sep: A string to print between array values. The default
- * value is a comma.
+ * value is a ",\001" ("\001" indicates an optional line
+ * break).
*
- * suf: A strint to print at the end of each array. The default
+ * suf: A string to print at the end of each array. The default
* value is a right square bracket `]'.
*/
const char *arr_pre;
@@ -42,7 +111,9 @@ typedef struct h5dump_t {
* followed by an equal sign and then the value.
*
* sep: A string that separates one member from another. The
- * default is a comma.
+ * default is ", \001" (the \001 indicates an optional
+ * line break to allow structs to span multiple lines of
+ * output).
*
* pre: A string to print at the beginning of a compound type.
* The default is a left curly brace.
@@ -58,13 +129,6 @@ typedef struct h5dump_t {
/*
* Fields associated with the individual elements.
*
- * ascii: If set then print 1-byte integer values as an ASCII
- * character (no quotes). If the character is one of the
- * standard C escapes then print the escaped version. If
- * the character is unprintable then print a 3-digit octal
- * escape. If `ascii' is zero then then 1-byte integers are
- * printed as numeric values. The default is zero.
- *
* fmt: A printf(3c) format to use to print the value string
* after it has been rendered. The default is "%s".
*
@@ -76,7 +140,6 @@ typedef struct h5dump_t {
* are followed on the same line by another element. The
* default is a single space.
*/
- int ascii;
const char *elmt_fmt;
const char *elmt_suf1;
const char *elmt_suf2;
@@ -107,6 +170,22 @@ typedef struct h5dump_t {
*
* ncols: Number of columns per line defaults to 80.
*
+ * pre: Each line of output contains an optional prefix area
+ * before the data. This area can contain the index for the
+ * first datum (represented by `%s') as well as other
+ * constant text. The default value is `%s'.
+ *
+ * 1st: This is the format to print at the beginning of the first
+ * line of output. The default value is the current value of
+ * `pre' described above.
+ *
+ * cont: This is the format to print at the beginning of each line
+ * which was continued because the line was split onto
+ * multiple lines. This often happens with compound
+ * data which is longer than one line of output. The default
+ * value is the current value of the `pre' field
+ * described above.
+ *
* suf: This character string will be appended to each line of
* output. It should not contain line feeds. The default
* is the empty string.
@@ -114,11 +193,33 @@ typedef struct h5dump_t {
* sep: A character string to be printed after every line feed
* defaulting to the empty string. It should end with a
* line feed.
+ *
+ * multi_new: Indicates the algorithm to use when data elements tend to
+ * occupy more than one line of output. The possible values
+ * are (zero is the default):
+ *
+ * 0: No consideration. Each new element is printed
+ * beginning where the previous element ended.
+ *
+ * 1: Print the current element beginning where the
+ * previous element left off. But if that would result
+ * in the element occupying more than one line and it
+ * would only occupy one line if it started at the
+ * beginning of a line, then it is printed at the
+ * beginning of the next line.
+ *
+ * multi_new: If an element is continued onto additional lines then
+ * should the following element begin on the next line? The
+ * default is to start the next element on the same line
+ * unless it wouldn't fit.
*/
int line_ncols; /*columns of output */
+ const char *line_pre; /*prefix at front of each line */
+ const char *line_1st; /*alternate pre. on first line */
+ const char *line_cont; /*alternate pre. on continuation*/
const char *line_suf; /*string to append to each line */
const char *line_sep; /*separates lines */
-
+ int line_multi_new; /*split multi-line outputs? */
} h5dump_t;