1 #ifndef DIAGNOSTICMACROS_H
2 #define DIAGNOSTICMACROS_H
4 ** $Id: DiagnosticMacros.h,v 1.3 2000/01/12 20:29:05 bernie Exp $
6 ** Copyright (C) 1999 Bernardo Innocenti <bernardo.innocenti@usa.net>
7 ** All rights reserved.
9 ** Use 4 chars wide TABs to read this file
11 ** These are some handy macros to dump some common system
12 ** structures to the debug console. Use DUMP_XXX(pointer)
13 ** in your code to get a full dump of the structure contents.
15 ** These macros will automatically disable themselves when the
16 ** preprocessor symbol DEBUG isn't defined.
21 #define DUMP_BITMAP(p) DumpBitMap(p, #p);
22 #define DUMP_LAYER(p) DumpLayer(p, #p);
23 #define DUMP_GADGETINFO(p) DumpGadgetInfo (p, #p);
25 #ifdef INTUITION_CGHOOKS_H
26 static void DumpGadgetInfo (struct GadgetInfo *p, const char *name)
30 DBPRINTF ("struct GadgetInfo * %s (at 0x%lx) = {\n", name, p);
31 DBPRINTF (" struct Screen * gi_Screen = 0x%lx\n", p->gi_Screen);
32 DBPRINTF (" struct Window * gi_Window = 0x%lx\n", p->gi_Window);
33 DBPRINTF (" struct Requester * gi_Requester = 0x%lx\n", p->gi_Requester);
35 DBPRINTF (" struct RastPort * gi_RastPort = 0x%lx\n", p->gi_RastPort);
36 DBPRINTF (" struct Layer * gi_Layer = 0x%lx\n", p->gi_Layer);
37 DBPRINTF (" struct IBox gi_Domain = { %ld, %ld, %ld, %ld }\n",
38 p->gi_Domain.Left, p->gi_Domain.Top, p->gi_Domain.Width, p->gi_Domain.Height);
39 DBPRINTF (" UBYTE gi_Pens = { %ld, %ld }\n",
40 p->gi_Pens.DetailPen, p->gi_Pens.BlockPen);
41 DBPRINTF (" struct DrawInfo * gi_DrInfo = 0x%lx\n", p->gi_DrInfo);
44 DBPRINTF (" struct GadgetInfo * %s = NULL\n", name);
46 #endif /* !INTUITION_CGHOOKS_H */
49 static void DumpBitMap (struct BitMap *p, const char *name)
53 DBPRINTF ("struct BitMap * %s (at 0x%lx) = {\n", name, p);
54 DBPRINTF (" UWORD BytesPerRow = %ld\n", p->BytesPerRow);
55 DBPRINTF (" UWORD Rows = %ld\n", p->Rows);
56 DBPRINTF (" UBYTE Flags = 0x%lx\n", p->Flags);
57 DBPRINTF (" UBYTE Depth = %ld\n", p->Depth);
58 DBPRINTF (" UWORD pad = %ld\n", p->pad);
59 DBPRINTF (" PLANEPTR Planes[8] = { 0x%lx, 0x%lx, 0x%lx, 0x%lx, 0x%lx, 0x%lx, 0x%lx, 0x%lx }\n",
60 p->Planes[0], p->Planes[1], p->Planes[2], p->Planes[3],
61 p->Planes[4], p->Planes[5], p->Planes[6], p->Planes[7]);
65 DBPRINTF (" struct BitMap * %s = NULL\n", name);
67 #endif /* !GRAPHICS_GFX_H */
70 #ifdef GRAPHICS_CLIP_H
71 static void DumpLayer (struct Layer *p, const char *name)
79 if (p->Flags & LAYERSIMPLE) strcat(flags, "LAYERSIMPLE");
80 if (p->Flags & LAYERSMART) strcat(flags, " | LAYERSMART");
81 if (p->Flags & LAYERSUPER) strcat(flags, " | LAYERSUPER");
82 if (p->Flags & 0x0008) strcat(flags, " | 0x0008");
83 if (p->Flags & LAYERUPDATING) strcat(flags, " | LAYERUPDATING");
84 if (p->Flags & 0x0020) strcat(flags, " | 0x0020");
85 if (p->Flags & LAYERBACKDROP) strcat(flags, " | LAYERBACKDROP");
86 if (p->Flags & LAYERREFRESH) strcat(flags, " | LAYERREFRESH");
87 if (p->Flags & LAYER_CLIPRECTS_LOST) strcat(flags, " | LAYER_CLIPRECTS_LOST");
88 if (p->Flags & LAYERIREFRESH) strcat (flags, " | LAYERIREFRESH");
89 if (p->Flags & LAYERIREFRESH2) strcat (flags, " | LAYERIREFRESH2");
90 if (p->Flags & 0x0800) strcat(flags, " | 0x0800");
91 if (p->Flags & 0x1000) strcat(flags, " | 0x1000");
92 if (p->Flags & 0x2000) strcat(flags, " | 0x2000");
93 if (p->Flags & 0x4000) strcat(flags, " | 0x4000");
94 if (p->Flags & 0x8000) strcat(flags, " | 0x8000");
97 DBPRINTF ("struct Layer * %s (at 0x%lx) = {\n", name, p);
98 DBPRINTF (" struct Layer * front = 0x%lx, back = 0x%lx\n", p->front, p->back);
99 DBPRINTF (" struct ClipRect * ClipRect = 0x%lx\n", p->ClipRect);
100 DBPRINTF (" struct RastPort * rp = 0x%lx\n", p->rp);
101 DBPRINTF (" struct Rectangle bounds = { %ld, %ld, %ld, %ld }\n",
102 p->bounds.MinX, p->bounds.MinY, p->bounds.MaxX, p->bounds.MaxY);
103 DBPRINTF (" UBYTE reserved[4] = { %ld, %ld, %ld, %ld }\n",
104 p->reserved[0], p->reserved[1], p->reserved[2], p->reserved[3]);
105 DBPRINTF (" UWORD priority = %ld\n", p->priority);
106 DBPRINTF (" UWORD Flags = 0x%lx (%s)\n", p->Flags, flags);
107 DBPRINTF (" struct BitMap * SuperBitMap = 0x%lx\n", p->SuperBitMap);
108 DBPRINTF (" struct ClipRect * SuperClipRect = 0x%lx\n", p->SuperClipRect);
109 DBPRINTF (" APTR Window = 0x%lx\n", p->Window);
110 DBPRINTF (" UWORD Scroll_X = %ld, Scroll_Y = %ld\n", p->Scroll_X, p->Scroll_Y);
111 DBPRINTF (" struct ClipRect * cr = 0x%lx, cr2 = 0x%lx, crnew = 0x%lx\n",
112 p->cr, p->cr2, p->crnew);
113 DBPRINTF (" struct ClipRect * SuperSaveClipRects = 0x%lx\n", p->SuperSaveClipRects);
114 DBPRINTF (" struct ClipRect * _cliprects = 0x%lx\n", p->_cliprects);
115 DBPRINTF (" struct Layer_Info * LayerInfo = 0x%lx\n", p->LayerInfo);
116 DBPRINTF (" struct SignalSemaphore Lock = {\n");
117 DBPRINTF (" WORD ss_NestCount = %ld\n", p->Lock.ss_NestCount);
118 DBPRINTF (" struct Task * ss_Owner = 0x%lx\n", p->Lock.ss_Owner);
121 DBPRINTF (" struct Hook * BackFill = 0x%lx\n", p->BackFill);
122 DBPRINTF (" ULONG reserved1 = 0x%lx\n", p->reserved1);
123 DBPRINTF (" struct Region * ClipRegion = 0x%lx\n", p->ClipRegion);
124 DBPRINTF (" struct Region * saveClipRects = 0x%lx\n", p->saveClipRects);
125 DBPRINTF (" WORD Width = %ld, Height = %ld\n", p->Width, p->Height);
126 DBPRINTF (" UBYTE reserved2[18] = ...\n");
127 DBPRINTF (" struct Region * DamageList = 0x%lx\n", p->DamageList);
131 DBPRINTF ("struct Layer * %s = NULL\n", name);
133 #endif /* !GRAPHICS_CLIP_H */
138 #else /* DEBUG not defined */
140 #define DUMP_BITMAP(x)
141 #define DUMP_LAYER(x)
142 #define DUMP_GADGETINFO(x)
146 #endif /* !DIAGNOSTICMACROS_H */