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