Blame debug.h

Packit a4aae4
/*
Packit a4aae4
// -*- mode: c++; c-basic-offset:4 -*-
Packit a4aae4
Packit a4aae4
// This file is part of libdap, A C++ implementation of the OPeNDAP Data
Packit a4aae4
// Access Protocol.
Packit a4aae4
Packit a4aae4
// Copyright (c) 2002,2003 OPeNDAP, Inc.
Packit a4aae4
// Author: James Gallagher <jgallagher@opendap.org>
Packit a4aae4
//
Packit a4aae4
// This library is free software; you can redistribute it and/or
Packit a4aae4
// modify it under the terms of the GNU Lesser General Public
Packit a4aae4
// License as published by the Free Software Foundation; either
Packit a4aae4
// version 2.1 of the License, or (at your option) any later version.
Packit a4aae4
//
Packit a4aae4
// This library is distributed in the hope that it will be useful,
Packit a4aae4
// but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit a4aae4
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit a4aae4
// Lesser General Public License for more details.
Packit a4aae4
//
Packit a4aae4
// You should have received a copy of the GNU Lesser General Public
Packit a4aae4
// License along with this library; if not, write to the Free Software
Packit a4aae4
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
Packit a4aae4
//
Packit a4aae4
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
Packit a4aae4
*/
Packit a4aae4
Packit a4aae4
/*
Packit a4aae4
  This header defines macros which enable compile-time program
Packit a4aae4
  instrumentation. These macros work for both C and C++. Enclose the entire
Packit a4aae4
  statement to be debugged within the DBG() macro *and* put the semicolon
Packit a4aae4
  after the macro. (e.g., DBG(cerr << "Bad program" << endl); ). Statements
Packit a4aae4
  should not span lines unless they include `\'s to escape the newlines.
Packit a4aae4
Packit a4aae4
  jhrg 10/13/94
Packit a4aae4
*/
Packit a4aae4
Packit a4aae4
#ifndef _debug_h
Packit a4aae4
#define _debug_h
Packit a4aae4
Packit a4aae4
#ifdef __cplusplus
Packit a4aae4
Packit a4aae4
#include <iostream>
Packit a4aae4
using std::cerr;
Packit a4aae4
using std::string;
Packit a4aae4
using std::endl;
Packit a4aae4
#define FILE_N_LINE cerr << __FILE__ << ": " << __LINE__ << ":"
Packit a4aae4
Packit a4aae4
#else
Packit a4aae4
Packit a4aae4
#define FILE_N_LINE fprintf(stderr, "%s:%d: ", __FILE__, __LINE__);
Packit a4aae4
Packit a4aae4
#endif /* cplusplus */
Packit a4aae4
Packit a4aae4
#ifdef DODS_DEBUG
Packit a4aae4
#define DBG(x) FILE_N_LINE; x
Packit a4aae4
#define DBGN(x) x
Packit a4aae4
#else
Packit a4aae4
#define DBG(x) /* x */
Packit a4aae4
#define DBGN(x) /* x */
Packit a4aae4
#endif
Packit a4aae4
Packit a4aae4
/** The purpose of DODS_DEBUG1 is to look at only a handful of the DBG()
Packit a4aae4
    macros by changing them to DBG1() macros and defining DODS_DEBUG1. */
Packit a4aae4
#ifdef DODS_DEBUG1
Packit a4aae4
#define DBG1(x) FILE_N_LINE; x
Packit a4aae4
#else
Packit a4aae4
#define DBG1(x) /* x */
Packit a4aae4
#endif
Packit a4aae4
Packit a4aae4
#ifdef DODS_DEBUG2
Packit a4aae4
#define DBG2(x) FILE_N_LINE; x
Packit a4aae4
#define DBG2N(x) x
Packit a4aae4
#else
Packit a4aae4
#define DBG2(x) /* x */
Packit a4aae4
#define DBG2n(x) /* x */
Packit a4aae4
#endif
Packit a4aae4
Packit a4aae4
#ifdef DODS_PERF
Packit a4aae4
#error "Deprecated macro!"
Packit a4aae4
#endif
Packit a4aae4
Packit a4aae4
#endif /* _debug_h */