|
1 /* |
|
2 * Copyright (c) 2003-2008 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: This file contains various macros to control debug printing with |
|
15 * RDebug::Print() and insertion of file failure test code. |
|
16 * NOTE-macro is provided to simplify printing warnings compile-time. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 #ifndef CBS_DEBUG_H |
|
23 #define CBS_DEBUG_H |
|
24 |
|
25 ///////////////////////////////////////////////////////////////////////////// |
|
26 // #Defines that control printing of additional information to debug stream. |
|
27 ///////////////////////////////////////////////////////////////////////////// |
|
28 |
|
29 // Defining this enables debug printing with DEBUG(), DVAL() and DVAL2 macros. |
|
30 //#define CBS_PRINT_DEBUG_INFO |
|
31 |
|
32 // Defining this enables printing of headers of received messages |
|
33 //#define CBS_PRINT_MESSAGE_HEADER |
|
34 |
|
35 // Defining this makes message generators print the content of generated |
|
36 // messages in plaintext. |
|
37 //#define CBS_PRINT_MESSAGE_CONTENT |
|
38 |
|
39 // Defining this makes message generators print the content of generated |
|
40 // messages in hexadecimal |
|
41 //#define CBS_PRINT_GENERATED_MESSAGES_IN_HEX |
|
42 |
|
43 // Prints topic file store structure to debug stream on startup. |
|
44 //#define CBS_PRINT_STORE_STRUCTURE 1 |
|
45 |
|
46 // Prints additional info on generated messages |
|
47 //#define CBS_EMULATOR_PRINT_ADDITIONAL_INFO |
|
48 |
|
49 ///////////////////////////////////////////////////////////////////////////// |
|
50 // #Defines that control compilation of file operation failure tests. |
|
51 ///////////////////////////////////////////////////////////////////////////// |
|
52 |
|
53 // Defining this inserts User::Leave:s before file changes are commited. |
|
54 // Usage: FAIL_FILE_OP; forces a leave if DO_FILE_OP_FAILURE_TESTS is defined. |
|
55 |
|
56 // #define DO_FILE_OP_FAILURE_TESTS 1 |
|
57 |
|
58 // Defining this inserts User::Leave:s to critical places trying to break |
|
59 // the database integrity. |
|
60 // Usage: FAIL_FILE_OP_IN_A_NASTY_WAY; forces a leave if |
|
61 // DO_NASTY_FILE_OP_FAILURE_TESTS is defined. |
|
62 |
|
63 // #define DO_NASTY_FILE_OP_FAILURE_TESTS 1 |
|
64 |
|
65 // Defining this inserts User::Leave:s before file operations on startup. |
|
66 // Usage: FAIL_FILE_OP_STARTUP; forces a leave if |
|
67 // DO_FILE_OP_FAILURE_STARTUP_TESTS is defined. |
|
68 |
|
69 //#define DO_FILE_OP_FAILURE_STARTUP_TESTS |
|
70 |
|
71 ///////////////////////////////////////////////////////////////////////////// |
|
72 // Macros to simplify writing to the debug stream. |
|
73 ///////////////////////////////////////////////////////////////////////////// |
|
74 |
|
75 #ifdef _DEBUG |
|
76 #ifdef CBS_PRINT_DEBUG_INFO |
|
77 #include <e32svr.h> |
|
78 #define DEBUG(s) RDebug::Print(_L(s)) |
|
79 #define DVA(s, v) RDebug::Print(_L(s), v) |
|
80 #define DVA2(s, v1, v2) RDebug::Print(_L(s), v1, v2) |
|
81 #define DPRINT(s) RDebug::Print(s) |
|
82 |
|
83 #else // CBS_PRINT_DEBUG_INFO |
|
84 #define DEBUG(s) |
|
85 #define DVA(s, v) |
|
86 #define DVA2(s, v1, v2) |
|
87 #define DPRINT(s) |
|
88 #endif // CBS_PRINT_DEBUG_INFO |
|
89 #else |
|
90 #define DEBUG(s) |
|
91 #define DVA(s, v) |
|
92 #define DVA2(s, v1, v2) |
|
93 #define DPRINT(s) |
|
94 #endif // _DEBUG |
|
95 |
|
96 ///////////////////////////////////////////////////////////////////////////// |
|
97 // Macros to test file operation failures. |
|
98 ///////////////////////////////////////////////////////////////////////////// |
|
99 |
|
100 #ifdef DO_FILE_OP_FAILURE_TESTS |
|
101 #define FAIL_FILE_OP User::Leave( KErrDiskFull ) |
|
102 #else |
|
103 #define FAIL_FILE_OP |
|
104 #endif // DO_FILE_OP_FAILURE_TESTS |
|
105 |
|
106 #ifdef DO_NASTY_FILE_OP_FAILURE_TESTS |
|
107 #define FAIL_FILE_OP_IN_A_NASTY_WAY User::Leave( KErrDiskFull ) |
|
108 #else |
|
109 #define FAIL_FILE_OP_IN_A_NASTY_WAY |
|
110 #endif // DO_FILE_OP_FAILURE_TESTS |
|
111 |
|
112 #ifdef DO_FILE_OP_FAILURE_STARTUP_TESTS |
|
113 #define FAIL_FILE_OP_STARTUP User::Leave( KErrDiskFull ) |
|
114 #else |
|
115 #define FAIL_FILE_OP_STARTUP |
|
116 #endif // DO_FILE_OP_FAILURE_TESTS |
|
117 |
|
118 ///////////////////////////////////////////////////////////////////////////// |
|
119 // NOTE is a convience macro to simplify printing warning texts compile-time. |
|
120 // The macro will print the filename and line number in question. |
|
121 // |
|
122 // Usage: #pragma message(NOTE "Please remove this") |
|
123 ///////////////////////////////////////////////////////////////////////////// |
|
124 #define STRINGIZE( L ) #L |
|
125 #define MAKESTRING( M, L ) M(L) |
|
126 #define LINENUMBER MAKESTRING( STRINGIZE, __LINE__ ) |
|
127 #define NOTE __FILE__ "(" LINENUMBER ") : " |
|
128 |
|
129 #endif // CBS_DEBUG_H |
|
130 |
|
131 // End of File |