HL-HDF
hlhdf_debug.h File Reference

Debug functions used in HLHDF. More...

#include <H5Epublic.h>

Go to the source code of this file.

Classes

struct  hlhdf_debug_struct
 Debug structure. More...
 

Macros

#define HL_SPEWDEBUG0(msg)
 Spewdebug macro taking one text string.
 
#define HL_SPEWDEBUG1(msg, arg1)
 Spewdebug macro taking one text string and one argument.
 
#define HL_SPEWDEBUG2(msg, arg1, arg2)
 Spewdebug macro taking one text string and two arguments.
 
#define HL_SPEWDEBUG3(msg, arg1, arg2, arg3)
 Spewdebug macro taking one text string and three arguments.
 
#define HL_SPEWDEBUG4(msg, arg1, arg2, arg3, arg4)
 Spewdebug macro taking one text string and four arguments.
 
#define HL_DEBUG0(msg)
 Debug macro taking one text string.
 
#define HL_DEBUG1(msg, arg1)
 Debug macro taking one text string and one argument.
 
#define HL_DEBUG2(msg, arg1, arg2)
 Debug macro taking one text string and two arguments.
 
#define HL_DEBUG3(msg, arg1, arg2, arg3)
 Debug macro taking one text string and three arguments.
 
#define HL_DEBUG4(msg, arg1, arg2, arg3, arg4)
 Debug macro taking one text string and four arguments.
 
#define HL_DEPRECATED0(msg)
 Deprecated macro taking one text string.
 
#define HL_DEPRECATED1(msg, arg1)
 Deprecated macro taking one text string and one argument.
 
#define HL_DEPRECATED2(msg, arg1, arg2)
 Deprecated macro taking one text string and two arguments.
 
#define HL_DEPRECATED3(msg, arg1, arg2, arg3)
 Deprecated macro taking one text string and three arguments.
 
#define HL_DEPRECATED4(msg, arg1, arg2, arg3, arg4)
 Deprecated macro taking one text string and four arguments.
 
#define HL_INFO0(msg)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_INFO,msg)
 Info macro taking one text string.
 
#define HL_INFO1(msg, arg1)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_INFO,msg,arg1)
 Info macro taking one text string and one argument.
 
#define HL_INFO2(msg, arg1, arg2)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_INFO,msg,arg1,arg2)
 Info macro taking one text string and two arguments.
 
#define HL_INFO3(msg, arg1, arg2, arg3)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_INFO,msg,arg1,arg2,arg3)
 Info macro taking one text string and three arguments.
 
#define HL_INFO4(msg, arg1, arg2, arg3, arg4)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_INFO,msg,arg1,arg2,arg3,arg4)
 Info macro taking one text string and four arguments.
 
#define HL_WARNING0(msg)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_WARNING,msg)
 Warning macro taking one text string.
 
#define HL_WARNING1(msg, arg1)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_WARNING,msg,arg1)
 Warning macro taking one text string and one argument.
 
#define HL_WARNING2(msg, arg1, arg2)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_WARNING,msg,arg1,arg2)
 Warning macro taking one text string and two arguments.
 
#define HL_WARNING3(msg, arg1, arg2, arg3)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_WARNING,msg,arg1,arg2,arg3)
 Warning macro taking one text string and three arguments.
 
#define HL_WARNING4(msg, arg1, arg2, arg3, arg4)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_WARNING,msg,arg1,arg2,arg3,arg4)
 Warning macro taking one text string and four arguments.
 
#define HL_ERROR0(msg)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_ERROR,msg)
 Error macro taking one text string.
 
#define HL_ERROR1(msg, arg1)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_ERROR,msg,arg1)
 Error macro taking one text string and one argument.
 
#define HL_ERROR2(msg, arg1, arg2)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_ERROR,msg,arg1,arg2)
 Error macro taking one text string and two arguments.
 
#define HL_ERROR3(msg, arg1, arg2, arg3)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_ERROR,msg,arg1,arg2,arg3)
 Error macro taking one text string and three arguments.
 
#define HL_ERROR4(msg, arg1, arg2, arg3, arg4)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_ERROR,msg,arg1,arg2,arg3,arg4)
 Error macro taking one text string and four arguments.
 
#define HL_CRITICAL0(msg)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_CRITICAL,msg)
 Critical macro taking one text string.
 
#define HL_CRITICAL1(msg, arg1)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_CRITICAL,msg,arg1)
 Critical macro taking one text string and one argument.
 
#define HL_CRITICAL2(msg, arg1, arg2)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_CRITICAL,msg,arg1,arg2)
 Critical macro taking one text string and two arguments.
 
#define HL_CRITICAL3(msg, arg1, arg2, arg3)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_CRITICAL,msg,arg1,arg2,arg3)
 Critical macro taking one text string and three arguments.
 
