e32def.inc 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865
  1. {%MainUnit ../symbian.pas}
  2. {
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2007 by contributors of the Free Pascal Compiler
  5. This file is a pascal translation of the Symbian OS headers
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. { e32\include\e32def.h
  13. *
  14. * Copyright (c) Symbian Software Ltd 1994-2005. All rights reserved.
  15. *
  16. * NOTE: THIS FILE SHOULD BE ACCEPTABLE TO A C COMPILER
  17. }
  18. {
  19. * __LEAVE_EQUALS_THROW__ requires the compiler to support C++ exceptions
  20. }
  21. {#ifndef __SUPPORT_CPP_EXCEPTIONS__
  22. #undef __LEAVE_EQUALS_THROW__
  23. #endif}
  24. {#ifdef __PROFILING__
  25. /**
  26. @publishedPartner
  27. @removed
  28. */
  29. #define __PROFILE_START(aBin) RDebug::ProfileStart(aBin)
  30. /**
  31. @publishedPartner
  32. @removed
  33. */
  34. #define __PROFILE_END(aBin) RDebug::ProfileEnd(aBin)
  35. /**
  36. @publishedPartner
  37. @removed
  38. */
  39. #define __PROFILE_RESET(aNumberOfBins) RDebug::ProfileReset(0,aNumberOfBins)
  40. /**
  41. @publishedPartner
  42. @removed
  43. */
  44. #define __PROFILE_DISPLAY(aNumberOfBins) \
  45. begin TFixedArray<TProfile, aNumberOfBins> result; \
  46. RDebug::ProfileResult(result.Begin(), 0, aNumberOfBins); \
  47. for (TInt i=0; i<aNumberOfBins; i++) \
  48. RDebug::Print(_L("Profile bin %d: Calls: %d, Clock ticks: %d\n" ),i,res[i].iCount,result[i].iTime); \
  49. end
  50. #else /* __PROFILING__ */
  51. #define __PROFILE_START(aBin)
  52. #define __PROFILE_END(aBin)
  53. #define __PROFILE_RESET(aNumberOfBins)
  54. #define __PROFILE_DISPLAY(aNumberOfBins)
  55. #endif}
  56. {#if defined(__VC32__)
  57. /**
  58. @publishedAll
  59. @released
  60. */
  61. #define __NO_CLASS_CONSTS__
  62. #if (_MSC_VER >= 1200)
  63. /**
  64. @publishedAll
  65. @released
  66. */
  67. #define __NORETURN__ __declspec(noreturn)
  68. #else
  69. #define __NORETURN__
  70. #endif
  71. /**
  72. @publishedAll
  73. @released
  74. */
  75. #define __NORETURN_TERMINATOR()
  76. /**
  77. @publishedAll
  78. @released
  79. */
  80. #define IMPORT_C __declspec(dllexport)
  81. /**
  82. @publishedAll
  83. @released
  84. */
  85. #define EXPORT_C __declspec(dllexport)
  86. /**
  87. @publishedAll
  88. @released
  89. */
  90. #define NONSHARABLE_CLASS(x) class x
  91. /**
  92. @publishedAll
  93. @released
  94. */
  95. #define NONSHARABLE_STRUCT(x) struct x
  96. /**
  97. @publishedAll
  98. @released
  99. */
  100. #define __NO_THROW throw()
  101. /**
  102. @publishedAll
  103. @released
  104. */
  105. #define __THROW(t) throw(t)
  106. #pragma warning( disable : 4355 ) /* 'this' used in base member initializer list */
  107. #pragma warning( disable : 4511 ) /* copy constructor could not be generated */
  108. #pragma warning( disable : 4512 ) /* assignment operator could not be generated */
  109. #pragma warning( disable : 4514 ) /* unreferenced inline function has been removed */
  110. #pragma warning( disable : 4699 ) /* Note: Using precompiled header %s */
  111. #pragma warning( disable : 4710 ) /* function not inlined */
  112. #pragma warning( disable : 4121 ) /* alignment sensitive to packing */
  113. #pragma warning( disable : 4273 )
  114. #pragma warning( disable : 4097 ) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */
  115. #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 */
  116. #if _MSC_VER >= 1100
  117. /**
  118. @publishedAll
  119. @released
  120. */
  121. #define TEMPLATE_SPECIALIZATION template<>
  122. #else
  123. #define TEMPLATE_SPECIALIZATION
  124. #endif
  125. #endif}
  126. {#if defined(__CW32__)
  127. #undef __embedded_cplusplus
  128. /** @internalTechnology */
  129. #define __embedded_cplusplus 1
  130. #define __NO_CLASS_CONSTS__
  131. #define __NORETURN__
  132. #define __NORETURN_TERMINATOR()
  133. #define IMPORT_C __declspec(dllexport)
  134. #define EXPORT_C __declspec(dllexport)
  135. #define NONSHARABLE_CLASS(x) class x
  136. #define NONSHARABLE_STRUCT(x) struct x
  137. #define __NO_THROW throw()
  138. #define __THROW(t) throw(t)
  139. #define TEMPLATE_SPECIALIZATION template<>
  140. /**
  141. @publishedAll
  142. @released
  143. */
  144. #define _asm asm
  145. #ifndef __int64
  146. #pragma longlong on
  147. /** @internalTechnology */
  148. #define __int64 long long
  149. #endif
  150. #ifndef __SUPPORT_CPP_EXCEPTIONS__
  151. #pragma exceptions off /* no support for C++ exception handling */
  152. #pragma RTTI off /* no support for C++ runtime type information */
  153. #endif
  154. #if __MWERKS__ >= 0x3200
  155. #pragma warning off (10480) /* deleteing void pointer is undefined */
  156. #pragma warning off (10350) /* N pad byte(s) inserted after data member */
  157. #endif
  158. #endif}
  159. {#if defined(__GCC32__)
  160. #define __NO_CLASS_CONSTS__
  161. #define __NORETURN__ __attribute__ ((noreturn))
  162. #ifdef __GCCV3__
  163. #define __NORETURN_TERMINATOR()
  164. #else
  165. #define __NORETURN_TERMINATOR() abort()
  166. #endif
  167. #define IMPORT_C
  168. #if !defined __WINS__ && defined _WIN32 /* VC++ Browser Hack */
  169. #define EXPORT_C
  170. /** @internalTechnology */
  171. #define asm(x)
  172. #else
  173. #define EXPORT_C __declspec(dllexport)
  174. #endif
  175. #define NONSHARABLE_CLASS(x) class x
  176. #define NONSHARABLE_STRUCT(x) struct x
  177. #define __NO_THROW
  178. #define __THROW(t)
  179. #ifdef __EABI__
  180. #define TEMPLATE_SPECIALIZATION template<>
  181. #else
  182. #define TEMPLATE_SPECIALIZATION
  183. #endif
  184. #endif}
  185. {#ifdef __GCC32__
  186. /**
  187. @publishedAll
  188. @released
  189. */
  190. #define __DOUBLE_WORDS_SWAPPED__
  191. #endif}
  192. { @internalTechnology }
  193. {#define __NO_MUTABLE_KEYWORD
  194. #if defined(__NO_MUTABLE_KEYWORD)
  195. /**
  196. @publishedAll
  197. @deprecated
  198. */
  199. #define __MUTABLE
  200. #else
  201. #define __MUTABLE mutable
  202. #endif}
  203. {/**
  204. @publishedAll
  205. @deprecated
  206. */
  207. #define CONST_CAST(type,exp) (const_cast<type>(exp))
  208. /**
  209. @publishedAll
  210. @deprecated
  211. */
  212. #define STATIC_CAST(type,exp) (static_cast<type>(exp))
  213. /**
  214. @publishedAll
  215. @deprecated
  216. */
  217. #define REINTERPRET_CAST(type,exp) (reinterpret_cast<type>(exp))
  218. #if defined(__NO_MUTABLE_KEYWORD)
  219. /**
  220. @publishedAll
  221. @deprecated
  222. */
  223. #define MUTABLE_CAST(type,exp) (const_cast<type>(exp))
  224. #else
  225. #define MUTABLE_CAST(type,exp) (exp)
  226. #endif
  227. /**
  228. @publishedAll
  229. @deprecated
  230. */
  231. #define GLREF_D extern
  232. /**
  233. @publishedAll
  234. @deprecated
  235. */
  236. #define GLDEF_D
  237. /**
  238. @publishedAll
  239. @deprecated
  240. */
  241. #define LOCAL_D static
  242. /**
  243. @publishedAll
  244. @deprecated
  245. */
  246. #define GLREF_C extern
  247. /**
  248. @publishedAll
  249. @deprecated
  250. */
  251. #define GLDEF_C
  252. /**
  253. @publishedAll
  254. @deprecated
  255. */
  256. #define LOCAL_C static
  257. /**
  258. @publishedAll
  259. @deprecated
  260. */
  261. #define FOREVER for(;;)}
  262. {/**
  263. @publishedAll
  264. @released
  265. Symbolic definition for a true value.
  266. */
  267. #define TRUE 1}
  268. {/**
  269. @publishedAll
  270. @released
  271. Symbolic definition for a false value.
  272. */
  273. #define FALSE 0
  274. #ifndef NULL}
  275. {/**
  276. @publishedAll
  277. @released
  278. Symbolic definition for a NULL value.
  279. */
  280. #define NULL 0
  281. #endif}
  282. {#ifndef VA_START
  283. /**
  284. @publishedAll
  285. @released
  286. A macro used by Symbian OS code for handling a variable argument list
  287. in a function call.
  288. Sets a pointer to point to the first of the variable arguments.
  289. Typical usage:
  290. @code
  291. Foo(CAbcdef aAbcdef,...)
  292. {
  293. VA_LIST list;
  294. VA_START(list, aAbcdef);
  295. // other code
  296. }
  297. @endcode
  298. @param ap A pointer used to hold the address of an argument in
  299. the variable argument list. After execution of the code generated
  300. by this macro, the pointer points to the first argument in
  301. the variable argument list.
  302. This symbol is usually declared as a VA_LIST type.
  303. @param pn The argument that immediately precedes the variable argument list.
  304. @see VA_LIST
  305. @see VA_ARG
  306. */
  307. #define VA_START(ap,pn) ((ap)[0]=(TInt8 *)&pn+((sizeof(pn)+sizeof(TInt)-1)&~(sizeof(TInt)-1)),(void)0)
  308. #endif}
  309. {#ifndef VA_ARG
  310. /**
  311. @publishedAll
  312. @released
  313. A macro used by Symbian OS code for handling a variable argument list
  314. in a function call.
  315. Increments a pointer to a variable argument list to point to the next argument
  316. in the list. The current argument is assumed to be of a type defined by
  317. the second parameter to this macro.
  318. Typical usage:
  319. @code
  320. Foo(CAbcdef aAbcdef,...)
  321. {
  322. VA_LIST list;
  323. VA_START(list, aAbcdef);
  324. ...
  325. TInt x = VA_ARG(list,TInt);
  326. ...
  327. const TDesC *pS=VA_ARG(aList,const TDesC*);
  328. ...
  329. etc
  330. }
  331. @endcode
  332. @param ap A pointer used to hold the address of an argument in
  333. the variable argument list. It is assumed to point to the current
  334. argument in the variable argument list. After execution of the code
  335. generated by this macro, the pointer points to the next argument in
  336. the list. This symbol is usually declared as a VA_LIST type.
  337. @param type The type of the current argument.
  338. This can be any valid type, for example, TInt, const TDesC*, etc.
  339. @see VA_LIST
  340. @see VA_START
  341. */
  342. #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)))))
  343. #endif }
  344. {#ifndef VA_END
  345. /**
  346. @publishedAll
  347. @released
  348. A macro used by Symbian OS code for handling a variable argument list
  349. in a function call.
  350. Sets a pointer to zero.
  351. @param ap A pointer used to hold the address of an argument in
  352. the variable argument list. After execution of the code generated
  353. by this macro, the pointer is reset to 0.
  354. This symbol is usually declared as a VA_LIST type.
  355. @see VA_LIST
  356. @see VA_START
  357. @see VA_ARG
  358. */
  359. #define VA_END(ap) ((ap)[0]=0,(void)0)
  360. #endif}
  361. {/**
  362. @publishedAll
  363. @released
  364. Calculates the offset of member f within class c.
  365. This is used in the TSglQue and TDblQue constructors to set the offset of
  366. the link object from the start of a list element.
  367. @param c The name of the class.
  368. @param f The name of the member within the specified class.
  369. @see TSglQue
  370. @see TDblQue
  371. */
  372. #define _FOFF(c,f) (((TInt)&(((c *)0x1000)->f))-0x1000)
  373. /**
  374. @internalTechnology
  375. @released
  376. */
  377. #define _ALIGN_DOWN(x,a) ((x)&~((a)-1))
  378. /**
  379. @internalTechnology
  380. @released
  381. */
  382. #define _ALIGN_UP(x,a) _ALIGN_DOWN((x)+(a)-1, a)
  383. }
  384. {
  385. @publishedAll
  386. @released
  387. Pointer to any type.
  388. TAny* is equivalent to void* in standard C or C++. TAny* is used in preference
  389. to void* because it is more suggestive of the actual meaning,
  390. e.g. TAny* foo();.
  391. TAny is not used where it really means "nothing", as in the declaration of
  392. functions which do not return a value; void is used instead, e.g. void Foo();.
  393. }
  394. type TAny = Pointer;
  395. {
  396. @publishedAll
  397. @released
  398. 8-bit signed integer type, used in Symbian OS to mean an 8-bit
  399. unsigned integer, independent of the implementation.
  400. }
  401. type TInt8 = Byte;
  402. {
  403. @publishedAll
  404. @released
  405. 8-bit unsigned integer type; used in Symbian OS to mean an 8-bit
  406. unsigned integer, independent of the implementation.
  407. }
  408. type TUint8 = Char;
  409. {
  410. @publishedAll
  411. @released
  412. 16-bit signed integer type, used in Symbian OS to mean a 16-bit
  413. unsigned integer, independent of the implementation.
  414. }
  415. type TInt16 = ShortInt;
  416. {
  417. @publishedAll
  418. @released
  419. 16-bit unsigned integer type. used in Symbian OS to mean a 16-bit
  420. unsigned integer, independent of the implementation.
  421. }
  422. type TUint16 = Word;
  423. {
  424. @publishedAll
  425. @released
  426. 32-bit signed integer type, used in Symbian OS to mean a 32-bit
  427. unsigned integer, independent of the implementation.
  428. }
  429. type TInt32 = Integer;
  430. {
  431. @publishedAll
  432. @released
  433. 32-bit unsigned integer type; used in Symbian OS to mean a 32-bit
  434. unsigned integer, independent of the implementation.
  435. }
  436. type TUint32 = Cardinal;
  437. {
  438. @publishedAll
  439. @released
  440. Signed integer type of the natural machine word length.
  441. This is as defined by the C++ implementation's int type. In all
  442. implementations, this is guaranteed to be at least 32 bits.
  443. A TInt should be used in preference to a sized integer (TInt32, TInt16) for
  444. all general use. Sized integers should only be used when packing is essential.
  445. C++'s type conversion rules imply that all sized integers smaller than the
  446. natural machine word are in any case broadened to the natural machine word
  447. size when passed as function parameters.
  448. A TInt should be used in preference to an unsigned integer (TUint) for all
  449. general use. Unsigned integers should only be used for flags (which use Boolean
  450. operations but not arithmetic) and, in very rare cases, for numbers whose
  451. range exceeds that available from signed integers. Although it is natural
  452. to attempt to use unsigned integers for quantities which cannot by nature
  453. be negative, the C++ language does not provide the support necessary to enforce
  454. the "expected" behaviour in these circumstances, and experience has shown
  455. that it is better to use signed integers unless there is good reason not to.
  456. @see TUint
  457. @see TInt32
  458. @see TInt16
  459. }
  460. type TInt = cint;
  461. {
  462. @publishedAll
  463. @released
  464. Unsigned integer type of the natural machine word length.
  465. This is guaranteed to be at least 32 bits in all implementations.
  466. In almost all circumstances, a TInt should be used in preference to a TUint.
  467. The main exception is in flags bytes.
  468. @see TInt
  469. }
  470. type TUint = cuint;
  471. {
  472. @publishedAll
  473. @released
  474. 32-bit floating point number, providing IEEE754 single precision on all Symbian
  475. OS implementations.
  476. TReal should normally be used in preference to TReal32.
  477. Use of floating-point numbers should generally be avoided unless a natural
  478. part of the problem specification. Most Symbian OS implementations do not
  479. have a hardware floating point unit: as a result, their floating-point performance
  480. is hundreds of times slower than integer performance.
  481. }
  482. //type float TReal32;
  483. {
  484. @publishedAll
  485. @released
  486. 64-bit floating point number, providing IEEE754 double precision on all Symbian
  487. OS implementations.
  488. Use of floating-point numbers should generally be avoided unless a natural
  489. part of the problem specification. Most Symbian OS implementations do not
  490. have a hardware floating point unit: as a result, their floating-point performance
  491. is hundreds of times slower than integer performance.
  492. This type is identical to TReal.
  493. @see TReal
  494. }
  495. //type double TReal64;
  496. {
  497. @publishedAll
  498. @released
  499. 64-bit floating point number; identical to TReal64.
  500. Use of floating-point numbers should generally be avoided unless a natural
  501. part of the problem specification. Most Symbian OS implementations do not
  502. have a hardware floating point unit: as a result, their floating-point performance
  503. is hundreds of times slower than integer performance.
  504. Most serious floating-point calculations require double-precision. All standard
  505. math functions (see Math class) take double-precision arguments. Single-precision
  506. should only be used where space and performance are at a premium, and when
  507. their limited precision is acceptable.
  508. @see TReal64
  509. @see Math
  510. }
  511. //type double TReal;
  512. {
  513. @publishedAll
  514. @released
  515. 8-bit unsigned character.
  516. Use instead of C++ built-in char type because it is guaranteed to be unsigned.
  517. Use instead of TInt8 where the application is really for text rather than
  518. 8-bit arithmetic or binary quantities.
  519. For most purposes, you should use TText rather than TText8. TText is mapped
  520. onto either TText8 or TText16 depending on whether a non-Unicode or Unicode
  521. variant is being built. Use TText8 only when you are dealing explicitly with
  522. 8-bit text, regardless of build.
  523. @see TText }
  524. type TText8 = Char;
  525. {
  526. @publishedAll
  527. @released
  528. 16-bit unsigned character.
  529. Use instead of C++ wchar_t type because it is guaranteed to be unsigned. Use
  530. instead of TInt16 where the application is really for text rather than 8-bit
  531. arithmetic or binary quantities.
  532. For most purposes, you should use TText rather than TText16. TText is mapped
  533. onto either TText8 or TText16 depending on whether a non-Unicode or Unicode
  534. variant is being built. Use TText16 only when you are dealing explicitly with
  535. 16-bit text, regardless of build.
  536. @see TText
  537. }
  538. type TText16 = Word;
  539. {
  540. @publishedAll
  541. @released
  542. Boolean type which takes the value either ETrue or EFalse.
  543. Although only a single bit would theoretically be necessary to represent a
  544. Boolean, a machine word is used instead, so that these quantities can be easily
  545. passed. Also, TBool must map onto int because of C++'s interpretation of
  546. operands in conditional expressions.
  547. On implementations of Symbian OS in which the compiler supports the ANSI-recommended
  548. bool type, TBool will be type'ed to bool instead of int.
  549. }
  550. //type int TBool;
  551. {
  552. @publishedPartner
  553. @released
  554. Defines a linear (virtual) address type.
  555. }
  556. type TLinAddr = TUint32;
  557. {
  558. @internalTechnology
  559. A sorted list of all the code segments in ROM that contain an Exception Descriptor.
  560. }
  561. type
  562. TRomExceptionSearchTable = record
  563. {
  564. The number of entries in the following table.
  565. }
  566. iNumEntries: TInt32;
  567. {
  568. Address of the code segment of each TRomImageHeader that has an Exception Descriptor.
  569. }
  570. iEntries: array[0..0] of TLinAddr;
  571. end;
  572. {
  573. @internalComponent
  574. }
  575. {type
  576. TExceptionDescriptor = record
  577. TLinAddr iExIdxBase;
  578. TLinAddr iExIdxLimit;
  579. TLinAddr iROSegmentBase;
  580. TLinAddr iROSegmentLimit;
  581. end;}
  582. {$if defined(__GCC32__)}
  583. {
  584. @publishedAll
  585. @released
  586. Defines a 64-bit signed integer type.
  587. }
  588. //type Int64;
  589. {
  590. @publishedAll
  591. @released
  592. Defines a 64-bit unsigned integer type.
  593. }
  594. //type unsigned long long Uint64;
  595. {
  596. @publishedAll
  597. @released
  598. }
  599. #define I64LIT(x) x##LL
  600. {
  601. @publishedAll
  602. @released
  603. }
  604. #define UI64LIT(x) x##ULL
  605. #elif defined(__VC32__)
  606. type __int64 Int64;
  607. type unsigned __int64 Uint64;
  608. #define I64LIT(x) (__int64)##x
  609. #define UI64LIT(x) (unsigned __int64)##x
  610. #elif defined(__CW32__)
  611. #pragma longlong on
  612. type long long Int64;
  613. type unsigned long long Uint64;
  614. #define I64LIT(x) x##LL
  615. #define UI64LIT(x) x##ULL
  616. {$endif}
  617. {
  618. @publishedAll
  619. @released
  620. Defines a 64-bit signed integer type.
  621. NOTE: For those migrating from versions of Symbian OS before 8.1b (i.e. 8.1a, 7.0s etc)
  622. TInt64 is now defined as a built-in type instead of as a class type. This means
  623. that the member functions of the old TInt64 class are no longer exported
  624. from EUSER.LIB, and represents a compatibility break.
  625. To ease migration of source code, a number of macros are provided. Similar
  626. macros have also been defined in Symbian OS versions 7.0s and 8.1a, but
  627. implemented in terms of the old TInt64 class. This is important for code that
  628. is common to : one or both of these Symbian OS versions, and to 8.1b and
  629. subsequent versions.
  630. The following list shows the new macros and the functions that they replace.
  631. It also shows some alternative techniques.
  632. In this list: x, v and r are declared as TInt64, c is declared as TInt, High
  633. and Low are declared as TUint.
  634. @code
  635. OLD USAGE REPLACEMENT
  636. TInt64(High,Low); MAKE_TINT64(High,Low);
  637. x.Set(High,Low); MAKE_TINT64(High,Low);
  638. x.Low(); I64LOW(x);
  639. x.High(); I64HIGH(x);
  640. x.GetTInt(); I64INT(x);
  641. x.GetTReal(); I64REAL(x);
  642. x.Lsr(c); I64LSR(x,c);
  643. x.Mul10(); x*=10;
  644. x.MulTop(a); I64MULTOP(x,a);
  645. x.DivMod(v,r); r=x%v; x/=v;
  646. @endcode
  647. }
  648. type TInt64 = Int64;
  649. {
  650. @publishedAll
  651. @released
  652. Defines a 64-bit unsigned integer type.
  653. }
  654. //type Uint64 TUint64;
  655. { @internalComponent }
  656. //#define _MAKE_TINT64_ZX(x) ((TInt64)((TUint32)(x)))
  657. { @internalComponent }
  658. //#define _MAKE_TUINT64_ZX(x) ((TUint64)((TUint32)(x)))
  659. {
  660. @publishedAll
  661. @released
  662. }
  663. //#define MAKE_TINT64(h,l) ( (_MAKE_TINT64_ZX(h)<<32) | _MAKE_TINT64_ZX(l) )
  664. {
  665. @publishedAll
  666. @released
  667. }
  668. //#define MAKE_TUINT64(h,l) ( (_MAKE_TUINT64_ZX(h)<<32) | _MAKE_TUINT64_ZX(l) )
  669. {
  670. @publishedAll
  671. @released
  672. Generates code to access the high order 32 bits of a 64 bit number.
  673. }
  674. //#define I64HIGH(x) ( (TUint32)((x)>>32) )
  675. {
  676. @publishedAll
  677. @released
  678. Generates code to access the low order 32 bits of a 64 bit number.
  679. }
  680. //#define I64LOW(x) ( (TUint32)(x) )
  681. {
  682. @publishedAll
  683. @released
  684. Generates code to cast a 64 bit value as an signed integer.
  685. }
  686. //#define I64INT(x) ( (TInt)(x) )
  687. {
  688. @publishedAll
  689. @released
  690. Generates code to cast a 64 bit value as a TReal type.
  691. }
  692. //#define I64REAL(x) ( (TReal)(x) )
  693. {
  694. @publishedAll
  695. @released
  696. Generates code to logically shift a 64 bit integer right.
  697. }
  698. //#define I64LSR(x, shift) ( *reinterpret_cast<TUint64*>(&(x)) >>= (shift) )
  699. {
  700. @publishedAll
  701. @released
  702. Generates code to multiply a 64 bit integer by 10.
  703. }
  704. //#define I64MUL10(x) ( (x) *= 10 )
  705. {
  706. @publishedAll
  707. @released
  708. Generates code to divide a 64 bit integer by another and find the remainder.
  709. }
  710. //#define I64DIVMOD(x, divisor, remainder) ( ((remainder) = (x) % (divisor), (x) /= (divisor)) )
  711. {
  712. @publishedAll
  713. @released
  714. Generates code to cast a double to a 64 bit integer.
  715. }
  716. //#define I64DOUBLECAST(x) ( static_cast<TInt64>(x) )
  717. {
  718. @publishedAll
  719. @deprecated Use _LIT8 instead.
  720. 8-bit literal.
  721. The macro defines an explicit 8-bit constant literal which is suitable
  722. for non-Unicode literal text, regardless of the build.
  723. @see _L
  724. @see _LIT8
  725. @see _LIT
  726. }
  727. //#define _L8(a) (TPtrC8((const TText8 *)(a)))
  728. {
  729. @publishedAll
  730. @released
  731. Defines an explicit 8-bit string which is suitable when non-Unicode text
  732. is required, regardless of the build.
  733. This is used by the deprecated literal descriptor _L8.
  734. }
  735. //#define _S8(a) ((const TText8 *)a)
  736. {
  737. @publishedAll
  738. @released
  739. Constructs a constant literal descriptor of type TLitC8<TInt> with
  740. the specified name and text.
  741. The 8-bit build variant is generated for both non-Unicode and Unicode builds.
  742. @param name The name of the C++ variable to be generated.
  743. @param s The literal text enclosed within a pair of double quotes.
  744. @see _LIT
  745. }
  746. //#define _LIT8(name,s) const static TLitC8<sizeof(s)> name={sizeof(s)-1,s}
  747. {
  748. @publishedAll
  749. @deprecated Use _LIT16 instead.
  750. 16-bit literal.
  751. The macro defines an explicit 16-bit constant literal which is suitable
  752. for Unicode literal text, regardless of the build.
  753. @see _L
  754. @see _LIT16
  755. @see _LIT
  756. }
  757. //#define _L16(a) (TPtrC16((const TText16 *)L ## a))
  758. {
  759. @publishedAll
  760. @released
  761. Defines an explicit 16-bit string which is suitable when Unicode text
  762. is required, regardless of the build.
  763. This is used by the deprecated literal descriptor _L16.
  764. }
  765. //#define _S16(a) ((const TText16 *)L ## a)
  766. {
  767. @publishedAll
  768. @released
  769. Constructs a constant literal descriptor of type TLitC16<TInt> with
  770. the specified name and text.
  771. The 16-bit build variant is generated for both non-Unicode and Unicode builds.
  772. @param name The name of the C++ variable to be generated.
  773. @param s The literal text enclosed within a pair of double quotes.
  774. @see _LIT
  775. }
  776. //#define _LIT16(name,s) const static TLitC16<sizeof(L##s)/2> name={sizeof(L##s)/2-1,L##s}
  777. {$if defined(_UNICODE) and not defined(__KERNEL_MODE__)}
  778. {
  779. @publishedAll
  780. @released
  781. Build independent general text character.
  782. In non-Unicode builds, this is mapped to TText8. In Unicode builds, this is
  783. mapped to TText16. Use the classes with explicit width only when you wish
  784. the width to be independent of the build variant.
  785. Use this class rather than TChar for general use.
  786. }
  787. type TText16 TText;
  788. {
  789. @publishedAll
  790. @deprecated Use _LIT instead.
  791. Build independent literal.
  792. The macro defines either an 8-bit constant literal (for non-Unicode text),
  793. or a 16-bit constant literal (for Unicode text) depending on the build.
  794. @see _LIT
  795. @see _L16
  796. @see _L8
  797. }
  798. #define _L(a) (TPtrC((const TText *)L ## a))
  799. {
  800. @publishedAll
  801. @released
  802. Defines either an 8-bit string (for non-Unicode text),
  803. or a 16-bit string (for Unicode text) depending on the build.
  804. This is used by the deprecated build independent literal _L.
  805. }
  806. #define _S(a) ((const TText *)L ## a)
  807. {
  808. @publishedAll
  809. @released
  810. Constructs a build independent constant literal descriptor of type TLitC<TInt>
  811. with the specified name and text.
  812. An 8-bit build variant is generated for a non-Unicode build;
  813. A 16-bit build variant is generated for a Unicode build.
  814. @param name The name of the C++ variable to be generated.
  815. @param s The literal text enclosed within a pair of double quotes.
  816. @see _LIT16
  817. @see _LIT8
  818. }
  819. #define _LIT(name,s) const static TLitC<sizeof(L##s)/2> name={sizeof(L##s)/2-1,L##s}
  820. {$else}
  821. {
  822. @publishedAll
  823. @released
  824. Build independent general text character.
  825. In non-Unicode builds, this is mapped to TText8. In Unicode builds, this is
  826. mapped to TText16. Use the classes with explicit width only when you wish
  827. the width to be independent of the build variant.
  828. Use this class rather than TChar for general use.
  829. }
  830. type TText = TText8;
  831. {
  832. @publishedAll
  833. @released
  834. @deprecated Use _LIT instead.
  835. Build independent literal.
  836. The macro defines either an 8-bit constant literal (for non-Unicode text),
  837. or a 16-bit constant literal (for Unicode text) depending on the build.
  838. @see _LIT
  839. @see _L16
  840. @see _L8
  841. }
  842. //#define _L(a) (TPtrC((const TText *)(a)))
  843. {
  844. @publishedAll
  845. @released
  846. Defines either an 8-bit string (for non-Unicode text),
  847. or a 16-bit string (for Unicode text) depending on the build.
  848. This is used by the deprecated build independent literal _L.
  849. }
  850. //#define _S(a) ((const TText *)a)
  851. {
  852. @publishedAll
  853. @released
  854. Constructs a build independent constant literal descriptor of type TLitC<TInt>
  855. with the specified name and text.
  856. An 8-bit build variant is generated for a non-Unicode build;
  857. A 16-bit build variant is generated for a Unicode build.
  858. @param name The name of the C++ variable to be generated.
  859. @param s The literal text enclosed within a pair of double quotes.
  860. @see _LIT16
  861. @see _LIT8
  862. }
  863. //#define _LIT(name,s) const static TLitC<sizeof(s)> name={sizeof(s)-1,s}
  864. {$endif}
  865. {$ifndef __VA_LIST_defined}
  866. {
  867. @publishedAll
  868. @released
  869. Defines a 'C' style array of pointers to TInt8 types.
  870. The type is most commonly used by code that needs to deal with a variable
  871. number of arguments passed to a function.
  872. @see TInt8
  873. }
  874. //type TInt8 *VA_LIST[1];
  875. {$endif}
  876. {
  877. @publishedAll
  878. @released
  879. Asserts that a condition is true.
  880. Code is generated for all builds.
  881. This macro is used as a C++ statement to assert the truth of some condition,
  882. and to take appropriate action if the condition is false. Unlike __ASSERT_DEBUG
  883. it is defined in both release and debug builds.
  884. The most common use for this macro is to check that the external environment of
  885. a function or class is behaving as expected; for example, that parameters
  886. passed to a function are credible, or that called functions are behaving as
  887. expected; the macro is commonly placed at the beginning of a function.
  888. The effect of the macro is to generate code which tests
  889. the conditional expression c; if the expression is false, then
  890. function p is called. In the majority of cases, the function p is one that
  891. raises a panic.
  892. Note that the macro definition is, in effect, equivalent to:
  893. @code
  894. if !(c)p;
  895. @endcode
  896. @param c a conditional expression which results in true or false.
  897. @param p a function which is called if the conditional expression c is false.
  898. @see __ASSERT_DEBUG
  899. }
  900. //#define __ASSERT_ALWAYS(c,p) (void)((c)||(p,0))
  901. //#ifdef __WINS__
  902. //#ifdef __CW32__
  903. {
  904. @internalAll
  905. @released
  906. }
  907. //#define __BREAKPOINT() \
  908. // { \
  909. // __asm { byte 0xcc }; \
  910. // }
  911. //#else //!__CW32__
  912. {
  913. @internalAll
  914. @released
  915. }
  916. //#define __BREAKPOINT() \
  917. // { \
  918. // __asm { int 3 }; \
  919. // }
  920. //#endif //__CW32__
  921. //#else
  922. {
  923. @internalAll
  924. @released
  925. }
  926. //#define __BREAKPOINT()
  927. //#endif
  928. //#if defined(_DEBUG)
  929. {
  930. @internalComponent
  931. @deprecated
  932. }
  933. //#define __ASSERT_DEBUG_MB(aCond,aPanicNo) (void)((aCond)||(PanicMB(aPanicNo,_L(#aPanicNo),_L(#aCond)),0))
  934. {
  935. @publishedAll
  936. @released
  937. Asserts that a condition is true.
  938. Code is generated for debug builds only.
  939. This macro is used as a C++ statement to assert the truth of some condition,
  940. and to take appropriate action if the condition is false. It is used in
  941. the same way as __ASSERT_ALWAYS, except that it is only defined for debug builds.
  942. The macro may be used to insert extra checks at various points in source code
  943. as desired; the code will only be generated in debug builds and not in release
  944. builds.
  945. @param c A conditional expression which results in true or false.
  946. @param p A function which is called if the conditional expression c is false.
  947. @see __ASSERT_ALWAYS
  948. }
  949. //#define __ASSERT_DEBUG(c,p) (void)((c)||(p,0))
  950. {
  951. @internalAll
  952. @removed
  953. }
  954. //#define __DECLARE_NAME(t)
  955. {
  956. @publishedAll
  957. @released
  958. Calls the function for testing object invariance.
  959. Classes can define a standard member function __DbgTestInvariant(),
  960. which checks that the object is in a valid state, and panics if it is not.
  961. In debug builds, this macro simply expands to call that function. For details on how
  962. to define __DbgTestInvariant(), and an example of its use, see __DECLARE_TEST.
  963. The macro is typically invoked at the beginning of all the member functions of
  964. the class. For non-const functions (those which can change the object’s state),
  965. you can ensure that the object has been left in a stable state by invoking
  966. the macro at the end of the function.
  967. In release builds, no code is generated for the macro.
  968. }
  969. //#define __TEST_INVARIANT __DbgTestInvariant()
  970. {
  971. @publishedAll
  972. @released
  973. Marks the start of checking the current thread's heap.
  974. This macro is defined only for debug builds.
  975. This macro must be matched by a corresponding call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
  976. Calls to this macro can be nested but each call must be matched by corresponding
  977. call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
  978. @see User::__DbgMarkStart()
  979. @see __UHEAP_MARKEND
  980. @see __UHEAP_MARKENDC
  981. }
  982. //#define __UHEAP_MARK User::__DbgMarkStart(FALSE)
  983. {
  984. @publishedAll
  985. @released
  986. Checks that the number of allocated cells at the current nested level on the
  987. current thread's heap is the same as the specified value.
  988. This macro is defined only for debug builds.
  989. The macro also takes the name of the file containing this source code statement
  990. and the line number of this source code statement; they are displayed as part
  991. of the panic category, if the checks fail.
  992. The macro assumes that:
  993. 1. the heap being checked is a user heap
  994. 2. checking is being done for the number of allocated cells at the current nested
  995. level; i.e. that aCountAll is set to false
  996. 3. the line number is the line number of this source code statement.
  997. 4. the file name is the full path name of the file containing this source statement
  998. @param aCount The number of heap cells expected to be allocated at
  999. the current nest level.
  1000. @see User::__DbgMarkCheck()
  1001. @see __KHEAP_CHECK
  1002. }
  1003. //#define __UHEAP_CHECK(aCount) User::__DbgMarkCheck(FALSE,FALSE,aCount,(TText8*)__FILE__,__LINE__)
  1004. {
  1005. @publishedAll
  1006. @released
  1007. Checks that the total number of allocated cells on the current thread's heap
  1008. is the same as the specified value.
  1009. This macro is defined only for debug builds.
  1010. The macro also takes the name of the file containing this source code statement
  1011. and the line number of this source code statement; they are displayed as part
  1012. of the panic category, if the checks fail.
  1013. @param aCount The total number of heap cells expected to be allocated.
  1014. @see User::__DbgMarkCheck()
  1015. @see __KHEAP_CHECKALL
  1016. }
  1017. //#define __UHEAP_CHECKALL(aCount) User::__DbgMarkCheck(FALSE,TRUE,aCount,(TText8*)__FILE__,__LINE__)
  1018. {
  1019. @publishedAll
  1020. @released
  1021. Marks the end of checking the current thread's heap.
  1022. The macro expects zero heap cells to remain allocated at the current nest
  1023. level. This macro is defined only for debug builds.
  1024. This macro must match an earlier call to __UHEAP_MARK.
  1025. @see User::__DbgMarkEnd()
  1026. @see __UHEAP_MARK
  1027. }
  1028. //#define __UHEAP_MARKEND User::__DbgMarkEnd(FALSE,0)
  1029. {
  1030. @publishedAll
  1031. @released
  1032. Marks the end of checking the current thread's heap.
  1033. The macro expects aCount heap cells to remain allocated at the current nest
  1034. level.
  1035. This macro must match an earlier call to __UHEAP_MARK.
  1036. @param aCount The number of heap cells expected to remain allocated at
  1037. the current nest level.
  1038. @see User::__DbgMarkEnd()
  1039. @see __UHEAP_MARK
  1040. }
  1041. //#define __UHEAP_MARKENDC(aCount) User::__DbgMarkEnd(FALSE,aCount)
  1042. {
  1043. @publishedAll
  1044. @released
  1045. Simulates heap allocation failure for the current thread's heap.
  1046. The failure occurs on the next call to new or any of the functions which
  1047. allocate memory from the heap. This macro is defined only for debug builds.
  1048. @param aCount Determines when the allocation will fail.
  1049. Heap allocation fails on attempt number aCount - later
  1050. allocations will succeed.
  1051. For example, if aCount is 3, then heap allocation fails
  1052. on the 3rd attempt, but all subsequent allocations succeed.
  1053. @see User::__DbgSetAllocFail()
  1054. }
  1055. //#define __UHEAP_FAILNEXT(aCount) User::__DbgSetAllocFail(FALSE,RAllocator::EFailNext,aCount)
  1056. {
  1057. @publishedAll
  1058. @released
  1059. Simulates heap allocation failure for the current thread's heap.
  1060. The failure occurs on subsequent calls to new or any of the functions which
  1061. allocate memory from the heap. This macro is defined only for debug builds.
  1062. @param aType The type of failure to be simulated.
  1063. @param aValue The failure rate.
  1064. @see User::__DbgSetAllocFail()
  1065. }
  1066. //#define __UHEAP_SETFAIL(aType,aValue) User::__DbgSetAllocFail(FALSE,aType,aValue)
  1067. {
  1068. @publishedAll
  1069. @released
  1070. Cancels simulated heap allocation failure for the current thread's heap.
  1071. This macro is defined only for debug builds.
  1072. @see User::__DbgSetAllocFail()
  1073. }
  1074. //#define __UHEAP_RESET User::__DbgSetAllocFail(FALSE,RAllocator::ENone,1)
  1075. {
  1076. @publishedAll
  1077. @released
  1078. Cancels simulated heap allocation failure for the current thread's heap.
  1079. It walks the the heap and sets the nesting level for all allocated
  1080. cells to zero.
  1081. This macro is defined only for debug builds.
  1082. }
  1083. //#define __UHEAP_TOTAL_RESET User::__DbgSetAllocFail(FALSE,RAllocator::EReset,1)
  1084. {
  1085. @publishedPartner
  1086. @released
  1087. Marks the start of Kernel heap checking.
  1088. Checking the Kernel heap is only useful when developing Kernel side code such
  1089. as device drivers and media drivers.
  1090. This macro is defined only for debug builds.
  1091. This macro must be matched by a corresponding call to __KHEAP_MARKEND or __KHEAP_MARKENDC.
  1092. Calls to this macro can be nested but each call must be matched by corresponding
  1093. call to __KHEAP_MARKEND or __KHEAP_MARKENDC.
  1094. @see User::__DbgMarkStart()
  1095. @see __KHEAP_MARKEND
  1096. @see __KHEAP_MARKENDC
  1097. }
  1098. //#define __KHEAP_MARK User::__DbgMarkStart(TRUE)
  1099. {
  1100. @publishedPartner
  1101. @released
  1102. Checks that the number of allocated cells at the current nested level of the
  1103. Kernel heap is the same as the specified value. This macro is defined only
  1104. for debug builds. Checking the Kernel heap is only useful when developing
  1105. Kernel side code such as device drivers and media drivers.
  1106. The macro also takes the name of the file containing this source code statement
  1107. and the line number of this source code statement; they are displayed as part
  1108. of the panic category, if the checks fail.
  1109. @param aCount The number of heap cells expected to be allocated at
  1110. the current nest level.
  1111. @see User::__DbgMarkCheck()
  1112. @see __UHEAP_CHECK
  1113. }
  1114. //#define __KHEAP_CHECK(aCount) User::__DbgMarkCheck(TRUE,FALSE,aCount,(TText8*)__FILE__,__LINE__)
  1115. {
  1116. @publishedPartner
  1117. @released
  1118. Checks that the total number of allocated cells on the Kernel heap is the same
  1119. as the specified value.
  1120. It is only useful when developing Kernel side code such as device drivers
  1121. and media drivers.
  1122. The macro also takes the name of the file containing this source code statement
  1123. and the line number of this source code statement; they are displayed as part
  1124. of the panic category, if the checks fail.
  1125. This macro is defined only for debug builds.
  1126. @param aCount The total number of heap cells expected to be allocated
  1127. @see User::__DbgMarkCheck()
  1128. @see __UHEAP_CHECKALL
  1129. }
  1130. //#define __KHEAP_CHECKALL(aCount) User::__DbgMarkCheck(TRUE,TRUE,aCount,(TText8*)__FILE__,__LINE__)
  1131. {
  1132. @publishedPartner
  1133. @released
  1134. Marks the end of Kernel heap checking. The macro expects zero heap cells to
  1135. remain allocated at the current nest level.
  1136. This macro is defined only for debug builds. Checking the Kernel heap is only
  1137. useful when developing Kernel side code such as device drivers and media drivers.
  1138. This macro must match an earlier call to __KHEAP_MARK.
  1139. @see User::__DbgMarkEnd()
  1140. @see __KHEAP_MARK
  1141. }
  1142. //#define __KHEAP_MARKEND User::__DbgMarkEnd(TRUE,0)
  1143. {
  1144. @publishedPartner
  1145. @released
  1146. Marks the end of Kernel heap checking. The macro expects aCount heap cells
  1147. to remain allocated at the current nest level.
  1148. This macro is defined only for debug builds.
  1149. This macro must match an earlier call to __KHEAP_MARK.
  1150. @param aCount The number of heap cells expected to remain allocated at
  1151. the current nest level.
  1152. @see User::__DbgMarkEnd()
  1153. @see __KHEAP_MARK
  1154. }
  1155. //#define __KHEAP_MARKENDC(aCount) User::__DbgMarkEnd(TRUE,aCount)
  1156. {
  1157. @publishedPartner
  1158. @released
  1159. Simulates Kernel heap allocation failure. The failure occurs on the next call
  1160. to new or any of the functions which allocate memory from the heap. This macro
  1161. is defined only for debug builds.
  1162. Checking the Kernel heap is only useful when developing Kernel side code such
  1163. as device drivers and media drivers.
  1164. @param aCount The rate of failure - heap allocation fails every aCount attempt.
  1165. @see User::__DbgSetAllocFail()
  1166. }
  1167. //#define __KHEAP_FAILNEXT(aCount) User::__DbgSetAllocFail(TRUE,RAllocator::EFailNext,aCount)
  1168. {
  1169. @publishedPartner
  1170. @released
  1171. Simulates Kernel heap allocation failure.
  1172. The failure occurs on subsequent calls to new or any of the functions which
  1173. allocate memory from this heap.
  1174. This macro is defined only for debug builds.
  1175. @param aType The type of failure to be simulated.
  1176. @param aValue The failure rate.
  1177. @see User::__DbgSetAllocFail()
  1178. }
  1179. //#define __KHEAP_SETFAIL(aType,aValue) User::__DbgSetAllocFail(TRUE,aType,aValue)
  1180. {
  1181. @publishedPartner
  1182. @released
  1183. Cancels simulated Kernel heap allocation failure.
  1184. Checking the Kernel heap is only useful when developing Kernel side code such
  1185. as device drivers and media drivers.
  1186. This macro is defined only for debug builds.
  1187. @see User::__DbgSetAllocFail()
  1188. }
  1189. //#define __KHEAP_RESET User::__DbgSetAllocFail(TRUE,RAllocator::ENone,1)
  1190. {
  1191. @publishedPartner
  1192. @released
  1193. Cancels simulated kernel heap allocation failure.
  1194. It walks the the heap and sets the nesting level for all allocated
  1195. cells to zero.
  1196. Checking the kernel heap is only useful when developing kernel side code such
  1197. as device drivers and media drivers.
  1198. This macro is defined only for debug builds.
  1199. }
  1200. //#define __KHEAP_TOTAL_RESET User::__DbgSetAllocFail(TRUE,RAllocator::EReset,1)
  1201. {
  1202. @publishedAll
  1203. @released
  1204. Marks the start of heap checking for the specific heap.
  1205. This macro is defined only for debug builds.
  1206. This macro must be matched by a corresponding call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
  1207. Calls to this macro can be nested but each call must be matched by corresponding
  1208. call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
  1209. @param aHeap A pointer to the specific RHeap
  1210. @see RHeap
  1211. @see RAllocator::__DbgMarkStart()
  1212. @see __RHEAP_MARKEND
  1213. @see __RHEAP_MARKENDC
  1214. }
  1215. //#define __RHEAP_MARK(aHeap) (aHeap)->__DbgMarkStart()
  1216. {
  1217. @publishedAll
  1218. @released
  1219. Checks that the number of allocated cells at the current nested level on the
  1220. specified heap is the same as the specified value.
  1221. The macro also takes the name of the file containing this source code statement
  1222. and the line number of this source code statement; they are displayed as part
  1223. of the panic category, if the checks fail.
  1224. This macro is defined only for debug builds.
  1225. @param aHeap A pointer to the specific RHeap.
  1226. @param aCount The number of heap cells expected to be allocated at
  1227. the current nest level.
  1228. @see RAllocator::__DbgMarkCheck()
  1229. }
  1230. //#define __RHEAP_CHECK(aHeap,aCount) (aHeap)->__DbgMarkCheck(FALSE,aCount,(TText8*)__FILE__,__LINE__)
  1231. {
  1232. @publishedAll
  1233. @released
  1234. Checks that the total number of allocated cells on the specified heap is the
  1235. same as the specified value.
  1236. The macro also takes the name of the file containing this source code statement
  1237. and the line number of this source code statement; they are displayed as part
  1238. of the panic category, if the checks fail.
  1239. This macro is defined only for debug builds.
  1240. @param aHeap A pointer to the specific RHeap.
  1241. @param aCount The total number of heap cells expected to be allocated.
  1242. @see RAllocator::__DbgMarkCheck()
  1243. }
  1244. //#define __RHEAP_CHECKALL(aHeap,aCount) (aHeap)->__DbgMarkCheck(TRUE,aCount,(TText8*)__FILE__,__LINE__)
  1245. {
  1246. @publishedAll
  1247. @released
  1248. Marks the end of heap checking for the specific heap.
  1249. The macro expects zero heap cells to remain allocated at the current nest
  1250. level. This macro is defined only for debug builds.
  1251. This macro must match an earlier call to __RHEAP_MARK.
  1252. @param aHeap A pointer to the specific RHeap.
  1253. @see RAllocator::__DbgMarkEnd()
  1254. @see __RHEAP_MARK
  1255. }
  1256. //#define __RHEAP_MARKEND(aHeap) (aHeap)->__DbgMarkEnd(0)
  1257. {
  1258. @publishedAll
  1259. @released
  1260. Marks the end of heap checking for the specific heap.
  1261. The macro expects aCount heap cells to remain allocated at the current nest
  1262. level. This macro is defined only for debug builds.
  1263. This macro must match an earlier call to __RHEAP_MARK.
  1264. @param aHeap A pointer to the specific RHeap.
  1265. @param aCount The number of heap cells expected to remain allocated at
  1266. the current nest level
  1267. @see RAllocator::__DbgMarkEnd()
  1268. @see __RHEAP_MARK
  1269. }
  1270. //#define __RHEAP_MARKENDC(aHeap,aCount) (aHeap)->__DbgMarkEnd(aCount)
  1271. {
  1272. @publishedAll
  1273. @released
  1274. Simulates an allocation failure for the specific heap.
  1275. The failure occurs on the next call to new or any of the functions which allocate
  1276. memory from the heap. This macro is defined only for debug builds.
  1277. @param aHeap A pointer to the specific RHeap.
  1278. @param aCount The rate of failure - heap allocation fails every aCount attempt.
  1279. @see RAllocator::__DbgSetAllocFail()
  1280. }
  1281. //#define __RHEAP_FAILNEXT(aHeap,aCount) (aHeap)->__DbgSetAllocFail(RAllocator::EFailNext,aCount)
  1282. {
  1283. @publishedAll
  1284. @released
  1285. Simulates an allocation failure for the specific heap.
  1286. The failure occurs on subsequent calls to new or any of the functions which
  1287. allocate memory from the heap. This macro is defined only for debug builds.
  1288. @param aHeap A pointer to the specific RHeap.
  1289. @param aType The type of failure to be simulated.
  1290. @param aValue The failure rate.
  1291. @see RAllocator::__DbgSetAllocFail()
  1292. }
  1293. //#define __RHEAP_SETFAIL(aHeap,aType,aValue) (aHeap)->__DbgSetAllocFail(aType,aValue)
  1294. {
  1295. @publishedAll
  1296. @released
  1297. Cancels simulated allocation failure for the specific heap.
  1298. This macro is defined only for debug builds.
  1299. @param aHeap A pointer to the specific RHeap.
  1300. @see RAllocator::__DbgSetAllocFail()
  1301. }
  1302. //#define __RHEAP_RESET(aHeap) (aHeap)->__DbgSetAllocFail(RAllocator::ENone,1)
  1303. {
  1304. @publishedAll
  1305. @released
  1306. Cancels simulated allocation failure for the specific heap.
  1307. It walks the the heap and sets the nesting level for all allocated
  1308. cells to zero.
  1309. This macro is defined only for debug builds.
  1310. @param aHeap A pointer to the specific RHeap.
  1311. @see RAllocator::__DbgSetAllocFail()
  1312. }
  1313. //#define __RHEAP_TOTAL_RESET(aHeap) (aHeap)->__DbgSetAllocFail(RAllocator::EReset,1)
  1314. //#if defined (__WINS__)
  1315. {
  1316. @publishedAll
  1317. @released
  1318. }
  1319. //#define __DEBUGGER() {if (User::JustInTime()) __BREAKPOINT()}
  1320. //#else
  1321. //#define __DEBUGGER()
  1322. //#endif
  1323. //#if defined(__DLL__)
  1324. {
  1325. @publishedAll
  1326. @released
  1327. Declares a function for testing object invariance.
  1328. For complex classes, it is often useful to provide a function that can
  1329. be called to check that the object is in a valid state.
  1330. The __DECLARE_TEST macro supplies a standard prototype for such a function
  1331. named __DbgTestInvariant(). A companion macro __TEST_INVARIANT is provided
  1332. to call the function.
  1333. For DLLs, as opposed to EXEs, __DbgTestInvariant() is exported,
  1334. i.e. the macro expands to:
  1335. @code
  1336. public: IMPORT_C void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
  1337. @endcode
  1338. This macro should placed as the last item in a class declaration (as it
  1339. switches back to public access). Note that a terminating semi-colon must be used.
  1340. You should define the __DbgTestInvariant() function to check that the object
  1341. is in a healthy state. If it finds an error, it should call User::Invariant(),
  1342. which will cause a panic.
  1343. If a class is derived from a base class, then the base class __DbgTestInvariant()
  1344. should be called first, and then any further checking done.
  1345. The second function declared, __DbgTest(), is intended to allow test code a way
  1346. of directly accessing non-public members of a class. The function is
  1347. implemented by any test code that requires it, rather than in the class’s own
  1348. source code. The function is therefore not exported.
  1349. __DECLARE_TEST is defined for both debug and release builds. This point is
  1350. particularly important for DLLs, as otherwise the exported interfaces would
  1351. differ between the build versions, giving potential binary compatibility
  1352. problems. To avoid using memory unnecessarily in release builds, you can,
  1353. however, use preprocessor directives to define the code within
  1354. __DbgTestInvariant() only for debug builds. __DbgTestInvariant() is never
  1355. called in release builds.
  1356. @see __TEST_INVARIANT
  1357. }
  1358. {#define __DECLARE_TEST public: IMPORT_C void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
  1359. #else
  1360. #define __DECLARE_TEST public: void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
  1361. #endif
  1362. #else
  1363. #define __ASSERT_DEBUG(c,p)
  1364. #define __DECLARE_NAME(t)
  1365. #define __TEST_INVARIANT
  1366. #if defined(__DLL__)
  1367. #define __DECLARE_TEST public: IMPORT_C void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
  1368. #else
  1369. #define __DECLARE_TEST public: void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
  1370. #endif}
  1371. {
  1372. @publishedAll
  1373. @released
  1374. Marks the start of checking the current thread's heap.
  1375. This macro is defined only for debug builds.
  1376. This macro must be matched by a corresponding call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
  1377. Calls to this macro can be nested but each call must be matched by corresponding
  1378. call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
  1379. @see User::__DbgMarkStart()
  1380. @see __UHEAP_MARKEND
  1381. @see __UHEAP_MARKENDC
  1382. }
  1383. //#define __UHEAP_MARK
  1384. {
  1385. @publishedAll
  1386. @released
  1387. Checks that the number of allocated cells at the current nested level on the
  1388. current thread's heap is the same as the specified value.
  1389. This macro is defined only for debug builds.
  1390. The macro also takes the name of the file containing this source code statement
  1391. and the line number of this source code statement; they are displayed as part
  1392. of the panic category, if the checks fail.
  1393. The macro assumes that:
  1394. 1. the heap being checked is a user heap
  1395. 2. checking is being done for the number of allocated cells at the current nested
  1396. level; i.e. that aCountAll is set to false
  1397. 3. the line number is the line number of this source code statement.
  1398. 4. the file name is the full path name of the file containing this source statement
  1399. @param aCount The number of heap cells expected to be allocated at
  1400. the current nest level.
  1401. @see User::__DbgMarkCheck()
  1402. @see __KHEAP_CHECK
  1403. }
  1404. //#define __UHEAP_CHECK(aCount)
  1405. {
  1406. @publishedAll
  1407. @released
  1408. Checks that the total number of allocated cells on the current thread's heap
  1409. is the same as the specified value.
  1410. This macro is defined only for debug builds.
  1411. The macro also takes the name of the file containing this source code statement
  1412. and the line number of this source code statement; they are displayed as part
  1413. of the panic category, if the checks fail.
  1414. @param aCount The total number of heap cells expected to be allocated.
  1415. @see User::__DbgMarkCheck()
  1416. @see __KHEAP_CHECKALL
  1417. }
  1418. //#define __UHEAP_CHECKALL(aCount)
  1419. {
  1420. @publishedAll
  1421. @released
  1422. Marks the end of checking the current thread's heap.
  1423. The macro expects zero heap cells to remain allocated at the current nest
  1424. level. This macro is defined only for debug builds.
  1425. This macro must match an earlier call to __UHEAP_MARK.
  1426. @see User::__DbgMarkEnd()
  1427. @see __UHEAP_MARK
  1428. }
  1429. //#define __UHEAP_MARKEND
  1430. {
  1431. @publishedAll
  1432. @released
  1433. Marks the end of checking the current thread's heap.
  1434. The macro expects aCount heap cells to remain allocated at the current nest
  1435. level.
  1436. This macro must match an earlier call to __UHEAP_MARK.
  1437. @param aCount The number of heap cells expected to remain allocated at
  1438. the current nest level.
  1439. @see User::__DbgMarkEnd()
  1440. @see __UHEAP_MARK
  1441. }
  1442. //#define __UHEAP_MARKENDC(aCount)
  1443. {
  1444. @publishedAll
  1445. @released
  1446. Simulates heap allocation failure for the current thread's heap.
  1447. The failure occurs on the next call to new or any of the functions which
  1448. allocate memory from the heap. This macro is defined only for debug builds.
  1449. @param aCount Determines when the allocation will fail.
  1450. Heap allocation fails on attempt number aCount - later
  1451. allocations will succeed.
  1452. For example, if aCount is 3, then heap allocation fails
  1453. on the 3rd attempt, but all subsequent allocations succeed.
  1454. @see User::__DbgSetAllocFail()
  1455. }
  1456. //#define __UHEAP_FAILNEXT(aCount)
  1457. {
  1458. @publishedAll
  1459. @released
  1460. Simulates heap allocation failure for the current thread's heap.
  1461. The failure occurs on subsequent calls to new or any of the functions which
  1462. allocate memory from the heap. This macro is defined only for debug builds.
  1463. @param aType The type of failure to be simulated.
  1464. @param aValue The failure rate.
  1465. @see User::__DbgSetAllocFail()
  1466. }
  1467. //#define __UHEAP_SETFAIL(aType,aValue)
  1468. {
  1469. @publishedAll
  1470. @released
  1471. Cancels simulated heap allocation failure for the current thread's heap.
  1472. This macro is defined only for debug builds.
  1473. @see User::__DbgSetAllocFail()
  1474. }
  1475. //#define __UHEAP_RESET
  1476. {
  1477. @publishedAll
  1478. @released
  1479. Cancels simulated heap allocation failure for the current thread's heap.
  1480. It walks the the heap and sets the nesting level for all allocated
  1481. cells to zero.
  1482. This macro is defined only for debug builds.
  1483. }
  1484. //#define __UHEAP_TOTAL_RESET
  1485. {
  1486. @publishedPartner
  1487. @released
  1488. Marks the start of Kernel heap checking.
  1489. Checking the Kernel heap is only useful when developing Kernel side code such
  1490. as device drivers and media drivers.
  1491. This macro is defined only for debug builds.
  1492. This macro must be matched by a corresponding call to __KHEAP_MARKEND or __KHEAP_MARKENDC.
  1493. Calls to this macro can be nested but each call must be matched by corresponding
  1494. call to __KHEAP_MARKEND or __KHEAP_MARKENDC.
  1495. @see User::__DbgMarkStart()
  1496. @see __KHEAP_MARKEND
  1497. @see __KHEAP_MARKENDC
  1498. }
  1499. //#define __KHEAP_MARK
  1500. {
  1501. @publishedPartner
  1502. @released
  1503. Checks that the number of allocated cells at the current nested level of the
  1504. Kernel heap is the same as the specified value. This macro is defined only
  1505. for debug builds. Checking the Kernel heap is only useful when developing
  1506. Kernel side code such as device drivers and media drivers.
  1507. The macro also takes the name of the file containing this source code statement
  1508. and the line number of this source code statement; they are displayed as part
  1509. of the panic category, if the checks fail.
  1510. @param aCount The number of heap cells expected to be allocated at
  1511. the current nest level.
  1512. @see User::__DbgMarkCheck()
  1513. @see __UHEAP_CHECK
  1514. }
  1515. //#define __KHEAP_CHECK(aCount)
  1516. {
  1517. @publishedPartner
  1518. @released
  1519. Checks that the total number of allocated cells on the Kernel heap is the same
  1520. as the specified value.
  1521. It is only useful when developing Kernel side code such as device drivers
  1522. and media drivers.
  1523. The macro also takes the name of the file containing this source code statement
  1524. and the line number of this source code statement; they are displayed as part
  1525. of the panic category, if the checks fail.
  1526. This macro is defined only for debug builds.
  1527. @param aCount The total number of heap cells expected to be allocated
  1528. @see User::__DbgMarkCheck()
  1529. @see __UHEAP_CHECKALL
  1530. }
  1531. //#define __KHEAP_CHECKALL(aCount)
  1532. {
  1533. @publishedPartner
  1534. @released
  1535. Marks the end of Kernel heap checking. The macro expects zero heap cells to
  1536. remain allocated at the current nest level.
  1537. This macro is defined only for debug builds. Checking the Kernel heap is only
  1538. useful when developing Kernel side code such as device drivers and media drivers.
  1539. This macro must match an earlier call to __KHEAP_MARK.
  1540. @see User::__DbgMarkEnd()
  1541. @see __KHEAP_MARK
  1542. }
  1543. //#define __KHEAP_MARKEND
  1544. {
  1545. @publishedPartner
  1546. @released
  1547. Marks the end of Kernel heap checking. The macro expects aCount heap cells
  1548. to remain allocated at the current nest level.
  1549. This macro is defined only for debug builds.
  1550. This macro must match an earlier call to __KHEAP_MARK.
  1551. @param aCount The number of heap cells expected to remain allocated at
  1552. the current nest level.
  1553. @see User::__DbgMarkEnd()
  1554. @see __KHEAP_MARK
  1555. }
  1556. //#define __KHEAP_MARKENDC(aCount)
  1557. {
  1558. @publishedPartner
  1559. @released
  1560. Simulates Kernel heap allocation failure. The failure occurs on the next call
  1561. to new or any of the functions which allocate memory from the heap. This macro
  1562. is defined only for debug builds.
  1563. Checking the Kernel heap is only useful when developing Kernel side code such
  1564. as device drivers and media drivers.
  1565. @param aCount The rate of failure - heap allocation fails every aCount attempt.
  1566. @see User::__DbgSetAllocFail()
  1567. }
  1568. //#define __KHEAP_FAILNEXT(aCount)
  1569. {
  1570. @publishedPartner
  1571. @released
  1572. Simulates Kernel heap allocation failure.
  1573. The failure occurs on subsequent calls to new or any of the functions which
  1574. allocate memory from this heap.
  1575. This macro is defined only for debug builds.
  1576. @param aType The type of failure to be simulated.
  1577. @param aValue The failure rate.
  1578. @see User::__DbgSetAllocFail()
  1579. }
  1580. //#define __KHEAP_SETFAIL(aType,aValue)
  1581. {
  1582. @publishedPartner
  1583. @released
  1584. Cancels simulated Kernel heap allocation failure.
  1585. Checking the Kernel heap is only useful when developing Kernel side code such
  1586. as device drivers and media drivers.
  1587. This macro is defined only for debug builds.
  1588. @see User::__DbgSetAllocFail()
  1589. }
  1590. //#define __KHEAP_RESET
  1591. {
  1592. @publishedPartner
  1593. @released
  1594. Cancels simulated kernel heap allocation failure.
  1595. It walks the the heap and sets the nesting level for all allocated
  1596. cells to zero.
  1597. Checking the kernel heap is only useful when developing kernel side code such
  1598. as device drivers and media drivers.
  1599. This macro is defined only for debug builds.
  1600. }
  1601. //#define __KHEAP_TOTAL_RESET
  1602. {
  1603. @publishedAll
  1604. @released
  1605. Marks the start of heap checking for the specific heap.
  1606. This macro is defined only for debug builds.
  1607. This macro must be matched by a corresponding call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
  1608. Calls to this macro can be nested but each call must be matched by corresponding
  1609. call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
  1610. @param aHeap A pointer to the specific RHeap
  1611. @see RHeap
  1612. @see RAllocator::__DbgMarkStart()
  1613. @see __RHEAP_MARKEND
  1614. @see __RHEAP_MARKENDC
  1615. }
  1616. //#define __RHEAP_MARK(aHeap)
  1617. {
  1618. @publishedAll
  1619. @released
  1620. Checks that the number of allocated cells at the current nested level on the
  1621. specified heap is the same as the specified value.
  1622. The macro also takes the name of the file containing this source code statement
  1623. and the line number of this source code statement; they are displayed as part
  1624. of the panic category, if the checks fail.
  1625. This macro is defined only for debug builds.
  1626. @param aHeap A pointer to the specific RHeap.
  1627. @param aCount The number of heap cells expected to be allocated at
  1628. the current nest level.
  1629. @see RAllocator::__DbgMarkCheck()
  1630. }
  1631. //#define __RHEAP_CHECK(aHeap,aCount)
  1632. {
  1633. @publishedAll
  1634. @released
  1635. Checks that the total number of allocated cells on the specified heap is the
  1636. same as the specified value.
  1637. The macro also takes the name of the file containing this source code statement
  1638. and the line number of this source code statement; they are displayed as part
  1639. of the panic category, if the checks fail.
  1640. This macro is defined only for debug builds.
  1641. @param aHeap A pointer to the specific RHeap.
  1642. @param aCount The total number of heap cells expected to be allocated.
  1643. @see RAllocator::__DbgMarkCheck()
  1644. }
  1645. //#define __RHEAP_CHECKALL(aHeap,aCount)
  1646. {
  1647. @publishedAll
  1648. @released
  1649. Marks the end of heap checking for the specific heap.
  1650. The macro expects zero heap cells to remain allocated at the current nest
  1651. level. This macro is defined only for debug builds.
  1652. This macro must match an earlier call to __RHEAP_MARK.
  1653. @param aHeap A pointer to the specific RHeap.
  1654. @see RAllocator::__DbgMarkEnd()
  1655. @see __RHEAP_MARK
  1656. }
  1657. //#define __RHEAP_MARKEND(aHeap)
  1658. {
  1659. @publishedAll
  1660. @released
  1661. Marks the end of heap checking for the specific heap.
  1662. The macro expects aCount heap cells to remain allocated at the current nest
  1663. level. This macro is defined only for debug builds.
  1664. This macro must match an earlier call to __RHEAP_MARK.
  1665. @param aHeap A pointer to the specific RHeap.
  1666. @param aCount The number of heap cells expected to remain allocated at
  1667. the current nest level
  1668. @see RAllocator::__DbgMarkEnd()
  1669. @see __RHEAP_MARK
  1670. }
  1671. //#define __RHEAP_MARKENDC(aHeap,aCount)
  1672. {
  1673. @publishedAll
  1674. @released
  1675. Simulates an allocation failure for the specific heap.
  1676. The failure occurs on the next call to new or any of the functions which allocate
  1677. memory from the heap. This macro is defined only for debug builds.
  1678. @param aHeap A pointer to the specific RHeap.
  1679. @param aCount The rate of failure - heap allocation fails every aCount attempt.
  1680. @see RAllocator::__DbgSetAllocFail()
  1681. }
  1682. //#define __RHEAP_FAILNEXT(aHeap,aCount)
  1683. {
  1684. @publishedAll
  1685. @released
  1686. Simulates an allocation failure for the specific heap.
  1687. The failure occurs on subsequent calls to new or any of the functions which
  1688. allocate memory from the heap. This macro is defined only for debug builds.
  1689. @param aHeap A pointer to the specific RHeap.
  1690. @param aType The type of failure to be simulated.
  1691. @param aValue The failure rate.
  1692. @see RAllocator::__DbgSetAllocFail()
  1693. }
  1694. //#define __RHEAP_SETFAIL(aHeap,aType,aValue)
  1695. {
  1696. @publishedAll
  1697. @released
  1698. Cancels simulated allocation failure for the specific heap.
  1699. This macro is defined only for debug builds.
  1700. @param aHeap A pointer to the specific RHeap.
  1701. @see RAllocator::__DbgSetAllocFail()
  1702. }
  1703. //#define __RHEAP_RESET(aHeap)
  1704. {
  1705. @publishedAll
  1706. @released
  1707. Cancels simulated allocation failure for the specific heap.
  1708. It walks the the heap and sets the nesting level for all allocated
  1709. cells to zero.
  1710. This macro is defined only for debug builds.
  1711. @param aHeap A pointer to the specific RHeap.
  1712. @see RAllocator::__DbgSetAllocFail()
  1713. }
  1714. //#define __RHEAP_TOTAL_RESET(aHeap)
  1715. {#define __DEBUGGER()
  1716. #endif
  1717. #if defined (__WINS__)}
  1718. { @internalTechnology }
  1719. //#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};
  1720. { @internalTechnology }
  1721. {#define __EMULATOR_IMAGE_HEADER(aUid0,aUid1,aUid2,aPriority,aCap,aFlags) TEmulatorImageHeader uid={{aUid0,aUid1,aUid2},aPriority,{aUid2,0,{aCap,0}},0,0,0x00010000u,aFlags};
  1722. #else
  1723. #define __EMULATOR_IMAGE_HEADER2(aUid0,aUid1,aUid2,aPriority,aCap0,aCap1,aSid,aVer,aFlags)
  1724. #define __EMULATOR_IMAGE_HEADER(aUid0,aUid1,aUid2,aPriority,aCap,aFlags)
  1725. #endif
  1726. #if defined(__OPT__)}
  1727. {
  1728. @internalComponent
  1729. @deprecated
  1730. }
  1731. {#define __ASSERT_OPT(c,p) (void)((c)||(p,0))
  1732. #else
  1733. #define __ASSERT_OPT(c,p)
  1734. #endif
  1735. #if defined(_UNICODE)
  1736. #if !defined(UNICODE) }
  1737. {
  1738. @publishedAll
  1739. @deprecated
  1740. }
  1741. {#define UNICODE
  1742. #endif
  1743. #endif }
  1744. //#if defined(_DEBUG)
  1745. {
  1746. @internalComponent
  1747. @deprecated
  1748. }
  1749. {#define __DECLARE_TEST_DEBUG __DECLARE_TEST
  1750. #else
  1751. #define __DECLARE_TEST_DEBUG
  1752. #endif
  1753. #if !defined(ASSERT) }
  1754. {
  1755. @publishedAll
  1756. @released
  1757. Generates _ASSERT_DEBUG code that calls User::Invariant() if the specified
  1758. condition is not true.
  1759. @param x A conditional expression which results in true or false.
  1760. }
  1761. {#define ASSERT(x) __ASSERT_DEBUG(x,User::Invariant())
  1762. #endif
  1763. #ifndef __VALUE_IN_REGS__ }
  1764. {
  1765. @publishedPartner
  1766. @released
  1767. }
  1768. {#define __VALUE_IN_REGS__
  1769. #endif
  1770. #if defined(_DEBUG) }
  1771. {
  1772. @publishedAll
  1773. @released
  1774. }
  1775. {#define __DEBUG_ONLY(x) x
  1776. #else
  1777. #define __DEBUG_ONLY(x)
  1778. #endif }
  1779. {$ifdef __KERNEL_MODE__}
  1780. { @internalComponent }
  1781. #define KIMPORT_C IMPORT_C
  1782. { @internalComponent }
  1783. #define KEXPORT_C EXPORT_C
  1784. { @internalComponent }
  1785. #define UIMPORT_C
  1786. { @internalComponent }
  1787. #define UEXPORT_C
  1788. #else
  1789. #define KIMPORT_C
  1790. #define KEXPORT_C
  1791. #define UIMPORT_C IMPORT_C
  1792. #define UEXPORT_C EXPORT_C
  1793. {$endif}
  1794. {
  1795. @publishedAll
  1796. @released
  1797. Asserts that a condition is true at compilation time.
  1798. @param x Condition to assert
  1799. }
  1800. //#define __ASSERT_COMPILE(x) void __compile_time_assert(int __check[(x)?1:-1])
  1801. //#ifdef __REMOVE_PLATSEC_DIAGNOSTICS__
  1802. {
  1803. @publishedPartner
  1804. @released
  1805. }
  1806. //#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
  1807. //#define __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
  1808. //#endif /*__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__}
  1809. //#endif /*__REMOVE_PLATSEC_DIAGNOSTICS__}
  1810. {
  1811. @internalComponent
  1812. }
  1813. //static const char* const KSuppressPlatSecDiagnosticMagicValue = (const char*)1;
  1814. //#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
  1815. {
  1816. @internalComponent
  1817. }
  1818. //#define __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER(l) #l
  1819. {
  1820. @internalComponent
  1821. }
  1822. //#define __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER2(f,l) f "(" __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER(l) ")"
  1823. {
  1824. @publishedPartner
  1825. @released
  1826. }
  1827. //#define __PLATSEC_DIAGNOSTIC_FILE_AND_LINE __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER2(__FILE__,__LINE__)
  1828. {
  1829. @publishedPartner
  1830. @released
  1831. A macro that should be used to enclose a platform security diagnostic
  1832. 'C' style string that can be passed to a capability checking function such
  1833. as RThread::HasCapability() and Kern::CurrentThreadHasCapability().
  1834. The content of the string is emitted if the capability test finds that
  1835. the capability is not present.
  1836. The macro provides a convenient mechanism that allows the strings to
  1837. be removed from future versions of Symbian OS.
  1838. For example:
  1839. @code
  1840. if(!Kern::CurrentThreadHasCapability(ECapabilityPowerMgmt,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetState")))
  1841. {
  1842. return KErrPermissionDenied;
  1843. }
  1844. @endcode
  1845. In this example, the string:
  1846. @code
  1847. Checked by Hal function EDisplayHalSetState
  1848. @endcode
  1849. is emitted if the calling process does not have the ECapabilityPowerMgmt capability.
  1850. @param s A C-style string.
  1851. @see RProcess::HasCapability()
  1852. @see RThread::HasCapability()
  1853. @see RMessagePtr2::HasCapability()
  1854. @see User::CreatorHasCapability()
  1855. }
  1856. //#define __PLATSEC_DIAGNOSTIC_STRING(s) s
  1857. {
  1858. When this value is used in Platform Security APIs as the value for the aDiagnosticText
  1859. argument, these APIs will not emit any form of diagnostic message.
  1860. @publishedPartner
  1861. @released
  1862. }
  1863. //static const char* const KSuppressPlatSecDiagnostic = KSuppressPlatSecDiagnosticMagicValue;
  1864. //#else /* __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ }
  1865. //#define __PLATSEC_DIAGNOSTIC_STRING(s) NULL
  1866. {$ifndef __KERNEL_MODE__}
  1867. //#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
  1868. {
  1869. When this value is used in Platform Security APIs as the value for the aDiagnostic
  1870. argument, these APIs will not emit any form of diagnostic message.
  1871. @publishedPartner
  1872. @released
  1873. }
  1874. //#define KSuppressPlatSecDiagnostic NULL, NULL
  1875. {.$else} { __REMOVE_PLATSEC_DIAGNOSTICS__ }
  1876. {
  1877. When this value is used in Platform Security APIs as the value for the aDiagnostic
  1878. argument, these APIs will not emit any form of diagnostic message.
  1879. @publishedPartner
  1880. @release
  1881. }
  1882. //#define KSuppressPlatSecDiagnostic NULL
  1883. //#endif { !__REMOVE_PLATSEC_DIAGNOSTICS__ }
  1884. {$endif} { !__KERNEL_MODE__ }
  1885. //#endif /* !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ }
  1886. {
  1887. * MSVC operator new and operator new[] header guards
  1888. }
  1889. {#ifdef __PLACEMENT_NEW
  1890. #define __PLACEMENT_NEW_INLINE
  1891. #endif} { __PLACEMENT_NEW }
  1892. {#if defined(__VC32__) && (_MSC_VER < 1300)
  1893. #define __PLACEMENT_VEC_NEW_INLINE
  1894. #endif} { version of MSVC that doesn't support overloaded operator new[] }
  1895. {
  1896. Calling convention qualifier for functions involving floating point
  1897. variables passed or returned by value.
  1898. @publishedAll
  1899. @released
  1900. }
  1901. {#ifndef __SOFTFP
  1902. #define __SOFTFP
  1903. #endif /* __SOFTFP }