1 /**
2  ** grxdebug.h ---- GRX library debug support
3  **
4  ** Copyright (c) 1998 Hartmut Schirmer
5  **
6  ** This file is part of the GRX graphics library.
7  **
8  ** The GRX graphics library is free software; you can redistribute it
9  ** and/or modify it under some conditions; see the "copying.grx" file
10  ** for details.
11  **
12  ** This library is distributed in the hope that it will be useful,
13  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  **
16  **/
17 
18 #ifndef __GRXDEBUG_H_INCLUDED__
19 #define __GRXDEBUG_H_INCLUDED__
20 
21 #define DBG_ENTER          0x8000
22 #define DBG_LEAVE          DBG_ENTER
23 #define DBG_FONT           0x4000
24 #define DBG_SETMD          0x2000
25 #define DBG_DRIVER         0x1000
26 #define DBG_COLOR          0x0800
27 #define DBG_COPYFILL       0x0400
28 
29 extern char *_GR_debug_file;
30 extern int   _GR_debug_line;
31 extern int   _GR_debug_flags;
32 extern void  _GR_debug_printf(char *fmt,...);
33 
34 # ifdef __GNUC__
35   extern char *_GR_debug_function;
36 #  define DBGPRINTF(tst,x) do {           \
37      if ((tst)&_GR_debug_flags) {         \
38        _GR_debug_file = __FILE__;         \
39        _GR_debug_line = __LINE__;         \
40        _GR_debug_function = __FUNCTION__; \
41        _GR_debug_printf x;                \
42      }                                    \
43    } while (0)
44 # else
45 #  define DBGPRINTF(tst,x) do {           \
46      if ((tst)&_GR_debug_flags) {         \
47        _GR_debug_file = __FILE__;         \
48        _GR_debug_line = __LINE__;         \
49        _GR_debug_printf x ;               \
50      }                                    \
51    } while (0)
52 #endif
53 
54 #define GRX_ENTER()       DBGPRINTF(DBG_ENTER,("FUNC ENTER\n"))
55 #define GRX_LEAVE()       DBGPRINTF(DBG_LEAVE,("FUNC EXIT\n"))
56 #define GRX_RETURN(x)     GRX_LEAVE(); return x;
57 
58 #endif  /* whole file */
59 
60