/* Title  : > h.trace
 * Purpose: centralised control for trace/debug output
 * Version: 0.1
 *          0.2 SKS allow for trace setting without modifying this file
 */

/****************************************************************************
 * This source file was written by Acorn Computers Limited. It is part of   *
 * the "cwimp" library for writing applications in C for RISC OS. It may be *
 * used freely in the creation of programs for Archimedes. It should be     *
 * used with Acorn's C Compiler Release 2 or later.                         *
 *                                                                          *
 * No support can be given to programmers using this code and, while we     *
 * believe that it is correct, no correspondence can be entered into        *
 * concerning behaviour or bugs.                                            *
 *                                                                          *
 * Upgrades of this code may or may not appear, and while every effort will *
 * be made to keep such upgrades upwards compatible, no guarantees can be   *
 * given.                                                                   *
 ***************************************************************************/

#ifndef TRACE
#define TRACE 0
#endif

/* This flag says if tracing is compiled in. It should be used in
conditional compilation statements around all tracing code. */

#if TRACE

void tracef(char*,...);
/* must only appear if TRACE is 0: see "else" case below. */

void tracef0(char*);
void tracef1(char*, int);
void tracef2(char*, int,int);
void tracef3(char*, int,int,int);
void tracef4(char*, int,int,int,int);

/* These forms can occur outside conditional compilation clauses:
they will produce no code if TRACE is not set. */

int trace_is_on(void);
void trace_on(void);
void trace_off(void);

#else

/* No-trace versions */
/* tracef itself cannot be done as a macro. */

#define tracef0(a) ;
#define tracef1(a,b) ;
#define tracef2(a,b,c) ;
#define tracef3(a,b,c,d) ;
#define tracef4(a,b,c,d,e) ;

#define trace_is_on(void) 0
#define trace_on(void) ;
#define trace_off(void) ;

#endif

/* end h.trace */
