Main Page   Compound List   File List   Compound Members   File Members  

lib/error.c File Reference

Error handling functions. More...

#include "gobj/error.h"
#include "gobj/lang.h"
#include "gobj/errormgr.h"
#include "gobj/errors.h"
#include "gobj/ids.h"
#include "gobj/id.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

Functions

char* gj_error_conversion_id (void* id)
 Convert the error id to a string. More...

Gj_Errorargtypegj_error_findErrorargtype (char* name)
 Search the given argument type within the argtype array. More...

Gj_Errorspecgj_error_findErrorspec (Gj_Id* id)
 Search the errorspec with the given id within the error specifications. More...

int gj_error_getTypeSize (Gj_Errorargtype* spec)
 Get the type size. More...

Gj_ErrorGj_error_new (Gj_Id* id, char* sourcefile, int sourceline, ...)
 Create a new error. More...

void Gj_error_delete (Gj_Error* err)
 Destroy an error. More...

char* Gj_error_getSourcefile (Gj_Error* error)
 Get the name of the source file where the error occured. More...

int Gj_error_getSourceline (Gj_Error* error)
 Get the source line where the error occured. More...

char* Gj_error_getMsg (Gj_Error* error)
 Get the error message of a given error. More...

void Gj_error_dump (Gj_Error* err, FILE* stream)
 Dump an error structure to the given stream. More...


Variables

Gj_Errorargtype Gj_errorargtypes []
 The error types. More...

Gj_Errorspec Gj_errorspecs []
 Error specifications external.


Detailed Description

Error handling functions.


Function Documentation

char * gj_error_conversion_id ( void * id )
 

Convert the error id to a string.

Parameters:
id   The error id.
Returns:
The id as a string.

Gj_Errorargtype * gj_error_findErrorargtype ( char * name )
 

Search the given argument type within the argtype array.

Parameters:
name   The name. May either be terminated by a space or a null-character.

Returns:
  • The pointer to the argtype on success.
  • 0 if the argument name was not found.

Gj_Errorspec * gj_error_findErrorspec ( Gj_Id * id )
 

Search the errorspec with the given id within the error specifications.

Parameters:
id   The error id.

Returns:
  • The pointer to the errorspec on success.
  • 0 if the id was not found.

int gj_error_getTypeSize ( Gj_Errorargtype * spec )
 

Get the type size.

Returns:
The type size.

Gj_Error * Gj_error_new ( Gj_Id * id,
char * module,
int line,
... )
 

Create a new error.

Parameters:
id   The error id.
module   The module name.
line   The source file line number.
...   Additional error informations.
Returns:
A pointer to the new created error.

void Gj_error_delete ( Gj_Error * error )
 

Destroy an error.

Parameters:
error   A pointer to the error.

char * Gj_error_getSourcefile ( Gj_Error * error )
 

Get the name of the source file where the error occured.

Parameters:
error   A pointer to the error.
Returns:
The source file name.

int Gj_error_getSourceline ( Gj_Error * error )
 

Get the source line where the error occured.

Parameters:
error   A pointer to the error.
Returns:
The source line number.

char * Gj_error_getMsg ( Gj_Error * error )
 

Get the error message of a given error.

Parameters:
error   A pointer to the error.
Returns:
The error message (NOT OWNED by the error).

void Gj_error_dump ( Gj_Error * error,
FILE * stream )
 

Dump an error structure to the given stream.

Parameters:
error   A pointer to the error.
stream   A pointer to the output stream.


Variable Documentation

Gj_Errorargtype Gj_errorargtypes[]
 

Initializer:

{
  { "name", GJ_ERRDATATYPE_STRING, 0, 0 },
  { "viewname", GJ_ERRDATATYPE_STRING, 0, 0 },
  { "viewid", GJ_ERRDATATYPE_DATA, sizeof(Gj_Id), &gj_error_conversion_id },
  { "modelptr", GJ_ERRDATATYPE_POINTER, 0, 0 },
  { "id", GJ_ERRDATATYPE_DATA, sizeof(Gj_Id), &gj_error_conversion_id },
  { "propertyname", GJ_ERRDATATYPE_STRING, 0, 0 },
  { "viewptr", GJ_ERRDATATYPE_POINTER, 0, 0 },
  { "paramname", GJ_ERRDATATYPE_STRING, 0, 0 },
  { "index", GJ_ERRDATATYPE_INT, 0, 0 },
  { "objectptr", GJ_ERRDATATYPE_POINTER, 0, 0 },
  { "objectid", GJ_ERRDATATYPE_DATA, sizeof(Gj_Id), &gj_error_conversion_id },
  { "modelmgrptr", GJ_ERRDATATYPE_POINTER, 0, 0 },
  { "cause", GJ_ERRDATATYPE_STRING, 0, 0 },
  { "idmgrptr", GJ_ERRDATATYPE_POINTER, 0, 0 },
  { "ifaceid", GJ_ERRDATATYPE_DATA, sizeof(Gj_Id), &gj_error_conversion_id },
  { "string", GJ_ERRDATATYPE_STRING, 0, 0 },
  { "ifaceport", GJ_ERRDATATYPE_POINTER, 0, 0 },
  { "containderid", GJ_ERRDATATYPE_DATA, sizeof(Gj_Id), &gj_error_conversion_id },
  { "hex", GJ_ERRDATATYPE_POINTER, 0, 0 },
  { "ptr", GJ_ERRDATATYPE_POINTER, 0, 0 },
  { "str", GJ_ERRDATATYPE_STRING, 0, 0 },
  { "addr", GJ_ERRDATATYPE_STRING, 0, 0 },
  { "", 0, 0, 0 }
}
The error types.


Generated at Fri Aug 17 18:28:56 2001 for Gobj by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000