kb_error.c File Reference

This module provides basic error and message handling. More...

Include dependency graph for kb_error.c:

Go to the source code of this file.

Functions

void kb_set_debug_mask (unsigned int mask)
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 mask, const char *msg, va_list argptr)
int kb_debug (const char *file, unsigned int line, const char *func, unsigned int mask, 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 []
static kb_error_handler_t kb_user_error_handler = NULL
static kb_warning_handler_t kb_user_warning_handler = NULL
unsigned int kb_debug_level = 0
unsigned int kb_debug_mask = 0


Detailed Description

This module provides basic error and message handling.

Error Handling

Author:
CÚdric Gaudin (K-Team SA)
Note:
Copyright (C) 2004 K-TEAM SA
Bug:
none discovered.
Todo:
nothing.

Definition in file kb_error.c.


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_debug_mask ( unsigned int  mask  ) 

This function changes the debug mask

Parameters:
level New debug mask

Definition at line 115 of file kb_error.c.

References kb_debug_mask.

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 = 0

Definition at line 106 of file kb_error.c.

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

unsigned int kb_debug_mask = 0

Definition at line 107 of file kb_error.c.

Referenced by kb_set_debug_mask(), and kb_vdebug().

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().

Definition at line 104 of file kb_error.c.

Referenced by kb_set_error_handler(), and kb_verror().

Definition at line 105 of file kb_error.c.

Referenced by kb_vwarning().

const char* kb_warnmsg[]

Initial value:

 {
  "no configuration file available in %s" ,
  "unable to open directory '%s'" ,
  "Handling client %s",
  "i/o error in reading file '%s' !",
  "error in playing sample errno=%d",
  NULL
}
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