summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repack_parse.c
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2004-07-20 19:21:03 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2004-07-20 19:21:03 (GMT)
commit4cb6c01d7f59be968649e36a61346be044f76345 (patch)
treee0a0b81e542768b75d5bbb2de8afc1abfb8c4370 /tools/h5repack/h5repack_parse.c
parent00909f278d64017c21c8348537231daba97be9dd (diff)
downloadhdf5-4cb6c01d7f59be968649e36a61346be044f76345.zip
hdf5-4cb6c01d7f59be968649e36a61346be044f76345.tar.gz
hdf5-4cb6c01d7f59be968649e36a61346be044f76345.tar.bz2
[svn-r8904] Purpose:
h5diff and h5repack changes Description: h5diff introduced the following four modes of output: Normal mode: print the number of differences found and where they occured Report mode: print the above plus the differences Verbose mode: print the above plus a list of objects and warnings Quiet mode: do not print output (h5diff always returns an exit code of 1 when differences are found) h5repack added an extra parameter for SZIP filter (coding method) the new syntax is -f SZIP=<pixels per block,coding> (pixels per block is a even number in 2-32 and coding method is 'EC' or 'NN') Example of use: ./h5repack -i file1 -o file2 -f SZIP=8,NN -v updated usage messages, test scripts and files accordingly Solution: Platforms tested: linux AIX solaris Misc. update:
Diffstat (limited to 'tools/h5repack/h5repack_parse.c')
-rw-r--r--tools/h5repack/h5repack_parse.c87
1 files changed, 75 insertions, 12 deletions
diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c
index 96f7bce..e6974c0 100644
--- a/tools/h5repack/h5repack_parse.c
+++ b/tools/h5repack/h5repack_parse.c
@@ -56,10 +56,11 @@ obj_list_t* parse_filter(const char *str,
unsigned i, u;
char c;
size_t len=strlen(str);
- int j, m, n, k, end_obj=-1, no_param=0;
+ int j, m, n, k, l, end_obj=-1, no_param=0;
char sobj[MAX_NC_NAME];
char scomp[10];
char stype[5];
+ char smask[3];
obj_list_t* obj_list=NULL;
unsigned pixels_per_block;
@@ -132,17 +133,74 @@ obj_list_t* parse_filter(const char *str,
if ( c=='=') { /*one more parameter */
scomp[k]='\0'; /*cut space */
- /* here we could have 1, 2 or 3 digits */
- for ( m=0,u=i+1; u<len; u++,m++) {
- c = str[u];
- if (!isdigit(c)){
- if (obj_list) free(obj_list);
- printf("Input Error: Compression parameter not digit in <%s>\n",str);
- exit(1);
- }
- stype[m]=c;
- }
- stype[m]='\0';
+ /*SZIP is a special case , it can be
+ SZIP=8,EC
+ SZIP=8,NN
+ */
+
+ if (strcmp(scomp,"SZIP")==0)
+ {
+ l=-1; /* mask index check */
+ for ( m=0,u=i+1; u<len; u++,m++)
+ {
+ if (str[u]==',')
+ {
+ stype[m]='\0'; /* end digit of szip */
+ l=0; /* start EC or NN search */
+ u++; /* skip ',' */
+ }
+ c = str[u];
+ if (!isdigit(c) && l==-1){
+ if (obj_list) free(obj_list);
+ printf("Input Error: Compression parameter not digit in <%s>\n",str);
+ exit(1);
+ }
+ if (l==-1)
+ stype[m]=c;
+ else
+ {
+ smask[l]=c;
+ l++;
+ if (l==2)
+ {
+ smask[l]='\0';
+ i=len-1; /* end */
+ (*n_objs)--; /* we counted an extra ',' */
+ if (strcmp(smask,"NN")==0)
+ filt->szip_coding=0;
+ else if (strcmp(smask,"EC")==0)
+ filt->szip_coding=1;
+ else
+ {
+ printf("Input Error: szip mask must be 'NN' or 'EC' \n");
+ exit(1);
+ }
+
+ }
+ }
+
+ } /* u */
+ } /*if */
+
+ else
+ {
+ /* here we could have 1 or 2 digits */
+ for ( m=0,u=i+1; u<len; u++,m++)
+ {
+ c = str[u];
+ if (!isdigit(c)){
+ if (obj_list) free(obj_list);
+ printf("Input Error: Compression parameter not digit in <%s>\n",str);
+ exit(1);
+ }
+ stype[m]=c;
+ } /* u */
+
+ stype[m]='\0';
+ } /*if */
+
+
+
filt->cd_values[j++]=atoi(stype);
i+=m; /* jump */
}
@@ -249,6 +307,11 @@ obj_list_t* parse_filter(const char *str,
printf("Input Error: pixels_per_block is too large in <%s>\n",str);
exit(1);
}
+ if ( (strcmp(smask,"NN")!=0) && (strcmp(smask,"EC")!=0) ) {
+ if (obj_list) free(obj_list);
+ printf("Input Error: szip mask must be 'NN' or 'EC' \n");
+ exit(1);
+ }
break;
};