error.c File Reference


Detailed Description

Error-handling module.

If the library is built with pthreads support, then oski_GetErrorHandler and oski_SetErrorHandler routines execute atomically using pthreads locking.

Todo:
Wrap error handler get/set routines in mutexes.

#include <assert.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <oski/common.h>
#include <oski/config.h>

Defines

#define g_errlogfile   stderr
 Where default error handler's output messages go.
#define oski_LockErrorHandler()   ;
 Lock access to global error-handler variable.
#define oski_UnlockErrorHandler()   ;
 Release global error-handler variable.

Functions

const char * oski_GetErrorName (int code)
 Get generic information about an error code.
void oski_HandleErrorDefault (int error_code, const char *message, const char *source_filename, unsigned long line_number, const char *format_string,...)
 The default error handler, called when one of the BeBOP routines detects an error condition and the handler has not been overriden.
void oski_HandleErrorNull (int error_code, const char *message, const char *source_filename, unsigned long line_number, const char *format_string,...)
 Null error handler.
oski_errhandler_t oski_GetErrorHandler (void)
 Returns a pointer to the current error handling routine for a given matrix object, or the current global handler if a valid matrix object is not specified.
oski_errhandler_t oski_SetErrorHandler (oski_errhandler_t new_handler)
 Changes the current error handler for a given matrix, or changes the default error handler if no valid matrix object is specified.

Variables

static oski_errhandler_t gfuncp_oski_HandleError = oski_HandleErrorDefault
 This variable points to the current error handler.


Define Documentation

#define g_errlogfile   stderr
 

Where default error handler's output messages go.

Todo:
Make g_errlogfile a static global variable that the user can change to redirect errors elsewhere.


Function Documentation

void oski_HandleErrorNull int  error_code,
const char *  message,
const char *  source_filename,
unsigned long  line_number,
const char *  format_string,
  ...
 

Null error handler.

This routine has the signature of an error handler, but contains no statements (i.e., is a no-op.)


Variable Documentation

oski_errhandler_t gfuncp_oski_HandleError = oski_HandleErrorDefault [static]
 

This variable points to the current error handler.

When an error occurs in the library, the error handler is called through this pointer.

Important note: This variable should never be equal to NULL! Instead, error handling should be disabled by setting this variable to be equal to oski_HandleErrorNull, the 'null' error handler.


Generated on Wed Sep 19 16:41:22 2007 for BeBOP Optimized Sparse Kernel Interface Library by  doxygen 1.4.6