Main Page   Compound List   File List   Compound Members   File Members   Related Pages  

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 and is distributed under the terms and
00006      conditions of the CCP4 licence agreement as `Part 0' (Annex 2)
00007      software, which is version 2.1 of the GNU Lesser General Public
00008      Licence (LGPL) with the following additional clause:
00009 
00010         `You may also combine or link a "work that uses the Library" to
00011         produce a work containing portions of the Library, and distribute
00012         that work under terms of your choice, provided that you give
00013         prominent notice with each copy of the work that the specified
00014         version of the Library is used in it, and that you include or
00015         provide public access to the complete corresponding
00016         machine-readable source code for the Library including whatever
00017         changes were used in the work. (i.e. If you make changes to the
00018         Library you must distribute those, but you do not need to
00019         distribute source or object code to those portions of the work
00020         not covered by this licence.)'
00021 
00022      Note that this clause grants an additional right and does not impose
00023      any additional restriction, and so does not affect compatibility
00024      with the GNU General Public Licence (GPL). If you wish to negotiate
00025      other terms, please contact the maintainer.
00026 
00027      You can redistribute it and/or modify the library under the terms of
00028      the GNU Lesser General Public License as published by the Free Software
00029      Foundation; either version 2.1 of the License, or (at your option) any
00030      later version.
00031 
00032      This library is distributed in the hope that it will be useful, but
00033      WITHOUT ANY WARRANTY; without even the implied warranty of
00034      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00035      Lesser General Public License for more details.
00036 
00037      You should have received a copy of the CCP4 licence and/or GNU
00038      Lesser General Public License along with this library; if not, write
00039      to the CCP4 Secretary, Daresbury Laboratory, Warrington WA4 4AD, UK.
00040      The GNU Lesser General Public can also be obtained by writing to the
00041      Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00042      MA 02111-1307 USA
00043 */
00049 #ifndef __CCP4_ERROR_GUARD
00050 #define __CCP4_ERROR_GUARD
00051 
00052 #include <errno.h>
00053 
00054 static char rcsidhe[] = "$Id: ccp4__errno_8h-source.html,v 1.8 2004/07/05 14:36:54 mdw Exp $";
00055 
00056 #ifndef CCP4_ERRSYSTEM
00057 #define CCP4_ERRSYSTEM(x) (((x)&0xfff)<<24)
00058 #endif
00059 #ifndef CCP4_ERRLEVEL
00060 #define CCP4_ERRLEVEL(x)  (((x)&0xf)<<16)
00061 #endif
00062 #ifndef CCP4_ERRSETLEVEL
00063 #define CCP4_ERRSETLEVEL(y,x) ((y) & (~CCP4_ERRLEVEL(0xf)) | CCP4_ERRLEVEL(x)))
00064 #endif
00065 #ifndef CCP4_ERRGETSYS   
00066 #define CCP4_ERRGETSYS(x)   (((x)>>24)&0xfff)
00067 #endif
00068 #ifndef CCP4_ERRGETLEVEL
00069 #define CCP4_ERRGETLEVEL(x) (((x)>>16)&0xf)
00070 #endif
00071 #ifndef CCP4_ERRGETCODE
00072 #define CCP4_ERRGETCODE(x)  ((x)&0xffff)
00073 #endif
00074 
00075 #define CCP4_ERR_SYS CCP4_ERRSYSTEM(0x0)
00076 #define CCP4_ERR_FILE CCP4_ERRSYSTEM(0x1)
00077 #define CCP4_ERR_COORD CCP4_ERRSYSTEM(0x2)
00078 #define CCP4_ERR_MTZ CCP4_ERRSYSTEM(0x3)
00079 #define CCP4_ERR_MAP CCP4_ERRSYSTEM(0x4)
00080 #define CCP4_ERR_UTILS CCP4_ERRSYSTEM(0x5)
00081 #define CCP4_ERR_PARS CCP4_ERRSYSTEM(0x6)
00082 #define CCP4_ERR_SYM CCP4_ERRSYSTEM(0x7)
00083 #define CCP4_ERR_GEN CCP4_ERRSYSTEM(0x8)
00084 
00085 #define CCP4_COUNT(x) sizeof(x)/sizeof(x[0])
00086 
00116 extern int ccp4_errno;
00117 
00118 #ifdef __cplusplus
00119 namespace CCP4 {
00120 extern "C" {
00121 #endif
00122 
00129 void ccp4_error( const char *);
00130 
00138 const char *ccp4_strerror( int);
00139 
00144 void ccp4_fatal(const char *);
00145 
00159 int ccp4_liberr_verbosity(int iverb);
00160 
00175 void ccp4_signal(const int, const char *const, void (*)());
00176 
00177 int cfile_perror(const char *);
00178 
00179 #ifdef __cplusplus
00180 }
00181 }
00182 #endif
00183 
00184 #endif