00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef ERROR_HH
00030 #define ERROR_HH
00031
00032 #include <stdio.h>
00033 #include <errno.h>
00034
00035 #include <playerconfig.h>
00036
00037 #if defined (WIN32)
00038 #if defined (PLAYER_STATIC)
00039 #define PLAYERERROR_EXPORT
00040 #elif defined (playererror_EXPORTS)
00041 #define PLAYERERROR_EXPORT __declspec (dllexport)
00042 #else
00043 #define PLAYERERROR_EXPORT __declspec (dllimport)
00044 #endif
00045 #else
00046 #define PLAYERERROR_EXPORT
00047 #endif
00048
00049 #ifdef __cplusplus
00050 extern "C" {
00051 #endif
00052
00054 PLAYERERROR_EXPORT void ErrorInit(int _msgLevel, FILE * logfile);
00055
00058 PLAYERERROR_EXPORT void DefaultErrorPrint(int msgType, int level, const char *file, int line, const char *fmt, ...);
00059
00060 PLAYERERROR_EXPORT extern void (*ErrorPrint)(int msgType, int level, const char *file, int line, const char *fmt, ...);
00061 PLAYERERROR_EXPORT extern int msgLevel;
00062
00063
00064 PLAYERERROR_EXPORT extern FILE *msgFile;
00065
00066 #ifdef __cplusplus
00067 }
00068 #endif
00069
00070
00072 #define PLAYER_ERR_ERR 0
00073 #define PLAYER_ERR_WARN 1
00074 #define PLAYER_ERR_MSG 2
00075 #define PLAYER_ERR_DBG 2
00076
00080
00081 #define PLAYER_ERROR(msg) ErrorPrint(PLAYER_ERR_ERR, 0, __FILE__, __LINE__, "error : " msg "\n")
00082 #define PLAYER_ERROR1(msg, a) ErrorPrint(PLAYER_ERR_ERR, 0, __FILE__, __LINE__, "error : " msg "\n", a)
00083 #define PLAYER_ERROR2(msg, a, b) ErrorPrint(PLAYER_ERR_ERR, 0, __FILE__, __LINE__, "error : " msg "\n", a, b)
00084 #define PLAYER_ERROR3(msg, a, b, c) ErrorPrint(PLAYER_ERR_ERR, 0, __FILE__, __LINE__, "error : " msg "\n", a, b, c)
00085 #define PLAYER_ERROR4(msg, a, b, c,d) ErrorPrint(PLAYER_ERR_ERR, 0, __FILE__, __LINE__, "error : " msg "\n", a, b, c, d)
00086 #define PLAYER_ERROR5(msg, a, b, c, d, e) ErrorPrint(PLAYER_ERR_ERR, 0, __FILE__, __LINE__, "error : " msg "\n", a, b, c, d, e)
00087
00089 #define PLAYER_WARN(msg) ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n")
00090 #define PLAYER_WARN1(msg, a) ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n", a)
00091 #define PLAYER_WARN2(msg, a, b) ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n", a, b)
00092 #define PLAYER_WARN3(msg, a, b, c) ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n", a, b, c)
00093 #define PLAYER_WARN4(msg, a, b, c, d) ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n", a, b, c, d)
00094 #define PLAYER_WARN5(msg, a, b, c, d, e) ErrorPrint(PLAYER_ERR_WARN, 0, __FILE__, __LINE__, "warning : " msg "\n", a, b, c, d, e)
00095 #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)
00096 #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)
00097
00105 #define PLAYER_MSG0(level, msg) ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n")
00106 #define PLAYER_MSG1(level, msg, a) ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n", a)
00107 #define PLAYER_MSG2(level, msg, a, b) ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n", a, b)
00108 #define PLAYER_MSG3(level, msg, a, b, c) ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n", a, b, c)
00109 #define PLAYER_MSG4(level, msg, a, b, c, d) ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n", a, b, c, d)
00110 #define PLAYER_MSG5(level, msg, a, b, c, d, e) ErrorPrint(PLAYER_ERR_MSG, level, __FILE__, __LINE__, "" msg "\n", a, b, c, d, e)
00111 #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)
00112 #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)
00113
00116 #endif