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