gpp4 1.3.1

src/ccp4_errno.h

Go to the documentation of this file.
00001 /*
00002      ccp4_errno.h: Header file for error handling routines
00003      Copyright (C) 2001  CCLRC, Charles Ballard and Martyn Winn
00004 
00005      This library is free software: you can redistribute it and/or
00006      modify it under the terms of the GNU Lesser General Public
00007      License as published by the Free Software Foundation, either
00008      version 3 of the License, or (at your option) any later version.
00009 
00010      This library is distributed in the hope that it will be useful,
00011      but WITHOUT ANY WARRANTY; without even the implied warranty of
00012      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013      Lesser General Public License for more details.
00014 
00015      You should have received a copy of the GNU Lesser General Public
00016      License along with This library.  If not, see
00017      <http://www.gnu.org/licenses/>.
00018 
00019 */
00026 #ifndef __CCP4_ERROR_GUARD
00027 #define __CCP4_ERROR_GUARD
00028 
00029 #include <errno.h>
00030 
00031 
00032 #ifndef CCP4_ERRSYSTEM
00033 #define CCP4_ERRSYSTEM(x) (((x)&0xfff)<<24)
00034 #endif
00035 #ifndef CCP4_ERRLEVEL
00036 #define CCP4_ERRLEVEL(x)  (((x)&0xf)<<16)
00037 #endif
00038 #ifndef CCP4_ERRSETLEVEL
00039 #define CCP4_ERRSETLEVEL(y,x) ((y) & (~CCP4_ERRLEVEL(0xf)) | CCP4_ERRLEVEL(x)))
00040 #endif
00041 #ifndef CCP4_ERRGETSYS   
00042 #define CCP4_ERRGETSYS(x)   (((x)>>24)&0xfff)
00043 #endif
00044 #ifndef CCP4_ERRGETLEVEL
00045 #define CCP4_ERRGETLEVEL(x) (((x)>>16)&0xf)
00046 #endif
00047 #ifndef CCP4_ERRGETCODE
00048 #define CCP4_ERRGETCODE(x)  ((x)&0xffff)
00049 #endif
00050 
00051 #define CCP4_ERR_SYS CCP4_ERRSYSTEM(0x0)
00052 #define CCP4_ERR_FILE CCP4_ERRSYSTEM(0x1)
00053 #define CCP4_ERR_COORD CCP4_ERRSYSTEM(0x2)
00054 #define CCP4_ERR_MTZ CCP4_ERRSYSTEM(0x3)
00055 #define CCP4_ERR_MAP CCP4_ERRSYSTEM(0x4)
00056 #define CCP4_ERR_UTILS CCP4_ERRSYSTEM(0x5)
00057 #define CCP4_ERR_PARS CCP4_ERRSYSTEM(0x6)
00058 #define CCP4_ERR_SYM CCP4_ERRSYSTEM(0x7)
00059 #define CCP4_ERR_GEN CCP4_ERRSYSTEM(0x8)
00060 
00061 #define CCP4_COUNT(x) sizeof(x)/sizeof(x[0])
00062 
00092 #ifdef __cplusplus
00093 extern "C" {
00094 #endif
00095 extern int ccp4_errno;
00096 #ifdef __cplusplus
00097 }
00098 #endif
00099 
00100 #ifdef __cplusplus
00101 namespace CCP4 {
00102 extern "C" {
00103 #endif
00104 
00111 void ccp4_error( const char *);
00112 
00120 const char *ccp4_strerror( int);
00121 
00126 void ccp4_fatal(const char *);
00127 
00141 int ccp4_liberr_verbosity(int iverb);
00142 
00157 void ccp4_signal(const int, const char *const, void (*)());
00158 
00159 int cfile_perror(const char *);
00160 
00161 #ifdef __cplusplus
00162 }
00163 }
00164 #endif
00165 
00166 #endif  
00168 /*
00169   Local variables:
00170   mode: font-lock
00171   End:
00172 */