0
|
1 |
/*
|
|
2 |
* Copyright (c) 2003-2005 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 |
|
|
18 |
|
|
19 |
#ifndef _SDK_CARDDEBUG_H_
|
|
20 |
#define _SDK_CARDDEBUG_H_
|
|
21 |
|
|
22 |
// Defines RDebug:
|
|
23 |
#include <e32svr.h>
|
|
24 |
|
|
25 |
// files that redefine ASSERT macro
|
|
26 |
#include <e32def.h>
|
|
27 |
#include <vwsdef.h>
|
|
28 |
#include <mda/common/base.h>
|
|
29 |
|
|
30 |
#define N(x) ((TInt)(sizeof(x)/sizeof((x)[0])))
|
|
31 |
|
|
32 |
//===========================================================================
|
|
33 |
// Debug trace
|
|
34 |
//===========================================================================
|
|
35 |
|
|
36 |
#ifdef _REALLY_DEBUG
|
|
37 |
|
|
38 |
# ifdef TRACE_PREFIX
|
|
39 |
# if defined(_UNICODE)
|
|
40 |
# define ___L(a,b) _L(a L##b)
|
|
41 |
# else // _UNICODE
|
|
42 |
# define ___L(a,b) _L(a##b)
|
|
43 |
# endif // _UNICODE
|
|
44 |
# define __L(z) ___L(TRACE_PREFIX,z)
|
|
45 |
# else
|
|
46 |
# define __L(z) _L(z)
|
|
47 |
# endif // TRACE_PREFIX
|
|
48 |
|
|
49 |
# define TRACE(s) RDebug::Print(__L("%s"),_S(s))
|
|
50 |
# define TRACE0(s) RDebug::Print(__L("%s"),_S(s))
|
|
51 |
# define TRACE1(s,p1) RDebug::Print(__L(s),p1)
|
|
52 |
# define TRACE2(s,p1,p2) RDebug::Print(__L(s),p1,p2)
|
|
53 |
# define TRACE3(s,p1,p2,p3) RDebug::Print(__L(s),p1,p2,p3)
|
|
54 |
# define TRACE4(s,p1,p2,p3,p4) RDebug::Print(__L(s),p1,p2,p3,p4)
|
|
55 |
# define TRACE5(s,p1,p2,p3,p4,p5) RDebug::Print(__L(s),p1,p2,p3,p4,p5)
|
|
56 |
|
|
57 |
# define DEBUG_ONLY(x) x
|
|
58 |
|
|
59 |
#else /* !_REALLY_DEBUG */
|
|
60 |
|
|
61 |
# define TRACE(s) ((void)0)
|
|
62 |
# define TRACE0(s) ((void)0)
|
|
63 |
# define TRACE1(s,p1) ((void)0)
|
|
64 |
# define TRACE2(s,p1,p2) ((void)0)
|
|
65 |
# define TRACE3(s,p1,p2,p3) ((void)0)
|
|
66 |
# define TRACE4(s,p1,p2,p3,p4) ((void)0)
|
|
67 |
# define TRACE5(s,p1,p2,p3,p4,p5) ((void)0)
|
|
68 |
|
|
69 |
# define DEBUG_ONLY(x)
|
|
70 |
|
|
71 |
#endif /* !_REALLY_DEBUG */
|
|
72 |
|
|
73 |
//===========================================================================
|
|
74 |
// Debug assert
|
|
75 |
//===========================================================================
|
|
76 |
|
|
77 |
#undef ASSERT
|
|
78 |
#ifdef _REALLY_DEBUG
|
|
79 |
void SdkCardAssert(const TText* s,const TText* file,TInt line);
|
|
80 |
TInt SdkCardAssertSuccess(TInt err,const TText* s,const TText* file,TInt line);
|
|
81 |
void SdkCardLeave(TInt err,const TText* s,const TText* file,TInt line);
|
|
82 |
void SdkCardLeaveIfNull(void*,const TText* s,const TText* file,TInt line);
|
|
83 |
void SdkCardLeaveIfError(TInt err,const TText* s,const TText* file,TInt line);
|
|
84 |
# define __S(x) _S(x)
|
|
85 |
# define ASSERT(x) ((void)((x)||(SdkCardAssert(_S(#x),__S(__FILE__),__LINE__),0),0))
|
|
86 |
# define LEAVE(x) SdkCardLeave(x,_S(#x),__S(__FILE__),__LINE__)
|
|
87 |
# define LEAVE_IF_NULL(x) SdkCardLeaveIfNull(x,_S(#x),__S(__FILE__),__LINE__)
|
|
88 |
# define LEAVE_IF_ERROR(x) SdkCardLeaveIfError(x,_S(#x),__S(__FILE__),__LINE__)
|
|
89 |
# define ASSERT_SUCCESS(x) SdkCardAssertSuccess(x,_S(#x),__S(__FILE__),__LINE__)
|
|
90 |
# define VERIFY_SUCCESS(x) ASSERT_SUCCESS(x)
|
|
91 |
#else // _REALLY_DEBUG
|
|
92 |
# define ASSERT(x) ((void)0)
|
|
93 |
# define LEAVE(x) User::Leave(x)
|
|
94 |
# define LEAVE_IF_NULL(x) User::LeaveIfNull(x)
|
|
95 |
# define LEAVE_IF_ERROR(x) User::LeaveIfError(x)
|
|
96 |
# define ASSERT_SUCCESS(x) ((void)0)
|
|
97 |
# define VERIFY_SUCCESS(x) (x)
|
|
98 |
#endif // _REALLY_DEBUG
|
|
99 |
|
|
100 |
#endif // _SDK_CARDDEBUG_H_
|