The outage for Sunday 24th November has been cancelled.
Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
Data Structures | Typedefs | Functions
ErrStack.c File Reference

Build and print an error stack for program failure. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SysDefs.h"
#include "macros.h"
#include "ErrStack.h"

Go to the source code of this file.

Data Structures

struct  _errorstack
 

Typedefs

typedef struct _errorstack ERRORSTACK
 

Functions

void blStoreError (char *routine, char *error)
 
void blShowErrors (void *PrintRoutine(char *), BOOL Trace)
 

Detailed Description

Build and print an error stack for program failure.

Version
V1.1
Date
07.07.14
Author
Dr. Andrew C. R. Martin
Institute of Structural & Molecular Biology, University College London, Gower Street, London. WC1E 6BT.
andre.nosp@m.w@bi.nosp@m.oinf..nosp@m.org..nosp@m.uk andre.nosp@m.w.ma.nosp@m.rtin@.nosp@m.ucl..nosp@m.ac.uk

This code is NOT IN THE PUBLIC DOMAIN, but it may be copied according to the conditions laid out in the accompanying file COPYING.DOC.

The code may be modified as required, but any modifications must be documented so that the person responsible can be identified.

The code may not be sold commercially or included as part of a commercial product except as described in the file COPYING.DOC.

Description:

This set of routines allows a stack of errors to be created. When a program has a fatal error, the StoreError() routine is called to place the error on the stack. As the program un-winds, each routine which fails stores it's error. Finally, before the program actually exits, it calls ShowErrors() to display the error stack.

Usage:

blStoreError(char *routine, char *error)

The routine is called with the name of the routine at fault and the description of the fault.

blShowErrors(void *PrintRoutine, BOOL Trace)

The routine is called with a pointer to the routine which is to do the actual error display and a flag to indicate whether the faulty routine names should be displyed. This is only of use if the user has access to the source code so should be used for debugging purposes only.

If PrintRoutine is supplied as NULL, the simple PrintAnError() routine will be used which displays the error on stderr. More complex routines could, for example, show the error in a requester or output to a window.

If a print routine is specified, the routine is called with:

blShowErrors(void *)MyRoutine, TRUE);

Revision History:

Definition in file ErrStack.c.

Typedef Documentation

typedef struct _errorstack ERRORSTACK

Function Documentation

void blShowErrors ( void *  PrintRoutinechar *,
BOOL  Trace 
)
Parameters
[in]*PrintRoutineThe print routine or NULL
[in]TraceFlag to print routine names

Display the error stack using the supplied print routine or the simple default one if NULL is given.

  • 31.08.94 Original By: ACRM
  • 06.09.94 No longer tries to set PrintRoutine if was NULL (strict ANSI compliance)
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 182 of file ErrStack.c.

void blStoreError ( char *  routine,
char *  error 
)
Parameters
[in]*routineName of the routine generating the error
[in]*errorDescription of the error

Stores an error on the error stack.

  • 31.08.94 Original By: ACRM
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 137 of file ErrStack.c.