00001 /* --------------------------------------------------------------------------- 00002 Phission : 00003 Realtime Vision Processing System 00004 00005 Copyright (C) 2003-2006 Philip D.S. Thoren (pthoren@cs.uml.edu) 00006 University of Massachusetts at Lowell, 00007 Laboratory for Artificial Intelligence and Robotics 00008 00009 This file is part of Phission. 00010 00011 Phission is free software; you can redistribute it and/or modify 00012 it under the terms of the GNU Lesser General Public License as published by 00013 the Free Software Foundation; either version 2 of the License, or 00014 (at your option) any later version. 00015 00016 Phission is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 GNU Lesser General Public License for more details. 00020 00021 You should have received a copy of the GNU Lesser General Public License 00022 along with Phission; if not, write to the Free Software 00023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00024 00025 ---------------------------------------------------------------------------*/ 00026 #ifndef _PHERROR_H 00027 #define _PHERROR_H 00028 00034 #include <phStandard.h> 00035 #include <phPrint.h> 00036 00037 /* ------------------------------------------------------------------------ */ 00047 #ifndef phVDK_ERROR_LOOKUP_TABLE 00048 #define phVDK_ERROR_LOOKUP_TABLE 1 00049 #endif 00050 00051 /* ------------------------------------------------------------------------ */ 00052 #ifdef __cplusplus 00053 extern "C" 00054 { 00055 #endif 00056 00064 typedef long ph_error; 00069 typedef char *ph_string; 00070 00084 PHAPI(void) phError( ph_string msg ); 00097 PHAPI(void) phErrorString( ph_error errnum, ph_string *buf ); 00098 00099 #ifdef __cplusplus 00100 } /* extern "C" { */ 00101 #endif 00102 00103 /* ---------------------------------------------------------------------- */ 00125 #define phDO_CHECK(rc,pmsg,fmt,action, ...) \ 00126 { \ 00127 if (rc < 0) \ 00128 { \ 00129 phERROR_PRINT(pmsg,"*** ERROR (rc:%d)*** " fmt "\n",\ 00130 rc, ## __VA_ARGS__ ); \ 00131 action; \ 00132 } \ 00133 } 00159 #define phCHECK_RC(rc,pmsg,fmt, ...) \ 00160 phDO_CHECK(rc,pmsg,fmt, goto error, ## __VA_ARGS__ ) 00161 00166 #define phBREAK_RC(rc,pmsg,fmt, ...) \ 00167 phDO_CHECK(rc,pmsg,fmt, break, ## __VA_ARGS__ ) 00168 00174 #define phCONT_RC(rc,pmsg,fmt, ...) \ 00175 phDO_CHECK(rc,pmsg,fmt, continue, ## __VA_ARGS__ ) 00176 00182 #define phPRINT_RC(rc,pmsg,fmt, ...) \ 00183 phDO_CHECK(rc,pmsg,fmt, , ## __VA_ARGS__ ) 00184 00185 /* ---------------------------------------------------------------------- */ 00189 #define phDO_CHECKPTR(ptr,pmsg,fmt,action, ...) \ 00190 { \ 00191 if (((void *)ptr) == NULL) \ 00192 { \ 00193 phERROR_PRINT(pmsg,"*** ERROR (ptr:%p)*** " fmt "\n",\ 00194 ptr, ## __VA_ARGS__ ); \ 00195 action; \ 00196 } \ 00197 } 00198 00199 #define phCHECK_PTR(ptr,pmsg,fmt, ...) \ 00200 phDO_CHECKPTR(ptr,pmsg,fmt, goto error, ## __VA_ARGS__ ) 00201 00202 #define phBREAK_PTR(ptr,pmsg,fmt, ...) \ 00203 phDO_CHECKPTR(ptr,pmsg,fmt, break, ## __VA_ARGS__ ) 00204 00205 #define phCONT_PTR(ptr,pmsg,fmt, ...) \ 00206 phDO_CHECKPTR(ptr,pmsg,fmt, continue, ## __VA_ARGS__ ) 00207 00208 #define phPRINT_PTR(ptr,pmsg,fmt, ...) \ 00209 phDO_CHECKPTR(ptr,pmsg,fmt, , ## __VA_ARGS__ ) 00210 00211 #define phCHECK_NULLPTR phCHECK_PTR 00212 00213 #define phBREAK_NULLPTR phBREAK_PTR 00214 00215 #define phCONT_NULLPTR phCONT_PTR 00216 00217 #define phPRINT_NULLPTR phPRINT_PTR 00218 00219 /* ---------------------------------------------------------------------- */ 00227 #define phTHISCHK() { phCHECK_NULLPTR(this,NULL,"this == NULL"); } 00228 /* End group ErrorCheckingMacros */ 00230 00231 #endif /* _PHERROR_H */
Copyright (C) 2002 - 2007 |
Philip D.S. Thoren ( pthoren@users.sourceforge.net ) University Of Massachusetts at Lowell Robotics Lab |