#define HL_CRITICAL4(msg, arg1, arg2, arg3, arg4)   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_CRITICAL,msg,arg1,arg2,arg3,arg4)
 Critical macro taking one text string and four arguments.
 
#define HL_ASSERT(expr, msg)
 Precondition macro, if the expression does not evaluate to true, then an CRITICAL error message will be produced and then the program will abort().
 
#define HL_ABORT()   abort()
 

Typedefs

typedef enum HL_Debug HL_Debug
 Debug levels.
 

Enumerations

enum  HL_Debug {
  HLHDF_SPEWDEBUG =0 , HLHDF_DEBUG , HLHDF_DEPRECATED , HLHDF_INFO ,
  HLHDF_WARNING , HLHDF_ERROR , HLHDF_CRITICAL , HLHDF_SILENT
}
 Debug levels. More...
 

Functions

void HL_printf (const char *fmt,...)
 The printer function.
 
void HL_InitializeDebugger (void)
 Initializes the debugger structure, must have been called before executing the code.
 
void HL_setDebugLevel (HL_Debug lvl)
 Sets the debug level.
 
void HL_setDebugFunction (void(*dbgfun)(char *filename, int lineno, HL_Debug lvl, const char *fmt,...))
 Sets the debug function where the debug printouts should be routed.
 
void HL_setHdf5ErrorFunction (void(*hdf5fun)(unsigned n, const H5E_error_t *val))
 Sets the HDF5 error reporting function.
 
void HL_disableHdf5ErrorReporting (void)
 Disables the HDF5 error reporting.
 
void HL_enableHdf5ErrorReporting (void)
 Enables the HDF5 error reporting.
 
herr_t HL_hdf5_debug_function (hid_t estack, void *inv)
 This is the debug function that is used to forward messages to the appropriate debugger function.
 

Variables

hlhdf_debug_struct hlhdfDbg
 The main structure used for routing errors and debug printouts.
 

Detailed Description

Debug functions used in HLHDF.

It is also provides a mechanism to route the printouts to custom made report functions.

Author
Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
Date
2009-06-12

Macro Definition Documentation

◆ HL_ASSERT

#define HL_ASSERT ( expr,
msg )
Value:
if(!expr) { \
hlhdfDbg.dbgfun(__FILE__, __LINE__, HLHDF_CRITICAL, msg); \
abort(); \
}
@ HLHDF_CRITICAL
If this occurs, then something has gone very wrong or the code contains a bug, please report it to th...
Definition hlhdf_debug.h:44
hlhdf_debug_struct hlhdfDbg
The main structure used for routing errors and debug printouts.
Definition hlhdf_debug.c:28
void(* dbgfun)(char *filename, int lineno, HL_Debug lvl, const char *fmt,...)
Debug function.
Definition hlhdf_debug.h:53

Precondition macro, if the expression does not evaluate to true, then an CRITICAL error message will be produced and then the program will abort().

◆ HL_CRITICAL0

#define HL_CRITICAL0 ( msg)    hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_CRITICAL,msg)

Critical macro taking one text string.

◆ HL_CRITICAL1

#define HL_CRITICAL1 ( msg,
arg1 )   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_CRITICAL,msg,arg1)

Critical macro taking one text string and one argument.

◆ HL_CRITICAL2

#define HL_CRITICAL2 ( msg,
arg1,
arg2 )   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_CRITICAL,msg,arg1,arg2)

Critical macro taking one text string and two arguments.

◆ HL_CRITICAL3

#define HL_CRITICAL3 ( msg,
arg1,
arg2,
arg3 )   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_CRITICAL,msg,arg1,arg2,arg3)

Critical macro taking one text string and three arguments.

◆ HL_CRITICAL4

#define HL_CRITICAL4 ( msg,
arg1,
arg2,
arg3,
arg4 )   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_CRITICAL,msg,arg1,arg2,arg3,arg4)

Critical macro taking one text string and four arguments.

◆ HL_DEBUG0

#define HL_DEBUG0 ( msg)

Debug macro taking one text string.

◆ HL_DEBUG1

#define HL_DEBUG1 ( msg,
arg1 )

Debug macro taking one text string and one argument.

◆ HL_DEBUG2

#define HL_DEBUG2 ( msg,
arg1,
arg2 )

Debug macro taking one text string and two arguments.

◆ HL_DEBUG3

#define HL_DEBUG3 ( msg,
arg1,
arg2,
arg3 )

Debug macro taking one text string and three arguments.

◆ HL_DEBUG4

#define HL_DEBUG4 ( msg,
arg1,
arg2,
arg3,
arg4 )

Debug macro taking one text string and four arguments.

◆ HL_DEPRECATED0

#define HL_DEPRECATED0 ( msg)

Deprecated macro taking one text string.

◆ HL_DEPRECATED1

#define HL_DEPRECATED1 ( msg,
arg1 )

