LALStatusMacros.h File Reference

#include <lal/LALConfig.h>
#include <stdlib.h>
#include <string.h>
#include <lal/LALMalloc.h>
#include <lal/LALDatatypes.h>
#include <lal/LALError.h>
#include <lal/LALRCSID.h>

Include dependency graph for LALStatusMacros.h:

Go to the source code of this file.

Defines

#define LAL_EXLAL   16384
#define LAL_MSGEXLAL   "Failure in an XLAL routine"
#define ABORTXLAL(sp)   ABORT(sp,LAL_EXLAL,LAL_MSGEXLAL)
#define INITSTATUS(statusptr, funcname, id)
#define RETURN(statusptr)
#define ATTATCHSTATUSPTR(statusptr)
#define DETATCHSTATUSPTR(statusptr)
#define ABORT(statusptr, code, mesg)
#define ASSERT(assertion, statusptr, code, mesg)
#define TRY(func, statusptr)
#define CHECKSTATUSPTR(statusptr)
#define FREESTATUSPTR(statusptr)
#define REPORTSTATUS(statusptr)
#define BEGINFAIL(statusptr)
#define ENDFAIL(statusptr)
#define SETSTATUSFILELINE(statusptr)   ( ( void ) ( (statusptr)->file = __FILE__, (statusptr)->line = __LINE__ ) )
#define SETSTATUS(statusptr, code, mesg)

Functions

 NRCSID (LALSTATUSMACROSH,"$Id: LALStatusMacros.h,v 1.25 2007/06/08 14:41:52 bema Exp $")

Variables

int lalDebugLevel
 DECLARE AND SET GLOBAL DEBUG LEVEL.
const int lalNoDebug


Define Documentation

#define LAL_EXLAL   16384

Definition at line 798 of file LALStatusMacros.h.

#define LAL_MSGEXLAL   "Failure in an XLAL routine"

Definition at line 799 of file LALStatusMacros.h.

#define ABORTXLAL ( sp   )     ABORT(sp,LAL_EXLAL,LAL_MSGEXLAL)

Definition at line 800 of file LALStatusMacros.h.

#define INITSTATUS ( statusptr,
funcname,
id   ) 

Value:

if ( (statusptr) )                                                            {                                                                               INT4 level_ = (statusptr)->level ;                                            INT4 statp_ = (statusptr)->statusPtr ? 1 : 0 ;                                memset( (statusptr), 0, sizeof( LALStatus ) ); /* possible memory leak */     (statusptr)->level    = level_ > 0 ? level_ : 1 ;                             (statusptr)->Id       = (id);                                                 (statusptr)->function = (funcname);                                           SETSTATUSFILELINE( statusptr );                                               (void) LALTrace( statusptr, 0 );                                              if ( statp_ )                                                                  {                                                                               ABORT( statusptr, -2, "INITSTATUS: non-null status pointer" );              }                                                                             else if ( xlalErrno )                                                         {                                                                               ABORT( statusptr, -16, "INITSTATUS: non-zero xlalErrno" );                  }                                                                           }                                                                             else                                                                            lalAbortHook( "Abort: function %s, file %s, line %d, %s\n"                                  "       Null status pointer passed to function\n",                            (funcname), __FILE__, __LINE__, (id) )

Definition at line 804 of file LALStatusMacros.h.

#define RETURN ( statusptr   ) 

Value:

if ( 1 )                                                                      {                                                                               SETSTATUSFILELINE( statusptr );                                               if ( (statusptr)->statusCode )                                                  (void) LALError( statusptr, "RETURN:" );                                    (void) LALTrace( statusptr, 1 );                                              if ( xlalErrno )                                                              {                                                                               ABORT( statusptr, -32, "RETURN: untrapped XLAL error" );                    }                                                                             return;                                                                     }                                                                             else (void)(0)

Definition at line 829 of file LALStatusMacros.h.

#define ATTATCHSTATUSPTR ( statusptr   ) 

Value:

if ( !(statusptr)->statusPtr )                                                {                                                                               (statusptr)->statusPtr = (LALStatus *)LALCalloc( 1, sizeof( LALStatus ) );    if ( !(statusptr)->statusPtr )                                                {                                                                               ABORT( statusptr, -4, "ATTATCHSTATUSPTR: memory allocation error" );        }                                                                             (statusptr)->statusPtr->level = (statusptr)->level + 1;                     }                                                                             else                                                                            ABORT( statusptr, -2, "ATTATCHSTATUSPTR: non-null status pointer" )

Definition at line 844 of file LALStatusMacros.h.

#define DETATCHSTATUSPTR ( statusptr   ) 

Value:

if ( (statusptr)->statusPtr )                                                 {                                                                               FREESTATUSPTR( statusptr );                                                   (statusptr)->statusCode = 0;                                                  (statusptr)->statusDescription = NULL;                                      }                                                                             else                                                                            ABORT( statusptr, -8, "DETATCHSTATUSPTR: null status pointer" )

Definition at line 857 of file LALStatusMacros.h.

#define ABORT ( statusptr,
code,
mesg   ) 

Value:

if ( 1 )                                                                      {                                                                               if ( statusptr->statusPtr ) FREESTATUSPTR( statusptr );                       SETSTATUS( statusptr, code, mesg );                                           if ( code )                                                                     (void) LALError( statusptr, "ABORT:" );                                     (void) LALTrace( statusptr, 1 );                                              return;                                                                     }                                                                             else (void)(0)

