2 * Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * e32\include\e32def.h
16 * NOTE: THIS FILE SHOULD BE ACCEPTABLE TO A C COMPILER
27 * __LEAVE_EQUALS_THROW__ requires the compiler to support C++ exceptions
29 #ifndef __SUPPORT_CPP_EXCEPTIONS__
30 #undef __LEAVE_EQUALS_THROW__
39 #define __NO_CLASS_CONSTS__
40 #if (_MSC_VER >= 1200)
45 #define __NORETURN__ __declspec(noreturn)
53 #define __NORETURN_TERMINATOR()
58 #define IMPORT_C __declspec(dllexport)
63 #define EXPORT_C __declspec(dllexport)
68 #define IMPORT_D __declspec(dllexport)
73 #define EXPORT_D __declspec(dllexport)
78 #define NONSHARABLE_CLASS(x) class x
83 #define NONSHARABLE_STRUCT(x) struct x
88 #define __NO_THROW throw()
93 #define __THROW(t) throw(t)
94 #pragma warning( disable : 4355 ) /* 'this' used in base member initializer list */
95 #pragma warning( disable : 4511 ) /* copy constructor could not be generated */
96 #pragma warning( disable : 4512 ) /* assignment operator could not be generated */
97 #pragma warning( disable : 4514 ) /* unreferenced inline function has been removed */
98 #pragma warning( disable : 4699 ) /* Note: Using precompiled header %s */
99 #pragma warning( disable : 4710 ) /* function not inlined */
100 #pragma warning( disable : 4121 ) /* alignment sensitive to packing */
101 #pragma warning( disable : 4273 )
102 #pragma warning( disable : 4097 ) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */
103 #pragma warning( disable : 4291 ) /* 'TAny *CBase::operator new(TUint,TLeave)' : no matching operator delete found; memory will not be freed if initialization throws an exception */
110 #define TEMPLATE_SPECIALIZATION template<>
112 #define TEMPLATE_SPECIALIZATION
118 #if defined(__CW32__)
119 #undef __embedded_cplusplus
120 /** @internalTechnology */
121 #define __embedded_cplusplus 1
122 #define __NO_CLASS_CONSTS__
124 #define __NORETURN_TERMINATOR()
125 #define IMPORT_C __declspec(dllexport)
126 #define EXPORT_C __declspec(dllexport)
127 #define IMPORT_D __declspec(dllexport)
128 #define EXPORT_D __declspec(dllexport)
129 #define NONSHARABLE_CLASS(x) class x
130 #define NONSHARABLE_STRUCT(x) struct x
131 #define __NO_THROW throw()
132 #define __THROW(t) throw(t)
134 #define TEMPLATE_SPECIALIZATION template<>
142 /** @internalTechnology */
143 #define __int64 long long
145 #ifndef __SUPPORT_CPP_EXCEPTIONS__
146 #pragma exceptions off /* no support for C++ exception handling */
147 #pragma RTTI off /* no support for C++ runtime type information */
149 #if __MWERKS__ >= 0x3200
150 #pragma warning off (10480) /* deleteing void pointer is undefined */
151 #pragma warning off (10350) /* N pad byte(s) inserted after data member */
157 // GCC (ARM) compiler
159 #if defined(__GCC32__) && defined(__MARM__)
160 #ifndef __GNUC__ /* GCC98r2 doesn't define this for some reason */
163 #define __NO_CLASS_CONSTS__
164 #define __NORETURN__ __attribute__ ((noreturn))
166 #define __NORETURN_TERMINATOR()
168 #define __NORETURN_TERMINATOR() abort()
172 #if !defined __WINS__ && defined _WIN32 /* VC++ Browser Hack */
175 /** @internalTechnology */
178 #define EXPORT_C __declspec(dllexport)
179 #define EXPORT_D __declspec(dllexport)
181 #define NONSHARABLE_CLASS(x) class x
182 #define NONSHARABLE_STRUCT(x) struct x
186 #define TEMPLATE_SPECIALIZATION template<>
188 #define TEMPLATE_SPECIALIZATION
194 #define __DOUBLE_WORDS_SWAPPED__
198 /** @internalTechnology */
199 #define __NO_MUTABLE_KEYWORD
200 #if defined(__NO_MUTABLE_KEYWORD)
207 #define __MUTABLE mutable
216 #define CONST_CAST(type,exp) (const_cast<type>(exp))
222 #define STATIC_CAST(type,exp) (static_cast<type>(exp))
228 #define REINTERPRET_CAST(type,exp) (reinterpret_cast<type>(exp))
230 #if defined(__NO_MUTABLE_KEYWORD)
235 #define MUTABLE_CAST(type,exp) (const_cast<type>(exp))
237 #define MUTABLE_CAST(type,exp) (exp)
244 #define GLREF_D extern
254 #define LOCAL_D static
259 #define GLREF_C extern
269 #define LOCAL_C static
275 #define IMPORT_D IMPORT_C
282 #define FOREVER for(;;)
291 Symbolic definition for a true value.
302 Symbolic definition for a false value.
314 Symbolic definition for a NULL value.
327 A macro used by Symbian OS code for handling a variable argument list
330 Sets a pointer to point to the first of the variable arguments.
335 Foo(CAbcdef aAbcdef,...)
338 VA_START(list, aAbcdef);
343 @param ap A pointer used to hold the address of an argument in
344 the variable argument list. After execution of the code generated
345 by this macro, the pointer points to the first argument in
346 the variable argument list.
347 This symbol is usually declared as a VA_LIST type.
349 @param pn The argument that immediately precedes the variable argument list.
354 #define VA_START(ap,pn) ((ap)[0]=(TInt8 *)&pn+((sizeof(pn)+sizeof(TInt)-1)&~(sizeof(TInt)-1)),(void)0)
365 A macro used by Symbian OS code for handling a variable argument list
368 Increments a pointer to a variable argument list to point to the next argument
369 in the list. The current argument is assumed to be of a type defined by
370 the second parameter to this macro.
375 Foo(CAbcdef aAbcdef,...)
378 VA_START(list, aAbcdef);
380 TInt x = VA_ARG(list,TInt);
382 const TDesC *pS=VA_ARG(aList,const TDesC*);
388 @param ap A pointer used to hold the address of an argument in
389 the variable argument list. It is assumed to point to the current
390 argument in the variable argument list. After execution of the code
391 generated by this macro, the pointer points to the next argument in
392 the list. This symbol is usually declared as a VA_LIST type.
394 @param type The type of the current argument.
395 This can be any valid type, for example, TInt, const TDesC*, etc.
400 #define VA_ARG(ap,type) ((ap)[0]+=((sizeof(type)+sizeof(TInt)-1)&~(sizeof(TInt)-1)),(*(type *)((ap)[0]-((sizeof(type)+sizeof(TInt)-1)&~(sizeof(TInt)-1)))))
411 A macro used by Symbian OS code for handling a variable argument list
414 Sets a pointer to zero.
416 @param ap A pointer used to hold the address of an argument in
417 the variable argument list. After execution of the code generated
418 by this macro, the pointer is reset to 0.
419 This symbol is usually declared as a VA_LIST type.
425 #define VA_END(ap) ((ap)[0]=0,(void)0)
434 Calculates the offset of member f within class c.
436 This is used in the TSglQue and TDblQue constructors to set the offset of
437 the link object from the start of a list element.
439 @param c The name of the class.
440 @param f The name of the member within the specified class.
447 #define _FOFF(c,f) (((TInt)&(((c *)0x1000)->f))-0x1000)
449 #define _FOFF(c,f) (__builtin_offsetof(c,f))
459 #define _ALIGN_DOWN(x,a) ((x)&~((a)-1))
464 #define _ALIGN_UP(x,a) _ALIGN_DOWN((x)+(a)-1, a)
475 TAny* is equivalent to void* in standard C or C++. TAny* is used in preference
476 to void* because it is more suggestive of the actual meaning,
479 TAny is not used where it really means "nothing", as in the declaration of
480 functions which do not return a value; void is used instead, e.g. void Foo();.
491 8-bit signed integer type, used in Symbian OS to mean an 8-bit
492 signed integer, independent of the implementation.
494 typedef signed char TInt8;
503 8-bit unsigned integer type; used in Symbian OS to mean an 8-bit
504 unsigned integer, independent of the implementation.
506 typedef unsigned char TUint8;
515 16-bit signed integer type, used in Symbian OS to mean a 16-bit
516 signed integer, independent of the implementation.
518 typedef short int TInt16;
527 16-bit unsigned integer type. used in Symbian OS to mean a 16-bit
528 unsigned integer, independent of the implementation.
530 typedef unsigned short int TUint16;
539 32-bit signed integer type, used in Symbian OS to mean a 32-bit
540 signed integer, independent of the implementation.
542 typedef long int TInt32;
551 A signed integer type of the same size as a pointer.
553 typedef TInt32 T_IntPtr;
554 typedef TInt32 TIntPtr;
563 32-bit unsigned integer type; used in Symbian OS to mean a 32-bit
564 unsigned integer, independent of the implementation.
566 typedef unsigned long int TUint32;
575 An unsigned integer type of the same size as a pointer.
577 typedef TUint32 T_UintPtr;
578 typedef TUint32 TUintPtr;
587 Signed integer type of the natural machine word length.
589 This is as defined by the C++ implementation's int type. In all
590 implementations, this is guaranteed to be at least 32 bits.
592 A TInt should be used in preference to a sized integer (TInt32, TInt16) for
593 all general use. Sized integers should only be used when packing is essential.
594 C++'s type conversion rules imply that all sized integers smaller than the
595 natural machine word are in any case broadened to the natural machine word
596 size when passed as function parameters.
598 A TInt should be used in preference to an unsigned integer (TUint) for all
599 general use. Unsigned integers should only be used for flags (which use Boolean
600 operations but not arithmetic) and, in very rare cases, for numbers whose
601 range exceeds that available from signed integers. Although it is natural
602 to attempt to use unsigned integers for quantities which cannot by nature
603 be negative, the C++ language does not provide the support necessary to enforce
604 the "expected" behaviour in these circumstances, and experience has shown
605 that it is better to use signed integers unless there is good reason not to.
611 typedef signed int TInt;
620 Unsigned integer type of the natural machine word length.
622 This is guaranteed to be at least 32 bits in all implementations.
624 In almost all circumstances, a TInt should be used in preference to a TUint.
625 The main exception is in flags bytes.
629 typedef unsigned int TUint;
638 32-bit floating point number, providing IEEE754 single precision on all Symbian
641 TReal should normally be used in preference to TReal32.
643 Use of floating-point numbers should generally be avoided unless a natural
644 part of the problem specification. Most Symbian OS implementations do not
645 have a hardware floating point unit: as a result, their floating-point performance
646 is hundreds of times slower than integer performance.
648 typedef float TReal32;
657 64-bit floating point number, providing IEEE754 double precision on all Symbian
660 Use of floating-point numbers should generally be avoided unless a natural
661 part of the problem specification. Most Symbian OS implementations do not
662 have a hardware floating point unit: as a result, their floating-point performance
663 is hundreds of times slower than integer performance.
665 This type is identical to TReal.
669 typedef double TReal64;
678 64-bit floating point number; identical to TReal64.
680 Use of floating-point numbers should generally be avoided unless a natural
681 part of the problem specification. Most Symbian OS implementations do not
682 have a hardware floating point unit: as a result, their floating-point performance
683 is hundreds of times slower than integer performance.
685 Most serious floating-point calculations require double-precision. All standard
686 math functions (see Math class) take double-precision arguments. Single-precision
687 should only be used where space and performance are at a premium, and when
688 their limited precision is acceptable.
693 typedef double TReal;
702 8-bit unsigned character.
704 Use instead of C++ built-in char type because it is guaranteed to be unsigned.
705 Use instead of TInt8 where the application is really for text rather than
706 8-bit arithmetic or binary quantities.
708 For most purposes, you should use TText rather than TText8. TText is mapped
709 onto either TText8 or TText16 depending on whether a non-Unicode or Unicode
710 variant is being built. Use TText8 only when you are dealing explicitly with
711 8-bit text, regardless of build.
714 typedef unsigned char TText8;
723 16-bit unsigned character.
725 Use instead of C++ wchar_t type because it is guaranteed to be unsigned. Use
726 instead of TInt16 where the application is really for text rather than 8-bit
727 arithmetic or binary quantities.
729 For most purposes, you should use TText rather than TText16. TText is mapped
730 onto either TText8 or TText16 depending on whether a non-Unicode or Unicode
731 variant is being built. Use TText16 only when you are dealing explicitly with
732 16-bit text, regardless of build.
736 typedef unsigned short int TText16;
745 Boolean type which takes the value either ETrue or EFalse.
747 Although only a single bit would theoretically be necessary to represent a
748 Boolean, a machine word is used instead, so that these quantities can be easily
749 passed. Also, TBool must map onto int because of C++'s interpretation of
750 operands in conditional expressions.
761 Defines a linear (virtual) address type.
763 typedef T_UintPtr TLinAddr;
767 #if defined(__GCC32__)
776 Defines a 64-bit signed integer type.
778 typedef long long Int64;
787 Defines a 64-bit unsigned integer type.
789 typedef unsigned long long Uint64;
798 #define I64LIT(x) x##LL
803 #define UI64LIT(x) x##ULL
805 #elif defined(__VC32__)
806 typedef __int64 Int64;
807 typedef unsigned __int64 Uint64;
808 #define I64LIT(x) (__int64)##x
809 #define UI64LIT(x) (unsigned __int64)##x
811 #elif defined(__CW32__)
813 typedef long long Int64;
814 typedef unsigned long long Uint64;
815 #define I64LIT(x) x##LL
816 #define UI64LIT(x) x##ULL
826 Defines a 64-bit signed integer type.
828 NOTE: For those migrating from versions of Symbian OS before 8.1b (i.e. 8.1a, 7.0s etc)
829 TInt64 is now defined as a built-in type instead of as a class type. This means
830 that the member functions of the old TInt64 class are no longer exported
831 from EUSER.LIB, and represents a compatibility break.
833 To ease migration of source code, a number of macros are provided. Similar
834 macros have also been defined in Symbian OS versions 7.0s and 8.1a, but
835 implemented in terms of the old TInt64 class. This is important for code that
836 is common to : one or both of these Symbian OS versions, and to 8.1b and
839 The following list shows the new macros and the functions that they replace.
840 It also shows some alternative techniques.
841 In this list: x, v and r are declared as TInt64, c is declared as TInt, High
842 and Low are declared as TUint.
845 OLD USAGE REPLACEMENT
847 TInt64(High,Low); MAKE_TINT64(High,Low);
848 x.Set(High,Low); MAKE_TINT64(High,Low);
850 x.High(); I64HIGH(x);
851 x.GetTInt(); I64INT(x);
852 x.GetTReal(); I64REAL(x);
853 x.Lsr(c); I64LSR(x,c);
855 x.MulTop(a); I64MULTOP(x,a);
856 x.DivMod(v,r); r=x%v; x/=v;
859 typedef Int64 TInt64;
868 Defines a 64-bit unsigned integer type.
870 typedef Uint64 TUint64;
875 /** @internalComponent */
876 #define _MAKE_TINT64_ZX(x) ((TInt64)((TUint32)(x)))
878 /** @internalComponent */
879 #define _MAKE_TUINT64_ZX(x) ((TUint64)((TUint32)(x)))
888 #define MAKE_TINT64(h,l) ( (_MAKE_TINT64_ZX(h)<<32) | _MAKE_TINT64_ZX(l) )
897 #define MAKE_TUINT64(h,l) ( (_MAKE_TUINT64_ZX(h)<<32) | _MAKE_TUINT64_ZX(l) )
906 Generates code to access the high order 32 bits of a 64 bit number.
908 #define I64HIGH(x) ( (TUint32)((x)>>32) )
917 Generates code to access the low order 32 bits of a 64 bit number.
919 #define I64LOW(x) ( (TUint32)(x) )
928 Generates code to cast a 64 bit value as an signed integer.
930 #define I64INT(x) ( (TInt)(x) )
939 Generates code to cast a 64 bit value as a TReal type.
941 #define I64REAL(x) ( (TReal)(x) )
950 Generates code to logically shift a 64 bit integer right.
952 #define I64LSR(x, shift) ( *reinterpret_cast<TUint64*>(&(x)) >>= (shift) )
960 Generates code to multiply a 64 bit integer by 10.
962 #define I64MUL10(x) ( (x) *= 10 )
970 Generates code to divide a 64 bit integer by another and find the remainder.
972 #define I64DIVMOD(x, divisor, remainder) ( ((remainder) = (x) % (divisor), (x) /= (divisor)) )
981 Generates code to cast a double to a 64 bit integer.
983 #define I64DOUBLECAST(x) ( static_cast<TInt64>(x) )
990 @deprecated Use _LIT8 instead.
994 The macro defines an explicit 8-bit constant literal which is suitable
995 for non-Unicode literal text, regardless of the build.
1001 #define _L8(a) (TPtrC8((const TText8 *)(a)))
1010 Defines an explicit 8-bit string which is suitable when non-Unicode text
1011 is required, regardless of the build.
1013 This is used by the deprecated literal descriptor _L8.
1015 #define _S8(a) ((const TText8 *)a)
1024 Constructs a constant literal descriptor of type TLitC8<TInt> with
1025 the specified name and text.
1027 The 8-bit build variant is generated for both non-Unicode and Unicode builds.
1029 @param name The name of the C++ variable to be generated.
1030 @param s The literal text enclosed within a pair of double quotes.
1034 #define _LIT8(name,s) const static TLitC8<sizeof(s)> name={sizeof(s)-1,s}
1041 @deprecated Use _LIT16 instead.
1045 The macro defines an explicit 16-bit constant literal which is suitable
1046 for Unicode literal text, regardless of the build.
1052 #define _L16(a) (TPtrC16((const TText16 *)L ## a))
1060 Defines an explicit 16-bit string which is suitable when Unicode text
1061 is required, regardless of the build.
1063 This is used by the deprecated literal descriptor _L16.
1065 #define _S16(a) ((const TText16 *)L ## a)
1074 Constructs a constant literal descriptor of type TLitC16<TInt> with
1075 the specified name and text.
1077 The 16-bit build variant is generated for both non-Unicode and Unicode builds.
1079 @param name The name of the C++ variable to be generated.
1080 @param s The literal text enclosed within a pair of double quotes.
1084 #define _LIT16(name,s) const static TLitC16<sizeof(L##s)/2> name={sizeof(L##s)/2-1,L##s}
1089 #if defined(_UNICODE) && !defined(__KERNEL_MODE__)
1094 Build independent general text character.
1096 In non-Unicode builds, this is mapped to TText8. In Unicode builds, this is
1097 mapped to TText16. Use the classes with explicit width only when you wish
1098 the width to be independent of the build variant.
1100 Use this class rather than TChar for general use.
1102 typedef TText16 TText;
1108 @deprecated Use _LIT instead.
1110 Build independent literal.
1112 The macro defines either an 8-bit constant literal (for non-Unicode text),
1113 or a 16-bit constant literal (for Unicode text) depending on the build.
1119 #define _L(a) (TPtrC((const TText *)L ## a))
1128 Defines either an 8-bit string (for non-Unicode text),
1129 or a 16-bit string (for Unicode text) depending on the build.
1131 This is used by the deprecated build independent literal _L.
1133 #define _S(a) ((const TText *)L ## a)
1142 Constructs a build independent constant literal descriptor of type TLitC<TInt>
1143 with the specified name and text.
1145 An 8-bit build variant is generated for a non-Unicode build;
1146 A 16-bit build variant is generated for a Unicode build.
1148 @param name The name of the C++ variable to be generated.
1149 @param s The literal text enclosed within a pair of double quotes.
1154 #define _LIT(name,s) const static TLitC<sizeof(L##s)/2> name={sizeof(L##s)/2-1,L##s}
1164 Build independent general text character.
1166 In non-Unicode builds, this is mapped to TText8. In Unicode builds, this is
1167 mapped to TText16. Use the classes with explicit width only when you wish
1168 the width to be independent of the build variant.
1170 Use this class rather than TChar for general use.
1172 typedef TText8 TText;
1180 @deprecated Use _LIT instead.
1182 Build independent literal.
1184 The macro defines either an 8-bit constant literal (for non-Unicode text),
1185 or a 16-bit constant literal (for Unicode text) depending on the build.
1191 #define _L(a) (TPtrC((const TText *)(a)))
1200 Defines either an 8-bit string (for non-Unicode text),
1201 or a 16-bit string (for Unicode text) depending on the build.
1203 This is used by the deprecated build independent literal _L.
1205 #define _S(a) ((const TText *)a)
1214 Constructs a build independent constant literal descriptor of type TLitC<TInt>
1215 with the specified name and text.
1217 An 8-bit build variant is generated for a non-Unicode build;
1218 A 16-bit build variant is generated for a Unicode build.
1220 @param name The name of the C++ variable to be generated.
1221 @param s The literal text enclosed within a pair of double quotes.
1226 #define _LIT(name,s) const static TLitC<sizeof(s)> name={sizeof(s)-1,s}
1232 #ifndef __VA_LIST_defined
1237 Defines a 'C' style array of pointers to TInt8 types.
1239 The type is most commonly used by code that needs to deal with a variable
1240 number of arguments passed to a function.
1244 typedef TInt8 *VA_LIST[1];
1251 Asserts that a condition is true.
1253 Code is generated for all builds.
1255 This macro is used as a C++ statement to assert the truth of some condition,
1256 and to take appropriate action if the condition is false. Unlike __ASSERT_DEBUG
1257 it is defined in both release and debug builds.
1259 The most common use for this macro is to check that the external environment of
1260 a function or class is behaving as expected; for example, that parameters
1261 passed to a function are credible, or that called functions are behaving as
1262 expected; the macro is commonly placed at the beginning of a function.
1264 The effect of the macro is to generate code which tests
1265 the conditional expression c; if the expression is false, then
1266 function p is called. In the majority of cases, the function p is one that
1269 Note that the macro definition is, in effect, equivalent to:
1275 @param c a conditional expression which results in true or false.
1276 @param p a function which is called if the conditional expression c is false.
1280 #define __ASSERT_ALWAYS(c,p) (void)((c)||(p,0))
1290 #define __BREAKPOINT() \
1292 __asm { byte 0xcc }; \
1299 #define __BREAKPOINT() \
1309 #define __BREAKPOINT()
1319 Asserts that a condition is true.
1321 Code is generated for debug builds only.
1323 This macro is used as a C++ statement to assert the truth of some condition,
1324 and to take appropriate action if the condition is false. It is used in
1325 the same way as __ASSERT_ALWAYS, except that it is only defined for debug builds.
1327 The macro may be used to insert extra checks at various points in source code
1328 as desired; the code will only be generated in debug builds and not in release
1331 @param c A conditional expression which results in true or false.
1332 @param p A function which is called if the conditional expression c is false.
1334 @see __ASSERT_ALWAYS
1336 #define __ASSERT_DEBUG(c,p) (void)((c)||(p,0))
1344 #define __DECLARE_NAME(t)
1353 Calls the function for testing object invariance.
1355 Classes can define a standard member function __DbgTestInvariant(),
1356 which checks that the object is in a valid state, and panics if it is not.
1357 In debug builds, this macro simply expands to call that function. For details on how
1358 to define __DbgTestInvariant(), and an example of its use, see __DECLARE_TEST.
1360 The macro is typically invoked at the beginning of all the member functions of
1361 the class. For non-const functions (those which can change the object’s state),
1362 you can ensure that the object has been left in a stable state by invoking
1363 the macro at the end of the function.
1365 In release builds, no code is generated for the macro.
1367 #define __TEST_INVARIANT __DbgTestInvariant()
1376 Marks the start of checking the current thread's heap.
1378 This macro is defined only for debug builds.
1380 This macro must be matched by a corresponding call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
1382 Calls to this macro can be nested but each call must be matched by corresponding
1383 call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
1385 @see User::__DbgMarkStart()
1386 @see __UHEAP_MARKEND
1387 @see __UHEAP_MARKENDC
1389 #define __UHEAP_MARK User::__DbgMarkStart(FALSE)
1398 Checks that the number of allocated cells at the current nested level on the
1399 current thread's heap is the same as the specified value.
1401 This macro is defined only for debug builds.
1403 The macro also takes the name of the file containing this source code statement
1404 and the line number of this source code statement; they are displayed as part
1405 of the panic category, if the checks fail.
1407 The macro assumes that:
1409 1. the heap being checked is a user heap
1411 2. checking is being done for the number of allocated cells at the current nested
1412 level; i.e. that aCountAll is set to false
1414 3. the line number is the line number of this source code statement.
1416 4. the file name is the full path name of the file containing this source statement
1418 @param aCount The number of heap cells expected to be allocated at
1419 the current nest level.
1421 @see User::__DbgMarkCheck()
1424 #define __UHEAP_CHECK(aCount) User::__DbgMarkCheck(FALSE,FALSE,aCount,(TText8*)__FILE__,__LINE__)
1433 Checks that the total number of allocated cells on the current thread's heap
1434 is the same as the specified value.
1436 This macro is defined only for debug builds.
1438 The macro also takes the name of the file containing this source code statement
1439 and the line number of this source code statement; they are displayed as part
1440 of the panic category, if the checks fail.
1442 @param aCount The total number of heap cells expected to be allocated.
1444 @see User::__DbgMarkCheck()
1445 @see __KHEAP_CHECKALL
1447 #define __UHEAP_CHECKALL(aCount) User::__DbgMarkCheck(FALSE,TRUE,aCount,(TText8*)__FILE__,__LINE__)
1456 Marks the end of checking the current thread's heap.
1458 The macro expects zero heap cells to remain allocated at the current nest
1459 level. This macro is defined only for debug builds.
1461 This macro must match an earlier call to __UHEAP_MARK.
1463 @see User::__DbgMarkEnd()
1466 #define __UHEAP_MARKEND User::__DbgMarkEnd(FALSE,0)
1475 Marks the end of checking the current thread's heap.
1477 The macro expects aCount heap cells to remain allocated at the current nest
1480 This macro must match an earlier call to __UHEAP_MARK.
1482 @param aCount The number of heap cells expected to remain allocated at
1483 the current nest level.
1485 @see User::__DbgMarkEnd()
1488 #define __UHEAP_MARKENDC(aCount) User::__DbgMarkEnd(FALSE,aCount)
1497 Simulates heap allocation failure for the current thread's heap.
1499 The failure occurs on the next call to new or any of the functions which
1500 allocate memory from the heap. This macro is defined only for debug builds.
1502 @param aCount Determines when the allocation will fail.
1503 Heap allocation fails on attempt number aCount - later
1504 allocations will succeed.
1505 For example, if aCount is 3, then heap allocation fails
1506 on the 3rd attempt, but all subsequent allocations succeed.
1508 @see User::__DbgSetAllocFail()
1510 #define __UHEAP_FAILNEXT(aCount) User::__DbgSetAllocFail(FALSE,RAllocator::EFailNext,aCount)
1516 Simulates heap allocation failure for the current thread's heap.
1518 The failures will occur for aBurst times from the next call to new or any of the functions which
1519 allocate memory from the heap. This macro is defined only for debug builds.
1521 @param aCount Determines when the allocation will fail.
1522 Heap allocation fails on attempt number aCount - later
1523 allocations will succeed.
1524 For example, if aCount is 3, then heap allocation fails
1525 on the 3rd attempt, but all subsequent allocations succeed.
1526 Note when used with RHeap the maximum value aCount can be set
1528 @param aBurst The number of consecutive allocations that will fail. Note
1529 when used with RHeap the maximum value aBurst can be set to
1532 @see User::__DbgSetBurstAllocFail()
1534 #define __UHEAP_BURSTFAILNEXT(aCount,aBurst) User::__DbgSetBurstAllocFail(FALSE,RAllocator::EBurstFailNext,aCount,aBurst)
1542 Simulates heap allocation failure for the current thread's heap.
1544 The failure occurs on subsequent calls to new or any of the functions which
1545 allocate memory from the heap. This macro is defined only for debug builds.
1547 @param aType The type of failure to be simulated.
1548 @param aRate The failure rate.
1550 @see User::__DbgSetAllocFail()
1551 @see RAllocator::TAllocFail
1553 #define __UHEAP_SETFAIL(aType,aRate) User::__DbgSetAllocFail(FALSE, aType, aRate)
1559 Simulates heap allocation failure for the current thread's heap.
1561 The failure occurs on subsequent calls to new or any of the functions which
1562 allocate memory from the heap. This macro is defined only for debug builds.
1564 @param aType The type of failure to be simulated.
1565 @param aRate The failure rate. Note when used with RHeap the maximum value
1566 aRate can be set to is KMaxTUint16.
1567 @param aBurst The number of consecutive allocations that will fail. Note
1568 when used with RHeap the maximum value aBurst can be set
1571 @see User::__DbgSetBurstAllocFail()
1572 @see RAllocator::TAllocFail
1574 #define __UHEAP_SETBURSTFAIL(aType,aRate,aBurst) User::__DbgSetBurstAllocFail(FALSE, aType, aRate, aBurst)
1582 Cancels simulated heap allocation failure for the current thread's heap.
1584 This macro is defined only for debug builds.
1586 @see User::__DbgSetAllocFail()
1588 #define __UHEAP_RESET User::__DbgSetAllocFail(FALSE,RAllocator::ENone,1)
1595 Cancels simulated heap allocation failure for the current thread's heap.
1596 It walks the the heap and sets the nesting level for all allocated
1599 This macro is defined only for debug builds.
1601 #define __UHEAP_TOTAL_RESET User::__DbgSetAllocFail(FALSE,RAllocator::EReset,1)
1607 Returns the number of heap allocation failures the current debug allocator fail
1608 function has caused so far.
1610 This is intended to only be used with fail types RAllocator::EFailNext,
1611 RAllocator::EBurstFailNext, RAllocator::EDeterministic and
1612 RAllocator::EBurstDeterministic. The return value is unreliable for
1613 all other fail types.
1615 @return The number of heap allocation failures the current debug fail
1616 function has caused.
1618 @see RAllocator::TAllocFail
1620 #define __UHEAP_CHECKFAILURE User::__DbgCheckFailure(FALSE)
1626 Returns the number of kernel heap allocation failures the current debug
1627 allocator fail function has caused so far.
1629 This is intended to only be used with fail types RAllocator::EFailNext,
1630 RAllocator::EBurstFailNext, RAllocator::EDeterministic and
1631 RAllocator::EBurstDeterministic. The return value is unreliable for
1632 all other fail types.
1634 @return The number of heap allocation failures the current debug fail
1635 function has caused.
1637 @see RAllocator::TAllocFail
1639 #define __KHEAP_CHECKFAILURE User::__DbgCheckFailure(TRUE)
1647 Marks the start of heap checking for the specific heap.
1649 This macro is defined only for debug builds.
1651 This macro must be matched by a corresponding call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
1653 Calls to this macro can be nested but each call must be matched by corresponding
1654 call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
1656 @param aHeap A pointer to the specific RHeap
1659 @see RAllocator::__DbgMarkStart()
1660 @see __RHEAP_MARKEND
1661 @see __RHEAP_MARKENDC
1663 #define __RHEAP_MARK(aHeap) (aHeap)->__DbgMarkStart()
1672 Checks that the number of allocated cells at the current nested level on the
1673 specified heap is the same as the specified value.
1675 The macro also takes the name of the file containing this source code statement
1676 and the line number of this source code statement; they are displayed as part
1677 of the panic category, if the checks fail.
1679 This macro is defined only for debug builds.
1681 @param aHeap A pointer to the specific RHeap.
1682 @param aCount The number of heap cells expected to be allocated at
1683 the current nest level.
1685 @see RAllocator::__DbgMarkCheck()
1687 #define __RHEAP_CHECK(aHeap,aCount) (aHeap)->__DbgMarkCheck(FALSE,aCount,(TText8*)__FILE__,__LINE__)
1696 Checks that the total number of allocated cells on the specified heap is the
1697 same as the specified value.
1699 The macro also takes the name of the file containing this source code statement
1700 and the line number of this source code statement; they are displayed as part
1701 of the panic category, if the checks fail.
1703 This macro is defined only for debug builds.
1705 @param aHeap A pointer to the specific RHeap.
1706 @param aCount The total number of heap cells expected to be allocated.
1708 @see RAllocator::__DbgMarkCheck()
1710 #define __RHEAP_CHECKALL(aHeap,aCount) (aHeap)->__DbgMarkCheck(TRUE,aCount,(TText8*)__FILE__,__LINE__)
1719 Marks the end of heap checking for the specific heap.
1721 The macro expects zero heap cells to remain allocated at the current nest
1722 level. This macro is defined only for debug builds.
1724 This macro must match an earlier call to __RHEAP_MARK.
1726 @param aHeap A pointer to the specific RHeap.
1728 @see RAllocator::__DbgMarkEnd()
1731 #define __RHEAP_MARKEND(aHeap) (aHeap)->__DbgMarkEnd(0)
1740 Marks the end of heap checking for the specific heap.
1742 The macro expects aCount heap cells to remain allocated at the current nest
1743 level. This macro is defined only for debug builds.
1745 This macro must match an earlier call to __RHEAP_MARK.
1747 @param aHeap A pointer to the specific RHeap.
1748 @param aCount The number of heap cells expected to remain allocated at
1749 the current nest level
1751 @see RAllocator::__DbgMarkEnd()
1754 #define __RHEAP_MARKENDC(aHeap,aCount) (aHeap)->__DbgMarkEnd(aCount)
1763 Simulates an allocation failure for the specific heap.
1765 The failure occurs on the next call to new or any of the functions which allocate
1766 memory from the heap. This macro is defined only for debug builds.
1768 @param aHeap A pointer to the specific RHeap.
1769 @param aCount The rate of failure - heap allocation fails every aCount attempt.
1771 @see RAllocator::__DbgSetAllocFail()
1773 #define __RHEAP_FAILNEXT(aHeap,aCount) (aHeap)->__DbgSetAllocFail(RAllocator::EFailNext,aCount)
1779 Simulates aBurst allocation failures for the specific heap.
1781 The failure occurs on the next call to new or any of the functions which allocate
1782 memory from the heap. This macro is defined only for debug builds.
1784 @param aHeap A pointer to the specific RHeap.
1785 @param aCount The heap allocation will fail after aCount-1 allocation attempts.
1786 Note when used with RHeap the maximum value aCount can be set
1788 @param aBurst The number of consecutive allocations that will fail. Note
1789 when used with RHeap the maximum value aBurst can be set
1792 @see RAllocator::__DbgSetBurstAllocFail()
1794 #define __RHEAP_BURSTFAILNEXT(aHeap,aCount,aBurst) (aHeap)->__DbgSetBurstAllocFail(RAllocator::EBurstFailNext,aCount, aBurst)
1802 Simulates an allocation failure for the specific heap.
1804 The failure occurs on subsequent calls to new or any of the functions which
1805 allocate memory from the heap. This macro is defined only for debug builds.
1807 @param aHeap A pointer to the specific RHeap.
1808 @param aType The type of failure to be simulated.
1809 @param aRate The failure rate.
1811 @see RAllocator::__DbgSetAllocFail()
1813 #define __RHEAP_SETFAIL(aHeap,aType,aRate) (aHeap)->__DbgSetAllocFail(aType,aRate)
1819 Simulates an allocation failure for the specific heap.
1821 The failure occurs on subsequent calls to new or any of the functions which
1822 allocate memory from the heap. This macro is defined only for debug builds.
1824 @param aHeap A pointer to the specific RHeap.
1825 @param aType The type of failure to be simulated.
1826 @param aRate The failure rate. Note when used with RHeap the maximum value
1827 aRate can be set to is KMaxTUint16.
1828 @param aBurst The number of consecutive allocations that will fail. Note
1829 when used with RHeap the maximum value aBurst can be set
1832 @see RAllocator::__DbgSetBurstAllocFail()
1834 #define __RHEAP_SETBURSTFAIL(aHeap,aType,aRate,aBurst) (aHeap)->__DbgSetBurstAllocFail(aType,aRate,aBurst)
1842 Cancels simulated allocation failure for the specific heap.
1844 This macro is defined only for debug builds.
1846 @param aHeap A pointer to the specific RHeap.
1848 @see RAllocator::__DbgSetAllocFail()
1850 #define __RHEAP_RESET(aHeap) (aHeap)->__DbgSetAllocFail(RAllocator::ENone,1)
1858 Cancels simulated allocation failure for the specific heap.
1859 It walks the the heap and sets the nesting level for all allocated
1862 This macro is defined only for debug builds.
1864 @param aHeap A pointer to the specific RHeap.
1866 @see RAllocator::__DbgSetAllocFail()
1868 #define __RHEAP_TOTAL_RESET(aHeap) (aHeap)->__DbgSetAllocFail(RAllocator::EReset,1)
1874 Returns the number of heap allocation failures the current debug allocator fail
1875 function has caused so far.
1877 This is intended to only be used with fail types RAllocator::EFailNext,
1878 RAllocator::EBurstFailNext, RAllocator::EDeterministic and
1879 RAllocator::EBurstDeterministic. The return value is unreliable for
1880 all other fail types.
1882 @return The number of heap allocation failures the current debug fail
1883 function has caused.
1885 @see RAllocator::TAllocFail
1887 #define __RHEAP_CHECKFAILURE(aHeap) (aHeap)->__DbgCheckFailure()
1890 #if defined (__WINS__)
1896 #define __DEBUGGER() {if (User::JustInTime()) __BREAKPOINT()}
1899 #define __DEBUGGER()
1903 #if defined(__DLL__)
1908 Declares a function for testing object invariance.
1910 For complex classes, it is often useful to provide a function that can
1911 be called to check that the object is in a valid state.
1912 The __DECLARE_TEST macro supplies a standard prototype for such a function
1913 named __DbgTestInvariant(). A companion macro __TEST_INVARIANT is provided
1914 to call the function.
1916 For DLLs, as opposed to EXEs, __DbgTestInvariant() is exported,
1917 i.e. the macro expands to:
1920 public: IMPORT_C void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
1923 This macro should placed as the last item in a class declaration (as it
1924 switches back to public access). Note that a terminating semi-colon must be used.
1926 You should define the __DbgTestInvariant() function to check that the object
1927 is in a healthy state. If it finds an error, it should call User::Invariant(),
1928 which will cause a panic.
1930 If a class is derived from a base class, then the base class __DbgTestInvariant()
1931 should be called first, and then any further checking done.
1933 The second function declared, __DbgTest(), is intended to allow test code a way
1934 of directly accessing non-public members of a class. The function is
1935 implemented by any test code that requires it, rather than in the class’s own
1936 source code. The function is therefore not exported.
1938 __DECLARE_TEST is defined for both debug and release builds. This point is
1939 particularly important for DLLs, as otherwise the exported interfaces would
1940 differ between the build versions, giving potential binary compatibility
1941 problems. To avoid using memory unnecessarily in release builds, you can,
1942 however, use preprocessor directives to define the code within
1943 __DbgTestInvariant() only for debug builds. __DbgTestInvariant() is never
1944 called in release builds.
1946 @see __TEST_INVARIANT
1948 #define __DECLARE_TEST public: IMPORT_C void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
1950 #define __DECLARE_TEST public: void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
1954 #define __ASSERT_DEBUG(c,p)
1955 #define __DECLARE_NAME(t)
1956 #define __TEST_INVARIANT
1957 #if defined(__DLL__)
1958 #define __DECLARE_TEST public: IMPORT_C void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
1960 #define __DECLARE_TEST public: void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
1970 Marks the start of checking the current thread's heap.
1972 This macro is defined only for debug builds.
1974 This macro must be matched by a corresponding call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
1976 Calls to this macro can be nested but each call must be matched by corresponding
1977 call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
1979 @see User::__DbgMarkStart()
1980 @see __UHEAP_MARKEND
1981 @see __UHEAP_MARKENDC
1983 #define __UHEAP_MARK
1992 Checks that the number of allocated cells at the current nested level on the
1993 current thread's heap is the same as the specified value.
1995 This macro is defined only for debug builds.
1997 The macro also takes the name of the file containing this source code statement
1998 and the line number of this source code statement; they are displayed as part
1999 of the panic category, if the checks fail.
2001 The macro assumes that:
2003 1. the heap being checked is a user heap
2005 2. checking is being done for the number of allocated cells at the current nested
2006 level; i.e. that aCountAll is set to false
2008 3. the line number is the line number of this source code statement.
2010 4. the file name is the full path name of the file containing this source statement
2012 @param aCount The number of heap cells expected to be allocated at
2013 the current nest level.
2015 @see User::__DbgMarkCheck()
2018 #define __UHEAP_CHECK(aCount)
2027 Checks that the total number of allocated cells on the current thread's heap
2028 is the same as the specified value.
2030 This macro is defined only for debug builds.
2032 The macro also takes the name of the file containing this source code statement
2033 and the line number of this source code statement; they are displayed as part
2034 of the panic category, if the checks fail.
2036 @param aCount The total number of heap cells expected to be allocated.
2038 @see User::__DbgMarkCheck()
2039 @see __KHEAP_CHECKALL
2041 #define __UHEAP_CHECKALL(aCount)
2050 Marks the end of checking the current thread's heap.
2052 The macro expects zero heap cells to remain allocated at the current nest
2053 level. This macro is defined only for debug builds.
2055 This macro must match an earlier call to __UHEAP_MARK.
2057 @see User::__DbgMarkEnd()
2060 #define __UHEAP_MARKEND
2069 Marks the end of checking the current thread's heap.
2071 The macro expects aCount heap cells to remain allocated at the current nest
2074 This macro must match an earlier call to __UHEAP_MARK.
2076 @param aCount The number of heap cells expected to remain allocated at
2077 the current nest level.
2079 @see User::__DbgMarkEnd()
2082 #define __UHEAP_MARKENDC(aCount)
2091 Simulates heap allocation failure for the current thread's heap.
2093 The failure occurs on the next call to new or any of the functions which
2094 allocate memory from the heap. This macro is defined only for debug builds.
2096 @param aCount Determines when the allocation will fail.
2097 Heap allocation fails on attempt number aCount - later
2098 allocations will succeed.
2099 For example, if aCount is 3, then heap allocation fails
2100 on the 3rd attempt, but all subsequent allocations succeed.
2102 @see User::__DbgSetAllocFail()
2104 #define __UHEAP_FAILNEXT(aCount)
2110 Simulates heap allocation failure for the current thread's heap.
2112 The failures will occur for aBurst times from the next call to new or any of the functions which
2113 allocate memory from the heap. This macro is defined only for debug builds.
2115 @param aCount Determines when the allocation will fail.
2116 Heap allocation fails on attempt number aCount - later
2117 allocations will succeed.
2118 For example, if aCount is 3, then heap allocation fails
2119 on the 3rd attempt, but all subsequent allocations succeed.
2120 Note when used with RHeap the maximum value aBurst can be
2121 set to is KMaxTUint16.
2122 @param aBurst The number of consecutive allocations that will fail. Note
2123 when used with RHeap the maximum value aBurst can be set
2126 @see User::__DbgSetBurstAllocFail()
2128 #define __UHEAP_BURSTFAILNEXT(aCount,aBurst)
2136 Simulates heap allocation failure for the current thread's heap.
2138 The failure occurs on subsequent calls to new or any of the functions which
2139 allocate memory from the heap. This macro is defined only for debug builds.
2141 @param aType The type of failure to be simulated.
2142 @param aRate The failure rate.
2144 @see User::__DbgSetAllocFail()
2146 #define __UHEAP_SETFAIL(aType,aRate)
2152 Simulates heap allocation failure for the current thread's heap.
2154 The failure occurs on subsequent calls to new or any of the functions which
2155 allocate memory from the heap. This macro is defined only for debug builds.
2157 @param aType The type of failure to be simulated.
2158 @param aRate The failure rate. Note when used with RHeap the maximum value
2159 aRate can be set to is KMaxTUint16.
2160 @param aBurst The number of consecutive allocations that will fail. Note
2161 when used with RHeap the maximum value aBurst can be set
2164 @see User::__DbgSetBurstAllocFail()
2165 @see RAllocator::TAllocFail
2167 #define __UHEAP_SETBURSTFAIL(aType,aRate,aBurst)
2175 Cancels simulated heap allocation failure for the current thread's heap.
2177 This macro is defined only for debug builds.
2179 @see User::__DbgSetAllocFail()
2181 #define __UHEAP_RESET
2189 Cancels simulated heap allocation failure for the current thread's heap.
2190 It walks the the heap and sets the nesting level for all allocated
2193 This macro is defined only for debug builds.
2195 #define __UHEAP_TOTAL_RESET
2201 Returns the number of heap allocation failures the current debug allocator fail
2202 function has caused so far.
2204 This is intended to only be used with fail types RAllocator::EFailNext,
2205 RAllocator::EBurstFailNext, RAllocator::EDeterministic and
2206 RAllocator::EBurstDeterministic. The return value is unreliable for
2207 all other fail types.
2209 @return The number of heap allocation failures the current debug fail
2210 function has caused.
2212 @see RAllocator::TAllocFail
2214 #define __UHEAP_CHECKFAILURE ((TUint)0)
2220 Returns the number of kernel heap allocation failures the current debug
2221 allocator fail function has caused so far.
2223 This is intended to only be used with fail types RAllocator::EFailNext,
2224 RAllocator::EBurstFailNext, RAllocator::EDeterministic and
2225 RAllocator::EBurstDeterministic. The return value is unreliable for
2226 all other fail types.
2228 @return The number of heap allocation failures the current debug fail
2229 function has caused.
2231 @see RAllocator::TAllocFail
2233 #define __KHEAP_CHECKFAILURE ((TUint)0)
2239 Marks the start of heap checking for the specific heap.
2241 This macro is defined only for debug builds.
2243 This macro must be matched by a corresponding call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
2245 Calls to this macro can be nested but each call must be matched by corresponding
2246 call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
2248 @param aHeap A pointer to the specific RHeap
2251 @see RAllocator::__DbgMarkStart()
2252 @see __RHEAP_MARKEND
2253 @see __RHEAP_MARKENDC
2255 #define __RHEAP_MARK(aHeap)
2264 Checks that the number of allocated cells at the current nested level on the
2265 specified heap is the same as the specified value.
2267 The macro also takes the name of the file containing this source code statement
2268 and the line number of this source code statement; they are displayed as part
2269 of the panic category, if the checks fail.
2271 This macro is defined only for debug builds.
2273 @param aHeap A pointer to the specific RHeap.
2274 @param aCount The number of heap cells expected to be allocated at
2275 the current nest level.
2277 @see RAllocator::__DbgMarkCheck()
2279 #define __RHEAP_CHECK(aHeap,aCount)
2288 Checks that the total number of allocated cells on the specified heap is the
2289 same as the specified value.
2291 The macro also takes the name of the file containing this source code statement
2292 and the line number of this source code statement; they are displayed as part
2293 of the panic category, if the checks fail.
2295 This macro is defined only for debug builds.
2297 @param aHeap A pointer to the specific RHeap.
2298 @param aCount The total number of heap cells expected to be allocated.
2300 @see RAllocator::__DbgMarkCheck()
2302 #define __RHEAP_CHECKALL(aHeap,aCount)
2311 Marks the end of heap checking for the specific heap.
2313 The macro expects zero heap cells to remain allocated at the current nest
2314 level. This macro is defined only for debug builds.
2316 This macro must match an earlier call to __RHEAP_MARK.
2318 @param aHeap A pointer to the specific RHeap.
2320 @see RAllocator::__DbgMarkEnd()
2323 #define __RHEAP_MARKEND(aHeap)
2332 Marks the end of heap checking for the specific heap.
2334 The macro expects aCount heap cells to remain allocated at the current nest
2335 level. This macro is defined only for debug builds.
2337 This macro must match an earlier call to __RHEAP_MARK.
2339 @param aHeap A pointer to the specific RHeap.
2340 @param aCount The number of heap cells expected to remain allocated at
2341 the current nest level
2343 @see RAllocator::__DbgMarkEnd()
2346 #define __RHEAP_MARKENDC(aHeap,aCount)
2355 Simulates an allocation failure for the specific heap.
2357 The failure occurs on the next call to new or any of the functions which allocate
2358 memory from the heap. This macro is defined only for debug builds.
2360 @param aHeap A pointer to the specific RHeap.
2361 @param aCount The rate of failure - heap allocation fails every aCount attempt.
2363 @see RAllocator::__DbgSetAllocFail()
2365 #define __RHEAP_FAILNEXT(aHeap,aCount)
2371 Simulates aBurst allocation failures for the specific heap.
2373 The failure occurs on the next call to new or any of the functions which allocate
2374 memory from the heap. This macro is defined only for debug builds.
2376 @param aHeap A pointer to the specific RHeap.
2377 @param aCount The heap allocation will fail after aCount-1 allocation attempts.
2378 Note when used with RHeap the maximum value aCount can be set
2380 @param aBurst The number of consecutive allocations that will fail. Note
2381 when used with RHeap the maximum value aBurst can be set
2384 @see RAllocator::__DbgSetBurstAllocFail()
2386 #define __RHEAP_BURSTFAILNEXT(aHeap,aCount,aBurst)
2394 Simulates an allocation failure for the specific heap.
2396 The failure occurs on subsequent calls to new or any of the functions which
2397 allocate memory from the heap. This macro is defined only for debug builds.
2399 @param aHeap A pointer to the specific RHeap.
2400 @param aType The type of failure to be simulated.
2401 @param aRate The failure rate.
2403 @see RAllocator::__DbgSetAllocFail()
2405 #define __RHEAP_SETFAIL(aHeap,aType,aRate)
2411 Simulates an allocation failure for the specific heap.
2413 The failure occurs on subsequent calls to new or any of the functions which
2414 allocate memory from the heap. This macro is defined only for debug builds.
2416 @param aHeap A pointer to the specific RHeap.
2417 @param aType The type of failure to be simulated.
2418 @param aRate The failure rate. Note when used with RHeap the maximum value
2419 aRate can be set to is KMaxTUint16.
2420 @param aBurst The number of consecutive allocations that will fail. Note
2421 when used with RHeap the maximum value aBurst can be set
2424 @see RAllocator::__DbgSetBurstAllocFail()
2426 #define __RHEAP_SETBURSTFAIL(aHeap,aType,aRate,aBurst)
2434 Cancels simulated allocation failure for the specific heap.
2436 This macro is defined only for debug builds.
2438 @param aHeap A pointer to the specific RHeap.
2440 @see RAllocator::__DbgSetAllocFail()
2442 #define __RHEAP_RESET(aHeap)
2450 Cancels simulated allocation failure for the specific heap.
2451 It walks the the heap and sets the nesting level for all allocated
2454 This macro is defined only for debug builds.
2456 @param aHeap A pointer to the specific RHeap.
2458 @see RAllocator::__DbgSetAllocFail()
2460 #define __RHEAP_TOTAL_RESET(aHeap)
2467 Returns the number of heap allocation failures the current debug allocator fail
2468 function has caused so far.
2470 This is intended to only be used with fail types RAllocator::EFailNext,
2471 RAllocator::EBurstFailNext, RAllocator::EDeterministic and
2472 RAllocator::EBurstDeterministic. The return value is unreliable for
2473 all other fail types.
2475 @return The number of heap allocation failures the current debug fail
2476 function has caused.
2478 @see RAllocator::TAllocFail
2480 #define __RHEAP_CHECKFAILURE(aHeap) ((TUint)0)
2482 #define __DEBUGGER()
2485 #if defined (__WINS__)
2486 /** @internalTechnology */
2487 #define __EMULATOR_IMAGE_HEADER2(aUid0,aUid1,aUid2,aPriority,aCap0,aCap1,aSid,aVid,aVer,aFlags) TEmulatorImageHeader uid={{aUid0,aUid1,aUid2},aPriority,{aSid,aVid,{aCap0,aCap1}},0,0,aVer,aFlags};
2488 /** @internalTechnology */
2489 #define __EMULATOR_IMAGE_HEADER(aUid0,aUid1,aUid2,aPriority,aCap,aFlags) TEmulatorImageHeader uid={{aUid0,aUid1,aUid2},aPriority,{aUid2,0,{aCap,0}},0,0,0x00010000u,aFlags};
2491 #define __EMULATOR_IMAGE_HEADER2(aUid0,aUid1,aUid2,aPriority,aCap0,aCap1,aSid,aVer,aFlags)
2492 #define __EMULATOR_IMAGE_HEADER(aUid0,aUid1,aUid2,aPriority,aCap,aFlags)
2495 #if defined(_UNICODE)
2496 #if !defined(UNICODE)
2505 #if !defined(ASSERT)
2510 Generates _ASSERT_DEBUG code that calls User::Invariant() if the specified
2511 condition is not true.
2513 @param x A conditional expression which results in true or false.
2515 #define ASSERT(x) __ASSERT_DEBUG(x,User::Invariant())
2526 #define __DEBUG_ONLY(x) x
2528 #define __DEBUG_ONLY(x)
2534 #ifdef __KERNEL_MODE__
2536 /** @internalComponent */
2537 #define KIMPORT_C IMPORT_C
2539 /** @internalComponent */
2540 #define KEXPORT_C EXPORT_C
2542 /** @internalComponent */
2545 /** @internalComponent */
2550 #define UIMPORT_C IMPORT_C
2551 #define UEXPORT_C EXPORT_C
2561 Asserts that a condition is true at compilation time.
2563 @param x Condition to assert
2565 #define __ASSERT_COMPILE(x) void __compile_time_assert(int __check[(x)?1:-1])
2567 #ifdef __REMOVE_PLATSEC_DIAGNOSTICS__
2572 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
2573 #define __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
2574 #endif /*__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__*/
2575 #endif /*__REMOVE_PLATSEC_DIAGNOSTICS__*/
2580 static const char* const KSuppressPlatSecDiagnosticMagicValue = (const char*)1;
2582 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
2586 #define __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER(l) #l
2590 #define __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER2(f,l) f "(" __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER(l) ")"
2595 #define __PLATSEC_DIAGNOSTIC_FILE_AND_LINE __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER2(__FILE__,__LINE__)
2601 A macro that should be used to enclose a platform security diagnostic
2602 'C' style string that can be passed to a capability checking function such
2603 as RThread::HasCapability() and Kern::CurrentThreadHasCapability().
2605 The content of the string is emitted if the capability test finds that
2606 the capability is not present.
2608 The macro provides a convenient mechanism that allows the strings to
2609 be removed from future versions of Symbian OS.
2614 if(!Kern::CurrentThreadHasCapability(ECapabilityPowerMgmt,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetState")))
2616 return KErrPermissionDenied;
2620 In this example, the string:
2623 Checked by Hal function EDisplayHalSetState
2626 is emitted if the calling process does not have the ECapabilityPowerMgmt capability.
2628 @param s A C-style string.
2630 @see RProcess::HasCapability()
2631 @see RThread::HasCapability()
2632 @see RMessagePtr2::HasCapability()
2633 @see User::CreatorHasCapability()
2635 #define __PLATSEC_DIAGNOSTIC_STRING(s) s
2638 When this value is used in Platform Security APIs as the value for the aDiagnosticText
2639 argument, these APIs will not emit any form of diagnostic message.
2643 // Note this value is the same as KSuppressPlatSecDiagnosticMagicValue
2644 // and used to be a set by it but that caused an error with GCCE compiler
2645 static const char* const KSuppressPlatSecDiagnostic = (const char*)1;
2647 #else /* __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ */
2649 #define __PLATSEC_DIAGNOSTIC_STRING(s) NULL
2651 #ifndef __KERNEL_MODE__
2652 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
2654 When this value is used in Platform Security APIs as the value for the aDiagnostic
2655 argument, these APIs will not emit any form of diagnostic message.
2659 #define KSuppressPlatSecDiagnostic NULL, NULL
2661 #else /* __REMOVE_PLATSEC_DIAGNOSTICS__ */
2664 When this value is used in Platform Security APIs as the value for the aDiagnostic
2665 argument, these APIs will not emit any form of diagnostic message.
2669 #define KSuppressPlatSecDiagnostic NULL
2671 #endif /* !__REMOVE_PLATSEC_DIAGNOSTICS__ */
2672 #endif /* !__KERNEL_MODE__ */
2673 #endif /* !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ */
2676 * MSVC operator new and operator new[] header guards
2678 #ifdef __PLACEMENT_NEW
2679 #define __PLACEMENT_NEW_INLINE
2680 #endif /* __PLACEMENT_NEW */
2682 #if defined(__VC32__) && (_MSC_VER < 1300)
2683 #define __PLACEMENT_VEC_NEW_INLINE
2684 #define __OMIT_VEC_OPERATOR_NEW_DECL__
2685 #endif /* version of MSVC that doesn't support overloaded operator new[] */
2688 Calling convention qualifier for functions involving floating point
2689 variables passed or returned by value.
2695 #endif /* __SOFTFP */
2697 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
2698 #include <e32def_private.h>
2701 #endif /* __E32DEF_H__ */