libdap Updated for version 3.20.11
libdap4 is an implementation of OPeNDAP's DAP protocol.
debug.h
1/*
2// -*- mode: c++; c-basic-offset:4 -*-
3
4// This file is part of libdap, A C++ implementation of the OPeNDAP Data
5// Access Protocol.
6
7// Copyright (c) 2002,2003 OPeNDAP, Inc.
8// Author: James Gallagher <jgallagher@opendap.org>
9//
10// This library is free software; you can redistribute it and/or
11// modify it under the terms of the GNU Lesser General Public
12// License as published by the Free Software Foundation; either
13// version 2.1 of the License, or (at your option) any later version.
14//
15// This library is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18// Lesser General Public License for more details.
19//
20// You should have received a copy of the GNU Lesser General Public
21// License along with this library; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23//
24// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25*/
26
27/*
28 This header defines macros which enable compile-time program
29 instrumentation. These macros work for both C and C++. Enclose the entire
30 statement to be debugged within the DBG() macro *and* put the semicolon
31 after the macro. (e.g., DBG(cerr << "Bad program" << endl); ). Statements
32 should not span lines unless they include `\'s to escape the newlines.
33
34 jhrg 10/13/94
35*/
36
37#ifndef _debug_h
38#define _debug_h
39
40#ifdef __cplusplus
41
42#include <iostream>
43using std::cerr;
44using std::string;
45using std::endl;
46#define FILE_N_LINE std::cerr << __FILE__ << ":" << __LINE__ << ": "
47
48#else
49
50#define FILE_N_LINE fprintf(stderr, "%s:%d: ", __FILE__, __LINE__);
51
52#endif /* cplusplus */
53
54#ifdef DODS_DEBUG
55#define DBG(x) FILE_N_LINE, x
56#define DBGN(x) x
57#else
58#define DBG(x) /* x */
59#define DBGN(x) /* x */
60#endif
61
64#ifdef DODS_DEBUG1
65#define DBG1(x) FILE_N_LINE, x
66#else
67#define DBG1(x) /* x */
68#endif
69
70#ifdef DODS_DEBUG2
71#define DBG2(x) FILE_N_LINE, x
72#define DBG2N(x) x
73#else
74#define DBG2(x) /* x */
75#define DBG2n(x) /* x */
76#endif
77
78#ifdef DODS_PERF
79#error "Deprecated macro!"
80#endif
81
82#endif /* _debug_h */