MacMemory.pas 84 KB

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