source: XIOS/dev/dev_olga/extern/src_netcdf4/dapdebug.h @ 1620

Last change on this file since 1620 was 409, checked in by ymipsl, 11 years ago

Add improved nectdf internal library src

YM

  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1/*********************************************************************
2 *   Copyright 1993, UCAR/Unidata
3 *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
4 *   $Header: /upc/share/CVS/netcdf-3/libncdap3/dapdebug.h,v 1.33 2009/12/03 18:53:16 dmh Exp $
5 *********************************************************************/
6#ifndef DEBUG_H
7#define DEBUG_H
8
9#include "ocdebug.h"
10
11#ifdef DAPDEBUG
12#  define DEBUG
13#  if DAPDEBUG > 0
14#    define DEBUG1
15#  endif
16#  if DAPDEBUG > 1
17#    define DEBUG2
18#  endif
19#  if DAPDEBUG > 2
20#    define DEBUG3
21#  endif
22#endif
23
24#undef PARSEDEBUG
25
26#include <stdarg.h>
27#include <assert.h>
28
29/* Warning: setting CATCHERROR has significant performance impact */
30#undef CATCHERROR
31#ifdef DEBUG
32#undef CATCHERROR
33#define CATCHERROR
34#endif
35
36#define PANIC(msg) assert(dappanic(msg));
37#define PANIC1(msg,arg) assert(dappanic(msg,arg));
38#define PANIC2(msg,arg1,arg2) assert(dappanic(msg,arg1,arg2));
39
40#define ASSERT(expr) if(!(expr)) {PANIC(#expr);} else {}
41
42extern int ncdap3debug;
43
44extern int dappanic(const char* fmt, ...);
45
46#define MEMCHECK(var,throw) {if((var)==NULL) return (throw);}
47
48#ifdef CATCHERROR
49/* Place breakpoint on dapbreakpoint to catch errors close to where they occur*/
50#define THROW(e) dapthrow(e)
51#define THROWCHK(e) (void)dapthrow(e)
52
53extern int dapbreakpoint(int err);
54extern int dapthrow(int err);
55#else
56#define THROW(e) (e)
57#define THROWCHK(e)
58#endif
59
60#ifdef DEBUG
61#define SHOWFETCH (1)
62#define LOG0(level,msg) fprintf(stderr,msg)
63#define LOG1(level,msg,a1) fprintf(stderr,msg,a1)
64#define LOG2(level,msg,a1,a2) fprintf(stderr,msg,a1,a2)
65#else
66#define SHOWFETCH FLAGSET(nccomm->controls,NCF_SHOWFETCH)
67#define LOG0(level,msg) nclog(level,msg)
68#define LOG1(level,msg,a1) nclog(level,msg,a1)
69#define LOG2(level,msg,a1,a2) nclog(level,msg,a1,a2)
70#endif
71
72#endif /*DEBUG_H*/
73
Note: See TracBrowser for help on using the repository browser.