From 693c9ff72b4ced48102f3e67250a8499ba52391c Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 14 Feb 2008 15:37:42 +0000 Subject: [PATCH] src/h5/h5_private.h - include of "errorhandling_private.h" added - macros "CHECK_FILEHANDLE", "CHECK_WRITABLE_MODE", "CHECK_READONLY_MODE" and "CHECK_TIMEGROUP" added --- src/h5/h5_private.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) 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