File: debug.h

package info (click to toggle)
floater 1.2b1-6
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 1,612 kB
  • ctags: 1,822
  • sloc: ansic: 16,755; tcl: 4,034; sh: 1,291; makefile: 129
file content (85 lines) | stat: -rw-r--r-- 2,417 bytes parent folder | download
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* Copyright (c) 1996--1999 Geoff Pike. */
/* All rights reserved. */

/* Floater 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. */

/* This software is provided "as is" and comes with absolutely no */
/* warranties.  Geoff Pike is not liable for damages under any */
/* circumstances.  Support is not provided.  Use at your own risk. */

/* Personal, non-commercial use is allowed.  Attempting to make money */
/* from Floater or products or code derived from Floater is not allowed */
/* without prior written consent from Geoff Pike.  Anything that remotely */
/* involves commercialism, including (but not limited to) systems that */
/* show advertisements while being used and systems that collect */
/* information on users that is later sold or traded require prior */
/* written consent from Geoff Pike. */
#ifndef __DEBUG_H__
#define __DEBUG_H__

#include "floater.h"
#include <signal.h>
#include <assert.h>

#ifndef USER_TCL
#define USER_TCL 1
#endif

#ifndef CORE_DUMPS
#define CORE_DUMPS 1
#endif

#define MAKING_TUTORIAL 0
#define log(s) fputs(TEMPCAT((s), "\n"), logfile);

/* whether to create a log file of messages and other good stuff */
#define LOGGING 0

/* controls for various debugging output */
#define DBG 0
#define DBGu 0
#define DEBUGMSG 0
#define DEBUGMSG0 0
#define DEBUGCONN 0
#define DEBUGBR 0
#define DEBUGRES 0
#define DEBUGSEEN 0
#define DEBUGHEARTS 0

#define ANY_DBG (DBG||DEBUGCONN||DEBUGMSG||DEBUGBR||DEBUGRES||DEBUGSEEN||DEBUGHEARTS)

#define RANDOMPLAY 1 /* whether randomplay is an option */

extern bool debugprint;

#if CORE_DUMPS
#define floater_abort abort()
#else
#define floater_abort exit(-2)
#endif

#if ANY_DBG
#ifdef NO_X11
#define DEBUG(x) (TclDo("gset debugprinting 1"), (x), \
		  (TclDo("gset debugprinting 0")))
#else /* NO_X11 */
#define DEBUG(x) ((debugprint=TRUE), TclDo("gset debugprinting 1"), (x), \
		  (TclDo("gset debugprinting 0")), (debugprint=FALSE))
#endif /* NO_X11 */

#else /* ANY_DBG */
#define DEBUG(x)
#endif /* if ANY_DBG */

#undef _assert
#undef assert
# define _assert(ex)	{if (!(ex)){endcurses(); mail_bug("Assertion failed: file \"%s\", line %d\n", __FILE__, __LINE__); floater_abort;}}
# define assert(ex)	_assert(ex)

#if LOGGING||MAKING_TUTORIAL
extern FILE *logfile;
#endif

#endif /* __DEBUG_H__ */