From cdd4606430edbb9b322c1abd55b2a4cdff936088 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 21 Aug 2007 16:08:27 -0500 Subject: [svn-r14097] Description: First real use of API versioning code, H5E routines switched to use new API versioning scheme. Tested on: Mac OS X/32 10.4.10 (amazon) FreeBSD/32 6.2 (duty) FreeBSD/64 6.2 (liberty) Linux/32 2.6 (kagiso) Linux/64 2.6 (smirom) Solaris/32 5.10 (linew) --- MANIFEST | 2 +- bin/make_vers | 167 ++++++++++++++++++++++++++++-------- configure | 5 +- configure.in | 1 + fortran/src/H5Ef.c | 10 +-- src/H5E.c | 92 +++++++------------- src/H5Edeprec.c | 76 ++++++++-------- src/H5Eint.c | 238 ++++++++++++++++++++++++++++++++------------------- src/H5Epkg.h | 60 ++++++++++--- src/H5Eprivate.h | 35 +------- src/H5Epublic.h | 107 ++++++++++++++--------- src/H5vers.txt | 21 +++-- src/H5version.h | 111 ++++++++++++++++++++++-- test/Makefile.am | 5 +- test/Makefile.in | 12 ++- test/err_compat.c | 64 +++++++------- test/error_test.c | 27 +++--- test/h5test.c | 4 +- test/testerror.sh | 107 ----------------------- test/testerror.sh.in | 120 ++++++++++++++++++++++++++ test/testframe.c | 2 +- tools/misc/h5debug.c | 2 +- 22 files changed, 791 insertions(+), 477 deletions(-) delete mode 100644 test/testerror.sh create mode 100644 test/testerror.sh.in diff --git a/MANIFEST b/MANIFEST index fd907c1..487dc3e 100644 --- a/MANIFEST +++ b/MANIFEST @@ -801,10 +801,10 @@ ./test/tbogus.h5 ./test/tchecksum.c ./test/tconfig.c +./test/testerror.sh.in ./test/testframe.c ./test/testhdf5.c ./test/testhdf5.h -./test/testerror.sh ./test/testmeta.c ./test/tfile.c ./test/tgenprop.c diff --git a/bin/make_vers b/bin/make_vers index 7f612b4..25e1297 100755 --- a/bin/make_vers +++ b/bin/make_vers @@ -99,11 +99,11 @@ sub print_globalapivers ($) { my $curr_idx; # Current API version index # Print the descriptive comment - print $fh "\n/* If a particular \"global\" version of the library's interfaces is chosen,\n"; - print $fh " * set the versions for the API routines affected.\n"; + print $fh "\n\n/* If a particular \"global\" version of the library's interfaces is chosen,\n"; + print $fh " * set the versions for the API symbols affected.\n"; print $fh " *\n"; print $fh " * Note: If an application has already chosen a particular version for an\n"; - print $fh " * API routine, the individual API version macro takes priority.\n"; + print $fh " * API symbol, the individual API version macro takes priority.\n"; print $fh " */\n"; # Loop over supported older library APIs and define the appropriate macros @@ -113,14 +113,28 @@ sub print_globalapivers ($) { # Print the version macro info for each function that is defined for # this API version - for $name (sort keys %{$api_vers[$curr_idx]}) { + print $fh "\n/*************/\n"; + print $fh "/* Functions */\n"; + print $fh "/*************/\n"; + for $name (sort keys %{$func_vers[$curr_idx]}) { print $fh "#if !defined(", $name, "_vers)\n"; - print $fh "#define ", $name, "_vers $api_vers[$curr_idx]{$name}\n"; + print $fh "#define ", $name, "_vers $func_vers[$curr_idx]{$name}\n"; + print $fh "#endif /* !defined(", $name, "_vers) */\n"; + } + + # Print the version macro info for each typedef that is defined for + # this API version + print $fh "\n/************/\n"; + print $fh "/* Typedefs */\n"; + print $fh "/************/\n"; + for $name (sort keys %{$type_vers[$curr_idx]}) { + print $fh "#if !defined(", $name, "_vers)\n"; + print $fh "#define ", $name, "_vers $type_vers[$curr_idx]{$name}\n"; print $fh "#endif /* !defined(", $name, "_vers) */\n"; } # Print API version endif - print $fh "#endif /* H5_USE_1", ($curr_idx * 2), "_API */\n"; + print $fh "\n#endif /* H5_USE_1", ($curr_idx * 2), "_API */\n"; } } @@ -132,30 +146,79 @@ sub print_defaultapivers ($) { my $curr_name; # Current API function # Print the descriptive comment - print $fh "\n/* Choose the correct version of each API routine, defaulting to the latest\n"; - print $fh " * version of each API routine. The \"best\" name for API parameters/data\n"; - print $fh " * structures that have changed definitions is also set. An error is\n"; - print $fh " * issued for specifying an invalid API version.\n"; + print $fh "\n\n/* Choose the correct version of each API symbol, defaulting to the latest\n"; + print $fh " * version of each. The \"best\" name for API parameters/data structures\n"; + print $fh " * that have changed definitions is also set. An error is issued for\n"; + print $fh " * specifying an invalid API version.\n"; print $fh " */\n"; # Loop over function names that are versioned and set up the version macros + print $fh "\n/*************/\n"; + print $fh "/* Functions */\n"; + print $fh "/*************/\n"; for $curr_name (sort keys %functions) { my $curr_vers_name; # Name of version macro for current function my $curr_vers; # Version of function + my @param_list; # Typedefs for the function parameters # Set up variables for later use $curr_vers_name = $curr_name . "_vers"; $curr_vers = $functions{$curr_name}; + # Split up parameter info + @param_list = split(/\s*,\s*/, $func_params{$curr_name}); +#print "print_defaultapivers: param_list=(@param_list)\n"; + # Set up default/latest version name mapping - print $fh "#if !defined($curr_vers_name) || $curr_vers_name == $curr_vers\n"; + print $fh "\n#if !defined($curr_vers_name) || $curr_vers_name == $curr_vers\n"; print $fh "#define $curr_name $curr_name$curr_vers\n"; + # Print function's dependent parameter types + foreach(sort(@param_list)) { + print $fh "#define ${_}_t $_${curr_vers}_t\n"; + } + # Loop to print earlier version name mappings $curr_vers--; while($curr_vers > 0) { print $fh "#elif $curr_vers_name == $curr_vers\n"; print $fh "#define $curr_name $curr_name$curr_vers\n"; + + # Print function's dependent parameter types + foreach(sort(@param_list)) { + print $fh "#define ${_}_t $_${curr_vers}_t\n"; + } + + $curr_vers--; + } + + # Finish up with error for unknown version and endif + print $fh "#else /* $curr_vers_name */\n"; + print $fh "#error \"$curr_vers_name set to invalid value\"\n"; + print $fh "#endif /* $curr_vers_name */\n"; + } + + # Loop over typedefs that are versioned and set up the version macros + print $fh "\n/************/\n"; + print $fh "/* Typedefs */\n"; + print $fh "/************/\n"; + for $curr_name (sort keys %typedefs) { + my $curr_vers_name; # Name of version macro for current function + my $curr_vers; # Version of function + + # Set up variables for later use + $curr_vers_name = $curr_name . "_vers"; + $curr_vers = $typedefs{$curr_name}; + + # Set up default/latest version name mapping + print $fh "#if !defined($curr_vers_name) || $curr_vers_name == $curr_vers\n"; + print $fh "#define ${curr_name}_t $curr_name${curr_vers}_t\n"; + + # Loop to print earlier version name mappings + $curr_vers--; + while($curr_vers > 0) { + print $fh "#elif $curr_vers_name == $curr_vers\n"; + print $fh "#define ${curr_name}_t $curr_name${curr_vers}_t\n"; $curr_vers--; } @@ -176,7 +239,7 @@ sub print_endprotect ($$) { $file =~ s/(\w*)\.h/$1/; # Print the endif info - print $fh "\n#endif /* ${file}_H */\n\n"; + print $fh "#endif /* ${file}_H */\n\n"; } ############################################################################## @@ -188,22 +251,37 @@ sub parse_line ($) { # Parse API function lines #print "line=$line\n"; - if($line =~ /^\s*FUNCTION,/) { + if($line =~ /^\s*FUNCTION:/ || $line =~ /^\s*TYPEDEF:/) { my $name; # The name of the function + my $params; # Typedefs for function parameters my $vers; # The version info for the function my @vers_list; # Version info, as a list my $num_versions; # Number of versions for function - my %func_versions; # Versions for a function + my %sym_versions; # Versions for a symbol my $last_idx; # The previous version index seen for a function my $last_vers; # The previous version # seen for a function + my $line_type; # Type of line we are parsing + + # Determine the type of the line to parse + if($line =~ /^\s*FUNCTION:/) { + $line_type = 1; + # Get the function's name & version info + ($name, $params, $vers) = ($line =~ /^\s*FUNCTION:\s*(\w*);\s*(.*?)\s*;\s*(.*?)\s*$/); +#print "parse_line: name='$name', params='$params', vers='$vers'\n"; + } + elsif($line =~ /^\s*TYPEDEF:/) { + $line_type = 2; - # Get the function's name & version info - ($name, $vers) = ($line =~ /^\s*FUNCTION,\s*(\w*),\s*(.*?)\s*$/); -#print "FUNCTION: name='$name', vers='$vers'\n"; + # Get the typedefs's name & version info + ($name, $vers) = ($line =~ /^\s*TYPEDEF:\s*(\w*);\s*(.*?)\s*$/); +#print "parse_line: name='$name', vers='$vers'\n"; + } +#print "parse_line: line_type='$line_type'\n"; - # Check if the name already exists in the list of functions - if(exists($functions{$name})) { - die "duplicated name: $name"; + + # Check if the name already exists in the list of symbols + if(exists($functions{$name}) || exists($typedefs{$name})) { + die "duplicated symbol: $name"; } # Check for no version info given @@ -213,7 +291,7 @@ sub parse_line ($) { # Split up version info @vers_list = split(/\s*,\s*/, $vers); -#print "FUNCTION: vers_list=(@vers_list)\n"; +#print "parse_line: vers_list=(@vers_list)\n"; # Check for invalid version info given $last_idx = -1; @@ -221,31 +299,37 @@ sub parse_line ($) { foreach(sort(@vers_list)) { my $vers_idx; # Index of version in array -#print "FUNCTION: _=$_ last_idx='$last_idx'\n"; +#print "parse_line: _=$_ last_idx='$last_idx'\n"; # Do some validation on the input if(!($_ =~ /v1[02468]/)) { die "bad version information: $name"; } - if(exists($func_versions{$_})) { + if(exists($sym_versions{$_})) { die "duplicate version information: $name"; } # Store the versions for the function in a local hash table, indexed by the version - $func_versions{$_}=$_; + $sym_versions{$_}=$_; # Get the index of the version ($vers_idx) = ($_ =~ /v1(\d)/); $vers_idx /= 2; -#print "FUNCTION: vers_idx='$vers_idx'\n"; +#print "parse_line: vers_idx='$vers_idx'\n"; # Update intermediate versions of the library that included the API routine if($last_idx >= 0) { -#print "FUNCTION: last_idx='$last_idx'\n"; +#print "parse_line: last_idx='$last_idx'\n"; # Add the function to the list of API routines available in # different versions of the library while($last_idx < $vers_idx) { - $api_vers[$last_idx]{$name} = $last_vers; + if($line_type == 1) { + $func_vers[$last_idx]{$name} = $last_vers; + } elsif($line_type == 2) { + $type_vers[$last_idx]{$name} = $last_vers; + } else { + die "unknown line type: $line"; + } $last_idx++; } @@ -259,18 +343,33 @@ sub parse_line ($) { # Finish updating versions of the library that included the API routine if($last_idx >= 0) { -#print "FUNCTION: max_idx='$max_idx'\n"; +#print "parse_line: max_idx='$max_idx'\n"; # Add the function to the list of API routines available in # different versions of the library while($last_idx <= $max_idx) { - $api_vers[$last_idx]{$name} = $last_vers; + if($line_type == 1) { + $func_vers[$last_idx]{$name} = $last_vers; + } elsif($line_type == 2) { + $type_vers[$last_idx]{$name} = $last_vers; + } else { + die "unknown line type: $line"; + } $last_idx++; } } - # Store the number of function versions in a hash table, indexed by the name - $functions{$name} = $#vers_list + 1; + # Store the number of symbol versions in a hash table, indexed by the name + if($line_type == 1) { + $functions{$name} = $#vers_list + 1; + + # Store the function's parameter types for later + $func_params{$name} = $params; + } elsif($line_type == 2) { + $typedefs{$name} = $#vers_list + 1; + } else { + die "unknown line type: $line"; + } } # Unknown keyword else { @@ -334,12 +433,12 @@ for $file (@ARGV) { # print "functions{$name} = $functions{$name}\n"; #} -#for $i (0 .. $#api_vers) { +#for $i (0 .. $#func_vers) { # my $vers_name; # Name of indexed version # $vers_name = "v1." . ($i * 2); # print "$vers_name functions: "; -# for $name (sort keys %{$api_vers[$i]}) { -# print "$name$api_vers[$i]{$name} "; +# for $name (sort keys %{$func_vers[$i]}) { +# print "$name$func_vers[$i]{$name} "; # } # print "\n"; #} diff --git a/configure b/configure index adc1755..a1682ff 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Id: configure.in 14061 2007-08-09 19:46:44Z mcgreevy . +# From configure.in Id: configure.in 14096 2007-08-20 21:55:38Z slu . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for HDF5 1.8.0-beta3post1. # @@ -52648,7 +52648,7 @@ if test -n "$TESTPARALLEL"; then fi fi -ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile testpar/Makefile testpar/testph5.sh perform/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5dump/testh5dumpxml.sh tools/h5import/Makefile tools/h5diff/Makefile tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/misc/testh5repart.sh tools/h5stat/testh5stat.sh tools/h5stat/Makefile examples/Makefile examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/examples/Makefile c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/libhdf5_fortran.settings fortran/src/Makefile fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/testh5fc.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/tools/Makefile hl/tools/gif2h5/Makefile hl/examples/Makefile hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile" +ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile test/testerror.sh testpar/Makefile testpar/testph5.sh perform/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5dump/testh5dumpxml.sh tools/h5import/Makefile tools/h5diff/Makefile tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/misc/testh5repart.sh tools/h5stat/testh5stat.sh tools/h5stat/Makefile examples/Makefile examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/examples/Makefile c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/libhdf5_fortran.settings fortran/src/Makefile fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/testh5fc.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/tools/Makefile hl/tools/gif2h5/Makefile hl/examples/Makefile hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile" cat >confcache <<\_ACEOF @@ -53306,6 +53306,7 @@ do "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; + "test/testerror.sh") CONFIG_FILES="$CONFIG_FILES test/testerror.sh" ;; "testpar/Makefile") CONFIG_FILES="$CONFIG_FILES testpar/Makefile" ;; "testpar/testph5.sh") CONFIG_FILES="$CONFIG_FILES testpar/testph5.sh" ;; "perform/Makefile") CONFIG_FILES="$CONFIG_FILES perform/Makefile" ;; diff --git a/configure.in b/configure.in index 901f3fb..0de3499 100644 --- a/configure.in +++ b/configure.in @@ -3790,6 +3790,7 @@ AC_CONFIG_FILES([src/libhdf5.settings Makefile src/Makefile test/Makefile + test/testerror.sh testpar/Makefile testpar/testph5.sh perform/Makefile diff --git a/fortran/src/H5Ef.c b/fortran/src/H5Ef.c index 612e894..d3983af 100644 --- a/fortran/src/H5Ef.c +++ b/fortran/src/H5Ef.c @@ -70,7 +70,7 @@ nh5eprint_c1(_fcd name, int_f* namelen) file = fopen(c_name, "a"); if(!file) goto DONE; /* - * Call H5Eprint function. + * Call H5Eprint2 function. */ status = H5Eprint2(H5E_DEFAULT, file); if (status >=0 ) ret_val = 0; @@ -100,7 +100,7 @@ nh5eprint_c2() herr_t status; /* - * Call H5Eprint function. + * Call H5Eprint2 function. */ status = H5Eprint2(H5E_DEFAULT, NULL); if(status >= 0) ret_val = 0; @@ -192,9 +192,9 @@ nh5eset_auto_c(int_f* printflag) herr_t status = -1; if (*printflag == 1) - status = H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)H5Eprint, stderr); - if (*printflag == 0) - status = H5Eset_auto2(H5E_DEFAULT, NULL,NULL); + status = H5Eset_auto2(H5E_DEFAULT, H5Eprint2, stderr); + else if (*printflag == 0) + status = H5Eset_auto2(H5E_DEFAULT, NULL, NULL); if (status >= 0) ret_val = 0; return ret_val; } diff --git a/src/H5E.c b/src/H5E.c index 31922a0..b97f72f 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -22,7 +22,7 @@ * return some indication that an error occurred and the * application can print the error stack. * - * Certain API functions in the H5E package (such as H5Eprint()) + * Certain API functions in the H5E package (such as H5Eprint2()) * do not clear the error stack. Otherwise, any function which * doesn't have an underscore immediately after the package name * will clear the error stack. For instance, H5Fopen() clears @@ -151,6 +151,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_init() */ + /*-------------------------------------------------------------------------- * Function: H5E_init_interface * @@ -190,13 +191,13 @@ H5E_init_interface(void) #ifndef H5_HAVE_THREADSAFE H5E_stack_g[0].nused = 0; -#ifdef H5_WANT_H5_V1_6_COMPAT - H5E_stack_g[0].new_api = FALSE; - H5E_stack_g[0].u.func = (H5E_auto_t)H5Eprint; -#else /*H5_WANT_H5_V1_6_COMPAT*/ - H5E_stack_g[0].new_api = TRUE; - H5E_stack_g[0].u.func2 = (H5E_auto2_t)H5Eprint2; -#endif /*H5_WANT_H5_V1_6_COMPAT*/ +#ifdef H5_USE_16_API + H5E_stack_g[0].auto_op.vers = 1; + H5E_stack_g[0].auto_op.u.func1 = (H5E_auto1_t)H5Eprint1; +#else /* H5_USE_16_API */ + H5E_stack_g[0].auto_op.vers = 2; + H5E_stack_g[0].auto_op.u.func2 = (H5E_auto2_t)H5Eprint2; +#endif /* H5_USE_16_API */ H5E_stack_g[0].auto_data = NULL; #endif /* H5_HAVE_THREADSAFE */ @@ -320,8 +321,8 @@ H5E_get_stack(void) /* Set the thread-specific info */ estack->nused = 0; - estack->new_api = TRUE; - estack->u.func2 = (H5E_auto2_t)H5Eprint2; + estack->auto_op.vers = 2; + estack->auto_op.u.func2 = (H5E_auto2_t)H5Eprint2; estack->auto_data = NULL; /* (It's not necessary to release this in this API, it is @@ -633,6 +634,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Eclose_msg() */ + /*------------------------------------------------------------------------- * Function: H5E_close_msg * @@ -662,6 +664,7 @@ H5E_close_msg(H5E_msg_t *err) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5E_close_msg() */ + /*------------------------------------------------------------------------- * Function: H5Ecreate_msg * @@ -1373,7 +1376,7 @@ H5Eprint2(hid_t err_stack, FILE *stream) } /* end else */ /* Print error stack */ - if(H5E_print2(estack, stream, FALSE) < 0) + if(H5E_print(estack, stream, FALSE) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack") done: @@ -1397,8 +1400,9 @@ done: herr_t H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, void *client_data) { - H5E_t *estack; /* Error stack to operate on */ - herr_t ret_value = SUCCEED; /* Return value */ + H5E_t *estack; /* Error stack to operate on */ + H5E_walk_op_t op; /* Operator for walking error stack */ + herr_t ret_value = SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ FUNC_ENTER_API_NOCLEAR(H5Ewalk2, FAIL) @@ -1418,7 +1422,9 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi } /* end else */ /* Walk the error stack */ - if(H5E_walk2(estack, direction, NULL, stack_func, FALSE, client_data) < 0) + op.vers = 2; + op.u.func2 = stack_func; + if(H5E_walk(estack, direction, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") done: @@ -1445,7 +1451,7 @@ herr_t H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data) { H5E_t *estack; /* Error stack to operate on */ - H5E_auto_op_t f; /* Error stack function */ + H5E_auto_op_t op; /* Error stack function */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Eget_auto2, FAIL) @@ -1460,10 +1466,10 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") /* Get the automatic error reporting information */ - if(H5E_get_auto2(estack, TRUE, &f, client_data) < 0) + if(H5E_get_auto(estack, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") if(func) - *func = f.efunc2; + *func = op.u.func2; done: FUNC_LEAVE_API(ret_value) @@ -1479,7 +1485,7 @@ done: * call FUNC passing it CLIENT_DATA as an argument. * * The default values before this function is called are - * H5Eprint() with client data being the standard error stream, + * H5Eprint2() with client data being the standard error stream, * stderr. * * Automatic stack traversal is always in the H5E_WALK_DOWNWARD @@ -1496,7 +1502,7 @@ herr_t H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) { H5E_t *estack; /* Error stack to operate on */ - H5E_auto_op_t f; /* Error stack function */ + H5E_auto_op_t op; /* Error stack operator */ herr_t ret_value = SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ @@ -1512,8 +1518,9 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") /* Set the automatic error reporting information */ - f.efunc2 = func; - if(H5E_set_auto2(estack, TRUE, &f, client_data) < 0) + op.vers = 2; + op.u.func2 = func; + if(H5E_set_auto(estack, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info") done: @@ -1522,47 +1529,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_dump_api_stack - * - * Purpose: Private function to dump the error stack during an error in - * an API function if a callback function is defined for the - * current error stack. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Wednesday, August 6, 2003 - * - *------------------------------------------------------------------------- - */ -herr_t -H5E_dump_api_stack(int is_api) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5E_dump_api_stack, FAIL) - - /* Only dump the error stack during an API call */ - if(is_api) { - H5E_t *estack = H5E_get_my_stack(); - - assert(estack); - if(estack->new_api) { - if(estack->u.func2) - (void)((estack->u.func2)(H5E_DEFAULT, estack->auto_data)); - } /* end if */ - else { - if(estack->u.func) - (void)((estack->u.func)(estack->auto_data)); - } /* end else */ - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_dump_api_stack() */ - - -/*------------------------------------------------------------------------- * Function: H5Eauto_is_v2 * * Purpose: Determines if the error auto reporting function for an @@ -1596,7 +1562,7 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack) /* Check if the error stack reporting function is the "newer" stack type */ if(is_stack) - *is_stack = estack->new_api; + *is_stack = estack->auto_op.vers > 1; done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index 13a2f3d..c1a5a21 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -82,6 +82,7 @@ /*******************/ +#ifndef H5_NO_DEPRECATED_SYMBOLS /*-------------------------------------------------------------------------- NAME @@ -117,7 +118,7 @@ H5E_init_deprec_interface(void) * *------------------------------------------------------------------------- */ -const char * +char * H5Eget_major(H5E_major_t maj) { H5E_msg_t *msg; /* Pointer to error message */ @@ -165,7 +166,7 @@ done: * *------------------------------------------------------------------------- */ -const char * +char * H5Eget_minor(H5E_minor_t min) { H5E_msg_t *msg; /* Pointer to error message */ @@ -201,7 +202,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Epush + * Function: H5Epush1 * * Purpose: This function definition is for backward compatibility only. * It doesn't have error stack and error class as parameters. @@ -221,13 +222,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Epush(const char *file, const char *func, unsigned line, +H5Epush1(const char *file, const char *func, unsigned line, H5E_major_t maj, H5E_minor_t min, const char *str) { herr_t ret_value = SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ - FUNC_ENTER_API_NOCLEAR(H5Epush, FAIL) + FUNC_ENTER_API_NOCLEAR(H5Epush1, FAIL) H5TRACE6("e", "*s*sIuii*s", file, func, line, maj, min, str); /* Push the error on the default error stack */ @@ -236,11 +237,11 @@ H5Epush(const char *file, const char *func, unsigned line, done: FUNC_LEAVE_API(ret_value) -} /* end H5Epush() */ +} /* end H5Epush1() */ /*------------------------------------------------------------------------- - * Function: H5Eclear + * Function: H5Eclear1 * * Purpose: This function is for backward compatbility. * Clears the error stack for the specified error stack. @@ -253,12 +254,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Eclear(void) +H5Eclear1(void) { herr_t ret_value = SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ - FUNC_ENTER_API_NOCLEAR(H5Eclear, FAIL) + FUNC_ENTER_API_NOCLEAR(H5Eclear1, FAIL) H5TRACE0("e",""); /* Clear the default error stack */ @@ -267,11 +268,11 @@ H5Eclear(void) done: FUNC_LEAVE_API(ret_value) -} /* end H5Eclear() */ +} /* end H5Eclear1() */ /*------------------------------------------------------------------------- - * Function: H5Eprint + * Function: H5Eprint1 * * Purpose: This function is for backward compatbility. * Prints the error stack in some default way. This is just a @@ -287,29 +288,29 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Eprint(FILE *stream) +H5Eprint1(FILE *stream) { H5E_t *estack; /* Error stack to operate on */ herr_t ret_value = SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ - FUNC_ENTER_API_NOCLEAR(H5Eprint, FAIL) + FUNC_ENTER_API_NOCLEAR(H5Eprint1, FAIL) /*NO TRACE*/ if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Print error stack */ - if(H5E_print2(estack, stream, TRUE) < 0) + if(H5E_print(estack, stream, TRUE) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack") done: FUNC_LEAVE_API(ret_value) -} /* end H5Eprint() */ +} /* end H5Eprint1() */ /*------------------------------------------------------------------------- - * Function: H5Ewalk + * Function: H5Ewalk1 * * Purpose: This function is for backward compatbility. * Walks the error stack for the current thread and calls some @@ -323,29 +324,32 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Ewalk(H5E_direction_t direction, H5E_walk_t func, void *client_data) +H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, void *client_data) { H5E_t *estack; /* Error stack to operate on */ + H5E_walk_op_t walk_op; /* Error stack walking callback */ herr_t ret_value = SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ - FUNC_ENTER_API_NOCLEAR(H5Ewalk, FAIL) + FUNC_ENTER_API_NOCLEAR(H5Ewalk1, FAIL) /*NO TRACE*/ if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Walk the error stack */ - if(H5E_walk2(estack, direction, func, NULL, TRUE, client_data) < 0) + walk_op.vers = 1; + walk_op.u.func1 = func; + if(H5E_walk(estack, direction, &walk_op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") done: FUNC_LEAVE_API(ret_value) -} /* end H5Ewalk() */ +} /* end H5Ewalk1() */ /*------------------------------------------------------------------------- - * Function: H5Eget_auto + * Function: H5Eget_auto1 * * Purpose: This function is for backward compatbility. * Returns the current settings for the automatic error stack @@ -361,13 +365,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Eget_auto(H5E_auto_t *func, void **client_data) +H5Eget_auto1(H5E_auto1_t *func, void **client_data) { H5E_t *estack; /* Error stack to operate on */ - H5E_auto_op_t f; /* Error stack function */ + H5E_auto_op_t auto_op; /* Error stack operator */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Eget_auto, FAIL) + FUNC_ENTER_API(H5Eget_auto1, FAIL) H5TRACE2("e", "*x**x", func, client_data); /* Retrieve default error stack */ @@ -375,18 +379,18 @@ H5Eget_auto(H5E_auto_t *func, void **client_data) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Get the automatic error reporting information */ - if(H5E_get_auto2(estack, FALSE, &f, client_data) < 0) + if(H5E_get_auto(estack, &auto_op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") if(func) - *func = f.efunc; + *func = auto_op.u.func1; done: FUNC_LEAVE_API(ret_value) -} /* end H5Eget_auto() */ +} /* end H5Eget_auto1() */ /*------------------------------------------------------------------------- - * Function: H5Eset_auto + * Function: H5Eset_auto1 * * Purpose: This function is for backward compatbility. * Turns on or off automatic printing of errors for certain @@ -395,7 +399,7 @@ done: * call FUNC passing it CLIENT_DATA as an argument. * * The default values before this function is called are - * H5Eprint() with client data being the standard error stream, + * H5Eprint1() with client data being the standard error stream, * stderr. * * Automatic stack traversal is always in the H5E_WALK_DOWNWARD @@ -409,25 +413,27 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Eset_auto(H5E_auto_t func, void *client_data) +H5Eset_auto1(H5E_auto1_t func, void *client_data) { H5E_t *estack; /* Error stack to operate on */ - H5E_auto_op_t f; /* Error stack function */ + H5E_auto_op_t auto_op; /* Error stack operator */ herr_t ret_value = SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ - FUNC_ENTER_API_NOCLEAR(H5Eset_auto, FAIL) + FUNC_ENTER_API_NOCLEAR(H5Eset_auto1, FAIL) H5TRACE2("e", "x*x", func, client_data); if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Set the automatic error reporting information */ - f.efunc = func; - if(H5E_set_auto2(estack, FALSE, &f, client_data) < 0) + auto_op.vers = 1; + auto_op.u.func1 = func; + if(H5E_set_auto(estack, &auto_op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info") done: FUNC_LEAVE_API(ret_value) -} /* end H5Eset_auto() */ +} /* end H5Eset_auto1() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Eint.c b/src/H5Eint.c index 168cc4d..95075d7 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -52,6 +52,12 @@ /* Local Typedefs */ /******************/ +/* Printing information */ +typedef struct H5E_print_t { + FILE *stream; + H5E_cls_t cls; +} H5E_print_t; + /********************/ /* Package Typedefs */ @@ -61,8 +67,10 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5E_walk_cb(unsigned n, const H5E_error_t *err_desc, +#ifndef H5_NO_DEPRECATED_SYMBOLS +static herr_t H5E_walk1_cb(unsigned n, const H5E_error1_t *err_desc, void *client_data); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ static herr_t H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data); static herr_t H5E_clear_entries(H5E_t *estack, size_t nentries); @@ -105,7 +113,7 @@ hid_t H5E_ERR_CLS_g = FAIL; */ char H5E_mpi_error_str[MPI_MAX_ERROR_STRING]; int H5E_mpi_error_str_len; -#endif +#endif /* H5_HAVE_PARALLEL */ @@ -171,9 +179,10 @@ H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) FUNC_LEAVE_NOAPI(len) } /* end H5E_get_msg() */ +#ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5E_walk_cb + * Function: H5E_walk1_cb * * Purpose: This function is for backward compatibility. * This is a default error stack traversal callback function @@ -206,7 +215,7 @@ H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) *------------------------------------------------------------------------- */ static herr_t -H5E_walk_cb(unsigned n, const H5E_error_t *err_desc, void *client_data) +H5E_walk1_cb(unsigned n, const H5E_error1_t *err_desc, void *client_data) { H5E_print_t *eprint = (H5E_print_t *)client_data; FILE *stream; /* I/O stream to print output to */ @@ -217,7 +226,7 @@ H5E_walk_cb(unsigned n, const H5E_error_t *err_desc, void *client_data) const char *min_str = "No minor description"; /* Minor error description */ unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_walk_cb) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_walk1_cb) /* Check arguments */ HDassert(err_desc); @@ -290,7 +299,8 @@ H5E_walk_cb(unsigned n, const H5E_error_t *err_desc, void *client_data) fprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_walk_cb() */ +} /* end H5E_walk1_cb() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- @@ -413,7 +423,7 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) /*------------------------------------------------------------------------- - * Function: H5E_print2 + * Function: H5E_print * * Purpose: Private function to print the error stack in some default * way. This is just a convenience function for H5Ewalk() and @@ -429,13 +439,14 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) *------------------------------------------------------------------------- */ herr_t -H5E_print2(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) +H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) { - H5E_print_t eprint; /* Callback information to pass to H5E_walk2() */ + H5E_print_t eprint; /* Callback information to pass to H5E_walk() */ + H5E_walk_op_t walk_op; /* Error stack walking callback */ herr_t ret_value = SUCCEED; /* Don't clear the error stack! :-) */ - FUNC_ENTER_NOAPI_NOINIT(H5E_print2) + FUNC_ENTER_NOAPI_NOINIT(H5E_print) /* Sanity check */ HDassert(estack); @@ -451,21 +462,29 @@ H5E_print2(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) /* Walk the error stack */ if(bk_compatible) { - if(H5E_walk2(estack, H5E_WALK_DOWNWARD, H5E_walk_cb, NULL, TRUE, (void*)&eprint) < 0) +#ifndef H5_NO_DEPRECATED_SYMBOLS + walk_op.vers = 1; + walk_op.u.func1 = H5E_walk1_cb; + if(H5E_walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") +#else /* H5_NO_DEPRECATED_SYMBOLS */ + HDassert(0 && "version 1 error stack print without deprecated symbols!"); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end if */ else { - if(H5E_walk2(estack, H5E_WALK_DOWNWARD, NULL, H5E_walk2_cb, FALSE, (void*)&eprint) < 0) + walk_op.vers = 2; + walk_op.u.func2 = H5E_walk2_cb; + if(H5E_walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_print2() */ +} /* end H5E_print() */ /*------------------------------------------------------------------------- - * Function: H5E_walk2 + * Function: H5E_walk * * Purpose: Private function for H5Ewalk. * Walks the error stack, calling the specified function for @@ -480,7 +499,7 @@ done: * each error record in the error stack. It's arguments will * include an index number (beginning at zero regardless of * stack traversal direction), an error stack entry, and the - * CLIENT_DATA pointer passed to H5E_print2. + * CLIENT_DATA pointer passed to H5E_print. * * The function FUNC is also provided for backward compatibility. * When BK_COMPATIBLE is set to be TRUE, FUNC is used to be @@ -495,81 +514,91 @@ done: *------------------------------------------------------------------------- */ herr_t -H5E_walk2(const H5E_t *estack, H5E_direction_t direction, H5E_walk_t func, H5E_walk2_t stack_func, - hbool_t bk_compatible, void *client_data) +H5E_walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op, + void *client_data) { int i; /* Local index variable */ herr_t status; /* Status from callback function */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5E_walk2) + FUNC_ENTER_NOAPI_NOINIT(H5E_walk) /* Sanity check */ HDassert(estack); + HDassert(op); /* check args, but rather than failing use some default value */ if(direction != H5E_WALK_UPWARD && direction != H5E_WALK_DOWNWARD) direction = H5E_WALK_UPWARD; /* Walk the stack if a callback function was given */ - if(bk_compatible && func) { - H5E_error_t old_err; - - status = SUCCEED; - if(H5E_WALK_UPWARD == direction) { - for(i = 0; i < (int)estack->nused && status >= 0; i++) { - /* Point to each error record on the stack and pass it to callback function.*/ - old_err.maj_num = estack->slot[i].maj_num; - old_err.min_num = estack->slot[i].min_num; - old_err.func_name = estack->slot[i].func_name; - old_err.file_name = estack->slot[i].file_name; - old_err.desc = estack->slot[i].desc; - old_err.line = estack->slot[i].line; - - status = (func)((unsigned)i, &old_err, client_data); - } /* end for */ + if(op->vers == 1) { +#ifndef H5_NO_DEPRECATED_SYMBOLS + if(op->u.func1) { + H5E_error1_t old_err; + + status = SUCCEED; + if(H5E_WALK_UPWARD == direction) { + for(i = 0; i < (int)estack->nused && status >= 0; i++) { + /* Point to each error record on the stack and pass it to callback function.*/ + old_err.maj_num = estack->slot[i].maj_num; + old_err.min_num = estack->slot[i].min_num; + old_err.func_name = estack->slot[i].func_name; + old_err.file_name = estack->slot[i].file_name; + old_err.desc = estack->slot[i].desc; + old_err.line = estack->slot[i].line; + + status = (op->u.func1)((unsigned)i, &old_err, client_data); + } /* end for */ + } /* end if */ + else { + H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int); + for(i = (int)(estack->nused - 1); i >= 0 && status >= 0; i--) { + /* Point to each error record on the stack and pass it to callback function.*/ + old_err.maj_num = estack->slot[i].maj_num; + old_err.min_num = estack->slot[i].min_num; + old_err.func_name = estack->slot[i].func_name; + old_err.file_name = estack->slot[i].file_name; + old_err.desc = estack->slot[i].desc; + old_err.line = estack->slot[i].line; + + status = (op->u.func1)((unsigned)(estack->nused - (size_t)(i + 1)), &old_err, client_data); + } /* end for */ + } /* end else */ + + if(status < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") } /* end if */ - else { - H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int); - for(i = (int)(estack->nused - 1); i >= 0 && status >= 0; i--) { - /* Point to each error record on the stack and pass it to callback function.*/ - old_err.maj_num = estack->slot[i].maj_num; - old_err.min_num = estack->slot[i].min_num; - old_err.func_name = estack->slot[i].func_name; - old_err.file_name = estack->slot[i].file_name; - old_err.desc = estack->slot[i].desc; - old_err.line = estack->slot[i].line; - - status = (func)((unsigned)(estack->nused - (size_t)(i + 1)), &old_err, client_data); - } /* end for */ - } /* end else */ - - if(status < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") +#else /* H5_NO_DEPRECATED_SYMBOLS */ + HDassert(0 && "version 1 error stack walk without deprecated symbols!"); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end if */ - else if(!bk_compatible && stack_func) { - status = SUCCEED; - if(H5E_WALK_UPWARD == direction) { - for(i = 0; i < (int)estack->nused && status >= 0; i++) - status = (stack_func)((unsigned)i, estack->slot + i, client_data); + else { + HDassert(op->vers == 2); + if(op->u.func2) { + status = SUCCEED; + if(H5E_WALK_UPWARD == direction) { + for(i = 0; i < (int)estack->nused && status >= 0; i++) + status = (op->u.func2)((unsigned)i, estack->slot + i, client_data); + } /* end if */ + else { + H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int); + for(i = (int)(estack->nused - 1); i >= 0 && status >= 0; i--) + status = (op->u.func2)((unsigned)(estack->nused - (size_t)(i + 1)), estack->slot + i, client_data); + } /* end else */ + + if(status < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") } /* end if */ - else { - H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int); - for(i = (int)(estack->nused - 1); i >= 0 && status >= 0; i--) - status = (stack_func)((unsigned)(estack->nused-(size_t)(i + 1)), estack->slot + i, client_data); - } /* end else */ - - if(status < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") - } /* end if */ + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_walk2() */ +} /* end H5E_walk() */ /*------------------------------------------------------------------------- - * Function: H5E_get_auto2 + * Function: H5E_get_auto * * Purpose: Private function to return the current settings for the * automatic error stack traversal function and its data @@ -584,19 +613,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5E_get_auto2(const H5E_t *estack, hbool_t new_api, H5E_auto_op_t *func, void **client_data) +H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_get_auto2) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_get_auto) HDassert(estack); /* Retrieve the requested information */ - if(func) { - if(new_api) - func->efunc2 = estack->u.func2; - else - func->efunc = estack->u.func; - } /* end if */ + if(op) + *op = estack->auto_op; if(client_data) *client_data = estack->auto_data; @@ -605,7 +630,7 @@ H5E_get_auto2(const H5E_t *estack, hbool_t new_api, H5E_auto_op_t *func, void ** /*------------------------------------------------------------------------- - * Function: H5E_set_auto2 + * Function: H5E_set_auto * * Purpose: Private function to turn on or off automatic printing of * errors for certain error stack. When turned on (non-null @@ -614,7 +639,7 @@ H5E_get_auto2(const H5E_t *estack, hbool_t new_api, H5E_auto_op_t *func, void ** * as an argument. * * The default values before this function is called are - * H5Eprint() with client data being the standard error stream, + * H5Eprint2() with client data being the standard error stream, * stderr. * * Automatic stack traversal is always in the H5E_WALK_DOWNWARD @@ -628,22 +653,18 @@ H5E_get_auto2(const H5E_t *estack, hbool_t new_api, H5E_auto_op_t *func, void ** *------------------------------------------------------------------------- */ herr_t -H5E_set_auto2(H5E_t *estack, hbool_t new_api, H5E_auto_op_t *func, void *client_data) +H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_set_auto2) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_set_auto) HDassert(estack); /* Set the automatic error reporting info */ - estack->new_api = new_api; - if(new_api) - estack->u.func2 = func->efunc2; - else - estack->u.func = func->efunc; + estack->auto_op = *op; estack->auto_data = client_data; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_set_auto2() */ +} /* end H5E_set_auto() */ /*------------------------------------------------------------------------- @@ -668,7 +689,7 @@ H5E_set_auto2(H5E_t *estack, hbool_t new_api, H5E_auto_op_t *func, void *client_ */ herr_t H5E_push_stack(H5E_t *estack, const char *file, const char *func, unsigned line, - hid_t cls_id, hid_t maj_id, hid_t min_id, const char *desc) + hid_t cls_id, hid_t maj_id, hid_t min_id, const char *desc) { herr_t ret_value = SUCCEED; /* Return value */ @@ -857,3 +878,48 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_pop() */ + +/*------------------------------------------------------------------------- + * Function: H5E_dump_api_stack + * + * Purpose: Private function to dump the error stack during an error in + * an API function if a callback function is defined for the + * current error stack. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Wednesday, August 6, 2003 + * + *------------------------------------------------------------------------- + */ +herr_t +H5E_dump_api_stack(int is_api) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5E_dump_api_stack, FAIL) + + /* Only dump the error stack during an API call */ + if(is_api) { + H5E_t *estack = H5E_get_my_stack(); + + HDassert(estack); + if(estack->auto_op.vers == 1) { +#ifndef H5_NO_DEPRECATED_SYMBOLS + if(estack->auto_op.u.func1) + (void)((estack->auto_op.u.func1)(estack->auto_data)); +#else /* H5_NO_DEPRECATED_SYMBOLS */ + HDassert(0 && "version 1 error stack dump without deprecated symbols!"); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + } /* end if */ + else { + if(estack->auto_op.u.func2) + (void)((estack->auto_op.u.func2)(H5E_DEFAULT, estack->auto_data)); + } /* end else */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5E_dump_api_stack() */ + diff --git a/src/H5Epkg.h b/src/H5Epkg.h index 5e36b38..a85ddc9 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -41,6 +41,9 @@ /* Amount to indent each error */ #define H5E_INDENT 2 +/* Number of slots in an error stack */ +#define H5E_NSLOTS 32 + #ifdef H5_HAVE_THREADSAFE /* * The per-thread error stack. pthread_once() initializes a special @@ -65,11 +68,49 @@ /****************************/ /* Some syntactic sugar to make the compiler happy with two different kinds of callbacks */ -typedef union { - H5E_auto_t efunc; /* Old-style callback, NO error stack param. */ - H5E_auto2_t efunc2; /* New-style callback, with error stack param. */ +typedef struct { + unsigned vers; /* Which version callback to use */ + union { +#ifndef H5_NO_DEPRECATED_SYMBOLS + H5E_auto1_t func1; /* Old-style callback, NO error stack param. */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + H5E_auto2_t func2; /* New-style callback, with error stack param. */ + }u; } H5E_auto_op_t; +/* Some syntactic sugar to make the compiler happy with two different kinds of callbacks */ +typedef struct { + unsigned vers; /* Which version callback to use */ + union { +#ifndef H5_NO_DEPRECATED_SYMBOLS + H5E_walk1_t func1; /* Old-style callback, NO error stack param. */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + H5E_walk2_t func2; /* New-style callback, with error stack param. */ + }u; +} H5E_walk_op_t; + +/* Error class */ +typedef struct H5E_cls_t { + char *cls_name; /* Name of error class */ + char *lib_name; /* Name of library within class */ + char *lib_vers; /* Version of library */ +} H5E_cls_t; + +/* Major or minor message */ +typedef struct H5E_msg_t { + char *msg; /* Message for error */ + H5E_type_t type; /* Type of error (major or minor) */ + H5E_cls_t *cls; /* Which error class this message belongs to */ +} H5E_msg_t; + +/* Error stack */ +struct H5E_t { + size_t nused; /* Num slots currently used in stack */ + H5E_error2_t slot[H5E_NSLOTS]; /* Array of error records */ + H5E_auto_op_t auto_op; /* Operator for 'automatic' error reporting */ + void *auto_data; /* Callback data for 'automatic error reporting */ +}; + /*****************************/ /* Package Private Variables */ @@ -91,14 +132,13 @@ H5_DLL H5E_t *H5E_get_stack(void); #endif /* H5_HAVE_THREADSAFE */ H5_DLL ssize_t H5E_get_msg(const H5E_msg_t *msg_ptr, H5E_type_t *type, char *msg, size_t size); -H5_DLL herr_t H5E_print2(const H5E_t *estack, FILE *stream, hbool_t bk_compat); -H5_DLL herr_t H5E_walk2(const H5E_t *estack, H5E_direction_t direction, - H5E_walk_t func, H5E_walk2_t stack_func, hbool_t bk_compatible, +H5_DLL herr_t H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compat); +H5_DLL herr_t H5E_walk(const H5E_t *estack, H5E_direction_t direction, + const H5E_walk_op_t *op, void *client_data); +H5_DLL herr_t H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, + void **client_data); +H5_DLL herr_t H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data); -H5_DLL herr_t H5E_get_auto2(const H5E_t *estack, hbool_t new_api, - H5E_auto_op_t *func, void **client_data); -H5_DLL herr_t H5E_set_auto2(H5E_t *estack, hbool_t new_api, - H5E_auto_op_t *func, void *client_data); H5_DLL herr_t H5E_pop(H5E_t *err_stack, size_t count); #endif /* _H5HFpkg_H */ diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 9d444bc..05ce10e 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -24,39 +24,8 @@ /* Private headers needed by this file */ #include "H5private.h" -#define H5E_NSLOTS 32 /*number of slots in an error stack */ - -/* Error class */ -typedef struct H5E_cls_t { - char *cls_name; /* Name of error class */ - char *lib_name; /* Name of library within class */ - char *lib_vers; /* Version of library */ -} H5E_cls_t; - -/* Major or minor message */ -typedef struct H5E_msg_t { - char *msg; /* Message for error */ - H5E_type_t type; /* Type of error (major or minor) */ - H5E_cls_t *cls; /* Which error class this message belongs to */ -} H5E_msg_t; - -/* Error stack */ -typedef struct H5E_t { - size_t nused; /* Num slots currently used in stack */ - H5E_error2_t slot[H5E_NSLOTS]; /* Array of error records */ - hbool_t new_api; /* Indicate that the function pointer is for the new (stack) API or the old */ - union { - H5E_auto_t func; /* Function for 'automatic' error reporting */ - H5E_auto2_t func2; /* Function for 'automatic' error reporting with error stacks */ - } u; - void *auto_data; /* Callback data for 'automatic error reporting */ -} H5E_t; - -/* Printing information */ -typedef struct H5E_print_t { - FILE *stream; - H5E_cls_t cls; -} H5E_print_t; +/* Typedef for error stack (defined in H5Epkg.h) */ +typedef struct H5E_t H5E_t; /* * HERROR macro, used to facilitate error reporting between a FUNC_ENTER() diff --git a/src/H5Epublic.h b/src/H5Epublic.h index ce68b71..2ad7a06 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -34,20 +34,6 @@ typedef enum H5E_type_t { H5E_MINOR } H5E_type_t; -/* For backward compatibility with v1.6 */ -typedef hid_t H5E_major_t; -typedef hid_t H5E_minor_t; - -/* Information about an error; element of error stack. For backward compatibility with v1.6. */ -typedef struct H5E_error_t { - H5E_major_t maj_num; /*major error number */ - H5E_minor_t min_num; /*minor error number */ - const char *func_name; /*function in which error occurred */ - const char *file_name; /*file in which error occurred */ - unsigned line; /*line in file where error occurs */ - const char *desc; /*optional supplied description */ -} H5E_error_t; - /* Information about an error; element of error stack */ typedef struct H5E_error2_t { hid_t cls_id; /*class ID */ @@ -92,10 +78,11 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g; * These two macros still use the old API functions for backward compatibility * purpose. */ +#ifndef H5_NO_DEPRECATED_SYMBOLS #define H5E_BEGIN_TRY { \ unsigned H5E_saved_is_v2; \ union { \ - H5E_auto_t efunc; \ + H5E_auto1_t efunc1; \ H5E_auto2_t efunc2; \ } H5E_saved; \ void *H5E_saved_edata; \ @@ -105,16 +92,28 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g; (void)H5Eget_auto2(H5E_DEFAULT, &H5E_saved.efunc2, &H5E_saved_edata); \ (void)H5Eset_auto2(H5E_DEFAULT, NULL, NULL); \ } else { \ - (void)H5Eget_auto(&H5E_saved.efunc, &H5E_saved_edata); \ - (void)H5Eset_auto(NULL, NULL); \ + (void)H5Eget_auto1(&H5E_saved.efunc1, &H5E_saved_edata); \ + (void)H5Eset_auto1(NULL, NULL); \ } #define H5E_END_TRY \ if(H5E_saved_is_v2) \ (void)H5Eset_auto2(H5E_DEFAULT, H5E_saved.efunc2, H5E_saved_edata); \ else \ - (void)H5Eset_auto(H5E_saved.efunc, H5E_saved_edata); \ + (void)H5Eset_auto1(H5E_saved.efunc1, H5E_saved_edata); \ +} +#else /* H5_NO_DEPRECATED_SYMBOLS */ +#define H5E_BEGIN_TRY { \ + H5E_auto_t saved_efunc; \ + void *H5E_saved_edata; \ + \ + (void)H5Eget_auto(H5E_DEFAULT, &saved_efunc, &H5E_saved_edata); \ + (void)H5Eset_auto(H5E_DEFAULT, NULL, NULL); + +#define H5E_END_TRY \ + (void)H5Eset_auto(H5E_DEFAULT, saved_efunc, H5E_saved_edata); \ } +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* * Public API Convenience Macros for Error reporting - Documented @@ -152,11 +151,8 @@ extern "C" { #endif /* Error stack traversal callback function pointers */ -typedef herr_t (*H5E_walk_t)(unsigned n, const H5E_error_t *err_desc, - void *client_data); typedef herr_t (*H5E_walk2_t)(unsigned n, const H5E_error2_t *err_desc, void *client_data); -typedef herr_t (*H5E_auto_t)(void *client_data); typedef herr_t (*H5E_auto2_t)(hid_t estack, void *client_data); /* Public API functions */ @@ -168,36 +164,63 @@ H5_DLL hid_t H5Ecreate_msg(hid_t cls, H5E_type_t msg_type, const char *msg); H5_DLL hid_t H5Eget_current_stack(void); H5_DLL herr_t H5Eclose_stack(hid_t stack_id); H5_DLL ssize_t H5Eget_class_name(hid_t class_id, char *name, size_t size); -H5_DLL ssize_t H5Eget_msg(hid_t msg_id, H5E_type_t *type, char *msg, - size_t size); -H5_DLL ssize_t H5Eget_num(hid_t error_stack_id); H5_DLL herr_t H5Eset_current_stack(hid_t err_stack_id); -H5_DLL herr_t H5Epop(hid_t err_stack, size_t count); -H5_DLL herr_t H5Eauto_is_v2(hid_t err_stack, unsigned *is_stack); - -/* These old APIs are kept for backward compatibility. They don't have - * the error stack in the parameters. */ -H5_DLL herr_t H5Epush(const char *file, const char *func, unsigned line, - H5E_major_t maj, H5E_minor_t min, const char *str); -H5_DLL herr_t H5Eprint(FILE *stream); -H5_DLL herr_t H5Ewalk(H5E_direction_t direction, H5E_walk_t func, - void *client_data); -H5_DLL herr_t H5Eget_auto(H5E_auto_t *func, void **client_data); -H5_DLL herr_t H5Eset_auto(H5E_auto_t func, void *client_data); -H5_DLL herr_t H5Eclear(void); -H5_DLL const char *H5Eget_major(H5E_major_t maj); -H5_DLL const char *H5Eget_minor(H5E_minor_t min); - -/* New APIs function the same as the old ones above, with the error stack - * in the parameters */ H5_DLL herr_t H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *msg, ...); +H5_DLL herr_t H5Epop(hid_t err_stack, size_t count); H5_DLL herr_t H5Eprint2(hid_t err_stack, FILE *stream); H5_DLL herr_t H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t func, void *client_data); H5_DLL herr_t H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data); H5_DLL herr_t H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data); H5_DLL herr_t H5Eclear2(hid_t err_stack); +H5_DLL herr_t H5Eauto_is_v2(hid_t err_stack, unsigned *is_stack); +H5_DLL ssize_t H5Eget_msg(hid_t msg_id, H5E_type_t *type, char *msg, + size_t size); +H5_DLL ssize_t H5Eget_num(hid_t error_stack_id); + + +/* Symbols defined for compatibility with previous versions of the HDF5 API. + * + * Use of these symbols is deprecated. + */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +/* Typedefs */ + +/* Alias major & minor error types to hid_t's, for compatibility with new + * error API in v1.8 + */ +typedef hid_t H5E_major_t; +typedef hid_t H5E_minor_t; + +/* Information about an error element of error stack. */ +typedef struct H5E_error1_t { + H5E_major_t maj_num; /*major error number */ + H5E_minor_t min_num; /*minor error number */ + const char *func_name; /*function in which error occurred */ + const char *file_name; /*file in which error occurred */ + unsigned line; /*line in file where error occurs */ + const char *desc; /*optional supplied description */ +} H5E_error1_t; + +/* Error stack traversal callback function pointers */ +typedef herr_t (*H5E_walk1_t)(unsigned n, const H5E_error1_t *err_desc, + void *client_data); +typedef herr_t (*H5E_auto1_t)(void *client_data); + +/* Function prototypes */ +H5_DLL herr_t H5Eclear1(void); +H5_DLL herr_t H5Eget_auto1(H5E_auto1_t *func, void **client_data); +H5_DLL herr_t H5Epush1(const char *file, const char *func, unsigned line, + H5E_major_t maj, H5E_minor_t min, const char *str); +H5_DLL herr_t H5Eprint1(FILE *stream); +H5_DLL herr_t H5Eset_auto1(H5E_auto1_t func, void *client_data); +H5_DLL herr_t H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, + void *client_data); +H5_DLL char *H5Eget_major(H5E_major_t maj); +H5_DLL char *H5Eget_minor(H5E_minor_t min); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ #ifdef __cplusplus } diff --git a/src/H5vers.txt b/src/H5vers.txt index 0fd4c4c..e01ea81 100644 --- a/src/H5vers.txt +++ b/src/H5vers.txt @@ -22,7 +22,9 @@ # Blank lines and lines beginning with '#' are ignored # # The format of this file is as follows: -# , , , +# : ; ; , +# +# Where is either 'FUNCTION' or 'TYPEDEF' # # For example, the following sample input shows two functions with different # API versions for each. The example below shows H5Gfoo being added to the @@ -34,8 +36,8 @@ # revised in the v1.6 branch (so there should be two versioned names for the # routine: H5Gbar1 and H5Gbar2). # -# FUNCTION, H5Gfoo, v10, v14, v18 -# FUNCTION, H5Gbar, v12, v16 +# FUNCTION: H5Gfoo; ; v10, v14, v18 +# FUNCTION: H5Gbar; ; v12, v16 # # Programmer: Quincey Koziol # Creation Date: 2007/07/10 @@ -43,6 +45,15 @@ # API function names # (although not required, it's easier to compare this file with the headers # generated if the list below is in alphanumeric sort order - QAK) -#FUNCTION, H5Gcreate, v10, v14, v18 -#FUNCTION, H5Gopen, v12, v18 +FUNCTION: H5Eclear; ; v10, v18 +FUNCTION: H5Eget_auto; ; v10, v18 +FUNCTION: H5Eprint; ; v10, v18 +FUNCTION: H5Epush; ; v14, v18 +FUNCTION: H5Eset_auto; ; v10, v18 +FUNCTION: H5Ewalk; H5E_walk, H5E_error; v10, v18 + +# API typedefs +# (although not required, it's easier to compare this file with the headers +# generated if the list below is in alphanumeric sort order - QAK) +TYPEDEF: H5E_auto; v10, v18 diff --git a/src/H5version.h b/src/H5version.h index 6b27ce3..43e82dc 100644 --- a/src/H5version.h +++ b/src/H5version.h @@ -25,20 +25,119 @@ #error "Can't choose old API versions when deprecated APIs are disabled" #endif /* defined(H5_USE_16_API) && defined(H5_NO_DEPRECATED_SYMBOLS) */ + /* If a particular "global" version of the library's interfaces is chosen, - * set the versions for the API routines affected. + * set the versions for the API symbols affected. * * Note: If an application has already chosen a particular version for an - * API routine, the individual API version macro takes priority. + * API symbol, the individual API version macro takes priority. */ #ifdef H5_USE_16_API + +/*************/ +/* Functions */ +/*************/ +#if !defined(H5Eclear_vers) +#define H5Eclear_vers 1 +#endif /* !defined(H5Eclear_vers) */ +#if !defined(H5Eget_auto_vers) +#define H5Eget_auto_vers 1 +#endif /* !defined(H5Eget_auto_vers) */ +#if !defined(H5Eprint_vers) +#define H5Eprint_vers 1 +#endif /* !defined(H5Eprint_vers) */ +#if !defined(H5Epush_vers) +#define H5Epush_vers 1 +#endif /* !defined(H5Epush_vers) */ +#if !defined(H5Eset_auto_vers) +#define H5Eset_auto_vers 1 +#endif /* !defined(H5Eset_auto_vers) */ +#if !defined(H5Ewalk_vers) +#define H5Ewalk_vers 1 +#endif /* !defined(H5Ewalk_vers) */ + +/************/ +/* Typedefs */ +/************/ +#if !defined(H5E_auto_vers) +#define H5E_auto_vers 1 +#endif /* !defined(H5E_auto_vers) */ + #endif /* H5_USE_16_API */ -/* Choose the correct version of each API routine, defaulting to the latest - * version of each API routine. The "best" name for API parameters/data - * structures that have changed definitions is also set. An error is - * issued for specifying an invalid API version. + +/* Choose the correct version of each API symbol, defaulting to the latest + * version of each. The "best" name for API parameters/data structures + * that have changed definitions is also set. An error is issued for + * specifying an invalid API version. */ +/*************/ +/* Functions */ +/*************/ + +#if !defined(H5Eclear_vers) || H5Eclear_vers == 2 +#define H5Eclear H5Eclear2 +#elif H5Eclear_vers == 1 +#define H5Eclear H5Eclear1 +#else /* H5Eclear_vers */ +#error "H5Eclear_vers set to invalid value" +#endif /* H5Eclear_vers */ + +#if !defined(H5Eget_auto_vers) || H5Eget_auto_vers == 2 +#define H5Eget_auto H5Eget_auto2 +#elif H5Eget_auto_vers == 1 +#define H5Eget_auto H5Eget_auto1 +#else /* H5Eget_auto_vers */ +#error "H5Eget_auto_vers set to invalid value" +#endif /* H5Eget_auto_vers */ + +#if !defined(H5Eprint_vers) || H5Eprint_vers == 2 +#define H5Eprint H5Eprint2 +#elif H5Eprint_vers == 1 +#define H5Eprint H5Eprint1 +#else /* H5Eprint_vers */ +#error "H5Eprint_vers set to invalid value" +#endif /* H5Eprint_vers */ + +#if !defined(H5Epush_vers) || H5Epush_vers == 2 +#define H5Epush H5Epush2 +#elif H5Epush_vers == 1 +#define H5Epush H5Epush1 +#else /* H5Epush_vers */ +#error "H5Epush_vers set to invalid value" +#endif /* H5Epush_vers */ + +#if !defined(H5Eset_auto_vers) || H5Eset_auto_vers == 2 +#define H5Eset_auto H5Eset_auto2 +#elif H5Eset_auto_vers == 1 +#define H5Eset_auto H5Eset_auto1 +#else /* H5Eset_auto_vers */ +#error "H5Eset_auto_vers set to invalid value" +#endif /* H5Eset_auto_vers */ + +#if !defined(H5Ewalk_vers) || H5Ewalk_vers == 2 +#define H5Ewalk H5Ewalk2 +#define H5E_error_t H5E_error2_t +#define H5E_walk_t H5E_walk2_t +#elif H5Ewalk_vers == 1 +#define H5Ewalk H5Ewalk1 +#define H5E_error_t H5E_error1_t +#define H5E_walk_t H5E_walk1_t +#else /* H5Ewalk_vers */ +#error "H5Ewalk_vers set to invalid value" +#endif /* H5Ewalk_vers */ + +/************/ +/* Typedefs */ +/************/ +#if !defined(H5E_auto_vers) || H5E_auto_vers == 2 +#define H5E_auto_t H5E_auto2_t +#elif H5E_auto_vers == 1 +#define H5E_auto_t H5E_auto1_t +#else /* H5E_auto_vers */ +#error "H5E_auto_vers set to invalid value" +#endif /* H5E_auto_vers */ + #endif /* H5version_H */ diff --git a/test/Makefile.am b/test/Makefile.am index a60c1a0..ae89ca2 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -24,7 +24,7 @@ include $(top_srcdir)/config/commence.am INCLUDES=-I$(top_srcdir)/src -I$(top_builddir)/src # Test script for error_test and err_compat -TEST_SCRIPT = $(top_srcdir)/test/testerror.sh +TEST_SCRIPT = testerror.sh check_SCRIPTS = $(TEST_SCRIPT) SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) @@ -125,4 +125,7 @@ testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ trefer.c trefstr.c tselect.c tsohm.c tskiplist.c ttst.c tunicode.c tvltypes.c \ tvlstr.c +# Temporary files. +DISTCLEANFILES=testerror.sh + include $(top_srcdir)/config/conclude.am diff --git a/test/Makefile.in b/test/Makefile.in index c46aa5c..d09072f 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -51,7 +51,7 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/config/commence.am \ + $(srcdir)/testerror.sh.in $(top_srcdir)/config/commence.am \ $(top_srcdir)/config/conclude.am COPYING check_PROGRAMS = $(am__EXEEXT_1) error_test$(EXEEXT) \ err_compat$(EXEEXT) testmeta$(EXEEXT) @@ -64,7 +64,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/H5config.h -CONFIG_CLEAN_FILES = +CONFIG_CLEAN_FILES = testerror.sh LTLIBRARIES = $(noinst_LTLIBRARIES) libh5test_la_LIBADD = am_libh5test_la_OBJECTS = h5test.lo testframe.lo cache_common.lo @@ -610,7 +610,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog cmpd_dset.h5 \ INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src # Test script for error_test and err_compat -TEST_SCRIPT = $(top_srcdir)/test/testerror.sh +TEST_SCRIPT = testerror.sh check_SCRIPTS = $(TEST_SCRIPT) SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) @@ -663,6 +663,9 @@ testhdf5_SOURCES = testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ tvlstr.c +# Temporary files. +DISTCLEANFILES = testerror.sh + # Automake needs to be taught how to build lib, progs, and tests targets. # These will be filled in automatically for the most part (e.g., # lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG, and @@ -711,6 +714,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +testerror.sh: $(top_builddir)/config.status $(srcdir)/testerror.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @@ -1121,6 +1126,7 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/test/err_compat.c b/test/err_compat.c index a057a20..a4d0968 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -21,13 +21,13 @@ */ #include "h5test.h" -#ifndef H5_WANT_H5_V1_6_COMPAT +#ifdef H5_NO_DEPRECATED_SYMBOLS int main(void) { - printf("Test skipped because backward compatbility with v1.6 is NOT configured in\n"); + printf("Test skipped because backward compatability with v1.6 is NOT configured in\n"); return 0; } -#else +#else /* H5_NO_DEPRECATED_SYMBOLS */ const char *FILENAME[] = { "errors_compat", @@ -42,7 +42,7 @@ int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; #define DSET_NAME "a_dataset" #define FAKE_ID -1 -herr_t custom_print_cb(int n, H5E_error_t *err_desc, void* client_data); +herr_t custom_print_cb(unsigned n, const H5E_error1_t *err_desc, void* client_data); /*------------------------------------------------------------------------- @@ -68,7 +68,7 @@ test_error(hid_t file) hid_t dataset, space; hsize_t dims[2]; const char *FUNC_test_error="test_error"; - H5E_auto_t old_func; + H5E_auto1_t old_func; void *old_data; TESTING("error API based on data I/O"); @@ -87,32 +87,37 @@ test_error(hid_t file) /* Create the dataset */ if ((dataset = H5Dcreate(file, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT))<0) { - H5Epush(__FILE__, FUNC_test_error, __LINE__, H5E_ERROR, H5E_CANTCREATE, + H5Epush1(__FILE__, FUNC_test_error, __LINE__, H5E_ERROR, H5E_CANTCREATE, "H5Dcreate failed"); goto error; } /* Test enabling and disabling default printing */ - if (H5Eget_auto(&old_func, &old_data)<0) + if (H5Eget_auto1(&old_func, &old_data)<0) TEST_ERROR; if (old_data != NULL) TEST_ERROR; if (!old_func) TEST_ERROR; - if (old_func != (H5E_auto_t)H5Eprint) +#ifdef H5_USE_16_API + if (old_func != (H5E_auto1_t)H5Eprint1) TEST_ERROR; +#else /* H5_USE_16_API */ + if (old_func != (H5E_auto1_t)H5Eprint2) + TEST_ERROR; +#endif /* H5_USE_16_API */ - if(H5Eset_auto(NULL, NULL)<0) + if(H5Eset_auto1(NULL, NULL)<0) TEST_ERROR; /* Make H5Dwrite fail, verify default print is disabled */ if (H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2)<0) { - H5Epush(__FILE__, FUNC_test_error, __LINE__, H5E_ERROR, H5E_WRITEERROR, + H5Epush1(__FILE__, FUNC_test_error, __LINE__, H5E_ERROR, H5E_WRITEERROR, "H5Dwrite shouldn't succeed"); goto error; } - if(H5Eset_auto(old_func, old_data)<0) + if(H5Eset_auto1(old_func, old_data)<0) TEST_ERROR; /* In case program comes to this point, close dataset */ @@ -147,12 +152,12 @@ dump_error(void) { /* Print errors in library default way */ fprintf(stderr, "********* Print error stack in HDF5 default way *********\n"); - if(H5Eprint(stderr)<0) + if(H5Eprint1(stderr) < 0) TEST_ERROR; /* Customized way to print errors */ fprintf(stderr, "\n********* Print error stack in customized way *********\n"); - if(H5Ewalk(H5E_WALK_UPWARD, custom_print_cb, stderr)<0) + if(H5Ewalk1(H5E_WALK_UPWARD, custom_print_cb, stderr) < 0) TEST_ERROR; return 0; @@ -179,30 +184,30 @@ dump_error(void) *------------------------------------------------------------------------- */ herr_t -custom_print_cb(int n, H5E_error_t *err_desc, void* client_data) +custom_print_cb(unsigned n, const H5E_error1_t *err_desc, void* client_data) { FILE *stream = (FILE *)client_data; - const char *maj; - const char *min; + char *maj; + char *min; const int indent = 4; - if((min = H5Eget_minor(err_desc->min_num))==NULL) + if(NULL == (min = H5Eget_minor(err_desc->min_num))) TEST_ERROR; - if((maj = H5Eget_major(err_desc->maj_num))==NULL) + if(NULL == (maj = H5Eget_major(err_desc->maj_num))) TEST_ERROR; - fprintf (stream, "%*serror #%03d: %s in %s(): line %u\n", + fprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", indent, "", n, err_desc->file_name, err_desc->func_name, err_desc->line); - fprintf (stream, "%*smajor: %s\n", indent*2, "", maj); + fprintf(stream, "%*smajor: %s\n", indent*2, "", maj); HDfree(maj); fprintf (stream, "%*sminor: %s\n", indent*2, "", min); HDfree(min); return 0; - error: +error: return -1; } @@ -230,29 +235,29 @@ main(void) fapl = h5_fileaccess(); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR ; /* Test error stack */ /* Push an error onto error stack */ - H5Epush(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADVALUE, + H5Epush1(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADVALUE, "Error test failed"); /* Print out the errors on stack */ dump_error(); /* Empty error stack */ - H5Eclear(); + H5Eclear1(); /* Test error API */ - if(test_error(file)<0) { - H5Epush(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADMESG, + if(test_error(file) < 0) { + H5Epush1(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADMESG, "Error test failed"); - H5Eprint(stderr); + H5Eprint1(stderr); } - if (H5Fclose(file)<0) TEST_ERROR ; + if(H5Fclose(file) < 0) TEST_ERROR ; h5_cleanup(FILENAME, fapl); printf("All error API tests passed.\n"); @@ -262,4 +267,5 @@ main(void) printf("***** ERROR TEST FAILED! *****\n"); return 1; } -#endif /*H5_WANT_H5_V1_6_COMPAT*/ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + diff --git a/test/error_test.c b/test/error_test.c index 7850ff1..3b3b617 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -21,13 +21,13 @@ */ #include "h5test.h" -#ifdef H5_WANT_H5_V1_6_COMPAT +#ifdef H5_USE_16_API int main(void) { printf("Test skipped because backward compatbility with v1.6 is configured in\n"); return 0; } -#else +#else /* H5_USE_16_API */ const char *FILENAME[] = { "errors", @@ -119,7 +119,7 @@ test_error(hid_t file) /* Create the dataset */ if((dataset = H5Dcreate(file, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT)) < 0) { - H5Epush2(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_CREATE, + H5Epush(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_CREATE, "H5Dcreate failed"); goto error; } /* end if */ @@ -129,15 +129,20 @@ test_error(hid_t file) TEST_ERROR; if(old_data != NULL) TEST_ERROR; - if(old_func != (H5E_auto2_t)H5Eprint2) +#ifdef H5_USE_16_API + if (old_func != (H5E_auto_t)H5Eprint) TEST_ERROR; +#else /* H5_USE_16_API */ + if (old_func != (H5E_auto2_t)H5Eprint2) + TEST_ERROR; +#endif /* H5_USE_16_API */ if(H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0) TEST_ERROR; /* Make H5Dwrite fail, verify default print is disabled */ if(H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) >= 0) { - H5Epush2(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE, + H5Epush(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE, "H5Dwrite shouldn't succeed"); goto error; } /* end if */ @@ -147,7 +152,7 @@ test_error(hid_t file) /* Test saving and restoring the current error stack */ if(H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) < 0) { - H5Epush2(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE, + H5Epush(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE, "H5Dwrite failed as supposed to"); estack_id = H5Eget_current_stack(); H5Dclose(dataset); @@ -263,7 +268,7 @@ error_stack(void) /* Make it push error, force this function to fail */ if((err_num = H5Eget_num(ERR_STACK)) == 0) { - H5Epush2(ERR_STACK, __FILE__, FUNC_error_stack, __LINE__, ERR_CLS, ERR_MAJ_API, ERR_MIN_GETNUM, + H5Epush(ERR_STACK, __FILE__, FUNC_error_stack, __LINE__, ERR_CLS, ERR_MAJ_API, ERR_MIN_GETNUM, "Get number test failed, returned %d", err_num); goto error; } /* end if */ @@ -341,7 +346,7 @@ test_long_desc(void) if(H5Eclear2(H5E_DEFAULT) < 0) TEST_ERROR; /* Push an error with a long description */ - if(H5Epush2(H5E_DEFAULT, __FILE__, test_FUNC, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, format, long_desc) < 0) TEST_ERROR; + if(H5Epush(H5E_DEFAULT, __FILE__, test_FUNC, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, format, long_desc) < 0) TEST_ERROR; /* Create the string that should be in the description */ HDsnprintf(full_desc, LONG_DESC_SIZE + 128, format, long_desc); @@ -518,7 +523,7 @@ main(void) /* Test error stack */ if(error_stack() < 0) { /* Push an error onto error stack */ - if(H5Epush2(ERR_STACK, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_ERRSTACK, + if(H5Epush(ERR_STACK, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_ERRSTACK, "Error stack test failed") < 0) TEST_ERROR; /* Delete an error from the top of error stack */ @@ -536,7 +541,7 @@ main(void) /* Test error API */ if(test_error(file) < 0) { - H5Epush2(H5E_DEFAULT, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, + H5Epush(H5E_DEFAULT, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "Error test failed, %s", "it's wrong"); estack_id = H5Eget_current_stack(); H5Eprint2(estack_id, stderr); @@ -560,5 +565,5 @@ error: printf("***** ERROR TEST FAILED! *****\n"); return 1; } -#endif /*H5_WANT_H5_V1_6_COMPAT*/ +#endif /* H5_USE_16_API */ diff --git a/test/h5test.c b/test/h5test.c index 31ad231..2eb87c1 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -113,7 +113,7 @@ static herr_t h5_errors(void UNUSED *client_data) { H5_FAILED(); - H5Eprint(stdout); + H5Eprint2(H5E_DEFAULT, stdout); return 0; } @@ -215,7 +215,7 @@ h5_reset(void) HDfflush(stdout); HDfflush(stderr); H5close(); - H5Eset_auto(h5_errors, NULL); + H5Eset_auto2(H5E_DEFAULT, h5_errors, NULL); /* * Cause the library to emit some diagnostics early so they don't diff --git a/test/testerror.sh b/test/testerror.sh deleted file mode 100644 index 93b49e9..0000000 --- a/test/testerror.sh +++ /dev/null @@ -1,107 +0,0 @@ -#! /bin/sh -# -# Copyright by The HDF Group. -# Copyright by the Board of Trustees of the University of Illinois. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. -# -# Tests for test_error and err_compat - -CMP='cmp -s' -DIFF='diff -c' - -nerrors=0 -verbose=yes - -# The build (current) directory might be different than the source directory. -if test -z "$srcdir"; then - srcdir=. -fi - -test -d ./testfiles || mkdir ./testfiles - -# Print a line-line message left justified in a field of 70 characters -# beginning with the word "Testing". -# -TESTING() { - SPACES=" " - echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' -} - -# Run a test and print PASS or *FAIL*. If a test fails then increment -# the `nerrors' global variable and (if $verbose is set) display the -# difference between the actual output and the expected output. The -# expected output is given as the first argument to this function and -# the actual output file is calculated by replacing the `.ddl' with -# `.out'. The actual output is not removed if $HDF5_NOCLEANUP has a -# non-zero value. -# -TEST() { - TEST_ERR=$1 # The test name - TEST_ERR_BIN=`pwd`/$TEST_ERR # The path of the test binary - - expect1="$srcdir/testfiles/$1_1" - expect2="$srcdir/testfiles/$1_2" - actual="./`basename $1`.out" - actual_err="./`basename $1`.err" - actual_ext="./`basename $1`.ext" - shift - - # Run test. - TESTING $TEST_ERR - ( - echo "#############################" - echo "Expected output for $TEST_ERR" - echo "#############################" - $RUNSERIAL $TEST_ERR_BIN - ) >$actual 2>$actual_err - # Extract file name, line number, version and thread IDs because they may be different - sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ - -e 's/line [0-9]*/line (number)/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ - $actual_err > $actual_ext - cat $actual_ext >> $actual - - if $CMP $expect1 $actual; then - echo " PASSED" - elif $CMP $expect2 $actual; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected result differs from actual result" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect1 $actual |sed 's/^/ /' - fi - - # Clean up output file - if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_ext - fi -} - -############################################################################## -############################################################################## -### T H E T E S T S ### -############################################################################## -############################################################################## - -# test for err_compat -TEST err_compat - -# test for error_test -TEST error_test - -if test $nerrors -eq 0 ; then - echo "All Error API tests passed." -fi - -exit $nerrors diff --git a/test/testerror.sh.in b/test/testerror.sh.in new file mode 100644 index 0000000..7f9657a --- /dev/null +++ b/test/testerror.sh.in @@ -0,0 +1,120 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# +# Tests for test_error and err_compat + +# Determine backward compatibility options eneabled +DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@" + +CMP='cmp -s' +DIFF='diff -c' + +nerrors=0 +verbose=yes + +# The build (current) directory might be different than the source directory. +if test -z "$srcdir"; then + srcdir=. +fi + +test -d ./testfiles || mkdir ./testfiles + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# Run a test and print PASS or *FAIL*. If a test fails then increment +# the `nerrors' global variable and (if $verbose is set) display the +# difference between the actual output and the expected output. The +# expected output is given as the first argument to this function and +# the actual output file is calculated by replacing the `.ddl' with +# `.out'. The actual output is not removed if $HDF5_NOCLEANUP has a +# non-zero value. +# +TEST() { + TEST_ERR=$1 # The test name + TEST_ERR_BIN=`pwd`/$TEST_ERR # The path of the test binary + + expect1="$srcdir/testfiles/$1_1" + expect2="$srcdir/testfiles/$1_2" + actual="./`basename $1`.out" + actual_err="./`basename $1`.err" + actual_ext="./`basename $1`.ext" + shift + + # Run test. + TESTING $TEST_ERR + ( + echo "#############################" + echo "Expected output for $TEST_ERR" + echo "#############################" + $RUNSERIAL $TEST_ERR_BIN + ) >$actual 2>$actual_err + # Extract file name, line number, version and thread IDs because they may be different + sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + $actual_err > $actual_ext + cat $actual_ext >> $actual + + if $CMP $expect1 $actual; then + echo " PASSED" + elif $CMP $expect2 $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect1 $actual |sed 's/^/ /' + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err $actual_ext + fi +} + +# Print a "SKIP" message +SKIP() { + TESTING $@ + echo " -SKIP-" +} + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## + +# test for err_compat +if test $DEPRECATED_SYMBOLS != "yes"; then +SKIP err_compat +else +TEST err_compat +fi + +# test for error_test +TEST error_test + +if test $nerrors -eq 0 ; then + echo "All Error API tests passed." +fi + +exit $nerrors diff --git a/test/testframe.c b/test/testframe.c index 88f9a06..dd2f2f4 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -135,7 +135,7 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p * half the functions this test calls are private, so automatic error * reporting wouldn't do much good since it's triggered at the API layer. */ - H5Eset_auto(NULL, NULL); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); /* * Record the program name and private routines if provided. diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index 0af179a..d21da90 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -504,7 +504,7 @@ main(int argc, char *argv[]) /* Check for an error when dumping information */ if(status < 0) { fprintf(stderr, "An error occurred!\n"); - H5Eprint(stderr); + H5Eprint2(H5E_DEFAULT, stderr); HDexit(5); } /* end if */ -- cgit v0.12