summaryrefslogtreecommitdiffstats
path: root/tools/h5import
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2008-09-25 20:38:21 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2008-09-25 20:38:21 (GMT)
commita6e2a45d15bc066072d01c4792b810ff47bae377 (patch)
tree0820b696f13c14f6391cc6946c13128633ad55d8 /tools/h5import
parent41e1d56e32ffc4600068e8a61dd499adad1db5f2 (diff)
downloadhdf5-a6e2a45d15bc066072d01c4792b810ff47bae377.zip
hdf5-a6e2a45d15bc066072d01c4792b810ff47bae377.tar.gz
hdf5-a6e2a45d15bc066072d01c4792b810ff47bae377.tar.bz2
[svn-r15699] Bug fix #1281
The TEXTFPE was described in the usage (read floats in scientific notation) but was not implemeneted. Solution: remove TEXTFPE from the help system and have the TEXTFPE input type do the same thing as TEXTPF currently does to support backwards compatibility (the format read for both TEXTFPE and TEXTPF is %f) added a test tested: windows, linux
Diffstat (limited to 'tools/h5import')
-rwxr-xr-xtools/h5import/h5import.c33
-rwxr-xr-xtools/h5import/h5importtestutil.sh4
-rw-r--r--tools/h5import/testfiles/in64.txt2
-rw-r--r--tools/h5import/testfiles/test15.h5bin0 -> 2064 bytes
-rw-r--r--tools/h5import/testfiles/textpfe.conf11
5 files changed, 44 insertions, 6 deletions
diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c
index 6352c52..89d14f9 100755
--- a/tools/h5import/h5import.c
+++ b/tools/h5import/h5import.c
@@ -764,8 +764,20 @@ readFloatData(FILE **strm, struct Input *in)
fp32 = (H5DT_FLOAT32 *) in->data;
break;
+ /* same as TEXTFP */
case 2: /*TEXTFPE */
- break;
+
+ for (i = 0; i < len; i++, fp32++)
+ {
+ if (fscanf(*strm, "%f", fp32) != 1)
+ {
+ (void) fprintf(stderr, err1);
+ return (-1);
+ }
+ }
+
+ fp32 = (H5DT_FLOAT32 *) in->data;
+ break;
case 3: /* FP */
for (i = 0; i < len; i++, fp32++)
@@ -801,8 +813,20 @@ readFloatData(FILE **strm, struct Input *in)
fp64 = (H5DT_FLOAT64 *) in->data;
break;
+ /* same as TEXTFP */
case 2: /*TEXTFPE */
- break;
+
+ for (i = 0; i < len; i++, fp64++)
+ {
+ if (fscanf(*strm, "%lf", fp64) != 1)
+ {
+ (void) fprintf(stderr, err1);
+ return (-1);
+ }
+ }
+
+ fp64 = (H5DT_FLOAT64 *) in->data;
+ break;
case 3: /* FP */
for (i = 0; i < len; i++, fp64++)
@@ -2733,7 +2757,7 @@ help(char *name)
(void) fprintf(stdout, "\t to be created.\n\n");
(void) fprintf(stdout, "\t INPUT-CLASS:\n");
(void) fprintf(stdout, "\t String denoting the type of input data.\n");
- (void) fprintf(stdout, "\t (\"TEXTIN\", \"TEXTFP\", \"TEXTFPE\", \"FP\", \"IN\", \n");
+ (void) fprintf(stdout, "\t (\"TEXTIN\", \"TEXTFP\", \"FP\", \"IN\", \n");
(void) fprintf(stdout, "\t \"STR\", \"TEXTUIN\", \"UIN\"). \n");
(void) fprintf(stdout, "\t INPUT-CLASS \"TEXTIN\" denotes an ASCII text \n");
(void) fprintf(stdout, "\t file with signed integer data in ASCII form,\n");
@@ -2742,9 +2766,6 @@ help(char *name)
(void) fprintf(stdout, "\t \"TEXTFP\" denotes an ASCII text file containing\n");
(void) fprintf(stdout, "\t floating point data in the fixed notation\n");
(void) fprintf(stdout, "\t (325.34),\n");
- (void) fprintf(stdout, "\t \"TEXTFPE\" denotes an ASCII text file containing\n");
- (void) fprintf(stdout, "\t floating point data in the scientific notation\n");
- (void) fprintf(stdout, "\t (3.2534E+02),\n");
(void) fprintf(stdout, "\t \"FP\" denotes a floating point binary file,\n");
(void) fprintf(stdout, "\t \"IN\" denotes a signed integer binary file,\n");
(void) fprintf(stdout, "\t \"UIN\" denotes an unsigned integer binary file,\n");
diff --git a/tools/h5import/h5importtestutil.sh b/tools/h5import/h5importtestutil.sh
index ff7dc35..ed0a930 100755
--- a/tools/h5import/h5importtestutil.sh
+++ b/tools/h5import/h5importtestutil.sh
@@ -124,6 +124,10 @@ TOOLTEST $srcdir/testfiles/txtstr.txt -c $srcdir/testfiles/txtstr.conf -o txtstr
TESTING "BINARY I8 CR LF EOF"
TOOLTEST binin8w.bin -c $srcdir/testfiles/binin8w.conf -o binin8w.h5
+TESTING "ASCII F64 - rank 1 - INPUT-CLASS TEXTFPE "
+TOOLTEST $srcdir/testfiles/in64.txt -c $srcdir/testfiles/textpfe.conf -o test15.h5
+
+
rm -f *.txt *.bin *.h5
rm -rf tmp_testfiles
diff --git a/tools/h5import/testfiles/in64.txt b/tools/h5import/testfiles/in64.txt
new file mode 100644
index 0000000..f6dd7f4
--- /dev/null
+++ b/tools/h5import/testfiles/in64.txt
@@ -0,0 +1,2 @@
+6.02E+24
+3.14159265E+00
diff --git a/tools/h5import/testfiles/test15.h5 b/tools/h5import/testfiles/test15.h5
new file mode 100644
index 0000000..14a9b3e
--- /dev/null
+++ b/tools/h5import/testfiles/test15.h5
Binary files differ
diff --git a/tools/h5import/testfiles/textpfe.conf b/tools/h5import/testfiles/textpfe.conf
new file mode 100644
index 0000000..69fd8c8
--- /dev/null
+++ b/tools/h5import/testfiles/textpfe.conf
@@ -0,0 +1,11 @@
+PATH /test
+INPUT-CLASS TEXTFPE
+INPUT-SIZE 64
+RANK 1
+DIMENSION-SIZES 2
+OUTPUT-CLASS FP
+OUTPUT-SIZE 64
+
+
+
+