Update contrib.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
20 #ifndef __BITPANIC_H__
21 #define __BITPANIC_H__
24 void Panic(TGdiPanic aPanicCode);
25 void PanicWithCondAndInfo(TGdiPanic aPanic, const TDesC& aCondition, const TDesC& aFileName, const TDesC& aPanicName, TInt aLine);
28 void PanicLogWithInfo(const TDesC& aCommand, const TDesC& aCondition, const TDesC& aFileName, TInt aLine);
31 #define GDI_ASSERT_FILENAME(f) _LIT(KPanicFileName, f);
32 #define GDI_ASSERT_PANICNAME(p) _LIT(KPanicEnum ## p, # p);
33 #define GDI_ASSERT_PANICCOMMAND(a) _LIT(KPanicCommand, a);
34 #define GDI_ASSERT_CONDITION(c) _LIT(KPanicCondition, c);
36 /* Use these macros for GDI Asserts & Panics with diagnostic logging:
37 GDI_ASSERT_ALWAYS, GDI_ASSERT_ALWAYS_GENERAL, GDI_ASSERT_DEBUG
38 and GDI_ASSERT_DEBUG_GENERAL
39 Note that the "do { ... } while (0)" construction forces the invocation to have a ';'
40 and makes the macro expansion safe in nested "if ... else ..." clauses that forget to use the
41 { braces } in the Coding Standard.
44 #define GDI_ASSERT_ALWAYS(c, p) \
48 GDI_ASSERT_FILENAME(__FILE__); \
49 GDI_ASSERT_PANICNAME(p); \
50 GDI_ASSERT_CONDITION(#c); \
51 PanicWithCondAndInfo(p, KPanicCondition, KPanicFileName, KPanicEnum ## p, __LINE__); \
55 #define GDI_ASSERT_ALWAYS_GENERAL(c, a) \
59 GDI_ASSERT_FILENAME(__FILE__); \
60 GDI_ASSERT_PANICCOMMAND(#a); \
61 GDI_ASSERT_CONDITION(#c); \
62 PanicLogWithInfo(KPanicCondition, KPanicCommand, KPanicFileName, __LINE__); \
68 #define GDI_ASSERT_DEBUG(c, p) \
72 GDI_ASSERT_FILENAME(__FILE__); \
73 GDI_ASSERT_PANICNAME(p); \
74 GDI_ASSERT_CONDITION(#c); \
75 PanicWithCondAndInfo(p, KPanicCondition, KPanicFileName, KPanicEnum ## p, __LINE__); \
79 #define GDI_ASSERT_DEBUG_GENERAL(c, a) \
83 GDI_ASSERT_FILENAME(__FILE__); \
84 GDI_ASSERT_PANICCOMMAND(#a); \
85 GDI_ASSERT_CONDITION(#c); \
86 PanicLogWithInfo(KPanicCondition, KPanicCommand, KPanicFileName, __LINE__); \
92 #define GDI_ASSERT_DEBUG(c, p)
93 #define GDI_ASSERT_DEBUG_GENERAL(c, p)