LAL  7.5.0.1-08ee4f4
LALStatusMacros.h File Reference

Go to the source code of this file.

Macros

#define LAL_EXLAL   16384
 
#define LAL_MSGEXLAL   "Failure in an XLAL routine"
 
#define ABORTXLAL(sp)   ABORT(sp,LAL_EXLAL,LAL_MSGEXLAL)
 
#define XLAL_CHECK_LAL(sp, assertion, ...)   _XLAL_CHECK_IMPL_(ABORTXLAL(sp), assertion, __VA_ARGS__)
 
#define INITSTATUS(statusptr)
 
#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)
 

Macro Definition Documentation

◆ LAL_EXLAL

#define LAL_EXLAL   16384

Definition at line 42 of file LALStatusMacros.h.

◆ LAL_MSGEXLAL

#define LAL_MSGEXLAL   "Failure in an XLAL routine"

Definition at line 43 of file LALStatusMacros.h.

◆ ABORTXLAL

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

Definition at line 44 of file LALStatusMacros.h.

◆ XLAL_CHECK_LAL

#define XLAL_CHECK_LAL (   sp,
  assertion,
  ... 
)    _XLAL_CHECK_IMPL_(ABORTXLAL(sp), assertion, __VA_ARGS__)

Definition at line 45 of file LALStatusMacros.h.

◆ INITSTATUS

#define INITSTATUS (   statusptr)
Value:
do { 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 = __func__; \
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" ); \
} \
lalAbortHook( "Abort: function %s, file %s, line %d, %s\n" \
" Null status pointer passed to function\n", \
__func__, __FILE__, __LINE__, "$Id$" ); \
} while ( 0 )
void(* lalAbortHook)(const char *,...)
Definition: LALError.c:75
#define LALTrace(statusptr, exitflg)
Definition: LALError.h:117
#define xlalErrno
Modifiable lvalue containing the XLAL error number.
Definition: XLALError.h:571
LAL status structure, see The LALStatus structure for more details.
Definition: LALDatatypes.h:947

Definition at line 49 of file LALStatusMacros.h.

◆ RETURN

#define RETURN (   statusptr)
Value:
do { 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; \
} \
} while ( 0 )
#define LALError(statusptr, statement)
Definition: LALError.h:95

Definition at line 71 of file LALStatusMacros.h.

◆ ATTATCHSTATUSPTR

#define ATTATCHSTATUSPTR (   statusptr)
Value:
do { 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; \
} \
ABORT( statusptr, -2, "ATTATCHSTATUSPTR: non-null status pointer" ); \
} while ( 0 )
#define LALCalloc(m, n)
Definition: LALMalloc.h:94
#define ABORT(statusptr, code, mesg)

Definition at line 84 of file LALStatusMacros.h.

◆ DETATCHSTATUSPTR

#define DETATCHSTATUSPTR (   statusptr)
Value:
do { if ( (statusptr)->statusPtr ) \
{ \
FREESTATUSPTR( statusptr ); \
(statusptr)->statusCode = 0; \
(statusptr)->statusDescription = NULL; \
} \
ABORT( statusptr, -8, "DETATCHSTATUSPTR: null status pointer" ); \
} while ( 0 )

Definition at line 96 of file LALStatusMacros.h.

◆ ABORT

#define ABORT (   statusptr,
  code,
  mesg 
)
Value:
do { if ( (statusptr)->statusPtr ) FREESTATUSPTR( statusptr ); \
SETSTATUS( statusptr, code, mesg ); \
if ( code ) \
(void) LALError( statusptr, "ABORT:" ); \
(void) LALTrace( statusptr, 1 ); \
return; \
} while ( 0 )
#define FREESTATUSPTR(statusptr)

Definition at line 107 of file LALStatusMacros.h.

◆ ASSERT

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

Definition at line 119 of file LALStatusMacros.h.

◆ TRY

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

Definition at line 132 of file LALStatusMacros.h.

◆ CHECKSTATUSPTR

#define CHECKSTATUSPTR (   statusptr)
Value:
do { if ( (statusptr)->statusPtr->statusCode ) \
{ \
SETSTATUS( statusptr, -1, "Recursive error" ); \
(void) LALError( statusptr, "CHECKSTATUSPTR:" ); \
(void) LALTrace( statusptr, 1 ); \
return; \
} \
} while ( 0 )

Definition at line 142 of file LALStatusMacros.h.

◆ FREESTATUSPTR

#define FREESTATUSPTR (   statusptr)
Value:
do \
{ \
LALStatus *next_ = (statusptr)->statusPtr->statusPtr; \
LALFree( (statusptr)->statusPtr ); \
(statusptr)->statusPtr = next_; \
} \
while ( (statusptr)->statusPtr )
#define LALFree(p)
Definition: LALMalloc.h:96

Definition at line 152 of file LALStatusMacros.h.

◆ REPORTSTATUS

#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 ); \
LALPrintError( "\tStatus code 0: Nominal\n" ); \
LALPrintError( "\tfunction %s, file %s, line %i\n", \
ptr_->function, ptr_->file, ptr_->line ); \
} \
} while ( 0 )
int LALPrintError(const char *fmt,...)
Definition: LALError.c:46

Definition at line 161 of file LALStatusMacros.h.

◆ BEGINFAIL

#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 226 of file LALStatusMacros.h.

◆ ENDFAIL

#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 238 of file LALStatusMacros.h.

◆ SETSTATUSFILELINE

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

Definition at line 249 of file LALStatusMacros.h.

◆ SETSTATUS

#define SETSTATUS (   statusptr,
  code,
  mesg 
)
Value:
( SETSTATUSFILELINE( statusptr ), \
(statusptr)->statusDescription = (mesg), \
(statusptr)->statusCode = (code) )
#define SETSTATUSFILELINE(statusptr)

Definition at line 252 of file LALStatusMacros.h.