epoc32/include/e32def.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of the License "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:
williamr@2
    15
* e32\include\e32def.h
williamr@2
    16
* NOTE: THIS FILE SHOULD BE ACCEPTABLE TO A C COMPILER
williamr@2
    17
* 
williamr@2
    18
*
williamr@2
    19
*/
williamr@2
    20
williamr@2
    21
williamr@2
    22
williamr@2
    23
#ifndef __E32DEF_H__
williamr@2
    24
#define __E32DEF_H__
williamr@2
    25
williamr@2
    26
/*
williamr@2
    27
 * __LEAVE_EQUALS_THROW__ requires the compiler to support C++ exceptions
williamr@2
    28
 */
williamr@2
    29
#ifndef __SUPPORT_CPP_EXCEPTIONS__
williamr@2
    30
#undef __LEAVE_EQUALS_THROW__
williamr@2
    31
#endif
williamr@2
    32
williamr@2
    33
williamr@2
    34
#if defined(__VC32__)
williamr@2
    35
/**
williamr@2
    36
@publishedAll
williamr@2
    37
@released
williamr@2
    38
*/
williamr@2
    39
#define __NO_CLASS_CONSTS__
williamr@2
    40
#if (_MSC_VER >= 1200)
williamr@2
    41
/**
williamr@2
    42
@publishedAll
williamr@2
    43
@released
williamr@2
    44
*/
williamr@2
    45
#define __NORETURN__ __declspec(noreturn)
williamr@2
    46
#else
williamr@2
    47
#define __NORETURN__
williamr@2
    48
#endif
williamr@2
    49
/**
williamr@2
    50
@publishedAll
williamr@2
    51
@released
williamr@2
    52
*/
williamr@2
    53
#define __NORETURN_TERMINATOR()
williamr@2
    54
/**
williamr@2
    55
@publishedAll
williamr@2
    56
@released
williamr@2
    57
*/
williamr@2
    58
#define IMPORT_C __declspec(dllexport)
williamr@2
    59
/**
williamr@2
    60
@publishedAll
williamr@2
    61
@released
williamr@2
    62
*/
williamr@2
    63
#define EXPORT_C __declspec(dllexport)
williamr@2
    64
/**
williamr@2
    65
@publishedAll
williamr@2
    66
@released
williamr@2
    67
*/
williamr@4
    68
#define IMPORT_D __declspec(dllexport)
williamr@4
    69
/**
williamr@4
    70
@publishedAll
williamr@4
    71
@released
williamr@4
    72
*/
williamr@4
    73
#define EXPORT_D __declspec(dllexport)
williamr@4
    74
/**
williamr@4
    75
@publishedAll
williamr@4
    76
@released
williamr@4
    77
*/
williamr@2
    78
#define NONSHARABLE_CLASS(x) class x
williamr@2
    79
/**
williamr@2
    80
@publishedAll
williamr@2
    81
@released
williamr@2
    82
*/
williamr@2
    83
#define NONSHARABLE_STRUCT(x) struct x
williamr@2
    84
/**
williamr@2
    85
@publishedAll
williamr@2
    86
@released
williamr@2
    87
*/
williamr@2
    88
#define __NO_THROW throw()
williamr@2
    89
/**
williamr@2
    90
@publishedAll
williamr@2
    91
@released
williamr@2
    92
*/
williamr@2
    93
#define __THROW(t) throw(t)
williamr@2
    94
#pragma warning( disable : 4355 )	/* 'this' used in base member initializer list */
williamr@2
    95
#pragma warning( disable : 4511 )	/* copy constructor could not be generated */
williamr@2
    96
#pragma warning( disable : 4512 )	/* assignment operator could not be generated */
williamr@2
    97
#pragma warning( disable : 4514 )	/* unreferenced inline function has been removed */
williamr@2
    98
#pragma warning( disable : 4699 )	/* Note: Using precompiled header %s */
williamr@2
    99
#pragma warning( disable : 4710 )	/* function not inlined */
williamr@2
   100
#pragma warning( disable : 4121 )	/* alignment sensitive to packing */
williamr@2
   101
#pragma warning( disable : 4273 )
williamr@2
   102
#pragma warning( disable : 4097 )	/* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */
williamr@2
   103
#pragma warning( disable : 4291 )	/* 'TAny *CBase::operator new(TUint,TLeave)' : no matching operator delete found; memory will not be freed if initialization throws an exception */
williamr@2
   104
williamr@2
   105
#if _MSC_VER  >= 1100
williamr@2
   106
/**
williamr@2
   107
@publishedAll
williamr@2
   108
@released
williamr@2
   109
*/
williamr@2
   110
#define TEMPLATE_SPECIALIZATION template<>
williamr@2
   111
#else
williamr@2
   112
#define TEMPLATE_SPECIALIZATION
williamr@2
   113
#endif
williamr@2
   114
#endif
williamr@2
   115
williamr@2
   116
williamr@2
   117
williamr@2
   118
#if defined(__CW32__)
williamr@2
   119
#undef __embedded_cplusplus
williamr@2
   120
/** @internalTechnology */
williamr@2
   121
#define __embedded_cplusplus	1
williamr@2
   122
#define __NO_CLASS_CONSTS__
williamr@2
   123
#define __NORETURN__
williamr@2
   124
#define __NORETURN_TERMINATOR()
williamr@2
   125
#define IMPORT_C __declspec(dllexport)
williamr@2
   126
#define EXPORT_C __declspec(dllexport)
williamr@4
   127
#define IMPORT_D __declspec(dllexport)
williamr@4
   128
#define EXPORT_D __declspec(dllexport)
williamr@2
   129
#define NONSHARABLE_CLASS(x) class x
williamr@2
   130
#define NONSHARABLE_STRUCT(x) struct x
williamr@2
   131
#define __NO_THROW throw()
williamr@2
   132
#define __THROW(t) throw(t)
williamr@2
   133
williamr@2
   134
#define TEMPLATE_SPECIALIZATION template<>
williamr@2
   135
/**
williamr@2
   136
@publishedAll
williamr@2
   137
@released
williamr@2
   138
*/
williamr@2
   139
#define _asm	asm
williamr@2
   140
#ifndef __int64
williamr@2
   141
#pragma longlong on
williamr@2
   142
/** @internalTechnology */
williamr@2
   143
#define __int64  long long
williamr@2
   144
#endif
williamr@2
   145
#ifndef __SUPPORT_CPP_EXCEPTIONS__
williamr@2
   146
#pragma exceptions off    /* no support for C++ exception handling */
williamr@2
   147
#pragma RTTI off          /* no support for C++ runtime type information */
williamr@2
   148
#endif
williamr@2
   149
#if __MWERKS__ >= 0x3200
williamr@2
   150
#pragma warning off (10480)	/* deleteing void pointer is undefined */
williamr@2
   151
#pragma warning off (10350) /* N pad byte(s) inserted after data member */
williamr@2
   152
#endif
williamr@2
   153
#endif
williamr@2
   154
williamr@2
   155
williamr@4
   156
//
williamr@4
   157
// GCC (ARM) compiler
williamr@4
   158
//
williamr@4
   159
#if defined(__GCC32__) && defined(__MARM__)
williamr@4
   160
#ifndef __GNUC__		/* GCC98r2 doesn't define this for some reason */
williamr@4
   161
#define __GNUC__	2
williamr@4
   162
#endif
williamr@2
   163
#define __NO_CLASS_CONSTS__
williamr@2
   164
#define __NORETURN__  __attribute__ ((noreturn))
williamr@2
   165
#ifdef __GCCV3__
williamr@2
   166
#define __NORETURN_TERMINATOR()
williamr@2
   167
#else
williamr@2
   168
#define __NORETURN_TERMINATOR()		abort()
williamr@2
   169
#endif
williamr@2
   170
#define IMPORT_C
williamr@4
   171
#define IMPORT_D
williamr@2
   172
#if !defined __WINS__ && defined _WIN32 /* VC++ Browser Hack */
williamr@2
   173
#define EXPORT_C
williamr@4
   174
#define EXPORT_D
williamr@2
   175
/** @internalTechnology */
williamr@2
   176
#define asm(x)
williamr@2
   177
#else
williamr@2
   178
#define EXPORT_C __declspec(dllexport)
williamr@4
   179
#define EXPORT_D __declspec(dllexport)
williamr@2
   180
#endif
williamr@2
   181
#define NONSHARABLE_CLASS(x) class x
williamr@2
   182
#define NONSHARABLE_STRUCT(x) struct x
williamr@2
   183
#define __NO_THROW
williamr@2
   184
#define __THROW(t)
williamr@2
   185
#ifdef __EABI__
williamr@2
   186
#define TEMPLATE_SPECIALIZATION template<>
williamr@2
   187
#else
williamr@2
   188
#define TEMPLATE_SPECIALIZATION
williamr@2
   189
#endif
williamr@2
   190
/**
williamr@2
   191
@publishedAll
williamr@2
   192
@released
williamr@2
   193
*/
williamr@2
   194
#define __DOUBLE_WORDS_SWAPPED__
williamr@2
   195
#endif
williamr@2
   196
williamr@2
   197
williamr@2
   198
/** @internalTechnology */
williamr@2
   199
#define __NO_MUTABLE_KEYWORD
williamr@2
   200
#if defined(__NO_MUTABLE_KEYWORD)
williamr@2
   201
/**
williamr@2
   202
@publishedAll
williamr@2
   203
@deprecated
williamr@2
   204
*/
williamr@2
   205
#define __MUTABLE
williamr@2
   206
#else
williamr@2
   207
#define __MUTABLE mutable
williamr@2
   208
#endif
williamr@2
   209
williamr@2
   210
williamr@2
   211
williamr@2
   212
/**
williamr@2
   213
@publishedAll
williamr@2
   214
@deprecated
williamr@2
   215
*/
williamr@2
   216
#define CONST_CAST(type,exp) (const_cast<type>(exp))
williamr@2
   217
williamr@2
   218
/**
williamr@2
   219
@publishedAll
williamr@2
   220
@deprecated
williamr@2
   221
*/
williamr@2
   222
#define STATIC_CAST(type,exp) (static_cast<type>(exp))
williamr@2
   223
williamr@2
   224
/**
williamr@2
   225
@publishedAll
williamr@2
   226
@deprecated
williamr@2
   227
*/
williamr@2
   228
#define REINTERPRET_CAST(type,exp) (reinterpret_cast<type>(exp))
williamr@2
   229
williamr@2
   230
#if defined(__NO_MUTABLE_KEYWORD)
williamr@2
   231
/**
williamr@2
   232
@publishedAll
williamr@2
   233
@deprecated
williamr@2
   234
*/
williamr@2
   235
#define MUTABLE_CAST(type,exp) (const_cast<type>(exp))
williamr@2
   236
#else
williamr@2
   237
#define MUTABLE_CAST(type,exp) (exp)
williamr@2
   238
#endif
williamr@2
   239
williamr@2
   240
/**
williamr@2
   241
@publishedAll
williamr@2
   242
@deprecated
williamr@2
   243
*/
williamr@2
   244
#define GLREF_D extern
williamr@2
   245
/**
williamr@2
   246
@publishedAll
williamr@2
   247
@deprecated
williamr@2
   248
*/
williamr@2
   249
#define GLDEF_D
williamr@2
   250
/**
williamr@2
   251
@publishedAll
williamr@2
   252
@deprecated
williamr@2
   253
*/
williamr@2
   254
#define LOCAL_D static
williamr@2
   255
/**
williamr@2
   256
@publishedAll
williamr@2
   257
@deprecated
williamr@2
   258
*/
williamr@2
   259
#define GLREF_C extern
williamr@2
   260
/**
williamr@2
   261
@publishedAll
williamr@2
   262
@deprecated
williamr@2
   263
*/
williamr@2
   264
#define GLDEF_C
williamr@2
   265
/**
williamr@2
   266
@publishedAll
williamr@2
   267
@deprecated
williamr@2
   268
*/
williamr@2
   269
#define LOCAL_C static
williamr@2
   270
/**
williamr@4
   271
@internalAll
williamr@4
   272
@prototype
williamr@4
   273
*/
williamr@4
   274
#ifndef IMPORT_D
williamr@4
   275
#define IMPORT_D IMPORT_C 
williamr@4
   276
#endif
williamr@4
   277
williamr@4
   278
/**
williamr@2
   279
@publishedAll
williamr@2
   280
@deprecated
williamr@2
   281
*/
williamr@2
   282
#define FOREVER for(;;)
williamr@2
   283
williamr@2
   284
williamr@2
   285
williamr@2
   286
williamr@2
   287
/**
williamr@2
   288
@publishedAll
williamr@2
   289
@released
williamr@2
   290
williamr@2
   291
Symbolic definition for a true value.
williamr@2
   292
*/
williamr@2
   293
#define TRUE 1
williamr@2
   294
williamr@2
   295
williamr@2
   296
williamr@2
   297
williamr@2
   298
/**
williamr@2
   299
@publishedAll
williamr@2
   300
@released
williamr@2
   301
williamr@2
   302
Symbolic definition for a false value.
williamr@2
   303
*/
williamr@2
   304
#define FALSE 0
williamr@2
   305
#ifndef NULL
williamr@2
   306
williamr@2
   307
williamr@2
   308
williamr@2
   309
williamr@2
   310
/**
williamr@2
   311
@publishedAll
williamr@2
   312
@released
williamr@2
   313
williamr@2
   314
Symbolic definition for a NULL value.
williamr@2
   315
*/
williamr@2
   316
#define NULL 0
williamr@2
   317
#endif
williamr@2
   318
williamr@2
   319
williamr@2
   320
williamr@2
   321
williamr@2
   322
#ifndef VA_START
williamr@2
   323
/**
williamr@2
   324
@publishedAll
williamr@2
   325
@released
williamr@2
   326
williamr@2
   327
A macro used by Symbian OS code for handling a variable argument list
williamr@2
   328
in a function call.
williamr@2
   329
williamr@2
   330
Sets a pointer to point to the first of the variable arguments.
williamr@2
   331
williamr@2
   332
Typical usage:
williamr@2
   333
williamr@2
   334
@code
williamr@2
   335
Foo(CAbcdef aAbcdef,...)
williamr@2
   336
   {
williamr@2
   337
   VA_LIST list;
williamr@2
   338
   VA_START(list, aAbcdef);
williamr@2
   339
   // other code
williamr@2
   340
   } 
williamr@2
   341
@endcode
williamr@2
   342
williamr@2
   343
@param ap   A pointer used to hold the address of an argument in
williamr@2
   344
            the variable argument list. After execution of the code generated 
williamr@2
   345
            by this macro, the pointer points to the first argument in
williamr@2
   346
            the variable argument list.
williamr@2
   347
            This symbol is usually declared as a VA_LIST type. 
williamr@2
   348
williamr@2
   349
@param pn   The argument that immediately precedes the variable argument list.
williamr@2
   350
williamr@2
   351
@see VA_LIST
williamr@2
   352
@see VA_ARG
williamr@2
   353
*/
williamr@2
   354
#define VA_START(ap,pn) ((ap)[0]=(TInt8 *)&pn+((sizeof(pn)+sizeof(TInt)-1)&~(sizeof(TInt)-1)),(void)0)
williamr@2
   355
#endif
williamr@2
   356
williamr@2
   357
williamr@2
   358
williamr@2
   359
williamr@2
   360
#ifndef VA_ARG
williamr@2
   361
