summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repack_parse.c
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2006-10-05 14:35:40 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2006-10-05 14:35:40 (GMT)
commit5df5ee8956c9613793908169676de0fb47582c71 (patch)
treea48346c4a0d1e6284ad916807030e288a6979577 /tools/h5repack/h5repack_parse.c
parent4d8a0f4c54b95c5b865ebdee6e82cf42c7b44c5a (diff)
downloadhdf5-5df5ee8956c9613793908169676de0fb47582c71.zip
hdf5-5df5ee8956c9613793908169676de0fb47582c71.tar.gz
hdf5-5df5ee8956c9613793908169676de0fb47582c71.tar.bz2
[svn-r12720]
added output of error messages using the tools library function error_msg, that prints the program name and error on the message tested: kagiso
Diffstat (limited to 'tools/h5repack/h5repack_parse.c')
-rw-r--r--tools/h5repack/h5repack_parse.c59
1 files changed, 29 insertions, 30 deletions
diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c
index 9243b72..7b173cc 100644
--- a/tools/h5repack/h5repack_parse.c
+++ b/tools/h5repack/h5repack_parse.c
@@ -16,11 +16,10 @@
#include <string.h>
#include <stdio.h>
#include <ctype.h>
+#include "h5tools_utils.h"
#include "h5repack.h"
-#if 0
-#define PARSE_DEBUG
-#endif
+extern char *progname;
/*-------------------------------------------------------------------------
* Function: parse_filter
@@ -96,7 +95,7 @@ obj_list_t* parse_filter(const char *str,
obj_list=malloc(n*sizeof(obj_list_t));
if (obj_list==NULL)
{
- printf("Could not alloc object list\n");
+ error_msg(progname, "could not allocate object list\n");
return NULL;
}
*n_objs=n;
@@ -119,7 +118,7 @@ obj_list_t* parse_filter(const char *str,
if (end_obj+1==(int)len)
{
if (obj_list) free(obj_list);
- printf("Input Error: Invalid compression type in <%s>\n",str);
+ error_msg(progname, "input Error: Invalid compression type in <%s>\n",str);
exit(1);
}
@@ -156,7 +155,7 @@ obj_list_t* parse_filter(const char *str,
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);
+ error_msg(progname, "compression parameter not digit in <%s>\n",str);
exit(1);
}
if (l==-1)
@@ -176,7 +175,7 @@ obj_list_t* parse_filter(const char *str,
filt->cd_values[j++]=H5_SZIP_EC_OPTION_MASK;
else
{
- printf("Input Error: szip mask must be 'NN' or 'EC' \n");
+ error_msg(progname, "szip mask must be 'NN' or 'EC' \n");
exit(1);
}
@@ -215,7 +214,7 @@ obj_list_t* parse_filter(const char *str,
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);
+ error_msg(progname, "compression parameter is not a digit in <%s>\n",str);
exit(1);
}
if (l==-1)
@@ -235,7 +234,7 @@ obj_list_t* parse_filter(const char *str,
filt->cd_values[j++]=H5Z_SO_FLOAT_DSCALE;
else
{
- printf("Input Error: scale type must be 'IN' or 'DS' \n");
+ error_msg(progname, "scale type must be 'IN' or 'DS' \n");
exit(1);
}
@@ -259,7 +258,7 @@ obj_list_t* parse_filter(const char *str,
c = str[u];
if (!isdigit(c)){
if (obj_list) free(obj_list);
- printf("Input Error: Compression parameter not digit in <%s>\n",str);
+ error_msg(progname, "compression parameter is not a digit in <%s>\n",str);
exit(1);
}
stype[m]=c;
@@ -294,7 +293,7 @@ obj_list_t* parse_filter(const char *str,
filt->filtn=H5Z_FILTER_DEFLATE;
if (no_param) { /*no more parameters, GZIP must have parameter */
if (obj_list) free(obj_list);
- printf("Input Error: Missing compression parameter in <%s>\n",str);
+ error_msg(progname, "missing compression parameter in <%s>\n",str);
exit(1);
}
}
@@ -308,7 +307,7 @@ obj_list_t* parse_filter(const char *str,
filt->filtn=H5Z_FILTER_SZIP;
if (no_param) { /*no more parameters, SZIP must have parameter */
if (obj_list) free(obj_list);
- printf("Input Error: Missing compression parameter in <%s>\n",str);
+ error_msg(progname, "missing compression parameter in <%s>\n",str);
exit(1);
}
}
@@ -322,7 +321,7 @@ obj_list_t* parse_filter(const char *str,
filt->filtn=H5Z_FILTER_SHUFFLE;
if (m>0){ /*shuffle does not have parameter */
if (obj_list) free(obj_list);
- printf("Input Error: Extra parameter in SHUF <%s>\n",str);
+ error_msg(progname, "extra parameter in SHUF <%s>\n",str);
exit(1);
}
}
@@ -335,7 +334,7 @@ obj_list_t* parse_filter(const char *str,
filt->filtn=H5Z_FILTER_FLETCHER32;
if (m>0){ /*shuffle does not have parameter */
if (obj_list) free(obj_list);
- printf("Input Error: Extra parameter in FLET <%s>\n",str);
+ error_msg(progname, "extra parameter in FLET <%s>\n",str);
exit(1);
}
}
@@ -348,7 +347,7 @@ obj_list_t* parse_filter(const char *str,
filt->filtn=H5Z_FILTER_NBIT;
if (m>0){ /*nbit does not have parameter */
if (obj_list) free(obj_list);
- printf("Input Error: Extra parameter in NBIT <%s>\n",str);
+ error_msg(progname, "extra parameter in NBIT <%s>\n",str);
exit(1);
}
}
@@ -361,13 +360,13 @@ obj_list_t* parse_filter(const char *str,
filt->filtn=H5Z_FILTER_SCALEOFFSET;
if (no_param) { /*no more parameters, SOFF must have parameter */
if (obj_list) free(obj_list);
- printf("Input Error: Missing compression parameter in <%s>\n",str);
+ error_msg(progname, "missing compression parameter in <%s>\n",str);
exit(1);
}
}
else {
if (obj_list) free(obj_list);
- printf("Input Error: Invalid filter type in <%s>\n",str);
+ error_msg(progname, "invalid filter type in <%s>\n",str);
exit(1);
}
}
@@ -384,7 +383,7 @@ obj_list_t* parse_filter(const char *str,
case H5Z_FILTER_DEFLATE:
if (filt->cd_values[0]<0 || filt->cd_values[0]>9 ){
if (obj_list) free(obj_list);
- printf("Input Error: Invalid compression parameter in <%s>\n",str);
+ error_msg(progname, "invalid compression parameter in <%s>\n",str);
exit(1);
}
break;
@@ -394,24 +393,24 @@ obj_list_t* parse_filter(const char *str,
pixels_per_block=filt->cd_values[0];
if ((pixels_per_block%2)==1) {
if (obj_list) free(obj_list);
- printf("Input Error: pixels_per_block is not even in <%s>\n",str);
+ error_msg(progname, "pixels_per_block is not even in <%s>\n",str);
exit(1);
}
if (pixels_per_block>H5_SZIP_MAX_PIXELS_PER_BLOCK) {
if (obj_list) free(obj_list);
- printf("Input Error: pixels_per_block is too large in <%s>\n",str);
+ error_msg(progname, "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");
+ error_msg(progname, "szip mask must be 'NN' or 'EC' \n");
exit(1);
}
break;
case H5Z_FILTER_SCALEOFFSET:
if (filt->cd_values[0]<0 ){
if (obj_list) free(obj_list);
- printf("Input Error: Invalid compression parameter in <%s>\n",str);
+ error_msg(progname, "invalid compression parameter in <%s>\n",str);
exit(1);
}
break;
@@ -448,7 +447,7 @@ const char* get_sfilter(H5Z_filter_t filtn)
else if (filtn==H5Z_FILTER_SCALEOFFSET)
return "SOFF";
else {
- printf("Input error in filter type\n");
+ error_msg(progname, "input error in filter type\n");
exit(1);
}
return NULL;
@@ -517,7 +516,7 @@ obj_list_t* parse_layout(const char *str,
obj_list=malloc(n*sizeof(obj_list_t));
if (obj_list==NULL)
{
- printf("Could not alloc object list\n");
+ error_msg(progname, "could not allocate object list\n");
return NULL;
}
*n_objs=n;
@@ -541,7 +540,7 @@ obj_list_t* parse_layout(const char *str,
if (end_obj+1==(int)len)
{
if (obj_list) free(obj_list);
- printf("Parse layout error: No characters after : in <%s>\n",str);
+ error_msg(progname, "in parse layout, no characters after : in <%s>\n",str);
exit(1);
}
@@ -558,7 +557,7 @@ obj_list_t* parse_layout(const char *str,
else if (strcmp(slayout,"CHUNK")==0)
pack->layout=H5D_CHUNKED;
else {
- printf("Parse layout error: Not a valid layout in <%s>\n",str);
+ error_msg(progname, "in parse layout, not a valid layout in <%s>\n",str);
exit(1);
}
}
@@ -582,7 +581,7 @@ obj_list_t* parse_layout(const char *str,
if (j>(int)len)
{
if (obj_list) free(obj_list);
- printf("Parse layout error: <%s> Chunk dimensions missing\n",str);
+ error_msg(progname, "in parse layout, <%s> Chunk dimensions missing\n",str);
exit(1);
}
@@ -596,7 +595,7 @@ obj_list_t* parse_layout(const char *str,
&& c!='N' && c!='O' && c!='N' && c!='E'
){
if (obj_list) free(obj_list);
- printf("Parse layout error: <%s> Not a valid character in <%s>\n",
+ error_msg(progname, "in parse layout, <%s> Not a valid character in <%s>\n",
sdim,str);
exit(1);
}
@@ -609,7 +608,7 @@ obj_list_t* parse_layout(const char *str,
pack->chunk.chunk_lengths[c_index]=atoi(sdim);
if (pack->chunk.chunk_lengths[c_index]==0) {
if (obj_list) free(obj_list);
- printf("Parse layout error: <%s> Conversion to number in <%s>\n",
+ error_msg(progname, "in parse layout, <%s> conversion to number in <%s>\n",
sdim,str);
exit(1);
}
@@ -627,7 +626,7 @@ obj_list_t* parse_layout(const char *str,
pack->chunk.chunk_lengths[c_index]=atoi(sdim);
if (pack->chunk.chunk_lengths[c_index]==0){
if (obj_list) free(obj_list);
- printf("Parse layout error: <%s> Conversion to number in <%s>\n",
+ error_msg(progname, "in parse layout, <%s> conversion to number in <%s>\n",
sdim,str);
exit(1);
}