/****************************************************************************
*
* $Id: Debug.h 1.1 1997/06/30 10:11:24 ssolie Exp $
*
*****************************************************************************
*
* Copyright (c) 1997 Software Evolution.  All Rights Reserved.
*
*****************************************************************************
*
* Debug.h -- Debugging macros header file
*
* This header file contains all the definitions necessary to use either
* serial or console debugging.
*
* The ideas are based on CATS debug.h header files and a few other ones from
* Aminet, etc.
*
* The options for debugging are as follows:
*	CONSOLEDEBUG	- Define for console debugging (default off)
*	SERIALDEBUG		- Define for serial console debugging (default off)
*	DEBUG2			- Define to turn on level 2 debugging (default off)
*	DEBUGDELAY		- Set delay for DD(bug()) statements (default 100 ticks)
*
* The macros are as follows:
*	D(bug())	- Simple debugging statement
*	DD(bug())	- Simple debugging statement with delay
*	D2(bug())	- Level 2 debugging statement
*	DD2(bug())	- Level 2 debugging statement with delay
*
* Example macro uses:
*	D(bug("about to do xyz. variable = $%lx\n", myvariable));
*	D2(bug("v1=$%lx v2=$%lx v3=$%lx\n", v1, v2, v3));
*	DD(bug("About to do something nasty...\n"));
*/

#ifndef DEBUG_H
#define DEBUG_H


/*** Function prototypes ***/
#ifndef  PROTO_DOS_H
#include <proto/dos.h>
#endif

void kprintf(unsigned char *fmt, ...);


/*** Setup defaults ***/
#ifndef DEBUGDELAY
#define DEBUGDELAY	100		/* 2 second delay */
#endif


/*** Debugging function used to print messages ***/
#if defined(SERIALDEBUG)
#define bug kprintf
#elif defined(CONSOLEDEBUG)
#define bug Printf
#endif


/*** Debugging macros ***/
#ifdef bug
#define D(x)  (x)
#define DD(x) (x); Delay(DEBUGDELAY)
#ifdef DEBUG2
#define D2(x)  (x)
#define DD2(x) (x); Delay(DEBUGDELAY)
#endif
#else
#define D(x) ;
#define DD(x) ;
#define D2(x) ;
#define DD2(x) ;
#endif


#endif