Deprecated macro taking one text string and one argument.

◆ HL_DEPRECATED2

#define HL_DEPRECATED2 ( msg,
arg1,
arg2 )

Deprecated macro taking one text string and two arguments.

◆ HL_DEPRECATED3

#define HL_DEPRECATED3 ( msg,
arg1,
arg2,
arg3 )

Deprecated macro taking one text string and three arguments.

◆ HL_DEPRECATED4

#define HL_DEPRECATED4 ( msg,
arg1,
arg2,
arg3,
arg4 )

Deprecated macro taking one text string and four arguments.

◆ HL_ERROR0

#define HL_ERROR0 ( msg)    hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_ERROR,msg)

Error macro taking one text string.

◆ HL_ERROR1

#define HL_ERROR1 ( msg,
arg1 )   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_ERROR,msg,arg1)

Error macro taking one text string and one argument.

◆ HL_ERROR2

#define HL_ERROR2 ( msg,
arg1,
arg2 )   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_ERROR,msg,arg1,arg2)

Error macro taking one text string and two arguments.

◆ HL_ERROR3

#define HL_ERROR3 ( msg,
arg1,
arg2,
arg3 )   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_ERROR,msg,arg1,arg2,arg3)

Error macro taking one text string and three arguments.

◆ HL_ERROR4

#define HL_ERROR4 ( msg,
arg1,
arg2,
arg3,
arg4 )   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_ERROR,msg,arg1,arg2,arg3,arg4)

Error macro taking one text string and four arguments.

◆ HL_INFO0

#define HL_INFO0 ( msg)    hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_INFO,msg)

Info macro taking one text string.

◆ HL_INFO1

#define HL_INFO1 ( msg,
arg1 )   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_INFO,msg,arg1)

Info macro taking one text string and one argument.

◆ HL_INFO2

#define HL_INFO2 ( msg,
arg1,
arg2 )   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_INFO,msg,arg1,arg2)

Info macro taking one text string and two arguments.

◆ HL_INFO3

#define HL_INFO3 ( msg,
arg1,
arg2,
arg3 )   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_INFO,msg,arg1,arg2,arg3)

Info macro taking one text string and three arguments.

◆ HL_INFO4

#define HL_INFO4 ( msg,
arg1,
arg2,
arg3,
arg4 )   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_INFO,msg,arg1,arg2,arg3,arg4)

Info macro taking one text string and four arguments.

◆ HL_SPEWDEBUG0

#define HL_SPEWDEBUG0 ( msg)

Spewdebug macro taking one text string.

◆ HL_SPEWDEBUG1

#define HL_SPEWDEBUG1 ( msg,
arg1 )

Spewdebug macro taking one text string and one argument.

◆ HL_SPEWDEBUG2

#define HL_SPEWDEBUG2 ( msg,
arg1,
arg2 )

Spewdebug macro taking one text string and two arguments.

◆ HL_SPEWDEBUG3

#define HL_SPEWDEBUG3 ( msg,
arg1,
arg2,
arg3 )

Spewdebug macro taking one text string and three arguments.

◆ HL_SPEWDEBUG4

#define HL_SPEWDEBUG4 ( msg,
arg1,
arg2,
arg3,
arg4 )

Spewdebug macro taking one text string and four arguments.

◆ HL_WARNING0

#define HL_WARNING0 ( msg)    hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_WARNING,msg)

Warning macro taking one text string.

◆ HL_WARNING1

#define HL_WARNING1 ( msg,
arg1 )   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_WARNING,msg,arg1)

Warning macro taking one text string and one argument.

◆ HL_WARNING2

#define HL_WARNING2 ( msg,
arg1,
arg2 )   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_WARNING,msg,arg1,arg2)

Warning macro taking one text string and two arguments.

◆ HL_WARNING3

#define HL_WARNING3 ( msg,
arg1,
arg2,
arg3 )   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_WARNING,msg,arg1,arg2,arg3)

Warning macro taking one text string and three arguments.

◆ HL_WARNING4

#define HL_WARNING4 ( msg,
arg1,
arg2,
arg3,
arg4 )   hlhdfDbg.dbgfun(__FILE__,__LINE__,HLHDF_WARNING,msg,arg1,arg2,arg3,arg4)

Warning macro taking one text string and four arguments.

Function Documentation

◆ HL_hdf5_debug_function()

herr_t HL_hdf5_debug_function ( hid_t estack,
void * inv )

This is the debug function that is used to forward messages to the appropriate debugger function.

Parameters
[in]estackthe error stack
[in]invsome data

◆ HL_printf()

void HL_printf ( const char * fmt,
... )

The printer function.

Parameters
[in]fmt- the varargs formatter string
[in]...- the varargs list

Variable Documentation

◆ hlhdfDbg

hlhdf_debug_struct hlhdfDbg
extern

The main structure used for routing errors and debug printouts.