//-----------------------------------------------------------------------------
// Copyright © 2003 - Philip Howard - All rights reserved
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//-----------------------------------------------------------------------------
// package	libh/debug
// homepage	http://libh.slashusr.org/
//-----------------------------------------------------------------------------
// author	Philip Howard
// email	libh at ipal dot org
// homepage	http://phil.ipal.org/
//-----------------------------------------------------------------------------
// This file is best viewed using a fixed spaced font such as Courier
// and in a display at least 120 columns wide.
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// header	debug_off.h
//
// purpose	Define symbols to disable compilation of debug actions.
//		If DEBUG_ON is defined, debug will be enabled.
//
// note		The name debug is declared as a function and may also be
//		declared as a macro at the same time.
//-----------------------------------------------------------------------------

#include <stdio.h>

#ifndef DEBUG_DECLARED
#define DEBUG_DECLARED
int (debug)(int,const char *,...);
int (debug_set_file)(FILE *);
int (debug_set_level)(int);
#endif

#ifndef DEBUG_OFF

#define debug_signed(x,v)		(debug)((x),#v " = %ld",(signed long)(v))
#define debug_unsigned(x,v)		(debug)((x),#v " = %lu",(unsigned long)(v))
#define debug_pointer(x,v)		(debug)((x),#v " = %p",(void*)(v))
#define debug_string(x,v)		(debug)((x),#v " = \"%s\"",(char*)(v))
#define debug_cetal(x,v)		(debug)((x),#v " = 0x%08lx",(unsigned long)(v))

#else

#define debug(...)

#define debug_set_file(x)
#define debug_set_level(x)

#define debug_signed(x,v)
#define debug_unsigned(x,v)
#define debug_pointer(x,v)
#define debug_string(x,v)
#define debug_cetal(x,v)

#endif

