diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-08-13 20:53:35 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-08-13 20:53:35 (GMT) |
commit | 6b45f5172ccb4311e0be9ae15da3758abb6b0e67 (patch) | |
tree | 5a7a112fe7a8a98c6fecb45b513789d15962eb3d /tools/h5import | |
parent | 6562465a2c2a58cfbc2f47bf60bb538f7a783933 (diff) | |
download | hdf5-6b45f5172ccb4311e0be9ae15da3758abb6b0e67.zip hdf5-6b45f5172ccb4311e0be9ae15da3758abb6b0e67.tar.gz hdf5-6b45f5172ccb4311e0be9ae15da3758abb6b0e67.tar.bz2 |
[svn-r11245] Purpose:
Code cleanup
Description:
Trim trailing whitespace, which is making 'diff'ing the two branches
difficult.
Solution:
Ran this script in each directory:
foreach f (*.[ch] *.cpp)
sed 's/[[:blank:]]*$//' $f > sed.out && mv sed.out $f
end
Platforms tested:
FreeBSD 4.11 (sleipnir)
Too minor to require h5committest
Diffstat (limited to 'tools/h5import')
-rwxr-xr-x | tools/h5import/h5import.c | 702 | ||||
-rwxr-xr-x | tools/h5import/h5import.h | 24 | ||||
-rwxr-xr-x | tools/h5import/h5importtest.c | 52 |
3 files changed, 389 insertions, 389 deletions
diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index b24aa84..79c249b 100755 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -21,7 +21,7 @@ #include <ctype.h> #include "h5import.h" -int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { struct Options opt; int outfile_named = FALSE; @@ -39,7 +39,7 @@ int main(int argc, char *argv[]) const char *err7 = "Invalid type of data - %s.\n"; const char *err8 = "Invalid size of data - %s.\n"; const char *err9 = "Cannot specify more than 30 input files in one call to h5import.\n"; - + (void) setvbuf(stderr, (char *) NULL, _IOLBF, 0); (void) setvbuf(stdout, (char *) NULL, _IOLBF, 0); @@ -50,7 +50,7 @@ int main(int argc, char *argv[]) /* * validate the number of command line arguments */ - + if (argc < 2) { (void) fprintf(stderr, err1, argc); @@ -72,25 +72,25 @@ int main(int argc, char *argv[]) usage(argv[0]); goto err; } - + state = state_table[state][token]; switch (state) { - - case 1: /* counting input files */ - if (opt.fcount < 29) { + + case 1: /* counting input files */ + if (opt.fcount < 29) { (void) HDstrcpy(opt.infiles[opt.fcount].datafile, argv[i]); in = &(opt.infiles[opt.fcount].in); opt.infiles[opt.fcount].config = 0; - setDefaultValues(in, opt.fcount); + setDefaultValues(in, opt.fcount); opt.fcount++; } else { (void) fprintf(stderr, err9, argv[i]); goto err; } - + break; case 2: /* -c found; look for configfile */ @@ -163,7 +163,7 @@ int main(int argc, char *argv[]) (void) fprintf(stderr, err8, argv[i]); goto err; } - /*set default value for output-size */ + /*set default value for output-size */ in->outputSize = in->inputSize; break; @@ -181,11 +181,11 @@ int main(int argc, char *argv[]) usage(argv[0]); goto err; } - + if (process(&opt) == -1) goto err; - return(0); + return(0); err: (void) fprintf(stderr, err4); return(-1); @@ -212,38 +212,38 @@ gtoken(char *s) if (!HDstrncmp("outfile", &s[1], len)) token = OPT_o; break; - + case 'c': if (!HDstrncmp("config", &s[1], len)) token = OPT_c; break; - + case 'h': if (!HDstrncmp("help", &s[1], len)) token = OPT_h; - break; + break; case 'd': if (!HDstrncmp("dims", &s[1], len)) token = OPT_d; - break; + break; case 'p': if (!HDstrncmp("path", &s[1], len)) token = OPT_p; - break; + break; case 't': if (!HDstrncmp("type", &s[1], len)) token = OPT_t; - break; + break; case 's': if (!HDstrncmp("size", &s[1], len)) token = OPT_s; - break; + break; } - + if (token == ERR) (void) fprintf(stderr, err1, s); } @@ -254,7 +254,7 @@ gtoken(char *s) return (token); } -static int +static int processDataFile(char *infile, struct Input *in, FILE **strm) { const char *err1 = "Unable to open the input file %s for reading.\n"; @@ -262,8 +262,8 @@ processDataFile(char *infile, struct Input *in, FILE **strm) const char *err3 = "Error in allocating floating-point data storage.\n"; const char *err4 = "Error in reading integer data.\n"; const char *err5 = "Error in reading floating-point data.\n"; - const char *err6 = "Error in allocating unsigned integer data storage.\n"; - const char *err7 = "Error in reading unsigned integer data.\n"; + const char *err6 = "Error in allocating unsigned integer data storage.\n"; + const char *err7 = "Error in reading unsigned integer data.\n"; const char *err10 = "Unrecognized input class type.\n"; if ((*strm = fopen(infile, "r")) == NULL) @@ -279,33 +279,33 @@ processDataFile(char *infile, struct Input *in, FILE **strm) if (allocateIntegerStorage(in) == -1) { (void) fprintf(stderr, err2, infile); - return(-1); + return(-1); } if (readIntegerData(strm, in) == -1) { (void) fprintf(stderr, err4, infile); - return(-1); + return(-1); } break; case 1: /* TEXTFP */ case 2: /* TEXTFPE */ - case 3: /* FP */ + case 3: /* FP */ if (allocateFloatStorage(in) == -1) { (void) fprintf(stderr, err3, infile); - return(-1); + return(-1); } - + if (readFloatData(strm, in) == -1) { (void) fprintf(stderr, err5, infile); - return(-1); + return(-1); } break; - + case 5: /* STR */ break; @@ -314,15 +314,15 @@ processDataFile(char *infile, struct Input *in, FILE **strm) if (allocateUIntegerStorage(in) == -1) { (void) fprintf(stderr, err6, infile); - return(-1); + return(-1); } if (readUIntegerData(strm, in) == -1) { (void) fprintf(stderr, err7, infile); - return(-1); + return(-1); } break; - + default: (void) fprintf(stderr, err10); return(-1); @@ -330,7 +330,7 @@ processDataFile(char *infile, struct Input *in, FILE **strm) return (0); } -static int +static int readIntegerData(FILE **strm, struct Input *in) { H5DT_INT8 *in08; @@ -346,7 +346,7 @@ readIntegerData(FILE **strm, struct Input *in) const char *err1 = "Unable to get integer value from file.\n"; const char *err2 = "Unrecongnized input class type.\n"; - const char *err3 = "Invalid input size.\n"; + const char *err3 = "Invalid input size.\n"; for (j=0; j<in->rank;j++) len *= in->sizeOfDimension[j]; @@ -357,38 +357,38 @@ readIntegerData(FILE **strm, struct Input *in) switch(in->inputClass) { case 0: /* TEXTIN */ - in08 = (H5DT_INT8 *) in->data; + in08 = (H5DT_INT8 *) in->data; for (i = 0; i < len; i++, in08++) - { + { if (fscanf(*strm, "%hd", &temp) != 1) { (void) fprintf(stderr, err1); return (-1); } (*in08) = (H5DT_INT8)temp; - } + } break; case 4: /* IN */ - in08 = (H5DT_INT8 *) in->data; + in08 = (H5DT_INT8 *) in->data; for (i = 0; i < len; i++, in08++) { if (fread((char *) in08, sizeof(H5DT_INT8), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); } break; - + case 16: - in16 = (H5DT_INT16 *) in->data; + in16 = (H5DT_INT16 *) in->data; switch(in->inputClass) { case 0: /* TEXTIN */ @@ -407,21 +407,21 @@ readIntegerData(FILE **strm, struct Input *in) for (i = 0; i < len; i++, in16++) { if (fread((char *) in16, sizeof(H5DT_INT16), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); } break; - + case 32: - in32 = (H5DT_INT32 *) in->data; + in32 = (H5DT_INT32 *) in->data; switch(in->inputClass) { case 0: /* TEXTIN */ @@ -439,13 +439,13 @@ readIntegerData(FILE **strm, struct Input *in) for (i = 0; i < len; i++, in32++) { if (fread((char *) in32, sizeof(H5DT_INT32), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); @@ -454,7 +454,7 @@ readIntegerData(FILE **strm, struct Input *in) #ifndef WIN32 case 64: - in64 = (H5DT_INT64 *) in->data; + in64 = (H5DT_INT64 *) in->data; switch(in->inputClass) { case 0: /* TEXTIN */ @@ -464,7 +464,7 @@ readIntegerData(FILE **strm, struct Input *in) { (void) fprintf(stderr, err1); return (-1); - } + } *in64 = (H5DT_INT64) HDstrtoll(buffer, NULL, 10); } break; @@ -473,20 +473,20 @@ readIntegerData(FILE **strm, struct Input *in) for (i = 0; i < len; i++, in64++) { if (fread((char *) in64, sizeof(H5DT_INT64), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); } break; -#endif /* ifndef WIN32 */ - +#endif /* ifndef WIN32 */ + default: (void) fprintf(stderr, err3); break; @@ -494,13 +494,13 @@ readIntegerData(FILE **strm, struct Input *in) return(0); } -static int +static int readUIntegerData(FILE **strm, struct Input *in) { H5DT_UINT8 *in08; H5DT_UINT16 *in16, temp; H5DT_UINT32 *in32; -#ifndef WIN32 +#ifndef WIN32 H5DT_UINT64 *in64; char buffer[256]; #endif @@ -520,38 +520,38 @@ readUIntegerData(FILE **strm, struct Input *in) switch(in->inputClass) { case 6: /* TEXTUIN */ - in08 = (H5DT_UINT8 *) in->data; + in08 = (H5DT_UINT8 *) in->data; for (i = 0; i < len; i++, in08++) - { + { if (fscanf(*strm, "%hu", &temp) != 1) { (void) fprintf(stderr, err1); return (-1); } (*in08) = (H5DT_UINT8)temp; - } + } break; case 7: /* UIN */ - in08 = (H5DT_UINT8 *) in->data; + in08 = (H5DT_UINT8 *) in->data; for (i = 0; i < len; i++, in08++) { if (fread((char *) in08, sizeof(H5DT_UINT8), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); } break; - + case 16: - in16 = (H5DT_UINT16 *) in->data; + in16 = (H5DT_UINT16 *) in->data; switch(in->inputClass) { case 6: /* TEXTUIN */ @@ -569,21 +569,21 @@ readUIntegerData(FILE **strm, struct Input *in) for (i = 0; i < len; i++, in16++) { if (fread((char *) in16, sizeof(H5DT_UINT16), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); } break; - + case 32: - in32 = (H5DT_UINT32 *) in->data; + in32 = (H5DT_UINT32 *) in->data; switch(in->inputClass) { case 6: /* TEXTUIN */ @@ -601,13 +601,13 @@ readUIntegerData(FILE **strm, struct Input *in) for (i = 0; i < len; i++, in32++) { if (fread((char *) in32, sizeof(H5DT_UINT32), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); @@ -616,7 +616,7 @@ readUIntegerData(FILE **strm, struct Input *in) #ifndef WIN32 case 64: - in64 = (H5DT_UINT64 *) in->data; + in64 = (H5DT_UINT64 *) in->data; switch(in->inputClass) { case 6: /* TEXTUIN */ @@ -626,7 +626,7 @@ readUIntegerData(FILE **strm, struct Input *in) { (void) fprintf(stderr, err1); return (-1); - } + } *in64 = (H5DT_UINT64) HDstrtoll(buffer, NULL, 10); } break; @@ -635,20 +635,20 @@ readUIntegerData(FILE **strm, struct Input *in) for (i = 0; i < len; i++, in64++) { if (fread((char *) in64, sizeof(H5DT_UINT64), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); } break; #endif /* ifndef WIN32 */ - + default: (void) fprintf(stderr, err3); break; @@ -656,7 +656,7 @@ readUIntegerData(FILE **strm, struct Input *in) return(0); } -static int +static int readFloatData(FILE **strm, struct Input *in) { H5DT_FLOAT32 *fp32; @@ -675,7 +675,7 @@ readFloatData(FILE **strm, struct Input *in) switch(in->inputSize) { case 32: - fp32 = (H5DT_FLOAT32 *) in->data; + fp32 = (H5DT_FLOAT32 *) in->data; switch(in->inputClass) { case 1: /* TEXTFP */ @@ -698,13 +698,13 @@ readFloatData(FILE **strm, struct Input *in) for (i = 0; i < len; i++, fp32++) { if (fread((char *) fp32, sizeof(H5DT_FLOAT32), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); @@ -712,7 +712,7 @@ readFloatData(FILE **strm, struct Input *in) break; case 64: - fp64 = (H5DT_FLOAT64 *) in->data; + fp64 = (H5DT_FLOAT64 *) in->data; switch(in->inputClass) { case 1: /* TEXTFP */ @@ -735,13 +735,13 @@ readFloatData(FILE **strm, struct Input *in) for (i = 0; i < len; i++, fp64++) { if (fread((char *) fp64, sizeof(H5DT_FLOAT64), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); @@ -755,7 +755,7 @@ readFloatData(FILE **strm, struct Input *in) return(0); } -static int +static int allocateIntegerStorage(struct Input *in) { hsize_t len=1; @@ -775,7 +775,7 @@ allocateIntegerStorage(struct Input *in) return (-1); } break; - + case 16: if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT16))) == NULL) { @@ -783,13 +783,13 @@ allocateIntegerStorage(struct Input *in) return (-1); } break; - + case 32: if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT32))) == NULL) { (void) fprintf(stderr, err1); return (-1); - } + } break; case 64: @@ -797,9 +797,9 @@ allocateIntegerStorage(struct Input *in) { (void) fprintf(stderr, err1); return (-1); - } + } break; - + default: (void) fprintf(stderr, err2); break; @@ -826,7 +826,7 @@ static int allocateUIntegerStorage(struct Input *in) return (-1); } break; - + case 16: if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT16))) == NULL) { @@ -834,13 +834,13 @@ static int allocateUIntegerStorage(struct Input *in) return (-1); } break; - + case 32: if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT32))) == NULL) { (void) fprintf(stderr, err1); return (-1); - } + } break; case 64: @@ -848,24 +848,24 @@ static int allocateUIntegerStorage(struct Input *in) { (void) fprintf(stderr, err1); return (-1); - } + } break; - + default: (void) fprintf(stderr, err2); break; } - return(0); + return(0); } -static int +static int allocateFloatStorage(struct Input *in) { hsize_t len = 1; int j; const char *err1 = "Unable to allocate dynamic memory.\n"; const char *err2 = "Invalid storage size for float input data.\n"; - + for (j=0; j<in->rank;j++) len *= in->sizeOfDimension[j]; @@ -876,7 +876,7 @@ allocateFloatStorage(struct Input *in) { (void) fprintf(stderr, err1); return (-1); - } + } break; case 64: @@ -884,9 +884,9 @@ allocateFloatStorage(struct Input *in) { (void) fprintf(stderr, err1); return (-1); - } + } break; - + default: (void) fprintf(stderr, err2); break; @@ -894,52 +894,52 @@ allocateFloatStorage(struct Input *in) return(0); } -static int +static int processConfigurationFile(char *infile, struct Input *in, FILE **strm) { char key[255]; int kindex; char temp[255]; int ival; - + const char *err1 = "Unable to open the configuration file: %s for reading.\n"; const char *err2 = "Unknown keyword in configuration file: %s\n"; const char *err3a = "PATH keyword appears twice in %s.\n"; const char *err3b = "Error in parsing the path information from %s.\n"; - const char *err4a = "INPUT-CLASS keyword appears twice in %s.\n"; + const char *err4a = "INPUT-CLASS keyword appears twice in %s.\n"; const char *err4b = "Error in retrieving the input class from %s.\n"; - const char *err5a = "INPUT-SIZE keyword appears twice in %s.\n"; + const char *err5a = "INPUT-SIZE keyword appears twice in %s.\n"; const char *err5b = "Error in retrieving the input size from %s.\n"; - const char *err6a = "RANK keyword appears twice in %s.\n"; + const char *err6a = "RANK keyword appears twice in %s.\n"; const char *err6b = "Error in retrieving the rank from %s.\n"; - const char *err7a = "DIMENSION-SIZES keyword appears twice in %s.\n"; - const char *err7b = "DIMENSION-SIZES cannot appear before RANK is provided.\n"; - const char *err7c = "Error in retrieving the dimension sizes from %s.\n"; - const char *err8a = "OUTPUT-CLASS keyword appears twice in %s.\n"; + const char *err7a = "DIMENSION-SIZES keyword appears twice in %s.\n"; + const char *err7b = "DIMENSION-SIZES cannot appear before RANK is provided.\n"; + const char *err7c = "Error in retrieving the dimension sizes from %s.\n"; + const char *err8a = "OUTPUT-CLASS keyword appears twice in %s.\n"; const char *err8b = "Error in retrieving the output class from %s.\n"; - const char *err9a = "OUTPUT-SIZE keyword appears twice in %s.\n"; + const char *err9a = "OUTPUT-SIZE keyword appears twice in %s.\n"; const char *err9b = "Error in retrieving the output size from %s.\n"; - const char *err10a = "OUTPUT-ARCHITECTURE keyword appears twice in %s.\n"; + const char *err10a = "OUTPUT-ARCHITECTURE keyword appears twice in %s.\n"; const char *err10b = "Error in retrieving the output architecture from %s.\n"; - const char *err11a = "OUTPUT-BYTE-ORDER keyword appears twice in %s.\n"; + const char *err11a = "OUTPUT-BYTE-ORDER keyword appears twice in %s.\n"; const char *err11b = "Error in retrieving the output byte order from %s.\n"; - const char *err12a = "CHUNKED-DIMENSION-SIZES keyword appears twice in %s.\n"; - const char *err12b = "CHUNKED-DIMENSION-SIZES cannot appear before DIMENSION-SIZES are provided.\n"; - const char *err12c = "Error in retrieving the chunked dimension sizes from %s.\n"; - const char *err13a = "COMPRESSION-TYPE keyword appears twice in %s.\n"; + const char *err12a = "CHUNKED-DIMENSION-SIZES keyword appears twice in %s.\n"; + const char *err12b = "CHUNKED-DIMENSION-SIZES cannot appear before DIMENSION-SIZES are provided.\n"; + const char *err12c = "Error in retrieving the chunked dimension sizes from %s.\n"; + const char *err13a = "COMPRESSION-TYPE keyword appears twice in %s.\n"; const char *err13b = "Error in retrieving the compression type from %s.\n"; - const char *err14a = "COMPRESSION-PARAM keyword appears twice in %s.\n"; + const char *err14a = "COMPRESSION-PARAM keyword appears twice in %s.\n"; const char *err14b = "Error in retrieving the compression parameter from %s.\n"; - const char *err15a = "EXTERNAL-STORAGE keyword appears twice in %s.\n"; + const char *err15a = "EXTERNAL-STORAGE keyword appears twice in %s.\n"; const char *err15b = "Error in retrieving the external storage paramters from %s.\n"; const char *err16a = "MAXIMUM-DIMENSIONS keyword appears twice in %s.\n"; - const char *err16b = "MAXIMUM-DIMENSIONS cannot appear before DIMENSION-SIZES are provided.\n"; + const char *err16b = "MAXIMUM-DIMENSIONS cannot appear before DIMENSION-SIZES are provided.\n"; const char *err16c = "Error in retrieving the maximum dimension sizes from %s.\n"; const char *err17 = "Configuration parameters are invalid in %s.\n"; const char *err18 = "Unable to get string value.\n"; const char *err19 = "Unable to get integer value.\n"; - /* create vector to map which keywords have been found + /* create vector to map which keywords have been found check vector after each keyword to check for violation at the end check vector to see if required fields have been provided process the output file according to the options @@ -950,7 +950,7 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) (void) fprintf(stderr, err1, infile); return (-1); } - + while (fscanf(*strm, "%s", key) == 1) { if ((kindex = mapKeywordToIndex(key)) == -1) @@ -964,17 +964,17 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[PATH] == 1) { (void) fprintf(stderr, err3a, infile); - return (-1); + return (-1); } if (fscanf(*strm, "%s", temp) != 1) { (void) fprintf(stderr, err18); - return (-1); - } + return (-1); + } if (parsePathInfo(&in->path, temp) == -1) { (void) fprintf(stderr, err3b, infile); - return (-1); + return (-1); } in->configOptionVector[PATH] = 1; break; @@ -983,7 +983,7 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[INPUT_CLASS] == 1) { (void) fprintf(stderr, err4a, infile); - return (-1); + return (-1); } if (fscanf(*strm, "%s", temp) != 1) @@ -994,7 +994,7 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (getInputClass(in, temp) == -1) { (void) fprintf(stderr, err4b, infile); - return (-1); + return (-1); } in->configOptionVector[INPUT_CLASS] = 1; @@ -1015,7 +1015,7 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[INPUT_SIZE] == 1) { (void) fprintf(stderr, err5a, infile); - return (-1); + return (-1); } if (fscanf(*strm, "%d", (&ival)) != 1) { @@ -1025,11 +1025,11 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (getInputSize(in, ival) == -1) { (void) fprintf(stderr, err5b, infile); - return (-1); + return (-1); } in->configOptionVector[INPUT_SIZE] = 1; - - /*set default value for output-size */ + + /*set default value for output-size */ if (in->configOptionVector[OUTPUT_SIZE] == 0) in->outputSize = in->inputSize; break; @@ -1038,13 +1038,13 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[RANK] == 1) { (void) fprintf(stderr, err6a, infile); - return (-1); + return (-1); } if (getRank(in, strm) == -1) { (void) fprintf(stderr, err6b, infile); - return (-1); + return (-1); } in->configOptionVector[RANK] = 1; break; @@ -1053,18 +1053,18 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[DIM] == 1) { (void) fprintf(stderr, err7a, infile); - return (-1); + return (-1); } if (in->configOptionVector[RANK] == 0) { (void) fprintf(stderr, err7b, infile); - return (-1); - } + return (-1); + } if (getDimensionSizes(in, strm) == -1) { (void) fprintf(stderr, err7c, infile); - return (-1); + return (-1); } in->configOptionVector[DIM] = 1; break; @@ -1073,13 +1073,13 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[OUTPUT_CLASS] == 1) { (void) fprintf(stderr, err8a, infile); - return (-1); + return (-1); } if (getOutputClass(in, strm) == -1) { (void) fprintf(stderr, err8b, infile); - return (-1); + return (-1); } in->configOptionVector[OUTPUT_CLASS] = 1; break; @@ -1088,14 +1088,14 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[OUTPUT_SIZE] == 1) { (void) fprintf(stderr, err9a, infile); - return (-1); + return (-1); } if (getOutputSize(in, strm) == -1) { (void) fprintf(stderr, err9b, infile); - return (-1); - } + return (-1); + } in->configOptionVector[OUTPUT_SIZE] = 1; break; @@ -1103,14 +1103,14 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[OUTPUT_ARCH] == 1) { (void) fprintf(stderr, err10a, infile); - return (-1); + return (-1); } if (getOutputArchitecture(in, strm) == -1) { (void) fprintf(stderr, err10b, infile); - return (-1); - } + return (-1); + } in->configOptionVector[OUTPUT_ARCH] = 1; break; @@ -1118,14 +1118,14 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[OUTPUT_B_ORDER] == 1) { (void) fprintf(stderr, err11a, infile); - return (-1); + return (-1); } if (getOutputByteOrder(in, strm) == -1) { (void) fprintf(stderr, err11b, infile); - return (-1); - } + return (-1); + } in->configOptionVector[OUTPUT_B_ORDER] = 1; break; @@ -1133,37 +1133,37 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[CHUNK] == 1) { (void) fprintf(stderr, err12a, infile); - return (-1); + return (-1); } /* cant appear before dimension sizes have been provided */ if (in->configOptionVector[DIM] == 0) { (void) fprintf(stderr, err12b, infile); - return (-1); + return (-1); } if (getChunkedDimensionSizes(in, strm) == -1) { (void) fprintf(stderr, err12c, infile); - return (-1); - } - in->configOptionVector[CHUNK] = 1; + return (-1); + } + in->configOptionVector[CHUNK] = 1; break; case 10: /* COMPRESSION-TYPE */ if (in->configOptionVector[COMPRESS] == 1) { (void) fprintf(stderr, err13a, infile); - return (-1); + return (-1); } if (getCompressionType(in, strm) == -1) { (void) fprintf(stderr, err13b, infile); - return (-1); + return (-1); } in->configOptionVector[COMPRESS] = 1; - + if (in->configOptionVector[COMPRESS_PARAM] == 0) { if (in->compressionType == 0) @@ -1175,20 +1175,20 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[COMPRESS_PARAM] == 1) { (void) fprintf(stderr, err14a, infile); - return (-1); + return (-1); } if (getCompressionParameter(in, strm) == -1) { (void) fprintf(stderr, err14b, infile); - return (-1); + return (-1); } - + in->configOptionVector[COMPRESS_PARAM] = 1; if (in->configOptionVector[COMPRESS] == 0) - in->compressionType = 0; - + in->compressionType = 0; + in->configOptionVector[COMPRESS] = 1; break; @@ -1196,38 +1196,38 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[EXTERNAL] == 1) { (void) fprintf(stderr, err15a, infile); - return (-1); + return (-1); } if (getExternalFilename(in, strm) == -1) { (void) fprintf(stderr, err15b, infile); - return (-1); - } - in->configOptionVector[EXTERNAL] = 1; + return (-1); + } + in->configOptionVector[EXTERNAL] = 1; break; case 13: /* MAXIMUM-DIMENSIONS */ if (in->configOptionVector[EXTEND] == 1) { (void) fprintf(stderr, err16a, infile); - return (-1); + return (-1); } /* cant appear before dimension sizes have been provided */ if (in->configOptionVector[DIM] == 0) { (void) fprintf(stderr, err16b, infile); - return (-1); - } + return (-1); + } if (getMaximumDimensionSizes(in, strm) == -1) { (void) fprintf(stderr, err16c, infile); - return (-1); - } - in->configOptionVector[EXTEND] = 1; + return (-1); + } + in->configOptionVector[EXTEND] = 1; break; - - default: + + default: break; } } @@ -1235,20 +1235,20 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) check if keywords obtained are valid if yes, return 0 else error */ - + if (validateConfigurationParameters(in) == -1) { (void) fprintf(stderr, err17, infile); - return (-1); - } + return (-1); + } - return (0); + return (0); } -static int +static int validateConfigurationParameters(struct Input * in) { - const char *err1 = "One or more of the required fields (RANK, DIMENSION-SIZES) missing.\n"; + const char *err1 = "One or more of the required fields (RANK, DIMENSION-SIZES) missing.\n"; const char *err2 = "Cannot specify chunking or compression or extendible data sets with the external file option.\n"; const char *err3 = "Cannot specify the compression or the extendible data sets without the chunking option.\n"; const char *err4a = "OUTPUT-ARCHITECTURE cannot be STD if OUTPUT-CLASS is floating point (FP).\n"; @@ -1259,25 +1259,25 @@ validateConfigurationParameters(struct Input * in) #endif if ( - (in->configOptionVector[DIM] != 1) || + (in->configOptionVector[DIM] != 1) || (in->configOptionVector[RANK] != 1)) { (void) fprintf(stderr, err1); - return (-1); + return (-1); } if (in->configOptionVector[EXTERNAL] == 1) { - if ((in->configOptionVector[COMPRESS] == 1) || - (in->configOptionVector[CHUNK] == 1) || + if ((in->configOptionVector[COMPRESS] == 1) || + (in->configOptionVector[CHUNK] == 1) || (in->configOptionVector[EXTEND] == 1)) { (void) fprintf(stderr, err2); - return (-1); + return (-1); } } - if ((in->configOptionVector[COMPRESS] == 1) || + if ((in->configOptionVector[COMPRESS] == 1) || (in->configOptionVector[EXTEND] == 1)) { if (in->configOptionVector[CHUNK] != 1) @@ -1286,7 +1286,7 @@ validateConfigurationParameters(struct Input * in) return (-1); } } - + /* Arch cant be STD if O/p class is FP */ if (in->outputArchitecture == 1) if (in->outputClass == 1) @@ -1302,7 +1302,7 @@ validateConfigurationParameters(struct Input * in) (void) fprintf(stderr, err4b); return (-1); } - + if (in->outputClass == 1) if(in->outputSize != 32 && in->outputSize != 64 ) @@ -1318,10 +1318,10 @@ validateConfigurationParameters(struct Input * in) return -1; } #endif - return (0); + return (0); } -static int +static int mapKeywordToIndex(char *key) { int i; @@ -1331,7 +1331,7 @@ mapKeywordToIndex(char *key) return -1; } -static int +static int parsePathInfo(struct path_info *path, char *temp) { const char delimiter[] = "/"; @@ -1351,7 +1351,7 @@ parsePathInfo(struct path_info *path, char *temp) return (0); } -static int +static int parseDimensions(struct Input *in, char *strm) { const char delimiter[] = ","; @@ -1371,7 +1371,7 @@ parseDimensions(struct Input *in, char *strm) i++; } in->rank = i+1; - if ((in->sizeOfDimension = + if ((in->sizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { (void) fprintf(stderr, err1); @@ -1392,37 +1392,37 @@ parseDimensions(struct Input *in, char *strm) return (0); } -static int +static int getOutputClass(struct Input *in, FILE** strm) { char temp[255]; int kindex; const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output class.\n"; - + if (fscanf(*strm, "%s", temp) != 1) { (void) fprintf(stderr, err1); - return (-1); + return (-1); } if ((kindex = OutputClassStrToInt(temp)) == -1) { (void) fprintf(stderr, err2); - return (-1); + return (-1); } - + in->outputClass = kindex; return (0); } -static int +static int OutputClassStrToInt(char *temp) { int i; char classKeywordTable[3][15] = { "IN", - "FP", + "FP", "UIN" }; for (i=0; i<3; i++) @@ -1431,7 +1431,7 @@ OutputClassStrToInt(char *temp) return -1; } /* same as getInputSize. But defined separately for extensibility */ -static int +static int getOutputSize(struct Input *in, FILE** strm) { int ival; @@ -1439,7 +1439,7 @@ getOutputSize(struct Input *in, FILE** strm) int outputSizeValidValues[4] = {8,16,32,64}; const char *err1 = "Unable to get integer value.\n"; const char *err2 = "Invalid value for output size.\n"; - + if (fscanf(*strm, "%d", (&ival)) != 1) { (void) fprintf(stderr, err1); @@ -1447,37 +1447,37 @@ getOutputSize(struct Input *in, FILE** strm) } for (i=0; i<4; i++) - if (outputSizeValidValues[i] == ival) + if (outputSizeValidValues[i] == ival) { in->outputSize = ival; - return (0); - } - (void) fprintf(stderr, err2); - return(-1); + return (0); + } + (void) fprintf(stderr, err2); + return(-1); } -static int +static int getInputClass(struct Input *in, char * temp) { int kindex; const char *err1 = "Invalid value for input class.\n"; - + if ((kindex = InputClassStrToInt(temp)) == -1) { (void) fprintf(stderr, err1); - return (-1); + return (-1); } - + in->inputClass = kindex; return (0); } -static int +static int InputClassStrToInt(char *temp) { int i; char classKeywordTable[8][15] = { - "TEXTIN", + "TEXTIN", "TEXTFP", "TEXTFPE", "FP", @@ -1492,7 +1492,7 @@ InputClassStrToInt(char *temp) } /* same as getOutputSize. But defined separately for extensibility */ -static int +static int getInputSize(struct Input *in, int ival) { int i; @@ -1500,40 +1500,40 @@ getInputSize(struct Input *in, int ival) const char *err1 = "Invalid value for input size.\n"; for (i=0; i<4; i++) - if (inputSizeValidValues[i] == ival) + if (inputSizeValidValues[i] == ival) { in->inputSize = ival; - return (0); - } - (void) fprintf(stderr, err1); - return(-1); + return (0); + } + (void) fprintf(stderr, err1); + return(-1); } -static int +static int getRank(struct Input *in, FILE** strm) { int ival; const char *err1 = "Unable to get integer value.\n"; const char *err2 = "Invalid value for rank.\n"; - + if (fscanf(*strm, "%d", (&ival)) != 1) { (void) fprintf(stderr, err1); return (-1); } - if (ival >=MIN_NUM_DIMENSION && ival <=MAX_NUM_DIMENSION ) + if (ival >=MIN_NUM_DIMENSION && ival <=MAX_NUM_DIMENSION ) { in->rank = ival; return (0); } - (void) fprintf(stderr, err2); - return(-1); + (void) fprintf(stderr, err2); + return(-1); } /* same as getChunkedDimensionSizes. But defined separately for extensibility */ -static int +static int getDimensionSizes(struct Input *in, FILE **strm) { int ival; @@ -1542,16 +1542,16 @@ getDimensionSizes(struct Input *in, FILE **strm) const char *err1 = "Unable to allocate dynamic memory.\n"; const char *err2 = "No. of dimensions for which dimension sizes provided is not equal to provided rank.\n"; - if ((in->sizeOfDimension = + if ((in->sizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { (void) fprintf(stderr, err1); return (-1); } - + while (fscanf(*strm, "%d", (&ival)) == 1) in->sizeOfDimension[i++] = ival; - + if (in->rank != i) { (void) fprintf(stderr, err2); @@ -1560,7 +1560,7 @@ getDimensionSizes(struct Input *in, FILE **strm) return (0); } /* same as getDimensionSizes. But defined separately for extensibility */ -static int +static int getChunkedDimensionSizes(struct Input *in, FILE **strm) { int ival; @@ -1570,16 +1570,16 @@ getChunkedDimensionSizes(struct Input *in, FILE **strm) const char *err2 = "No. of dimensions for which chunked dimension sizes provided is not equal to provided rank.\n"; const char *err3 = "The CHUNKED-DIMENSION-SIZES cannot exceed the sizes of DIMENSION-SIZES\n"; - if ((in->sizeOfChunk = + if ((in->sizeOfChunk = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { (void) fprintf(stderr, err1); return (-1); } - + while (fscanf(*strm, "%d", (&ival)) == 1) in->sizeOfChunk[i++] = ival; - + if (in->rank != i) { (void) fprintf(stderr, err2); @@ -1595,7 +1595,7 @@ getChunkedDimensionSizes(struct Input *in, FILE **strm) return (0); } -static int +static int getMaximumDimensionSizes(struct Input *in, FILE **strm) { int ival; @@ -1605,13 +1605,13 @@ getMaximumDimensionSizes(struct Input *in, FILE **strm) const char *err2 = "No. of dimensions for which maximum dimension sizes provided is not equal to provided rank.\n"; const char *err3 = "The MAXIMUM-DIMENSIONS cannot be less than the sizes of DIMENSION-SIZES. Exception: can be -1 to indicate unlimited size\n"; - if ((in->maxsizeOfDimension = + if ((in->maxsizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { (void) fprintf(stderr, err1); return (-1); } - + while (fscanf(*strm, "%d", (&ival)) == 1) { if (ival == -1) @@ -1619,7 +1619,7 @@ getMaximumDimensionSizes(struct Input *in, FILE **strm) else in->maxsizeOfDimension[i++] = ival; } - + if (in->rank != i) { (void) fprintf(stderr, err2); @@ -1638,31 +1638,31 @@ getMaximumDimensionSizes(struct Input *in, FILE **strm) return (0); } -static int +static int getOutputArchitecture(struct Input *in, FILE** strm) { char temp[255]; int kindex; const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output architecture.\n"; - + if (fscanf(*strm, "%s", temp) != 1) { (void) fprintf(stderr, err1); - return (-1); + return (-1); } if ((kindex = OutputArchStrToInt(temp)) == -1) { (void) fprintf(stderr, err2); - return (-1); + return (-1); } - + in->outputArchitecture = kindex; return (0); } -static int +static int OutputArchStrToInt(char *temp) { int i; @@ -1681,31 +1681,31 @@ OutputArchStrToInt(char *temp) return -1; } -static int +static int getOutputByteOrder(struct Input *in, FILE** strm) { char temp[255]; int kindex; const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output byte-order.\n"; - + if (fscanf(*strm, "%s", temp) != 1) { (void) fprintf(stderr, err1); - return (-1); + return (-1); } if ((kindex = OutputByteOrderStrToInt(temp)) == -1) { (void) fprintf(stderr, err2); - return (-1); + return (-1); } - + in->outputByteOrder = kindex; return (0); } -static int +static int OutputByteOrderStrToInt(char *temp) { int i; @@ -1718,32 +1718,32 @@ OutputByteOrderStrToInt(char *temp) return -1; } -static int +static int getCompressionType(struct Input *in, FILE** strm) { char temp[255]; int kindex; const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for compression.\n"; - + if (fscanf(*strm, "%s", temp) != 1) { (void) fprintf(stderr, err1); - return (-1); + return (-1); } if ((kindex = CompressionTypeStrToInt(temp)) == -1) { (void) fprintf(stderr, err2); - return (-1); + return (-1); } - + in->outputByteOrder = kindex; return (0); } -static int +static int CompressionTypeStrToInt(char *temp) { /* currently supports only GZIP */ @@ -1758,17 +1758,17 @@ CompressionTypeStrToInt(char *temp) return -1; } -static int +static int getCompressionParameter(struct Input *in, FILE** strm) { /* currently supports only GZIP */ - /* can be extended by adding more values to COMPRESSION-TYPE and + /* can be extended by adding more values to COMPRESSION-TYPE and handling the paramters here by adding more cases */ int ival; const char *err1 = "Unable to get integer value.\n"; const char *err2 = "Invalid value for compression paramter.\n"; - const char *err3 = "Unsupported Compression Type.\n"; + const char *err3 = "Unsupported Compression Type.\n"; switch (in->compressionType) { @@ -1782,7 +1782,7 @@ getCompressionParameter(struct Input *in, FILE** strm) if (ival <0 || ival > 9) { (void) fprintf(stderr, err2); - return (-1); + return (-1); } in->compressionParam = ival; return (0); @@ -1793,34 +1793,34 @@ getCompressionParameter(struct Input *in, FILE** strm) } } -static int +static int getExternalFilename(struct Input *in, FILE** strm) { char temp[255]; const char *err1 = "Unable to get 'string' value.\n"; - + if (fscanf(*strm, "%s", temp) != 1) { (void) fprintf(stderr, err1); - return (-1); + return (-1); } - + in->externFilename = (char *) HDmalloc ((size_t) (HDstrlen(temp)) * sizeof(char)); (void) HDstrcpy(in->externFilename, temp); return (0); } -void +void setDefaultValues(struct Input *in, int count) { int i; char temp[255]; - char num[255]; + char num[255]; in->inputClass = 3; /* FP */ in->inputSize = 32; in->outputClass = 1; /* FP */ - in->outputSize = 32; + in->outputSize = 32; in->rank = 0; in->path.count = 1; @@ -1836,15 +1836,15 @@ setDefaultValues(struct Input *in, int count) in->configOptionVector[i] = 0; } -hid_t +hid_t createOutputDataType(struct Input *in) { hid_t new_type = (-1); const char *err1 = "Invalid value for output class.\n"; - + switch (in->outputClass) { - case 0: + case 0: switch (in->outputArchitecture) { case 0: /* NATIVE */ @@ -1855,11 +1855,11 @@ createOutputDataType(struct Input *in) break; case 16: - new_type = H5Tcopy (H5T_NATIVE_SHORT); + new_type = H5Tcopy (H5T_NATIVE_SHORT); break; case 32: - new_type = H5Tcopy (H5T_NATIVE_INT); + new_type = H5Tcopy (H5T_NATIVE_INT); break; case 64: @@ -1877,9 +1877,9 @@ createOutputDataType(struct Input *in) case 1: H5Tset_order (new_type,H5T_ORDER_LE); break; - } + } break; - + case 1: /* STD */ switch(in->outputSize) { @@ -1894,7 +1894,7 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_STD_I8LE); break; - } + } break; case 16: @@ -1908,7 +1908,7 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_STD_I16LE); break; - } + } break; case 32: @@ -1922,7 +1922,7 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_STD_I32LE); break; - } + } break; case 64: @@ -1936,11 +1936,11 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_STD_I64LE); break; - } - break; + } + break; } break; - + } break; @@ -1951,7 +1951,7 @@ createOutputDataType(struct Input *in) switch(in->outputSize) { case 32: - new_type = H5Tcopy (H5T_NATIVE_FLOAT); + new_type = H5Tcopy (H5T_NATIVE_FLOAT); break; case 64: @@ -1969,9 +1969,9 @@ createOutputDataType(struct Input *in) case 1: H5Tset_order (new_type,H5T_ORDER_LE); break; - } + } break; - + case 1: /* STD not supported for float */ break; @@ -1990,7 +1990,7 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_IEEE_F32LE); break; - } + } break; case 64: @@ -2004,11 +2004,11 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_IEEE_F64LE); break; - } - break; + } + break; } break; - + } break; @@ -2023,11 +2023,11 @@ createOutputDataType(struct Input *in) break; case 16: - new_type = H5Tcopy (H5T_NATIVE_USHORT); + new_type = H5Tcopy (H5T_NATIVE_USHORT); break; case 32: - new_type = H5Tcopy (H5T_NATIVE_UINT); + new_type = H5Tcopy (H5T_NATIVE_UINT); break; case 64: @@ -2045,9 +2045,9 @@ createOutputDataType(struct Input *in) case 1: H5Tset_order (new_type,H5T_ORDER_LE); break; - } + } break; - + case 1: switch(in->outputSize) { @@ -2062,7 +2062,7 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_STD_U8LE); break; - } + } break; case 16: @@ -2076,7 +2076,7 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_STD_U16LE); break; - } + } break; case 32: @@ -2090,7 +2090,7 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_STD_U32LE); break; - } + } break; case 64: @@ -2104,15 +2104,15 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_STD_U64LE); break; - } - break; + } + break; } break; - + case 2: /* IEEE not supported for INT */ break; - + } break; @@ -2124,7 +2124,7 @@ createOutputDataType(struct Input *in) return new_type; } -hid_t +hid_t createInputDataType(struct Input *in) { hid_t new_type = (-1); @@ -2141,11 +2141,11 @@ createInputDataType(struct Input *in) break; case 16: - new_type = H5Tcopy (H5T_NATIVE_SHORT); + new_type = H5Tcopy (H5T_NATIVE_SHORT); break; case 32: - new_type = H5Tcopy (H5T_NATIVE_INT); + new_type = H5Tcopy (H5T_NATIVE_INT); break; case 64: @@ -2164,8 +2164,8 @@ createInputDataType(struct Input *in) break; case 64: - new_type = H5Tcopy (H5T_NATIVE_DOUBLE); - break; + new_type = H5Tcopy (H5T_NATIVE_DOUBLE); + break; } break; @@ -2181,11 +2181,11 @@ createInputDataType(struct Input *in) break; case 16: - new_type = H5Tcopy (H5T_NATIVE_USHORT); + new_type = H5Tcopy (H5T_NATIVE_USHORT); break; case 32: - new_type = H5Tcopy (H5T_NATIVE_UINT); + new_type = H5Tcopy (H5T_NATIVE_UINT); break; case 64: @@ -2198,43 +2198,43 @@ createInputDataType(struct Input *in) (void) fprintf(stderr, err1); return (-1); } - return new_type; + return new_type; } -static int +static int process(struct Options *opt) { struct Input *in; - hid_t file_id, group_id, handle; - hid_t dataset, dataspace = (-1); + hid_t file_id, group_id, handle; + hid_t dataset, dataspace = (-1); FILE *strm, *extfile; hid_t intype, outtype; - hid_t proplist; - hsize_t numOfElements = 1; + hid_t proplist; + hsize_t numOfElements = 1; int j,k; const char *err1 = "Error creating HDF output file: %s.\n"; const char *err2 = "Error in processing the configuration file: %s.\n"; const char *err3 = "Error in reading the input file: %s.\n"; - const char *err4 = "Error in creating or opening external file.\n"; + const char *err4 = "Error in creating or opening external file.\n"; const char *err5 = "Error in creating the output data set. Dataset with the same name may exist at the specified path\n"; const char *err6 = "Error in writing the output data set.\n"; H5E_BEGIN_TRY { if ((file_id = H5Fopen(opt->outfile, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { - if ((file_id = H5Fcreate(opt->outfile, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) == FAIL) + if ((file_id = H5Fcreate(opt->outfile, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) == FAIL) { (void) fprintf(stderr, err1, opt->outfile); return (-1); } } } H5E_END_TRY; - + for (k = 0; k < opt->fcount; k++) { in = &(opt->infiles[k].in); if (opt->infiles[k].config == 1) - { + { if (processConfigurationFile(opt->infiles[k].configfile, in, &strm) == -1) { (void) fprintf(stderr, err2, opt->infiles[k].configfile); @@ -2246,14 +2246,14 @@ process(struct Options *opt) { (void) fprintf(stderr, err3, opt->infiles[k].datafile); return (-1); - } - + } + for (j=0; j<in->rank;j++) numOfElements *= in->sizeOfDimension[j]; /* disable error reporting */ H5E_BEGIN_TRY { - + /* create parent groups */ if (in->path.count > 1) { @@ -2265,15 +2265,15 @@ process(struct Options *opt) { group_id = H5Gcreate(handle, in->path.group[j++], 0); for (; j<in->path.count-1; j++) - group_id = H5Gcreate(group_id, in->path.group[j], 0); + group_id = H5Gcreate(group_id, in->path.group[j], 0); handle = group_id; break; - } + } handle = group_id; j++; } } - else + else { handle = file_id; j=0; @@ -2281,25 +2281,25 @@ process(struct Options *opt) /*enable error reporting */ } H5E_END_TRY; - + /*create data type */ intype = createInputDataType(in); - outtype = createOutputDataType(in); - + outtype = createOutputDataType(in); + /* create property list */ - proplist = H5Pcreate (H5P_DATASET_CREATE); + proplist = H5Pcreate (H5P_DATASET_CREATE); if (in->configOptionVector[CHUNK] == 1) { - H5Pset_layout (proplist, H5D_CHUNKED); + H5Pset_layout (proplist, H5D_CHUNKED); /* not reqd chunking is implied if set_chunk is used */ H5Pset_chunk (proplist, in->rank, in->sizeOfChunk); } - + if (in->configOptionVector[COMPRESS] == 1) { H5Pset_deflate (proplist, (unsigned) in->compressionParam); } - + if (in->configOptionVector[EXTERNAL] == 1) { /* creating the external file if it doesnt exist */ @@ -2308,13 +2308,13 @@ process(struct Options *opt) (void) fprintf(stderr, err4); H5Pclose(proplist); H5Sclose(dataspace); - H5Fclose(file_id); - return (-1); + H5Fclose(file_id); + return (-1); } HDfclose(extfile); H5Pset_external (proplist, in->externFilename, (off_t)0, numOfElements * in->inputSize / 8); } - + /* create dataspace */ if (in->configOptionVector[EXTEND] == 1) { @@ -2324,38 +2324,38 @@ process(struct Options *opt) { dataspace = H5Screate_simple(in->rank, in->sizeOfDimension, NULL); } - + /* disable error reporting */ H5E_BEGIN_TRY { /* create data set */ - if ((dataset = H5Dcreate(handle, in->path.group[j], outtype, dataspace, proplist)) < 0) + if ((dataset = H5Dcreate(handle, in->path.group[j], outtype, dataspace, proplist)) < 0) { (void) fprintf(stderr, err5); H5Pclose(proplist); H5Sclose(dataspace); - H5Fclose(file_id); - return (-1); + H5Fclose(file_id); + return (-1); } - + /*enable error reporting */ } H5E_END_TRY; /* write dataset */ - if (H5Dwrite(dataset, intype, H5S_ALL, H5S_ALL, H5P_DEFAULT, (VOIDP)in->data) < 0) + if (H5Dwrite(dataset, intype, H5S_ALL, H5S_ALL, H5P_DEFAULT, (VOIDP)in->data) < 0) { (void) fprintf(stderr, err6); H5Dclose(dataset); H5Pclose(proplist); H5Sclose(dataspace); - H5Fclose(file_id); - return (-1); - } - + H5Fclose(file_id); + return (-1); + } + H5Dclose(dataset); - H5Pclose(proplist); - H5Sclose(dataspace); + H5Pclose(proplist); + H5Sclose(dataspace); } - H5Fclose(file_id); + H5Fclose(file_id); return (0); } diff --git a/tools/h5import/h5import.h b/tools/h5import/h5import.h index 353e548..cf318fc 100755 --- a/tools/h5import/h5import.h +++ b/tools/h5import/h5import.h @@ -13,9 +13,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * - * Data and structure definitions for h5import - * + * + * Data and structure definitions for h5import + * */ /* @@ -39,7 +39,7 @@ #define MAX_NUM_DIMENSION 32 #define BASE_10 10 -#define CHUNK 0 +#define CHUNK 0 #define COMPRESS 1 #define EXTEND 2 #define EXTERNAL 3 @@ -51,8 +51,8 @@ #define OUTPUT_CLASS 9 #define OUTPUT_SIZE 10 #define OUTPUT_ARCH 11 -#define OUTPUT_B_ORDER 12 -#define COMPRESS_PARAM 13 +#define OUTPUT_B_ORDER 12 +#define COMPRESS_PARAM 13 /* data types */ #define H5DT_INT8 signed char @@ -75,7 +75,7 @@ struct path_info struct Input { - struct path_info path; + struct path_info path; int inputClass; int inputSize; int rank; @@ -85,7 +85,7 @@ struct Input int outputArchitecture; int outputByteOrder; hsize_t* sizeOfChunk; - hsize_t* maxsizeOfDimension; + hsize_t* maxsizeOfDimension; int compressionType; int compressionParam; char *externFilename; @@ -105,7 +105,7 @@ struct Options { struct infilesformat infiles[30]; /* structure to hold the list of input file names. Limited to 30*/ char outfile[256]; /* output file name */ - int fcount; /* number of input files */ + int fcount; /* number of input files */ }; char keytable[NUM_KEYS][30] = { @@ -147,7 +147,7 @@ static int state_table[15][8] = /* state 5: outfile */ {ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR}, - + /* state 6: -h[elp] */ {ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR}, @@ -177,9 +177,9 @@ static int state_table[15][8] = }; -/* +/* * - * Function declarations for h5import + * Function declarations for h5import * */ void usage(char *); diff --git a/tools/h5import/h5importtest.c b/tools/h5import/h5importtest.c index 48670c5..e6c29e5 100755 --- a/tools/h5import/h5importtest.c +++ b/tools/h5import/h5importtest.c @@ -19,7 +19,7 @@ * * Description: * This program creates that can be - * used to test the h5import program. + * used to test the h5import program. * */ /* @@ -38,24 +38,24 @@ main(void) float rowo4 = (float)11.0e0, colo4 = (float)21.0e0, plno4 = (float)51.0e0; float rowi4 = (float)1.0e0, coli4 = (float)2.0e0, plni4 = (float)5.0e0; - int b32i3[5][3][4]; + int b32i3[5][3][4]; int row4i[3], col4i[4], pln4i[5]; int rowo4i = (int)11 , colo4i = (int)21 , plno4i = (int)51 ; int rowi4i = (int)1 , coli4i = (int)2 , plni4i = (int)5 ; #ifndef WIN32 - long_long b64i2[3][4], b64i3[5][3][4]; + long_long b64i2[3][4], b64i3[5][3][4]; long_long row4i64[3], col4i64[4], pln4i64[5]; long_long rowo4i64 = (long_long)11 , colo4i64 = (long_long)21 , plno4i64 = (long_long)51 ; long_long rowi4i64 = (long_long)1 , coli4i64 = (long_long)2 , plni4i64 = (long_long)5 ; #endif - short b16i3[5][3][4]; + short b16i3[5][3][4]; short row4i16[3], col4i16[4], pln4i16[5]; short rowo4i16 = (short)11 , colo4i16 = (short)21 , plno4i16 = (short)51 ; short rowi4i16 = (short)1 , coli4i16 = (short)2 , plni4i16 = (short)5 ; - char b8i3[5][3][4]; + char b8i3[5][3][4]; char row4i8[3], col4i8[4], pln4i8[5]; char rowo4i8 = (char)11 , colo4i8 = (char)21 , plno4i8 = (char)51 ; char rowi4i8 = (char)1 , coli4i8 = (char)2 , plni4i8 = (char)5 ; @@ -65,7 +65,7 @@ main(void) double rowo8 = 11.0e0, colo8 = 21.0e0, plno8 = 51.0e0; double rowi8 = 1.0e0, coli8 = 2.0e0, plni8 = 5.0e0; - + /* * initialize the row, column, and plane vectors * @@ -74,7 +74,7 @@ main(void) * plane values start at 51 and increment by 5 => 51, 56, 61, 66, 71 */ - + /* * build array elements - rank 2 * @@ -84,16 +84,16 @@ main(void) row4[0] = rowo4; col4[0] = colo4; pln4[0] = plno4; - + row8[0] = rowo8; col8[0] = colo8; pln8[0] = plno8; - + row4i[0] = rowo4i; col4i[0] = colo4i; pln4i[0] = plno4i; -#ifndef WIN32 +#ifndef WIN32 row4i64[0] = rowo4i64; col4i64[0] = colo4i64; pln4i64[0] = plno4i64; @@ -102,11 +102,11 @@ main(void) row4i16[0] = rowo4i16; col4i16[0] = colo4i16; pln4i16[0] = plno4i16; - + row4i8[0] = rowo4i8; col4i8[0] = colo4i8; pln4i8[0] = plno4i8; - + for (i = 1; i < nrow; i++) { row4[i] = row4[i - 1] + rowi4; @@ -116,18 +116,18 @@ main(void) row4i64[i] = row4i64[i - 1] + rowi4i64; #endif row4i16[i] = row4i16[i - 1] + rowi4i16; - row4i8[i] = row4i8[i - 1] + rowi4i8; + row4i8[i] = row4i8[i - 1] + rowi4i8; } - + for (j = 1; j < ncol; j++) { col4[j] = col4[j - 1] + coli4; col8[j] = col8[j - 1] + coli8; col4i[j] = col4i[j - 1] + coli4i; #ifndef WIN32 - col4i64[j] = col4i64[j - 1] + coli4i64; + col4i64[j] = col4i64[j - 1] + coli4i64; #endif - col4i16[j] = col4i16[j - 1] + coli4i16; + col4i16[j] = col4i16[j - 1] + coli4i16; col4i8[j] = col4i8[j - 1] + coli4i8; } for (k = 1; k < npln; k++) @@ -138,7 +138,7 @@ main(void) #ifndef WIN32 pln4i64[k] = pln4i64[k - 1] + plni4i64; #endif - pln4i16[k] = pln4i16[k - 1] + plni4i16; + pln4i16[k] = pln4i16[k - 1] + plni4i16; pln4i8[k] = pln4i8[k - 1] + plni4i8; } @@ -147,7 +147,7 @@ main(void) for (j = 0; j < ncol; j++) { #ifndef WIN32 - b64i2[i][j] = row4i64[i] + col4i64[j]; + b64i2[i][j] = row4i64[i] + col4i64[j]; #endif } } @@ -175,13 +175,13 @@ main(void) } } } - + /* * binary 32-bit file - rank 2 & 3 */ #ifndef UNICOS - + sp = fopen("txtin16", "w"); for (k = 0; k < npln; k++) @@ -204,7 +204,7 @@ main(void) (void) fclose(sp); sp = fopen("bin32", "w"); - for (k = 0; k < npln; k++) + for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) for (j = 0; j < ncol; j++) (void) fwrite((char *) &b32i3[k][i][j], sizeof(int), 1, sp); @@ -212,7 +212,7 @@ main(void) sp = fopen("buin32", "w"); - for (k = 0; k < npln; k++) + for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) for (j = 0; j < ncol; j++) (void) fwrite((char *) &b32i3[k][i][j], sizeof(unsigned int), 1, sp); @@ -234,7 +234,7 @@ main(void) (void) fwrite((char *) &b32r3[k][i][j], sizeof(float), 1, sp); (void) fclose(sp); - + sp = fopen("bin16", "w"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) @@ -261,7 +261,7 @@ main(void) sp); (void) fclose(sp); #endif - + sp = fopen("bin8", "w"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) @@ -269,13 +269,13 @@ main(void) (void) fwrite((char *) &b8i3[k][i][j], sizeof(char), 1, sp); (void) fclose(sp); - + #endif /* * binary 64-bit file - rank 2 & 3 */ - + sp = fopen("bfp64", "w"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) |