diff --git a/src/h5/h5_private.h b/src/h5/h5_private.h index aaa46f5..44e53dc 100644 --- a/src/h5/h5_private.h +++ b/src/h5/h5_private.h @@ -1,6 +1,8 @@ #ifndef __H5_PRIVATE_H #define __H5_PRIVATE_H +#include "errorhandling_private.h" + #define H5B_CONTAINER_GRPNAME "Block" #define H5T_CONTAINER_GRPNAME "Topo" @@ -13,4 +15,32 @@ #define H5BLOCK_GROUPNAME_BLOCK H5B_CONTAINER_GRPNAME +#define SET_FNAME( fname ) H5_set_funcname( fname ); + +#define CHECK_FILEHANDLE( f ) \ + if ( f == NULL ) \ + return HANDLE_H5_BADFD_ERR; + +#define CHECK_WRITABLE_MODE( f ) \ + if ( f->mode==H5PART_READ ) \ + return (*H5_get_errorhandler()) ( \ + H5_get_funcname(), \ + H5_ERR_INVAL, \ + "Attempting to write to read-only file" ); + +#define CHECK_READONLY_MODE( f ) \ + if ( ! f->mode==H5PART_READ ) \ + return (*H5_get_errorhandler()) ( \ + H5_get_funcname(), \ + H5_ERR_INVAL, \ + "Operation is not allowed on writable files." ); + +#define CHECK_TIMEGROUP( f ) \ + if ( f->step_gid <= 0 ) \ + return (*H5_get_errorhandler()) ( \ + H5_get_funcname(), \ + H5_ERR_INVAL, \ + "Internal error: step_gid <= 0."); + + #endif