error.h

00001 /********************************************************************
00002  *
00003  *  This library is free software; you can redistribute it and/or
00004  *  modify it under the terms of the GNU Lesser General Public
00005  *  License as published by the Free Software Foundation; either
00006  *  version 2.1 of the License, or (at your option) any later version.
00007  *
00008  *  This library is distributed in the hope that it will be useful,
00009  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011  *  Lesser General Public License for more details.
00012  *
00013  *  You should have received a copy of the GNU Lesser General Public
00014  *  License along with this library; if not, write to the Free Software
00015  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00016  *
00017  ********************************************************************/
00018 
00019 /***************************************************************************
00020  * Desc: Error handling macros
00021  * Author: Andrew Howard
00022  * Date: 13 May 2002
00023  * CVS: $Id: error.h 4419 2008-03-16 08:41:58Z thjc $
00024  **************************************************************************/
00025 
00026 #ifndef ERROR_HH
00027 #define ERROR_HH
00028 
00029 #include <stdio.h>
00030 #include <errno.h>
00031 
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif
00035 
00037 void ErrorInit(int _msgLevel);
00038 
00041 void DefaultErrorPrint(int msgType, int level, const char *file, int line, const char *fmt, ...);
00042 
00043 extern void (*ErrorPrint)(int msgType, int level, const char *file, int line, const char *fmt, ...);
00044 extern int msgLevel;
00045 
00046 // File for logging messages
00047 extern FILE *msgFile;
00048 
00049 #ifdef __cplusplus
00050 }
00051 #endif
00052 
00053 
00055 #define PLAYER_ERR_ERR 0
00056 #define PLAYER_ERR_WARN 1
00057 #define PLAYER_ERR_MSG 2
00058 #define PLAYER_ERR_DBG 2
00059 
00063 
00064 #define PLAYER_ERROR(msg)         ErrorPrint(PLAYER_ERR_ERR, 0, __FILE__, __LINE__, "error   : " msg "\n")
00065 #define PLAYER_ERROR1(msg, a)     ErrorPrint(PLAYER_ERR_ERR, 0, __FILE__, __LINE__, "error   : " msg "\n", a)
00066 #define PLAYER_ERROR2(msg, a, b)  ErrorPrint(PLAYER_ERR_ERR, 0, __FILE__, __LINE__, "error   : " msg "\n", a, b)
00067 #define PLAYER_ERROR3(msg, a, b, c)  ErrorPrint(PLAYER_ERR_ERR, 0, __FILE__, __LINE__,  "error   : " msg "\n", a, b, c)
00068 #define PLAYER_ERROR4(msg, a, b, c,d)  ErrorPrint(PLAYER_ERR_ERR, 0, __FILE__, __LINE__,  "error   : " msg "\n", a, b, c, d)
00069 
00071 #define PLAYER_WARN(msg)        ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n")
00072 #define PLAYER_WARN1(msg, a)    ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n", a)
00073 #define PLAYER_WARN2(msg, a, b) ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n", a, b)
00074 #define PLAYER_WARN3(msg, a, b, c) ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n", a, b, c)
00075 #define PLAYER_WARN4(msg, a, b, c, d) ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n", a, b, c, d)
00076 #define PLAYER_WARN5(msg, a, b, c, d, e) ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n", a, b, c, d, e)
00077 #define PLAYER_WARN6(msg, a, b, c, d, e, f) ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n", a, b, c, d, e, f)
00078 #define PLAYER_WARN7(msg, a, b, c, d, e, f, g) ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n", a, b, c, d, e, f, g)
00079 
00087 #define PLAYER_MSG0(level, msg) ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n") 
00088 #define PLAYER_MSG1(level, msg, a) ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n", a) 
00089 #define PLAYER_MSG2(level, msg, a, b)  ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n", a, b)
00090 #define PLAYER_MSG3(level, msg, a, b, c) ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n", a, b, c)
00091 #define PLAYER_MSG4(level, msg, a, b, c, d) ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n", a, b, c, d)
00092 #define PLAYER_MSG5(level, msg, a, b, c, d, e) ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n", a, b, c, d, e)
00093 #define PLAYER_MSG6(level, msg, a, b, c, d, e, f) ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n", a, b, c, d, e, f)
00094 #define PLAYER_MSG7(level, msg, a, b, c, d, e, f, g) ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n", a, b, c, d, e, f, g)
00095 
00098 #endif

Last updated 12 September 2005 21:38:45