diff options
author | Bill Wendling <wendling@ncsa.uiuc.edu> | 2000-09-19 20:06:49 (GMT) |
---|---|---|
committer | Bill Wendling <wendling@ncsa.uiuc.edu> | 2000-09-19 20:06:49 (GMT) |
commit | 8055378bcecfc77af85b2bb07e7904edc9492789 (patch) | |
tree | 01c100c34cd727b9dc15ae21c89b6e0dfa361303 /fortran/src/H5Ef.c | |
parent | 8272da0b67a9ef3a7299fd10cc5f3ccbf80cbeae (diff) | |
download | hdf5-8055378bcecfc77af85b2bb07e7904edc9492789.zip hdf5-8055378bcecfc77af85b2bb07e7904edc9492789.tar.gz hdf5-8055378bcecfc77af85b2bb07e7904edc9492789.tar.bz2 |
[svn-r2576] Purpose:
Adding the Fortran interface to the HDF5 library
Description:
Fortran is now a subdirectory of the HDF5 library tree.
Platforms tested:
Solaris and IRIX (O2K)
Diffstat (limited to 'fortran/src/H5Ef.c')
-rw-r--r-- | fortran/src/H5Ef.c | 169 |
1 files changed, 169 insertions, 0 deletions
diff --git a/fortran/src/H5Ef.c b/fortran/src/H5Ef.c new file mode 100644 index 0000000..0ae4255 --- /dev/null +++ b/fortran/src/H5Ef.c @@ -0,0 +1,169 @@ +#include "H5f90.h" + + +/*---------------------------------------------------------------------------- + * Name: h5eclear_c + * Purpose: Call H5Eclear to clear the error stack for the current thread + * Inputs: + * Outputs: + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, March 29, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5eclear_c( ) +{ + int ret_val = -1; + herr_t status; + + /* + * Call H5Eclear function. + */ + status = H5Eclear(); + if(status < 0) return ret_val; + ret_val = 0; + return ret_val; +} + +/*---------------------------------------------------------------------------- + * Name: h5eprint_c1 + * Purpose: Call H5Eprint to print the error stack in a default manner. + * Inputs: name - file name + * namelen - length of name + * Outputs: + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, March 29, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5eprint_c1(_fcd name, int_f* namelen) +{ + int ret_val = -1; + herr_t status; + FILE * file; + char* c_name; + int c_namelen; + c_namelen = *namelen; + c_name = (char*)HD5f2cstring(name, c_namelen); + file = fopen(c_name, "w"); + + /* + * Call H5Eprint function. + */ + status = H5Eprint(file); + if(status < 0) return ret_val; + ret_val = 0; + return ret_val; +} + + +/*---------------------------------------------------------------------------- + * Name: h5eprint_c2 + * Purpose: Call H5Eprint to print the error stack to stderr + * in a default manner. + * Inputs: + * Outputs: + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, March 29, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5eprint_c2() +{ + int ret_val = -1; + herr_t status; + + /* + * Call H5Eprint function. + */ + status = H5Eprint(NULL); + if(status < 0) return ret_val; + ret_val = 0; + return ret_val; +} + +/*---------------------------------------------------------------------------- + * Name: h5eget_major_c + * Purpose: Call H5Eget_major to get a character string + * describing an error specified by a major error number. + * Inputs: error_no - Major error number + * Outputs: name - character string describing the error + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, March 29, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5eget_major_c(int_f* error_no, _fcd name) +{ + int ret_val = -1; + const char* c_name; + H5E_major_t c_error_no; + c_error_no = (H5E_major_t)*error_no; + + /* + * Call H5Eget_major function. + */ + c_name = H5Eget_major(c_error_no); + HDpackFstring((char*)c_name, _fcdtocp(name), strlen(c_name)); + + if(!strcmp(c_name, "Invalid major error number")) return ret_val; + ret_val = 0; + return ret_val; +} + +/*---------------------------------------------------------------------------- + * Name: h5eget_minor_c + * Purpose: Call H5Eget_minor to get a character string + * describing an error specified by a minor error number. + * Inputs: error_no - Major error number + * Outputs: name - character string describing the error + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, March 29, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5eget_minor_c(int_f* error_no, _fcd name) +{ + int ret_val = -1; + const char* c_name; + H5E_minor_t c_error_no; + c_error_no = (H5E_minor_t)*error_no; + + /* + * Call H5Eget_minor function. + */ + c_name = H5Eget_minor(c_error_no); + HDpackFstring((char*)c_name, _fcdtocp(name), strlen(c_name)); + + if(!strcmp(c_name, "Invalid minor error number")) return ret_val; + ret_val = 0; + return ret_val; +} + +/*---------------------------------------------------------------------------- + * Name: h5eset_auto_c + * Purpose: Call H5Eset_auto to turn automatic error printing on or off. + * Inputs: printflag - flag to turn automatic error printing on or off. + * Outputs: + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, March 29, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5eset_auto_c(int_f* printflag) +{ + int ret_val = -1; + herr_t status; + + if (*printflag == 1) + status = H5Eset_auto((H5E_auto_t)H5Eprint, stderr); + if (status >= 0) ret_val = 0; + return ret_val; +} |