annotate src/debug.h @ 371:cc15677e0335 r21-2b1

Import from CVS: tag r21-2b1
author cvs
date Mon, 13 Aug 2007 11:03:08 +0200
parents c5d627a313b1
children 74fd4e045ea6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Debugging aids -- togglable assertions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1994 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 /* Written by Chuck Thompson */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 #ifndef _XEMACS_DEBUG_H_
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 #define _XEMACS_DEBUG_H_
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 #define DEBUG_STDERR 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 #define DEBUG_ABORT 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 #ifdef DEBUG_XEMACS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 #include <stdio.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 struct debug_classes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 unsigned int redisplay :1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 unsigned int buffers :1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 unsigned int extents :1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 unsigned int faces :1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 unsigned int windows :1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 unsigned int frames :1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 unsigned int devices :1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 unsigned int byte_code :1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 unsigned int types_of_redisplay;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 unsigned int types_of_buffers;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 unsigned int types_of_extents;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 unsigned int types_of_faces;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 unsigned int types_of_windows;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 unsigned int types_of_frames;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 unsigned int types_of_devices;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 unsigned int types_of_byte_code;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 0
diff changeset
56 extern Lisp_Object Qbuffers, Qdevices, Qfaces, Qframes, Qredisplay, Qwindows;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 0
diff changeset
57
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 extern struct debug_classes active_debug_classes;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 #define DASSERT(class, desired_type, action, assertion) do \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 if (active_debug_classes.##class \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 && (active_debug_classes.types_of_##class & desired_type)) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 if (! (assertion)) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 if (action == DEBUG_STDERR) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 stderr_out ("Assertion failed in %s at line %d\n", \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 __FILE__, __LINE__); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 else \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 abort (); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 } \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 } \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 #else /* !DEBUG_XEMACS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 #define DASSERT(class, desired_type, action, assertion) ((void) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 #endif /* !DEBUG_XEMACS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 #endif /* _XEMACS_DEBUG_H_ */