|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 /* Define all debug macros here */ |
|
18 |
|
19 #ifndef XADEBUG_H |
|
20 #define XADEBUG_H |
|
21 |
|
22 #define _DEBUG_API_ 1 |
|
23 #define _DEBUG_ERR_ 2 |
|
24 #define _DEBUG_INFO_ 4 |
|
25 |
|
26 /* |
|
27 * Define wanted debug level via DEBUG_LEVEL macro: |
|
28 * _DEPUG_API_ - prints entry/exit messages in the methods |
|
29 * _DEBUG_ERR_ - prints error messages |
|
30 * _DEBUG_INFO_ - prints info messages |
|
31 * |
|
32 * e.g. DEBUG_LEVEL ( _DEBUG_API_ | _DEBUG_ERR_ ) prints entry/exit and |
|
33 * error messages. |
|
34 */ |
|
35 #define DEBUG_LEVEL 0 |
|
36 |
|
37 |
|
38 /*********************************************************/ |
|
39 /* |
|
40 * Debug definitions do not touch |
|
41 */ |
|
42 #ifdef _DEBUG |
|
43 #include <stdio.h> |
|
44 #if ( DEBUG_LEVEL & _DEBUG_API_ ) |
|
45 #define DEBUG_API(X) printf(X"\n"); |
|
46 #define DEBUG_API_A1(X,A1) printf(X"\n",A1); |
|
47 #define DEBUG_API_A2(X,A1,A2) printf(X"\n",A1,A2); |
|
48 #define DEBUG_API_A3(X,A1,A2,A3) printf(X"\n",A1,A2,A3); |
|
49 #define DEBUG_API_A4(X,A1,A2,A3,A4) printf(X"\n",A1,A2,A3,A4); |
|
50 #else // ( DEBUG_LEVEL & _DEBUG_API_ ) |
|
51 #define DEBUG_API(X); |
|
52 #define DEBUG_API_A1(X,A1); |
|
53 #define DEBUG_API_A2(X,A1,A2); |
|
54 #define DEBUG_API_A3(X,A1,A2,A3); |
|
55 #define DEBUG_API_A4(X,A1,A2,A3,A4); |
|
56 #endif // ( DEBUG_LEVEL & _DEBUG_API_ ) |
|
57 |
|
58 #if ( DEBUG_LEVEL & _DEBUG_ERR_ ) |
|
59 #define DEBUG_ERR(X) printf(" ERR: "X"\n"); |
|
60 #define DEBUG_ERR_A1(X,A1) printf(" ERR: "X"\n",A1); |
|
61 #define DEBUG_ERR_A2(X,A1,A2) printf(" ERR: "X"\n",A1,A2); |
|
62 #define DEBUG_ERR_A3(X,A1,A2,A3) printf(" ERR: "X"\n",A1,A2,A3); |
|
63 #else // ( DEBUG_LEVEL & _DEBUG_ERR_ ) |
|
64 #define DEBUG_ERR(X); |
|
65 #define DEBUG_ERR_A1(X,A1); |
|
66 #define DEBUG_ERR_A2(X,A1,A2); |
|
67 #define DEBUG_ERR_A3(X,A1,A2,A3); |
|
68 #endif // ( DEBUG_LEVEL & _DEBUG_ERR_ ) |
|
69 |
|
70 #if ( DEBUG_LEVEL & _DEBUG_INFO_ ) |
|
71 #define DEBUG_INFO(X) printf(" :"X"\n"); |
|
72 #define DEBUG_INFO_A1(X,A1) printf(" :"X"\n",A1); |
|
73 #define DEBUG_INFO_A2(X,A1,A2) printf(" :"X"\n",A1,A2); |
|
74 #define DEBUG_INFO_A3(X,A1,A2,A3) printf(" :"X"\n",A1,A2,A3); |
|
75 #define DEBUG_INFO_A4(X,A1,A2,A3,A4) printf(" :"X"\n",A1,A2,A3,A4); |
|
76 #else // ( DEBUG_LEVEL & _DEBUG_INFO_ ) |
|
77 #define DEBUG_INFO(X); |
|
78 #define DEBUG_INFO_A1(X,A1); |
|
79 #define DEBUG_INFO_A2(X,A1,A2); |
|
80 #define DEBUG_INFO_A3(X,A1,A2,A3); |
|
81 #define DEBUG_INFO_A4(X,A1,A2,A3,A4); |
|
82 #endif // ( DEBUG_LEVEL & _DEBUG_INFO_ ) |
|
83 |
|
84 #else |
|
85 |
|
86 #define DEBUG_API(X) |
|
87 #define DEBUG_API_A1(X,A1) |
|
88 #define DEBUG_API_A2(X,A1,A2) |
|
89 #define DEBUG_API_A3(X,A1,A2,A3) |
|
90 #define DEBUG_API_A4(X,A1,A2,A3,A4) |
|
91 |
|
92 #define DEBUG_ERR(X) |
|
93 #define DEBUG_ERR_A1(X,A1) |
|
94 #define DEBUG_ERR_A2(X,A1,A2) |
|
95 #define DEBUG_ERR_A3(X,A1,A2,A3) |
|
96 |
|
97 #define DEBUG_INFO(X) |
|
98 #define DEBUG_INFO_A1(X,A1) |
|
99 #define DEBUG_INFO_A2(X,A1,A2) |
|
100 #define DEBUG_INFO_A3(X,A1,A2,A3) |
|
101 #define DEBUG_INFO_A4(X,A1,A2,A3,A4); |
|
102 #endif /* _DEBUG */ |
|
103 |
|
104 #endif /* XADEBUG_H */ |