/**
williamr@2
   362
@publishedAll
williamr@2
   363
@released
williamr@2
   364
williamr@2
   365
A macro used by Symbian OS code for handling a variable argument list
williamr@2
   366
in a function call.
williamr@2
   367
williamr@2
   368
Increments a pointer to a variable argument list to point to the next argument
williamr@2
   369
in the list. The current argument is assumed to be of a type defined by
williamr@2
   370
the second parameter to this macro.
williamr@2
   371
williamr@2
   372
Typical usage:
williamr@2
   373
williamr@2
   374
@code
williamr@2
   375
Foo(CAbcdef aAbcdef,...)
williamr@2
   376
   {
williamr@2
   377
   VA_LIST list;
williamr@2
   378
   VA_START(list, aAbcdef);
williamr@2
   379
   ...
williamr@2
   380
   TInt x = VA_ARG(list,TInt);
williamr@2
   381
   ...
williamr@2
   382
   const TDesC *pS=VA_ARG(aList,const TDesC*);
williamr@2
   383
   ... 
williamr@2
   384
   etc
williamr@2
   385
   } 
williamr@2
   386
@endcode
williamr@2
   387
williamr@2
   388
@param ap   A pointer used to hold the address of an argument in
williamr@2
   389
            the variable argument list. It is assumed to point to the current
williamr@2
   390
            argument in the variable argument list. After execution of the code
williamr@2
   391
            generated by this macro, the pointer points to the next argument in
williamr@2
   392
            the list. This symbol is usually declared as a VA_LIST type. 
williamr@2
   393
williamr@2
   394
@param type The type of the current argument.
williamr@2
   395
            This can be any valid type, for example, TInt, const TDesC*, etc.
williamr@2
   396
            
williamr@2
   397
@see VA_LIST
williamr@2
   398
@see VA_START            
williamr@2
   399
*/
williamr@2
   400
#define VA_ARG(ap,type) ((ap)[0]+=((sizeof(type)+sizeof(TInt)-1)&~(sizeof(TInt)-1)),(*(type *)((ap)[0]-((sizeof(type)+sizeof(TInt)-1)&~(sizeof(TInt)-1)))))
williamr@2
   401
#endif
williamr@2
   402
williamr@2
   403
williamr@2
   404
williamr@2
   405
williamr@2
   406
#ifndef VA_END
williamr@2
   407
/**
williamr@2
   408
@publishedAll
williamr@2
   409
@released
williamr@2
   410
williamr@2
   411
A macro used by Symbian OS code for handling a variable argument list
williamr@2
   412
in a function call.
williamr@2
   413
williamr@2
   414
Sets a pointer to zero.
williamr@2
   415
williamr@2
   416
@param ap   A pointer used to hold the address of an argument in
williamr@2
   417
            the variable argument list. After execution of the code generated 
williamr@2
   418
            by this macro, the pointer is reset to 0.
williamr@2
   419
            This symbol is usually declared as a VA_LIST type. 
williamr@2
   420
            
williamr@2
   421
@see VA_LIST
williamr@2
   422
@see VA_START
williamr@2
   423
@see VA_ARG            
williamr@2
   424
*/
williamr@2
   425
#define VA_END(ap) ((ap)[0]=0,(void)0)
williamr@2
   426
#endif
williamr@2
   427
	
williamr@2
   428
williamr@2
   429
williamr@2
   430
/**
williamr@2
   431
@publishedAll
williamr@2
   432
@released
williamr@2
   433
williamr@2
   434
Calculates the offset of member f within class c.
williamr@2
   435
williamr@2
   436
This is used in the TSglQue and TDblQue constructors to set the offset of
williamr@2
   437
the link object from the start of a list element.
williamr@2
   438
williamr@2
   439
@param c The name of the class.
williamr@2
   440
@param f The name of the member within the specified class.
williamr@2
   441
williamr@2
   442
@see TSglQue
williamr@2
   443
@see TDblQue
williamr@2
   444
*/
williamr@2
   445
#ifndef _FOFF
williamr@2
   446
#if __GNUC__ < 4
williamr@2
   447
#define _FOFF(c,f)			(((TInt)&(((c *)0x1000)->f))-0x1000)
williamr@2
   448
#else
williamr@4
   449
#define _FOFF(c,f)			(__builtin_offsetof(c,f))
williamr@2
   450
#endif
williamr@2
   451
#endif
williamr@2
   452
williamr@2
   453
williamr@2
   454
williamr@2
   455
/**
williamr@2
   456
@internalTechnology
williamr@2
   457
@released
williamr@2
   458
*/
williamr@2
   459
#define _ALIGN_DOWN(x,a)	((x)&~((a)-1))
williamr@2
   460
/**
williamr@2
   461
@internalTechnology
williamr@2
   462
@released
williamr@2
   463
*/
williamr@2
   464
#define _ALIGN_UP(x,a)		_ALIGN_DOWN((x)+(a)-1, a)
williamr@2
   465
williamr@2
   466
williamr@2
   467
williamr@2
   468
williamr@2
   469
/** 
williamr@2
   470
@publishedAll
williamr@2
   471
@released
williamr@2
   472
williamr@2
   473
Pointer to any type.
williamr@2
   474
williamr@2
   475
TAny* is equivalent to void* in standard C or C++. TAny* is used in preference 
williamr@2
   476
to void* because it is more suggestive of the actual meaning,
williamr@2
   477
e.g. TAny* foo();.
williamr@2
   478
williamr@2
   479
TAny is not used where it really means "nothing", as in the declaration of 
williamr@2
   480
functions which do not return a value; void is used instead, e.g. void Foo();.
williamr@2
   481
*/
williamr@2
   482
typedef void TAny;
williamr@2
   483
williamr@2
   484
williamr@2
   485
williamr@2
   486
williamr@2
   487
/**
williamr@2
   488
@publishedAll
williamr@2
   489
@released
williamr@2
   490
williamr@2
   491
8-bit signed integer type, used in Symbian OS to mean an 8-bit
williamr@2
   492
signed integer, independent of the implementation.
williamr@2
   493
*/
williamr@2
   494
typedef signed char TInt8;
williamr@2
   495
williamr@2
   496
williamr@2
   497
williamr@2
   498
williamr@2
   499
/**
williamr@2
   500
@publishedAll
williamr@2
   501
@released
williamr@2
   502
williamr@2
   503
8-bit unsigned integer type; used in Symbian OS to mean an 8-bit
williamr@2
   504
unsigned integer, independent of the implementation.
williamr@2
   505
*/
williamr@2
   506
typedef unsigned char TUint8;
williamr@2
   507
williamr@2
   508
williamr@2
   509
williamr@2
   510
williamr@2
   511
/**
williamr@2
   512
@publishedAll
williamr@2
   513
@released
williamr@2
   514
williamr@2
   515
16-bit signed integer type, used in Symbian OS to mean a 16-bit
williamr@2
   516
signed integer, independent of the implementation.
williamr@2
   517
*/
williamr@2
   518
typedef short int TInt16;
williamr@2
   519
williamr@2
   520
williamr@2
   521
williamr@2
   522
williamr@2
   523
/**
williamr@2
   524
@publishedAll
williamr@2
   525
@released
williamr@2
   526
williamr@2
   527
16-bit unsigned integer type. used in Symbian OS to mean a 16-bit
williamr@2
   528
unsigned integer, independent of the implementation.
williamr@2
   529
*/
williamr@2
   530
typedef unsigned short int TUint16;
williamr@2
   531
williamr@2
   532
williamr@2
   533
williamr@2
   534
williamr@2
   535
/**
williamr@2
   536
@publishedAll
williamr@2
   537
@released
williamr@2
   538
williamr@2
   539
32-bit signed integer type, used in Symbian OS to mean a 32-bit
williamr@2
   540
signed integer, independent of the implementation.
williamr@2
   541
*/
williamr@2
   542
typedef long int TInt32;
williamr@2
   543
williamr@2
   544
williamr@2
   545
williamr@2
   546
williamr@2
   547
/**
williamr@2
   548
@publishedAll
williamr@2
   549
@released
williamr@2
   550
williamr@4
   551
A signed integer type of the same size as a pointer.
williamr@4
   552
*/
williamr@4
   553
typedef TInt32 T_IntPtr;
williamr@4
   554
typedef TInt32 TIntPtr;
williamr@4
   555
williamr@4
   556
williamr@4
   557
williamr@4
   558
williamr@4
   559
/**
williamr@4
   560
@publishedAll
williamr@4
   561
@released
williamr@4
   562
williamr@2
   563
32-bit unsigned integer type; used in Symbian OS to mean a 32-bit
williamr@2
   564
unsigned integer, independent of the implementation.
williamr@2
   565
*/
williamr@2
   566
typedef unsigned long int TUint32;
williamr@2
   567
williamr@2
   568
williamr@2
   569
williamr@2
   570
williamr@2
   571
/**
williamr@2
   572
@publishedAll
williamr@2
   573
@released
williamr@2
   574
williamr@4
   575
An unsigned integer type of the same size as a pointer.
williamr@4
   576
*/
williamr@4
   577
typedef TUint32 T_UintPtr;
williamr@4
   578
typedef TUint32 TUintPtr;
williamr@4
   579
williamr@4
   580
williamr@4
   581
williamr@4
   582
williamr@4
   583
/**
williamr@4
   584
@publishedAll
williamr@4
   585
@released
williamr@4
   586
williamr@2
   587
Signed integer type of the natural machine word length.
williamr@2
   588
williamr@2
   589
This is as defined by the C++ implementation's int type. In all
williamr@2
   590
implementations, this is guaranteed to be at least 32 bits.
williamr@2
   591
williamr@2
   592
A TInt should be used in preference to a sized integer (TInt32, TInt16) for 
williamr@2
   593
all general use. Sized integers should only be used when packing is essential. 
williamr@2
   594
C++'s type conversion rules imply that all sized integers smaller than the 
williamr@2
   595
natural machine word are in any case broadened to the natural machine word 
williamr@2
   596
size when passed as function parameters.
williamr@2
   597
williamr@2
   598
A TInt should be used in preference to an unsigned integer (TUint) for all 
williamr@2
   599
general use. Unsigned integers should only be used for flags (which use Boolean 
williamr@2
   600
operations but not arithmetic) and, in very rare cases, for numbers whose 
williamr@2
   601
range exceeds that available from signed integers. Although it is natural 
williamr@2
   602
to attempt to use unsigned integers for quantities which cannot by nature 
williamr@2
   603
be negative, the C++ language does not provide the support necessary to enforce 
williamr@2
   604
the "expected" behaviour in these circumstances, and experience has shown 
williamr@2
   605
that it is better to use signed integers unless there is good reason not to.
williamr@2
   606
williamr@2
   607
@see TUint
williamr@2
   608
@see TInt32
williamr@2
   609
@see TInt16
williamr@2
   610
*/
williamr@2
   611
typedef signed int TInt;
williamr@2
   612
williamr@2
   613
williamr@2
   614
williamr@2
   615
williamr@2
   616
/**
williamr@2
   617
@publishedAll
williamr@2
   618
@released
williamr@2
   619
williamr@2
   620
Unsigned integer type of the natural machine word length. 
williamr@2
   621
williamr@2
   622
This is guaranteed to be at least 32 bits in all implementations.
williamr@2
   623
williamr@2
   624
In almost all circumstances, a TInt should be used in preference to a TUint. 
williamr@2
   625
The main exception is in flags bytes.
williamr@2
   626
williamr@2
   627
@see TInt
williamr@2
   628
*/
williamr@2
   629
typedef unsigned int TUint;
williamr@2
   630
williamr@2
   631
williamr@2
   632
williamr@2
   633
williamr@2
   634
/**
williamr@2
   635
@publishedAll
williamr@2
   636
@released
williamr@2
   637
williamr@2
   638
32-bit floating point number, providing IEEE754 single precision on all Symbian 
williamr@2
   639
OS implementations.
williamr@2
   640
williamr@2
   641
TReal should normally be used in preference to TReal32.
williamr@2
   642
williamr@2
   643
Use of floating-point numbers should generally be avoided unless a natural 
williamr@2
   644
part of the problem specification. Most Symbian OS implementations do not 
williamr@2
   645
have a hardware floating point unit: as a result, their floating-point performance 
williamr@2
   646
is hundreds of times slower than integer performance.
williamr@2
   647
*/
williamr@2
   648
typedef float TReal32;
williamr@2
   649
williamr@2
   650
williamr@2
   651
williamr@2
   652
williamr@2
   653
/**
williamr@2
   654
@publishedAll
williamr@2
   655
@released
williamr@2
   656
williamr@2
   657
64-bit floating point number, providing IEEE754 double precision on all Symbian 
williamr@2
   658
OS implementations.
williamr@2
   659
williamr@2
   660
Use of floating-point numbers should generally be avoided unless a natural 
williamr@2
   661
part of the problem specification. Most Symbian OS implementations do not 
williamr@2
   662
have a hardware floating point unit: as a result, their floating-point performance 
williamr@2
   663
is hundreds of times slower than integer performance.
williamr@2
   664
williamr@2
   665
This type is identical to TReal.
williamr@2
   666
williamr@2
   667
@see TReal
williamr@2
   668
*/
williamr@2
   669
typedef double TReal64;
williamr@2
   670
williamr@2
   671
williamr@2
   672
williamr@2
   673
williamr@2
   674
/**
williamr@2
   675
@publishedAll
williamr@2
   676
@released
williamr@2
   677
williamr@2
   678
64-bit floating point number; identical to TReal64.
williamr@2
   679
williamr@2
   680
Use of floating-point numbers should generally be avoided unless a natural 
williamr@2
   681
part of the problem specification. Most Symbian OS implementations do not 
williamr@2
   682
have a hardware floating point unit: as a result, their floating-point performance 
williamr@2
   683
is hundreds of times slower than integer performance.
williamr@2
   684
williamr@2
   685
Most serious floating-point calculations require double-precision. All standard 
williamr@2
   686
math functions (see Math class) take double-precision arguments. Single-precision 
williamr@2
   687
should only be used where space and performance are at a premium, and when 
williamr@2
   688
their limited precision is acceptable.
williamr@2
   689
williamr@2
   690
@see TReal64
williamr@2
   691
@see Math
williamr@2
   692
*/
williamr@2
   693
typedef double TReal;
williamr@2
   694
williamr@2
   695
williamr@2
   696
williamr@2
   697
williamr@2
   698
/**
williamr@2
   699
@publishedAll
williamr@2
   700
@released
williamr@2
   701
williamr@2
   702
8-bit unsigned character.
williamr@2
   703
williamr@2
   704
Use instead of C++ built-in char type because it is guaranteed to be unsigned. 
williamr@2
   705
Use instead of TInt8 where the application is really for text rather than 
williamr@2
   706
8-bit arithmetic or binary quantities.
williamr@2
   707
williamr@2
   708
For most purposes, you should use TText rather than TText8. TText is mapped 
williamr@2
   709
onto either TText8 or TText16 depending on whether a non-Unicode or Unicode 
williamr@2
   710
variant is being built. Use TText8 only when you are dealing explicitly with 
williamr@2
   711
8-bit text, regardless of build.
williamr@2
   712
williamr@2
   713
@see TText */
williamr@2
   714
typedef unsigned char TText8;
williamr@2
   715
williamr@2
   716
williamr@2
   717
williamr@2
   718
williamr@2
   719
/**
williamr@2
   720
@publishedAll
williamr@2
   721
@released
williamr@2
   722
williamr@2
   723
16-bit unsigned character.
williamr@2
   724
williamr@2
   725
Use instead of C++ wchar_t type because it is guaranteed to be unsigned. Use 
williamr@2
   726
instead of TInt16 where the application is really for text rather than 8-bit 
williamr@2
   727
arithmetic or binary quantities.
williamr@2
   728
williamr@2
   729
For most purposes, you should use TText rather than TText16. TText is mapped 
williamr@2
   730
onto either TText8 or TText16 depending on whether a non-Unicode or Unicode 
williamr@2
   731
variant is being built. Use TText16 only when you are dealing explicitly with 
williamr@2
   732
16-bit text, regardless of build.
williamr@2
   733
williamr@2
   734
@see TText
williamr@2
   735
*/
williamr@2
   736
