xref: /plan9/sys/src/cmd/gs/src/gsmdebug.h (revision 6a9fc400c33447ef5e1cda7185cb4de2c8e8010e)
1 /* Copyright (C) 1995, 1996, 1998 Aladdin Enterprises.  All rights reserved.
2 
3   This file is part of AFPL Ghostscript.
4 
5   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
6   distributor accepts any responsibility for the consequences of using it, or
7   for whether it serves any particular purpose or works at all, unless he or
8   she says so in writing.  Refer to the Aladdin Free Public License (the
9   "License") for full details.
10 
11   Every copy of AFPL Ghostscript must include a copy of the License, normally
12   in a plain ASCII text file named PUBLIC.  The License grants you the right
13   to copy, modify and redistribute AFPL Ghostscript, but only under certain
14   conditions described in the License.  Among other things, the License
15   requires that the copyright notice and this notice be preserved on all
16   copies.
17 */
18 
19 /*$Id: gsmdebug.h,v 1.3 2001/08/01 16:21:35 stefan911 Exp $ */
20 /* Allocator debugging definitions and interface */
21 /* Requires gdebug.h (for gs_debug) */
22 
23 #ifndef gsmdebug_INCLUDED
24 #  define gsmdebug_INCLUDED
25 
26 /* Define the fill patterns used for debugging the allocator. */
27 extern const byte
28        gs_alloc_fill_alloc,	/* allocated but not initialized */
29        gs_alloc_fill_block,	/* locally allocated block */
30        gs_alloc_fill_collected,	/* garbage collected */
31        gs_alloc_fill_deleted,	/* locally deleted block */
32        gs_alloc_fill_free;	/* freed */
33 
34 /* Define an alias for a specialized debugging flag */
35 /* that used to be a separate variable. */
36 #define gs_alloc_debug gs_debug['@']
37 
38 /* Conditionally fill unoccupied blocks with a pattern. */
39 extern void gs_alloc_memset(P3(void *, int /*byte */ , ulong));
40 
41 #ifdef DEBUG
42 #  define gs_alloc_fill(ptr, fill, len)\
43      BEGIN if ( gs_alloc_debug ) gs_alloc_memset(ptr, fill, (ulong)(len)); END
44 #else
45 #  define gs_alloc_fill(ptr, fill, len)\
46      DO_NOTHING
47 #endif
48 
49 #endif /* gsmdebug_INCLUDED */
50