1.1 --- a/epoc32/include/e32def.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/e32def.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,3238 @@
1.4 -e32def.h
1.5 +/*
1.6 +* Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description:
1.19 +* e32\include\e32def.h
1.20 +* NOTE: THIS FILE SHOULD BE ACCEPTABLE TO A C COMPILER
1.21 +*
1.22 +*
1.23 +*/
1.24 +
1.25 +
1.26 +
1.27 +
1.28 +
1.29 +#ifndef __E32DEF_H__
1.30 +#define __E32DEF_H__
1.31 +
1.32 +/*
1.33 + * __LEAVE_EQUALS_THROW__ requires the compiler to support C++ exceptions
1.34 + */
1.35 +#ifndef __SUPPORT_CPP_EXCEPTIONS__
1.36 +#undef __LEAVE_EQUALS_THROW__
1.37 +#endif
1.38 +
1.39 +
1.40 +
1.41 +
1.42 +
1.43 +#ifdef __PROFILING__
1.44 +
1.45 +/**
1.46 +@publishedPartner
1.47 +@removed
1.48 +*/
1.49 +#define __PROFILE_START(aBin) RDebug::ProfileStart(aBin)
1.50 +
1.51 +/**
1.52 +@publishedPartner
1.53 +@removed
1.54 +*/
1.55 +#define __PROFILE_END(aBin) RDebug::ProfileEnd(aBin)
1.56 +
1.57 +/**
1.58 +@publishedPartner
1.59 +@removed
1.60 +*/
1.61 +#define __PROFILE_RESET(aNumberOfBins) RDebug::ProfileReset(0,aNumberOfBins)
1.62 +
1.63 +/**
1.64 +@publishedPartner
1.65 +@removed
1.66 +*/
1.67 +#define __PROFILE_DISPLAY(aNumberOfBins) \
1.68 + { TFixedArray<TProfile, aNumberOfBins> result; \
1.69 + RDebug::ProfileResult(result.Begin(), 0, aNumberOfBins); \
1.70 + for (TInt i=0; i<aNumberOfBins; i++) \
1.71 + RDebug::Print(_L("Profile bin %d: Calls: %d, Clock ticks: %d\n" ),i,res[i].iCount,result[i].iTime); \
1.72 + }
1.73 +#else /* __PROFILING__ */
1.74 +#define __PROFILE_START(aBin)
1.75 +#define __PROFILE_END(aBin)
1.76 +#define __PROFILE_RESET(aNumberOfBins)
1.77 +#define __PROFILE_DISPLAY(aNumberOfBins)
1.78 +#endif
1.79 +
1.80 +
1.81 +
1.82 +#if defined(__VC32__)
1.83 +/**
1.84 +@publishedAll
1.85 +@released
1.86 +*/
1.87 +#define __NO_CLASS_CONSTS__
1.88 +#if (_MSC_VER >= 1200)
1.89 +/**
1.90 +@publishedAll
1.91 +@released
1.92 +*/
1.93 +#define __NORETURN__ __declspec(noreturn)
1.94 +#else
1.95 +#define __NORETURN__
1.96 +#endif
1.97 +/**
1.98 +@publishedAll
1.99 +@released
1.100 +*/
1.101 +#define __NORETURN_TERMINATOR()
1.102 +/**
1.103 +@publishedAll
1.104 +@released
1.105 +*/
1.106 +#define IMPORT_C __declspec(dllexport)
1.107 +/**
1.108 +@publishedAll
1.109 +@released
1.110 +*/
1.111 +#define EXPORT_C __declspec(dllexport)
1.112 +/**
1.113 +@publishedAll
1.114 +@released
1.115 +*/
1.116 +#define NONSHARABLE_CLASS(x) class x
1.117 +/**
1.118 +@publishedAll
1.119 +@released
1.120 +*/
1.121 +#define NONSHARABLE_STRUCT(x) struct x
1.122 +/**
1.123 +@publishedAll
1.124 +@released
1.125 +*/
1.126 +#define __NO_THROW throw()
1.127 +/**
1.128 +@publishedAll
1.129 +@released
1.130 +*/
1.131 +#define __THROW(t) throw(t)
1.132 +#pragma warning( disable : 4355 ) /* 'this' used in base member initializer list */
1.133 +#pragma warning( disable : 4511 ) /* copy constructor could not be generated */
1.134 +#pragma warning( disable : 4512 ) /* assignment operator could not be generated */
1.135 +#pragma warning( disable : 4514 ) /* unreferenced inline function has been removed */
1.136 +#pragma warning( disable : 4699 ) /* Note: Using precompiled header %s */
1.137 +#pragma warning( disable : 4710 ) /* function not inlined */
1.138 +#pragma warning( disable : 4121 ) /* alignment sensitive to packing */
1.139 +#pragma warning( disable : 4273 )
1.140 +#pragma warning( disable : 4097 ) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */
1.141 +#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 */
1.142 +
1.143 +#if _MSC_VER >= 1100
1.144 +/**
1.145 +@publishedAll
1.146 +@released
1.147 +*/
1.148 +#define TEMPLATE_SPECIALIZATION template<>
1.149 +#else
1.150 +#define TEMPLATE_SPECIALIZATION
1.151 +#endif
1.152 +#endif
1.153 +
1.154 +
1.155 +
1.156 +#if defined(__CW32__)
1.157 +#undef __embedded_cplusplus
1.158 +/** @internalTechnology */
1.159 +#define __embedded_cplusplus 1
1.160 +#define __NO_CLASS_CONSTS__
1.161 +#define __NORETURN__
1.162 +#define __NORETURN_TERMINATOR()
1.163 +#define IMPORT_C __declspec(dllexport)
1.164 +#define EXPORT_C __declspec(dllexport)
1.165 +#define NONSHARABLE_CLASS(x) class x
1.166 +#define NONSHARABLE_STRUCT(x) struct x
1.167 +#define __NO_THROW throw()
1.168 +#define __THROW(t) throw(t)
1.169 +
1.170 +#define TEMPLATE_SPECIALIZATION template<>
1.171 +/**
1.172 +@publishedAll
1.173 +@released
1.174 +*/
1.175 +#define _asm asm
1.176 +#ifndef __int64
1.177 +#pragma longlong on
1.178 +/** @internalTechnology */
1.179 +#define __int64 long long
1.180 +#endif
1.181 +#ifndef __SUPPORT_CPP_EXCEPTIONS__
1.182 +#pragma exceptions off /* no support for C++ exception handling */
1.183 +#pragma RTTI off /* no support for C++ runtime type information */
1.184 +#endif
1.185 +#if __MWERKS__ >= 0x3200
1.186 +#pragma warning off (10480) /* deleteing void pointer is undefined */
1.187 +#pragma warning off (10350) /* N pad byte(s) inserted after data member */
1.188 +#endif
1.189 +#endif
1.190 +
1.191 +
1.192 +
1.193 +#if defined(__GCC32__)
1.194 +#define __NO_CLASS_CONSTS__
1.195 +#define __NORETURN__ __attribute__ ((noreturn))
1.196 +#ifdef __GCCV3__
1.197 +#define __NORETURN_TERMINATOR()
1.198 +#else
1.199 +#define __NORETURN_TERMINATOR() abort()
1.200 +#endif
1.201 +#define IMPORT_C
1.202 +#if !defined __WINS__ && defined _WIN32 /* VC++ Browser Hack */
1.203 +#define EXPORT_C
1.204 +/** @internalTechnology */
1.205 +#define asm(x)
1.206 +#else
1.207 +#define EXPORT_C __declspec(dllexport)
1.208 +#endif
1.209 +#define NONSHARABLE_CLASS(x) class x
1.210 +#define NONSHARABLE_STRUCT(x) struct x
1.211 +#define __NO_THROW
1.212 +#define __THROW(t)
1.213 +#ifdef __EABI__
1.214 +#define TEMPLATE_SPECIALIZATION template<>
1.215 +#else
1.216 +#define TEMPLATE_SPECIALIZATION
1.217 +#endif
1.218 +#endif
1.219 +
1.220 +
1.221 +
1.222 +#ifdef __GCC32__
1.223 +/**
1.224 +@publishedAll
1.225 +@released
1.226 +*/
1.227 +#define __DOUBLE_WORDS_SWAPPED__
1.228 +#endif
1.229 +
1.230 +
1.231 +
1.232 +/** @internalTechnology */
1.233 +#define __NO_MUTABLE_KEYWORD
1.234 +#if defined(__NO_MUTABLE_KEYWORD)
1.235 +/**
1.236 +@publishedAll
1.237 +@deprecated
1.238 +*/
1.239 +#define __MUTABLE
1.240 +#else
1.241 +#define __MUTABLE mutable
1.242 +#endif
1.243 +
1.244 +
1.245 +
1.246 +/**
1.247 +@publishedAll
1.248 +@deprecated
1.249 +*/
1.250 +#define CONST_CAST(type,exp) (const_cast<type>(exp))
1.251 +
1.252 +/**
1.253 +@publishedAll
1.254 +@deprecated
1.255 +*/
1.256 +#define STATIC_CAST(type,exp) (static_cast<type>(exp))
1.257 +
1.258 +/**
1.259 +@publishedAll
1.260 +@deprecated
1.261 +*/
1.262 +#define REINTERPRET_CAST(type,exp) (reinterpret_cast<type>(exp))
1.263 +
1.264 +#if defined(__NO_MUTABLE_KEYWORD)
1.265 +/**
1.266 +@publishedAll
1.267 +@deprecated
1.268 +*/
1.269 +#define MUTABLE_CAST(type,exp) (const_cast<type>(exp))
1.270 +#else
1.271 +#define MUTABLE_CAST(type,exp) (exp)
1.272 +#endif
1.273 +
1.274 +/**
1.275 +@publishedAll
1.276 +@deprecated
1.277 +*/
1.278 +#define GLREF_D extern
1.279 +/**
1.280 +@publishedAll
1.281 +@deprecated
1.282 +*/
1.283 +#define GLDEF_D
1.284 +/**
1.285 +@publishedAll
1.286 +@deprecated
1.287 +*/
1.288 +#define LOCAL_D static
1.289 +/**
1.290 +@publishedAll
1.291 +@deprecated
1.292 +*/
1.293 +#define GLREF_C extern
1.294 +/**
1.295 +@publishedAll
1.296 +@deprecated
1.297 +*/
1.298 +#define GLDEF_C
1.299 +/**
1.300 +@publishedAll
1.301 +@deprecated
1.302 +*/
1.303 +#define LOCAL_C static
1.304 +/**
1.305 +@publishedAll
1.306 +@deprecated
1.307 +*/
1.308 +#define FOREVER for(;;)
1.309 +
1.310 +
1.311 +
1.312 +
1.313 +/**
1.314 +@publishedAll
1.315 +@released
1.316 +
1.317 +Symbolic definition for a true value.
1.318 +*/
1.319 +#define TRUE 1
1.320 +
1.321 +
1.322 +
1.323 +
1.324 +/**
1.325 +@publishedAll
1.326 +@released
1.327 +
1.328 +Symbolic definition for a false value.
1.329 +*/
1.330 +#define FALSE 0
1.331 +#ifndef NULL
1.332 +
1.333 +
1.334 +
1.335 +
1.336 +/**
1.337 +@publishedAll
1.338 +@released
1.339 +
1.340 +Symbolic definition for a NULL value.
1.341 +*/
1.342 +#define NULL 0
1.343 +#endif
1.344 +
1.345 +
1.346 +
1.347 +
1.348 +#ifndef VA_START
1.349 +/**
1.350 +@publishedAll
1.351 +@released
1.352 +
1.353 +A macro used by Symbian OS code for handling a variable argument list
1.354 +in a function call.
1.355 +
1.356 +Sets a pointer to point to the first of the variable arguments.
1.357 +
1.358 +Typical usage:
1.359 +
1.360 +@code
1.361 +Foo(CAbcdef aAbcdef,...)
1.362 + {
1.363 + VA_LIST list;
1.364 + VA_START(list, aAbcdef);
1.365 + // other code
1.366 + }
1.367 +@endcode
1.368 +
1.369 +@param ap A pointer used to hold the address of an argument in
1.370 + the variable argument list. After execution of the code generated
1.371 + by this macro, the pointer points to the first argument in
1.372 + the variable argument list.
1.373 + This symbol is usually declared as a VA_LIST type.
1.374 +
1.375 +@param pn The argument that immediately precedes the variable argument list.
1.376 +
1.377 +@see VA_LIST
1.378 +@see VA_ARG
1.379 +*/
1.380 +#define VA_START(ap,pn) ((ap)[0]=(TInt8 *)&pn+((sizeof(pn)+sizeof(TInt)-1)&~(sizeof(TInt)-1)),(void)0)
1.381 +#endif
1.382 +
1.383 +
1.384 +
1.385 +
1.386 +#ifndef VA_ARG
1.387 +/**
1.388 +@publishedAll
1.389 +@released
1.390 +
1.391 +A macro used by Symbian OS code for handling a variable argument list
1.392 +in a function call.
1.393 +
1.394 +Increments a pointer to a variable argument list to point to the next argument
1.395 +in the list. The current argument is assumed to be of a type defined by
1.396 +the second parameter to this macro.
1.397 +
1.398 +Typical usage:
1.399 +
1.400 +@code
1.401 +Foo(CAbcdef aAbcdef,...)
1.402 + {
1.403 + VA_LIST list;
1.404 + VA_START(list, aAbcdef);
1.405 + ...
1.406 + TInt x = VA_ARG(list,TInt);
1.407 + ...
1.408 + const TDesC *pS=VA_ARG(aList,const TDesC*);
1.409 + ...
1.410 + etc
1.411 + }
1.412 +@endcode
1.413 +
1.414 +@param ap A pointer used to hold the address of an argument in
1.415 + the variable argument list. It is assumed to point to the current
1.416 + argument in the variable argument list. After execution of the code
1.417 + generated by this macro, the pointer points to the next argument in
1.418 + the list. This symbol is usually declared as a VA_LIST type.
1.419 +
1.420 +@param type The type of the current argument.
1.421 + This can be any valid type, for example, TInt, const TDesC*, etc.
1.422 +
1.423 +@see VA_LIST
1.424 +@see VA_START
1.425 +*/
1.426 +#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)))))
1.427 +#endif
1.428 +
1.429 +
1.430 +
1.431 +
1.432 +#ifndef VA_END
1.433 +/**
1.434 +@publishedAll
1.435 +@released
1.436 +
1.437 +A macro used by Symbian OS code for handling a variable argument list
1.438 +in a function call.
1.439 +
1.440 +Sets a pointer to zero.
1.441 +
1.442 +@param ap A pointer used to hold the address of an argument in
1.443 + the variable argument list. After execution of the code generated
1.444 + by this macro, the pointer is reset to 0.
1.445 + This symbol is usually declared as a VA_LIST type.
1.446 +
1.447 +@see VA_LIST
1.448 +@see VA_START
1.449 +@see VA_ARG
1.450 +*/
1.451 +#define VA_END(ap) ((ap)[0]=0,(void)0)
1.452 +#endif
1.453 +
1.454 +
1.455 +
1.456 +/**
1.457 +@publishedAll
1.458 +@released
1.459 +
1.460 +Calculates the offset of member f within class c.
1.461 +
1.462 +This is used in the TSglQue and TDblQue constructors to set the offset of
1.463 +the link object from the start of a list element.
1.464 +
1.465 +@param c The name of the class.
1.466 +@param f The name of the member within the specified class.
1.467 +
1.468 +@see TSglQue
1.469 +@see TDblQue
1.470 +*/
1.471 +#ifndef _FOFF
1.472 +#if __GNUC__ < 4
1.473 +#define _FOFF(c,f) (((TInt)&(((c *)0x1000)->f))-0x1000)
1.474 +#else
1.475 +#define _FOFF(c,f) __builtin_offsetof(c,f)
1.476 +#endif
1.477 +#endif
1.478 +
1.479 +
1.480 +
1.481 +/**
1.482 +@internalTechnology
1.483 +@released
1.484 +*/
1.485 +#define _ALIGN_DOWN(x,a) ((x)&~((a)-1))
1.486 +/**
1.487 +@internalTechnology
1.488 +@released
1.489 +*/
1.490 +#define _ALIGN_UP(x,a) _ALIGN_DOWN((x)+(a)-1, a)
1.491 +
1.492 +
1.493 +
1.494 +
1.495 +/**
1.496 +@publishedAll
1.497 +@released
1.498 +
1.499 +Pointer to any type.
1.500 +
1.501 +TAny* is equivalent to void* in standard C or C++. TAny* is used in preference
1.502 +to void* because it is more suggestive of the actual meaning,
1.503 +e.g. TAny* foo();.
1.504 +
1.505 +TAny is not used where it really means "nothing", as in the declaration of
1.506 +functions which do not return a value; void is used instead, e.g. void Foo();.
1.507 +*/
1.508 +typedef void TAny;
1.509 +
1.510 +
1.511 +
1.512 +
1.513 +/**
1.514 +@publishedAll
1.515 +@released
1.516 +
1.517 +8-bit signed integer type, used in Symbian OS to mean an 8-bit
1.518 +signed integer, independent of the implementation.
1.519 +*/
1.520 +typedef signed char TInt8;
1.521 +
1.522 +
1.523 +
1.524 +
1.525 +/**
1.526 +@publishedAll
1.527 +@released
1.528 +
1.529 +8-bit unsigned integer type; used in Symbian OS to mean an 8-bit
1.530 +unsigned integer, independent of the implementation.
1.531 +*/
1.532 +typedef unsigned char TUint8;
1.533 +
1.534 +
1.535 +
1.536 +
1.537 +/**
1.538 +@publishedAll
1.539 +@released
1.540 +
1.541 +16-bit signed integer type, used in Symbian OS to mean a 16-bit
1.542 +signed integer, independent of the implementation.
1.543 +*/
1.544 +typedef short int TInt16;
1.545 +
1.546 +
1.547 +
1.548 +
1.549 +/**
1.550 +@publishedAll
1.551 +@released
1.552 +
1.553 +16-bit unsigned integer type. used in Symbian OS to mean a 16-bit
1.554 +unsigned integer, independent of the implementation.
1.555 +*/
1.556 +typedef unsigned short int TUint16;
1.557 +
1.558 +
1.559 +
1.560 +
1.561 +/**
1.562 +@publishedAll
1.563 +@released
1.564 +
1.565 +32-bit signed integer type, used in Symbian OS to mean a 32-bit
1.566 +signed integer, independent of the implementation.
1.567 +*/
1.568 +typedef long int TInt32;
1.569 +
1.570 +
1.571 +
1.572 +
1.573 +/**
1.574 +@publishedAll
1.575 +@released
1.576 +
1.577 +32-bit unsigned integer type; used in Symbian OS to mean a 32-bit
1.578 +unsigned integer, independent of the implementation.
1.579 +*/
1.580 +typedef unsigned long int TUint32;
1.581 +
1.582 +
1.583 +
1.584 +
1.585 +/**
1.586 +@publishedAll
1.587 +@released
1.588 +
1.589 +Signed integer type of the natural machine word length.
1.590 +
1.591 +This is as defined by the C++ implementation's int type. In all
1.592 +implementations, this is guaranteed to be at least 32 bits.
1.593 +
1.594 +A TInt should be used in preference to a sized integer (TInt32, TInt16) for
1.595 +all general use. Sized integers should only be used when packing is essential.
1.596 +C++'s type conversion rules imply that all sized integers smaller than the
1.597 +natural machine word are in any case broadened to the natural machine word
1.598 +size when passed as function parameters.
1.599 +
1.600 +A TInt should be used in preference to an unsigned integer (TUint) for all
1.601 +general use. Unsigned integers should only be used for flags (which use Boolean
1.602 +operations but not arithmetic) and, in very rare cases, for numbers whose
1.603 +range exceeds that available from signed integers. Although it is natural
1.604 +to attempt to use unsigned integers for quantities which cannot by nature
1.605 +be negative, the C++ language does not provide the support necessary to enforce
1.606 +the "expected" behaviour in these circumstances, and experience has shown
1.607 +that it is better to use signed integers unless there is good reason not to.
1.608 +
1.609 +@see TUint
1.610 +@see TInt32
1.611 +@see TInt16
1.612 +*/
1.613 +typedef signed int TInt;
1.614 +
1.615 +
1.616 +
1.617 +
1.618 +/**
1.619 +@publishedAll
1.620 +@released
1.621 +
1.622 +Unsigned integer type of the natural machine word length.
1.623 +
1.624 +This is guaranteed to be at least 32 bits in all implementations.
1.625 +
1.626 +In almost all circumstances, a TInt should be used in preference to a TUint.
1.627 +The main exception is in flags bytes.
1.628 +
1.629 +@see TInt
1.630 +*/
1.631 +typedef unsigned int TUint;
1.632 +
1.633 +
1.634 +
1.635 +
1.636 +/**
1.637 +@publishedAll
1.638 +@released
1.639 +
1.640 +32-bit floating point number, providing IEEE754 single precision on all Symbian
1.641 +OS implementations.
1.642 +
1.643 +TReal should normally be used in preference to TReal32.
1.644 +
1.645 +Use of floating-point numbers should generally be avoided unless a natural
1.646 +part of the problem specification. Most Symbian OS implementations do not
1.647 +have a hardware floating point unit: as a result, their floating-point performance
1.648 +is hundreds of times slower than integer performance.
1.649 +*/
1.650 +typedef float TReal32;
1.651 +
1.652 +
1.653 +
1.654 +
1.655 +/**
1.656 +@publishedAll
1.657 +@released
1.658 +
1.659 +64-bit floating point number, providing IEEE754 double precision on all Symbian
1.660 +OS implementations.
1.661 +
1.662 +Use of floating-point numbers should generally be avoided unless a natural
1.663 +part of the problem specification. Most Symbian OS implementations do not
1.664 +have a hardware floating point unit: as a result, their floating-point performance
1.665 +is hundreds of times slower than integer performance.
1.666 +
1.667 +This type is identical to TReal.
1.668 +
1.669 +@see TReal
1.670 +*/
1.671 +typedef double TReal64;
1.672 +
1.673 +
1.674 +
1.675 +
1.676 +/**
1.677 +@publishedAll
1.678 +@released
1.679 +
1.680 +64-bit floating point number; identical to TReal64.
1.681 +
1.682 +Use of floating-point numbers should generally be avoided unless a natural
1.683 +part of the problem specification. Most Symbian OS implementations do not
1.684 +have a hardware floating point unit: as a result, their floating-point performance
1.685 +is hundreds of times slower than integer performance.
1.686 +
1.687 +Most serious floating-point calculations require double-precision. All standard
1.688 +math functions (see Math class) take double-precision arguments. Single-precision
1.689 +should only be used where space and performance are at a premium, and when
1.690 +their limited precision is acceptable.
1.691 +
1.692 +@see TReal64
1.693 +@see Math
1.694 +*/
1.695 +typedef double TReal;
1.696 +
1.697 +
1.698 +
1.699 +
1.700 +/**
1.701 +@publishedAll
1.702 +@released
1.703 +
1.704 +8-bit unsigned character.
1.705 +
1.706 +Use instead of C++ built-in char type because it is guaranteed to be unsigned.
1.707 +Use instead of TInt8 where the application is really for text rather than
1.708 +8-bit arithmetic or binary quantities.
1.709 +
1.710 +For most purposes, you should use TText rather than TText8. TText is mapped
1.711 +onto either TText8 or TText16 depending on whether a non-Unicode or Unicode
1.712 +variant is being built. Use TText8 only when you are dealing explicitly with
1.713 +8-bit text, regardless of build.
1.714 +
1.715 +@see TText */
1.716 +typedef unsigned char TText8;
1.717 +
1.718 +
1.719 +
1.720 +
1.721 +/**
1.722 +@publishedAll
1.723 +@released
1.724 +
1.725 +16-bit unsigned character.
1.726 +
1.727 +Use instead of C++ wchar_t type because it is guaranteed to be unsigned. Use
1.728 +instead of TInt16 where the application is really for text rather than 8-bit
1.729 +arithmetic or binary quantities.
1.730 +
1.731 +For most purposes, you should use TText rather than TText16. TText is mapped
1.732 +onto either TText8 or TText16 depending on whether a non-Unicode or Unicode
1.733 +variant is being built. Use TText16 only when you are dealing explicitly with
1.734 +16-bit text, regardless of build.
1.735 +
1.736 +@see TText
1.737 +*/
1.738 +typedef unsigned short int TText16;
1.739 +
1.740 +
1.741 +
1.742 +
1.743 +/**
1.744 +@publishedAll
1.745 +@released
1.746 +
1.747 +Boolean type which takes the value either ETrue or EFalse.
1.748 +
1.749 +Although only a single bit would theoretically be necessary to represent a
1.750 +Boolean, a machine word is used instead, so that these quantities can be easily
1.751 +passed. Also, TBool must map onto int because of C++'s interpretation of
1.752 +operands in conditional expressions.
1.753 +
1.754 +On implementations of Symbian OS in which the compiler supports the ANSI-recommended
1.755 +bool type, TBool will be typedef'ed to bool instead of int.
1.756 +*/
1.757 +typedef int TBool;
1.758 +
1.759 +
1.760 +
1.761 +
1.762 +/**
1.763 +@publishedPartner
1.764 +@released
1.765 +
1.766 +Defines a linear (virtual) address type.
1.767 +*/
1.768 +typedef TUint32 TLinAddr;
1.769 +
1.770 +/**
1.771 +@internalTechnology
1.772 +
1.773 +A sorted list of all the code segments in ROM that contain an Exception Descriptor.
1.774 +
1.775 +*/
1.776 +typedef struct TRomExceptionSearchTable
1.777 + {
1.778 + /**
1.779 + The number of entries in the following table.
1.780 + */
1.781 + TInt32 iNumEntries;
1.782 +
1.783 + /**
1.784 + Address of the code segment of each TRomImageHeader that has an Exception Descriptor.
1.785 + */
1.786 + TLinAddr iEntries[1];
1.787 + } TRomExceptionSearchTable;
1.788 +
1.789 +/**
1.790 +@internalComponent
1.791 +*/
1.792 +typedef struct TExceptionDescriptor
1.793 + {
1.794 + TLinAddr iExIdxBase;
1.795 + TLinAddr iExIdxLimit;
1.796 + TLinAddr iROSegmentBase;
1.797 + TLinAddr iROSegmentLimit;
1.798 + } TExceptionDescriptor;
1.799 +
1.800 +
1.801 +#if defined(__GCC32__)
1.802 +
1.803 +
1.804 +
1.805 +
1.806 +/**
1.807 +@publishedAll
1.808 +@released
1.809 +
1.810 +Defines a 64-bit signed integer type.
1.811 +*/
1.812 +typedef long long Int64;
1.813 +
1.814 +
1.815 +
1.816 +
1.817 +/**
1.818 +@publishedAll
1.819 +@released
1.820 +
1.821 +Defines a 64-bit unsigned integer type.
1.822 +*/
1.823 +typedef unsigned long long Uint64;
1.824 +
1.825 +
1.826 +
1.827 +
1.828 +/**
1.829 +@publishedAll
1.830 +@released
1.831 +*/
1.832 +#define I64LIT(x) x##LL
1.833 +/**
1.834 +@publishedAll
1.835 +@released
1.836 +*/
1.837 +#define UI64LIT(x) x##ULL
1.838 +
1.839 +#elif defined(__VC32__)
1.840 +typedef __int64 Int64;
1.841 +typedef unsigned __int64 Uint64;
1.842 +#define I64LIT(x) (__int64)##x
1.843 +#define UI64LIT(x) (unsigned __int64)##x
1.844 +
1.845 +#elif defined(__CW32__)
1.846 +#pragma longlong on
1.847 +typedef long long Int64;
1.848 +typedef unsigned long long Uint64;
1.849 +#define I64LIT(x) x##LL
1.850 +#define UI64LIT(x) x##ULL
1.851 +#endif
1.852 +
1.853 +
1.854 +
1.855 +
1.856 +/**
1.857 +@publishedAll
1.858 +@released
1.859 +
1.860 +Defines a 64-bit signed integer type.
1.861 +
1.862 +NOTE: For those migrating from versions of Symbian OS before 8.1b (i.e. 8.1a, 7.0s etc)
1.863 +TInt64 is now defined as a built-in type instead of as a class type. This means
1.864 +that the member functions of the old TInt64 class are no longer exported
1.865 +from EUSER.LIB, and represents a compatibility break.
1.866 +
1.867 +To ease migration of source code, a number of macros are provided. Similar
1.868 +macros have also been defined in Symbian OS versions 7.0s and 8.1a, but
1.869 +implemented in terms of the old TInt64 class. This is important for code that
1.870 +is common to : one or both of these Symbian OS versions, and to 8.1b and
1.871 +subsequent versions.
1.872 +
1.873 +The following list shows the new macros and the functions that they replace.
1.874 +It also shows some alternative techniques.
1.875 +In this list: x, v and r are declared as TInt64, c is declared as TInt, High
1.876 +and Low are declared as TUint.
1.877 +
1.878 +@code
1.879 +OLD USAGE REPLACEMENT
1.880 +
1.881 +TInt64(High,Low); MAKE_TINT64(High,Low);
1.882 +x.Set(High,Low); MAKE_TINT64(High,Low);
1.883 +x.Low(); I64LOW(x);
1.884 +x.High(); I64HIGH(x);
1.885 +x.GetTInt(); I64INT(x);
1.886 +x.GetTReal(); I64REAL(x);
1.887 +x.Lsr(c); I64LSR(x,c);
1.888 +x.Mul10(); x*=10;
1.889 +x.MulTop(a); I64MULTOP(x,a);
1.890 +x.DivMod(v,r); r=x%v; x/=v;
1.891 +@endcode
1.892 +*/
1.893 +typedef Int64 TInt64;
1.894 +
1.895 +
1.896 +
1.897 +
1.898 +/**
1.899 +@publishedAll
1.900 +@released
1.901 +
1.902 +Defines a 64-bit unsigned integer type.
1.903 +*/
1.904 +typedef Uint64 TUint64;
1.905 +
1.906 +
1.907 +
1.908 +
1.909 +/** @internalComponent */
1.910 +#define _MAKE_TINT64_ZX(x) ((TInt64)((TUint32)(x)))
1.911 +
1.912 +/** @internalComponent */
1.913 +#define _MAKE_TUINT64_ZX(x) ((TUint64)((TUint32)(x)))
1.914 +
1.915 +
1.916 +
1.917 +
1.918 +/**
1.919 +@publishedAll
1.920 +@released
1.921 +*/
1.922 +#define MAKE_TINT64(h,l) ( (_MAKE_TINT64_ZX(h)<<32) | _MAKE_TINT64_ZX(l) )
1.923 +
1.924 +
1.925 +
1.926 +
1.927 +/**
1.928 +@publishedAll
1.929 +@released
1.930 +*/
1.931 +#define MAKE_TUINT64(h,l) ( (_MAKE_TUINT64_ZX(h)<<32) | _MAKE_TUINT64_ZX(l) )
1.932 +
1.933 +
1.934 +
1.935 +
1.936 +/**
1.937 +@publishedAll
1.938 +@released
1.939 +
1.940 +Generates code to access the high order 32 bits of a 64 bit number.
1.941 +*/
1.942 +#define I64HIGH(x) ( (TUint32)((x)>>32) )
1.943 +
1.944 +
1.945 +
1.946 +
1.947 +/**
1.948 +@publishedAll
1.949 +@released
1.950 +
1.951 +Generates code to access the low order 32 bits of a 64 bit number.
1.952 +*/
1.953 +#define I64LOW(x) ( (TUint32)(x) )
1.954 +
1.955 +
1.956 +
1.957 +
1.958 +/**
1.959 +@publishedAll
1.960 +@released
1.961 +
1.962 +Generates code to cast a 64 bit value as an signed integer.
1.963 +*/
1.964 +#define I64INT(x) ( (TInt)(x) )
1.965 +
1.966 +
1.967 +
1.968 +
1.969 +/**
1.970 +@publishedAll
1.971 +@released
1.972 +
1.973 +Generates code to cast a 64 bit value as a TReal type.
1.974 +*/
1.975 +#define I64REAL(x) ( (TReal)(x) )
1.976 +
1.977 +
1.978 +
1.979 +
1.980 +/**
1.981 +@publishedAll
1.982 +@released
1.983 +
1.984 +Generates code to logically shift a 64 bit integer right.
1.985 +*/
1.986 +#define I64LSR(x, shift) ( *reinterpret_cast<TUint64*>(&(x)) >>= (shift) )
1.987 +
1.988 +
1.989 +
1.990 +/**
1.991 +@publishedAll
1.992 +@released
1.993 +
1.994 +Generates code to multiply a 64 bit integer by 10.
1.995 +*/
1.996 +#define I64MUL10(x) ( (x) *= 10 )
1.997 +
1.998 +
1.999 +
1.1000 +/**
1.1001 +@publishedAll
1.1002 +@released
1.1003 +
1.1004 +Generates code to divide a 64 bit integer by another and find the remainder.
1.1005 +*/
1.1006 +#define I64DIVMOD(x, divisor, remainder) ( ((remainder) = (x) % (divisor), (x) /= (divisor)) )
1.1007 +
1.1008 +
1.1009 +
1.1010 +
1.1011 +/**
1.1012 +@publishedAll
1.1013 +@released
1.1014 +
1.1015 +Generates code to cast a double to a 64 bit integer.
1.1016 +*/
1.1017 +#define I64DOUBLECAST(x) ( static_cast<TInt64>(x) )
1.1018 +
1.1019 +
1.1020 +
1.1021 +
1.1022 +/**
1.1023 +@publishedAll
1.1024 +@deprecated Use _LIT8 instead.
1.1025 +
1.1026 +8-bit literal.
1.1027 +
1.1028 +The macro defines an explicit 8-bit constant literal which is suitable
1.1029 +for non-Unicode literal text, regardless of the build.
1.1030 +
1.1031 +@see _L
1.1032 +@see _LIT8
1.1033 +@see _LIT
1.1034 +*/
1.1035 +#define _L8(a) (TPtrC8((const TText8 *)(a)))
1.1036 +
1.1037 +
1.1038 +
1.1039 +
1.1040 +/**
1.1041 +@publishedAll
1.1042 +@released
1.1043 +
1.1044 +Defines an explicit 8-bit string which is suitable when non-Unicode text
1.1045 +is required, regardless of the build.
1.1046 +
1.1047 +This is used by the deprecated literal descriptor _L8.
1.1048 +*/
1.1049 +#define _S8(a) ((const TText8 *)a)
1.1050 +
1.1051 +
1.1052 +
1.1053 +
1.1054 +/**
1.1055 +@publishedAll
1.1056 +@released
1.1057 +
1.1058 +Constructs a constant literal descriptor of type TLitC8<TInt> with
1.1059 +the specified name and text.
1.1060 +
1.1061 +The 8-bit build variant is generated for both non-Unicode and Unicode builds.
1.1062 +
1.1063 +@param name The name of the C++ variable to be generated.
1.1064 +@param s The literal text enclosed within a pair of double quotes.
1.1065 +
1.1066 +@see _LIT
1.1067 +*/
1.1068 +#define _LIT8(name,s) const static TLitC8<sizeof(s)> name={sizeof(s)-1,s}
1.1069 +
1.1070 +
1.1071 +
1.1072 +
1.1073 +/**
1.1074 +@publishedAll
1.1075 +@deprecated Use _LIT16 instead.
1.1076 +
1.1077 +16-bit literal.
1.1078 +
1.1079 +The macro defines an explicit 16-bit constant literal which is suitable
1.1080 +for Unicode literal text, regardless of the build.
1.1081 +
1.1082 +@see _L
1.1083 +@see _LIT16
1.1084 +@see _LIT
1.1085 +*/
1.1086 +#define _L16(a) (TPtrC16((const TText16 *)L ## a))
1.1087 +
1.1088 +
1.1089 +
1.1090 +/**
1.1091 +@publishedAll
1.1092 +@released
1.1093 +
1.1094 +Defines an explicit 16-bit string which is suitable when Unicode text
1.1095 +is required, regardless of the build.
1.1096 +
1.1097 +This is used by the deprecated literal descriptor _L16.
1.1098 +*/
1.1099 +#define _S16(a) ((const TText16 *)L ## a)
1.1100 +
1.1101 +
1.1102 +
1.1103 +
1.1104 +/**
1.1105 +@publishedAll
1.1106 +@released
1.1107 +
1.1108 +Constructs a constant literal descriptor of type TLitC16<TInt> with
1.1109 +the specified name and text.
1.1110 +
1.1111 +The 16-bit build variant is generated for both non-Unicode and Unicode builds.
1.1112 +
1.1113 +@param name The name of the C++ variable to be generated.
1.1114 +@param s The literal text enclosed within a pair of double quotes.
1.1115 +
1.1116 +@see _LIT
1.1117 +*/
1.1118 +#define _LIT16(name,s) const static TLitC16<sizeof(L##s)/2> name={sizeof(L##s)/2-1,L##s}
1.1119 +
1.1120 +
1.1121 +
1.1122 +
1.1123 +#if defined(_UNICODE) && !defined(__KERNEL_MODE__)
1.1124 +/**
1.1125 +@publishedAll
1.1126 +@released
1.1127 +
1.1128 +Build independent general text character.
1.1129 +
1.1130 +In non-Unicode builds, this is mapped to TText8. In Unicode builds, this is
1.1131 +mapped to TText16. Use the classes with explicit width only when you wish
1.1132 +the width to be independent of the build variant.
1.1133 +
1.1134 +Use this class rather than TChar for general use.
1.1135 +*/
1.1136 +typedef TText16 TText;
1.1137 +
1.1138 +
1.1139 +
1.1140 +/**
1.1141 +@publishedAll
1.1142 +@deprecated Use _LIT instead.
1.1143 +
1.1144 +Build independent literal.
1.1145 +
1.1146 +The macro defines either an 8-bit constant literal (for non-Unicode text),
1.1147 +or a 16-bit constant literal (for Unicode text) depending on the build.
1.1148 +
1.1149 +@see _LIT
1.1150 +@see _L16
1.1151 +@see _L8
1.1152 +*/
1.1153 +#define _L(a) (TPtrC((const TText *)L ## a))
1.1154 +
1.1155 +
1.1156 +
1.1157 +
1.1158 +/**
1.1159 +@publishedAll
1.1160 +@released
1.1161 +
1.1162 +Defines either an 8-bit string (for non-Unicode text),
1.1163 +or a 16-bit string (for Unicode text) depending on the build.
1.1164 +
1.1165 +This is used by the deprecated build independent literal _L.
1.1166 +*/
1.1167 +#define _S(a) ((const TText *)L ## a)
1.1168 +
1.1169 +
1.1170 +
1.1171 +
1.1172 +/**
1.1173 +@publishedAll
1.1174 +@released
1.1175 +
1.1176 +Constructs a build independent constant literal descriptor of type TLitC<TInt>
1.1177 +with the specified name and text.
1.1178 +
1.1179 +An 8-bit build variant is generated for a non-Unicode build;
1.1180 +A 16-bit build variant is generated for a Unicode build.
1.1181 +
1.1182 +@param name The name of the C++ variable to be generated.
1.1183 +@param s The literal text enclosed within a pair of double quotes.
1.1184 +
1.1185 +@see _LIT16
1.1186 +@see _LIT8
1.1187 +*/
1.1188 +#define _LIT(name,s) const static TLitC<sizeof(L##s)/2> name={sizeof(L##s)/2-1,L##s}
1.1189 +
1.1190 +
1.1191 +
1.1192 +
1.1193 +#else
1.1194 +/**
1.1195 +@publishedAll
1.1196 +@released
1.1197 +
1.1198 +Build independent general text character.
1.1199 +
1.1200 +In non-Unicode builds, this is mapped to TText8. In Unicode builds, this is
1.1201 +mapped to TText16. Use the classes with explicit width only when you wish
1.1202 +the width to be independent of the build variant.
1.1203 +
1.1204 +Use this class rather than TChar for general use.
1.1205 +*/
1.1206 +typedef TText8 TText;
1.1207 +
1.1208 +
1.1209 +
1.1210 +/**
1.1211 +@publishedAll
1.1212 +@released
1.1213 +
1.1214 +@deprecated Use _LIT instead.
1.1215 +
1.1216 +Build independent literal.
1.1217 +
1.1218 +The macro defines either an 8-bit constant literal (for non-Unicode text),
1.1219 +or a 16-bit constant literal (for Unicode text) depending on the build.
1.1220 +
1.1221 +@see _LIT
1.1222 +@see _L16
1.1223 +@see _L8
1.1224 +*/
1.1225 +#define _L(a) (TPtrC((const TText *)(a)))
1.1226 +
1.1227 +
1.1228 +
1.1229 +
1.1230 +/**
1.1231 +@publishedAll
1.1232 +@released
1.1233 +
1.1234 +Defines either an 8-bit string (for non-Unicode text),
1.1235 +or a 16-bit string (for Unicode text) depending on the build.
1.1236 +
1.1237 +This is used by the deprecated build independent literal _L.
1.1238 +*/
1.1239 +#define _S(a) ((const TText *)a)
1.1240 +
1.1241 +
1.1242 +
1.1243 +
1.1244 +/**
1.1245 +@publishedAll
1.1246 +@released
1.1247 +
1.1248 +Constructs a build independent constant literal descriptor of type TLitC<TInt>
1.1249 +with the specified name and text.
1.1250 +
1.1251 +An 8-bit build variant is generated for a non-Unicode build;
1.1252 +A 16-bit build variant is generated for a Unicode build.
1.1253 +
1.1254 +@param name The name of the C++ variable to be generated.
1.1255 +@param s The literal text enclosed within a pair of double quotes.
1.1256 +
1.1257 +@see _LIT16
1.1258 +@see _LIT8
1.1259 +*/
1.1260 +#define _LIT(name,s) const static TLitC<sizeof(s)> name={sizeof(s)-1,s}
1.1261 +#endif
1.1262 +
1.1263 +
1.1264 +
1.1265 +
1.1266 +#ifndef __VA_LIST_defined
1.1267 +/**
1.1268 +@publishedAll
1.1269 +@released
1.1270 +
1.1271 +Defines a 'C' style array of pointers to TInt8 types.
1.1272 +
1.1273 +The type is most commonly used by code that needs to deal with a variable
1.1274 +number of arguments passed to a function.
1.1275 +
1.1276 +@see TInt8
1.1277 +*/
1.1278 +typedef TInt8 *VA_LIST[1];
1.1279 +#endif
1.1280 +
1.1281 +/**
1.1282 +@publishedAll
1.1283 +@released
1.1284 +
1.1285 +Asserts that a condition is true.
1.1286 +
1.1287 +Code is generated for all builds.
1.1288 +
1.1289 +This macro is used as a C++ statement to assert the truth of some condition,
1.1290 +and to take appropriate action if the condition is false. Unlike __ASSERT_DEBUG
1.1291 +it is defined in both release and debug builds.
1.1292 +
1.1293 +The most common use for this macro is to check that the external environment of
1.1294 +a function or class is behaving as expected; for example, that parameters
1.1295 +passed to a function are credible, or that called functions are behaving as
1.1296 +expected; the macro is commonly placed at the beginning of a function.
1.1297 +
1.1298 +The effect of the macro is to generate code which tests
1.1299 +the conditional expression c; if the expression is false, then
1.1300 +function p is called. In the majority of cases, the function p is one that
1.1301 +raises a panic.
1.1302 +
1.1303 +Note that the macro definition is, in effect, equivalent to:
1.1304 +
1.1305 +@code
1.1306 +if !(c)p;
1.1307 +@endcode
1.1308 +
1.1309 +@param c a conditional expression which results in true or false.
1.1310 +@param p a function which is called if the conditional expression c is false.
1.1311 +
1.1312 +@see __ASSERT_DEBUG
1.1313 +*/
1.1314 +#define __ASSERT_ALWAYS(c,p) (void)((c)||(p,0))
1.1315 +
1.1316 +
1.1317 +
1.1318 +#ifdef __WINS__
1.1319 +#ifdef __CW32__
1.1320 +/**
1.1321 +@internalAll
1.1322 +@released
1.1323 +*/
1.1324 +#define __BREAKPOINT() \
1.1325 + { \
1.1326 + __asm { byte 0xcc }; \
1.1327 + }
1.1328 +#else // !__CW32__
1.1329 +/**
1.1330 +@internalAll
1.1331 +@released
1.1332 +*/
1.1333 +#define __BREAKPOINT() \
1.1334 + { \
1.1335 + __asm { int 3 }; \
1.1336 + }
1.1337 +#endif //__CW32__
1.1338 +#else
1.1339 +/**
1.1340 +@internalAll
1.1341 +@released
1.1342 +*/
1.1343 +#define __BREAKPOINT()
1.1344 +#endif
1.1345 +
1.1346 +#if defined(_DEBUG)
1.1347 +
1.1348 +/**
1.1349 +@internalComponent
1.1350 +@deprecated
1.1351 +*/
1.1352 +#define __ASSERT_DEBUG_MB(aCond,aPanicNo) (void)((aCond)||(PanicMB(aPanicNo,_L(#aPanicNo),_L(#aCond)),0))
1.1353 +
1.1354 +
1.1355 +
1.1356 +
1.1357 +/**
1.1358 +@publishedAll
1.1359 +@released
1.1360 +
1.1361 +Asserts that a condition is true.
1.1362 +
1.1363 +Code is generated for debug builds only.
1.1364 +
1.1365 +This macro is used as a C++ statement to assert the truth of some condition,
1.1366 +and to take appropriate action if the condition is false. It is used in
1.1367 +the same way as __ASSERT_ALWAYS, except that it is only defined for debug builds.
1.1368 +
1.1369 +The macro may be used to insert extra checks at various points in source code
1.1370 +as desired; the code will only be generated in debug builds and not in release
1.1371 +builds.
1.1372 +
1.1373 +@param c A conditional expression which results in true or false.
1.1374 +@param p A function which is called if the conditional expression c is false.
1.1375 +
1.1376 +@see __ASSERT_ALWAYS
1.1377 +*/
1.1378 +#define __ASSERT_DEBUG(c,p) (void)((c)||(p,0))
1.1379 +
1.1380 +
1.1381 +
1.1382 +/**
1.1383 +@internalAll
1.1384 +@removed
1.1385 +*/
1.1386 +#define __DECLARE_NAME(t)
1.1387 +
1.1388 +
1.1389 +
1.1390 +
1.1391 +/**
1.1392 +@publishedAll
1.1393 +@released
1.1394 +
1.1395 +Calls the function for testing object invariance.
1.1396 +
1.1397 +Classes can define a standard member function __DbgTestInvariant(),
1.1398 +which checks that the object is in a valid state, and panics if it is not.
1.1399 +In debug builds, this macro simply expands to call that function. For details on how
1.1400 +to define __DbgTestInvariant(), and an example of its use, see __DECLARE_TEST.
1.1401 +
1.1402 +The macro is typically invoked at the beginning of all the member functions of
1.1403 +the class. For non-const functions (those which can change the object’s state),
1.1404 +you can ensure that the object has been left in a stable state by invoking
1.1405 +the macro at the end of the function.
1.1406 +
1.1407 +In release builds, no code is generated for the macro.
1.1408 +*/
1.1409 +#define __TEST_INVARIANT __DbgTestInvariant()
1.1410 +
1.1411 +
1.1412 +
1.1413 +
1.1414 +/**
1.1415 +@publishedAll
1.1416 +@released
1.1417 +
1.1418 +Marks the start of checking the current thread's heap.
1.1419 +
1.1420 +This macro is defined only for debug builds.
1.1421 +
1.1422 +This macro must be matched by a corresponding call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
1.1423 +
1.1424 +Calls to this macro can be nested but each call must be matched by corresponding
1.1425 +call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
1.1426 +
1.1427 +@see User::__DbgMarkStart()
1.1428 +@see __UHEAP_MARKEND
1.1429 +@see __UHEAP_MARKENDC
1.1430 +*/
1.1431 +#define __UHEAP_MARK User::__DbgMarkStart(FALSE)
1.1432 +
1.1433 +
1.1434 +
1.1435 +
1.1436 +/**
1.1437 +@publishedAll
1.1438 +@released
1.1439 +
1.1440 +Checks that the number of allocated cells at the current nested level on the
1.1441 +current thread's heap is the same as the specified value.
1.1442 +
1.1443 +This macro is defined only for debug builds.
1.1444 +
1.1445 +The macro also takes the name of the file containing this source code statement
1.1446 +and the line number of this source code statement; they are displayed as part
1.1447 +of the panic category, if the checks fail.
1.1448 +
1.1449 +The macro assumes that:
1.1450 +
1.1451 +1. the heap being checked is a user heap
1.1452 +
1.1453 +2. checking is being done for the number of allocated cells at the current nested
1.1454 + level; i.e. that aCountAll is set to false
1.1455 +
1.1456 +3. the line number is the line number of this source code statement.
1.1457 +
1.1458 +4. the file name is the full path name of the file containing this source statement
1.1459 +
1.1460 +@param aCount The number of heap cells expected to be allocated at
1.1461 + the current nest level.
1.1462 +
1.1463 +@see User::__DbgMarkCheck()
1.1464 +@see __KHEAP_CHECK
1.1465 +*/
1.1466 +#define __UHEAP_CHECK(aCount) User::__DbgMarkCheck(FALSE,FALSE,aCount,(TText8*)__FILE__,__LINE__)
1.1467 +
1.1468 +
1.1469 +
1.1470 +
1.1471 +/**
1.1472 +@publishedAll
1.1473 +@released
1.1474 +
1.1475 +Checks that the total number of allocated cells on the current thread's heap
1.1476 +is the same as the specified value.
1.1477 +
1.1478 +This macro is defined only for debug builds.
1.1479 +
1.1480 +The macro also takes the name of the file containing this source code statement
1.1481 +and the line number of this source code statement; they are displayed as part
1.1482 +of the panic category, if the checks fail.
1.1483 +
1.1484 +@param aCount The total number of heap cells expected to be allocated.
1.1485 +
1.1486 +@see User::__DbgMarkCheck()
1.1487 +@see __KHEAP_CHECKALL
1.1488 +*/
1.1489 +#define __UHEAP_CHECKALL(aCount) User::__DbgMarkCheck(FALSE,TRUE,aCount,(TText8*)__FILE__,__LINE__)
1.1490 +
1.1491 +
1.1492 +
1.1493 +
1.1494 +/**
1.1495 +@publishedAll
1.1496 +@released
1.1497 +
1.1498 +Marks the end of checking the current thread's heap.
1.1499 +
1.1500 +The macro expects zero heap cells to remain allocated at the current nest
1.1501 +level. This macro is defined only for debug builds.
1.1502 +
1.1503 +This macro must match an earlier call to __UHEAP_MARK.
1.1504 +
1.1505 +@see User::__DbgMarkEnd()
1.1506 +@see __UHEAP_MARK
1.1507 +*/
1.1508 +#define __UHEAP_MARKEND User::__DbgMarkEnd(FALSE,0)
1.1509 +
1.1510 +
1.1511 +
1.1512 +
1.1513 +/**
1.1514 +@publishedAll
1.1515 +@released
1.1516 +
1.1517 +Marks the end of checking the current thread's heap.
1.1518 +
1.1519 +The macro expects aCount heap cells to remain allocated at the current nest
1.1520 +level.
1.1521 +
1.1522 +This macro must match an earlier call to __UHEAP_MARK.
1.1523 +
1.1524 +@param aCount The number of heap cells expected to remain allocated at
1.1525 + the current nest level.
1.1526 +
1.1527 +@see User::__DbgMarkEnd()
1.1528 +@see __UHEAP_MARK
1.1529 +*/
1.1530 +#define __UHEAP_MARKENDC(aCount) User::__DbgMarkEnd(FALSE,aCount)
1.1531 +
1.1532 +
1.1533 +
1.1534 +
1.1535 +/**
1.1536 +@publishedAll
1.1537 +@released
1.1538 +
1.1539 +Simulates heap allocation failure for the current thread's heap.
1.1540 +
1.1541 +The failure occurs on the next call to new or any of the functions which
1.1542 +allocate memory from the heap. This macro is defined only for debug builds.
1.1543 +
1.1544 +@param aCount Determines when the allocation will fail.
1.1545 + Heap allocation fails on attempt number aCount - later
1.1546 + allocations will succeed.
1.1547 + For example, if aCount is 3, then heap allocation fails
1.1548 + on the 3rd attempt, but all subsequent allocations succeed.
1.1549 +
1.1550 +@see User::__DbgSetAllocFail()
1.1551 +*/
1.1552 +#define __UHEAP_FAILNEXT(aCount) User::__DbgSetAllocFail(FALSE,RAllocator::EFailNext,aCount)
1.1553 +
1.1554 +/**
1.1555 +@publishedAll
1.1556 +@released
1.1557 +
1.1558 +Simulates heap allocation failure for the current thread's heap.
1.1559 +
1.1560 +The failures will occur for aBurst times from the next call to new or any of the functions which
1.1561 +allocate memory from the heap. This macro is defined only for debug builds.
1.1562 +
1.1563 +@param aCount Determines when the allocation will fail.
1.1564 + Heap allocation fails on attempt number aCount - later
1.1565 + allocations will succeed.
1.1566 + For example, if aCount is 3, then heap allocation fails
1.1567 + on the 3rd attempt, but all subsequent allocations succeed.
1.1568 + Note when used with RHeap the maximum value aCount can be set
1.1569 + to is KMaxTUint16.
1.1570 +@param aBurst The number of consecutive allocations that will fail. Note
1.1571 + when used with RHeap the maximum value aBurst can be set to
1.1572 + is KMaxTUint16.
1.1573 +
1.1574 +@see User::__DbgSetBurstAllocFail()
1.1575 +*/
1.1576 +#define __UHEAP_BURSTFAILNEXT(aCount,aBurst) User::__DbgSetBurstAllocFail(FALSE,RAllocator::EBurstFailNext,aCount,aBurst)
1.1577 +
1.1578 +
1.1579 +
1.1580 +/**
1.1581 +@publishedAll
1.1582 +@released
1.1583 +
1.1584 +Simulates heap allocation failure for the current thread's heap.
1.1585 +
1.1586 +The failure occurs on subsequent calls to new or any of the functions which
1.1587 +allocate memory from the heap. This macro is defined only for debug builds.
1.1588 +
1.1589 +@param aType The type of failure to be simulated.
1.1590 +@param aRate The failure rate.
1.1591 +
1.1592 +@see User::__DbgSetAllocFail()
1.1593 +@see RAllocator::TAllocFail
1.1594 +*/
1.1595 +#define __UHEAP_SETFAIL(aType,aRate) User::__DbgSetAllocFail(FALSE, aType, aRate)
1.1596 +
1.1597 +/**
1.1598 +@publishedAll
1.1599 +@released
1.1600 +
1.1601 +Simulates heap allocation failure for the current thread's heap.
1.1602 +
1.1603 +The failure occurs on subsequent calls to new or any of the functions which
1.1604 +allocate memory from the heap. This macro is defined only for debug builds.
1.1605 +
1.1606 +@param aType The type of failure to be simulated.
1.1607 +@param aRate The failure rate. Note when used with RHeap the maximum value
1.1608 + aRate can be set to is KMaxTUint16.
1.1609 +@param aBurst The number of consecutive allocations that will fail. Note
1.1610 + when used with RHeap the maximum value aBurst can be set
1.1611 + to is KMaxTUint16.
1.1612 +
1.1613 +@see User::__DbgSetBurstAllocFail()
1.1614 +@see RAllocator::TAllocFail
1.1615 +*/
1.1616 +#define __UHEAP_SETBURSTFAIL(aType,aRate,aBurst) User::__DbgSetBurstAllocFail(FALSE, aType, aRate, aBurst)
1.1617 +
1.1618 +
1.1619 +
1.1620 +/**
1.1621 +@publishedAll
1.1622 +@released
1.1623 +
1.1624 +Cancels simulated heap allocation failure for the current thread's heap.
1.1625 +
1.1626 +This macro is defined only for debug builds.
1.1627 +
1.1628 +@see User::__DbgSetAllocFail()
1.1629 +*/
1.1630 +#define __UHEAP_RESET User::__DbgSetAllocFail(FALSE,RAllocator::ENone,1)
1.1631 +
1.1632 +
1.1633 +/**
1.1634 +@publishedAll
1.1635 +@released
1.1636 +
1.1637 +Cancels simulated heap allocation failure for the current thread's heap.
1.1638 +It walks the the heap and sets the nesting level for all allocated
1.1639 +cells to zero.
1.1640 +
1.1641 +This macro is defined only for debug builds.
1.1642 +*/
1.1643 +#define __UHEAP_TOTAL_RESET User::__DbgSetAllocFail(FALSE,RAllocator::EReset,1)
1.1644 +
1.1645 +/**
1.1646 +@publishedAll
1.1647 +@released
1.1648 +
1.1649 +Returns the number of heap allocation failures the current debug allocator fail
1.1650 +function has caused so far.
1.1651 +
1.1652 +This is intended to only be used with fail types RAllocator::EFailNext,
1.1653 +RAllocator::EBurstFailNext, RAllocator::EDeterministic and
1.1654 +RAllocator::EBurstDeterministic. The return value is unreliable for
1.1655 +all other fail types.
1.1656 +
1.1657 +@return The number of heap allocation failures the current debug fail
1.1658 +function has caused.
1.1659 +
1.1660 +@see RAllocator::TAllocFail
1.1661 +*/
1.1662 +#define __UHEAP_CHECKFAILURE User::__DbgCheckFailure(FALSE)
1.1663 +
1.1664 +
1.1665 +
1.1666 +
1.1667 +/**
1.1668 +@publishedPartner
1.1669 +@released
1.1670 +
1.1671 +Marks the start of Kernel heap checking.
1.1672 +
1.1673 +Checking the Kernel heap is only useful when developing Kernel side code such
1.1674 +as device drivers and media drivers.
1.1675 +
1.1676 +This macro is defined only for debug builds.
1.1677 +
1.1678 +This macro must be matched by a corresponding call to __KHEAP_MARKEND or __KHEAP_MARKENDC.
1.1679 +Calls to this macro can be nested but each call must be matched by corresponding
1.1680 +call to __KHEAP_MARKEND or __KHEAP_MARKENDC.
1.1681 +
1.1682 +@see User::__DbgMarkStart()
1.1683 +@see __KHEAP_MARKEND
1.1684 +@see __KHEAP_MARKENDC
1.1685 +*/
1.1686 +#define __KHEAP_MARK User::__DbgMarkStart(TRUE)
1.1687 +
1.1688 +
1.1689 +
1.1690 +
1.1691 +/**
1.1692 +@publishedPartner
1.1693 +@released
1.1694 +
1.1695 +Checks that the number of allocated cells at the current nested level of the
1.1696 +Kernel heap is the same as the specified value. This macro is defined only
1.1697 +for debug builds. Checking the Kernel heap is only useful when developing
1.1698 +Kernel side code such as device drivers and media drivers.
1.1699 +
1.1700 +The macro also takes the name of the file containing this source code statement
1.1701 +and the line number of this source code statement; they are displayed as part
1.1702 +of the panic category, if the checks fail.
1.1703 +
1.1704 +@param aCount The number of heap cells expected to be allocated at
1.1705 + the current nest level.
1.1706 +
1.1707 +@see User::__DbgMarkCheck()
1.1708 +@see __UHEAP_CHECK
1.1709 +*/
1.1710 +#define __KHEAP_CHECK(aCount) User::__DbgMarkCheck(TRUE,FALSE,aCount,(TText8*)__FILE__,__LINE__)
1.1711 +
1.1712 +
1.1713 +
1.1714 +
1.1715 +/**
1.1716 +@publishedPartner
1.1717 +@released
1.1718 +
1.1719 +Checks that the total number of allocated cells on the Kernel heap is the same
1.1720 +as the specified value.
1.1721 +
1.1722 +It is only useful when developing Kernel side code such as device drivers
1.1723 +and media drivers.
1.1724 +
1.1725 +The macro also takes the name of the file containing this source code statement
1.1726 +and the line number of this source code statement; they are displayed as part
1.1727 +of the panic category, if the checks fail.
1.1728 +
1.1729 +This macro is defined only for debug builds.
1.1730 +
1.1731 +@param aCount The total number of heap cells expected to be allocated
1.1732 +
1.1733 +@see User::__DbgMarkCheck()
1.1734 +@see __UHEAP_CHECKALL
1.1735 +*/
1.1736 +#define __KHEAP_CHECKALL(aCount) User::__DbgMarkCheck(TRUE,TRUE,aCount,(TText8*)__FILE__,__LINE__)
1.1737 +
1.1738 +
1.1739 +
1.1740 +
1.1741 +/**
1.1742 +@publishedPartner
1.1743 +@released
1.1744 +
1.1745 +Marks the end of Kernel heap checking. The macro expects zero heap cells to
1.1746 +remain allocated at the current nest level.
1.1747 +
1.1748 +This macro is defined only for debug builds. Checking the Kernel heap is only
1.1749 +useful when developing Kernel side code such as device drivers and media drivers.
1.1750 +
1.1751 +This macro must match an earlier call to __KHEAP_MARK.
1.1752 +
1.1753 +@see User::__DbgMarkEnd()
1.1754 +@see __KHEAP_MARK
1.1755 +*/
1.1756 +#define __KHEAP_MARKEND User::__DbgMarkEnd(TRUE,0)
1.1757 +
1.1758 +
1.1759 +
1.1760 +
1.1761 +/**
1.1762 +@publishedPartner
1.1763 +@released
1.1764 +
1.1765 +Marks the end of Kernel heap checking. The macro expects aCount heap cells
1.1766 +to remain allocated at the current nest level.
1.1767 +
1.1768 +This macro is defined only for debug builds.
1.1769 +
1.1770 +This macro must match an earlier call to __KHEAP_MARK.
1.1771 +
1.1772 +@param aCount The number of heap cells expected to remain allocated at
1.1773 + the current nest level.
1.1774 +
1.1775 +@see User::__DbgMarkEnd()
1.1776 +@see __KHEAP_MARK
1.1777 +*/
1.1778 +#define __KHEAP_MARKENDC(aCount) User::__DbgMarkEnd(TRUE,aCount)
1.1779 +
1.1780 +
1.1781 +
1.1782 +
1.1783 +/**
1.1784 +@publishedPartner
1.1785 +@released
1.1786 +
1.1787 +Simulates Kernel heap allocation failure. The failure occurs on the next call
1.1788 +to new or any of the functions which allocate memory from the heap. This macro
1.1789 +is defined only for debug builds.
1.1790 +
1.1791 +Checking the Kernel heap is only useful when developing Kernel side code such
1.1792 +as device drivers and media drivers.
1.1793 +
1.1794 +@param aCount The rate of failure - heap allocation fails every aCount attempt.
1.1795 +
1.1796 +@see User::__DbgSetAllocFail()
1.1797 +*/
1.1798 +#define __KHEAP_FAILNEXT(aCount) User::__DbgSetAllocFail(TRUE,RAllocator::EFailNext,aCount)
1.1799 +
1.1800 +/**
1.1801 +@publishedPartner
1.1802 +@released
1.1803 +
1.1804 +Simulates Kernel heap allocation failures. aBurst failures will occur on the next call
1.1805 +to new or any of the functions which allocate memory from the heap. This macro
1.1806 +is defined only for debug builds.
1.1807 +
1.1808 +Checking the Kernel heap is only useful when developing Kernel side code such
1.1809 +as device drivers and media drivers.
1.1810 +
1.1811 +@param aCount The heap allocation will fail after aCount-1 allocation attempts.
1.1812 + Note when used with RHeap the maximum value aCount can be set
1.1813 + to is KMaxTUint16.
1.1814 +@param aBurst The number of allocations that will fail after aCount-1 allocation
1.1815 + attempts. Note when used with RHeap the maximum value aBurst can be
1.1816 + set to is KMaxTUint16.
1.1817 +
1.1818 +
1.1819 +@see User::__DbgSetBurstAllocFail()
1.1820 +*/
1.1821 +#define __KHEAP_BURSTFAILNEXT(aCount,aBurst) User::__DbgSetBurstAllocFail(TRUE,RAllocator::EBurstFailNext,aCount,aBurst)
1.1822 +
1.1823 +
1.1824 +/**
1.1825 +@publishedPartner
1.1826 +@released
1.1827 +
1.1828 +Simulates Kernel heap allocation failure.
1.1829 +
1.1830 +The failure occurs on subsequent calls to new or any of the functions which
1.1831 +allocate memory from this heap.
1.1832 +
1.1833 +This macro is defined only for debug builds.
1.1834 +
1.1835 +@param aType The type of failure to be simulated.
1.1836 +@param aRate The failure rate.
1.1837 +
1.1838 +@see RAllocator::TAllocFail
1.1839 +@see User::__DbgSetAllocFail()
1.1840 +*/
1.1841 +#define __KHEAP_SETFAIL(aType,aRate) User::__DbgSetAllocFail(TRUE,aType,aRate)
1.1842 +
1.1843 +/**
1.1844 +@publishedPartner
1.1845 +@released
1.1846 +
1.1847 +Simulates Kernel heap allocation failure.
1.1848 +
1.1849 +The failure occurs on subsequent calls to new or any of the functions which
1.1850 +allocate memory from this heap.
1.1851 +
1.1852 +This macro is defined only for debug builds.
1.1853 +
1.1854 +@param aType The type of failure to be simulated.
1.1855 +@param aRate The failure rate. Note when used with RHeap the maximum value
1.1856 + aRate can be set to is KMaxTUint16.
1.1857 +@param aBurst The number of consecutive allocations that will fail. Note
1.1858 + when used with RHeap the maximum value aBurst can be set to
1.1859 + is KMaxTUint16.
1.1860 +
1.1861 +@see RAllocator::TAllocFail
1.1862 +@see User::__DbgSetBurstAllocFail()
1.1863 +*/
1.1864 +#define __KHEAP_SETBURSTFAIL(aType,aRate,aBurst) User::__DbgSetBurstAllocFail(TRUE,aType,aRate,aBurst)
1.1865 +
1.1866 +
1.1867 +
1.1868 +/**
1.1869 +@publishedPartner
1.1870 +@released
1.1871 +
1.1872 +Cancels simulated Kernel heap allocation failure.
1.1873 +
1.1874 +Checking the Kernel heap is only useful when developing Kernel side code such
1.1875 +as device drivers and media drivers.
1.1876 +
1.1877 +This macro is defined only for debug builds.
1.1878 +
1.1879 +@see User::__DbgSetAllocFail()
1.1880 +*/
1.1881 +#define __KHEAP_RESET User::__DbgSetAllocFail(TRUE,RAllocator::ENone,1)
1.1882 +
1.1883 +
1.1884 +
1.1885 +
1.1886 +/**
1.1887 +@publishedPartner
1.1888 +@released
1.1889 +
1.1890 +Cancels simulated kernel heap allocation failure.
1.1891 +It walks the the heap and sets the nesting level for all allocated
1.1892 +cells to zero.
1.1893 +
1.1894 +Checking the kernel heap is only useful when developing kernel side code such
1.1895 +as device drivers and media drivers.
1.1896 +
1.1897 +This macro is defined only for debug builds.
1.1898 +*/
1.1899 +#define __KHEAP_TOTAL_RESET User::__DbgSetAllocFail(TRUE,RAllocator::EReset,1)
1.1900 +
1.1901 +/**
1.1902 +@publishedAll
1.1903 +@released
1.1904 +
1.1905 +Returns the number of kernel heap allocation failures the current debug
1.1906 +allocator fail function has caused so far.
1.1907 +
1.1908 +This is intended to only be used with fail types RAllocator::EFailNext,
1.1909 +RAllocator::EBurstFailNext, RAllocator::EDeterministic and
1.1910 +RAllocator::EBurstDeterministic. The return value is unreliable for
1.1911 +all other fail types.
1.1912 +
1.1913 +@return The number of heap allocation failures the current debug fail
1.1914 +function has caused.
1.1915 +
1.1916 +@see RAllocator::TAllocFail
1.1917 +*/
1.1918 +#define __KHEAP_CHECKFAILURE User::__DbgCheckFailure(TRUE)
1.1919 +
1.1920 +
1.1921 +
1.1922 +/**
1.1923 +@publishedAll
1.1924 +@released
1.1925 +
1.1926 +Marks the start of heap checking for the specific heap.
1.1927 +
1.1928 +This macro is defined only for debug builds.
1.1929 +
1.1930 +This macro must be matched by a corresponding call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
1.1931 +
1.1932 +Calls to this macro can be nested but each call must be matched by corresponding
1.1933 +call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
1.1934 +
1.1935 +@param aHeap A pointer to the specific RHeap
1.1936 +
1.1937 +@see RHeap
1.1938 +@see RAllocator::__DbgMarkStart()
1.1939 +@see __RHEAP_MARKEND
1.1940 +@see __RHEAP_MARKENDC
1.1941 +*/
1.1942 +#define __RHEAP_MARK(aHeap) (aHeap)->__DbgMarkStart()
1.1943 +
1.1944 +
1.1945 +
1.1946 +
1.1947 +/**
1.1948 +@publishedAll
1.1949 +@released
1.1950 +
1.1951 +Checks that the number of allocated cells at the current nested level on the
1.1952 +specified heap is the same as the specified value.
1.1953 +
1.1954 +The macro also takes the name of the file containing this source code statement
1.1955 +and the line number of this source code statement; they are displayed as part
1.1956 +of the panic category, if the checks fail.
1.1957 +
1.1958 +This macro is defined only for debug builds.
1.1959 +
1.1960 +@param aHeap A pointer to the specific RHeap.
1.1961 +@param aCount The number of heap cells expected to be allocated at
1.1962 + the current nest level.
1.1963 +
1.1964 +@see RAllocator::__DbgMarkCheck()
1.1965 +*/
1.1966 +#define __RHEAP_CHECK(aHeap,aCount) (aHeap)->__DbgMarkCheck(FALSE,aCount,(TText8*)__FILE__,__LINE__)
1.1967 +
1.1968 +
1.1969 +
1.1970 +
1.1971 +/**
1.1972 +@publishedAll
1.1973 +@released
1.1974 +
1.1975 +Checks that the total number of allocated cells on the specified heap is the
1.1976 +same as the specified value.
1.1977 +
1.1978 +The macro also takes the name of the file containing this source code statement
1.1979 +and the line number of this source code statement; they are displayed as part
1.1980 +of the panic category, if the checks fail.
1.1981 +
1.1982 +This macro is defined only for debug builds.
1.1983 +
1.1984 +@param aHeap A pointer to the specific RHeap.
1.1985 +@param aCount The total number of heap cells expected to be allocated.
1.1986 +
1.1987 +@see RAllocator::__DbgMarkCheck()
1.1988 +*/
1.1989 +#define __RHEAP_CHECKALL(aHeap,aCount) (aHeap)->__DbgMarkCheck(TRUE,aCount,(TText8*)__FILE__,__LINE__)
1.1990 +
1.1991 +
1.1992 +
1.1993 +
1.1994 +/**
1.1995 +@publishedAll
1.1996 +@released
1.1997 +
1.1998 +Marks the end of heap checking for the specific heap.
1.1999 +
1.2000 +The macro expects zero heap cells to remain allocated at the current nest
1.2001 +level. This macro is defined only for debug builds.
1.2002 +
1.2003 +This macro must match an earlier call to __RHEAP_MARK.
1.2004 +
1.2005 +@param aHeap A pointer to the specific RHeap.
1.2006 +
1.2007 +@see RAllocator::__DbgMarkEnd()
1.2008 +@see __RHEAP_MARK
1.2009 +*/
1.2010 +#define __RHEAP_MARKEND(aHeap) (aHeap)->__DbgMarkEnd(0)
1.2011 +
1.2012 +
1.2013 +
1.2014 +
1.2015 +/**
1.2016 +@publishedAll
1.2017 +@released
1.2018 +
1.2019 +Marks the end of heap checking for the specific heap.
1.2020 +
1.2021 +The macro expects aCount heap cells to remain allocated at the current nest
1.2022 +level. This macro is defined only for debug builds.
1.2023 +
1.2024 +This macro must match an earlier call to __RHEAP_MARK.
1.2025 +
1.2026 +@param aHeap A pointer to the specific RHeap.
1.2027 +@param aCount The number of heap cells expected to remain allocated at
1.2028 + the current nest level
1.2029 +
1.2030 +@see RAllocator::__DbgMarkEnd()
1.2031 +@see __RHEAP_MARK
1.2032 +*/
1.2033 +#define __RHEAP_MARKENDC(aHeap,aCount) (aHeap)->__DbgMarkEnd(aCount)
1.2034 +
1.2035 +
1.2036 +
1.2037 +
1.2038 +/**
1.2039 +@publishedAll
1.2040 +@released
1.2041 +
1.2042 +Simulates an allocation failure for the specific heap.
1.2043 +
1.2044 +The failure occurs on the next call to new or any of the functions which allocate
1.2045 +memory from the heap. This macro is defined only for debug builds.
1.2046 +
1.2047 +@param aHeap A pointer to the specific RHeap.
1.2048 +@param aCount The rate of failure - heap allocation fails every aCount attempt.
1.2049 +
1.2050 +@see RAllocator::__DbgSetAllocFail()
1.2051 +*/
1.2052 +#define __RHEAP_FAILNEXT(aHeap,aCount) (aHeap)->__DbgSetAllocFail(RAllocator::EFailNext,aCount)
1.2053 +
1.2054 +/**
1.2055 +@publishedAll
1.2056 +@released
1.2057 +
1.2058 +Simulates aBurst allocation failures for the specific heap.
1.2059 +
1.2060 +The failure occurs on the next call to new or any of the functions which allocate
1.2061 +memory from the heap. This macro is defined only for debug builds.
1.2062 +
1.2063 +@param aHeap A pointer to the specific RHeap.
1.2064 +@param aCount The heap allocation will fail after aCount-1 allocation attempts.
1.2065 + Note when used with RHeap the maximum value aCount can be set
1.2066 + to is KMaxTUint16.
1.2067 +@param aBurst The number of consecutive allocations that will fail. Note
1.2068 + when used with RHeap the maximum value aBurst can be set
1.2069 + to is KMaxTUint16.
1.2070 +
1.2071 +@see RAllocator::__DbgSetBurstAllocFail()
1.2072 +*/
1.2073 +#define __RHEAP_BURSTFAILNEXT(aHeap,aCount,aBurst) (aHeap)->__DbgSetBurstAllocFail(RAllocator::EBurstFailNext,aCount, aBurst)
1.2074 +
1.2075 +
1.2076 +
1.2077 +/**
1.2078 +@publishedAll
1.2079 +@released
1.2080 +
1.2081 +Simulates an allocation failure for the specific heap.
1.2082 +
1.2083 +The failure occurs on subsequent calls to new or any of the functions which
1.2084 +allocate memory from the heap. This macro is defined only for debug builds.
1.2085 +
1.2086 +@param aHeap A pointer to the specific RHeap.
1.2087 +@param aType The type of failure to be simulated.
1.2088 +@param aRate The failure rate.
1.2089 +
1.2090 +@see RAllocator::__DbgSetAllocFail()
1.2091 +*/
1.2092 +#define __RHEAP_SETFAIL(aHeap,aType,aRate) (aHeap)->__DbgSetAllocFail(aType,aRate)
1.2093 +
1.2094 +/**
1.2095 +@publishedAll
1.2096 +@released
1.2097 +
1.2098 +Simulates an allocation failure for the specific heap.
1.2099 +
1.2100 +The failure occurs on subsequent calls to new or any of the functions which
1.2101 +allocate memory from the heap. This macro is defined only for debug builds.
1.2102 +
1.2103 +@param aHeap A pointer to the specific RHeap.
1.2104 +@param aType The type of failure to be simulated.
1.2105 +@param aRate The failure rate. Note when used with RHeap the maximum value
1.2106 + aRate can be set to is KMaxTUint16.
1.2107 +@param aBurst The number of consecutive allocations that will fail. Note
1.2108 + when used with RHeap the maximum value aBurst can be set
1.2109 + to is KMaxTUint16.
1.2110 +
1.2111 +@see RAllocator::__DbgSetBurstAllocFail()
1.2112 +*/
1.2113 +#define __RHEAP_SETBURSTFAIL(aHeap,aType,aRate,aBurst) (aHeap)->__DbgSetBurstAllocFail(aType,aRate,aBurst)
1.2114 +
1.2115 +
1.2116 +
1.2117 +/**
1.2118 +@publishedAll
1.2119 +@released
1.2120 +
1.2121 +Cancels simulated allocation failure for the specific heap.
1.2122 +
1.2123 +This macro is defined only for debug builds.
1.2124 +
1.2125 +@param aHeap A pointer to the specific RHeap.
1.2126 +
1.2127 +@see RAllocator::__DbgSetAllocFail()
1.2128 +*/
1.2129 +#define __RHEAP_RESET(aHeap) (aHeap)->__DbgSetAllocFail(RAllocator::ENone,1)
1.2130 +
1.2131 +
1.2132 +
1.2133 +/**
1.2134 +@publishedAll
1.2135 +@released
1.2136 +
1.2137 +Cancels simulated allocation failure for the specific heap.
1.2138 +It walks the the heap and sets the nesting level for all allocated
1.2139 +cells to zero.
1.2140 +
1.2141 +This macro is defined only for debug builds.
1.2142 +
1.2143 +@param aHeap A pointer to the specific RHeap.
1.2144 +
1.2145 +@see RAllocator::__DbgSetAllocFail()
1.2146 +*/
1.2147 +#define __RHEAP_TOTAL_RESET(aHeap) (aHeap)->__DbgSetAllocFail(RAllocator::EReset,1)
1.2148 +
1.2149 +/**
1.2150 +@publishedAll
1.2151 +@released
1.2152 +
1.2153 +Returns the number of heap allocation failures the current debug allocator fail
1.2154 +function has caused so far.
1.2155 +
1.2156 +This is intended to only be used with fail types RAllocator::EFailNext,
1.2157 +RAllocator::EBurstFailNext, RAllocator::EDeterministic and
1.2158 +RAllocator::EBurstDeterministic. The return value is unreliable for
1.2159 +all other fail types.
1.2160 +
1.2161 +@return The number of heap allocation failures the current debug fail
1.2162 +function has caused.
1.2163 +
1.2164 +@see RAllocator::TAllocFail
1.2165 +*/
1.2166 +#define __RHEAP_CHECKFAILURE(aHeap) (aHeap)->__DbgCheckFailure()
1.2167 +
1.2168 +
1.2169 +#if defined (__WINS__)
1.2170 +
1.2171 +/**
1.2172 +@publishedAll
1.2173 +@released
1.2174 +*/
1.2175 +#define __DEBUGGER() {if (User::JustInTime()) __BREAKPOINT()}
1.2176 +
1.2177 +#else
1.2178 +#define __DEBUGGER()
1.2179 +#endif
1.2180 +
1.2181 +
1.2182 +#if defined(__DLL__)
1.2183 +/**
1.2184 +@publishedAll
1.2185 +@released
1.2186 +
1.2187 +Declares a function for testing object invariance.
1.2188 +
1.2189 +For complex classes, it is often useful to provide a function that can
1.2190 +be called to check that the object is in a valid state.
1.2191 +The __DECLARE_TEST macro supplies a standard prototype for such a function
1.2192 +named __DbgTestInvariant(). A companion macro __TEST_INVARIANT is provided
1.2193 +to call the function.
1.2194 +
1.2195 +For DLLs, as opposed to EXEs, __DbgTestInvariant() is exported,
1.2196 +i.e. the macro expands to:
1.2197 +
1.2198 +@code
1.2199 +public: IMPORT_C void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
1.2200 +@endcode
1.2201 +
1.2202 +This macro should placed as the last item in a class declaration (as it
1.2203 +switches back to public access). Note that a terminating semi-colon must be used.
1.2204 +
1.2205 +You should define the __DbgTestInvariant() function to check that the object
1.2206 +is in a healthy state. If it finds an error, it should call User::Invariant(),
1.2207 +which will cause a panic.
1.2208 +
1.2209 +If a class is derived from a base class, then the base class __DbgTestInvariant()
1.2210 +should be called first, and then any further checking done.
1.2211 +
1.2212 +The second function declared, __DbgTest(), is intended to allow test code a way
1.2213 +of directly accessing non-public members of a class. The function is
1.2214 +implemented by any test code that requires it, rather than in the class’s own
1.2215 +source code. The function is therefore not exported.
1.2216 +
1.2217 +__DECLARE_TEST is defined for both debug and release builds. This point is
1.2218 +particularly important for DLLs, as otherwise the exported interfaces would
1.2219 +differ between the build versions, giving potential binary compatibility
1.2220 +problems. To avoid using memory unnecessarily in release builds, you can,
1.2221 +however, use preprocessor directives to define the code within
1.2222 +__DbgTestInvariant() only for debug builds. __DbgTestInvariant() is never
1.2223 +called in release builds.
1.2224 +
1.2225 +@see __TEST_INVARIANT
1.2226 +*/
1.2227 +#define __DECLARE_TEST public: IMPORT_C void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
1.2228 +#else
1.2229 +#define __DECLARE_TEST public: void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
1.2230 +#endif
1.2231 +
1.2232 +#else
1.2233 +#define __ASSERT_DEBUG(c,p)
1.2234 +#define __DECLARE_NAME(t)
1.2235 +#define __TEST_INVARIANT
1.2236 +#if defined(__DLL__)
1.2237 +#define __DECLARE_TEST public: IMPORT_C void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
1.2238 +#else
1.2239 +#define __DECLARE_TEST public: void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
1.2240 +#endif
1.2241 +
1.2242 +
1.2243 +
1.2244 +
1.2245 +/**
1.2246 +@publishedAll
1.2247 +@released
1.2248 +
1.2249 +Marks the start of checking the current thread's heap.
1.2250 +
1.2251 +This macro is defined only for debug builds.
1.2252 +
1.2253 +This macro must be matched by a corresponding call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
1.2254 +
1.2255 +Calls to this macro can be nested but each call must be matched by corresponding
1.2256 +call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
1.2257 +
1.2258 +@see User::__DbgMarkStart()
1.2259 +@see __UHEAP_MARKEND
1.2260 +@see __UHEAP_MARKENDC
1.2261 +*/
1.2262 +#define __UHEAP_MARK
1.2263 +
1.2264 +
1.2265 +
1.2266 +
1.2267 +/**
1.2268 +@publishedAll
1.2269 +@released
1.2270 +
1.2271 +Checks that the number of allocated cells at the current nested level on the
1.2272 +current thread's heap is the same as the specified value.
1.2273 +
1.2274 +This macro is defined only for debug builds.
1.2275 +
1.2276 +The macro also takes the name of the file containing this source code statement
1.2277 +and the line number of this source code statement; they are displayed as part
1.2278 +of the panic category, if the checks fail.
1.2279 +
1.2280 +The macro assumes that:
1.2281 +
1.2282 +1. the heap being checked is a user heap
1.2283 +
1.2284 +2. checking is being done for the number of allocated cells at the current nested
1.2285 + level; i.e. that aCountAll is set to false
1.2286 +
1.2287 +3. the line number is the line number of this source code statement.
1.2288 +
1.2289 +4. the file name is the full path name of the file containing this source statement
1.2290 +
1.2291 +@param aCount The number of heap cells expected to be allocated at
1.2292 + the current nest level.
1.2293 +
1.2294 +@see User::__DbgMarkCheck()
1.2295 +@see __KHEAP_CHECK
1.2296 +*/
1.2297 +#define __UHEAP_CHECK(aCount)
1.2298 +
1.2299 +
1.2300 +
1.2301 +
1.2302 +/**
1.2303 +@publishedAll
1.2304 +@released
1.2305 +
1.2306 +Checks that the total number of allocated cells on the current thread's heap
1.2307 +is the same as the specified value.
1.2308 +
1.2309 +This macro is defined only for debug builds.
1.2310 +
1.2311 +The macro also takes the name of the file containing this source code statement
1.2312 +and the line number of this source code statement; they are displayed as part
1.2313 +of the panic category, if the checks fail.
1.2314 +
1.2315 +@param aCount The total number of heap cells expected to be allocated.
1.2316 +
1.2317 +@see User::__DbgMarkCheck()
1.2318 +@see __KHEAP_CHECKALL
1.2319 +*/
1.2320 +#define __UHEAP_CHECKALL(aCount)
1.2321 +
1.2322 +
1.2323 +
1.2324 +
1.2325 +/**
1.2326 +@publishedAll
1.2327 +@released
1.2328 +
1.2329 +Marks the end of checking the current thread's heap.
1.2330 +
1.2331 +The macro expects zero heap cells to remain allocated at the current nest
1.2332 +level. This macro is defined only for debug builds.
1.2333 +
1.2334 +This macro must match an earlier call to __UHEAP_MARK.
1.2335 +
1.2336 +@see User::__DbgMarkEnd()
1.2337 +@see __UHEAP_MARK
1.2338 +*/
1.2339 +#define __UHEAP_MARKEND
1.2340 +
1.2341 +
1.2342 +
1.2343 +
1.2344 +/**
1.2345 +@publishedAll
1.2346 +@released
1.2347 +
1.2348 +Marks the end of checking the current thread's heap.
1.2349 +
1.2350 +The macro expects aCount heap cells to remain allocated at the current nest
1.2351 +level.
1.2352 +
1.2353 +This macro must match an earlier call to __UHEAP_MARK.
1.2354 +
1.2355 +@param aCount The number of heap cells expected to remain allocated at
1.2356 + the current nest level.
1.2357 +
1.2358 +@see User::__DbgMarkEnd()
1.2359 +@see __UHEAP_MARK
1.2360 +*/
1.2361 +#define __UHEAP_MARKENDC(aCount)
1.2362 +
1.2363 +
1.2364 +
1.2365 +
1.2366 +/**
1.2367 +@publishedAll
1.2368 +@released
1.2369 +
1.2370 +Simulates heap allocation failure for the current thread's heap.
1.2371 +
1.2372 +The failure occurs on the next call to new or any of the functions which
1.2373 +allocate memory from the heap. This macro is defined only for debug builds.
1.2374 +
1.2375 +@param aCount Determines when the allocation will fail.
1.2376 + Heap allocation fails on attempt number aCount - later
1.2377 + allocations will succeed.
1.2378 + For example, if aCount is 3, then heap allocation fails
1.2379 + on the 3rd attempt, but all subsequent allocations succeed.
1.2380 +
1.2381 +@see User::__DbgSetAllocFail()
1.2382 +*/
1.2383 +#define __UHEAP_FAILNEXT(aCount)
1.2384 +
1.2385 +/**
1.2386 +@publishedAll
1.2387 +@released
1.2388 +
1.2389 +Simulates heap allocation failure for the current thread's heap.
1.2390 +
1.2391 +The failures will occur for aBurst times from the next call to new or any of the functions which
1.2392 +allocate memory from the heap. This macro is defined only for debug builds.
1.2393 +
1.2394 +@param aCount Determines when the allocation will fail.
1.2395 + Heap allocation fails on attempt number aCount - later
1.2396 + allocations will succeed.
1.2397 + For example, if aCount is 3, then heap allocation fails
1.2398 + on the 3rd attempt, but all subsequent allocations succeed.
1.2399 + Note when used with RHeap the maximum value aBurst can be
1.2400 + set to is KMaxTUint16.
1.2401 +@param aBurst The number of consecutive allocations that will fail. Note
1.2402 + when used with RHeap the maximum value aBurst can be set
1.2403 + to is KMaxTUint16.
1.2404 +
1.2405 +@see User::__DbgSetBurstAllocFail()
1.2406 +*/
1.2407 +#define __UHEAP_BURSTFAILNEXT(aCount,aBurst)
1.2408 +
1.2409 +
1.2410 +
1.2411 +/**
1.2412 +@publishedAll
1.2413 +@released
1.2414 +
1.2415 +Simulates heap allocation failure for the current thread's heap.
1.2416 +
1.2417 +The failure occurs on subsequent calls to new or any of the functions which
1.2418 +allocate memory from the heap. This macro is defined only for debug builds.
1.2419 +
1.2420 +@param aType The type of failure to be simulated.
1.2421 +@param aRate The failure rate.
1.2422 +
1.2423 +@see User::__DbgSetAllocFail()
1.2424 +*/
1.2425 +#define __UHEAP_SETFAIL(aType,aRate)
1.2426 +
1.2427 +/**
1.2428 +@publishedAll
1.2429 +@released
1.2430 +
1.2431 +Simulates heap allocation failure for the current thread's heap.
1.2432 +
1.2433 +The failure occurs on subsequent calls to new or any of the functions which
1.2434 +allocate memory from the heap. This macro is defined only for debug builds.
1.2435 +
1.2436 +@param aType The type of failure to be simulated.
1.2437 +@param aRate The failure rate. Note when used with RHeap the maximum value
1.2438 + aRate can be set to is KMaxTUint16.
1.2439 +@param aBurst The number of consecutive allocations that will fail. Note
1.2440 + when used with RHeap the maximum value aBurst can be set
1.2441 + to is KMaxTUint16.
1.2442 +
1.2443 +@see User::__DbgSetBurstAllocFail()
1.2444 +@see RAllocator::TAllocFail
1.2445 +*/
1.2446 +#define __UHEAP_SETBURSTFAIL(aType,aRate,aBurst)
1.2447 +
1.2448 +
1.2449 +
1.2450 +/**
1.2451 +@publishedAll
1.2452 +@released
1.2453 +
1.2454 +Cancels simulated heap allocation failure for the current thread's heap.
1.2455 +
1.2456 +This macro is defined only for debug builds.
1.2457 +
1.2458 +@see User::__DbgSetAllocFail()
1.2459 +*/
1.2460 +#define __UHEAP_RESET
1.2461 +
1.2462 +
1.2463 +
1.2464 +/**
1.2465 +@publishedAll
1.2466 +@released
1.2467 +
1.2468 +Cancels simulated heap allocation failure for the current thread's heap.
1.2469 +It walks the the heap and sets the nesting level for all allocated
1.2470 +cells to zero.
1.2471 +
1.2472 +This macro is defined only for debug builds.
1.2473 +*/
1.2474 +#define __UHEAP_TOTAL_RESET
1.2475 +
1.2476 +/**
1.2477 +@publishedAll
1.2478 +@released
1.2479 +
1.2480 +Returns the number of heap allocation failures the current debug allocator fail
1.2481 +function has caused so far.
1.2482 +
1.2483 +This is intended to only be used with fail types RAllocator::EFailNext,
1.2484 +RAllocator::EBurstFailNext, RAllocator::EDeterministic and
1.2485 +RAllocator::EBurstDeterministic. The return value is unreliable for
1.2486 +all other fail types.
1.2487 +
1.2488 +@return The number of heap allocation failures the current debug fail
1.2489 +function has caused.
1.2490 +
1.2491 +@see RAllocator::TAllocFail
1.2492 +*/
1.2493 +#define __UHEAP_CHECKFAILURE ((TUint)0)
1.2494 +
1.2495 +
1.2496 +/**
1.2497 +@publishedPartner
1.2498 +@released
1.2499 +
1.2500 +Marks the start of Kernel heap checking.
1.2501 +
1.2502 +Checking the Kernel heap is only useful when developing Kernel side code such
1.2503 +as device drivers and media drivers.
1.2504 +
1.2505 +This macro is defined only for debug builds.
1.2506 +
1.2507 +This macro must be matched by a corresponding call to __KHEAP_MARKEND or __KHEAP_MARKENDC.
1.2508 +Calls to this macro can be nested but each call must be matched by corresponding
1.2509 +call to __KHEAP_MARKEND or __KHEAP_MARKENDC.
1.2510 +
1.2511 +@see User::__DbgMarkStart()
1.2512 +@see __KHEAP_MARKEND
1.2513 +@see __KHEAP_MARKENDC
1.2514 +*/
1.2515 +#define __KHEAP_MARK
1.2516 +
1.2517 +
1.2518 +
1.2519 +
1.2520 +/**
1.2521 +@publishedPartner
1.2522 +@released
1.2523 +
1.2524 +Checks that the number of allocated cells at the current nested level of the
1.2525 +Kernel heap is the same as the specified value. This macro is defined only
1.2526 +for debug builds. Checking the Kernel heap is only useful when developing
1.2527 +Kernel side code such as device drivers and media drivers.
1.2528 +
1.2529 +The macro also takes the name of the file containing this source code statement
1.2530 +and the line number of this source code statement; they are displayed as part
1.2531 +of the panic category, if the checks fail.
1.2532 +
1.2533 +@param aCount The number of heap cells expected to be allocated at
1.2534 + the current nest level.
1.2535 +
1.2536 +@see User::__DbgMarkCheck()
1.2537 +@see __UHEAP_CHECK
1.2538 +*/
1.2539 +#define __KHEAP_CHECK(aCount)
1.2540 +
1.2541 +
1.2542 +
1.2543 +
1.2544 +/**
1.2545 +@publishedPartner
1.2546 +@released
1.2547 +
1.2548 +Checks that the total number of allocated cells on the Kernel heap is the same
1.2549 +as the specified value.
1.2550 +
1.2551 +It is only useful when developing Kernel side code such as device drivers
1.2552 +and media drivers.
1.2553 +
1.2554 +The macro also takes the name of the file containing this source code statement
1.2555 +and the line number of this source code statement; they are displayed as part
1.2556 +of the panic category, if the checks fail.
1.2557 +
1.2558 +This macro is defined only for debug builds.
1.2559 +
1.2560 +@param aCount The total number of heap cells expected to be allocated
1.2561 +
1.2562 +@see User::__DbgMarkCheck()
1.2563 +@see __UHEAP_CHECKALL
1.2564 +*/
1.2565 +#define __KHEAP_CHECKALL(aCount)
1.2566 +
1.2567 +
1.2568 +
1.2569 +
1.2570 +/**
1.2571 +@publishedPartner
1.2572 +@released
1.2573 +
1.2574 +Marks the end of Kernel heap checking. The macro expects zero heap cells to
1.2575 +remain allocated at the current nest level.
1.2576 +
1.2577 +This macro is defined only for debug builds. Checking the Kernel heap is only
1.2578 +useful when developing Kernel side code such as device drivers and media drivers.
1.2579 +
1.2580 +This macro must match an earlier call to __KHEAP_MARK.
1.2581 +
1.2582 +@see User::__DbgMarkEnd()
1.2583 +@see __KHEAP_MARK
1.2584 +*/
1.2585 +#define __KHEAP_MARKEND
1.2586 +
1.2587 +
1.2588 +
1.2589 +
1.2590 +/**
1.2591 +@publishedPartner
1.2592 +@released
1.2593 +
1.2594 +Marks the end of Kernel heap checking. The macro expects aCount heap cells
1.2595 +to remain allocated at the current nest level.
1.2596 +
1.2597 +This macro is defined only for debug builds.
1.2598 +
1.2599 +This macro must match an earlier call to __KHEAP_MARK.
1.2600 +
1.2601 +@param aCount The number of heap cells expected to remain allocated at
1.2602 + the current nest level.
1.2603 +
1.2604 +@see User::__DbgMarkEnd()
1.2605 +@see __KHEAP_MARK
1.2606 +*/
1.2607 +#define __KHEAP_MARKENDC(aCount)
1.2608 +
1.2609 +
1.2610 +
1.2611 +
1.2612 +/**
1.2613 +@publishedPartner
1.2614 +@released
1.2615 +
1.2616 +Simulates Kernel heap allocation failure. The failure occurs on the next call
1.2617 +to new or any of the functions which allocate memory from the heap. This macro
1.2618 +is defined only for debug builds.
1.2619 +
1.2620 +Checking the Kernel heap is only useful when developing Kernel side code such
1.2621 +as device drivers and media drivers.
1.2622 +
1.2623 +@param aCount The rate of failure - heap allocation fails every aCount attempt.
1.2624 +
1.2625 +@see User::__DbgSetAllocFail()
1.2626 +*/
1.2627 +#define __KHEAP_FAILNEXT(aCount)
1.2628 +
1.2629 +/**
1.2630 +@publishedPartner
1.2631 +@released
1.2632 +
1.2633 +Simulates Kernel heap allocation failures. aBurst failures will occur on the next call
1.2634 +to new or any of the functions which allocate memory from the heap. This macro
1.2635 +is defined only for debug builds.
1.2636 +
1.2637 +Checking the Kernel heap is only useful when developing Kernel side code such
1.2638 +as device drivers and media drivers.
1.2639 +
1.2640 +@param aCount The heap allocation will fail after aCount-1 allocation attempts.
1.2641 + Note when used with RHeap the maximum value aCount can be set
1.2642 + to is KMaxTUint16.
1.2643 +@param aBurst The number of allocations that will fail after aCount-1 allocation
1.2644 + attempts. Note when used with RHeap the maximum value aBurst can
1.2645 + be set to is KMaxTUint16.
1.2646 +
1.2647 +@see User::__DbgSetBurstAllocFail()
1.2648 +*/
1.2649 +#define __KHEAP_BURSTFAILNEXT(aCount,aBurst)
1.2650 +
1.2651 +
1.2652 +
1.2653 +/**
1.2654 +@publishedPartner
1.2655 +@released
1.2656 +
1.2657 +Simulates Kernel heap allocation failure.
1.2658 +
1.2659 +The failure occurs on subsequent calls to new or any of the functions which
1.2660 +allocate memory from this heap.
1.2661 +
1.2662 +This macro is defined only for debug builds.
1.2663 +
1.2664 +@param aType The type of failure to be simulated.
1.2665 +@param aRate The failure rate.
1.2666 +
1.2667 +@see User::__DbgSetAllocFail()
1.2668 +*/
1.2669 +#define __KHEAP_SETFAIL(aType,aRate)
1.2670 +
1.2671 +/**
1.2672 +@publishedPartner
1.2673 +@released
1.2674 +
1.2675 +Simulates Kernel heap allocation failure.
1.2676 +
1.2677 +The failure occurs on subsequent calls to new or any of the functions which
1.2678 +allocate memory from this heap.
1.2679 +
1.2680 +This macro is defined only for debug builds.
1.2681 +
1.2682 +@param aType The type of failure to be simulated.
1.2683 +@param aRate The failure rate. Note when used with RHeap the maximum value
1.2684 + aRate can be set to is KMaxTUint16.
1.2685 +@param aBurst The number of consecutive allocations that will fail. Note
1.2686 + when used with RHeap the maximum value aBurst can be set
1.2687 + to is KMaxTUint16.
1.2688 +
1.2689 +@see User::__DbgSetBurstAllocFail()
1.2690 +*/
1.2691 +#define __KHEAP_SETBURSTFAIL(aType,aRate,aBurst)
1.2692 +
1.2693 +
1.2694 +
1.2695 +/**
1.2696 +@publishedPartner
1.2697 +@released
1.2698 +
1.2699 +Cancels simulated Kernel heap allocation failure.
1.2700 +
1.2701 +Checking the Kernel heap is only useful when developing Kernel side code such
1.2702 +as device drivers and media drivers.
1.2703 +
1.2704 +This macro is defined only for debug builds.
1.2705 +
1.2706 +@see User::__DbgSetAllocFail()
1.2707 +*/
1.2708 +#define __KHEAP_RESET
1.2709 +
1.2710 +
1.2711 +
1.2712 +/**
1.2713 +@publishedPartner
1.2714 +@released
1.2715 +
1.2716 +Cancels simulated kernel heap allocation failure.
1.2717 +It walks the the heap and sets the nesting level for all allocated
1.2718 +cells to zero.
1.2719 +
1.2720 +Checking the kernel heap is only useful when developing kernel side code such
1.2721 +as device drivers and media drivers.
1.2722 +
1.2723 +This macro is defined only for debug builds.
1.2724 +*/
1.2725 +#define __KHEAP_TOTAL_RESET
1.2726 +
1.2727 +
1.2728 +/**
1.2729 +@publishedAll
1.2730 +@released
1.2731 +
1.2732 +Returns the number of kernel heap allocation failures the current debug
1.2733 +allocator fail function has caused so far.
1.2734 +
1.2735 +This is intended to only be used with fail types RAllocator::EFailNext,
1.2736 +RAllocator::EBurstFailNext, RAllocator::EDeterministic and
1.2737 +RAllocator::EBurstDeterministic. The return value is unreliable for
1.2738 +all other fail types.
1.2739 +
1.2740 +@return The number of heap allocation failures the current debug fail
1.2741 +function has caused.
1.2742 +
1.2743 +@see RAllocator::TAllocFail
1.2744 +*/
1.2745 +#define __KHEAP_CHECKFAILURE ((TUint)0)
1.2746 +
1.2747 +/**
1.2748 +@publishedAll
1.2749 +@released
1.2750 +
1.2751 +Marks the start of heap checking for the specific heap.
1.2752 +
1.2753 +This macro is defined only for debug builds.
1.2754 +
1.2755 +This macro must be matched by a corresponding call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
1.2756 +
1.2757 +Calls to this macro can be nested but each call must be matched by corresponding
1.2758 +call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
1.2759 +
1.2760 +@param aHeap A pointer to the specific RHeap
1.2761 +
1.2762 +@see RHeap
1.2763 +@see RAllocator::__DbgMarkStart()
1.2764 +@see __RHEAP_MARKEND
1.2765 +@see __RHEAP_MARKENDC
1.2766 +*/
1.2767 +#define __RHEAP_MARK(aHeap)
1.2768 +
1.2769 +
1.2770 +
1.2771 +
1.2772 +/**
1.2773 +@publishedAll
1.2774 +@released
1.2775 +
1.2776 +Checks that the number of allocated cells at the current nested level on the
1.2777 +specified heap is the same as the specified value.
1.2778 +
1.2779 +The macro also takes the name of the file containing this source code statement
1.2780 +and the line number of this source code statement; they are displayed as part
1.2781 +of the panic category, if the checks fail.
1.2782 +
1.2783 +This macro is defined only for debug builds.
1.2784 +
1.2785 +@param aHeap A pointer to the specific RHeap.
1.2786 +@param aCount The number of heap cells expected to be allocated at
1.2787 + the current nest level.
1.2788 +
1.2789 +@see RAllocator::__DbgMarkCheck()
1.2790 +*/
1.2791 +#define __RHEAP_CHECK(aHeap,aCount)
1.2792 +
1.2793 +
1.2794 +
1.2795 +
1.2796 +/**
1.2797 +@publishedAll
1.2798 +@released
1.2799 +
1.2800 +Checks that the total number of allocated cells on the specified heap is the
1.2801 +same as the specified value.
1.2802 +
1.2803 +The macro also takes the name of the file containing this source code statement
1.2804 +and the line number of this source code statement; they are displayed as part
1.2805 +of the panic category, if the checks fail.
1.2806 +
1.2807 +This macro is defined only for debug builds.
1.2808 +
1.2809 +@param aHeap A pointer to the specific RHeap.
1.2810 +@param aCount The total number of heap cells expected to be allocated.
1.2811 +
1.2812 +@see RAllocator::__DbgMarkCheck()
1.2813 +*/
1.2814 +#define __RHEAP_CHECKALL(aHeap,aCount)
1.2815 +
1.2816 +
1.2817 +
1.2818 +
1.2819 +/**
1.2820 +@publishedAll
1.2821 +@released
1.2822 +
1.2823 +Marks the end of heap checking for the specific heap.
1.2824 +
1.2825 +The macro expects zero heap cells to remain allocated at the current nest
1.2826 +level. This macro is defined only for debug builds.
1.2827 +
1.2828 +This macro must match an earlier call to __RHEAP_MARK.
1.2829 +
1.2830 +@param aHeap A pointer to the specific RHeap.
1.2831 +
1.2832 +@see RAllocator::__DbgMarkEnd()
1.2833 +@see __RHEAP_MARK
1.2834 +*/
1.2835 +#define __RHEAP_MARKEND(aHeap)
1.2836 +
1.2837 +
1.2838 +
1.2839 +
1.2840 +/**
1.2841 +@publishedAll
1.2842 +@released
1.2843 +
1.2844 +Marks the end of heap checking for the specific heap.
1.2845 +
1.2846 +The macro expects aCount heap cells to remain allocated at the current nest
1.2847 +level. This macro is defined only for debug builds.
1.2848 +
1.2849 +This macro must match an earlier call to __RHEAP_MARK.
1.2850 +
1.2851 +@param aHeap A pointer to the specific RHeap.
1.2852 +@param aCount The number of heap cells expected to remain allocated at
1.2853 + the current nest level
1.2854 +
1.2855 +@see RAllocator::__DbgMarkEnd()
1.2856 +@see __RHEAP_MARK
1.2857 +*/
1.2858 +#define __RHEAP_MARKENDC(aHeap,aCount)
1.2859 +
1.2860 +
1.2861 +
1.2862 +
1.2863 +/**
1.2864 +@publishedAll
1.2865 +@released
1.2866 +
1.2867 +Simulates an allocation failure for the specific heap.
1.2868 +
1.2869 +The failure occurs on the next call to new or any of the functions which allocate
1.2870 +memory from the heap. This macro is defined only for debug builds.
1.2871 +
1.2872 +@param aHeap A pointer to the specific RHeap.
1.2873 +@param aCount The rate of failure - heap allocation fails every aCount attempt.
1.2874 +
1.2875 +@see RAllocator::__DbgSetAllocFail()
1.2876 +*/
1.2877 +#define __RHEAP_FAILNEXT(aHeap,aCount)
1.2878 +
1.2879 +/**
1.2880 +@publishedAll
1.2881 +@released
1.2882 +
1.2883 +Simulates aBurst allocation failures for the specific heap.
1.2884 +
1.2885 +The failure occurs on the next call to new or any of the functions which allocate
1.2886 +memory from the heap. This macro is defined only for debug builds.
1.2887 +
1.2888 +@param aHeap A pointer to the specific RHeap.
1.2889 +@param aCount The heap allocation will fail after aCount-1 allocation attempts.
1.2890 + Note when used with RHeap the maximum value aCount can be set
1.2891 + to is KMaxTUint16.
1.2892 +@param aBurst The number of consecutive allocations that will fail. Note
1.2893 + when used with RHeap the maximum value aBurst can be set
1.2894 + to is KMaxTUint16.
1.2895 +
1.2896 +@see RAllocator::__DbgSetBurstAllocFail()
1.2897 +*/
1.2898 +#define __RHEAP_BURSTFAILNEXT(aHeap,aCount,aBurst)
1.2899 +
1.2900 +
1.2901 +
1.2902 +/**
1.2903 +@publishedAll
1.2904 +@released
1.2905 +
1.2906 +Simulates an allocation failure for the specific heap.
1.2907 +
1.2908 +The failure occurs on subsequent calls to new or any of the functions which
1.2909 +allocate memory from the heap. This macro is defined only for debug builds.
1.2910 +
1.2911 +@param aHeap A pointer to the specific RHeap.
1.2912 +@param aType The type of failure to be simulated.
1.2913 +@param aRate The failure rate.
1.2914 +
1.2915 +@see RAllocator::__DbgSetAllocFail()
1.2916 +*/
1.2917 +#define __RHEAP_SETFAIL(aHeap,aType,aRate)
1.2918 +
1.2919 +/**
1.2920 +@publishedAll
1.2921 +@released
1.2922 +
1.2923 +Simulates an allocation failure for the specific heap.
1.2924 +
1.2925 +The failure occurs on subsequent calls to new or any of the functions which
1.2926 +allocate memory from the heap. This macro is defined only for debug builds.
1.2927 +
1.2928 +@param aHeap A pointer to the specific RHeap.
1.2929 +@param aType The type of failure to be simulated.
1.2930 +@param aRate The failure rate. Note when used with RHeap the maximum value
1.2931 + aRate can be set to is KMaxTUint16.
1.2932 +@param aBurst The number of consecutive allocations that will fail. Note
1.2933 + when used with RHeap the maximum value aBurst can be set
1.2934 + to is KMaxTUint16.
1.2935 +
1.2936 +@see RAllocator::__DbgSetBurstAllocFail()
1.2937 +*/
1.2938 +#define __RHEAP_SETBURSTFAIL(aHeap,aType,aRate,aBurst)
1.2939 +
1.2940 +
1.2941 +
1.2942 +/**
1.2943 +@publishedAll
1.2944 +@released
1.2945 +
1.2946 +Cancels simulated allocation failure for the specific heap.
1.2947 +
1.2948 +This macro is defined only for debug builds.
1.2949 +
1.2950 +@param aHeap A pointer to the specific RHeap.
1.2951 +
1.2952 +@see RAllocator::__DbgSetAllocFail()
1.2953 +*/
1.2954 +#define __RHEAP_RESET(aHeap)
1.2955 +
1.2956 +
1.2957 +
1.2958 +/**
1.2959 +@publishedAll
1.2960 +@released
1.2961 +
1.2962 +Cancels simulated allocation failure for the specific heap.
1.2963 +It walks the the heap and sets the nesting level for all allocated
1.2964 +cells to zero.
1.2965 +
1.2966 +This macro is defined only for debug builds.
1.2967 +
1.2968 +@param aHeap A pointer to the specific RHeap.
1.2969 +
1.2970 +@see RAllocator::__DbgSetAllocFail()
1.2971 +*/
1.2972 +#define __RHEAP_TOTAL_RESET(aHeap)
1.2973 +
1.2974 +
1.2975 +/**
1.2976 +@publishedAll
1.2977 +@released
1.2978 +
1.2979 +Returns the number of heap allocation failures the current debug allocator fail
1.2980 +function has caused so far.
1.2981 +
1.2982 +This is intended to only be used with fail types RAllocator::EFailNext,
1.2983 +RAllocator::EBurstFailNext, RAllocator::EDeterministic and
1.2984 +RAllocator::EBurstDeterministic. The return value is unreliable for
1.2985 +all other fail types.
1.2986 +
1.2987 +@return The number of heap allocation failures the current debug fail
1.2988 +function has caused.
1.2989 +
1.2990 +@see RAllocator::TAllocFail
1.2991 +*/
1.2992 +#define __RHEAP_CHECKFAILURE(aHeap) ((TUint)0)
1.2993 +
1.2994 +#define __DEBUGGER()
1.2995 +#endif
1.2996 +
1.2997 +#if defined (__WINS__)
1.2998 +/** @internalTechnology */
1.2999 +#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};
1.3000 +/** @internalTechnology */
1.3001 +#define __EMULATOR_IMAGE_HEADER(aUid0,aUid1,aUid2,aPriority,aCap,aFlags) TEmulatorImageHeader uid={{aUid0,aUid1,aUid2},aPriority,{aUid2,0,{aCap,0}},0,0,0x00010000u,aFlags};
1.3002 +#else
1.3003 +#define __EMULATOR_IMAGE_HEADER2(aUid0,aUid1,aUid2,aPriority,aCap0,aCap1,aSid,aVer,aFlags)
1.3004 +#define __EMULATOR_IMAGE_HEADER(aUid0,aUid1,aUid2,aPriority,aCap,aFlags)
1.3005 +#endif
1.3006 +
1.3007 +#if defined(__OPT__)
1.3008 +/**
1.3009 +@internalComponent
1.3010 +@deprecated
1.3011 +*/
1.3012 +#define __ASSERT_OPT(c,p) (void)((c)||(p,0))
1.3013 +#else
1.3014 +#define __ASSERT_OPT(c,p)
1.3015 +#endif
1.3016 +
1.3017 +#if defined(_UNICODE)
1.3018 +#if !defined(UNICODE)
1.3019 +/**
1.3020 +@publishedAll
1.3021 +@deprecated
1.3022 +*/
1.3023 +#define UNICODE
1.3024 +#endif
1.3025 +#endif
1.3026 +
1.3027 +#if defined(_DEBUG)
1.3028 +/**
1.3029 +@internalComponent
1.3030 +@deprecated
1.3031 +*/
1.3032 +#define __DECLARE_TEST_DEBUG __DECLARE_TEST
1.3033 +#else
1.3034 +#define __DECLARE_TEST_DEBUG
1.3035 +#endif
1.3036 +
1.3037 +
1.3038 +
1.3039 +
1.3040 +#if !defined(ASSERT)
1.3041 +/**
1.3042 +@publishedAll
1.3043 +@released
1.3044 +
1.3045 +Generates _ASSERT_DEBUG code that calls User::Invariant() if the specified
1.3046 +condition is not true.
1.3047 +
1.3048 +@param x A conditional expression which results in true or false.
1.3049 +*/
1.3050 +#define ASSERT(x) __ASSERT_DEBUG(x,User::Invariant())
1.3051 +#endif
1.3052 +
1.3053 +
1.3054 +
1.3055 +
1.3056 +#ifndef __VALUE_IN_REGS__
1.3057 +/**
1.3058 +@publishedPartner
1.3059 +@released
1.3060 +*/
1.3061 +#define __VALUE_IN_REGS__
1.3062 +#endif
1.3063 +
1.3064 +
1.3065 +
1.3066 +
1.3067 +#if defined(_DEBUG)
1.3068 +/**
1.3069 +@publishedAll
1.3070 +@released
1.3071 +*/
1.3072 +#define __DEBUG_ONLY(x) x
1.3073 +#else
1.3074 +#define __DEBUG_ONLY(x)
1.3075 +#endif
1.3076 +
1.3077 +
1.3078 +
1.3079 +
1.3080 +#ifdef __KERNEL_MODE__
1.3081 +
1.3082 +/** @internalComponent */
1.3083 +#define KIMPORT_C IMPORT_C
1.3084 +
1.3085 +/** @internalComponent */
1.3086 +#define KEXPORT_C EXPORT_C
1.3087 +
1.3088 +/** @internalComponent */
1.3089 +#define UIMPORT_C
1.3090 +
1.3091 +/** @internalComponent */
1.3092 +#define UEXPORT_C
1.3093 +#else
1.3094 +#define KIMPORT_C
1.3095 +#define KEXPORT_C
1.3096 +#define UIMPORT_C IMPORT_C
1.3097 +#define UEXPORT_C EXPORT_C
1.3098 +#endif
1.3099 +
1.3100 +
1.3101 +
1.3102 +
1.3103 +/**
1.3104 +@publishedAll
1.3105 +@released
1.3106 +
1.3107 +Asserts that a condition is true at compilation time.
1.3108 +
1.3109 +@param x Condition to assert
1.3110 +*/
1.3111 +#define __ASSERT_COMPILE(x) void __compile_time_assert(int __check[(x)?1:-1])
1.3112 +
1.3113 +#ifdef __REMOVE_PLATSEC_DIAGNOSTICS__
1.3114 +/**
1.3115 +@publishedPartner
1.3116 +@released
1.3117 +*/
1.3118 +#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3119 +#define __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3120 +#endif /*__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__*/
1.3121 +#endif /*__REMOVE_PLATSEC_DIAGNOSTICS__*/
1.3122 +
1.3123 +/**
1.3124 +@internalComponent
1.3125 +*/
1.3126 +static const char* const KSuppressPlatSecDiagnosticMagicValue = (const char*)1;
1.3127 +
1.3128 +#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3129 +/**
1.3130 +@internalComponent
1.3131 +*/
1.3132 +#define __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER(l) #l
1.3133 +/**
1.3134 +@internalComponent
1.3135 +*/
1.3136 +#define __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER2(f,l) f "(" __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER(l) ")"
1.3137 +/**
1.3138 +@publishedPartner
1.3139 +@released
1.3140 +*/
1.3141 +#define __PLATSEC_DIAGNOSTIC_FILE_AND_LINE __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER2(__FILE__,__LINE__)
1.3142 +
1.3143 +/**
1.3144 +@publishedPartner
1.3145 +@released
1.3146 +
1.3147 +A macro that should be used to enclose a platform security diagnostic
1.3148 +'C' style string that can be passed to a capability checking function such
1.3149 +as RThread::HasCapability() and Kern::CurrentThreadHasCapability().
1.3150 +
1.3151 +The content of the string is emitted if the capability test finds that
1.3152 +the capability is not present.
1.3153 +
1.3154 +The macro provides a convenient mechanism that allows the strings to
1.3155 +be removed from future versions of Symbian OS.
1.3156 +
1.3157 +For example:
1.3158 +
1.3159 +@code
1.3160 +if(!Kern::CurrentThreadHasCapability(ECapabilityPowerMgmt,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetState")))
1.3161 + {
1.3162 + return KErrPermissionDenied;
1.3163 + }
1.3164 +@endcode
1.3165 +
1.3166 +In this example, the string:
1.3167 +
1.3168 +@code
1.3169 +Checked by Hal function EDisplayHalSetState
1.3170 +@endcode
1.3171 +
1.3172 +is emitted if the calling process does not have the ECapabilityPowerMgmt capability.
1.3173 +
1.3174 +@param s A C-style string.
1.3175 +
1.3176 +@see RProcess::HasCapability()
1.3177 +@see RThread::HasCapability()
1.3178 +@see RMessagePtr2::HasCapability()
1.3179 +@see User::CreatorHasCapability()
1.3180 +*/
1.3181 +#define __PLATSEC_DIAGNOSTIC_STRING(s) s
1.3182 +
1.3183 +/**
1.3184 +When this value is used in Platform Security APIs as the value for the aDiagnosticText
1.3185 +argument, these APIs will not emit any form of diagnostic message.
1.3186 +@publishedPartner
1.3187 +@released
1.3188 +*/
1.3189 +// Note this value is the same as KSuppressPlatSecDiagnosticMagicValue
1.3190 +// and used to be a set by it but that caused an error with GCCE compiler
1.3191 +static const char* const KSuppressPlatSecDiagnostic = (const char*)1;
1.3192 +
1.3193 +#else /* __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ */
1.3194 +
1.3195 +#define __PLATSEC_DIAGNOSTIC_STRING(s) NULL
1.3196 +
1.3197 +#ifndef __KERNEL_MODE__
1.3198 +#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
1.3199 +/**
1.3200 +When this value is used in Platform Security APIs as the value for the aDiagnostic
1.3201 +argument, these APIs will not emit any form of diagnostic message.
1.3202 +@publishedPartner
1.3203 +@released
1.3204 +*/
1.3205 +#define KSuppressPlatSecDiagnostic NULL, NULL
1.3206 +
1.3207 +#else /* __REMOVE_PLATSEC_DIAGNOSTICS__ */
1.3208 +
1.3209 +/**
1.3210 +When this value is used in Platform Security APIs as the value for the aDiagnostic
1.3211 +argument, these APIs will not emit any form of diagnostic message.
1.3212 +@publishedPartner
1.3213 +@release
1.3214 +*/
1.3215 +#define KSuppressPlatSecDiagnostic NULL
1.3216 +
1.3217 +#endif /* !__REMOVE_PLATSEC_DIAGNOSTICS__ */
1.3218 +#endif /* !__KERNEL_MODE__ */
1.3219 +#endif /* !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ */
1.3220 +
1.3221 +/*
1.3222 + * MSVC operator new and operator new[] header guards
1.3223 + */
1.3224 +#ifdef __PLACEMENT_NEW
1.3225 +#define __PLACEMENT_NEW_INLINE
1.3226 +#endif /* __PLACEMENT_NEW */
1.3227 +
1.3228 +#if defined(__VC32__) && (_MSC_VER < 1300)
1.3229 +#define __PLACEMENT_VEC_NEW_INLINE
1.3230 +#endif /* version of MSVC that doesn't support overloaded operator new[] */
1.3231 +
1.3232 +/**
1.3233 +Calling convention qualifier for functions involving floating point
1.3234 +variables passed or returned by value.
1.3235 +@publishedAll
1.3236 +@released
1.3237 +*/
1.3238 +#ifndef __SOFTFP
1.3239 +#define __SOFTFP
1.3240 +#endif /* __SOFTFP */
1.3241 +
1.3242 +#endif /* __E32DEF_H__ */