typedef unsigned short int TText16;
williamr@2
   737
williamr@2
   738
williamr@2
   739
williamr@2
   740
williamr@2
   741
/**
williamr@2
   742
@publishedAll
williamr@2
   743
@released
williamr@2
   744
williamr@2
   745
Boolean type which takes the value either ETrue or EFalse.
williamr@2
   746
williamr@2
   747
Although only a single bit would theoretically be necessary to represent a 
williamr@2
   748
Boolean, a machine word is used instead, so that these quantities can be easily 
williamr@2
   749
passed. Also, TBool must map onto int because of C++'s interpretation of 
williamr@2
   750
operands in conditional expressions.
williamr@2
   751
*/
williamr@2
   752
typedef int TBool;
williamr@2
   753
williamr@2
   754
williamr@2
   755
williamr@2
   756
williamr@2
   757
/**
williamr@2
   758
@publishedPartner
williamr@2
   759
@released
williamr@2
   760
williamr@2
   761
Defines a linear (virtual) address type.
williamr@2
   762
*/
williamr@4
   763
typedef T_UintPtr TLinAddr;
williamr@4
   764
williamr@2
   765
williamr@2
   766
williamr@2
   767
#if defined(__GCC32__)
williamr@2
   768
williamr@2
   769
williamr@2
   770
williamr@2
   771
williamr@2
   772
/**
williamr@2
   773
@publishedAll
williamr@2
   774
@released
williamr@2
   775
williamr@2
   776
Defines a 64-bit signed integer type.
williamr@2
   777
*/
williamr@2
   778
typedef long long Int64;
williamr@2
   779
williamr@2
   780
williamr@2
   781
williamr@2
   782
williamr@2
   783
/**
williamr@2
   784
@publishedAll
williamr@2
   785
@released
williamr@2
   786
williamr@2
   787
Defines a 64-bit unsigned integer type.
williamr@2
   788
*/
williamr@2
   789
typedef unsigned long long Uint64;
williamr@2
   790
williamr@2
   791
williamr@2
   792
williamr@2
   793
williamr@2
   794
/**
williamr@2
   795
@publishedAll
williamr@2
   796
@released
williamr@2
   797
*/
williamr@2
   798
#define	I64LIT(x)	x##LL
williamr@2
   799
/**
williamr@2
   800
@publishedAll
williamr@2
   801
@released
williamr@2
   802
*/
williamr@2
   803
#define	UI64LIT(x)	x##ULL
williamr@2
   804
williamr@2
   805
#elif defined(__VC32__)
williamr@2
   806
typedef __int64 Int64;
williamr@2
   807
typedef unsigned __int64 Uint64;
williamr@2
   808
#define	I64LIT(x)	(__int64)##x
williamr@2
   809
#define	UI64LIT(x)	(unsigned __int64)##x
williamr@2
   810
williamr@2
   811
#elif defined(__CW32__)
williamr@2
   812
#pragma longlong on
williamr@2
   813
typedef long long Int64;
williamr@2
   814
typedef unsigned long long Uint64;
williamr@2
   815
#define	I64LIT(x)	x##LL
williamr@2
   816
#define	UI64LIT(x)	x##ULL
williamr@2
   817
#endif
williamr@2
   818
williamr@2
   819
williamr@2
   820
williamr@2
   821
williamr@2
   822
/**
williamr@2
   823
@publishedAll
williamr@2
   824
@released
williamr@2
   825
williamr@2
   826
Defines a 64-bit signed integer type.
williamr@2
   827
williamr@2
   828
NOTE: For those migrating from versions of Symbian OS before 8.1b (i.e. 8.1a, 7.0s etc)
williamr@2
   829
TInt64 is now defined as a built-in type instead of as a class type. This means
williamr@2
   830
that the member functions of the old TInt64 class are no longer exported
williamr@2
   831
from EUSER.LIB, and represents a compatibility break.
williamr@2
   832
williamr@2
   833
To ease migration of source code, a number of macros are provided. Similar
williamr@2
   834
macros have also been defined in Symbian OS versions 7.0s and 8.1a, but
williamr@2
   835
implemented in terms of the old TInt64 class. This is important for code that
williamr@2
   836
is common to : one or both of these Symbian OS versions, and to 8.1b and
williamr@2
   837
subsequent versions.
williamr@2
   838
williamr@2
   839
The following list shows the new macros and the functions that they replace.
williamr@2
   840
It also shows some alternative techniques.
williamr@2
   841
In this list: x, v and r are declared as TInt64, c is declared as TInt, High
williamr@2
   842
and Low are declared as TUint.
williamr@2
   843
williamr@2
   844
@code
williamr@2
   845
OLD USAGE						REPLACEMENT
williamr@2
   846
williamr@2
   847
TInt64(High,Low);				MAKE_TINT64(High,Low);
williamr@2
   848
x.Set(High,Low);				MAKE_TINT64(High,Low);
williamr@2
   849
x.Low();						I64LOW(x);
williamr@2
   850
x.High();						I64HIGH(x); 
williamr@2
   851
x.GetTInt();					I64INT(x); 
williamr@2
   852
x.GetTReal();					I64REAL(x); 
williamr@2
   853
x.Lsr(c);						I64LSR(x,c); 
williamr@2
   854
x.Mul10();						x*=10; 
williamr@2
   855
x.MulTop(a);					I64MULTOP(x,a); 
williamr@2
   856
x.DivMod(v,r);					r=x%v; x/=v;
williamr@2
   857
@endcode 
williamr@2
   858
*/
williamr@2
   859
typedef	Int64	TInt64;
williamr@2
   860
williamr@2
   861
williamr@2
   862
williamr@2
   863
williamr@2
   864
/**
williamr@2
   865
@publishedAll
williamr@2
   866
@released
williamr@2
   867
 
williamr@2
   868
Defines a 64-bit unsigned integer type.
williamr@2
   869
*/
williamr@2
   870
typedef	Uint64	TUint64;
williamr@2
   871
williamr@2
   872
williamr@2
   873
williamr@2
   874
williamr@2
   875
/** @internalComponent */
williamr@2
   876
#define _MAKE_TINT64_ZX(x)	((TInt64)((TUint32)(x)))
williamr@2
   877
williamr@2
   878
/** @internalComponent */
williamr@2
   879
#define _MAKE_TUINT64_ZX(x)	((TUint64)((TUint32)(x)))
williamr@2
   880
williamr@2
   881
williamr@2
   882
williamr@2
   883
williamr@2
   884
/**
williamr@2
   885
@publishedAll
williamr@2
   886
@released
williamr@2
   887
*/
williamr@2
   888
#define MAKE_TINT64(h,l)	( (_MAKE_TINT64_ZX(h)<<32) | _MAKE_TINT64_ZX(l) )
williamr@2
   889
williamr@2
   890
williamr@2
   891
williamr@2
   892
williamr@2
   893
/**
williamr@2
   894
@publishedAll
williamr@2
   895
@released
williamr@2
   896
*/
williamr@2
   897
#define MAKE_TUINT64(h,l)	( (_MAKE_TUINT64_ZX(h)<<32) | _MAKE_TUINT64_ZX(l) )
williamr@2
   898
williamr@2
   899
williamr@2
   900
williamr@2
   901
williamr@2
   902
/**
williamr@2
   903
@publishedAll
williamr@2
   904
@released
williamr@2
   905
williamr@2
   906
Generates code to access the high order 32 bits of a 64 bit number.
williamr@2
   907
*/
williamr@2
   908
#define	I64HIGH(x)			( (TUint32)((x)>>32) )
williamr@2
   909
williamr@2
   910
williamr@2
   911
williamr@2
   912
williamr@2
   913
/**
williamr@2
   914
@publishedAll
williamr@2
   915
@released
williamr@2
   916
williamr@2
   917
Generates code to access the low order 32 bits of a 64 bit number.
williamr@2
   918
*/
williamr@2
   919
#define	I64LOW(x)			( (TUint32)(x) )
williamr@2
   920
williamr@2
   921
williamr@2
   922
williamr@2
   923
williamr@2
   924
/**
williamr@2
   925
@publishedAll
williamr@2
   926
@released
williamr@2
   927
williamr@2
   928
Generates code to cast a 64 bit value as an signed integer.
williamr@2
   929
*/
williamr@2
   930
#define	I64INT(x)			( (TInt)(x) )
williamr@2
   931
williamr@2
   932
williamr@2
   933
williamr@2
   934
williamr@2
   935
/**
williamr@2
   936
@publishedAll
williamr@2
   937
@released
williamr@2
   938
williamr@2
   939
Generates code to cast a 64 bit value as a TReal type.
williamr@2
   940
*/
williamr@2
   941
#define	I64REAL(x)			( (TReal)(x) )
williamr@2
   942
williamr@2
   943
williamr@2
   944
williamr@2
   945
williamr@2
   946
/**
williamr@2
   947
@publishedAll
williamr@2
   948
@released
williamr@2
   949
williamr@2
   950
Generates code to logically shift a 64 bit integer right.
williamr@2
   951
*/
williamr@2
   952
#define	I64LSR(x, shift)	( *reinterpret_cast<TUint64*>(&(x)) >>= (shift) )
williamr@2
   953
williamr@2
   954
williamr@2
   955
williamr@2
   956
/**
williamr@2
   957
@publishedAll
williamr@2
   958
@released
williamr@2
   959
williamr@2
   960
Generates code to multiply a 64 bit integer by 10.
williamr@2
   961
*/
williamr@2
   962
#define	I64MUL10(x)			( (x) *= 10 )
williamr@2
   963
williamr@2
   964
williamr@2
   965
williamr@2
   966
/**
williamr@2
   967
@publishedAll
williamr@2
   968
@released
williamr@2
   969
williamr@2
   970
Generates code to divide a 64 bit integer by another and find the remainder.
williamr@2
   971
*/
williamr@2
   972
#define	I64DIVMOD(x, divisor, remainder)	( ((remainder) = (x) % (divisor), (x) /= (divisor)) )
williamr@2
   973
williamr@2
   974
williamr@2
   975
williamr@2
   976
williamr@2
   977
/**
williamr@2
   978
@publishedAll
williamr@2
   979
@released
williamr@2
   980
williamr@2
   981
Generates code to cast a double to a 64 bit integer.
williamr@2
   982
*/
williamr@2
   983
#define	I64DOUBLECAST(x)	( static_cast<TInt64>(x) )
williamr@2
   984
williamr@2
   985
williamr@2
   986
williamr@2
   987
williamr@2
   988
/**
williamr@2
   989
@publishedAll
williamr@2
   990
@deprecated Use _LIT8 instead.
williamr@2
   991
williamr@2
   992
8-bit literal.
williamr@2
   993
williamr@2
   994
The macro defines an explicit 8-bit constant literal which is suitable
williamr@2
   995
for non-Unicode literal text, regardless of the build.
williamr@2
   996
williamr@2
   997
@see _L
williamr@2
   998
@see _LIT8
williamr@2
   999
@see _LIT
williamr@2
  1000
*/
williamr@2
  1001
#define _L8(a) (TPtrC8((const TText8 *)(a)))
williamr@2
  1002
williamr@2
  1003
williamr@2
  1004
williamr@2
  1005
williamr@2
  1006
/**
williamr@2
  1007
@publishedAll
williamr@2
  1008
@released
williamr@2
  1009
williamr@2
  1010
Defines an explicit 8-bit string which is suitable when non-Unicode text
williamr@2
  1011
is required, regardless of the build.
williamr@2
  1012
williamr@2
  1013
This is used by the deprecated literal descriptor _L8.
williamr@2
  1014
*/
williamr@2
  1015
#define _S8(a) ((const TText8 *)a)
williamr@2
  1016
williamr@2
  1017
williamr@2
  1018
williamr@2
  1019
williamr@2
  1020
/**
williamr@2
  1021
@publishedAll
williamr@2
  1022
@released
williamr@2
  1023
williamr@2
  1024
Constructs a constant literal descriptor of type TLitC8<TInt> with
williamr@2
  1025
the specified name and text.
williamr@2
  1026
williamr@2
  1027
The 8-bit build variant is generated for both non-Unicode and Unicode builds.
williamr@2
  1028
williamr@2
  1029
@param name The name of the C++ variable to be generated.
williamr@2
  1030
@param s    The literal text enclosed within a pair of double quotes. 
williamr@2
  1031
williamr@2
  1032
@see _LIT
williamr@2
  1033
*/
williamr@2
  1034
#define _LIT8(name,s) const static TLitC8<sizeof(s)> name={sizeof(s)-1,s}
williamr@2
  1035
williamr@2
  1036
williamr@2
  1037
williamr@2
  1038
williamr@2
  1039
/**
williamr@2
  1040
@publishedAll
williamr@2
  1041
@deprecated Use _LIT16 instead.
williamr@2
  1042
williamr@2
  1043
16-bit literal.
williamr@2
  1044
williamr@2
  1045
The macro defines an explicit 16-bit constant literal which is suitable
williamr@2
  1046
for Unicode literal text, regardless of the build.
williamr@2
  1047
williamr@2
  1048
@see _L
williamr@2
  1049
@see _LIT16
williamr@2
  1050
@see _LIT
williamr@2
  1051
*/
williamr@2
  1052
#define _L16(a) (TPtrC16((const TText16 *)L ## a))
williamr@2
  1053
williamr@2
  1054
williamr@2
  1055
williamr@2
  1056
/**
williamr@2
  1057
@publishedAll
williamr@2
  1058
@released
williamr@2
  1059
williamr@2
  1060
Defines an explicit 16-bit string which is suitable when Unicode text
williamr@2
  1061
is required, regardless of the build.
williamr@2
  1062
williamr@2
  1063
This is used by the deprecated literal descriptor _L16.
williamr@2
  1064
*/
williamr@2
  1065
#define _S16(a) ((const TText16 *)L ## a)
williamr@2
  1066
williamr@2
  1067
williamr@2
  1068
williamr@2
  1069
williamr@2
  1070
/**
williamr@2
  1071
@publishedAll
williamr@2
  1072
@released
williamr@2
  1073
williamr@2
  1074
Constructs a constant literal descriptor of type TLitC16<TInt> with
williamr@2
  1075
the specified name and text.
williamr@2
  1076
williamr@2
  1077
The 16-bit build variant is generated for both non-Unicode and Unicode builds.
williamr@2
  1078
williamr@2
  1079
@param name The name of the C++ variable to be generated.
williamr@2
  1080
@param s    The literal text enclosed within a pair of double quotes. 
williamr@2
  1081
williamr@2
  1082
@see _LIT
williamr@2
  1083
*/
williamr@2
  1084
#define _LIT16(name,s) const static TLitC16<sizeof(L##s)/2> name={sizeof(L##s)/2-1,L##s}
williamr@2
  1085
williamr@2
  1086
williamr@2
  1087
williamr@2
  1088
williamr@2
  1089
#if defined(_UNICODE) && !defined(__KERNEL_MODE__)
williamr@2
  1090
/**
williamr@2
  1091
@publishedAll
williamr@2
  1092
@released
williamr@2
  1093
williamr@2
  1094
Build independent general text character.
williamr@2
  1095
williamr@2
  1096
In non-Unicode builds, this is mapped to TText8. In Unicode builds, this is 
williamr@2
  1097
mapped to TText16. Use the classes with explicit width only when you wish 
williamr@2
  1098
the width to be independent of the build variant.
williamr@2
  1099
williamr@2
  1100
Use this class rather than TChar for general use.
williamr@2
  1101
*/
williamr@2
  1102
typedef TText16 TText;
williamr@2
  1103
