00001 /* 00002 * This file is part of the ESO UVES 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: 2007/06/06 08:17:33 $ 00023 * $Revision: 1.54 $ 00024 * $Name: uves-3_3_1 $ 00025 * $Log: uves_error.h,v $ 00026 * Revision 1.54 2007/06/06 08:17:33 amodigli 00027 * replace tab with 4 spaces 00028 * 00029 * Revision 1.53 2007/01/08 16:58:52 amodigli 00030 * added ck0 and cknull 00031 * 00032 * Revision 1.52 2006/11/06 15:19:41 jmlarsen 00033 * Removed unused include directives 00034 * 00035 * Revision 1.51 2006/08/17 13:56:52 jmlarsen 00036 * Reduced max line length 00037 * 00038 * Revision 1.50 2006/06/01 14:43:17 jmlarsen 00039 * Added missing documentation 00040 * 00041 * Revision 1.49 2006/05/05 13:54:11 jmlarsen 00042 * Added assure_mem 00043 * 00044 * Revision 1.48 2006/04/24 09:19:25 jmlarsen 00045 * Minor message change 00046 * 00047 * Revision 1.47 2006/04/06 08:31:52 jmlarsen 00048 * Dump trace on CPL_MSG_ERROR level 00049 * 00050 * Revision 1.46 2006/03/09 10:57:57 jmlarsen 00051 * Added check_nomsg macro 00052 * 00053 * Revision 1.45 2006/03/03 13:54:11 jmlarsen 00054 * Changed syntax of check macro 00055 * 00056 * Revision 1.44 2006/02/28 09:15:22 jmlarsen 00057 * Minor update 00058 * 00059 * Revision 1.43 2006/02/23 16:07:59 jmlarsen 00060 * Using irplib_assert_msg 00061 * 00062 * Revision 1.42 2006/02/21 14:26:54 jmlarsen 00063 * Minor changes 00064 * 00065 * Revision 1.41 2006/02/08 07:52:16 jmlarsen 00066 * Added function returning library version 00067 * 00068 * Revision 1.40 2006/02/03 07:46:30 jmlarsen 00069 * Moved recipe implementations to ./uves directory 00070 * 00071 * Revision 1.39 2006/01/24 07:49:31 jmlarsen 00072 * Removed spaces between backslash and newline 00073 * 00074 * Revision 1.38 2006/01/23 08:08:53 jmlarsen 00075 * Updated documentation 00076 * 00077 * Revision 1.37 2005/12/19 16:17:56 jmlarsen 00078 * Replaced bool -> int 00079 * 00080 */ 00081 00082 #ifndef UVES_ERROR_H 00083 #define UVES_ERROR_H 00084 00085 /*----------------------------------------------------------------------------*/ 00089 /*----------------------------------------------------------------------------*/ 00092 /*----------------------------------------------------------------------------- 00093 Includes 00094 -----------------------------------------------------------------------------*/ 00095 #include <uves_utils.h> 00096 #include <uves_msg.h> 00097 00098 #include <irplib_error.h> 00099 00100 #include <cpl_error.h> 00101 00102 /*----------------------------------------------------------------------------- 00103 Defines 00104 -----------------------------------------------------------------------------*/ 00105 /* To save some key-strokes, use the irplib error handling macros 00106 under different (shorter) names. 00107 Additionally, irplib macros require the VA_ARGS to be enclosed in (), 00108 */ 00109 00111 #define assure(BOOL, CODE, ...) \ 00112 irplib_error_assure(BOOL, CODE, (__VA_ARGS__), goto cleanup) 00113 00115 #define assure_nomsg(BOOL, CODE) \ 00116 irplib_error_assure(BOOL, CODE, (" "), goto cleanup) 00117 00119 #define assure_mem(PTR) \ 00120 irplib_error_assure((PTR) != NULL, CPL_ERROR_ILLEGAL_OUTPUT, \ 00121 ("Memory allocation failure!"), goto cleanup) 00122 #define ck0(IEXP, ...) \ 00123 irplib_error_assure(IEXP == 0, CPL_ERROR_UNSPECIFIED, \ 00124 (__VA_ARGS__), goto cleanup) 00125 00126 #define ck0_nomsg(IEXP) ck0(IEXP," ") 00127 00128 #define cknull(NULLEXP, ...) \ 00129 irplib_error_assure((NULLEXP) != NULL, \ 00130 CPL_ERROR_UNSPECIFIED, (__VA_ARGS__), goto cleanup) 00131 00132 #define cknull_nomsg(NULLEXP) cknull(NULLEXP," ") 00133 00134 00136 #define check(CMD, ...) \ 00137 irplib_error_assure((uves_msg_softer(), (CMD), uves_msg_louder(), \ 00138 cpl_error_get_code() == CPL_ERROR_NONE), \ 00139 cpl_error_get_code(), (__VA_ARGS__), goto cleanup) 00140 00142 #define check_nomsg(CMD) check(CMD, " ") 00143 00145 #define passure(BOOL, ...) \ 00146 irplib_error_assure(BOOL, CPL_ERROR_UNSPECIFIED, \ 00147 ("Internal error. Please report to " \ 00148 PACKAGE_BUGREPORT " " __VA_ARGS__), goto cleanup) 00149 /* Assumes that PACKAGE_BUGREPORT 00150 contains no formatting special characters */ 00151 00153 #define uves_error_reset() \ 00154 irplib_error_reset() 00155 00157 #define uves_error_dump() \ 00158 irplib_error_dump(CPL_MSG_ERROR, CPL_MSG_ERROR) 00159 00169 /*----------------------------------------------------------------------------*/ 00436 /*----------------------------------------------------------------------------*/ 00437 00438 #endif 00439 00440 00441 00442 00443 00444 00445 00446 00447 00448 00449 00450 00451 00452 00453 00454 00455 00456 00457 00458 00459 00460 00461
1.4.6