00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __kb_error__
00012 #define __kb_error__
00013
00014 #ifdef __cplusplus
00015 extern "C" {
00016 #endif
00017
00018
00019 #define KB_ERROR(f,e,...) kb_error( __FILE__ , __LINE__ , f , e , ##__VA_ARGS__ )
00020
00021 #define KB_FATAL(f,e,...) kb_fatal( __FILE__ , __LINE__ , f , e , ##__VA_ARGS__ )
00022
00023 #define KB_DEBUG(f,e,m,...) kb_debug( __FILE__ , __LINE__ , f , e , m , ##__VA_ARGS__ )
00024
00025
00026
00027
00028 #define KB_EXIT_ON_ERROR 200
00030
00031
00032
00033 #define KB_ERROR_NOMEM 0
00034 #define KB_ERROR_TOOMANYARGS 1
00035 #define KB_ERROR_OUTOFRANGE 2
00036 #define KB_ERROR_INVAL 3
00037 #define KB_ERROR_UNKCMD 4
00038 #define KB_ERROR_INVALID 5
00039 #define KB_ERROR_SYMDEF 6
00040 #define KB_ERROR_UNKDEVCLASS 7
00041 #define KB_ERROR_DEVCLASSUSED 8
00042 #define KB_ERROR_INVNUM 9
00043 #define KB_ERROR_FILEOPEN 10
00044 #define KB_ERROR_NOBUSFOUND 11
00045 #define KB_ERROR_INVORDER 12
00046 #define KB_ERROR_EXCLACCESS 13
00047 #define KB_ERROR_DEVICEINUSE 14
00048 #define KB_ERROR_UNLINKDEV 15
00049 #define KB_ERROR_OPENBUS 16
00050 #define KB_ERROR_SCANBUS 17
00051 #define KB_ERROR_NODEVFOUND 18
00052 #define KB_ERROR_OPENDIR 19
00053 #define KB_ERROR_NODEVFOUNDSTR 20
00054 #define KB_ERROR_SYMNOTDEF 21
00055 #define KB_ERROR_NOSECTION 22
00056 #define KB_ERROR_CMDARGMIN 23
00057 #define KB_ERROR_CMDARGMAX 24
00058 #define KB_ERROR_UNKBUS 25
00059 #define KB_ERROR_NOBUSADDR 26
00060 #define KB_ERROR_NOMODBUS 27
00061 #define KB_ERROR_INVNAME 28
00062 #define KB_ERROR_NOINIT 29
00063 #define KB_ERROR_DUPLEX 30
00064 #define KB_ERROR_FRAGMENT 31
00065 #define KB_ERROR_FRAGEXP 32
00066 #define KB_ERROR_IPTR 33
00067 #define KB_ERROR_OPTR 34
00068 #define KB_ERROR_PTHREAD 35
00069 #define KB_ERROR_BADSOUND 36
00070 #define KB_ERROR_MMAP 37
00071 #define KB_ERROR_OPENLRF 38
00072 #define KB_ERROR_LRFDATA2BIG 39
00073 #define KB_ERROR_LRFNOSTX 40
00074 #define KB_ERROR_LRFNOETX 41
00075 #define KB_ERROR_LRFWRONGSTX 42
00076 #define KB_ERROR_LRFWRONGETX 43
00077 #define KB_ERROR_LRFNODATA 44
00078 #define KB_ERROR_LRFWRONGCRC 45
00079 #define KB_ERROR_LRFSENDDATA 46
00080 #define KB_ERROR_LRFNOCERT 47
00081 #define KB_ERROR_LRFCMDTX 48
00082 #define KB_ERROR_LRFDISTRX 49
00083 #define KB_ERROR_LRFDATARX 50
00084 #define KB_ERROR_KH3SZFMTERR 51
00085 #define KB_ERROR_KH3FRMSZERR 52
00086 #define KB_ERROR_KH3FRMSNDERR 53
00087 #define KB_ERROR_KH3KBINIT 54
00088
00089
00090
00091 #define KB_WARN_CONFIG_FILE 0
00092 #define KB_WARN_OPENDIR 1
00093 #define KB_WARN_CONNECT 2
00094 #define KB_WARN_SOUNDIO 3
00095 #define KB_WARN_SOUNDSAMPLE 4
00096
00097
00098
00099
00100
00101
00102
00103
00104
00106 typedef void (*kb_error_handler_t)( const char * ,
00107 unsigned int ,
00108 const char * ,
00109 unsigned int ,
00110 va_list );
00111
00113 typedef void (*kb_warning_handler_t)( unsigned int , va_list );
00114
00115
00116
00117
00118 extern void kb_set_debug_level( unsigned int level );
00119
00120 extern void kb_set_error_handler( kb_error_handler_t handler );
00121
00122 extern void kb_vmsg( const char * msg , va_list argptr );
00123
00124 extern void kb_msg( const char * msg , ... );
00125
00126 extern int kb_vdebug( const char * file ,
00127 unsigned int line ,
00128 const char * func ,
00129 unsigned int level ,
00130 const char * msg ,
00131 va_list argptr );
00132
00133 extern int kb_debug( const char * file ,
00134 unsigned int line ,
00135 const char * func ,
00136 unsigned int level ,
00137 const char * msg ,
00138 ... );
00139
00140 extern int kb_verror( const char * file ,
00141 unsigned int line ,
00142 const char * func ,
00143 unsigned int error , va_list argptr );
00144
00145 extern int kb_error( const char * file ,
00146 unsigned int line ,
00147 const char * func ,
00148 unsigned int error , ... );
00149
00150 extern int kb_vwarning( unsigned int error , va_list argptr );
00151
00152 extern int kb_warning( unsigned int error , ... );
00153
00154 extern void kb_fatal( const char * file ,
00155 unsigned int line ,
00156 const char * func ,
00157 unsigned int error ,
00158 ... );
00159
00160 extern const char * kb_errmsg [];
00161 extern const char * kb_warnmsg [];
00162
00163 extern unsigned int kb_debug_level;
00164
00165 #ifdef __cplusplus
00166 }
00167 #endif
00168
00169 #endif