1 | /* -*- mode: C; tab-width:8; c-basic-offset:8 -*- |
---|
2 | * vi:set ts=8: |
---|
3 | * |
---|
4 | * al_debug.h |
---|
5 | * |
---|
6 | * Prototypes, macros and definitions related to the printing debugging |
---|
7 | * messages. |
---|
8 | * |
---|
9 | * The debugging facility relies heavily on defines provided by |
---|
10 | * al_siteconfig.h. One future optimization could rely on the varadic macro |
---|
11 | * facilities in ISO99 C. |
---|
12 | * |
---|
13 | */ |
---|
14 | #ifndef AL_DEBUG_H_ |
---|
15 | #define AL_DEBUG_H_ |
---|
16 | |
---|
17 | #include "al_siteconfig.h" |
---|
18 | |
---|
19 | #include <assert.h> |
---|
20 | |
---|
21 | #if defined(DEBUG) || defined(DEBUG_LOOP) || defined(DEBUG_STUB) || \ |
---|
22 | defined(DEBUG_CONFIG) || defined(DEBUG_LOCK) || defined(DEBUG_CONVERT) || \ |
---|
23 | defined(DEBUG_EXT) || defined(DEBUG_SOURCE) || defined(DEBUG_STREAMING)\ |
---|
24 | || defined(DEBUG_MATH) || defined(DEBUG_MEM) || defined(DEBUG_CONTEXT) \ |
---|
25 | || defined(DEBUG_MAXIMUS) || defined(DEBUG_BUFFER) \ |
---|
26 | || defined(DEBUG_LISTENER) || defined(DEBUG_QUEUE) || defined(DEBUG_FILTER) |
---|
27 | |
---|
28 | #define NEED_DEBUG |
---|
29 | #endif /* debug stuff */ |
---|
30 | |
---|
31 | #ifdef DEBUG_MAXIMUS |
---|
32 | #define DEBUG |
---|
33 | #endif /* DEBUG_MAXIMUS */ |
---|
34 | |
---|
35 | /* |
---|
36 | * aldEnum is an enum which enumerates each type of debug type. There isn't |
---|
37 | * any rule to which message should be associated with which debug type, but |
---|
38 | * the general idea is that if the user configures openal with |
---|
39 | * --enable-debug-foo, only debug messages relavant to foo should be printed. |
---|
40 | */ |
---|
41 | typedef enum _aldEnum |
---|
42 | { |
---|
43 | ALD_INVALID, |
---|
44 | ALD_CONVERT, |
---|
45 | ALD_CONFIG, |
---|
46 | ALD_SOURCE, |
---|
47 | ALD_LOOP, |
---|
48 | ALD_STUB, |
---|
49 | ALD_CONTEXT, |
---|
50 | ALD_MATH, |
---|
51 | ALD_MIXER, |
---|
52 | ALD_ERROR, |
---|
53 | ALD_EXT, |
---|
54 | ALD_LOCK, |
---|
55 | ALD_STREAMING, |
---|
56 | ALD_MEM, |
---|
57 | ALD_MAXIMUS, |
---|
58 | ALD_BUFFER, |
---|
59 | ALD_LISTENER, |
---|
60 | ALD_QUEUE, |
---|
61 | ALD_FILTER, |
---|
62 | ALD_MAXMAXMAX = 0x7fffffff |
---|
63 | } aldEnum; |
---|
64 | |
---|
65 | /* |
---|
66 | * If debugging messages for the type level are enabled, print the debugging |
---|
67 | * message specified by format, ... ( printf format ). Otherwise, return. |
---|
68 | */ |
---|
69 | int _alDebug( aldEnum level, const char *fn, int ln, const char *format, ... ) |
---|
70 | AL_ATTRIBUTE_FORMAT_PRINTF_(4,5); |
---|
71 | #endif |
---|