-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebug.h
46 lines (39 loc) · 1.4 KB
/
debug.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// This file is a part of Neo6502-Kermit.
// See LICENSE for the licensing details.
#include "cdefs.h"
#ifndef NODEBUG /* NODEBUG inhibits debugging */
#ifndef DEBUG /* and if DEBUG not already defined */
#ifndef MINSIZE /* MINSIZE inhibits debugging */
#ifndef DEBUG
#define DEBUG
#endif /* DEBUG */
#endif /* MINSIZE */
#endif /* DEBUG */
#endif /* NODEBUG */
#ifdef DEBUG /* Debugging included... */
/* dodebug() function codes... */
#define DB_OPN 1 /* Open log */
#define DB_LOG 2 /* Write label+string or int to log */
#define DB_MSG 3 /* Write message to log */
#define DB_CHR 4 /* Write label + char to log */
#define DB_PKT 5 /* Record a Kermit packet in log */
#define DB_CLS 6 /* Close log */
void dodebug(int, UCHAR*, UCHAR*, long); /* Prototype */
/*
dodebug() is accessed throug a macro that:
. Coerces its args to the required types.
. Accesses dodebug() directly or thru a pointer according to context.
. Makes it disappear entirely if DEBUG not defined.
*/
#ifdef KERMIT_C
/* In kermit.c we debug only through a function pointer */
#define debug(a, b, c, d) \
if (*(k->dbf)) \
(*(k->dbf))(a, (UCHAR*)b, (UCHAR*)c, (long)(d))
#else /* KERMIT_C */
/* Elsewhere we can call the debug function directly */
#define debug(a, b, c, d) dodebug(a, (UCHAR*)b, (UCHAR*)c, (long)(d))
#endif /* KERMIT_C */
#else /* Debugging not included... */
#define debug(a, b, c, d)
#endif /* DEBUG */