williamr@2
  1104
williamr@2
  1105
williamr@2
  1106
/**
williamr@2
  1107
@publishedAll
williamr@2
  1108
@deprecated Use _LIT instead.
williamr@2
  1109
williamr@2
  1110
Build independent literal. 
williamr@2
  1111
williamr@2
  1112
The macro defines either an 8-bit constant literal (for non-Unicode text),
williamr@2
  1113
or a 16-bit constant literal (for Unicode text) depending on the build.
williamr@2
  1114
williamr@2
  1115
@see _LIT
williamr@2
  1116
@see _L16
williamr@2
  1117
@see _L8
williamr@2
  1118
*/
williamr@2
  1119
#define _L(a) (TPtrC((const TText *)L ## a))
williamr@2
  1120
williamr@2
  1121
williamr@2
  1122
williamr@2
  1123
williamr@2
  1124
/**
williamr@2
  1125
@publishedAll
williamr@2
  1126
@released
williamr@2
  1127
williamr@2
  1128
Defines either an 8-bit string (for non-Unicode text),
williamr@2
  1129
or a 16-bit string (for Unicode text) depending on the build.
williamr@2
  1130
williamr@2
  1131
This is used by the deprecated build independent literal _L.
williamr@2
  1132
*/
williamr@2
  1133
#define _S(a) ((const TText *)L ## a)
williamr@2
  1134
williamr@2
  1135
williamr@2
  1136
williamr@2
  1137
williamr@2
  1138
/**
williamr@2
  1139
@publishedAll
williamr@2
  1140
@released
williamr@2
  1141
williamr@2
  1142
Constructs a build independent constant literal descriptor of type TLitC<TInt>
williamr@2
  1143
with the specified name and text.
williamr@2
  1144
williamr@2
  1145
An 8-bit build variant is generated for a non-Unicode build;
williamr@2
  1146
A 16-bit build variant is generated for a Unicode build.
williamr@2
  1147
williamr@2
  1148
@param name The name of the C++ variable to be generated.
williamr@2
  1149
@param s    The literal text enclosed within a pair of double quotes. 
williamr@2
  1150
williamr@2
  1151
@see _LIT16
williamr@2
  1152
@see _LIT8
williamr@2
  1153
*/
williamr@2
  1154
#define _LIT(name,s) const static TLitC<sizeof(L##s)/2> name={sizeof(L##s)/2-1,L##s}
williamr@2
  1155
williamr@2
  1156
williamr@2
  1157
williamr@2
  1158
williamr@2
  1159
#else
williamr@2
  1160
/**
williamr@2
  1161
@publishedAll
williamr@2
  1162
@released
williamr@2
  1163
williamr@2
  1164
Build independent general text character.
williamr@2
  1165
williamr@2
  1166
In non-Unicode builds, this is mapped to TText8. In Unicode builds, this is 
williamr@2
  1167
mapped to TText16. Use the classes with explicit width only when you wish 
williamr@2
  1168
the width to be independent of the build variant.
williamr@2
  1169
williamr@2
  1170
Use this class rather than TChar for general use.
williamr@2
  1171
*/
williamr@2
  1172
typedef TText8 TText;
williamr@2
  1173
williamr@2
  1174
williamr@2
  1175
williamr@2
  1176
/**
williamr@2
  1177
@publishedAll
williamr@2
  1178
@released
williamr@2
  1179
williamr@2
  1180
@deprecated Use _LIT instead.
williamr@2
  1181
williamr@2
  1182
Build independent literal. 
williamr@2
  1183
williamr@2
  1184
The macro defines either an 8-bit constant literal (for non-Unicode text),
williamr@2
  1185
or a 16-bit constant literal (for Unicode text) depending on the build.
williamr@2
  1186
williamr@2
  1187
@see _LIT
williamr@2
  1188
@see _L16
williamr@2
  1189
@see _L8
williamr@2
  1190
*/
williamr@2
  1191
#define _L(a) (TPtrC((const TText *)(a)))
williamr@2
  1192
williamr@2
  1193
williamr@2
  1194
williamr@2
  1195
williamr@2
  1196
/**
williamr@2
  1197
@publishedAll
williamr@2
  1198
@released
williamr@2
  1199
williamr@2
  1200
Defines either an 8-bit string (for non-Unicode text),
williamr@2
  1201
or a 16-bit string (for Unicode text) depending on the build.
williamr@2
  1202
williamr@2
  1203
This is used by the deprecated build independent literal _L.
williamr@2
  1204
*/
williamr@2
  1205
#define _S(a) ((const TText *)a)
williamr@2
  1206
williamr@2
  1207
williamr@2
  1208
williamr@2
  1209
williamr@2
  1210
/**
williamr@2
  1211
@publishedAll
williamr@2
  1212
@released
williamr@2
  1213
williamr@2
  1214
Constructs a build independent constant literal descriptor of type TLitC<TInt>
williamr@2
  1215
with the specified name and text.
williamr@2
  1216
williamr@2
  1217
An 8-bit build variant is generated for a non-Unicode build;
williamr@2
  1218
A 16-bit build variant is generated for a Unicode build.
williamr@2
  1219
williamr@2
  1220
@param name The name of the C++ variable to be generated.
williamr@2
  1221
@param s    The literal text enclosed within a pair of double quotes. 
williamr@2
  1222
williamr@2
  1223
@see _LIT16
williamr@2
  1224
@see _LIT8
williamr@2
  1225
*/
williamr@2
  1226
#define _LIT(name,s) const static TLitC<sizeof(s)> name={sizeof(s)-1,s}
williamr@2
  1227
#endif
williamr@2
  1228
williamr@2
  1229
williamr@2
  1230
williamr@2
  1231
williamr@2
  1232
#ifndef __VA_LIST_defined
williamr@2
  1233
/** 
williamr@2
  1234
@publishedAll
williamr@2
  1235
@released
williamr@2
  1236
williamr@2
  1237
Defines a 'C' style array of pointers to TInt8 types.
williamr@2
  1238
williamr@2
  1239
The type is most commonly used by code that needs to deal with a variable
williamr@2
  1240
number of arguments passed to a function.
williamr@2
  1241
williamr@2
  1242
@see TInt8
williamr@2
  1243
*/
williamr@2
  1244
typedef TInt8 *VA_LIST[1];
williamr@2
  1245
#endif
williamr@2
  1246
williamr@2
  1247
/** 
williamr@2
  1248
@publishedAll
williamr@2
  1249
@released
williamr@2
  1250
williamr@2
  1251
Asserts that a condition is true.
williamr@2
  1252
williamr@2
  1253
Code is generated for all builds.
williamr@2
  1254
williamr@2
  1255
This macro is used as a C++ statement to assert the truth of some condition,
williamr@2
  1256
and to take appropriate action if the condition is false. Unlike __ASSERT_DEBUG
williamr@2
  1257
it is defined in both release and debug builds.
williamr@2
  1258
williamr@2
  1259
The most common use for this macro is to check that the external environment of
williamr@2
  1260
a function or class is behaving as expected; for example, that parameters
williamr@2
  1261
passed to a function are credible, or that called functions are behaving as
williamr@2
  1262
expected; the macro is commonly placed at the beginning of a function.
williamr@2
  1263
williamr@2
  1264
The effect of the macro is to generate code which tests
williamr@2
  1265
the conditional expression c; if the expression is false, then
williamr@2
  1266
function p is called. In the majority of cases, the function p is one that
williamr@2
  1267
raises a panic.
williamr@2
  1268
williamr@2
  1269
Note that the macro definition is, in effect, equivalent to: 
williamr@2
  1270
williamr@2
  1271
@code
williamr@2
  1272
if !(c)p;
williamr@2
  1273
@endcode
williamr@2
  1274
williamr@2
  1275
@param c a conditional expression which results in true or false.
williamr@2
  1276
@param p a function which is called if the conditional expression c is false.
williamr@2
  1277
williamr@2
  1278
@see __ASSERT_DEBUG
williamr@2
  1279
*/
williamr@2
  1280
#define __ASSERT_ALWAYS(c,p) (void)((c)||(p,0))
williamr@2
  1281
williamr@2
  1282
williamr@2
  1283
williamr@2
  1284
#ifdef __WINS__
williamr@2
  1285
#ifdef __CW32__
williamr@2
  1286
/** 
williamr@2
  1287
@internalAll
williamr@2
  1288
@released
williamr@2
  1289
*/
williamr@2
  1290
#define __BREAKPOINT()			\
williamr@2
  1291
	{							\
williamr@2
  1292
	__asm { byte 0xcc };		\
williamr@2
  1293
	}
williamr@2
  1294
#else // !__CW32__
williamr@2
  1295
/** 
williamr@2
  1296
@internalAll
williamr@2
  1297
@released
williamr@2
  1298
*/
williamr@2
  1299
#define __BREAKPOINT()			\
williamr@2
  1300
	{							\
williamr@2
  1301
	__asm { int 3 };			\
williamr@2
  1302
	}
williamr@2
  1303
#endif //__CW32__
williamr@2
  1304
#else
williamr@2
  1305
/** 
williamr@2
  1306
@internalAll
williamr@2
  1307
@released
williamr@2
  1308
*/
williamr@2
  1309
#define __BREAKPOINT()
williamr@2
  1310
#endif
williamr@2
  1311
williamr@2
  1312
#if defined(_DEBUG)
williamr@2
  1313
williamr@2
  1314
williamr@2
  1315
/** 
williamr@2
  1316
@publishedAll
williamr@2
  1317
@released
williamr@2
  1318
williamr@2
  1319
Asserts that a condition is true.
williamr@2
  1320
williamr@2
  1321
Code is generated for debug builds only.
williamr@2
  1322
williamr@2
  1323
This macro is used as a C++ statement to assert the truth of some condition,
williamr@2
  1324
and to take appropriate action if the condition is false. It is used in
williamr@2
  1325
the same way as __ASSERT_ALWAYS, except that it is only defined for debug builds.
williamr@2
  1326
williamr@2
  1327
The macro may be used to insert extra checks at various points in source code
williamr@2
  1328
as desired; the code will only be generated in debug builds and not in release
williamr@2
  1329
builds.
williamr@2
  1330
williamr@2
  1331
@param c A conditional expression which results in true or false.
williamr@2
  1332
@param p A function which is called if the conditional expression c is false.
williamr@2
  1333
williamr@2
  1334
@see __ASSERT_ALWAYS
williamr@2
  1335
*/
williamr@2
  1336
#define __ASSERT_DEBUG(c,p) (void)((c)||(p,0))
williamr@2
  1337
williamr@2
  1338
williamr@2
  1339
williamr@2
  1340
/** 
williamr@2
  1341
@internalAll
williamr@2
  1342
@removed
williamr@2
  1343
*/
williamr@2
  1344
#define __DECLARE_NAME(t)
williamr@2
  1345
williamr@2
  1346
williamr@2
  1347
williamr@2
  1348
williamr@2
  1349
/** 
williamr@2
  1350
@publishedAll
williamr@2
  1351
@released
williamr@2
  1352
williamr@2
  1353
Calls the function for testing object invariance.
williamr@2
  1354
williamr@2
  1355
Classes can define a standard member function __DbgTestInvariant(),
williamr@2
  1356
which checks that the object is in a valid state, and panics if it is not.
williamr@2
  1357
In debug builds, this macro simply expands to call that function. For details on how
williamr@2
  1358
to define __DbgTestInvariant(), and an example of its use, see __DECLARE_TEST.
williamr@2
  1359
williamr@2
  1360
The macro is typically invoked at the beginning of all the member functions of
williamr@2
  1361
the class. For non-const functions (those which can change the object’s state),
williamr@2
  1362
you can ensure that the object has been left in a stable state by invoking
williamr@2
  1363
the macro at the end of the function.
williamr@2
  1364
williamr@2
  1365
In release builds, no code is generated for the macro. 
williamr@2
  1366
*/
williamr@2
  1367
#define __TEST_INVARIANT __DbgTestInvariant()
williamr@2
  1368
williamr@2
  1369
williamr@2
  1370
williamr@2
  1371
williamr@2
  1372
/**
williamr@2
  1373
@publishedAll
williamr@2
  1374
@released
williamr@2
  1375
williamr@2
  1376
Marks the start of checking the current thread's heap. 
williamr@2
  1377
williamr@2
  1378
This macro is defined only for debug builds.
williamr@2
  1379
williamr@2
  1380
This macro must be matched by a corresponding call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
williamr@2
  1381
williamr@2
  1382
Calls to this macro can be nested but each call must be matched by corresponding 
williamr@2
  1383
call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
williamr@2
  1384
williamr@2
  1385
@see User::__DbgMarkStart()
williamr@2
  1386
@see __UHEAP_MARKEND
williamr@2
  1387
@see __UHEAP_MARKENDC
williamr@2
  1388
*/
williamr@2
  1389
#define __UHEAP_MARK User::__DbgMarkStart(FALSE)
williamr@2
  1390
williamr@2
  1391
williamr@2
  1392
williamr@2
  1393
williamr@2
  1394
/**
williamr@2
  1395
@publishedAll
williamr@2
  1396
@released
williamr@2
  1397
williamr@2
  1398
Checks that the number of allocated cells at the current nested level on the 
williamr@2
  1399
current thread's heap is the same as the specified value.
williamr@2
  1400
williamr@2
  1401
This macro is defined only for debug builds.
williamr@2
  1402
williamr@2
  1403
The macro also takes the name of the file containing this source code statement 
williamr@2
  1404
and the line number of this source code statement; they are displayed as part 
williamr@2
  1405
of the panic category, if the checks fail.
williamr@2
  1406
williamr@2
  1407
The macro assumes that:
williamr@2
  1408
williamr@2
  1409
1. the heap being checked is a user heap
williamr@2
  1410
williamr@2
  1411
2. checking is being done for the number of allocated cells at the current nested 
williamr@2
  1412
   level; i.e. that aCountAll is set to false
williamr@2
  1413
williamr@2
  1414
3. the line number is the line number of this source code statement.
williamr@2
  1415
williamr@2
  1416
4. the file name is the full path name of the file containing this source statement
williamr@2
  1417
williamr@2
  1418
@param aCount The number of heap cells expected to be allocated at
williamr@2
  1419
              the current nest level.
williamr@2
  1420
williamr@2
  1421
@see User::__DbgMarkCheck()
williamr@2
  1422
@see __KHEAP_CHECK
williamr@2
  1423
*/
williamr@2
  1424
#define __UHEAP_CHECK(aCount) User::__DbgMarkCheck(FALSE,FALSE,aCount,(TText8*)__FILE__,__LINE__)
williamr@2
  1425
williamr@2
  1426
williamr@2
  1427
williamr@2
  1428
williamr@2
  1429
/**
williamr@2
  1430
@publishedAll
williamr@2
  1431
@released
williamr@2
  1432
williamr@2
  1433
Checks that the total number of allocated cells on the current thread's heap 
williamr@2
  1434
is the same as the specified value.
williamr@2
  1435
williamr@2
  1436
This macro is defined only for debug builds.
williamr@2
  1437
williamr@2
  1438
The macro also takes the name of the file containing this source code statement 
williamr@2
  1439
and the line number of this source code statement; they are displayed as part 
williamr@2
  1440
of the panic category, if the checks fail.
williamr@2
  1441
williamr@2
  1442
@param aCount The total number of heap cells expected to be allocated.
williamr@2
  1443
williamr@2
  1444
@see User::__DbgMarkCheck()
williamr@2
  1445
@see __KHEAP_CHECKALL
williamr@2
  1446
*/
williamr@2
  1447
#define __UHEAP_CHECKALL(aCount) User::__DbgMarkCheck(FALSE,TRUE,aCount,(TText8*)__FILE__,__LINE__)
williamr@2
  1448
