error.h

00001 
00002 /***************************************************************************
00003  * Desc: Error handling macros
00004  * Author: Andrew Howard
00005  * Date: 13 May 2002
00006  * CVS: $Id: error.h,v 1.5 2005/11/15 17:23:58 gerkey Exp $
00007  **************************************************************************/
00008 
00009 #ifndef ERROR_HH
00010 #define ERROR_HH
00011 
00012 #include <stdio.h>
00013 #include <errno.h>
00014 
00015 #ifdef __cplusplus
00016 extern "C" {
00017 #endif
00018 
00020 void ErrorInit(int _msgLevel);
00021 
00024 void ErrorPrint(int msgType, int level, const char *file, int line, const char *fmt, ...);
00025 
00026 #ifdef __cplusplus
00027 }
00028 #endif
00029 
00030 
00032 #define PLAYER_ERR_ERR 0
00033 #define PLAYER_ERR_WARN 1
00034 #define PLAYER_ERR_MSG 2
00035 #define PLAYER_ERR_DBG 2
00036 
00040 
00041 #define PLAYER_ERROR(msg)         ErrorPrint(PLAYER_ERR_ERR, 0, __FILE__, __LINE__, "error   : " msg "\n")
00042 #define PLAYER_ERROR1(msg, a)     ErrorPrint(PLAYER_ERR_ERR, 0, __FILE__, __LINE__, "error   : " msg "\n", a)
00043 #define PLAYER_ERROR2(msg, a, b)  ErrorPrint(PLAYER_ERR_ERR, 0, __FILE__, __LINE__, "error   : " msg "\n", a, b)
00044 #define PLAYER_ERROR3(msg, a, b, c)  ErrorPrint(PLAYER_ERR_ERR, 0, __FILE__, __LINE__,  "error   : " msg "\n", a, b, c)
00045 #define PLAYER_ERROR4(msg, a, b, c,d)  ErrorPrint(PLAYER_ERR_ERR, 0, __FILE__, __LINE__,  "error   : " msg "\n", a, b, c, d)
00046 
00048 #define PLAYER_WARN(msg)        ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n")
00049 #define PLAYER_WARN1(msg, a)    ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n", a)
00050 #define PLAYER_WARN2(msg, a, b) ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n", a, b)
00051 #define PLAYER_WARN3(msg, a, b, c) ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n", a, b, c)
00052 #define PLAYER_WARN4(msg, a, b, c, d) ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n", a, b, c, d)
00053 #define PLAYER_WARN5(msg, a, b, c, d, e) ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n", a, b, c, d, e)
00054 #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)
00055 #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)
00056 
00064 #define PLAYER_MSG0(level, msg) ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n") 
00065 #define PLAYER_MSG1(level, msg, a) ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n", a) 
00066 #define PLAYER_MSG2(level, msg, a, b)  ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n", a, b)
00067 #define PLAYER_MSG3(level, msg, a, b, c) ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n", a, b, c)
00068 #define PLAYER_MSG4(level, msg, a, b, c, d) ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n", a, b, c, d)
00069 #define PLAYER_MSG5(level, msg, a, b, c, d, e) ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n", a, b, c, d, e)
00070 #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)
00071 #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)
00072 
00075 #endif

Last updated 12 September 2005 21:38:45