From 66698746984365e58e6d2848721fc24e415c676e Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Wed, 24 Sep 2008 16:13:49 -0500 Subject: [svn-r15694] 1) 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 2) renamed configuration files to have the extension .conf tested: windows, linux --- MANIFEST | 20 ++++++++++++-------- tools/h5import/h5import.c | 29 +++++++++++++++++++++++++---- tools/h5import/h5importtest.c | 5 +++-- tools/h5import/h5importtestutil.sh | 19 +++++++++++-------- tools/h5import/testfiles/in64.txt | 2 ++ tools/h5import/testfiles/test15.h5 | Bin 0 -> 2064 bytes tools/h5import/testfiles/textfp32 | 10 ---------- tools/h5import/testfiles/textfp32.conf | 10 ++++++++++ tools/h5import/testfiles/textfp64 | 13 ------------- tools/h5import/testfiles/textfp64.conf | 13 +++++++++++++ tools/h5import/testfiles/textin16 | 12 ------------ tools/h5import/testfiles/textin16.conf | 12 ++++++++++++ tools/h5import/testfiles/textin32 | 11 ----------- tools/h5import/testfiles/textin32.conf | 11 +++++++++++ tools/h5import/testfiles/textin8 | 16 ---------------- tools/h5import/testfiles/textin8.conf | 16 ++++++++++++++++ tools/h5import/testfiles/textpfe.conf | 11 +++++++++++ tools/h5import/testfiles/textuin16 | 12 ------------ tools/h5import/testfiles/textuin16.conf | 12 ++++++++++++ tools/h5import/testfiles/textuin32 | 11 ----------- tools/h5import/testfiles/textuin32.conf | 11 +++++++++++ 21 files changed, 149 insertions(+), 107 deletions(-) create mode 100644 tools/h5import/testfiles/in64.txt create mode 100644 tools/h5import/testfiles/test15.h5 delete mode 100755 tools/h5import/testfiles/textfp32 create mode 100755 tools/h5import/testfiles/textfp32.conf delete mode 100755 tools/h5import/testfiles/textfp64 create mode 100755 tools/h5import/testfiles/textfp64.conf delete mode 100755 tools/h5import/testfiles/textin16 create mode 100755 tools/h5import/testfiles/textin16.conf delete mode 100755 tools/h5import/testfiles/textin32 create mode 100755 tools/h5import/testfiles/textin32.conf delete mode 100755 tools/h5import/testfiles/textin8 create mode 100755 tools/h5import/testfiles/textin8.conf create mode 100644 tools/h5import/testfiles/textpfe.conf delete mode 100755 tools/h5import/testfiles/textuin16 create mode 100755 tools/h5import/testfiles/textuin16.conf delete mode 100755 tools/h5import/testfiles/textuin32 create mode 100755 tools/h5import/testfiles/textuin32.conf diff --git a/MANIFEST b/MANIFEST index 5fb9c0c..bb754e2 100644 --- a/MANIFEST +++ b/MANIFEST @@ -927,13 +927,13 @@ ./tools/h5import/testfiles/fp1 ./tools/h5import/testfiles/fp2 ./tools/h5import/testfiles/in1 -./tools/h5import/testfiles/textfp32 -./tools/h5import/testfiles/textfp64 -./tools/h5import/testfiles/textin16 -./tools/h5import/testfiles/textin32 -./tools/h5import/testfiles/textin8 -./tools/h5import/testfiles/textuin16 -./tools/h5import/testfiles/textuin32 +./tools/h5import/testfiles/textfp32.conf +./tools/h5import/testfiles/textfp64.conf +./tools/h5import/testfiles/textin16.conf +./tools/h5import/testfiles/textin32.conf +./tools/h5import/testfiles/textin8.conf +./tools/h5import/testfiles/textuin16.conf +./tools/h5import/testfiles/textuin32.conf ./tools/h5import/testfiles/test1.h5 ./tools/h5import/testfiles/test2.h5 ./tools/h5import/testfiles/test3.h5 @@ -948,8 +948,12 @@ ./tools/h5import/testfiles/test12.h5 ./tools/h5import/testfiles/test13.h5 ./tools/h5import/testfiles/teststr.h5 -./tools/h5import/testfiles/txtstr +./tools/h5import/testfiles/test15.h5 +./tools/h5import/testfiles/teststr.h5 ./tools/h5import/testfiles/textstr +./tools/h5import/testfiles/textpfe.conf +./tools/h5import/testfiles/in64.txt + diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index 2d19d95..4b24223 100755 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -719,7 +719,19 @@ readFloatData(FILE **strm, struct Input *in) fp32 = (H5DT_FLOAT32 *) in->data; break; + /* same as TEXTFP */ case 2: /*TEXTFPE */ + + 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 */ @@ -756,7 +768,19 @@ readFloatData(FILE **strm, struct Input *in) fp64 = (H5DT_FLOAT64 *) in->data; break; + /* same as TEXTFP */ case 2: /*TEXTFPE */ + + 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 */ @@ -2678,7 +2702,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"); @@ -2687,9 +2711,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/h5importtest.c b/tools/h5import/h5importtest.c index 7a6bbff..3c82e81 100755 --- a/tools/h5import/h5importtest.c +++ b/tools/h5import/h5importtest.c @@ -29,6 +29,7 @@ * Define names for test files */ + int main(void) { @@ -172,7 +173,7 @@ main(void) #ifndef UNICOS - sp = fopen("txtin16", "w"); + sp = fopen("in16.txt", "w"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) { @@ -182,7 +183,7 @@ main(void) } (void) fclose(sp); - sp = fopen("txtin32", "w"); + sp = fopen("in32.txt", "w"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) { diff --git a/tools/h5import/h5importtestutil.sh b/tools/h5import/h5importtestutil.sh index 0687871..4f5a7bb 100755 --- a/tools/h5import/h5importtestutil.sh +++ b/tools/h5import/h5importtestutil.sh @@ -60,25 +60,25 @@ cp $srcdir/testfiles/*.h5 tmp_testfiles/ $RUNSERIAL ./h5importtest TESTING "ASCII I32 rank 3 - Output BE " ; -TOOLTEST txtin32 -c $srcdir/testfiles/textin32 -o test1.h5 +TOOLTEST in32.txt -c $srcdir/testfiles/textin32.conf -o test1.h5 TESTING "ASCII I16 rank 3 - Output LE - CHUNKED - extended" -TOOLTEST txtin16 -c $srcdir/testfiles/textin16 -o test2.h5 +TOOLTEST in16.txt -c $srcdir/testfiles/textin16.conf -o test2.h5 TESTING "ASCII I8 - rank 3 - Output I16 LE-Chunked+Extended+Compressed " -TOOLTEST txtin16 -c $srcdir/testfiles/textin8 -o test3.h5 +TOOLTEST in16.txt -c $srcdir/testfiles/textin8.conf -o test3.h5 TESTING "ASCII UI32 - rank 3 - Output BE" -TOOLTEST $srcdir/testfiles/in1 -c $srcdir/testfiles/textuin32 -o test4.h5 +TOOLTEST $srcdir/testfiles/in1 -c $srcdir/testfiles/textuin32.conf -o test4.h5 TESTING "ASCII UI16 - rank 2 - Output LE+Chunked+Compressed " -TOOLTEST $srcdir/testfiles/in1 -c $srcdir/testfiles/textuin16 -o test5.h5 +TOOLTEST $srcdir/testfiles/in1 -c $srcdir/testfiles/textuin16.conf -o test5.h5 TESTING "ASCII F32 - rank 3 - Output LE " -TOOLTEST $srcdir/testfiles/fp1 -c $srcdir/testfiles/textfp32 -o test6.h5 +TOOLTEST $srcdir/testfiles/fp1 -c $srcdir/testfiles/textfp32.conf -o test6.h5 TESTING "ASCII F64 - rank 3 - Output BE + CHUNKED+Extended+Compressed " -TOOLTEST $srcdir/testfiles/fp2 -c $srcdir/testfiles/textfp64 -o test7.h5 +TOOLTEST $srcdir/testfiles/fp2 -c $srcdir/testfiles/textfp64.conf -o test7.h5 TESTING "BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed " TOOLTEST bfp64 -c $srcdir/testfiles/conbfp64 -o test8.h5 @@ -101,7 +101,10 @@ TOOLTEST buin32 -c $srcdir/testfiles/conbuin32 -o test13.h5 TESTING "STR" TOOLTEST $srcdir/testfiles/txtstr -c $srcdir/testfiles/textstr -o teststr.h5 -rm -f tx* b* *.dat +TESTING "ASCII F64 - rank 1 - INPUT-CLASS TEXTFPE " +TOOLTEST $srcdir/testfiles/in64.txt -c $srcdir/testfiles/textpfe.conf -o test15.h5 + +rm -f tx* b* *.dat *.txt rm -f test*.h5 rm -rf tmp_testfiles else 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..73a157c Binary files /dev/null and b/tools/h5import/testfiles/test15.h5 differ diff --git a/tools/h5import/testfiles/textfp32 b/tools/h5import/testfiles/textfp32 deleted file mode 100755 index 9696a7f..0000000 --- a/tools/h5import/testfiles/textfp32 +++ /dev/null @@ -1,10 +0,0 @@ -PATH /fp/32-bit -INPUT-CLASS TEXTFP -INPUT-SIZE 32 -RANK 3 -DIMENSION-SIZES 2 4 3 -OUTPUT-ARCHITECTURE IEEE -OUTPUT-BYTE-ORDER LE - - - diff --git a/tools/h5import/testfiles/textfp32.conf b/tools/h5import/testfiles/textfp32.conf new file mode 100755 index 0000000..9696a7f --- /dev/null +++ b/tools/h5import/testfiles/textfp32.conf @@ -0,0 +1,10 @@ +PATH /fp/32-bit +INPUT-CLASS TEXTFP +INPUT-SIZE 32 +RANK 3 +DIMENSION-SIZES 2 4 3 +OUTPUT-ARCHITECTURE IEEE +OUTPUT-BYTE-ORDER LE + + + diff --git a/tools/h5import/testfiles/textfp64 b/tools/h5import/testfiles/textfp64 deleted file mode 100755 index fbab6a6..0000000 --- a/tools/h5import/testfiles/textfp64 +++ /dev/null @@ -1,13 +0,0 @@ -PATH /fp/64-bit -INPUT-CLASS TEXTFP -INPUT-SIZE 64 -RANK 3 -DIMENSION-SIZES 4 4 3 -OUTPUT-ARCHITECTURE IEEE -OUTPUT-BYTE-ORDER BE -CHUNKED-DIMENSION-SIZES 2 2 2 -COMPRESSION-PARAM 8 -MAXIMUM-DIMENSIONS -1 6 7 - - - diff --git a/tools/h5import/testfiles/textfp64.conf b/tools/h5import/testfiles/textfp64.conf new file mode 100755 index 0000000..fbab6a6 --- /dev/null +++ b/tools/h5import/testfiles/textfp64.conf @@ -0,0 +1,13 @@ +PATH /fp/64-bit +INPUT-CLASS TEXTFP +INPUT-SIZE 64 +RANK 3 +DIMENSION-SIZES 4 4 3 +OUTPUT-ARCHITECTURE IEEE +OUTPUT-BYTE-ORDER BE +CHUNKED-DIMENSION-SIZES 2 2 2 +COMPRESSION-PARAM 8 +MAXIMUM-DIMENSIONS -1 6 7 + + + diff --git a/tools/h5import/testfiles/textin16 b/tools/h5import/testfiles/textin16 deleted file mode 100755 index d2d11c3..0000000 --- a/tools/h5import/testfiles/textin16 +++ /dev/null @@ -1,12 +0,0 @@ -PATH /int/16-bit -INPUT-CLASS TEXTIN -INPUT-SIZE 16 -RANK 3 -DIMENSION-SIZES 2 4 3 -OUTPUT-BYTE-ORDER LE -CHUNKED-DIMENSION-SIZES 2 2 2 -MAXIMUM-DIMENSIONS -1 -1 8 -OUTPUT-ARCHITECTURE STD - - - diff --git a/tools/h5import/testfiles/textin16.conf b/tools/h5import/testfiles/textin16.conf new file mode 100755 index 0000000..d2d11c3 --- /dev/null +++ b/tools/h5import/testfiles/textin16.conf @@ -0,0 +1,12 @@ +PATH /int/16-bit +INPUT-CLASS TEXTIN +INPUT-SIZE 16 +RANK 3 +DIMENSION-SIZES 2 4 3 +OUTPUT-BYTE-ORDER LE +CHUNKED-DIMENSION-SIZES 2 2 2 +MAXIMUM-DIMENSIONS -1 -1 8 +OUTPUT-ARCHITECTURE STD + + + diff --git a/tools/h5import/testfiles/textin32 b/tools/h5import/testfiles/textin32 deleted file mode 100755 index ca4802a..0000000 --- a/tools/h5import/testfiles/textin32 +++ /dev/null @@ -1,11 +0,0 @@ -PATH /int/32-bit -INPUT-CLASS TEXTIN -INPUT-SIZE 32 -RANK 3 -DIMENSION-SIZES 2 4 3 -OUTPUT-ARCHITECTURE STD -OUTPUT-BYTE-ORDER BE - - - - diff --git a/tools/h5import/testfiles/textin32.conf b/tools/h5import/testfiles/textin32.conf new file mode 100755 index 0000000..ca4802a --- /dev/null +++ b/tools/h5import/testfiles/textin32.conf @@ -0,0 +1,11 @@ +PATH /int/32-bit +INPUT-CLASS TEXTIN +INPUT-SIZE 32 +RANK 3 +DIMENSION-SIZES 2 4 3 +OUTPUT-ARCHITECTURE STD +OUTPUT-BYTE-ORDER BE + + + + diff --git a/tools/h5import/testfiles/textin8 b/tools/h5import/testfiles/textin8 deleted file mode 100755 index 4405338..0000000 --- a/tools/h5import/testfiles/textin8 +++ /dev/null @@ -1,16 +0,0 @@ -PATH /int/8-bit -INPUT-CLASS TEXTIN -INPUT-SIZE 8 -OUTPUT-CLASS IN -OUTPUT-SIZE 8 -OUTPUT-BYTE-ORDER LE -OUTPUT-ARCHITECTURE STD -RANK 3 -DIMENSION-SIZES 2 4 3 -CHUNKED-DIMENSION-SIZES 2 2 2 -MAXIMUM-DIMENSIONS -1 -1 -1 -COMPRESSION-PARAM 3 - - - - diff --git a/tools/h5import/testfiles/textin8.conf b/tools/h5import/testfiles/textin8.conf new file mode 100755 index 0000000..4405338 --- /dev/null +++ b/tools/h5import/testfiles/textin8.conf @@ -0,0 +1,16 @@ +PATH /int/8-bit +INPUT-CLASS TEXTIN +INPUT-SIZE 8 +OUTPUT-CLASS IN +OUTPUT-SIZE 8 +OUTPUT-BYTE-ORDER LE +OUTPUT-ARCHITECTURE STD +RANK 3 +DIMENSION-SIZES 2 4 3 +CHUNKED-DIMENSION-SIZES 2 2 2 +MAXIMUM-DIMENSIONS -1 -1 -1 +COMPRESSION-PARAM 3 + + + + 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 + + + + diff --git a/tools/h5import/testfiles/textuin16 b/tools/h5import/testfiles/textuin16 deleted file mode 100755 index 753e6e8..0000000 --- a/tools/h5import/testfiles/textuin16 +++ /dev/null @@ -1,12 +0,0 @@ -PATH /int/uint/16-bit -INPUT-CLASS TEXTUIN -INPUT-SIZE 16 -RANK 2 -DIMENSION-SIZES 4 3 -COMPRESSION-PARAM 2 -CHUNKED-DIMENSION-SIZES 2 2 -OUTPUT-ARCHITECTURE STD -OUTPUT-BYTE-ORDER LE - - - diff --git a/tools/h5import/testfiles/textuin16.conf b/tools/h5import/testfiles/textuin16.conf new file mode 100755 index 0000000..753e6e8 --- /dev/null +++ b/tools/h5import/testfiles/textuin16.conf @@ -0,0 +1,12 @@ +PATH /int/uint/16-bit +INPUT-CLASS TEXTUIN +INPUT-SIZE 16 +RANK 2 +DIMENSION-SIZES 4 3 +COMPRESSION-PARAM 2 +CHUNKED-DIMENSION-SIZES 2 2 +OUTPUT-ARCHITECTURE STD +OUTPUT-BYTE-ORDER LE + + + diff --git a/tools/h5import/testfiles/textuin32 b/tools/h5import/testfiles/textuin32 deleted file mode 100755 index d61e1a1..0000000 --- a/tools/h5import/testfiles/textuin32 +++ /dev/null @@ -1,11 +0,0 @@ -PATH /int/uint/32-bit -INPUT-CLASS TEXTUIN -INPUT-SIZE 32 -RANK 3 -DIMENSION-SIZES 2 4 3 -OUTPUT-ARCHITECTURE STD -OUTPUT-BYTE-ORDER BE - - - - diff --git a/tools/h5import/testfiles/textuin32.conf b/tools/h5import/testfiles/textuin32.conf new file mode 100755 index 0000000..d61e1a1 --- /dev/null +++ b/tools/h5import/testfiles/textuin32.conf @@ -0,0 +1,11 @@ +PATH /int/uint/32-bit +INPUT-CLASS TEXTUIN +INPUT-SIZE 32 +RANK 3 +DIMENSION-SIZES 2 4 3 +OUTPUT-ARCHITECTURE STD +OUTPUT-BYTE-ORDER BE + + + + -- cgit v0.12