williamr@2
  1449
williamr@2
  1450
williamr@2
  1451
williamr@2
  1452
/**
williamr@2
  1453
@publishedAll
williamr@2
  1454
@released
williamr@2
  1455
williamr@2
  1456
Marks the end of checking the current thread's heap. 
williamr@2
  1457
williamr@2
  1458
The macro expects zero heap cells to remain allocated at the current nest 
williamr@2
  1459
level. This macro is defined only for debug builds.
williamr@2
  1460
williamr@2
  1461
This macro must match an earlier call to __UHEAP_MARK.
williamr@2
  1462
williamr@2
  1463
@see User::__DbgMarkEnd()
williamr@2
  1464
@see __UHEAP_MARK
williamr@2
  1465
*/
williamr@2
  1466
#define __UHEAP_MARKEND User::__DbgMarkEnd(FALSE,0)
williamr@2
  1467
williamr@2
  1468
williamr@2
  1469
williamr@2
  1470
williamr@2
  1471
/**
williamr@2
  1472
@publishedAll
williamr@2
  1473
@released
williamr@2
  1474
williamr@2
  1475
Marks the end of checking the current thread's heap. 
williamr@2
  1476
williamr@2
  1477
The macro expects aCount heap cells to remain allocated at the current nest 
williamr@2
  1478
level.
williamr@2
  1479
williamr@2
  1480
This macro must match an earlier call to __UHEAP_MARK.
williamr@2
  1481
williamr@2
  1482
@param aCount The number of heap cells expected to remain allocated at
williamr@2
  1483
              the current nest level.
williamr@2
  1484
williamr@2
  1485
@see User::__DbgMarkEnd()
williamr@2
  1486
@see __UHEAP_MARK
williamr@2
  1487
*/
williamr@2
  1488
#define __UHEAP_MARKENDC(aCount) User::__DbgMarkEnd(FALSE,aCount)
williamr@2
  1489
williamr@2
  1490
williamr@2
  1491
williamr@2
  1492
williamr@2
  1493
/**
williamr@2
  1494
@publishedAll
williamr@2
  1495
@released
williamr@2
  1496
williamr@2
  1497
Simulates heap allocation failure for the current thread's heap.
williamr@2
  1498
williamr@2
  1499
The failure occurs on the next call to new or any of the functions which 
williamr@2
  1500
allocate memory from the heap. This macro is defined only for debug builds.
williamr@2
  1501
williamr@2
  1502
@param aCount Determines when the allocation will fail.
williamr@2
  1503
              Heap allocation fails on attempt number aCount - later
williamr@2
  1504
              allocations will succeed.
williamr@2
  1505
              For example, if aCount is 3, then heap allocation fails
williamr@2
  1506
              on the 3rd attempt, but all subsequent allocations succeed. 
williamr@2
  1507
williamr@2
  1508
@see User::__DbgSetAllocFail()
williamr@2
  1509
*/
williamr@2
  1510
#define __UHEAP_FAILNEXT(aCount) User::__DbgSetAllocFail(FALSE,RAllocator::EFailNext,aCount)
williamr@2
  1511
williamr@2
  1512
/**
williamr@2
  1513
@publishedAll
williamr@2
  1514
@released
williamr@2
  1515
williamr@2
  1516
Simulates heap allocation failure for the current thread's heap.
williamr@2
  1517
williamr@2
  1518
The failures will occur for aBurst times from the next call to new or any of the functions which 
williamr@2
  1519
allocate memory from the heap. This macro is defined only for debug builds.
williamr@2
  1520
williamr@2
  1521
@param aCount Determines when the allocation will fail.
williamr@2
  1522
              Heap allocation fails on attempt number aCount - later
williamr@2
  1523
              allocations will succeed.
williamr@2
  1524
              For example, if aCount is 3, then heap allocation fails
williamr@2
  1525
              on the 3rd attempt, but all subsequent allocations succeed.  
williamr@2
  1526
              Note when used with RHeap the maximum value aCount can be set 
williamr@2
  1527
              to is KMaxTUint16.
williamr@2
  1528
@param aBurst The number of consecutive allocations that will fail.  Note 
williamr@2
  1529
              when used with RHeap the maximum value aBurst can be set to 
williamr@2
  1530
              is KMaxTUint16.
williamr@2
  1531
williamr@2
  1532
@see User::__DbgSetBurstAllocFail()
williamr@2
  1533
*/
williamr@2
  1534
#define __UHEAP_BURSTFAILNEXT(aCount,aBurst) User::__DbgSetBurstAllocFail(FALSE,RAllocator::EBurstFailNext,aCount,aBurst)
williamr@2
  1535
williamr@2
  1536
williamr@2
  1537
williamr@2
  1538
/**
williamr@2
  1539
@publishedAll
williamr@2
  1540
@released
williamr@2
  1541
williamr@2
  1542
Simulates heap allocation failure for the current thread's heap. 
williamr@2
  1543
williamr@2
  1544
The failure occurs on subsequent calls to new or any of the functions which 
williamr@2
  1545
allocate memory from the heap. This macro is defined only for debug builds.
williamr@2
  1546
williamr@2
  1547
@param aType  The type of failure to be simulated.
williamr@2
  1548
@param aRate The failure rate.
williamr@2
  1549
williamr@2
  1550
@see User::__DbgSetAllocFail()
williamr@2
  1551
@see RAllocator::TAllocFail
williamr@2
  1552
*/
williamr@2
  1553
#define __UHEAP_SETFAIL(aType,aRate) User::__DbgSetAllocFail(FALSE, aType, aRate)
williamr@2
  1554
williamr@2
  1555
/**
williamr@2
  1556
@publishedAll
williamr@2
  1557
@released
williamr@2
  1558
williamr@2
  1559
Simulates heap allocation failure for the current thread's heap. 
williamr@2
  1560
williamr@2
  1561
The failure occurs on subsequent calls to new or any of the functions which 
williamr@2
  1562
allocate memory from the heap. This macro is defined only for debug builds.
williamr@2
  1563
williamr@2
  1564
@param aType  The type of failure to be simulated.
williamr@2
  1565
@param aRate  The failure rate.  Note when used with RHeap the maximum value 
williamr@2
  1566
              aRate can be set to is KMaxTUint16.
williamr@2
  1567
@param aBurst The number of consecutive allocations that will fail.    Note 
williamr@2
  1568
              when used with RHeap the maximum value aBurst can be set 
williamr@2
  1569
              to is KMaxTUint16.
williamr@2
  1570
williamr@2
  1571
@see User::__DbgSetBurstAllocFail()
williamr@2
  1572
@see RAllocator::TAllocFail
williamr@2
  1573
*/
williamr@2
  1574
#define __UHEAP_SETBURSTFAIL(aType,aRate,aBurst) User::__DbgSetBurstAllocFail(FALSE, aType, aRate, aBurst)
williamr@2
  1575
williamr@2
  1576
williamr@2
  1577
williamr@2
  1578
/**
williamr@2
  1579
@publishedAll
williamr@2
  1580
@released
williamr@2
  1581
williamr@2
  1582
Cancels simulated heap allocation failure for the current thread's heap. 
williamr@2
  1583
williamr@2
  1584
This macro is defined only for debug builds.
williamr@2
  1585
williamr@2
  1586
@see User::__DbgSetAllocFail()
williamr@2
  1587
*/
williamr@2
  1588
#define __UHEAP_RESET User::__DbgSetAllocFail(FALSE,RAllocator::ENone,1)
williamr@2
  1589
williamr@2
  1590
williamr@2
  1591
/**
williamr@2
  1592
@publishedAll
williamr@2
  1593
@released
williamr@2
  1594
williamr@2
  1595
Cancels simulated heap allocation failure for the current thread's heap. 
williamr@2
  1596
It walks the the heap and sets the nesting level for all allocated
williamr@2
  1597
cells to zero.
williamr@2
  1598
williamr@2
  1599
This macro is defined only for debug builds.
williamr@2
  1600
*/
williamr@2
  1601
#define __UHEAP_TOTAL_RESET User::__DbgSetAllocFail(FALSE,RAllocator::EReset,1)
williamr@2
  1602
williamr@2
  1603
/**
williamr@2
  1604
@publishedAll
williamr@2
  1605
@released
williamr@2
  1606
williamr@2
  1607
Returns the number of heap allocation failures the current debug allocator fail
williamr@2
  1608
function has caused so far.
williamr@2
  1609
williamr@2
  1610
This is intended to only be used with fail types RAllocator::EFailNext,
williamr@2
  1611
RAllocator::EBurstFailNext, RAllocator::EDeterministic and
williamr@2
  1612
RAllocator::EBurstDeterministic.  The return value is unreliable for 
williamr@2
  1613
all other fail types.
williamr@2
  1614
williamr@2
  1615
@return The number of heap allocation failures the current debug fail 
williamr@2
  1616
function has caused.
williamr@2
  1617
williamr@2
  1618
@see RAllocator::TAllocFail
williamr@2
  1619
*/
williamr@2
  1620
#define __UHEAP_CHECKFAILURE User::__DbgCheckFailure(FALSE)
williamr@2
  1621
williamr@2
  1622
/**
williamr@2
  1623
@publishedAll
williamr@2
  1624
@released
williamr@2
  1625
williamr@2
  1626
Returns the number of kernel heap allocation failures the current debug 
williamr@2
  1627
allocator fail function has caused so far.
williamr@2
  1628
williamr@2
  1629
This is intended to only be used with fail types RAllocator::EFailNext,
williamr@2
  1630
RAllocator::EBurstFailNext, RAllocator::EDeterministic and
williamr@2
  1631
RAllocator::EBurstDeterministic.  The return value is unreliable for 
williamr@2
  1632
all other fail types.
williamr@2
  1633
williamr@2
  1634
@return The number of heap allocation failures the current debug fail 
williamr@2
  1635
function has caused.
williamr@2
  1636
williamr@2
  1637
@see RAllocator::TAllocFail
williamr@2
  1638
*/
williamr@2
  1639
#define __KHEAP_CHECKFAILURE User::__DbgCheckFailure(TRUE)
williamr@2
  1640
williamr@2
  1641
williamr@2
  1642
williamr@2
  1643
/**
williamr@2
  1644
@publishedAll
williamr@2
  1645
@released
williamr@2
  1646
williamr@2
  1647
Marks the start of heap checking for the specific heap. 
williamr@2
  1648
williamr@2
  1649
This macro is defined only for debug builds.
williamr@2
  1650
williamr@2
  1651
This macro must be matched by a corresponding call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
williamr@2
  1652
williamr@2
  1653
Calls to this macro can be nested but each call must be matched by corresponding 
williamr@2
  1654
call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
williamr@2
  1655
williamr@2
  1656
@param aHeap A pointer to the specific RHeap
williamr@2
  1657
williamr@2
  1658
@see RHeap
williamr@2
  1659
@see RAllocator::__DbgMarkStart()
williamr@2
  1660
@see __RHEAP_MARKEND
williamr@2
  1661
@see __RHEAP_MARKENDC
williamr@2
  1662
*/
williamr@2
  1663
#define __RHEAP_MARK(aHeap) (aHeap)->__DbgMarkStart()
williamr@2
  1664
williamr@2
  1665
williamr@2
  1666
williamr@2
  1667
williamr@2
  1668
/**
williamr@2
  1669
@publishedAll
williamr@2
  1670
@released
williamr@2
  1671
williamr@2
  1672
Checks that the number of allocated cells at the current nested level on the 
williamr@2
  1673
specified heap is the same as the specified value. 
williamr@2
  1674
williamr@2
  1675
The macro also takes the name of the file containing this source code statement 
williamr@2
  1676
and the line number of this source code statement; they are displayed as part 
williamr@2
  1677
of the panic category, if the checks fail. 
williamr@2
  1678
williamr@2
  1679
This macro is defined only for debug builds.
williamr@2
  1680
williamr@2
  1681
@param aHeap  A pointer to the specific RHeap.
williamr@2
  1682
@param aCount The number of heap cells expected to be allocated at
williamr@2
  1683
              the current nest level.
williamr@2
  1684
williamr@2
  1685
@see RAllocator::__DbgMarkCheck()
williamr@2
  1686
*/
williamr@2
  1687
#define __RHEAP_CHECK(aHeap,aCount) (aHeap)->__DbgMarkCheck(FALSE,aCount,(TText8*)__FILE__,__LINE__)
williamr@2
  1688
williamr@2
  1689
williamr@2
  1690
williamr@2
  1691
williamr@2
  1692
/**
williamr@2
  1693
@publishedAll
williamr@2
  1694
@released
williamr@2
  1695
williamr@2
  1696
Checks that the total number of allocated cells on the specified heap is the 
williamr@2
  1697
same as the specified value.
williamr@2
  1698
williamr@2
  1699
The macro also takes the name of the file containing this source code statement 
williamr@2
  1700
and the line number of this source code statement; they are displayed as part 
williamr@2
  1701
of the panic category, if the checks fail.
williamr@2
  1702
williamr@2
  1703
This macro is defined only for debug builds.
williamr@2
  1704
williamr@2
  1705
@param aHeap  A pointer to the specific RHeap.
williamr@2
  1706
@param aCount The total number of heap cells expected to be allocated.
williamr@2
  1707
williamr@2
  1708
@see RAllocator::__DbgMarkCheck()
williamr@2
  1709
*/
williamr@2
  1710
#define __RHEAP_CHECKALL(aHeap,aCount) (aHeap)->__DbgMarkCheck(TRUE,aCount,(TText8*)__FILE__,__LINE__)
williamr@2
  1711
williamr@2
  1712
williamr@2
  1713
williamr@2
  1714
williamr@2
  1715
/**
williamr@2
  1716
@publishedAll
williamr@2
  1717
@released
williamr@2
  1718
williamr@2
  1719
Marks the end of heap checking for the specific heap.
williamr@2
  1720
williamr@2
  1721
The macro expects zero heap cells to remain allocated at the current nest 
williamr@2
  1722
level. This macro is defined only for debug builds.
williamr@2
  1723
williamr@2
  1724
This macro must match an earlier call to __RHEAP_MARK.
williamr@2
  1725
williamr@2
  1726
@param aHeap A pointer to the specific RHeap.
williamr@2
  1727
williamr@2
  1728
@see RAllocator::__DbgMarkEnd()
williamr@2
  1729
@see __RHEAP_MARK
williamr@2
  1730
*/
williamr@2
  1731
#define __RHEAP_MARKEND(aHeap) (aHeap)->__DbgMarkEnd(0)
williamr@2
  1732
williamr@2
  1733
williamr@2
  1734
williamr@2
  1735
williamr@2
  1736
/**
williamr@2
  1737
@publishedAll
williamr@2
  1738
@released
williamr@2
  1739
williamr@2
  1740
Marks the end of heap checking for the specific heap.
williamr@2
  1741
williamr@2
  1742
The macro expects aCount heap cells to remain allocated at the current nest 
williamr@2
  1743
level. This macro is defined only for debug builds.
williamr@2
  1744
williamr@2
  1745
This macro must match an earlier call to __RHEAP_MARK.
williamr@2
  1746
williamr@2
  1747
@param aHeap  A pointer to the specific RHeap.
williamr@2
  1748
@param aCount The number of heap cells expected to remain allocated at
williamr@2
  1749
              the current nest level
williamr@2
  1750
williamr@2
  1751
@see RAllocator::__DbgMarkEnd()
williamr@2
  1752
@see __RHEAP_MARK
williamr@2
  1753
*/
williamr@2
  1754
#define __RHEAP_MARKENDC(aHeap,aCount) (aHeap)->__DbgMarkEnd(aCount)
williamr@2
  1755
williamr@2
  1756
williamr@2
  1757
williamr@2
  1758
williamr@2
  1759
