#ifndef GIMMELIB_DEBUG_H
#define GIMMELIB_DEBUG_H

#ifdef DEBUG

#define DEBUGCMD(c) c
#define DEBUGMSG(c) printf(c)
#define DEBUGMSG1(c,p) printf(c,p)
#define DEBUGMSG2(c,p1,p2) printf(c,p1,p2)
#define DEBUGMSG3(c,p1,p2,p3) printf(c,p1,p2,p3)
#define DEBUGMSG4(c,p1,p2,p3,p4) printf(c,p1,p2,p3,p4)

#ifndef OWNDEBUG
/* doPrintf parms: process-port, reply-port, c, p1, p2, p3, p4
 * note regarding reply-port: if it is NULL, then the printf might not get
 * done before a crash since doPrintf will not wait for a reply to make
 * sure that the printf was done
 * THIS VERSION uses gimMainPort as a default port, so it had better be there!!
*/
/* subtask debug message */
#define STDEBUGMSG(c) doPrintf(gimMainPort,NULL,c,0,0,0,0)
#define STDEBUGMSG1(c,p) doPrintf(gimMainPort,NULL,c,p,0,0,0)
#define STDEBUGMSG2(c,p1,p2) doPrintf(gimMainPort,NULL,c,p1,p2,0,0,0)
#define STDEBUGMSG3(c,p1,p2,p3) doPrintf(gimMainPort,NULL,c,p1,p2,p3,0)
#define STDEBUGMSG4(c,p1,p2,p3,p4) doPrintf(gimMainPort,NULL,c,p1,p2,p3,p4)
#endif !OWNDEBUG

#else

#define DEBUGCMD(c)
#define DEBUGMSG(c)
#define DEBUGMSG1(c,p)
#define DEBUGMSG2(c,p1,p2)
#define DEBUGMSG3(c,p1,p2,p3)
#define DEBUGMSG4(c,p1,p2,p3,p4)

#define STDEBUGMSG(c)
#define STDEBUGMSG1(c,p)
#define STDEBUGMSG2(c,p1,p2)
#define STDEBUGMSG3(c,p1,p2,p3)
#define STDEBUGMSG4(c,p1,p2,p3,p4)

#endif else !DEBUG

#endif !GIMMELIB_DEBUG_H
