sinfo_error.h

00001 /*
00002  * This file is part of the ESO SINFONI Pipeline
00003  * Copyright (C) 2004,2005 European Southern Observatory
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program 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
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA
00018  */
00019 
00020 /*
00021  * $Author: amodigli $
00022  * $Date: 2006/11/21 11:56:10 $
00023  * $Revision: 1.7 $
00024  * $Name:  $
00025  * $Log: sinfo_error.h,v $
00026  * Revision 1.7  2006/11/21 11:56:10  amodigli
00027  * replaced __func__ by cpl_func
00028  *
00029  * Revision 1.6  2006/10/16 07:26:23  amodigli
00030  * shortened line length
00031  *
00032  * Revision 1.5  2006/10/13 08:09:42  amodigli
00033  * shorten line length
00034  *
00035  * Revision 1.4  2006/10/13 06:34:40  amodigli
00036  * shorten line length
00037  *
00038  * Revision 1.3  2006/10/04 06:17:45  amodigli
00039  * added doxygen doc
00040  *
00041  * Revision 1.2  2006/07/31 06:33:34  amodigli
00042  * fixed  bug in ck0 macro
00043  *
00044  * Revision 1.1  2006/05/30 09:09:37  amodigli
00045  * added to repository
00046  *
00047  *
00048  */
00049 
00050 #ifndef SINFO_ERROR_H
00051 #define SINFO_ERROR_H
00052 
00057 /*-----------------------------------------------------------------------------
00058                  Includes
00059 -----------------------------------------------------------------------------*/
00060 #include <irplib_error.h>
00061 #include <cpl_error.h>
00062 /*-----------------------------------------------------------------------------
00063                              Defines
00064 -----------------------------------------------------------------------------*/
00065 /* To save some key-strokes, use the irplib error handling macros
00066    under different (shorter) names.
00067    Additionally, irplib macros require the VA_ARGS to be enclosed in (),
00068 */
00069 
00070 #define assure(BOOL, CODE, ...) \
00071   irplib_error_assure(BOOL, CODE, (__VA_ARGS__), goto cleanup)
00072 
00073 #define assure_nomsg(BOOL, CODE) \
00074   irplib_error_assure(BOOL, CODE, (" "), goto cleanup)
00075 
00076 
00077 #define ck0(IEXP, ...) \
00078   irplib_error_assure(IEXP == 0, CPL_ERROR_UNSPECIFIED, \
00079   (__VA_ARGS__), goto cleanup)
00080 
00081 #define ck0_nomsg(IEXP) ck0(IEXP," ")
00082 
00083 #define cknull(NULLEXP, ...) \
00084   irplib_error_assure((NULLEXP) != NULL, \
00085   CPL_ERROR_UNSPECIFIED, (__VA_ARGS__), goto cleanup)
00086 
00087 #define cknull_nomsg(NULLEXP) cknull(NULLEXP," ")
00088 
00089 #define  check(CMD, ...)                                                 \
00090   irplib_error_assure((sinfo_msg_softer(), (CMD), sinfo_msg_louder(),      \
00091               cpl_error_get_code() == CPL_ERROR_NONE),       \
00092                        cpl_error_get_code(), (__VA_ARGS__), goto cleanup)
00093 
00094 #define  check_nomsg(CMD) check(CMD, " ")
00095 
00096 #define passure(BOOL, ...)                                               \
00097   irplib_error_assure(BOOL, CPL_ERROR_UNSPECIFIED,                       \
00098                      ("Internal error. Please report to "                \
00099                       PACKAGE_BUGREPORT " " __VA_ARGS__), goto cleanup)
00100                        /*  Assumes that PACKAGE_BUGREPORT
00101                contains no formatting special characters  */
00102    
00103 #define sinfo_error_reset()   \
00104       irplib_error_reset()
00105 
00106 #define sinfo_error_dump()  \
00107       irplib_error_dump(CPL_MSG_ERROR, CPL_MSG_ERROR)
00108 
00392 #endif

Generated on Wed Jan 17 08:33:42 2007 for SINFONI Pipeline Reference Manual by  doxygen 1.4.4