/**
williamr@2
  1760
@publishedAll
williamr@2
  1761
@released
williamr@2
  1762
williamr@2
  1763
Simulates an allocation failure for the specific heap.
williamr@2
  1764
williamr@2
  1765
The failure occurs on the next call to new or any of the functions which allocate 
williamr@2
  1766
memory from the heap. This macro is defined only for debug builds.
williamr@2
  1767
williamr@2
  1768
@param aHeap  A pointer to the specific RHeap.
williamr@2
  1769
@param aCount The rate of failure - heap allocation fails every aCount attempt.
williamr@2
  1770
williamr@2
  1771
@see RAllocator::__DbgSetAllocFail()
williamr@2
  1772
*/
williamr@2
  1773
#define __RHEAP_FAILNEXT(aHeap,aCount) (aHeap)->__DbgSetAllocFail(RAllocator::EFailNext,aCount)
williamr@2
  1774
williamr@2
  1775
/**
williamr@2
  1776
@publishedAll
williamr@2
  1777
@released
williamr@2
  1778
williamr@2
  1779
Simulates aBurst allocation failures for the specific heap.
williamr@2
  1780
williamr@2
  1781
The failure occurs on the next call to new or any of the functions which allocate 
williamr@2
  1782
memory from the heap. This macro is defined only for debug builds.
williamr@2
  1783
williamr@2
  1784
@param aHeap  A pointer to the specific RHeap.
williamr@2
  1785
@param aCount The heap allocation will fail after aCount-1 allocation attempts. 
williamr@2
  1786
              Note when used with RHeap the maximum value aCount can be set 
williamr@2
  1787
              to is KMaxTUint16.
williamr@2
  1788
@param aBurst The number of consecutive allocations that will fail.  Note 
williamr@2
  1789
              when used with RHeap the maximum value aBurst can be set 
williamr@2
  1790
              to is KMaxTUint16.
williamr@2
  1791
williamr@2
  1792
@see RAllocator::__DbgSetBurstAllocFail()
williamr@2
  1793
*/
williamr@2
  1794
#define __RHEAP_BURSTFAILNEXT(aHeap,aCount,aBurst) (aHeap)->__DbgSetBurstAllocFail(RAllocator::EBurstFailNext,aCount, aBurst)
williamr@2
  1795
williamr@2
  1796
williamr@2
  1797
williamr@2
  1798
/**
williamr@2
  1799
@publishedAll
williamr@2
  1800
@released
williamr@2
  1801
williamr@2
  1802
Simulates an allocation failure for the specific heap. 
williamr@2
  1803
williamr@2
  1804
The failure occurs on subsequent calls to new or any of the functions which 
williamr@2
  1805
allocate memory from the heap. This macro is defined only for debug builds.
williamr@2
  1806
williamr@2
  1807
@param aHeap  A pointer to the specific RHeap.
williamr@2
  1808
@param aType  The type of failure to be simulated. 
williamr@2
  1809
@param aRate The failure rate.
williamr@2
  1810
williamr@2
  1811
@see RAllocator::__DbgSetAllocFail()
williamr@2
  1812
*/
williamr@2
  1813
#define __RHEAP_SETFAIL(aHeap,aType,aRate) (aHeap)->__DbgSetAllocFail(aType,aRate)
williamr@2
  1814
williamr@2
  1815
/**
williamr@2
  1816
@publishedAll
williamr@2
  1817
@released
williamr@2
  1818
williamr@2
  1819
Simulates an allocation failure for the specific heap. 
williamr@2
  1820
williamr@2
  1821
The failure occurs on subsequent calls to new or any of the functions which 
williamr@2
  1822
allocate memory from the heap. This macro is defined only for debug builds.
williamr@2
  1823
williamr@2
  1824
@param aHeap  A pointer to the specific RHeap.
williamr@2
  1825
@param aType  The type of failure to be simulated. 
williamr@2
  1826
@param aRate  The failure rate.  Note when used with RHeap the maximum value 
williamr@2
  1827
              aRate can be set to is KMaxTUint16.
williamr@2
  1828
@param aBurst The number of consecutive allocations that will fail.  Note 
williamr@2
  1829
              when used with RHeap the maximum value aBurst can be set 
williamr@2
  1830
              to is KMaxTUint16.
williamr@2
  1831
williamr@2
  1832
@see RAllocator::__DbgSetBurstAllocFail()
williamr@2
  1833
*/
williamr@2
  1834
#define __RHEAP_SETBURSTFAIL(aHeap,aType,aRate,aBurst) (aHeap)->__DbgSetBurstAllocFail(aType,aRate,aBurst)
williamr@2
  1835
williamr@2
  1836
williamr@2
  1837
williamr@2
  1838
/**
williamr@2
  1839
@publishedAll
williamr@2
  1840
@released
williamr@2
  1841
williamr@2
  1842
Cancels simulated allocation failure for the specific heap.
williamr@2
  1843
williamr@2
  1844
This macro is defined only for debug builds.
williamr@2
  1845
williamr@2
  1846
@param aHeap A pointer to the specific RHeap.
williamr@2
  1847
williamr@2
  1848
@see RAllocator::__DbgSetAllocFail()
williamr@2
  1849
*/
williamr@2
  1850
#define __RHEAP_RESET(aHeap) (aHeap)->__DbgSetAllocFail(RAllocator::ENone,1)
williamr@2
  1851
williamr@2
  1852
williamr@2
  1853
williamr@2
  1854
/**
williamr@2
  1855
@publishedAll
williamr@2
  1856
@released
williamr@2
  1857
williamr@2
  1858
Cancels simulated allocation failure for the specific heap.
williamr@2
  1859
It walks the the heap and sets the nesting level for all allocated
williamr@2
  1860
cells to zero.
williamr@2
  1861
williamr@2
  1862
This macro is defined only for debug builds.
williamr@2
  1863
williamr@2
  1864
@param aHeap A pointer to the specific RHeap.
williamr@2
  1865
williamr@2
  1866
@see RAllocator::__DbgSetAllocFail()
williamr@2
  1867
*/
williamr@2
  1868
#define __RHEAP_TOTAL_RESET(aHeap) (aHeap)->__DbgSetAllocFail(RAllocator::EReset,1)
williamr@2
  1869
williamr@2
  1870
/**
williamr@2
  1871
@publishedAll
williamr@2
  1872
@released
williamr@2
  1873
williamr@2
  1874
Returns the number of heap allocation failures the current debug allocator fail
williamr@2
  1875
function has caused so far.
williamr@2
  1876
williamr@2
  1877
This is intended to only be used with fail types RAllocator::EFailNext,
williamr@2
  1878
RAllocator::EBurstFailNext, RAllocator::EDeterministic and
williamr@2
  1879
RAllocator::EBurstDeterministic.  The return value is unreliable for 
williamr@2
  1880
all other fail types.
williamr@2
  1881
williamr@2
  1882
@return The number of heap allocation failures the current debug fail 
williamr@2
  1883
function has caused.
williamr@2
  1884
williamr@2
  1885
@see RAllocator::TAllocFail
williamr@2
  1886
*/
williamr@2
  1887
#define __RHEAP_CHECKFAILURE(aHeap) (aHeap)->__DbgCheckFailure()
williamr@2
  1888
williamr@2
  1889
williamr@2
  1890
#if defined (__WINS__) 
williamr@2
  1891
williamr@2
  1892
/**
williamr@2
  1893
@publishedAll
williamr@2
  1894
@released
williamr@2
  1895
*/
williamr@2
  1896
#define __DEBUGGER() {if (User::JustInTime()) __BREAKPOINT()}
williamr@2
  1897
williamr@2
  1898
#else
williamr@2
  1899
#define __DEBUGGER()
williamr@2
  1900
#endif
williamr@2
  1901
williamr@2
  1902
williamr@2
  1903
#if defined(__DLL__)
williamr@2
  1904
/**
williamr@2
  1905
@publishedAll
williamr@2
  1906
@released
williamr@2
  1907
williamr@2
  1908
Declares a function for testing object invariance.
williamr@2
  1909
williamr@2
  1910
For complex classes, it is often useful to provide a function that can
williamr@2
  1911
be called to check that the object is in a valid state.
williamr@2
  1912
The __DECLARE_TEST macro supplies a standard prototype for such a function
williamr@2
  1913
named __DbgTestInvariant(). A companion macro __TEST_INVARIANT is provided
williamr@2
  1914
to call the function.
williamr@2
  1915
williamr@2
  1916
For DLLs, as opposed to EXEs, __DbgTestInvariant() is exported,
williamr@2
  1917
i.e. the macro expands to:
williamr@2
  1918
williamr@2
  1919
@code
williamr@2
  1920
public: IMPORT_C void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
williamr@2
  1921
@endcode
williamr@2
  1922
williamr@2
  1923
This macro should placed as the last item in a class declaration (as it 
williamr@2
  1924
switches back to public access). Note that a terminating semi-colon must be used.
williamr@2
  1925
williamr@2
  1926
You should define the __DbgTestInvariant() function to check that the object
williamr@2
  1927
is in a healthy state. If it finds an error, it should call User::Invariant(),
williamr@2
  1928
which will cause a panic. 
williamr@2
  1929
williamr@2
  1930
If a class is derived from a base class, then the base class __DbgTestInvariant()
williamr@2
  1931
should be called first, and then any further checking done. 
williamr@2
  1932
williamr@2
  1933
The second function declared, __DbgTest(), is intended to allow test code a way
williamr@2
  1934
of directly accessing non-public members of a class. The function is
williamr@2
  1935
implemented by any test code that requires it, rather than in the class’s own
williamr@2
  1936
source code. The function is therefore not exported.
williamr@2
  1937
williamr@2
  1938
__DECLARE_TEST is defined for both debug and release builds. This point is
williamr@2
  1939
particularly important for DLLs, as otherwise the exported interfaces would
williamr@2
  1940
differ between the build versions, giving potential binary compatibility
williamr@2
  1941
problems. To avoid using memory unnecessarily in release builds, you can,
williamr@2
  1942
however, use preprocessor directives to define the code within
williamr@2
  1943
__DbgTestInvariant() only for debug builds. __DbgTestInvariant() is never
williamr@2
  1944
called in release builds.
williamr@2
  1945
williamr@2
  1946
@see __TEST_INVARIANT
williamr@2
  1947
*/
williamr@2
  1948
#define __DECLARE_TEST public: IMPORT_C void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
williamr@2
  1949
#else
williamr@2
  1950
#define __DECLARE_TEST public: void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
williamr@2
  1951
#endif
williamr@2
  1952
williamr@2
  1953
#else
williamr@2
  1954
#define __ASSERT_DEBUG(c,p)
williamr@2
  1955
#define __DECLARE_NAME(t)
williamr@2
  1956
#define __TEST_INVARIANT
williamr@2
  1957
#if defined(__DLL__)
williamr@2
  1958
#define __DECLARE_TEST public: IMPORT_C void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
williamr@2
  1959
#else
williamr@2
  1960
#define __DECLARE_TEST public: void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
williamr@2
  1961
#endif
williamr@2
  1962
williamr@2
  1963
williamr@2
  1964
williamr@2
  1965
williamr@2
  1966
/**
williamr@2
  1967
@publishedAll
williamr@2
  1968
@released
williamr@2
  1969
williamr@2
  1970
Marks the start of checking the current thread's heap. 
williamr@2
  1971
williamr@2
  1972
This macro is defined only for debug builds.
williamr@2
  1973
williamr@2
  1974
This macro must be matched by a corresponding call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
williamr@2
  1975
williamr@2
  1976
Calls to this macro can be nested but each call must be matched by corresponding 
williamr@2
  1977
call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
williamr@2
  1978
williamr@2
  1979
@see User::__DbgMarkStart()
williamr@2
  1980
@see __UHEAP_MARKEND
williamr@2
  1981
@see __UHEAP_MARKENDC
williamr@2
  1982
*/
williamr@2
  1983
#define __UHEAP_MARK
williamr@2
  1984
williamr@2
  1985
williamr@2
  1986
williamr@2
  1987
williamr@2
  1988
/**
williamr@2
  1989
@publishedAll
williamr@2
  1990
@released
williamr@2
  1991
williamr@2
  1992
Checks that the number of allocated cells at the current nested level on the 
williamr@2
  1993
current thread's heap is the same as the specified value.
williamr@2
  1994
williamr@2
  1995
This macro is defined only for debug builds.
williamr@2
  1996
williamr@2
  1997
The macro also takes the name of the file containing this source code statement 
williamr@2
  1998
and the line number of this source code statement; they are displayed as part 
williamr@2
  1999
of the panic category, if the checks fail.
williamr@2
  2000
williamr@2
  2001
The macro assumes that:
williamr@2
  2002
williamr@2
  2003
1. the heap being checked is a user heap
williamr@2
  2004
williamr@2
  2005
2. checking is being done for the number of allocated cells at the current nested 
williamr@2
  2006
   level; i.e. that aCountAll is set to false
williamr@2
  2007
williamr@2
  2008
3. the line number is the line number of this source code statement.
williamr@2
  2009
williamr@2
  2010
4. the file name is the full path name of the file containing this source statement
williamr@2
  2011
williamr@2
  2012
@param aCount The number of heap cells expected to be allocated at
williamr@2
  2013
              the current nest level.
williamr@2
  2014
williamr@2
  2015
@see User::__DbgMarkCheck()
williamr@2
  2016
@see __KHEAP_CHECK
williamr@2
  2017
*/
williamr@2
  2018
#define __UHEAP_CHECK(aCount)
williamr@2
  2019
williamr@2
  2020
williamr@2
  2021
williamr@2
  2022
williamr@2
  2023
/**
williamr@2
  2024
@publishedAll
williamr@2
  2025
@released
williamr@2
  2026
williamr@2
  2027
Checks that the total number of allocated cells on the current thread's heap 
williamr@2
  2028
is the same as the specified value.
williamr@2
  2029
williamr@2
  2030
This macro is defined only for debug builds.
williamr@2
  2031
williamr@2
  2032
The macro also takes the name of the file containing this source code statement 
williamr@2
  2033
and the line number of this source code statement; they are displayed as part 
williamr@2
  2034
of the panic category, if the checks fail.
williamr@2
  2035
williamr@2
  2036
@param aCount The total number of heap cells expected to be allocated.
williamr@2
  2037
williamr@2
  2038
@see User::__DbgMarkCheck()
williamr@2
  2039
@see __KHEAP_CHECKALL
williamr@2
  2040
*/
williamr@2
  2041
#define __UHEAP_CHECKALL(aCount)
williamr@2
  2042
williamr@2
  2043
williamr@2
  2044
williamr@2
  2045
williamr@2
  2046
/**
williamr@2
  2047
@publishedAll
williamr@2
  2048
@released
williamr@2
  2049
williamr@2
  2050
Marks the end of checking the current thread's heap. 
williamr@2
  2051
williamr@2
  2052
The macro expects zero heap cells to remain allocated at the current nest 
williamr@2
  2053
level. This macro is defined only for debug builds.
williamr@2
  2054
williamr@2
  2055
This macro must match an earlier call to __UHEAP_MARK.
williamr@2
  2056
williamr@2
  2057
@see User::__DbgMarkEnd()
williamr@2
  2058
@see __UHEAP_MARK
williamr@2
  2059
*/
williamr@2
  2060
#define __UHEAP_MARKEND
williamr@2
  2061
williamr@2
  2062
williamr@2
  2063
williamr@2
  2064
williamr@2
  2065