Definition at line 867 of file LALStatusMacros.h.

#define ASSERT ( assertion,
statusptr,
code,
mesg   ) 

Value:

if ( !(assertion) )                                                           {                                                                               if ( statusptr->statusPtr )                                                     FREESTATUSPTR( statusptr );                                                 SETSTATUS( statusptr, code, mesg );                                           (void) LALError( statusptr, "Assertion \"" #assertion "\" failed:" );         (void) LALTrace( statusptr, 1 );                                              return;                                                                     }                                                                             else (void)(0)

Definition at line 882 of file LALStatusMacros.h.

#define TRY ( func,
statusptr   ) 

Value:

if ( (func), (statusptr)->statusPtr->statusCode )                             {                                                                               SETSTATUS( statusptr, -1, "Recursive error" );                                (void) LALError( statusptr, "Function call \"" #func "\" failed:" );          (void) LALTrace( statusptr, 1 );                                              return;                                                                     }                                                                             else (void)(0)

Definition at line 895 of file LALStatusMacros.h.

#define CHECKSTATUSPTR ( statusptr   ) 

Value:

if ( (statusptr)->statusPtr->statusCode )                                     {                                                                               SETSTATUS( statusptr, -1, "Recursive error" );                                (void) LALError( statusptr, "CHECKSTATUSPTR:" );                              (void) LALTrace( statusptr, 1 );                                              return;                                                                     }                                                                             else (void)(0)

Definition at line 905 of file LALStatusMacros.h.

#define FREESTATUSPTR ( statusptr   ) 

Value:

do                                                                            {                                                                               LALStatus *next_ = (statusptr)->statusPtr->statusPtr;                          LALFree( (statusptr)->statusPtr );                                            (statusptr)->statusPtr = next_;                                              }                                                                             while ( (statusptr)->statusPtr )

Definition at line 915 of file LALStatusMacros.h.

#define REPORTSTATUS ( statusptr   ) 

Value:

do                                                                            {                                                                               LALStatus *ptr_;                                                              for ( ptr_ = (statusptr); ptr_; ptr_ = ptr_->statusPtr )                      {                                                                               LALPrintError( "\nLevel %i: %s\n", ptr_->level, ptr_->Id );                   if ( ptr_->statusCode )                                                       {                                                                               LALPrintError( "\tStatus code %i: %s\n", ptr_->statusCode,                                   ptr_->statusDescription );                                   }                                                                             else                                                                          {                                                                               LALPrintError( "\tStatus code 0: Nominal\n" );                              }                                                                             LALPrintError( "\tfunction %s, file %s, line %i\n",                                          ptr_->function, ptr_->file, ptr_->line );                    }                                                                           } while ( 0 )

Definition at line 924 of file LALStatusMacros.h.

#define BEGINFAIL ( statusptr   ) 

Value:

do {                                                                            if ( !(statusptr) ) {                                                           ABORT( statusptr, -8, "BEGINFAIL: null status pointer" );                   }                                                                             if ( !( (statusptr)->statusPtr ) ) {                                            ABORT( statusptr, -8, "BEGINFAIL: null status pointer pointer" );           }                                                                             if ( (statusptr)->statusPtr->statusCode ) {                                     LALStatus *statusPtrSave_ = (statusptr)->statusPtr;                           (statusptr)->statusPtr = NULL;                                                ATTATCHSTATUSPTR( statusptr );                                                do

Definition at line 994 of file LALStatusMacros.h.

#define ENDFAIL ( statusptr   ) 

Value:

while ( 0 );                                                                  DETATCHSTATUSPTR( statusptr );                                                (statusptr)->statusPtr = statusPtrSave_;                                      SETSTATUS( statusptr, -1, "Recursive error" );                                (void) LALError( statusptr, "ENDFAIL:" );                                     (void) LALTrace( statusptr, 1 );                                              return;                                                                     }                                                                           } while ( 0 )

Definition at line 1008 of file LALStatusMacros.h.

#define SETSTATUSFILELINE ( statusptr   )     ( ( void ) ( (statusptr)->file = __FILE__, (statusptr)->line = __LINE__ ) )

Definition at line 1019 of file LALStatusMacros.h.

#define SETSTATUS ( statusptr,
code,
mesg   ) 

Value:

( SETSTATUSFILELINE( statusptr ),                                               (statusptr)->statusDescription = (mesg),                                      (statusptr)->statusCode = (code) )

Definition at line 1022 of file LALStatusMacros.h.


Function Documentation

NRCSID ( LALSTATUSMACROSH  ,
"$Id: LALStatusMacros.  h,
v 1.25 2007/06/08 14:41:52 bema Exp $"   
)


Variable Documentation

int lalDebugLevel

DECLARE AND SET GLOBAL DEBUG LEVEL.

see the section (currently 7.4.1) of the LSD on "Status-reporting objects" for a list of predefined debug levels

Definition at line 62 of file BCVSpinTemplates.c.

const int lalNoDebug

Definition at line 91 of file LALStd.c.


Generated on Tue Oct 7 02:41:13 2008 for LAL by  doxygen 1.5.2