sdkcreationmw/sdkruntimes/scard/src/SdkCardDebug.h
author rajpuroh
Mon, 08 Mar 2010 12:09:11 +0530
changeset 0 b26acd06ea60
permissions -rw-r--r--
First Contribution of SDK components
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     1
/*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     2
* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     3
* All rights reserved.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     4
* This component and the accompanying materials are made available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     6
* which accompanies this distribution, and is available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     8
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     9
* Initial Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    11
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    12
* Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    13
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    14
* Description: 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    15
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    16
*/
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    17
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    18
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    19
#ifndef _SDK_CARDDEBUG_H_
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    20
#define _SDK_CARDDEBUG_H_
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    21
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    22
// Defines RDebug:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    23
#include <e32svr.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    24
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    25
// files that redefine ASSERT macro
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    26
#include <e32def.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    27
#include <vwsdef.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    28
#include <mda/common/base.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    29
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    30
#define N(x) ((TInt)(sizeof(x)/sizeof((x)[0])))
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    31
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    32
//===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    33
// Debug trace
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    34
//===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    35
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    36
#ifdef _REALLY_DEBUG
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    37
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    38
#  ifdef TRACE_PREFIX
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    39
#    if defined(_UNICODE)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    40
#      define ___L(a,b) _L(a L##b)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    41
#    else  // _UNICODE
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    42
#      define ___L(a,b) _L(a##b)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    43
#    endif // _UNICODE
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    44
#    define __L(z) ___L(TRACE_PREFIX,z)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    45
#  else
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    46
#    define __L(z) _L(z)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    47
#  endif // TRACE_PREFIX
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    48
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    49
#  define TRACE(s)                  RDebug::Print(__L("%s"),_S(s))
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    50
#  define TRACE0(s)                 RDebug::Print(__L("%s"),_S(s))
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    51
#  define TRACE1(s,p1)              RDebug::Print(__L(s),p1)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    52
#  define TRACE2(s,p1,p2)           RDebug::Print(__L(s),p1,p2)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    53
#  define TRACE3(s,p1,p2,p3)        RDebug::Print(__L(s),p1,p2,p3)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    54
#  define TRACE4(s,p1,p2,p3,p4)     RDebug::Print(__L(s),p1,p2,p3,p4)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    55
#  define TRACE5(s,p1,p2,p3,p4,p5)  RDebug::Print(__L(s),p1,p2,p3,p4,p5)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    56
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    57
#  define DEBUG_ONLY(x)             x
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    58
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    59
#else  /* !_REALLY_DEBUG */
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    60
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    61
#  define TRACE(s)                  ((void)0)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    62
#  define TRACE0(s)                 ((void)0)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    63
#  define TRACE1(s,p1)              ((void)0)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    64
#  define TRACE2(s,p1,p2)           ((void)0)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    65
#  define TRACE3(s,p1,p2,p3)        ((void)0)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    66
#  define TRACE4(s,p1,p2,p3,p4)     ((void)0)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    67
#  define TRACE5(s,p1,p2,p3,p4,p5)  ((void)0)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    68
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    69
#  define DEBUG_ONLY(x)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    70
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    71
#endif /* !_REALLY_DEBUG */
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    72
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    73
//===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    74
// Debug assert
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    75
//===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    76
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    77
#undef ASSERT
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    78
#ifdef _REALLY_DEBUG
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    79
void SdkCardAssert(const TText* s,const TText* file,TInt line);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    80
TInt SdkCardAssertSuccess(TInt err,const TText* s,const TText* file,TInt line);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    81
void SdkCardLeave(TInt err,const TText* s,const TText* file,TInt line);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    82
void SdkCardLeaveIfNull(void*,const TText* s,const TText* file,TInt line);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    83
void SdkCardLeaveIfError(TInt err,const TText* s,const TText* file,TInt line);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    84
#  define __S(x) _S(x)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    85
#  define ASSERT(x) ((void)((x)||(SdkCardAssert(_S(#x),__S(__FILE__),__LINE__),0),0))
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    86
#  define LEAVE(x) SdkCardLeave(x,_S(#x),__S(__FILE__),__LINE__)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    87
#  define LEAVE_IF_NULL(x) SdkCardLeaveIfNull(x,_S(#x),__S(__FILE__),__LINE__)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    88
#  define LEAVE_IF_ERROR(x) SdkCardLeaveIfError(x,_S(#x),__S(__FILE__),__LINE__)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    89
#  define ASSERT_SUCCESS(x) SdkCardAssertSuccess(x,_S(#x),__S(__FILE__),__LINE__)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    90
#  define VERIFY_SUCCESS(x) ASSERT_SUCCESS(x)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    91
#else  // _REALLY_DEBUG
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    92
#  define ASSERT(x)         ((void)0)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    93
#  define LEAVE(x)          User::Leave(x)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    94
#  define LEAVE_IF_NULL(x)  User::LeaveIfNull(x)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    95
#  define LEAVE_IF_ERROR(x) User::LeaveIfError(x)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    96
#  define ASSERT_SUCCESS(x) ((void)0)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    97
#  define VERIFY_SUCCESS(x) (x)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    98
#endif // _REALLY_DEBUG
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    99
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   100
#endif // _SDK_CARDDEBUG_H_