/**
williamr@2
  2066
@publishedAll
williamr@2
  2067
@released
williamr@2
  2068
williamr@2
  2069
Marks the end of checking the current thread's heap. 
williamr@2
  2070
williamr@2
  2071
The macro expects aCount heap cells to remain allocated at the current nest 
williamr@2
  2072
level.
williamr@2
  2073
williamr@2
  2074
This macro must match an earlier call to __UHEAP_MARK.
williamr@2
  2075
williamr@2
  2076
@param aCount The number of heap cells expected to remain allocated at
williamr@2
  2077
              the current nest level.
williamr@2
  2078
williamr@2
  2079
@see User::__DbgMarkEnd()
williamr@2
  2080
@see __UHEAP_MARK
williamr@2
  2081
*/
williamr@2
  2082
#define __UHEAP_MARKENDC(aCount)
williamr@2
  2083
williamr@2
  2084
williamr@2
  2085
williamr@2
  2086
williamr@2
  2087
/**
williamr@2
  2088
@publishedAll
williamr@2
  2089
@released
williamr@2
  2090
williamr@2
  2091
Simulates heap allocation failure for the current thread's heap.
williamr@2
  2092
williamr@2
  2093
The failure occurs on the next call to new or any of the functions which 
williamr@2
  2094
allocate memory from the heap. This macro is defined only for debug builds.
williamr@2
  2095
williamr@2
  2096
@param aCount Determines when the allocation will fail.
williamr@2
  2097
              Heap allocation fails on attempt number aCount - later
williamr@2
  2098
              allocations will succeed.
williamr@2
  2099
              For example, if aCount is 3, then heap allocation fails
williamr@2
  2100
              on the 3rd attempt, but all subsequent allocations succeed. 
williamr@2
  2101
williamr@2
  2102
@see User::__DbgSetAllocFail()
williamr@2
  2103
*/
williamr@2
  2104
#define __UHEAP_FAILNEXT(aCount)
williamr@2
  2105
williamr@2
  2106
/**
williamr@2
  2107
@publishedAll
williamr@2
  2108
@released
williamr@2
  2109
williamr@2
  2110
Simulates heap allocation failure for the current thread's heap.
williamr@2
  2111
williamr@2
  2112
The failures will occur for aBurst times from the next call to new or any of the functions which 
williamr@2
  2113
allocate memory from the heap. This macro is defined only for debug builds.
williamr@2
  2114
williamr@2
  2115
@param aCount Determines when the allocation will fail.
williamr@2
  2116
              Heap allocation fails on attempt number aCount - later
williamr@2
  2117
              allocations will succeed.
williamr@2
  2118
              For example, if aCount is 3, then heap allocation fails
williamr@2
  2119
              on the 3rd attempt, but all subsequent allocations succeed.   
williamr@2
  2120
              Note when used with RHeap the maximum value aBurst can be 
williamr@2
  2121
              set to is KMaxTUint16.
williamr@2
  2122
@param aBurst The number of consecutive allocations that will fail.  Note 
williamr@2
  2123
              when used with RHeap the maximum value aBurst can be set 
williamr@2
  2124
              to is KMaxTUint16.
williamr@2
  2125
williamr@2
  2126
@see User::__DbgSetBurstAllocFail()
williamr@2
  2127
*/
williamr@2
  2128
#define __UHEAP_BURSTFAILNEXT(aCount,aBurst)
williamr@2
  2129
williamr@2
  2130
williamr@2
  2131
williamr@2
  2132
/**
williamr@2
  2133
@publishedAll
williamr@2
  2134
@released
williamr@2
  2135
williamr@2
  2136
Simulates heap allocation failure for the current thread's heap. 
williamr@2
  2137
williamr@2
  2138
The failure occurs on subsequent calls to new or any of the functions which 
williamr@2
  2139
allocate memory from the heap. This macro is defined only for debug builds.
williamr@2
  2140
williamr@2
  2141
@param aType  The type of failure to be simulated.
williamr@2
  2142
@param aRate The failure rate.
williamr@2
  2143
williamr@2
  2144
@see User::__DbgSetAllocFail()
williamr@2
  2145
*/
williamr@2
  2146
#define __UHEAP_SETFAIL(aType,aRate)
williamr@2
  2147
williamr@2
  2148
/**
williamr@2
  2149
@publishedAll
williamr@2
  2150
@released
williamr@2
  2151
williamr@2
  2152
Simulates heap allocation failure for the current thread's heap. 
williamr@2
  2153
williamr@2
  2154
The failure occurs on subsequent calls to new or any of the functions which 
williamr@2
  2155
allocate memory from the heap. This macro is defined only for debug builds.
williamr@2
  2156
williamr@2
  2157
@param aType  The type of failure to be simulated.
williamr@2
  2158
@param aRate  The failure rate.  Note when used with RHeap the maximum value 
williamr@2
  2159
              aRate can be set to is KMaxTUint16.
williamr@2
  2160
@param aBurst The number of consecutive allocations that will fail.  Note 
williamr@2
  2161
              when used with RHeap the maximum value aBurst can be set 
williamr@2
  2162
              to is KMaxTUint16.
williamr@2
  2163
williamr@2
  2164
@see User::__DbgSetBurstAllocFail()
williamr@2
  2165
@see RAllocator::TAllocFail
williamr@2
  2166
*/
williamr@2
  2167
#define __UHEAP_SETBURSTFAIL(aType,aRate,aBurst)
williamr@2
  2168
williamr@2
  2169
williamr@2
  2170
williamr@2
  2171
/**
williamr@2
  2172
@publishedAll
williamr@2
  2173
@released
williamr@2
  2174
williamr@2
  2175
Cancels simulated heap allocation failure for the current thread's heap. 
williamr@2
  2176
williamr@2
  2177
This macro is defined only for debug builds.
williamr@2
  2178
williamr@2
  2179
@see User::__DbgSetAllocFail()
williamr@2
  2180
*/
williamr@2
  2181
#define __UHEAP_RESET
williamr@2
  2182
williamr@2
  2183
williamr@2
  2184
williamr@2
  2185
/**
williamr@2
  2186
@publishedAll
williamr@2
  2187
@released
williamr@2
  2188
williamr@2
  2189
Cancels simulated heap allocation failure for the current thread's heap. 
williamr@2
  2190
It walks the the heap and sets the nesting level for all allocated
williamr@2
  2191
cells to zero.
williamr@2
  2192
williamr@2
  2193
This macro is defined only for debug builds.
williamr@2
  2194
*/
williamr@2
  2195
#define __UHEAP_TOTAL_RESET
williamr@2
  2196
williamr@2
  2197
/**
williamr@2
  2198
@publishedAll
williamr@2
  2199
@released
williamr@2
  2200
williamr@2
  2201
Returns the number of heap allocation failures the current debug allocator fail
williamr@2
  2202
function has caused so far.
williamr@2
  2203
williamr@2
  2204
This is intended to only be used with fail types RAllocator::EFailNext,
williamr@2
  2205
RAllocator::EBurstFailNext, RAllocator::EDeterministic and
williamr@2
  2206
RAllocator::EBurstDeterministic.  The return value is unreliable for 
williamr@2
  2207
all other fail types.
williamr@2
  2208
williamr@2
  2209
@return The number of heap allocation failures the current debug fail 
williamr@2
  2210
function has caused.
williamr@2
  2211
williamr@2
  2212
@see RAllocator::TAllocFail
williamr@2
  2213
*/
williamr@2
  2214
#define __UHEAP_CHECKFAILURE ((TUint)0)
williamr@2
  2215
williamr@2
  2216
/**
williamr@2
  2217
@publishedAll
williamr@2
  2218
@released
williamr@2
  2219
williamr@2
  2220
Returns the number of kernel heap allocation failures the current debug 
williamr@2
  2221
allocator fail function has caused so far.
williamr@2
  2222
williamr@2
  2223
This is intended to only be used with fail types RAllocator::EFailNext,
williamr@2
  2224
RAllocator::EBurstFailNext, RAllocator::EDeterministic and
williamr@2
  2225
RAllocator::EBurstDeterministic.  The return value is unreliable for 
williamr@2
  2226
all other fail types.
williamr@2
  2227
williamr@2
  2228
@return The number of heap allocation failures the current debug fail 
williamr@2
  2229
function has caused.
williamr@2
  2230
williamr@2
  2231
@see RAllocator::TAllocFail
williamr@2
  2232
*/
williamr@2
  2233
#define __KHEAP_CHECKFAILURE ((TUint)0)
williamr@2
  2234
williamr@2
  2235
/**
williamr@2
  2236
@publishedAll
williamr@2
  2237
@released
williamr@2
  2238
williamr@2
  2239
Marks the start of heap checking for the specific heap. 
williamr@2
  2240
williamr@2
  2241
This macro is defined only for debug builds.
williamr@2
  2242
williamr@2
  2243
This macro must be matched by a corresponding call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
williamr@2
  2244
williamr@2
  2245
Calls to this macro can be nested but each call must be matched by corresponding 
williamr@2
  2246
call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
williamr@2
  2247
williamr@2
  2248
@param aHeap A pointer to the specific RHeap
williamr@2
  2249
williamr@2
  2250
@see RHeap
williamr@2
  2251
@see RAllocator::__DbgMarkStart()
williamr@2
  2252
@see __RHEAP_MARKEND
williamr@2
  2253
@see __RHEAP_MARKENDC
williamr@2
  2254
*/
williamr@2
  2255
#define __RHEAP_MARK(aHeap)
williamr@2
  2256
williamr@2
  2257
williamr@2
  2258
williamr@2
  2259
williamr@2
  2260
/**
williamr@2
  2261
@publishedAll
williamr@2
  2262
@released
williamr@2
  2263
williamr@2
  2264
Checks that the number of allocated cells at the current nested level on the 
williamr@2
  2265
specified heap is the same as the specified value. 
williamr@2
  2266
williamr@2
  2267
The macro also takes the name of the file containing this source code statement 
williamr@2
  2268
and the line number of this source code statement; they are displayed as part 
williamr@2
  2269
of the panic category, if the checks fail. 
williamr@2
  2270
williamr@2
  2271
This macro is defined only for debug builds.
williamr@2
  2272
williamr@2
  2273
@param aHeap  A pointer to the specific RHeap.
williamr@2
  2274
@param aCount The number of heap cells expected to be allocated at
williamr@2
  2275
              the current nest level.
williamr@2
  2276
williamr@2
  2277
@see RAllocator::__DbgMarkCheck()
williamr@2
  2278
*/
williamr@2
  2279
#define __RHEAP_CHECK(aHeap,aCount)
williamr@2
  2280
williamr@2
  2281
williamr@2
  2282
williamr@2
  2283
williamr@2
  2284
/**
williamr@2
  2285
@publishedAll
williamr@2
  2286
@released
williamr@2
  2287
williamr@2
  2288
Checks that the total number of allocated cells on the specified heap is the 
williamr@2
  2289
same as the specified value.
williamr@2
  2290
williamr@2
  2291
The macro also takes the name of the file containing this source code statement 
williamr@2
  2292
and the line number of this source code statement; they are displayed as part 
williamr@2
  2293
of the panic category, if the checks fail.
williamr@2
  2294
williamr@2
  2295
This macro is defined only for debug builds.
williamr@2
  2296
williamr@2
  2297
@param aHeap  A pointer to the specific RHeap.
williamr@2
  2298
@param aCount The total number of heap cells expected to be allocated.
williamr@2
  2299
williamr@2
  2300
@see RAllocator::__DbgMarkCheck()
williamr@2
  2301
*/
williamr@2
  2302
#define __RHEAP_CHECKALL(aHeap,aCount)
williamr@2
  2303
williamr@2
  2304
williamr@2
  2305
williamr@2
  2306
williamr@2
  2307
/**
williamr@2
  2308
@publishedAll
williamr@2
  2309
@released
williamr@2
  2310
williamr@2
  2311
Marks the end of heap checking for the specific heap.
williamr@2
  2312
williamr@2
  2313
The macro expects zero heap cells to remain allocated at the current nest 
williamr@2
  2314
level. This macro is defined only for debug builds.
williamr@2
  2315
williamr@2
  2316
This macro must match an earlier call to __RHEAP_MARK.
williamr@2
  2317
williamr@2
  2318
@param aHeap A pointer to the specific RHeap.
williamr@2
  2319
williamr@2
  2320
@see RAllocator::__DbgMarkEnd()
williamr@2
  2321
@see __RHEAP_MARK
williamr@2
  2322
*/
williamr@2
  2323
#define __RHEAP_MARKEND(aHeap)
williamr@2
  2324
williamr@2
  2325
williamr@2
  2326
williamr@2
  2327
williamr@2
  2328
/**
williamr@2
  2329
@publishedAll
williamr@2
  2330
@released
williamr@2
  2331
williamr@2
  2332
Marks the end of heap checking for the specific heap.
williamr@2
  2333
williamr@2
  2334
The macro expects aCount heap cells to remain allocated at the current nest 
williamr@2
  2335
level. This macro is defined only for debug builds.
williamr@2
  2336
williamr@2
  2337
This macro must match an earlier call to __RHEAP_MARK.
williamr@2
  2338
williamr@2
  2339
@param aHeap  A pointer to the specific RHeap.
williamr@2
  2340
@param aCount The number of heap cells expected to remain allocated at
williamr@2
  2341
              the current nest level
williamr@2
  2342
williamr@2
  2343
@see RAllocator::__DbgMarkEnd()
williamr@2
  2344
@see __RHEAP_MARK
williamr@2
  2345
*/
williamr@2
  2346
#define __RHEAP_MARKENDC(aHeap,aCount)
williamr@2
  2347
williamr@2
  2348
williamr@2
  2349
williamr@2
  2350
williamr@2
  2351
/**
williamr@2
  2352
@publishedAll
williamr@2
  2353
@released
williamr@2
  2354
williamr@2
  2355
Simulates an allocation failure for the specific heap.
williamr@2
  2356
williamr@2
  2357
The failure occurs on the next call to new or any of the functions which allocate 
williamr@2
  2358
memory from the heap. This macro is defined only for debug builds.
williamr@2
  2359
williamr@2
  2360
@param aHeap  A pointer to the specific RHeap.
williamr@2
  2361
@param aCount The rate of failure - heap allocation fails every aCount attempt.
williamr@2
  2362
williamr@2
  2363
@see RAllocator::__DbgSetAllocFail()
williamr@2
  2364
*/
williamr@2
  2365
#define __RHEAP_FAILNEXT(aHeap,aCount)
williamr@2
  2366
williamr@2
  2367
/**
williamr@2
  2368
@publishedAll
williamr@2
  2369
@released
williamr@2
  2370
williamr@2
  2371
Simulates aBurst allocation failures for the specific heap.
williamr@2
  2372
williamr@2
  2373
The failure occurs on the next call to new or any of the functions which allocate 
williamr@2
  2374
memory from the heap. This macro is defined only for debug builds.
williamr@2
  2375
williamr@2
  2376
@param aHeap  A pointer to the specific RHeap.
williamr@2
  2377
@param aCount The heap allocation will fail after aCount-1 allocation attempts. 
williamr@2
  2378
              Note when used with RHeap the maximum value aCount can be set 
williamr@2
  2379
              to is KMaxTUint16.
williamr@2
  2380
@param aBurst The number of consecutive allocations that will fail.  Note 
williamr@2
  2381
              when used with RHeap the maximum value aBurst can be set 
williamr@2
  2382
              to is KMaxTUint16.
williamr@2
  2383
williamr@2
  2384
@see RAllocator::__DbgSetBurstAllocFail()
williamr@2
  2385
*/
williamr@2
  2386
#define __RHEAP_BURSTFAILNEXT(aHeap,aCount,aBurst)
williamr@2
  2387
williamr@2
  2388
williamr@2
  2389
williamr@2
  2390
