summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2004-06-22 14:29:21 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2004-06-22 14:29:21 (GMT)
commita5f1d15035deb7b400f6228da936f1b96664aa35 (patch)
tree5ec7c5cab2035ef00a38bce95ad43cfaebf3fc22 /tools/lib
parent18a656663a73a693cabf49d6f4858f7af311e6f5 (diff)
downloadhdf5-a5f1d15035deb7b400f6228da936f1b96664aa35.zip
hdf5-a5f1d15035deb7b400f6228da936f1b96664aa35.tar.gz
hdf5-a5f1d15035deb7b400f6228da936f1b96664aa35.tar.bz2
[svn-r8715] Purpose:
h5dump output change, new tests Description: the storage layout output format the storage layout output format had some changes same for the user defined filter add an option (-y) for not printing the array indices (default is print indices ) the option for escaping non printable characters covers all characters (default is not escape) (this might be not very portable, the test files are tstring.ddl and tstringe.ddl ) add tests for the new options Solution: Platforms tested: linux solaris AIX Misc. update:
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5tools.h5
-rw-r--r--tools/lib/h5tools_str.c40
2 files changed, 31 insertions, 14 deletions
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index d561a94..7837a5e 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -318,8 +318,8 @@ typedef struct h5dump_t {
/*print array indices in output matrix */
int pindex;
- /*interpret CR/LF information */
- int do_lf;
+ /*escape non printable characters */
+ int do_escape;
} h5dump_t;
@@ -480,7 +480,6 @@ extern FILE *rawdatastream; /*output stream for raw data */
#define SHUFFLE "PREPROCESSING SHUFFLE"
#define FLETCHER32 "CHECKSUM FLETCHER32"
#define SZIP "COMPRESSION SZIP"
-#define UNKNOWN_FILTER "UNKNOWN_FILTER"
#define STORAGE_LAYOUT "STORAGE_LAYOUT"
#define CONTIGUOUS "CONTIGUOUS"
#define COMPACT "COMPACT"
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 9faba55..9214b89 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -475,33 +475,50 @@ h5tools_print_char(h5tools_str_t *str, const h5dump_t *info, unsigned char ch)
} else {
switch (ch) {
case '"':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\"");
+ else
h5tools_str_append(str, "\\\"");
break;
case '\\':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\\");
+ else
h5tools_str_append(str, "\\\\");
break;
case '\b':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\b");
+ else
h5tools_str_append(str, "\\b");
break;
case '\f':
- h5tools_str_append(str, "\\f");
+ if (!info->do_escape)
+ h5tools_str_append(str, "\f");
+ else
+ h5tools_str_append(str, "\\f");
break;
case '\n':
- if (info->do_lf) {
- h5tools_str_append(str, "\n");
- h5tools_str_append(str, " ");
- }
- else
- h5tools_str_append(str, "\\n");
+ if (!info->do_escape) {
+ h5tools_str_append(str, "\n");
+ h5tools_str_append(str, " ");
+ }
+ else
+ h5tools_str_append(str, "\\n");
break;
case '\r':
+ if (!info->do_escape) {
+ h5tools_str_append(str, "\r");
+ h5tools_str_append(str, " ");
+ }
+ else
h5tools_str_append(str, "\\r");
break;
case '\t':
- if (info->do_lf)
- h5tools_str_append(str, "\t");
- else
- h5tools_str_append(str, "\\t");
+ if (!info->do_escape)
+ h5tools_str_append(str, "\t");
+ else
+ h5tools_str_append(str, "\\t");
break;
default:
if (isprint(ch))
@@ -514,6 +531,7 @@ h5tools_print_char(h5tools_str_t *str, const h5dump_t *info, unsigned char ch)
}
}
+
/*-------------------------------------------------------------------------
* Function: h5tools_str_sprint
*