MacMemory.pas 84 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541
  1. {
  2. File: CarbonCore/MacMemory.h
  3. Contains: Memory Manager Interfaces.
  4. The contents of this header file are deprecated.
  5. Use malloc, free, etc instead.
  6. Copyright: © 1985-2011 by Apple Inc. All rights reserved.
  7. }
  8. {
  9. Modified for use with Free Pascal
  10. Version 308
  11. Please report any bugs to <[email protected]>
  12. }
  13. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  14. {$mode macpas}
  15. {$packenum 1}
  16. {$macro on}
  17. {$inline on}
  18. {$calling mwpascal}
  19. unit MacMemory;
  20. interface
  21. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  22. {$setc GAP_INTERFACES_VERSION := $0308}
  23. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  24. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  25. {$endc}
  26. {$ifc defined CPUPOWERPC and defined CPUI386}
  27. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  28. {$endc}
  29. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  30. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  31. {$endc}
  32. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  33. {$setc __ppc__ := 1}
  34. {$elsec}
  35. {$setc __ppc__ := 0}
  36. {$endc}
  37. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  38. {$setc __ppc64__ := 1}
  39. {$elsec}
  40. {$setc __ppc64__ := 0}
  41. {$endc}
  42. {$ifc not defined __i386__ and defined CPUI386}
  43. {$setc __i386__ := 1}
  44. {$elsec}
  45. {$setc __i386__ := 0}
  46. {$endc}
  47. {$ifc not defined __x86_64__ and defined CPUX86_64}
  48. {$setc __x86_64__ := 1}
  49. {$elsec}
  50. {$setc __x86_64__ := 0}
  51. {$endc}
  52. {$ifc not defined __arm__ and defined CPUARM}
  53. {$setc __arm__ := 1}
  54. {$elsec}
  55. {$setc __arm__ := 0}
  56. {$endc}
  57. {$ifc not defined __arm64__ and defined CPUAARCH64}
  58. {$setc __arm64__ := 1}
  59. {$elsec}
  60. {$setc __arm64__ := 0}
  61. {$endc}
  62. {$ifc defined cpu64}
  63. {$setc __LP64__ := 1}
  64. {$elsec}
  65. {$setc __LP64__ := 0}
  66. {$endc}
  67. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  68. {$error Conflicting definitions for __ppc__ and __i386__}
  69. {$endc}
  70. {$ifc defined __ppc__ and __ppc__}
  71. {$setc TARGET_CPU_PPC := TRUE}
  72. {$setc TARGET_CPU_PPC64 := FALSE}
  73. {$setc TARGET_CPU_X86 := FALSE}
  74. {$setc TARGET_CPU_X86_64 := FALSE}
  75. {$setc TARGET_CPU_ARM := FALSE}
  76. {$setc TARGET_CPU_ARM64 := FALSE}
  77. {$setc TARGET_OS_MAC := TRUE}
  78. {$setc TARGET_OS_IPHONE := FALSE}
  79. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  80. {$setc TARGET_OS_EMBEDDED := FALSE}
  81. {$elifc defined __ppc64__ and __ppc64__}
  82. {$setc TARGET_CPU_PPC := FALSE}
  83. {$setc TARGET_CPU_PPC64 := TRUE}
  84. {$setc TARGET_CPU_X86 := FALSE}
  85. {$setc TARGET_CPU_X86_64 := FALSE}
  86. {$setc TARGET_CPU_ARM := FALSE}
  87. {$setc TARGET_CPU_ARM64 := FALSE}
  88. {$setc TARGET_OS_MAC := TRUE}
  89. {$setc TARGET_OS_IPHONE := FALSE}
  90. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  91. {$setc TARGET_OS_EMBEDDED := FALSE}
  92. {$elifc defined __i386__ and __i386__}
  93. {$setc TARGET_CPU_PPC := FALSE}
  94. {$setc TARGET_CPU_PPC64 := FALSE}
  95. {$setc TARGET_CPU_X86 := TRUE}
  96. {$setc TARGET_CPU_X86_64 := FALSE}
  97. {$setc TARGET_CPU_ARM := FALSE}
  98. {$setc TARGET_CPU_ARM64 := FALSE}
  99. {$ifc defined(iphonesim)}
  100. {$setc TARGET_OS_MAC := FALSE}
  101. {$setc TARGET_OS_IPHONE := TRUE}
  102. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  103. {$elsec}
  104. {$setc TARGET_OS_MAC := TRUE}
  105. {$setc TARGET_OS_IPHONE := FALSE}
  106. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  107. {$endc}
  108. {$setc TARGET_OS_EMBEDDED := FALSE}
  109. {$elifc defined __x86_64__ and __x86_64__}
  110. {$setc TARGET_CPU_PPC := FALSE}
  111. {$setc TARGET_CPU_PPC64 := FALSE}
  112. {$setc TARGET_CPU_X86 := FALSE}
  113. {$setc TARGET_CPU_X86_64 := TRUE}
  114. {$setc TARGET_CPU_ARM := FALSE}
  115. {$setc TARGET_CPU_ARM64 := FALSE}
  116. {$ifc defined(iphonesim)}
  117. {$setc TARGET_OS_MAC := FALSE}
  118. {$setc TARGET_OS_IPHONE := TRUE}
  119. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  120. {$elsec}
  121. {$setc TARGET_OS_MAC := TRUE}
  122. {$setc TARGET_OS_IPHONE := FALSE}
  123. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  124. {$endc}
  125. {$setc TARGET_OS_EMBEDDED := FALSE}
  126. {$elifc defined __arm__ and __arm__}
  127. {$setc TARGET_CPU_PPC := FALSE}
  128. {$setc TARGET_CPU_PPC64 := FALSE}
  129. {$setc TARGET_CPU_X86 := FALSE}
  130. {$setc TARGET_CPU_X86_64 := FALSE}
  131. {$setc TARGET_CPU_ARM := TRUE}
  132. {$setc TARGET_CPU_ARM64 := FALSE}
  133. { will require compiler define when/if other Apple devices with ARM cpus ship }
  134. {$setc TARGET_OS_MAC := FALSE}
  135. {$setc TARGET_OS_IPHONE := TRUE}
  136. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  137. {$setc TARGET_OS_EMBEDDED := TRUE}
  138. {$elifc defined __arm64__ and __arm64__}
  139. {$setc TARGET_CPU_PPC := FALSE}
  140. {$setc TARGET_CPU_PPC64 := FALSE}
  141. {$setc TARGET_CPU_X86 := FALSE}
  142. {$setc TARGET_CPU_X86_64 := FALSE}
  143. {$setc TARGET_CPU_ARM := FALSE}
  144. {$setc TARGET_CPU_ARM64 := TRUE}
  145. { will require compiler define when/if other Apple devices with ARM cpus ship }
  146. {$setc TARGET_OS_MAC := FALSE}
  147. {$setc TARGET_OS_IPHONE := TRUE}
  148. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  149. {$setc TARGET_OS_EMBEDDED := TRUE}
  150. {$elsec}
  151. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  152. {$endc}
  153. {$ifc defined __LP64__ and __LP64__ }
  154. {$setc TARGET_CPU_64 := TRUE}
  155. {$elsec}
  156. {$setc TARGET_CPU_64 := FALSE}
  157. {$endc}
  158. {$ifc defined FPC_BIG_ENDIAN}
  159. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  160. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  161. {$elifc defined FPC_LITTLE_ENDIAN}
  162. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  163. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  164. {$elsec}
  165. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  166. {$endc}
  167. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  168. {$setc CALL_NOT_IN_CARBON := FALSE}
  169. {$setc OLDROUTINENAMES := FALSE}
  170. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  171. {$setc OPAQUE_UPP_TYPES := TRUE}
  172. {$setc OTCARBONAPPLICATION := TRUE}
  173. {$setc OTKERNEL := FALSE}
  174. {$setc PM_USE_SESSION_APIS := TRUE}
  175. {$setc TARGET_API_MAC_CARBON := TRUE}
  176. {$setc TARGET_API_MAC_OS8 := FALSE}
  177. {$setc TARGET_API_MAC_OSX := TRUE}
  178. {$setc TARGET_CARBON := TRUE}
  179. {$setc TARGET_CPU_68K := FALSE}
  180. {$setc TARGET_CPU_MIPS := FALSE}
  181. {$setc TARGET_CPU_SPARC := FALSE}
  182. {$setc TARGET_OS_UNIX := FALSE}
  183. {$setc TARGET_OS_WIN32 := FALSE}
  184. {$setc TARGET_RT_MAC_68881 := FALSE}
  185. {$setc TARGET_RT_MAC_CFM := FALSE}
  186. {$setc TARGET_RT_MAC_MACHO := TRUE}
  187. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  188. {$setc TYPE_BOOL := FALSE}
  189. {$setc TYPE_EXTENDED := FALSE}
  190. {$setc TYPE_LONGLONG := TRUE}
  191. uses MacTypes;
  192. {$endc} {not MACOSALLINCLUDE}
  193. {$ifc TARGET_OS_MAC}
  194. {$ALIGN MAC68K}
  195. const
  196. maxSize = $7FFFFFF0; {the largest block possible}
  197. {
  198. If you define a macro named __MAC_OS_X_MEMORY_MANAGER_CLEAN__ with a non-zero value, then
  199. some Memory Manager APIs will become inlined, minimal implementations. See the comments
  200. below for more information about this.
  201. }
  202. {$setc __MAC_OS_X_MEMORY_MANAGER_CLEAN__ := 0}
  203. {$ifc not __MAC_OS_X_MEMORY_MANAGER_CLEAN__}
  204. const
  205. defaultPhysicalEntryCount = 8;
  206. const
  207. { values returned from the GetPageState function }
  208. kPageInMemory = 0;
  209. kPageOnDisk = 1;
  210. kNotPaged = 2;
  211. const
  212. { masks for Zone->heapType field }
  213. k32BitHeap = 1; { valid in all Memory Managers }
  214. kNewStyleHeap = 2; { true if new Heap Manager is present }
  215. kNewDebugHeap = 4; { true if new Heap Manager is running in debug mode on this heap }
  216. {$endc} {not __MAC_OS_X_MEMORY_MANAGER_CLEAN__}
  217. { bits for use with HGetState/HSetState}
  218. const
  219. kHandleIsResourceBit = 5;
  220. kHandlePurgeableBit = 6;
  221. kHandleLockedBit = 7;
  222. { masks for use with HGetState/HSetState}
  223. const
  224. kHandleIsResourceMask = $20;
  225. kHandlePurgeableMask = $40;
  226. kHandleLockedMask = $80;
  227. {$ifc not TARGET_CPU_64}
  228. type
  229. GrowZoneProcPtr = function( cbNeeded: Size ): SIGNEDLONG;
  230. PurgeProcPtr = procedure( blockToPurge: Handle );
  231. UserFnProcPtr = procedure( parameter: UnivPtr );
  232. GrowZoneUPP = GrowZoneProcPtr;
  233. PurgeUPP = PurgeProcPtr;
  234. UserFnUPP = UserFnProcPtr;
  235. ZonePtr = ^Zone;
  236. Zone = record
  237. bkLim: Ptr;
  238. purgePtr: Ptr;
  239. hFstFree: Ptr;
  240. zcbFree: SIGNEDLONG;
  241. gzProc: GrowZoneUPP;
  242. moreMast: SInt16;
  243. flags: SInt16;
  244. cntRel: SInt16;
  245. maxRel: SInt16;
  246. cntNRel: SInt16;
  247. heapType: SInt8; { previously "maxNRel", now holds flags (e.g. k32BitHeap)}
  248. unused: SInt8;
  249. cntEmpty: SInt16;
  250. cntHandles: SInt16;
  251. minCBFree: SIGNEDLONG;
  252. purgeProc: PurgeUPP;
  253. sparePtr: Ptr;
  254. allocPtr: Ptr;
  255. heapData: SInt16;
  256. end;
  257. type
  258. THz = ^Zone;
  259. THzPtr = ^THz;
  260. {$ifc not __MAC_OS_X_MEMORY_MANAGER_CLEAN__}
  261. type
  262. MemoryBlockPtr = ^MemoryBlock;
  263. MemoryBlock = record
  264. address: UnivPtr;
  265. count: UNSIGNEDLONG;
  266. end;
  267. type
  268. LogicalToPhysicalTablePtr = ^LogicalToPhysicalTable;
  269. LogicalToPhysicalTable = record
  270. logical: MemoryBlock;
  271. physical: array [0..7] of MemoryBlock;
  272. end;
  273. PageState = SInt16;
  274. StatusRegisterContents = SInt16;
  275. const
  276. kVolumeVirtualMemoryInfoVersion1 = 1; { first version of VolumeVirtualMemoryInfo}
  277. type
  278. VolumeVirtualMemoryInfo = record
  279. version: PBVersion; { Input: Version of the VolumeVirtualMemoryInfo structure}
  280. volumeRefNum: SInt16; { Input: volume reference number}
  281. inUse: Boolean; { output: true if volume is currently used for file mapping}
  282. _fill: UInt8;
  283. vmOptions: UInt32; { output: tells what volume can support (same as DriverGestaltVMOptionsResponse vmOptions bits in DriverGestalt)}
  284. { end of kVolumeVirtualMemoryInfoVersion1 structure}
  285. end;
  286. VolumeVirtualMemoryInfoPtr = ^VolumeVirtualMemoryInfo;
  287. {$endc} {not __MAC_OS_X_MEMORY_MANAGER_CLEAN__}
  288. {
  289. * NewGrowZoneUPP()
  290. *
  291. * Availability:
  292. * Mac OS X: in version 10.0 and later in CoreServices.framework
  293. * CarbonLib: in CarbonLib 1.0 and later
  294. * Non-Carbon CFM: available as macro/inline
  295. }
  296. function NewGrowZoneUPP( userRoutine: GrowZoneProcPtr ): GrowZoneUPP; external name '_NewGrowZoneUPP';
  297. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  298. {
  299. * NewPurgeUPP()
  300. *
  301. * Availability:
  302. * Mac OS X: in version 10.0 and later in CoreServices.framework
  303. * CarbonLib: in CarbonLib 1.0 and later
  304. * Non-Carbon CFM: available as macro/inline
  305. }
  306. function NewPurgeUPP( userRoutine: PurgeProcPtr ): PurgeUPP; external name '_NewPurgeUPP';
  307. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  308. {
  309. * NewUserFnUPP()
  310. *
  311. * Availability:
  312. * Mac OS X: in version 10.0 and later in CoreServices.framework
  313. * CarbonLib: in CarbonLib 1.0 and later
  314. * Non-Carbon CFM: available as macro/inline
  315. }
  316. function NewUserFnUPP( userRoutine: UserFnProcPtr ): UserFnUPP; external name '_NewUserFnUPP';
  317. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  318. {
  319. * DisposeGrowZoneUPP()
  320. *
  321. * Availability:
  322. * Mac OS X: in version 10.0 and later in CoreServices.framework
  323. * CarbonLib: in CarbonLib 1.0 and later
  324. * Non-Carbon CFM: available as macro/inline
  325. }
  326. procedure DisposeGrowZoneUPP( userUPP: GrowZoneUPP ); external name '_DisposeGrowZoneUPP';
  327. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  328. {
  329. * DisposePurgeUPP()
  330. *
  331. * Availability:
  332. * Mac OS X: in version 10.0 and later in CoreServices.framework
  333. * CarbonLib: in CarbonLib 1.0 and later
  334. * Non-Carbon CFM: available as macro/inline
  335. }
  336. procedure DisposePurgeUPP( userUPP: PurgeUPP ); external name '_DisposePurgeUPP';
  337. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  338. {
  339. * DisposeUserFnUPP()
  340. *
  341. * Availability:
  342. * Mac OS X: in version 10.0 and later in CoreServices.framework
  343. * CarbonLib: in CarbonLib 1.0 and later
  344. * Non-Carbon CFM: available as macro/inline
  345. }
  346. procedure DisposeUserFnUPP( userUPP: UserFnUPP ); external name '_DisposeUserFnUPP';
  347. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  348. {
  349. * InvokeGrowZoneUPP()
  350. *
  351. * Availability:
  352. * Mac OS X: in version 10.0 and later in CoreServices.framework
  353. * CarbonLib: in CarbonLib 1.0 and later
  354. * Non-Carbon CFM: available as macro/inline
  355. }
  356. function InvokeGrowZoneUPP( cbNeeded: Size; userUPP: GrowZoneUPP ): SIGNEDLONG; external name '_InvokeGrowZoneUPP';
  357. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  358. {
  359. * InvokePurgeUPP()
  360. *
  361. * Availability:
  362. * Mac OS X: in version 10.0 and later in CoreServices.framework
  363. * CarbonLib: in CarbonLib 1.0 and later
  364. * Non-Carbon CFM: available as macro/inline
  365. }
  366. procedure InvokePurgeUPP( blockToPurge: Handle; userUPP: PurgeUPP ); external name '_InvokePurgeUPP';
  367. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  368. {
  369. * InvokeUserFnUPP()
  370. *
  371. * Availability:
  372. * Mac OS X: in version 10.0 and later in CoreServices.framework
  373. * CarbonLib: in CarbonLib 1.0 and later
  374. * Non-Carbon CFM: available as macro/inline
  375. }
  376. procedure InvokeUserFnUPP( parameter: UnivPtr; userUPP: UserFnUPP ); external name '_InvokeUserFnUPP';
  377. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  378. {$endc} {not TARGET_CPU_64}
  379. {
  380. * MemError()
  381. *
  382. * Summary:
  383. * Determines if an applicationÕs last direct call to a Memory
  384. * Manager function executed successfully.
  385. *
  386. * Discussion:
  387. * MemError() yields the result code produced by the last Memory
  388. * Manager function your application called directly, and resets
  389. * MemError() to return noErr in the future. MemError() is useful
  390. * during application debugging. You might also use MemError as one
  391. * part of a memory-management scheme to identify instances in which
  392. * the Memory Manager rejects overly large memory requests by
  393. * returning the error code memFullErr.
  394. *
  395. * To view the result codes that MemError() can produce, see "Memory
  396. * Manager Result Codes".
  397. *
  398. * Do not rely on MemError() as the only component of a
  399. * memory-management scheme. For example, suppose you call NewHandle
  400. * or NewPtr and receive the result code noErr, indicating that the
  401. * Memory Manager was able to allocate sufficient memory. In this
  402. * case, you have no guarantee that the allocation did not deplete
  403. * your applicationÕs memory reserves to levels so low that simple
  404. * operations might cause your application to crash. Instead of
  405. * relying on MemError(), check before making a memory request that
  406. * there is enough memory both to fulfill the request and to support
  407. * essential operations.
  408. *
  409. * On Mac OS X 10.3 and later, the value of MemError() is kept for
  410. * each thread; prior to Mac OS X 10.3. MemError() is global to the
  411. * application. Because of this, and other problems, the Memory
  412. * Manager APIs are not thread safe before Mac OS X 10.3.
  413. *
  414. * Mac OS X threading:
  415. * Thread safe since version 10.3
  416. *
  417. * Availability:
  418. * Mac OS X: in version 10.0 and later in CoreServices.framework
  419. * CarbonLib: in CarbonLib 1.0 and later
  420. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  421. }
  422. function MemError: OSErr; external name '_MemError';
  423. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  424. {
  425. * LMGetMemErr()
  426. *
  427. * Summary:
  428. * Returns the result of the last Memory Manager function, without
  429. * clearing the value like MemError() does.
  430. *
  431. * Discussion:
  432. * LMGetMemErr yields the result code produced by the last Memory
  433. * Manager function your application called directly. Unlike
  434. * MemError(), this function does not reset the stored value, so
  435. * subsequent calls to LMGetMemErr() will still return this value
  436. * until the next Memory Manager routine is called or until
  437. * MemError() is called to reset the value. LMGetMemErr is useful
  438. * during application debugging. You might also use this value as
  439. * one part of a memory-management scheme to identify instances in
  440. * which the Memory Manager rejects overly large memory requests by
  441. * returning the error code memFullErr.
  442. *
  443. * To view the result codes that MemError() can produce, see "Memory
  444. * Manager Result Codes".
  445. *
  446. * Do not rely on MemError() as the only component of a
  447. * memory-management scheme. For example, suppose you call NewHandle
  448. * or NewPtr and receive the result code noErr, indicating that the
  449. * Memory Manager was able to allocate sufficient memory. In this
  450. * case, you have no guarantee that the allocation did not deplete
  451. * your applicationÕs memory reserves to levels so low that simple
  452. * operations might cause your application to crash. Instead of
  453. * relying on MemError(), check before making a memory request that
  454. * there is enough memory both to fulfill the request and to support
  455. * essential operations.
  456. *
  457. * On Mac OS X 10.3 and later, the value of MemError() is kept for
  458. * each thread; prior to Mac OS X 10.3 there was one global value of
  459. * MemError() which all threads shared. Because of this, and other
  460. * problems, the Memory Manager APIs are not thread safe before Mac
  461. * OS X 10.3.
  462. *
  463. * Mac OS X threading:
  464. * Not thread safe
  465. *
  466. * Availability:
  467. * Mac OS X: in version 10.0 and later in CoreServices.framework
  468. * CarbonLib: in CarbonLib 1.0 and later
  469. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  470. }
  471. function LMGetMemErr: SInt16; external name '_LMGetMemErr';
  472. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  473. {
  474. * LMSetMemErr()
  475. *
  476. * Summary:
  477. * Set the value which will be returned by MemError()
  478. *
  479. * Discussion:
  480. * User code shouldn't need to call this function, which is used to
  481. * set the value which the next call to MemError() will return.
  482. *
  483. * Mac OS X threading:
  484. * Not thread safe
  485. *
  486. * Parameters:
  487. *
  488. * value:
  489. * the value which the next MemError() function call should return
  490. *
  491. * Availability:
  492. * Mac OS X: in version 10.0 and later in CoreServices.framework
  493. * CarbonLib: in CarbonLib 1.0 and later
  494. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  495. }
  496. procedure LMSetMemErr( value: SInt16 ); external name '_LMSetMemErr';
  497. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  498. {
  499. * NewHandle()
  500. *
  501. * Summary:
  502. * Allocate a relocatable memory block of a specified size.
  503. *
  504. * Discussion:
  505. * The NewHandle function attempts to allocate a new relocatable
  506. * block in the current heap zone with a logical size of logicalSize
  507. * bytes and then return a handle to the block. The new block is
  508. * unlocked and unpurgeable. If NewHandle cannot allocate a block of
  509. * the requested size, it returns NULL. The memory block returned
  510. * likely will contain garbage, and will be unlocked and
  511. * non-purgeable.
  512. *
  513. * WARNING
  514. *
  515. * Do not try to manufacture your own handles without this function
  516. * by simply assigning the address of a variable of type Ptr to a
  517. * variable of type Handle. The resulting "fake handle" would not
  518. * reference a relocatable block and could cause a system crash.
  519. * If this function returns NIL, the error result can be determined
  520. * by calling the function MemError().
  521. *
  522. * Mac OS X threading:
  523. * Thread safe since version 10.3
  524. *
  525. * Parameters:
  526. *
  527. * byteCount:
  528. * the size of the relocatable memory block to allocate. If this
  529. * value is < 0, NIL will be returned. If this value is 0, a
  530. * handle to 0 byte block will be returned.
  531. *
  532. * Availability:
  533. * Mac OS X: in version 10.0 and later in CoreServices.framework
  534. * CarbonLib: in CarbonLib 1.0 and later
  535. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  536. }
  537. function NewHandle( byteCount: Size ): Handle; external name '_NewHandle';
  538. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  539. {
  540. * NewHandleClear()
  541. *
  542. * Summary:
  543. * Allocate a relocatable memory block of a specified size.
  544. *
  545. * Discussion:
  546. * The NewHandle function attempts to allocate a new relocatable
  547. * block in the current heap zone with a logical size of logicalSize
  548. * bytes and then return a handle to the block. The new block is
  549. * unlocked and unpurgeable. If NewHandle cannot allocate a block of
  550. * the requested size, it returns NULL. The memory block returned
  551. * will be zeroed, and will be unlocked and non-purgeable.
  552. *
  553. * WARNING
  554. *
  555. * Do not try to manufacture your own handles without this function
  556. * by simply assigning the address of a variable of type Ptr to a
  557. * variable of type Handle. The resulting "fake handle" would not
  558. * reference a relocatable block and could cause a system crash.
  559. * If this function returns NIL, the error result can be determined
  560. * by calling the function MemError().
  561. *
  562. * Mac OS X threading:
  563. * Thread safe since version 10.3
  564. *
  565. * Parameters:
  566. *
  567. * byteCount:
  568. * the size of the relocatable memory block to allocate. If this
  569. * value is < 0, NIL will be returned. If this value is 0, a
  570. * handle to 0 byte block will be returned.
  571. *
  572. * Availability:
  573. * Mac OS X: in version 10.0 and later in CoreServices.framework
  574. * CarbonLib: in CarbonLib 1.0 and later
  575. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  576. }
  577. function NewHandleClear( byteCount: Size ): Handle; external name '_NewHandleClear';
  578. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  579. {
  580. * RecoverHandle()
  581. *
  582. * Summary:
  583. * Returns a handle to a relocatable block pointed to by a specified
  584. * pointer.
  585. *
  586. * Discussion:
  587. * The Memory Manager does not allow you to change relocatable
  588. * blocks into nonrelocatable blocks, or vice-versa. However, if you
  589. * no longer have access to a handle but still have access to its
  590. * master pointer p, you can use the RecoverHandle function to
  591. * recreate a handle to the relocatable block referenced by
  592. * p.
  593. *
  594. * Call the function MemError() to get the result code. See "Memory
  595. * Manager Result Codes".
  596. *
  597. * Mac OS X threading:
  598. * Thread safe since version 10.3
  599. *
  600. * Parameters:
  601. *
  602. * p:
  603. * the master pointer to a relocatable block.
  604. *
  605. * Result:
  606. * A handle to a relocatable block point to by p. If p does not
  607. * point to a valid block, this function returns NULL.
  608. *
  609. * Availability:
  610. * Mac OS X: in version 10.0 and later in CoreServices.framework
  611. * CarbonLib: in CarbonLib 1.0 and later
  612. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  613. }
  614. function RecoverHandle( p: Ptr ): Handle; external name '_RecoverHandle';
  615. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  616. {
  617. * NewPtr()
  618. *
  619. * Summary:
  620. * Allocates a nonrelocatable block of memory of a specified size.
  621. *
  622. * Discussion:
  623. * The NewPtr function attempts to reserve space for the new block.
  624. * If it is able to reserve the requested amount of space, NewPtr
  625. * allocates the nonrelocatable block. Otherwise, NewPtr returns
  626. * NULL and generates a memFullErr error. On Mac OS X, NewPtr will
  627. * never fail because it is unable to allocate the pointer. Certain
  628. * old versions of Mac OS X return a NULL pointer when asked to
  629. * allocate a pointer of size 0.
  630. * Call the function MemError to get the result code. See "Memory
  631. * Manager Result Codes".
  632. *
  633. * Mac OS X threading:
  634. * Thread safe since version 10.3
  635. *
  636. * Parameters:
  637. *
  638. * byteCount:
  639. * The requested size (in bytes) of the nonrelocatable block. If
  640. * you pass a value of zero, this function returns a valid zero
  641. * length pointer.
  642. *
  643. * Availability:
  644. * Mac OS X: in version 10.0 and later in CoreServices.framework
  645. * CarbonLib: in CarbonLib 1.0 and later
  646. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  647. }
  648. function NewPtr( byteCount: Size ): Ptr; external name '_NewPtr';
  649. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  650. {
  651. * NewPtrClear()
  652. *
  653. * Summary:
  654. * Allocates a nonrelocatable block of memory of a specified size
  655. * with all its bytes set to 0.
  656. *
  657. * Discussion:
  658. * The NewPtr function attempts to reserve space for the new block.
  659. * If it is able to reserve the requested amount of space, NewPtr
  660. * allocates the nonrelocatable block. Otherwise, NewPtr returns
  661. * NULL and generates a memFullErr error. On Mac OS X, NewPtr will
  662. * never fail because it is unable to allocate the pointer. Certain
  663. * old versions of Mac OS X return a NULL pointer when asked to
  664. * allocate a pointer of size 0.
  665. * Call the function MemError to get the result code. See "Memory
  666. * Manager Result Codes".
  667. *
  668. * Mac OS X threading:
  669. * Thread safe since version 10.3
  670. *
  671. * Parameters:
  672. *
  673. * byteCount:
  674. * The requested size (in bytes) of the nonrelocatable block. If
  675. * you pass a value of zero, this function returns a valid zero
  676. * length pointer.
  677. *
  678. * Availability:
  679. * Mac OS X: in version 10.0 and later in CoreServices.framework
  680. * CarbonLib: in CarbonLib 1.0 and later
  681. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  682. }
  683. function NewPtrClear( byteCount: Size ): Ptr; external name '_NewPtrClear';
  684. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  685. {$ifc not TARGET_CPU_64}
  686. {
  687. * MaxBlock() *** DEPRECATED ***
  688. *
  689. * Summary:
  690. * Return the size of the largest block you could allocate in the
  691. * current heap zone after compaction.
  692. *
  693. * Discussion:
  694. * On Mac OS X, this function always returns a large value, because
  695. * virtual memory is always available to fulfill any request for
  696. * memory. This function is deprecated on Mac OS X and later. You
  697. * can assume that any reasonable memory allocation will succeed.
  698. *
  699. * Mac OS X threading:
  700. * Not thread safe
  701. *
  702. * Availability:
  703. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.5
  704. * CarbonLib: in CarbonLib 1.0 and later
  705. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  706. }
  707. function MaxBlock: SIGNEDLONG; external name '_MaxBlock';
  708. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_5, __IPHONE_NA, __IPHONE_NA) *)
  709. {
  710. * StackSpace() *** DEPRECATED ***
  711. *
  712. * Summary:
  713. * Returns the amount of space unused on the current thread's stack.
  714. *
  715. * Mac OS X threading:
  716. * Not thread safe
  717. *
  718. * Availability:
  719. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.5
  720. * CarbonLib: in CarbonLib 1.0 and later
  721. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  722. }
  723. function StackSpace: SIGNEDLONG; external name '_StackSpace';
  724. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_5, __IPHONE_NA, __IPHONE_NA) *)
  725. {$endc} {not TARGET_CPU_64}
  726. {
  727. * NewEmptyHandle()
  728. *
  729. * Summary:
  730. * Initializes a new handle without allocating any memory for it to
  731. * control.
  732. *
  733. * Discussion:
  734. * When you want to allocate memory for the empty handle, use the
  735. * ReallocateHandle function.
  736. * Call the function MemError to get the result code. See "Memory
  737. * Manager Result Codes".
  738. *
  739. * Mac OS X threading:
  740. * Thread safe since version 10.3
  741. *
  742. * Availability:
  743. * Mac OS X: in version 10.0 and later in CoreServices.framework
  744. * CarbonLib: in CarbonLib 1.0 and later
  745. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  746. }
  747. function NewEmptyHandle: Handle; external name '_NewEmptyHandle';
  748. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  749. {
  750. * HLock()
  751. *
  752. * Summary:
  753. * Lock a relocatable block so that it does not move in the heap
  754. *
  755. * Discussion:
  756. * The HLock procedure locks the relocatable block to which h is a
  757. * handle, preventing it from being moved within its heap zone. If
  758. * the block is already locked,HLock does nothing.
  759. *
  760. * On Mac OS X, the behaviour of the Memory Manager and of heaps in
  761. * general is different than on Mac OS 9.x and earlier. In
  762. * particular, the heap on Mac OS X is never purged or compacted.
  763. * Therefore, an unlocked handle will never be relocated except as a
  764. * result of a direct action by something calling SetHandleSize() or
  765. * by using a function like PtrAndHand() which implicitly resizes
  766. * the handle to append data to it. Because of this, most locking
  767. * and unlocking of handles is unnecessary on Mac OS X, and the use
  768. * of HLock() and other functions is being deprecated. If you
  769. * define a macro named __MAC_OS_X_MEMORY_MANAGER_CLEAN__ to 1 in
  770. * your sources before you include MacMemory.h, then HLock() and
  771. * several other functions will become empty operations, removing
  772. * the overhead of a function call.
  773. *
  774. * However, some applications are relying on the behavior that
  775. * resizing a locked handle produces an error, or tracking the state
  776. * of the locked bit for a give handle via the HGetState() function.
  777. * Applications which rely on this can not use
  778. * __MAC_OS_X_MEMORY_MANAGER_CLEAN__.
  779. *
  780. * Mac OS X threading:
  781. * Thread safe since version 10.3
  782. *
  783. * Parameters:
  784. *
  785. * h:
  786. * the handle to lock. If h is == NULL, then HLock() sets
  787. * MemError() to noErr.
  788. *
  789. * Availability:
  790. * Mac OS X: in version 10.0 and later in CoreServices.framework
  791. * CarbonLib: in CarbonLib 1.0 and later
  792. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  793. }
  794. procedure HLock( h: Handle ); external name '_HLock';
  795. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  796. {
  797. * HLockHi()
  798. *
  799. * Summary:
  800. * Lock a relocatable handle.
  801. *
  802. * Discussion:
  803. * The HLockHi() function locks a handle in memory. On versions of
  804. * Mac OS before Mac OS X, it would first attempt to move the handle
  805. * as high in memory as feasible. However, on Mac OS X and later,
  806. * there is no advantage to having handles high in memory, and so
  807. * this function never moves a handle before locking it.
  808. * See the discussion about handle locking above the function
  809. * HLock().
  810. *
  811. * Mac OS X threading:
  812. * Not thread safe
  813. *
  814. * Parameters:
  815. *
  816. * h:
  817. * the handle to lock. If h is == NULL, then HLockHi() sets
  818. * MemError() to noErr.
  819. *
  820. * Availability:
  821. * Mac OS X: in version 10.0 and later in CoreServices.framework
  822. * CarbonLib: in CarbonLib 1.0 and later
  823. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  824. }
  825. procedure HLockHi( h: Handle ); external name '_HLockHi';
  826. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  827. {
  828. * HUnlock()
  829. *
  830. * Summary:
  831. * Unlock a relocatable block so that it does not move in the heap
  832. *
  833. * Discussion:
  834. * The HUnlock procedure unlocks the relocatable block to which h is
  835. * a handle, allowing it from being moved within its heap zone. If
  836. * the block is already unlocked, HUnlock does nothing.
  837. *
  838. * See the discussion about handles and locking on Mac OS X above
  839. * the HLock() function.
  840. *
  841. * Mac OS X threading:
  842. * Thread safe since version 10.3
  843. *
  844. * Parameters:
  845. *
  846. * h:
  847. * the handle to unlock. If h is == NULL, then HUnlock() sets
  848. * MemError() to noErr.
  849. *
  850. * Availability:
  851. * Mac OS X: in version 10.0 and later in CoreServices.framework
  852. * CarbonLib: in CarbonLib 1.0 and later
  853. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  854. }
  855. procedure HUnlock( h: Handle ); external name '_HUnlock';
  856. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  857. {$ifc not TARGET_CPU_64}
  858. {
  859. * HPurge() *** DEPRECATED ***
  860. *
  861. * Summary:
  862. * Mark a relocatable block so that it does can be purged if a
  863. * memory request cannot be fulfilled after compaction of the heap
  864. *
  865. * Discussion:
  866. * The HPurge procedure makes the relocatable block to which h is a
  867. * handle purgeable. If the block is already purgeable, HPurge does
  868. * nothing.
  869. *
  870. * On Mac OS X, heaps are never purged. Therefore, the use of
  871. * HPurge() and its associated functios is deprecated. If you define
  872. * a macro __MAC_OS_X_MEMORY_MANAGER_CLEAN__ in your sources before
  873. * you include MacMemory.h, then any calls to HPurge() in your
  874. * program will essentially be removed.
  875. *
  876. * However, some applications may set the handle as purgeable, and
  877. * then later check the purgeBit for the handle via HGetState(). If
  878. * your application depends on the purge bit being set for handles,
  879. * you will not be able to take advantage of this macro.
  880. *
  881. * Mac OS X threading:
  882. * Thread safe since version 10.3
  883. *
  884. * Parameters:
  885. *
  886. * h:
  887. * the handle to mark as purgeable. If h is == NULL, then
  888. * HPurge() just sets MemError() to noErr.
  889. *
  890. * Availability:
  891. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  892. * CarbonLib: in CarbonLib 1.0 and later
  893. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  894. }
  895. procedure HPurge( h: Handle ); external name '_HPurge';
  896. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  897. {
  898. * HNoPurge() *** DEPRECATED ***
  899. *
  900. * Summary:
  901. * Mark a relocatable block so that it can not be purged.
  902. *
  903. * Discussion:
  904. * The HNoPurge procedure makes the relocatable block to which h is
  905. * a handle unpurgeable. See the discussion about purgable handles
  906. * above the HPurge() function.
  907. *
  908. * Mac OS X threading:
  909. * Thread safe since version 10.3
  910. *
  911. * Parameters:
  912. *
  913. * h:
  914. * the handle to mark as nonpurgeable. If h is == NULL, then
  915. * HPurge() just sets MemError() to noErr.
  916. *
  917. * Availability:
  918. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  919. * CarbonLib: in CarbonLib 1.0 and later
  920. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  921. }
  922. procedure HNoPurge( h: Handle ); external name '_HNoPurge';
  923. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  924. {$endc} {not TARGET_CPU_64}
  925. {
  926. * TempNewHandle()
  927. *
  928. * Summary:
  929. * Allocate a relocatable memory block of a specified size.
  930. *
  931. * Discussion:
  932. * The TempNewHandle function attempts to allocate a new relocatable
  933. * block in the current heap zone with a logical size of logicalSize
  934. * bytes and then return a handle to the block. The new block is
  935. * unlocked and unpurgeable. If NewHandle cannot allocate a block of
  936. * the requested size, it returns NULL. The memory block returned
  937. * likely will contain garbage.
  938. *
  939. * WARNING
  940. *
  941. * Do not try to manufacture your own handles without this function
  942. * by simply assigning the address of a variable of type Ptr to a
  943. * variable of type Handle. The resulting "fake handle" would not
  944. * reference a relocatable block and could cause a system crash.
  945. * If this function returns NIL, the error result can be determined
  946. * by calling the function MemError().
  947. *
  948. * On Mac OS X, there is no temporary memory heap, and thus no
  949. * difference between the handles returned by TempNewHandle() and
  950. * those returned by NewHandle(). The only difference between the
  951. * two is that TempNewHandle() also returns the error result of the
  952. * call in resultCode.
  953. *
  954. * Mac OS X threading:
  955. * Not thread safe
  956. *
  957. * Parameters:
  958. *
  959. * logicalSize:
  960. * the size of the relocatable memory block to allocate. If this
  961. * value is < 0, NIL will be returned. If this value is 0, a
  962. * handle to 0 byte block will be returned.
  963. *
  964. * resultCode:
  965. * On exit, this will be set to the result of the operation.
  966. *
  967. * Availability:
  968. * Mac OS X: in version 10.0 and later in CoreServices.framework
  969. * CarbonLib: in CarbonLib 1.0 and later
  970. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  971. }
  972. function TempNewHandle( logicalSize: Size; var resultCode: OSErr ): Handle; external name '_TempNewHandle';
  973. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  974. {$ifc not TARGET_CPU_64}
  975. {
  976. * TempMaxMem() *** DEPRECATED ***
  977. *
  978. * Summary:
  979. * Return the maximum amount of temporary memory available
  980. *
  981. * Discussion:
  982. * On Mac OS X, this function always returns a large value, because
  983. * virtual memory is always available to fulfill any request for
  984. * memory. This function is deprecated on Mac OS X and later. You
  985. * can assume that any reasonable memory allocation will succeed.
  986. *
  987. * Mac OS X threading:
  988. * Not thread safe
  989. *
  990. * Parameters:
  991. *
  992. * grow:
  993. * If != NULL, then this is filled in with the the value 0.
  994. *
  995. * Availability:
  996. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  997. * CarbonLib: in CarbonLib 1.0 and later
  998. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  999. }
  1000. function TempMaxMem( var grow: Size ): Size; external name '_TempMaxMem';
  1001. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  1002. {
  1003. * TempFreeMem() *** DEPRECATED ***
  1004. *
  1005. * Summary:
  1006. * Return the maximum amount of free memory in the temporary heap.
  1007. *
  1008. * Discussion:
  1009. * On Mac OS X, there is no separate temporary memory heap. This
  1010. * function always returns a large value, because virtual memory is
  1011. * always available to fulfill any request for memory. This
  1012. * function is deprecated on Mac OS X and later. You can assume
  1013. * that any reasonable memory allocation will succeed.
  1014. *
  1015. * Mac OS X threading:
  1016. * Not thread safe
  1017. *
  1018. * Availability:
  1019. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  1020. * CarbonLib: in CarbonLib 1.0 and later
  1021. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1022. }
  1023. function TempFreeMem: SIGNEDLONG; external name '_TempFreeMem';
  1024. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  1025. {
  1026. * CompactMem() *** DEPRECATED ***
  1027. *
  1028. * Summary:
  1029. * Compact the heap by purging and moving blocks such that at least
  1030. * cbNeeded bytes are available, if possible.
  1031. *
  1032. * Discussion:
  1033. * On Mac OS X and later, blocks are never purged and memory heaps
  1034. * will grow as necessary, so compaction is never necessary nor
  1035. * performed.
  1036. *
  1037. * Mac OS X threading:
  1038. * Not thread safe
  1039. *
  1040. * Availability:
  1041. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  1042. * CarbonLib: in CarbonLib 1.0 and later
  1043. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1044. }
  1045. function CompactMem( cbNeeded: Size ): Size; external name '_CompactMem';
  1046. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  1047. {
  1048. * PurgeMem() *** DEPRECATED ***
  1049. *
  1050. * Summary:
  1051. * Purge blocks from the heap until cbNeeded bytes are available, if
  1052. * possible.
  1053. *
  1054. * Discussion:
  1055. * On Mac OS X and later, blocks are never purged and memory heaps
  1056. * will grow as necessary, so purging of a heap is never necessary
  1057. * nor performed.
  1058. *
  1059. * Mac OS X threading:
  1060. * Not thread safe
  1061. *
  1062. * Availability:
  1063. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  1064. * CarbonLib: in CarbonLib 1.0 and later
  1065. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1066. }
  1067. procedure PurgeMem( cbNeeded: Size ); external name '_PurgeMem';
  1068. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  1069. {
  1070. * FreeMem() *** DEPRECATED ***
  1071. *
  1072. * Summary:
  1073. * Return the maximum amount of free memory in the temporary heap.
  1074. *
  1075. * Discussion:
  1076. * On Mac OS X, this function always returns a large value, because
  1077. * virtual memory is always available to fulfill any request for
  1078. * memory. This function is deprecated on Mac OS X and later. You
  1079. * can assume that any reasonable memory allocation will succeed.
  1080. *
  1081. * Mac OS X threading:
  1082. * Not thread safe
  1083. *
  1084. * Availability:
  1085. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.5
  1086. * CarbonLib: in CarbonLib 1.0 and later
  1087. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1088. *
  1089. * Note:
  1090. * FreeMem has been renamed MacFreeMem, to resolve a naming conflict with
  1091. * FreeMem in the Turbo Pascal/Delphi/FreePascal runtime library
  1092. }
  1093. function MacFreeMem: SInt32; external name '_FreeMem';
  1094. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_5, __IPHONE_NA, __IPHONE_NA) *)
  1095. {
  1096. * MaxMem() *** DEPRECATED ***
  1097. *
  1098. * Summary:
  1099. * Return the maximum amount of free memory available
  1100. *
  1101. * Discussion:
  1102. * On Mac OS X, this function always returns a large value, because
  1103. * virtual memory is always available to fulfill any request for
  1104. * memory. This function is deprecated on Mac OS X and later. You
  1105. * can assume that any reasonable memory allocation will succeed.
  1106. *
  1107. * Mac OS X threading:
  1108. * Not thread safe
  1109. *
  1110. * Parameters:
  1111. *
  1112. * grow:
  1113. * If != NULL, then this is filled in with the the value 0.
  1114. *
  1115. * Availability:
  1116. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.5
  1117. * CarbonLib: in CarbonLib 1.0 and later
  1118. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1119. }
  1120. function MaxMem( var grow: Size ): Size; external name '_MaxMem';
  1121. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_5, __IPHONE_NA, __IPHONE_NA) *)
  1122. {
  1123. * SetGrowZone() *** DEPRECATED ***
  1124. *
  1125. * Summary:
  1126. * Set a function which is called when a heap is grown
  1127. *
  1128. * Discussion:
  1129. * On Mac OS X and later, heaps never grow, and so the function set
  1130. * by SetGrowZone() is never called.
  1131. *
  1132. * Mac OS X threading:
  1133. * Not thread safe
  1134. *
  1135. * Parameters:
  1136. *
  1137. * growZone:
  1138. * a upp for a function to call when a heap needs to be grown
  1139. *
  1140. * Availability:
  1141. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  1142. * CarbonLib: in CarbonLib 1.0 and later
  1143. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1144. }
  1145. procedure SetGrowZone( growZone: GrowZoneUPP ); external name '_SetGrowZone';
  1146. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  1147. {
  1148. * GetGrowZone() *** DEPRECATED ***
  1149. *
  1150. * Summary:
  1151. * Get the function which is called when a heap is grown
  1152. *
  1153. * Discussion:
  1154. * On Mac OS X and later, heaps never grow, and so this function (
  1155. * set by SetGrowZone() ) is never called.
  1156. *
  1157. * Mac OS X threading:
  1158. * Not thread safe
  1159. *
  1160. * Availability:
  1161. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  1162. * CarbonLib: in CarbonLib 1.1 and later
  1163. * Non-Carbon CFM: not available
  1164. }
  1165. function GetGrowZone: GrowZoneUPP; external name '_GetGrowZone';
  1166. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  1167. {
  1168. * MoveHHi() *** DEPRECATED ***
  1169. *
  1170. * Summary:
  1171. * Move a handle as high in memory as possible
  1172. *
  1173. * Discussion:
  1174. * On versions of Mac OS before Mac OS X, MoveHHi() would move the
  1175. * handle as high in memory as feasible. However, on Mac OS X and
  1176. * later, there is no advantage to having handles high in memory,
  1177. * and so this function never moves a handle before locking it.
  1178. * See the discussion about handle locking above the function
  1179. * HLock().
  1180. *
  1181. * Mac OS X threading:
  1182. * Not thread safe
  1183. *
  1184. * Parameters:
  1185. *
  1186. * h:
  1187. * the handle to move
  1188. *
  1189. * Availability:
  1190. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  1191. * CarbonLib: in CarbonLib 1.0 and later
  1192. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1193. }
  1194. procedure MoveHHi( h: Handle ); external name '_MoveHHi';
  1195. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  1196. {$endc} {not TARGET_CPU_64}
  1197. {
  1198. * DisposePtr()
  1199. *
  1200. * Summary:
  1201. * Release memory occupied by a nonrelocatable block
  1202. *
  1203. * Discussion:
  1204. * When you no longer need a nonrelocatable block, call the
  1205. * DisposePtr function to free it for other uses.
  1206. * Call the function MemError to get the result code. See "Memory
  1207. * Manager Result Codes".
  1208. * After a call to DisposePtr, all pointers to the released block
  1209. * become invalid and should not be used again. Any subsequent use
  1210. * of a pointer to the released block might cause a system error.
  1211. * You can pass the value NULL as the pointer to dispose.
  1212. *
  1213. * Mac OS X threading:
  1214. * Thread safe since version 10.3
  1215. *
  1216. * Parameters:
  1217. *
  1218. * p:
  1219. * A pointer to the nonrelocatable block you want to dispose of
  1220. *
  1221. * Availability:
  1222. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1223. * CarbonLib: in CarbonLib 1.0 and later
  1224. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1225. }
  1226. procedure DisposePtr( p: Ptr ); external name '_DisposePtr';
  1227. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1228. {
  1229. * GetPtrSize()
  1230. *
  1231. * Summary:
  1232. * Returns the logical size of the nonrelocatable block
  1233. * corresponding to a pointer.
  1234. *
  1235. * Discussion:
  1236. * This function returns the number of bytes used for the given
  1237. * pointer. Call the function MemError to get the result code. See
  1238. * "Memory Manager Result Codes".
  1239. *
  1240. * Mac OS X threading:
  1241. * Thread safe since version 10.3
  1242. *
  1243. * Parameters:
  1244. *
  1245. * p:
  1246. * a pointer to a nonrelocatable block.
  1247. *
  1248. * Result:
  1249. * The logical size, in bytes, of the nonrelocatable block pointed
  1250. * to by p. In case of error, the function returns 0.
  1251. *
  1252. * Availability:
  1253. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1254. * CarbonLib: in CarbonLib 1.0 and later
  1255. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1256. }
  1257. function GetPtrSize( p: Ptr ): Size; external name '_GetPtrSize';
  1258. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1259. {
  1260. * SetPtrSize()
  1261. *
  1262. * Mac OS X threading:
  1263. * Thread safe since version 10.3
  1264. *
  1265. * Availability:
  1266. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1267. * CarbonLib: in CarbonLib 1.0 and later
  1268. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1269. }
  1270. procedure SetPtrSize( p: Ptr; newSize: Size ); external name '_SetPtrSize';
  1271. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1272. {
  1273. * DisposeHandle()
  1274. *
  1275. * Summary:
  1276. * Releases memory occupied by a relocatable block.
  1277. *
  1278. * Discussion:
  1279. * The DisposeHandle function releases the memory occupied by the
  1280. * relocatable block whose handle is h. It also frees the handleÕs
  1281. * master pointer for other uses.
  1282. * Do not use DisposeHandle to dispose of a handle obtained from the
  1283. * Resource Manager (for example, by a previous call to
  1284. * GetResource), useReleaseResource instead. If, however, you have
  1285. * called DetachResource on a resource handle, you should dispose of
  1286. * the storage by callingDisposeHandle.
  1287. * Call the function MemError to get the result code. See "Memory
  1288. * Manager Result Codes".
  1289. * After a call to DisposeHandle, all handles to the released block
  1290. * become invalid and should not be used again. Any subsequent calls
  1291. * to DisposeHandleusing an invalid handle might damage the master
  1292. * pointer list. You can pass the value NULL as the handle to
  1293. * dispose.
  1294. *
  1295. * Mac OS X threading:
  1296. * Thread safe since version 10.3
  1297. *
  1298. * Parameters:
  1299. *
  1300. * h:
  1301. * A handle to a relocatable block.
  1302. *
  1303. * Availability:
  1304. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1305. * CarbonLib: in CarbonLib 1.0 and later
  1306. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1307. }
  1308. procedure DisposeHandle( h: Handle ); external name '_DisposeHandle';
  1309. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1310. {
  1311. * SetHandleSize()
  1312. *
  1313. * Summary:
  1314. * Changes the logical size of the relocatable block corresponding
  1315. * to the specified handle.
  1316. *
  1317. * Discussion:
  1318. * Change the logical size of the relocatable block corresponding to
  1319. * the specified handle. SetHandleSize might need to move the
  1320. * relocatable block to obtain enough space for the resized block.
  1321. * Thus, for best results you should unlock a block before resizing
  1322. * it.
  1323. *
  1324. * An attempt to increase the size of a locked block might fail,
  1325. * because of blocks above and below it that are either
  1326. * nonrelocatable or locked. You should be prepared for this
  1327. * possibility.
  1328. *
  1329. * Instead of using the SetHandleSize function to set the size of a
  1330. * handle to 0, you can use the EmptyHandle function.
  1331. *
  1332. * Mac OS X threading:
  1333. * Thread safe since version 10.3
  1334. *
  1335. * Parameters:
  1336. *
  1337. * h:
  1338. * a handle to a relocatable block.
  1339. *
  1340. * newSize:
  1341. * the desired new logical size, in bytes, of the relocatable
  1342. * block.
  1343. *
  1344. * Availability:
  1345. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1346. * CarbonLib: in CarbonLib 1.0 and later
  1347. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1348. }
  1349. procedure SetHandleSize( h: Handle; newSize: Size ); external name '_SetHandleSize';
  1350. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1351. {
  1352. * GetHandleSize()
  1353. *
  1354. * Summary:
  1355. * Returns the logical size of the relocatable block corresponding
  1356. * to a handle.
  1357. *
  1358. * Discussion:
  1359. * Returns the logical size of the relocatable block corresponding
  1360. * to a handle. Call the function MemError to get the result code.
  1361. * See "Memory Manager Result Codes".
  1362. *
  1363. * Mac OS X threading:
  1364. * Thread safe since version 10.3
  1365. *
  1366. * Parameters:
  1367. *
  1368. * h:
  1369. * a handle to a relocatable block.
  1370. *
  1371. * Result:
  1372. * The logical size, in bytes, of the relocatable block whose handle
  1373. * is h. In case of error, the function return 0.
  1374. *
  1375. * Availability:
  1376. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1377. * CarbonLib: in CarbonLib 1.0 and later
  1378. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1379. }
  1380. function GetHandleSize( h: Handle ): Size; external name '_GetHandleSize';
  1381. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1382. {
  1383. * ReallocateHandle()
  1384. *
  1385. * Summary:
  1386. * Allocates a new relocatable block of a specified size and sets a
  1387. * handleÕs master pointer to point to the new block.
  1388. *
  1389. * Discussion:
  1390. * Usually you use ReallocateHandle to reallocate space for a block
  1391. * that you have emptied. If the handle references an existing
  1392. * block, ReallocateHandle releases that block before creating a new
  1393. * one.
  1394. *
  1395. * To reallocate space for a resource that has been purged, you
  1396. * should call LoadResource, not ReallocateHandle. To resize
  1397. * relocatable blocks, you should call the SetHandleSize
  1398. * function.
  1399. *
  1400. * Call the function MemError to get the result code. See "Memory
  1401. * Manager Result Codes".
  1402. *
  1403. * Mac OS X threading:
  1404. * Thread safe since version 10.3
  1405. *
  1406. * Parameters:
  1407. *
  1408. * h:
  1409. * A handle to a relocatable block.
  1410. *
  1411. * byteCount:
  1412. * the desired new logical size (in bytes) of the relocatable
  1413. * block. The new block is unlocked and unpurgeable.
  1414. *
  1415. * Availability:
  1416. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1417. * CarbonLib: in CarbonLib 1.0 and later
  1418. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1419. }
  1420. procedure ReallocateHandle( h: Handle; byteCount: Size ); external name '_ReallocateHandle';
  1421. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1422. {
  1423. * EmptyHandle()
  1424. *
  1425. * Summary:
  1426. * Purges a relocatable block and sets the corresponding handleÕs
  1427. * master pointer to NULL.
  1428. *
  1429. * Discussion:
  1430. * The EmptyHandle function purges the relocatable block whose
  1431. * handle is h and sets the handleÕs master pointer to NULL. The
  1432. * EmptyHandle function allows you to free memory taken by a
  1433. * relocatable block without freeing the relocatable blockÕs master
  1434. * pointer for other uses. The block whose handle is h must be
  1435. * unlocked but need not be purgeable.
  1436. *
  1437. * Note that if there are multiple handles to the relocatable block,
  1438. * then calling the EmptyHandle function empties them all, because
  1439. * all of the handles share a common master pointer. When you later
  1440. * use ReallocateHandle to reallocate space for the block, the
  1441. * master pointer is updated, and all of the handles reference the
  1442. * new block correctly.
  1443. *
  1444. * To free the memory taken up by a relocatable block and release
  1445. * the blockÕs master pointer for other uses, use the DisposeHandle
  1446. * function.
  1447. *
  1448. * Call the function MemError to get the result code. See "Memory
  1449. * Manager Result Codes".
  1450. *
  1451. * Mac OS X threading:
  1452. * Thread safe since version 10.3
  1453. *
  1454. * Parameters:
  1455. *
  1456. * h:
  1457. * a handle to a relocatable block.
  1458. *
  1459. * Availability:
  1460. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1461. * CarbonLib: in CarbonLib 1.0 and later
  1462. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1463. }
  1464. procedure EmptyHandle( h: Handle ); external name '_EmptyHandle';
  1465. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1466. {
  1467. * HSetRBit()
  1468. *
  1469. * Summary:
  1470. * Set the "R" bit for the handle state.
  1471. *
  1472. * Mac OS X threading:
  1473. * Thread safe since version 10.3
  1474. *
  1475. * Availability:
  1476. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1477. * CarbonLib: in CarbonLib 1.0 and later
  1478. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1479. }
  1480. procedure HSetRBit( h: Handle ); external name '_HSetRBit';
  1481. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1482. {
  1483. * HClrRBit()
  1484. *
  1485. * Summary:
  1486. * Clear the "R" bit for the handle state.
  1487. *
  1488. * Mac OS X threading:
  1489. * Thread safe since version 10.3
  1490. *
  1491. * Availability:
  1492. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1493. * CarbonLib: in CarbonLib 1.0 and later
  1494. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1495. }
  1496. procedure HClrRBit( h: Handle ); external name '_HClrRBit';
  1497. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1498. {
  1499. * HGetState()
  1500. *
  1501. * Summary:
  1502. * Get the current state of the handle's locked, purgeable, and R
  1503. * bits
  1504. *
  1505. * Discussion:
  1506. * The HGetState function returns a signed byte (char) containing
  1507. * the flags of the master pointer for the given handle. You can
  1508. * save this byte, change the state of any of the flags using the
  1509. * functions described in this section, and then restore their
  1510. * original states by passing the byte to the HSetState
  1511. * function.
  1512. *
  1513. * You can use bit-manipulation functions on the returned signed
  1514. * byte to determine the value of a given attribute.
  1515. * Currently the following bits are used:
  1516. * kHandleIsResourceBit - if set, handle is a resource
  1517. * kHandlePurgeableBit - if set, handle is purgeable
  1518. * kHandleLockedBit - if set, handle is locked
  1519. * On Mac OS X and later, heaps are never purged, so the purgeable
  1520. * bit is used but its setting is essentially ignored. Also, since
  1521. * heaps are never compacted, and therefore the only time a handle
  1522. * moves is when that handle is resized, the danger of using
  1523. * defererenced handles is lower and so handles likely do not need
  1524. * to be locked as often. Because of this, the state for a handle is
  1525. * less useful, and HGetState() and other functions is being
  1526. * deprecated. If you define a macro named
  1527. * __MAC_OS_X_MEMORY_MANAGER_CLEAN__ in your sources before you
  1528. * include MacMemory.h, then HGetState() and several other functions
  1529. * will become empty operations, removing the overhead of a function
  1530. * call.
  1531. *
  1532. * However, some applications may depend on the state bits of a
  1533. * handle being correct or changing as functions like HLock(), etc.,
  1534. * are called. Applications which rely on this can not use
  1535. * __MAC_OS_X_MEMORY_MANAGER_CLEAN__.
  1536. *
  1537. * Mac OS X threading:
  1538. * Thread safe since version 10.3
  1539. *
  1540. * Parameters:
  1541. *
  1542. * h:
  1543. * the handle to get the state for
  1544. *
  1545. * Availability:
  1546. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1547. * CarbonLib: in CarbonLib 1.0 and later
  1548. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1549. }
  1550. function HGetState( h: Handle ): SInt8; external name '_HGetState';
  1551. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1552. {
  1553. * HSetState()
  1554. *
  1555. * Summary:
  1556. * Set the current state of the handle's locked, purgeable, and R
  1557. * bits
  1558. *
  1559. * Discussion:
  1560. * See the discussion about handle state and Mac OS X above the
  1561. * function HGetState().
  1562. *
  1563. * Mac OS X threading:
  1564. * Thread safe since version 10.3
  1565. *
  1566. * Parameters:
  1567. *
  1568. * h:
  1569. * the handle to set the state for
  1570. *
  1571. * flags:
  1572. * the flags to set for the handle
  1573. *
  1574. * Availability:
  1575. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1576. * CarbonLib: in CarbonLib 1.0 and later
  1577. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1578. }
  1579. procedure HSetState( h: Handle; flags: SInt8 ); external name '_HSetState';
  1580. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1581. {****************************************************************************
  1582. Beginning in Mac OS X Tiger, BlockMove, BlockMoveData, BlockMoveUncached,
  1583. BlockMoveDataUncached, BlockZero, and BlockZeroUncached are inlined to a
  1584. direct call to the posix memmove or bzero functions; this allows the
  1585. compiler to optimize in some cases.
  1586. However, CarbonCore.framework still exports functions with these names,
  1587. both so old code which linked them there will run and to support
  1588. compilers which don't support inline function definitions.
  1589. To use the exported version of BlockMove, #define NO_BLOCKMOVE_INLINE
  1590. in your source code ( or prefix header file ) before including any headers
  1591. which would include MacMemory.h.
  1592. ****************************************************************************}
  1593. {$ifc not TARGET_CPU_64}
  1594. {
  1595. * BlockMove()
  1596. *
  1597. * Availability:
  1598. * Non-Carbon CFM: in DriverServicesLib 1.0 and later
  1599. * CarbonLib: in CarbonLib 1.0 and later
  1600. * Mac OS X: in version 10.0 and later
  1601. }
  1602. procedure BlockMove( srcPtr: {const} UnivPtr; destPtr: UnivPtr; byteCount: Size ); external name '_BlockMove';
  1603. {
  1604. * BlockMoveData()
  1605. *
  1606. * Availability:
  1607. * Non-Carbon CFM: in DriverServicesLib 1.0 and later
  1608. * CarbonLib: in CarbonLib 1.0 and later
  1609. * Mac OS X: in version 10.0 and later
  1610. }
  1611. procedure BlockMoveData( srcPtr: {const} UnivPtr; destPtr: UnivPtr; byteCount: Size ); external name '_BlockMoveData';
  1612. {
  1613. * BlockMoveUncached()
  1614. *
  1615. * Availability:
  1616. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  1617. * CarbonLib: in CarbonLib 1.0 and later
  1618. * Mac OS X: in version 10.0 and later
  1619. }
  1620. procedure BlockMoveUncached( srcPtr: {const} UnivPtr; destPtr: UnivPtr; byteCount: Size ); external name '_BlockMoveUncached';
  1621. {
  1622. * BlockMoveDataUncached()
  1623. *
  1624. * Availability:
  1625. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  1626. * CarbonLib: in CarbonLib 1.0 and later
  1627. * Mac OS X: in version 10.0 and later
  1628. }
  1629. procedure BlockMoveDataUncached( srcPtr: {const} UnivPtr; destPtr: UnivPtr; byteCount: Size ); external name '_BlockMoveDataUncached';
  1630. {
  1631. * BlockZero()
  1632. *
  1633. * Availability:
  1634. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  1635. * CarbonLib: in CarbonLib 1.0 and later
  1636. * Mac OS X: in version 10.0 and later
  1637. }
  1638. procedure BlockZero( destPtr: UnivPtr; byteCount: Size ); external name '_BlockZero';
  1639. {
  1640. * BlockZeroUncached()
  1641. *
  1642. * Availability:
  1643. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  1644. * CarbonLib: in CarbonLib 1.0 and later
  1645. * Mac OS X: in version 10.0 and later
  1646. }
  1647. procedure BlockZeroUncached( destPtr: UnivPtr; byteCount: Size ); external name '_BlockZeroUncached';
  1648. {$endc} {not TARGET_CPU_64}
  1649. {
  1650. * HandToHand()
  1651. *
  1652. * Summary:
  1653. * Copies all of the data from one relocatable block to a new
  1654. * relocatable block.
  1655. *
  1656. * Discussion:
  1657. * The HandToHand function attempts to copy the information in the
  1658. * relocatable block to which theHndl is a handle; if successful,
  1659. * HandToHand sets theHndlto a handle pointing to the new
  1660. * relocatable block.
  1661. *
  1662. * If successful in creating a new relocatable block, the HandToHand
  1663. * function does not duplicate the properties of the original block.
  1664. * The new block is unlocked, unpurgeable, and not a resource. Call
  1665. * HLock or HPurge to adjust the properties of the new
  1666. * block.
  1667. *
  1668. * To copy only part of a relocatable block into a new relocatable
  1669. * block, use the PtrToHand function. Before calling PtrToHand, lock
  1670. * and dereference the handle pointing to the relocatable block you
  1671. * want to copy.
  1672. *
  1673. * Because HandToHand replaces its parameter with the new handle,
  1674. * you should retain the original parameter value somewhere else,
  1675. * otherwise you will not be able to access it.
  1676. *
  1677. * Mac OS X threading:
  1678. * Thread safe since version 10.3
  1679. *
  1680. * Parameters:
  1681. *
  1682. * theHndl:
  1683. * a handle to the relocatable block whose data HandToHand will
  1684. * copy. On return, theHndl contains a handle to a new
  1685. * relocatable block whose data duplicates the original.
  1686. *
  1687. * Availability:
  1688. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1689. * CarbonLib: in CarbonLib 1.0 and later
  1690. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1691. }
  1692. function HandToHand( var theHndl: Handle ): OSErr; external name '_HandToHand';
  1693. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1694. {
  1695. * PtrToXHand()
  1696. *
  1697. * Summary:
  1698. * Copies data referenced by a pointer to an existing relocatable
  1699. * block.
  1700. *
  1701. * Discussion:
  1702. * The PtrToXHand function copies the specified number of bytes from
  1703. * the location specified by srcPtr to the handle specified by
  1704. * dstHndl.
  1705. *
  1706. * Mac OS X threading:
  1707. * Thread safe since version 10.3
  1708. *
  1709. * Parameters:
  1710. *
  1711. * srcPtr:
  1712. * the address of the first byte to copy.
  1713. *
  1714. * dstHndl:
  1715. * a handle to an existing relocatable block.
  1716. *
  1717. * size:
  1718. * the number of bytes to copy.
  1719. *
  1720. * Availability:
  1721. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1722. * CarbonLib: in CarbonLib 1.0 and later
  1723. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1724. }
  1725. function PtrToXHand( srcPtr: {const} UnivPtr; dstHndl: Handle; size: SIGNEDLONG ): OSErr; external name '_PtrToXHand';
  1726. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1727. {
  1728. * PtrToHand()
  1729. *
  1730. * Summary:
  1731. * Copies data referenced by a pointer to a new relocatable block.
  1732. *
  1733. * Discussion:
  1734. * If you dereference and lock a handle, the PtrToHand function can
  1735. * copy its data to a new handle. However, for copying data from one
  1736. * handle to another, the HandToHand function is more efficient.
  1737. *
  1738. * Mac OS X threading:
  1739. * Thread safe since version 10.3
  1740. *
  1741. * Parameters:
  1742. *
  1743. * srcPtr:
  1744. * the address of the first byte to copy.
  1745. *
  1746. * dstHndl:
  1747. * a handle for which you have not yet allocated any memory. The
  1748. * PtrToHand function allocates memory for the handle and copies
  1749. * the specified number of bytes beginning at srcPtr into it. The
  1750. * dstHndl parameter is an output parameter that will hold the
  1751. * result. Its value on entry is ignored. If no error occurs, on
  1752. * exit it points to an unlocked, non-purgeable Handle of the
  1753. * requested size.
  1754. *
  1755. * size:
  1756. * the number of bytes to copy.
  1757. *
  1758. * Availability:
  1759. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1760. * CarbonLib: in CarbonLib 1.0 and later
  1761. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1762. }
  1763. function PtrToHand( srcPtr: {const} UnivPtr; var dstHndl: Handle; size: SIGNEDLONG ): OSErr; external name '_PtrToHand';
  1764. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1765. {
  1766. * HandAndHand()
  1767. *
  1768. * Summary:
  1769. * Use the HandAndHand function to concatenate two relocatable
  1770. * blocks.
  1771. *
  1772. * Discussion:
  1773. * The HandAndHand function concatenates the information from the
  1774. * relocatable block to which aHndl is a handle onto the end of the
  1775. * relocatable block to which bHndl is a handle. The aHndl variable
  1776. * remains unchanged.
  1777. *
  1778. * WARNING
  1779. *
  1780. * The HandAndHand function dereferences the handle aHndl. You must
  1781. * call the HLock procedure to lock the block before calling
  1782. * HandAndHand. Afterward, you can call the HUnlock procedure to
  1783. * unlock it. Alternatively, you can save the block's original state
  1784. * by calling the HGetState function, lock the block by calling
  1785. * HLock, and then restore the original settings by calling
  1786. * HSetState.
  1787. *
  1788. * Mac OS X threading:
  1789. * Thread safe since version 10.3
  1790. *
  1791. * Parameters:
  1792. *
  1793. * hand1:
  1794. * A handle to the first relocatable block, whose contents do not
  1795. * change but are concatenated to the end of the second
  1796. * relocatable block.
  1797. *
  1798. * hand2:
  1799. * A handle to the second relocatable block, whose size the Memory
  1800. * Manager expands so that it can concatenate the information from
  1801. * aHndl to the end of the contents of this block.
  1802. *
  1803. * Availability:
  1804. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1805. * CarbonLib: in CarbonLib 1.0 and later
  1806. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1807. }
  1808. function HandAndHand( hand1: Handle; hand2: Handle ): OSErr; external name '_HandAndHand';
  1809. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1810. {
  1811. * PtrAndHand()
  1812. *
  1813. * Summary:
  1814. * Concatenates part or all of a memory block to the end of a
  1815. * relocatable block.
  1816. *
  1817. * Discussion:
  1818. * The PtrAndHand function takes the number of bytes specified by
  1819. * the size parameter, beginning at the location specified by ptr1,
  1820. * and concatenates them onto the end of the relocatable block to
  1821. * which hand2 is a handle. The contents of the source block remain
  1822. * unchanged.
  1823. *
  1824. * Mac OS X threading:
  1825. * Thread safe since version 10.3
  1826. *
  1827. * Parameters:
  1828. *
  1829. * ptr1:
  1830. * a pointer to the beginning of the data that the Memory Manager
  1831. * is to concatenate onto the end of the relocatable block.
  1832. *
  1833. * hand2:
  1834. * a handle to the relocatable block, whose size the Memory
  1835. * Manager expands so that it can concatenate the information from
  1836. * ptr1 onto the end of this block.
  1837. *
  1838. * size:
  1839. * the number of bytes of the block referenced by ptr1 to copy.
  1840. *
  1841. * Availability:
  1842. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1843. * CarbonLib: in CarbonLib 1.0 and later
  1844. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1845. }
  1846. function PtrAndHand( ptr1: {const} UnivPtr; hand2: Handle; size: SIGNEDLONG ): OSErr; external name '_PtrAndHand';
  1847. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  1848. {$ifc not TARGET_CPU_64}
  1849. {
  1850. * MoreMasters() *** DEPRECATED ***
  1851. *
  1852. * Discussion:
  1853. * On Mac OS X and later, master pointers do not need to be
  1854. * pre-allocated.
  1855. *
  1856. * Mac OS X threading:
  1857. * Not thread safe
  1858. *
  1859. * Availability:
  1860. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  1861. * CarbonLib: in CarbonLib 1.0 and later
  1862. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1863. }
  1864. procedure MoreMasters; external name '_MoreMasters';
  1865. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  1866. {
  1867. * MoreMasterPointers() *** DEPRECATED ***
  1868. *
  1869. * Discussion:
  1870. * On Mac OS X and later, master pointers do not need to be
  1871. * pre-allocated.
  1872. *
  1873. * Mac OS X threading:
  1874. * Not thread safe
  1875. *
  1876. * Parameters:
  1877. *
  1878. * inCount:
  1879. * the number of master pointers to preallocate
  1880. *
  1881. * Availability:
  1882. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  1883. * CarbonLib: in CarbonLib 1.0 and later
  1884. * Non-Carbon CFM: not available
  1885. }
  1886. procedure MoreMasterPointers( inCount: UInt32 ); external name '_MoreMasterPointers';
  1887. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  1888. { Temporary Memory routines renamed, but obsolete, in System 7.0 and later. }
  1889. {
  1890. * TempHLock() *** DEPRECATED ***
  1891. *
  1892. * Discussion:
  1893. * This function has been deprecated for many years; replace it with
  1894. * HLock()
  1895. *
  1896. * Mac OS X threading:
  1897. * Not thread safe
  1898. *
  1899. * Availability:
  1900. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  1901. * CarbonLib: in CarbonLib 1.0 and later
  1902. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1903. }
  1904. procedure TempHLock( h: Handle; var resultCode: OSErr ); external name '_TempHLock';
  1905. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  1906. {
  1907. * TempHUnlock() *** DEPRECATED ***
  1908. *
  1909. * Discussion:
  1910. * This function has been deprecated for many years; replace it with
  1911. * HUnlock()
  1912. *
  1913. * Mac OS X threading:
  1914. * Not thread safe
  1915. *
  1916. * Availability:
  1917. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  1918. * CarbonLib: in CarbonLib 1.0 and later
  1919. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1920. }
  1921. procedure TempHUnlock( h: Handle; var resultCode: OSErr ); external name '_TempHUnlock';
  1922. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  1923. {
  1924. * TempDisposeHandle() *** DEPRECATED ***
  1925. *
  1926. * Discussion:
  1927. * This function has been deprecated for many years; replace it with
  1928. * DisposeHandle()
  1929. *
  1930. * Mac OS X threading:
  1931. * Not thread safe
  1932. *
  1933. * Availability:
  1934. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.5
  1935. * CarbonLib: in CarbonLib 1.0 and later
  1936. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1937. }
  1938. procedure TempDisposeHandle( h: Handle; var resultCode: OSErr ); external name '_TempDisposeHandle';
  1939. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_5, __IPHONE_NA, __IPHONE_NA) *)
  1940. {
  1941. * TempTopMem() *** DEPRECATED ***
  1942. *
  1943. * Discussion:
  1944. * Mac OS X and later does not have a seperate temporary memory
  1945. * heap. This function returns NULL.
  1946. *
  1947. * Mac OS X threading:
  1948. * Not thread safe
  1949. *
  1950. * Availability:
  1951. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  1952. * CarbonLib: in CarbonLib 1.0 and later
  1953. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1954. }
  1955. function TempTopMem: Ptr; external name '_TempTopMem';
  1956. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  1957. {
  1958. * HoldMemory() *** DEPRECATED ***
  1959. *
  1960. * Deprecated:
  1961. * Mac OS X has never supported HoldMemory. The functions in
  1962. * ./sys/mman.h may be useful for replacing usage of these
  1963. * functions, although Mac OS X does not allow the same level of
  1964. * control over whether pages are held in memory or resident as Mac
  1965. * OS 9.x did.
  1966. * If you define a macro __MAC_OS_X_MEMORY_MANAGER_CLEAN__ in your
  1967. * sources before you include MacMemory.h, then any calls to
  1968. * HoldMemory() in your program will essentially be removed.
  1969. *
  1970. * Mac OS X threading:
  1971. * Not thread safe
  1972. *
  1973. * Availability:
  1974. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  1975. * CarbonLib: in CarbonLib 1.1 and later
  1976. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1977. }
  1978. function HoldMemory( address: UnivPtr; count: UNSIGNEDLONG ): OSErr; external name '_HoldMemory';
  1979. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  1980. {
  1981. * UnholdMemory() *** DEPRECATED ***
  1982. *
  1983. * Deprecated:
  1984. * Mac OS X has never supported MakeMemoryResident. See the comment
  1985. * above UnholdMemory for more information.
  1986. *
  1987. * Mac OS X threading:
  1988. * Not thread safe
  1989. *
  1990. * Availability:
  1991. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  1992. * CarbonLib: in CarbonLib 1.1 and later
  1993. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1994. }
  1995. function UnholdMemory( address: UnivPtr; count: UNSIGNEDLONG ): OSErr; external name '_UnholdMemory';
  1996. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  1997. {
  1998. * MakeMemoryResident() *** DEPRECATED ***
  1999. *
  2000. * Deprecated:
  2001. * Mac OS X has never supported MakeMemoryResident. See the comment
  2002. * above UnholdMemory for more information.
  2003. *
  2004. * Mac OS X threading:
  2005. * Not thread safe
  2006. *
  2007. * Parameters:
  2008. *
  2009. * address:
  2010. * the address to make resident
  2011. *
  2012. * count:
  2013. * the count of pages to make make resident
  2014. *
  2015. * Availability:
  2016. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  2017. * CarbonLib: in CarbonLib 1.0.2 and later
  2018. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  2019. }
  2020. function MakeMemoryResident( address: UnivPtr; count: UNSIGNEDLONG ): OSErr; external name '_MakeMemoryResident';
  2021. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  2022. {
  2023. * ReleaseMemoryData() *** DEPRECATED ***
  2024. *
  2025. * Deprecated:
  2026. * Mac OS X has never supported MakeMemoryResident. See the comment
  2027. * above UnholdMemory for more information.
  2028. *
  2029. * Mac OS X threading:
  2030. * Not thread safe
  2031. *
  2032. * Parameters:
  2033. *
  2034. * address:
  2035. * the address to make release
  2036. *
  2037. * count:
  2038. * the count of pages to make make release
  2039. *
  2040. * Availability:
  2041. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  2042. * CarbonLib: in CarbonLib 1.0.2 and later
  2043. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  2044. }
  2045. function ReleaseMemoryData( address: UnivPtr; count: UNSIGNEDLONG ): OSErr; external name '_ReleaseMemoryData';
  2046. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  2047. {
  2048. * MakeMemoryNonResident() *** DEPRECATED ***
  2049. *
  2050. * Deprecated:
  2051. * Mac OS X has never supported MakeMemoryResident. See the comment
  2052. * above UnholdMemory for more information.
  2053. *
  2054. * Mac OS X threading:
  2055. * Not thread safe
  2056. *
  2057. * Parameters:
  2058. *
  2059. * address:
  2060. * the address to make non-resident
  2061. *
  2062. * count:
  2063. * the count of pages to make make non-resident
  2064. *
  2065. * Availability:
  2066. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  2067. * CarbonLib: in CarbonLib 1.0.2 and later
  2068. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  2069. }
  2070. function MakeMemoryNonResident( address: UnivPtr; count: UNSIGNEDLONG ): OSErr; external name '_MakeMemoryNonResident';
  2071. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  2072. {
  2073. * FlushMemory() *** DEPRECATED ***
  2074. *
  2075. * Deprecated:
  2076. * Mac OS X has never supported MakeMemoryResident. See the comment
  2077. * above UnholdMemory for more information.
  2078. *
  2079. * Mac OS X threading:
  2080. * Not thread safe
  2081. *
  2082. * Parameters:
  2083. *
  2084. * address:
  2085. * the address to flush
  2086. *
  2087. * count:
  2088. * the count of pages to make flush
  2089. *
  2090. * Availability:
  2091. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  2092. * CarbonLib: in CarbonLib 1.0.2 and later
  2093. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  2094. }
  2095. function FlushMemory( address: UnivPtr; count: UNSIGNEDLONG ): OSErr; external name '_FlushMemory';
  2096. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  2097. {
  2098. * GZSaveHnd() *** DEPRECATED ***
  2099. *
  2100. * Summary:
  2101. * This function is deprecated on Mac OS X and always returns NULL.
  2102. *
  2103. * Mac OS X threading:
  2104. * Not thread safe
  2105. *
  2106. * Availability:
  2107. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  2108. * CarbonLib: in CarbonLib 1.0 and later
  2109. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2110. }
  2111. function GZSaveHnd: Handle; external name '_GZSaveHnd';
  2112. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  2113. {
  2114. * TopMem() *** DEPRECATED ***
  2115. *
  2116. * Summary:
  2117. * This function is deprecated on Mac OS X and always returns NULL.
  2118. *
  2119. * Mac OS X threading:
  2120. * Not thread safe
  2121. *
  2122. * Availability:
  2123. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  2124. * CarbonLib: in CarbonLib 1.0 and later
  2125. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2126. }
  2127. function TopMem: Ptr; external name '_TopMem';
  2128. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  2129. {
  2130. * ReserveMem() *** DEPRECATED ***
  2131. *
  2132. * Summary:
  2133. * This function is deprecated on Mac OS X.
  2134. *
  2135. * Mac OS X threading:
  2136. * Not thread safe
  2137. *
  2138. * Availability:
  2139. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  2140. * CarbonLib: in CarbonLib 1.0 and later
  2141. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2142. }
  2143. procedure ReserveMem( cbNeeded: Size ); external name '_ReserveMem';
  2144. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  2145. {
  2146. * PurgeSpace() *** DEPRECATED ***
  2147. *
  2148. * Summary:
  2149. * This function is deprecated on Mac OS X.
  2150. *
  2151. * Discussion:
  2152. * On Mac OS X and later, heaps are never purged and therefore
  2153. * PurgeSpace will always return a large value for both the total
  2154. * space available and the largest block available. You can assume
  2155. * that any reasonable memory allocation will succeed.
  2156. *
  2157. * If you define a macro __MAC_OS_X_MEMORY_MANAGER_CLEAN__ in your
  2158. * sources before you include MacMemory.h, then any calls to
  2159. * PurgeSpace() in your program will essentially be removed.
  2160. *
  2161. * Mac OS X threading:
  2162. * Not thread safe
  2163. *
  2164. * Availability:
  2165. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  2166. * CarbonLib: in CarbonLib 1.0 and later
  2167. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2168. }
  2169. procedure PurgeSpace( var total: SIGNEDLONG; var contig: SIGNEDLONG ); external name '_PurgeSpace';
  2170. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  2171. {
  2172. * PurgeSpaceTotal() *** DEPRECATED ***
  2173. *
  2174. * Summary:
  2175. * This function is deprecated on Mac OS X.
  2176. *
  2177. * Discussion:
  2178. * On Mac OS X and later, heaps are never purged and therefore
  2179. * PurgeSpaceTotal will always return a large value. You can assume
  2180. * that any reasonable memory allocation will succeed.
  2181. *
  2182. * Mac OS X threading:
  2183. * Not thread safe
  2184. *
  2185. * Availability:
  2186. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  2187. * CarbonLib: in CarbonLib 1.0 and later
  2188. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  2189. }
  2190. function PurgeSpaceTotal: SIGNEDLONG; external name '_PurgeSpaceTotal';
  2191. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  2192. {
  2193. * PurgeSpaceContiguous() *** DEPRECATED ***
  2194. *
  2195. * Summary:
  2196. * This function is deprecated on Mac OS X.
  2197. *
  2198. * Discussion:
  2199. * On Mac OS X and later, heaps are never purged and therefore
  2200. * PurgeSpaceContiguous will always return a large value. You can
  2201. * assume that any reasonable memory allocation will succeed.
  2202. *
  2203. * Mac OS X threading:
  2204. * Not thread safe
  2205. *
  2206. * Availability:
  2207. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  2208. * CarbonLib: in CarbonLib 1.0 and later
  2209. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  2210. }
  2211. function PurgeSpaceContiguous: SIGNEDLONG; external name '_PurgeSpaceContiguous';
  2212. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  2213. { Carbon routines to aid in debugging. }
  2214. {
  2215. * CheckAllHeaps() *** DEPRECATED ***
  2216. *
  2217. * Summary:
  2218. * Check all known heaps for validity. Deprecated on Mac OS X,
  2219. * since there really aren't heaps. Use IsHeapValid() if you really
  2220. * want this functionality.
  2221. *
  2222. * Mac OS X threading:
  2223. * Not thread safe
  2224. *
  2225. * Availability:
  2226. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  2227. * CarbonLib: in CarbonLib 1.0 and later
  2228. * Non-Carbon CFM: not available
  2229. }
  2230. function CheckAllHeaps: Boolean; external name '_CheckAllHeaps';
  2231. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  2232. {$endc} {not TARGET_CPU_64}
  2233. {
  2234. * IsHeapValid()
  2235. *
  2236. * Summary:
  2237. * Check if the heap is valid.
  2238. *
  2239. * Mac OS X threading:
  2240. * Thread safe since version 10.4
  2241. *
  2242. * Availability:
  2243. * Mac OS X: in version 10.0 and later in CoreServices.framework
  2244. * CarbonLib: in CarbonLib 1.0 and later
  2245. * Non-Carbon CFM: not available
  2246. }
  2247. function IsHeapValid: Boolean; external name '_IsHeapValid';
  2248. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  2249. { It is invalid to pass a NULL or an empty Handle to IsHandleValid }
  2250. {
  2251. * IsHandleValid()
  2252. *
  2253. * Mac OS X threading:
  2254. * Thread safe since version 10.3
  2255. *
  2256. * Availability:
  2257. * Mac OS X: in version 10.0 and later in CoreServices.framework
  2258. * CarbonLib: in CarbonLib 1.0 and later
  2259. * Non-Carbon CFM: not available
  2260. }
  2261. function IsHandleValid( h: Handle ): Boolean; external name '_IsHandleValid';
  2262. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  2263. { It is invalid to pass a NULL Pointer to IsPointerValid }
  2264. {
  2265. * IsPointerValid()
  2266. *
  2267. * Mac OS X threading:
  2268. * Thread safe since version 10.3
  2269. *
  2270. * Availability:
  2271. * Mac OS X: in version 10.0 and later in CoreServices.framework
  2272. * CarbonLib: in CarbonLib 1.0 and later
  2273. * Non-Carbon CFM: not available
  2274. }
  2275. function IsPointerValid( p: Ptr ): Boolean; external name '_IsPointerValid';
  2276. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  2277. {$ifc not TARGET_CPU_64}
  2278. {
  2279. * LMGetSysZone() *** DEPRECATED ***
  2280. *
  2281. * Summary:
  2282. * This function is deprecated on Mac OS X.
  2283. *
  2284. * Mac OS X threading:
  2285. * Not thread safe
  2286. *
  2287. * Availability:
  2288. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  2289. * CarbonLib: in CarbonLib 1.0 and later
  2290. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2291. }
  2292. function LMGetSysZone: THz; external name '_LMGetSysZone';
  2293. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  2294. {
  2295. * LMSetSysZone() *** DEPRECATED ***
  2296. *
  2297. * Summary:
  2298. * This function is deprecated on Mac OS X.
  2299. *
  2300. * Mac OS X threading:
  2301. * Not thread safe
  2302. *
  2303. * Availability:
  2304. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  2305. * CarbonLib: in CarbonLib 1.0 and later
  2306. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2307. }
  2308. procedure LMSetSysZone( value: THz ); external name '_LMSetSysZone';
  2309. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  2310. {
  2311. * LMGetApplZone() *** DEPRECATED ***
  2312. *
  2313. * Summary:
  2314. * This function is deprecated on Mac OS X.
  2315. *
  2316. * Mac OS X threading:
  2317. * Not thread safe
  2318. *
  2319. * Availability:
  2320. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  2321. * CarbonLib: in CarbonLib 1.0 and later
  2322. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2323. }
  2324. function LMGetApplZone: THz; external name '_LMGetApplZone';
  2325. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  2326. {
  2327. * LMSetApplZone() *** DEPRECATED ***
  2328. *
  2329. * Summary:
  2330. * This function is deprecated on Mac OS X.
  2331. *
  2332. * Mac OS X threading:
  2333. * Not thread safe
  2334. *
  2335. * Availability:
  2336. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  2337. * CarbonLib: in CarbonLib 1.0 and later
  2338. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2339. }
  2340. procedure LMSetApplZone( value: THz ); external name '_LMSetApplZone';
  2341. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  2342. {$endc} {not TARGET_CPU_64}
  2343. {$endc} {TARGET_OS_MAC}
  2344. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  2345. end.
  2346. {$endc} {not MACOSALLINCLUDE}