/**
williamr@2
  2391
@publishedAll
williamr@2
  2392
@released
williamr@2
  2393
williamr@2
  2394
Simulates an allocation failure for the specific heap. 
williamr@2
  2395
williamr@2
  2396
The failure occurs on subsequent calls to new or any of the functions which 
williamr@2
  2397
allocate memory from the heap. This macro is defined only for debug builds.
williamr@2
  2398
williamr@2
  2399
@param aHeap  A pointer to the specific RHeap.
williamr@2
  2400
@param aType  The type of failure to be simulated. 
williamr@2
  2401
@param aRate The failure rate.
williamr@2
  2402
williamr@2
  2403
@see RAllocator::__DbgSetAllocFail()
williamr@2
  2404
*/
williamr@2
  2405
#define __RHEAP_SETFAIL(aHeap,aType,aRate)
williamr@2
  2406
williamr@2
  2407
/**
williamr@2
  2408
@publishedAll
williamr@2
  2409
@released
williamr@2
  2410
williamr@2
  2411
Simulates an allocation failure for the specific heap. 
williamr@2
  2412
williamr@2
  2413
The failure occurs on subsequent calls to new or any of the functions which 
williamr@2
  2414
allocate memory from the heap. This macro is defined only for debug builds.
williamr@2
  2415
williamr@2
  2416
@param aHeap  A pointer to the specific RHeap.
williamr@2
  2417
@param aType  The type of failure to be simulated. 
williamr@2
  2418
@param aRate  The failure rate.  Note when used with RHeap the maximum value 
williamr@2
  2419
              aRate can be set to is KMaxTUint16.
williamr@2
  2420
@param aBurst The number of consecutive allocations that will fail.  Note 
williamr@2
  2421
              when used with RHeap the maximum value aBurst can be set 
williamr@2
  2422
              to is KMaxTUint16.
williamr@2
  2423
williamr@2
  2424
@see RAllocator::__DbgSetBurstAllocFail()
williamr@2
  2425
*/
williamr@2
  2426
#define __RHEAP_SETBURSTFAIL(aHeap,aType,aRate,aBurst)
williamr@2
  2427
williamr@2
  2428
williamr@2
  2429
williamr@2
  2430
/**
williamr@2
  2431
@publishedAll
williamr@2
  2432
@released
williamr@2
  2433
williamr@2
  2434
Cancels simulated allocation failure for the specific heap.
williamr@2
  2435
williamr@2
  2436
This macro is defined only for debug builds.
williamr@2
  2437
williamr@2
  2438
@param aHeap A pointer to the specific RHeap.
williamr@2
  2439
williamr@2
  2440
@see RAllocator::__DbgSetAllocFail()
williamr@2
  2441
*/
williamr@2
  2442
#define __RHEAP_RESET(aHeap)
williamr@2
  2443
williamr@2
  2444
williamr@2
  2445
williamr@2
  2446
/**
williamr@2
  2447
@publishedAll
williamr@2
  2448
@released
williamr@2
  2449
williamr@2
  2450
Cancels simulated allocation failure for the specific heap.
williamr@2
  2451
It walks the the heap and sets the nesting level for all allocated
williamr@2
  2452
cells to zero.
williamr@2
  2453
williamr@2
  2454
This macro is defined only for debug builds.
williamr@2
  2455
williamr@2
  2456
@param aHeap A pointer to the specific RHeap.
williamr@2
  2457
williamr@2
  2458
@see RAllocator::__DbgSetAllocFail()
williamr@2
  2459
*/
williamr@2
  2460
#define __RHEAP_TOTAL_RESET(aHeap)
williamr@2
  2461
williamr@2
  2462
williamr@2
  2463
/**
williamr@2
  2464
@publishedAll
williamr@2
  2465
@released
williamr@2
  2466
williamr@2
  2467
Returns the number of heap allocation failures the current debug allocator fail
williamr@2
  2468
function has caused so far.
williamr@2
  2469
williamr@2
  2470
This is intended to only be used with fail types RAllocator::EFailNext,
williamr@2
  2471
RAllocator::EBurstFailNext, RAllocator::EDeterministic and
williamr@2
  2472
RAllocator::EBurstDeterministic.  The return value is unreliable for 
williamr@2
  2473
all other fail types.
williamr@2
  2474
williamr@2
  2475
@return The number of heap allocation failures the current debug fail 
williamr@2
  2476
function has caused.
williamr@2
  2477
williamr@2
  2478
@see RAllocator::TAllocFail
williamr@2
  2479
*/
williamr@2
  2480
#define __RHEAP_CHECKFAILURE(aHeap) ((TUint)0)
williamr@2
  2481
williamr@2
  2482
#define __DEBUGGER()
williamr@2
  2483
#endif
williamr@2
  2484
williamr@2
  2485
#if defined (__WINS__)
williamr@2
  2486
/** @internalTechnology */
williamr@2
  2487
#define __EMULATOR_IMAGE_HEADER2(aUid0,aUid1,aUid2,aPriority,aCap0,aCap1,aSid,aVid,aVer,aFlags)	TEmulatorImageHeader uid={{aUid0,aUid1,aUid2},aPriority,{aSid,aVid,{aCap0,aCap1}},0,0,aVer,aFlags};
williamr@2
  2488
/** @internalTechnology */
williamr@2
  2489
#define __EMULATOR_IMAGE_HEADER(aUid0,aUid1,aUid2,aPriority,aCap,aFlags)					TEmulatorImageHeader uid={{aUid0,aUid1,aUid2},aPriority,{aUid2,0,{aCap,0}},0,0,0x00010000u,aFlags};
williamr@2
  2490
#else
williamr@2
  2491
#define __EMULATOR_IMAGE_HEADER2(aUid0,aUid1,aUid2,aPriority,aCap0,aCap1,aSid,aVer,aFlags)
williamr@2
  2492
#define __EMULATOR_IMAGE_HEADER(aUid0,aUid1,aUid2,aPriority,aCap,aFlags)
williamr@2
  2493
#endif
williamr@2
  2494
williamr@2
  2495
#if defined(_UNICODE)
williamr@2
  2496
#if !defined(UNICODE)
williamr@2
  2497
/**
williamr@2
  2498
@publishedAll
williamr@2
  2499
@deprecated
williamr@2
  2500
*/
williamr@2
  2501
#define UNICODE
williamr@2
  2502
#endif
williamr@2
  2503
#endif
williamr@2
  2504
williamr@2
  2505
#if !defined(ASSERT)
williamr@2
  2506
/**
williamr@2
  2507
@publishedAll
williamr@2
  2508
@released
williamr@2
  2509
williamr@2
  2510
Generates _ASSERT_DEBUG code that calls User::Invariant() if the specified
williamr@2
  2511
condition is not true.
williamr@2
  2512
williamr@2
  2513
@param x A conditional expression which results in true or false.
williamr@2
  2514
*/
williamr@2
  2515
#define ASSERT(x) __ASSERT_DEBUG(x,User::Invariant())
williamr@2
  2516
#endif
williamr@2
  2517
williamr@2
  2518
williamr@2
  2519
williamr@2
  2520
williamr@2
  2521
#if defined(_DEBUG)
williamr@2
  2522
/**
williamr@2
  2523
@publishedAll
williamr@2
  2524
@released
williamr@2
  2525
*/
williamr@2
  2526
#define __DEBUG_ONLY(x) x
williamr@2
  2527
#else
williamr@2
  2528
#define __DEBUG_ONLY(x)
williamr@2
  2529
#endif
williamr@2
  2530
williamr@2
  2531
williamr@2
  2532
williamr@2
  2533
williamr@2
  2534
#ifdef __KERNEL_MODE__
williamr@2
  2535
williamr@2
  2536
/** @internalComponent */
williamr@2
  2537
#define	KIMPORT_C	IMPORT_C
williamr@2
  2538
williamr@2
  2539
/** @internalComponent */
williamr@2
  2540
#define	KEXPORT_C	EXPORT_C
williamr@2
  2541
williamr@2
  2542
/** @internalComponent */
williamr@2
  2543
#define	UIMPORT_C
williamr@2
  2544
williamr@2
  2545
/** @internalComponent */
williamr@2
  2546
#define	UEXPORT_C
williamr@2
  2547
#else
williamr@2
  2548
#define	KIMPORT_C
williamr@2
  2549
#define	KEXPORT_C
williamr@2
  2550
#define	UIMPORT_C	IMPORT_C
williamr@2
  2551
#define	UEXPORT_C	EXPORT_C
williamr@2
  2552
#endif
williamr@2
  2553
williamr@2
  2554
williamr@2
  2555
williamr@2
  2556
williamr@2
  2557
/**
williamr@2
  2558
@publishedAll
williamr@2
  2559
@released
williamr@2
  2560
williamr@2
  2561
Asserts that a condition is true at compilation time.
williamr@2
  2562
williamr@2
  2563
@param x Condition to assert
williamr@2
  2564
*/
williamr@2
  2565
#define __ASSERT_COMPILE(x)		void __compile_time_assert(int __check[(x)?1:-1])
williamr@2
  2566
williamr@2
  2567
#ifdef __REMOVE_PLATSEC_DIAGNOSTICS__
williamr@2
  2568
/**
williamr@2
  2569
@publishedPartner
williamr@2
  2570
@released
williamr@2
  2571
*/
williamr@2
  2572
#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
williamr@2
  2573
#define __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
williamr@2
  2574
#endif /*__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__*/
williamr@2
  2575
#endif /*__REMOVE_PLATSEC_DIAGNOSTICS__*/
williamr@2
  2576
williamr@2
  2577
/**
williamr@2
  2578
@internalComponent
williamr@2
  2579
*/
williamr@2
  2580
static const char* const KSuppressPlatSecDiagnosticMagicValue = (const char*)1;
williamr@2
  2581
williamr@2
  2582
#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
williamr@2
  2583
/**
williamr@2
  2584
@internalComponent
williamr@2
  2585
*/
williamr@2
  2586
#define __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER(l) #l
williamr@2
  2587
/**
williamr@2
  2588
@internalComponent
williamr@2
  2589
*/
williamr@2
  2590
#define __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER2(f,l) f "(" __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER(l) ")"
williamr@2
  2591
/**
williamr@2
  2592
@publishedPartner
williamr@2
  2593
@released
williamr@2
  2594
*/
williamr@2
  2595
#define __PLATSEC_DIAGNOSTIC_FILE_AND_LINE __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER2(__FILE__,__LINE__)
williamr@2
  2596
williamr@2
  2597
/**
williamr@2
  2598
@publishedPartner
williamr@2
  2599
@released
williamr@2
  2600
williamr@2
  2601
A macro that should be used to enclose a platform security diagnostic
williamr@2
  2602
'C' style string that can be passed to a capability checking function such
williamr@2
  2603
as RThread::HasCapability() and Kern::CurrentThreadHasCapability().
williamr@2
  2604
williamr@2
  2605
The content of the string is emitted if the capability test finds that
williamr@2
  2606
the capability is not present.
williamr@2
  2607
williamr@2
  2608
The macro provides a convenient mechanism that allows the strings to
williamr@2
  2609
be removed from future versions of Symbian OS.
williamr@2
  2610
williamr@2
  2611
For example:
williamr@2
  2612
williamr@2
  2613
@code
williamr@2
  2614
if(!Kern::CurrentThreadHasCapability(ECapabilityPowerMgmt,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetState")))
williamr@2
  2615
    {
williamr@2
  2616
    return KErrPermissionDenied;
williamr@2
  2617
    }			
williamr@2
  2618
@endcode
williamr@2
  2619
williamr@2
  2620
In this example, the string:
williamr@2
  2621
williamr@2
  2622
@code
williamr@2
  2623
Checked by Hal function EDisplayHalSetState
williamr@2
  2624
@endcode
williamr@2
  2625
williamr@2
  2626
is emitted if the calling process does not have the ECapabilityPowerMgmt capability.
williamr@2
  2627
williamr@2
  2628
@param s A C-style string.
williamr@2
  2629
williamr@2
  2630
@see RProcess::HasCapability()
williamr@2
  2631
@see RThread::HasCapability()
williamr@2
  2632
@see RMessagePtr2::HasCapability()
williamr@2
  2633
@see User::CreatorHasCapability()
williamr@2
  2634
*/
williamr@2
  2635
#define __PLATSEC_DIAGNOSTIC_STRING(s) s
williamr@2
  2636
williamr@2
  2637
/**
williamr@2
  2638
When this value is used in Platform Security APIs as the value for the aDiagnosticText
williamr@2
  2639
argument, these APIs will not emit any form of diagnostic message.
williamr@2
  2640
@publishedPartner
williamr@2
  2641
@released
williamr@2
  2642
*/
williamr@2
  2643
// Note this value is the same as KSuppressPlatSecDiagnosticMagicValue
williamr@2
  2644
// and used to be a set by it but that caused an error with GCCE compiler
williamr@2
  2645
static const char* const KSuppressPlatSecDiagnostic = (const char*)1;
williamr@2
  2646
williamr@2
  2647
#else /* __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ */
williamr@2
  2648
williamr@2
  2649
#define __PLATSEC_DIAGNOSTIC_STRING(s) NULL
williamr@2
  2650
williamr@2
  2651
#ifndef __KERNEL_MODE__
williamr@2
  2652
#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
williamr@2
  2653
/**
williamr@2
  2654
When this value is used in Platform Security APIs as the value for the aDiagnostic
williamr@2
  2655
argument, these APIs will not emit any form of diagnostic message.
williamr@2
  2656
@publishedPartner
williamr@2
  2657
@released
williamr@2
  2658
*/
williamr@2
  2659
#define KSuppressPlatSecDiagnostic		NULL, NULL
williamr@2
  2660
williamr@2
  2661
#else /* __REMOVE_PLATSEC_DIAGNOSTICS__ */
williamr@2
  2662
williamr@2
  2663
/**
williamr@2
  2664
When this value is used in Platform Security APIs as the value for the aDiagnostic
williamr@2
  2665
argument, these APIs will not emit any form of diagnostic message.
williamr@2
  2666
@publishedPartner
williamr@4
  2667
@released
williamr@2
  2668
*/
williamr@2
  2669
#define KSuppressPlatSecDiagnostic		NULL
williamr@2
  2670
williamr@2
  2671
#endif /* !__REMOVE_PLATSEC_DIAGNOSTICS__ */
williamr@2
  2672
#endif /* !__KERNEL_MODE__ */
williamr@2
  2673
#endif /* !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ */
williamr@2
  2674
williamr@2
  2675
/*
williamr@2
  2676
 * MSVC operator new and operator new[] header guards
williamr@2
  2677
 */
williamr@2
  2678
#ifdef __PLACEMENT_NEW
williamr@2
  2679
#define __PLACEMENT_NEW_INLINE
williamr@2
  2680
#endif /* __PLACEMENT_NEW */
williamr@2
  2681
williamr@2
  2682
#if defined(__VC32__) && (_MSC_VER < 1300)
williamr@2
  2683
#define __PLACEMENT_VEC_NEW_INLINE
williamr@4
  2684
#define __OMIT_VEC_OPERATOR_NEW_DECL__
williamr@2
  2685
#endif /* version of MSVC that doesn't support overloaded operator new[] */
williamr@2
  2686
williamr@2
  2687
/**
williamr@2
  2688
Calling convention qualifier for functions involving floating point 
williamr@2
  2689
variables passed or returned by value.
williamr@2
  2690
@publishedAll
williamr@2
  2691
@released
williamr@2
  2692
*/
williamr@2
  2693
#ifndef __SOFTFP
williamr@2
  2694
#define __SOFTFP
williamr@2
  2695
#endif /* __SOFTFP */
williamr@2
  2696
williamr@4
  2697
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
williamr@4
  2698
#include <e32def_private.h>
williamr@4
  2699
#endif
williamr@4
  2700
williamr@2
  2701
#endif /* __E32DEF_H__ */