kb_error.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define KB_ERROR(f, e,...)   kb_error( __FILE__ , __LINE__ , f , e , ##__VA_ARGS__ )
#define KB_FATAL(f, e,...)   kb_fatal( __FILE__ , __LINE__ , f , e , ##__VA_ARGS__ )
#define KB_DEBUG(f, e, m,...)   kb_debug( __FILE__ , __LINE__ , f , e , m , ##__VA_ARGS__ )
#define KB_EXIT_ON_ERROR   200
#define KB_ERROR_NOMEM   0
#define KB_ERROR_TOOMANYARGS   1
#define KB_ERROR_OUTOFRANGE   2
#define KB_ERROR_INVAL   3
#define KB_ERROR_UNKCMD   4
#define KB_ERROR_INVALID   5
#define KB_ERROR_SYMDEF   6
#define KB_ERROR_UNKDEVCLASS   7
#define KB_ERROR_DEVCLASSUSED   8
#define KB_ERROR_INVNUM   9
#define KB_ERROR_FILEOPEN   10
#define KB_ERROR_NOBUSFOUND   11
#define KB_ERROR_INVORDER   12
#define KB_ERROR_EXCLACCESS   13
#define KB_ERROR_DEVICEINUSE   14
#define KB_ERROR_UNLINKDEV   15
#define KB_ERROR_OPENBUS   16
#define KB_ERROR_SCANBUS   17
#define KB_ERROR_NODEVFOUND   18
#define KB_ERROR_OPENDIR   19
#define KB_ERROR_NODEVFOUNDSTR   20
#define KB_ERROR_SYMNOTDEF   21
#define KB_ERROR_NOSECTION   22
#define KB_ERROR_CMDARGMIN   23
#define KB_ERROR_CMDARGMAX   24
#define KB_ERROR_UNKBUS   25
#define KB_ERROR_NOBUSADDR   26
#define KB_ERROR_NOMODBUS   27
#define KB_ERROR_INVNAME   28
#define KB_ERROR_NOINIT   29
#define KB_ERROR_DUPLEX   30
#define KB_ERROR_FRAGMENT   31
#define KB_ERROR_FRAGEXP   32
#define KB_ERROR_IPTR   33
#define KB_ERROR_OPTR   34
#define KB_ERROR_PTHREAD   35
#define KB_ERROR_BADSOUND   36
#define KB_ERROR_MMAP   37
#define KB_ERROR_OPENLRF   38
#define KB_ERROR_LRFDATA2BIG   39
#define KB_ERROR_LRFNOSTX   40
#define KB_ERROR_LRFNOETX   41
#define KB_ERROR_LRFWRONGSTX   42
#define KB_ERROR_LRFWRONGETX   43
#define KB_ERROR_LRFNODATA   44
#define KB_ERROR_LRFWRONGCRC   45
#define KB_ERROR_LRFSENDDATA   46
#define KB_ERROR_LRFNOCERT   47
#define KB_ERROR_LRFCMDTX   48
#define KB_ERROR_LRFDISTRX   49
#define KB_ERROR_LRFDATARX   50
#define KB_ERROR_KH3SZFMTERR   51
#define KB_ERROR_KH3FRMSZERR   52
#define KB_ERROR_KH3FRMSNDERR   53
#define KB_ERROR_KH3KBINIT   54
#define KB_WARN_CONFIG_FILE   0
#define KB_WARN_OPENDIR   1
#define KB_WARN_CONNECT   2
#define KB_WARN_SOUNDIO   3
#define KB_WARN_SOUNDSAMPLE   4

Typedefs

typedef void(* kb_error_handler_t )(const char *, unsigned int, const char *, unsigned int, va_list)
typedef void(* kb_warning_handler_t )(unsigned int, va_list)

Functions

void kb_set_debug_level (unsigned int level)
void kb_set_error_handler (kb_error_handler_t handler)
void kb_vmsg (const char *msg, va_list argptr)
void kb_msg (const char *msg,...)
int kb_vdebug (const char *file, unsigned int line, const char *func, unsigned int level, const char *msg, va_list argptr)
int kb_debug (const char *file, unsigned int line, const char *func, unsigned int level, const char *msg,...)
int kb_verror (const char *file, unsigned int line, const char *func, unsigned int error, va_list argptr)
int kb_error (const char *file, unsigned int line, const char *func, unsigned int error,...)
int kb_vwarning (unsigned int error, va_list argptr)
int kb_warning (unsigned int error,...)
void kb_fatal (const char *file, unsigned int line, const char *func, unsigned int error,...)

Variables

const char * kb_errmsg []
const char * kb_warnmsg []
unsigned int kb_debug_level


Define Documentation

#define KB_DEBUG ( f,
e,
m,
...   )     kb_debug( __FILE__ , __LINE__ , f , e , m , ##__VA_ARGS__ )

#define KB_ERROR ( f,
e,
...   )     kb_error( __FILE__ , __LINE__ , f , e , ##__VA_ARGS__ )

#define KB_ERROR_BADSOUND   36

Definition at line 69 of file kb_error.h.

Referenced by kb_wav_play().

#define KB_ERROR_CMDARGMAX   24

Definition at line 57 of file kb_error.h.

Referenced by kb_parse_command().

#define KB_ERROR_CMDARGMIN   23

Definition at line 56 of file kb_error.h.

Referenced by kb_parse_command().

#define KB_ERROR_DEVCLASSUSED   8

Definition at line 41 of file kb_error.h.

Referenced by kb_parse_device().

#define KB_ERROR_DEVICEINUSE   14

Definition at line 47 of file kb_error.h.

Referenced by knet_device_destroy().

#define KB_ERROR_DUPLEX   30

Definition at line 63 of file kb_error.h.

Referenced by kb_snd_enableFrag().

#define KB_ERROR_EXCLACCESS   13

Definition at line 46 of file kb_error.h.

#define KB_ERROR_FILEOPEN   10

#define KB_ERROR_FRAGEXP   32

Definition at line 65 of file kb_error.h.

Referenced by kb_snd_enableFrag().

#define KB_ERROR_FRAGMENT   31

Definition at line 64 of file kb_error.h.

Referenced by kb_snd_enableFrag().

#define KB_ERROR_INVAL   3

Definition at line 36 of file kb_error.h.

Referenced by kb_parse_command().

#define KB_ERROR_INVALID   5

#define KB_ERROR_INVNAME   28

Definition at line 61 of file kb_error.h.

Referenced by kb_parse_device().

#define KB_ERROR_INVNUM   9

Definition at line 42 of file kb_error.h.

Referenced by kb_parse_device(), and kb_parse_register().

#define KB_ERROR_INVORDER   12

Definition at line 45 of file kb_error.h.

#define KB_ERROR_IPTR   33

Definition at line 66 of file kb_error.h.

Referenced by kb_snd_getIPtr().

#define KB_ERROR_KH3FRMSNDERR   53

Definition at line 86 of file kb_error.h.

Referenced by kh3_sendcommand().

#define KB_ERROR_KH3FRMSZERR   52

Definition at line 85 of file kb_error.h.

Referenced by kh3_getcommand().

#define KB_ERROR_KH3KBINIT   54

Definition at line 87 of file kb_error.h.

Referenced by kgripper_init(), and kh3_init().

#define KB_ERROR_KH3SZFMTERR   51

Definition at line 84 of file kb_error.h.

Referenced by kh3_getcommand().

#define KB_ERROR_LRFCMDTX   48

Definition at line 81 of file kb_error.h.

Referenced by kb_lrf_FetchDistanceFromLRF().

#define KB_ERROR_LRFDATA2BIG   39

Definition at line 72 of file kb_error.h.

Referenced by kb_lrf_SendCommand().

#define KB_ERROR_LRFDATARX   50

Definition at line 83 of file kb_error.h.

Referenced by kb_lrf_FetchDistanceFromLRF().

#define KB_ERROR_LRFDISTRX   49

Definition at line 82 of file kb_error.h.

Referenced by kb_lrf_FetchDistanceFromLRF().

#define KB_ERROR_LRFNOCERT   47

Definition at line 80 of file kb_error.h.

Referenced by kb_lrf_AcquireCertifiedCode(), kb_lrf_CertifyLink(), and kb_lrf_GetDistances().

#define KB_ERROR_LRFNODATA   44

Definition at line 77 of file kb_error.h.

Referenced by kb_lrf_AcquireCertifiedCode(), kb_lrf_CertifyLink(), and kb_lrf_SendCommand().

#define KB_ERROR_LRFNOETX   41

Definition at line 74 of file kb_error.h.

Referenced by kb_lrf_GetDataFromLRF().

#define KB_ERROR_LRFNOSTX   40

Definition at line 73 of file kb_error.h.

Referenced by kb_lrf_GetDataFromLRF().

#define KB_ERROR_LRFSENDDATA   46

Definition at line 79 of file kb_error.h.

Referenced by kb_lrf_SendCommand().

#define KB_ERROR_LRFWRONGCRC   45

Definition at line 78 of file kb_error.h.

#define KB_ERROR_LRFWRONGETX   43

Definition at line 76 of file kb_error.h.

#define KB_ERROR_LRFWRONGSTX   42

Definition at line 75 of file kb_error.h.

#define KB_ERROR_MMAP   37

#define KB_ERROR_NOBUSADDR   26

Definition at line 59 of file kb_error.h.

Referenced by knet_open().

#define KB_ERROR_NOBUSFOUND   11

Definition at line 44 of file kb_error.h.

Referenced by knet_open().

#define KB_ERROR_NODEVFOUND   18

Definition at line 51 of file kb_error.h.

Referenced by knet_i2c_open().

#define KB_ERROR_NODEVFOUNDSTR   20

Definition at line 53 of file kb_error.h.

Referenced by knet_open(), and knet_rs232_open().

#define KB_ERROR_NOINIT   29

#define KB_ERROR_NOMEM   0

Definition at line 33 of file kb_error.h.

Referenced by kb_alloc(), and kb_realloc().

#define KB_ERROR_NOMODBUS   27

Definition at line 60 of file kb_error.h.

Referenced by knet_open().

#define KB_ERROR_NOSECTION   22

#define KB_ERROR_OPENBUS   16

Definition at line 49 of file kb_error.h.

Referenced by knet_i2c_init().

#define KB_ERROR_OPENDIR   19

Definition at line 52 of file kb_error.h.

#define KB_ERROR_OPENLRF   38

Definition at line 71 of file kb_error.h.

Referenced by kb_lrf_Init(), and kb_lrf_OpenComPort().

#define KB_ERROR_OPTR   34

Definition at line 67 of file kb_error.h.

Referenced by kb_snd_getOPtr().

#define KB_ERROR_OUTOFRANGE   2

Definition at line 35 of file kb_error.h.

Referenced by kbot_SetProcVCore().

#define KB_ERROR_PTHREAD   35

Definition at line 68 of file kb_error.h.

Referenced by koa_net_init(), startlog(), and stoplog().

#define KB_ERROR_SCANBUS   17

Definition at line 50 of file kb_error.h.

Referenced by knet_i2c_init().

#define KB_ERROR_SYMDEF   6

Definition at line 39 of file kb_error.h.

Referenced by kb_parse_alias(), kb_parse_device(), kb_parse_register(), and kb_parse_section().

#define KB_ERROR_SYMNOTDEF   21

Definition at line 54 of file kb_error.h.

#define KB_ERROR_TOOMANYARGS   1

Definition at line 34 of file kb_error.h.

Referenced by kb_parse_command().

#define KB_ERROR_UNKBUS   25

Definition at line 58 of file kb_error.h.

Referenced by kb_parse_modbus().

#define KB_ERROR_UNKCMD   4

Definition at line 37 of file kb_error.h.

Referenced by kb_find_command(), kb_parse_command(), and kb_parse_config_file().

#define KB_ERROR_UNKDEVCLASS   7

Definition at line 40 of file kb_error.h.

Referenced by kb_parse_device().

#define KB_ERROR_UNLINKDEV   15

Definition at line 48 of file kb_error.h.

Referenced by knet_device_destroy().

#define KB_EXIT_ON_ERROR   200

Definition at line 28 of file kb_error.h.

Referenced by kb_fatal().

#define KB_FATAL ( f,
e,
...   )     kb_fatal( __FILE__ , __LINE__ , f , e , ##__VA_ARGS__ )

Definition at line 21 of file kb_error.h.

Referenced by kb_alloc(), kb_realloc(), koa_net_init(), startlog(), and stoplog().

#define KB_WARN_CONFIG_FILE   0

Definition at line 91 of file kb_error.h.

Referenced by kb_config_init().

#define KB_WARN_CONNECT   2

Definition at line 93 of file kb_error.h.

Referenced by ksock_next_connection().

#define KB_WARN_OPENDIR   1

Definition at line 92 of file kb_error.h.

Referenced by kb_config_init().

#define KB_WARN_SOUNDIO   3

Definition at line 94 of file kb_error.h.

Referenced by kb_wav_play().

#define KB_WARN_SOUNDSAMPLE   4

Definition at line 95 of file kb_error.h.

Referenced by kb_wav_play().


Typedef Documentation

typedef void(* kb_error_handler_t)(const char *, unsigned int, const char *, unsigned int, va_list)

Error Handle Type Definition

Definition at line 106 of file kb_error.h.

typedef void(* kb_warning_handler_t)(unsigned int, va_list)

Warning Handle Type Definition

Definition at line 113 of file kb_error.h.


Function Documentation

int kb_debug ( const char *  file,
unsigned int  line,
const char *  func,
unsigned int  mask,
const char *  msg,
  ... 
)

This function displays a debug message on standard output.

Parameters:
file caller's source file (usually __FILE__)
line caller's source line (usually __LINE__)
func caller's name
mask debug mask
msg debug message
... list of arguments
Returns:
-error
Remarks:
You can call this function from your user error handler.

Definition at line 213 of file kb_error.c.

References kb_vdebug().

Here is the call graph for this function:

int kb_error ( const char *  file,
unsigned int  line,
const char *  func,
unsigned int  error,
  ... 
)

This function displays an error message on standard error

Parameters:
file caller's source file (usually __FILE__)
line caller's source line (usually __LINE__)
func caller's name
error number of the error
... list of arguments
Returns:
-error

Definition at line 280 of file kb_error.c.

References kb_verror().

Referenced by kb_is_valid_identifier(), kb_parse_alias(), kb_parse_command(), kb_parse_config_file(), kb_parse_device(), kb_parse_modbus(), kb_parse_modbusaddr(), kb_parse_register(), kb_parse_section(), knet_device_destroy(), knet_i2c_init(), knet_i2c_open(), knet_open(), and knet_rs232_open().

Here is the call graph for this function:

void kb_fatal ( const char *  file,
unsigned int  line,
const char *  func,
unsigned int  error,
  ... 
)

This function displaya an error message on standard error and exit the application.

Parameters:
file caller's source file (usually __FILE__)
line caller's source line (usually __LINE__)
func caller's name
error number of the error
... list of arguments

Definition at line 357 of file kb_error.c.

References KB_EXIT_ON_ERROR, and kb_verror().

Here is the call graph for this function:

void kb_msg ( const char *  msg,
  ... 
)

This function displays a message on standard output

Parameters:
msg message
... list of arguments

Definition at line 161 of file kb_error.c.

References kb_vmsg().

Referenced by kb_dump_symbol_table(), kb_init(), main(), print_device(), print_register(), and print_section().

Here is the call graph for this function:

void kb_set_debug_level ( unsigned int  level  ) 

This function changes the debug level

Parameters:
level New debug level

Definition at line 126 of file kb_error.c.

References kb_debug_level.

Referenced by kb_init(), and main().

void kb_set_error_handler ( kb_error_handler_t  handler  ) 

This function sets a user error handler

Parameters:
handler Pointer to the user error handler

Definition at line 137 of file kb_error.c.

References kb_user_error_handler.

Referenced by kb_parse_config_file().

int kb_vdebug ( const char *  file,
unsigned int  line,
const char *  func,
unsigned int  mask,
const char *  msg,
va_list  argptr 
)

This function displays a debug message on standard output.

Parameters:
file caller's source file (usually __FILE__)
line caller's source line (usually __LINE__)
func caller's name
level debug level
msg debug message
argptr list of arguments
Returns:
-error
Remarks:
You can call this function from your user error handler.

Definition at line 184 of file kb_error.c.

References kb_debug_mask.

Referenced by kb_debug().

int kb_verror ( const char *  file,
unsigned int  line,
const char *  func,
unsigned int  error,
va_list  argptr 
)

This function displays an error message on standard error.

Parameters:
file caller's source file (usually __FILE__)
line caller's source line (usually __LINE__)
func caller's name
error number of the error
argptr list of arguments
Returns:
-error
Remarks:
You can call this function from your user error handler.

Definition at line 241 of file kb_error.c.

References kb_debug_level, kb_errmsg, and kb_user_error_handler.

Referenced by kb_config_error(), kb_error(), and kb_fatal().

void kb_vmsg ( const char *  msg,
va_list  argptr 
)

This function displays a message on standard output

Parameters:
msg message
argptr list of arguments

Definition at line 149 of file kb_error.c.

Referenced by kb_msg().

int kb_vwarning ( unsigned int  error,
va_list  argptr 
)

This function displays a warning message on standard error.

Parameters:
error number of the error
argptr list of arguments
Returns:
-error
Remarks:
You can call this function from your user error handler.

Definition at line 304 of file kb_error.c.

References kb_debug_level, kb_user_warning_handler, and kb_warnmsg.

Referenced by kb_warning().

int kb_warning ( unsigned int  error,
  ... 
)

This function displays a warning message on standard error

Parameters:
error number of the error
... list of arguments
Returns:
-error

Definition at line 335 of file kb_error.c.

References kb_vwarning().

Referenced by kb_config_init(), kb_wav_play(), and ksock_next_connection().

Here is the call graph for this function:


Variable Documentation

unsigned int kb_debug_level

Definition at line 106 of file kb_error.c.

Referenced by kb_set_debug_level(), kb_verror(), and kb_vwarning().

const char* kb_errmsg[]

Error Messages Error codes are defined in kb_error.h and are always returned as negative integers.

Definition at line 31 of file kb_error.c.

Referenced by kb_verror().

const char* kb_warnmsg[]

Warning Messages Warning codes are defined in kb_error.h and are always returned as positive intergers.

Definition at line 95 of file kb_error.c.

Referenced by kb_vwarning().


Generated on Wed Dec 15 11:49:27 2010 for KoreBot Library by  doxygen 1.5.5