1 {
2      File:       CarbonCore/OSUtils.h
3 
4      Contains:   OS Utilities Interfaces.
5                  The contents of this header file are deprecated.
6 
7      Copyright:  � 1985-2011 by Apple Inc. All rights reserved.
8 }
9 {
10     Modified for use with Free Pascal
11     Version 308
12     Please report any bugs to <gpc@microbizz.nl>
13 }
14 
15 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
16 {$mode macpas}
17 {$modeswitch cblocks}
18 {$packenum 1}
19 {$macro on}
20 {$inline on}
21 {$calling mwpascal}
22 
23 unit OSUtils;
24 interface
25 {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
26 {$setc GAP_INTERFACES_VERSION := $0308}
27 
28 {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
29     {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
30 {$endc}
31 
32 {$ifc defined CPUPOWERPC and defined CPUI386}
33 	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
34 {$endc}
35 {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
36 	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
37 {$endc}
38 
39 {$ifc not defined __ppc__ and defined CPUPOWERPC32}
40 	{$setc __ppc__ := 1}
41 {$elsec}
42 	{$setc __ppc__ := 0}
43 {$endc}
44 {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
45 	{$setc __ppc64__ := 1}
46 {$elsec}
47 	{$setc __ppc64__ := 0}
48 {$endc}
49 {$ifc not defined __i386__ and defined CPUI386}
50 	{$setc __i386__ := 1}
51 {$elsec}
52 	{$setc __i386__ := 0}
53 {$endc}
54 {$ifc not defined __x86_64__ and defined CPUX86_64}
55 	{$setc __x86_64__ := 1}
56 {$elsec}
57 	{$setc __x86_64__ := 0}
58 {$endc}
59 {$ifc not defined __arm__ and defined CPUARM}
60 	{$setc __arm__ := 1}
61 {$elsec}
62 	{$setc __arm__ := 0}
63 {$endc}
64 {$ifc not defined __arm64__ and defined CPUAARCH64}
65   {$setc __arm64__ := 1}
66 {$elsec}
67   {$setc __arm64__ := 0}
68 {$endc}
69 
70 {$ifc defined cpu64}
71   {$setc __LP64__ := 1}
72 {$elsec}
73   {$setc __LP64__ := 0}
74 {$endc}
75 
76 
77 {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
78 	{$error Conflicting definitions for __ppc__ and __i386__}
79 {$endc}
80 
81 {$ifc defined __ppc__ and __ppc__}
82 	{$setc TARGET_CPU_PPC := TRUE}
83 	{$setc TARGET_CPU_PPC64 := FALSE}
84 	{$setc TARGET_CPU_X86 := FALSE}
85 	{$setc TARGET_CPU_X86_64 := FALSE}
86 	{$setc TARGET_CPU_ARM := FALSE}
87 	{$setc TARGET_CPU_ARM64 := FALSE}
88 	{$setc TARGET_OS_MAC := TRUE}
89 	{$setc TARGET_OS_IPHONE := FALSE}
90 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
91 	{$setc TARGET_OS_EMBEDDED := FALSE}
92 {$elifc defined __ppc64__ and __ppc64__}
93 	{$setc TARGET_CPU_PPC := FALSE}
94 	{$setc TARGET_CPU_PPC64 := TRUE}
95 	{$setc TARGET_CPU_X86 := FALSE}
96 	{$setc TARGET_CPU_X86_64 := FALSE}
97 	{$setc TARGET_CPU_ARM := FALSE}
98 	{$setc TARGET_CPU_ARM64 := FALSE}
99 	{$setc TARGET_OS_MAC := TRUE}
100 	{$setc TARGET_OS_IPHONE := FALSE}
101 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
102 	{$setc TARGET_OS_EMBEDDED := FALSE}
103 {$elifc defined __i386__ and __i386__}
104 	{$setc TARGET_CPU_PPC := FALSE}
105 	{$setc TARGET_CPU_PPC64 := FALSE}
106 	{$setc TARGET_CPU_X86 := TRUE}
107 	{$setc TARGET_CPU_X86_64 := FALSE}
108 	{$setc TARGET_CPU_ARM := FALSE}
109 	{$setc TARGET_CPU_ARM64 := FALSE}
110 {$ifc defined iphonesim}
111  	{$setc TARGET_OS_MAC := FALSE}
112 	{$setc TARGET_OS_IPHONE := TRUE}
113 	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
114 {$elsec}
115 	{$setc TARGET_OS_MAC := TRUE}
116 	{$setc TARGET_OS_IPHONE := FALSE}
117 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
118 {$endc}
119 	{$setc TARGET_OS_EMBEDDED := FALSE}
120 {$elifc defined __x86_64__ and __x86_64__}
121 	{$setc TARGET_CPU_PPC := FALSE}
122 	{$setc TARGET_CPU_PPC64 := FALSE}
123 	{$setc TARGET_CPU_X86 := FALSE}
124 	{$setc TARGET_CPU_X86_64 := TRUE}
125 	{$setc TARGET_CPU_ARM := FALSE}
126 	{$setc TARGET_CPU_ARM64 := FALSE}
127 {$ifc defined iphonesim}
128  	{$setc TARGET_OS_MAC := FALSE}
129 	{$setc TARGET_OS_IPHONE := TRUE}
130 	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
131 {$elsec}
132 	{$setc TARGET_OS_MAC := TRUE}
133 	{$setc TARGET_OS_IPHONE := FALSE}
134 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
135 {$endc}
136 	{$setc TARGET_OS_EMBEDDED := FALSE}
137 {$elifc defined __arm__ and __arm__}
138 	{$setc TARGET_CPU_PPC := FALSE}
139 	{$setc TARGET_CPU_PPC64 := FALSE}
140 	{$setc TARGET_CPU_X86 := FALSE}
141 	{$setc TARGET_CPU_X86_64 := FALSE}
142 	{$setc TARGET_CPU_ARM := TRUE}
143 	{$setc TARGET_CPU_ARM64 := FALSE}
144 	{$setc TARGET_OS_MAC := FALSE}
145 	{$setc TARGET_OS_IPHONE := TRUE}
146 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
147 	{$setc TARGET_OS_EMBEDDED := TRUE}
148 {$elifc defined __arm64__ and __arm64__}
149 	{$setc TARGET_CPU_PPC := FALSE}
150 	{$setc TARGET_CPU_PPC64 := FALSE}
151 	{$setc TARGET_CPU_X86 := FALSE}
152 	{$setc TARGET_CPU_X86_64 := FALSE}
153 	{$setc TARGET_CPU_ARM := FALSE}
154 	{$setc TARGET_CPU_ARM64 := TRUE}
155 {$ifc defined ios}
156 	{$setc TARGET_OS_MAC := FALSE}
157 	{$setc TARGET_OS_IPHONE := TRUE}
158 	{$setc TARGET_OS_EMBEDDED := TRUE}
159 {$elsec}
160 	{$setc TARGET_OS_MAC := TRUE}
161 	{$setc TARGET_OS_IPHONE := FALSE}
162 	{$setc TARGET_OS_EMBEDDED := FALSE}
163 {$endc}
164 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
165 {$elsec}
166 	{$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
167 {$endc}
168 
169 {$ifc defined __LP64__ and __LP64__ }
170   {$setc TARGET_CPU_64 := TRUE}
171 {$elsec}
172   {$setc TARGET_CPU_64 := FALSE}
173 {$endc}
174 
175 {$ifc defined FPC_BIG_ENDIAN}
176 	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
177 	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
178 {$elifc defined FPC_LITTLE_ENDIAN}
179 	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
180 	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
181 {$elsec}
182 	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
183 {$endc}
184 {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
185 {$setc CALL_NOT_IN_CARBON := FALSE}
186 {$setc OLDROUTINENAMES := FALSE}
187 {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
188 {$setc OPAQUE_UPP_TYPES := TRUE}
189 {$setc OTCARBONAPPLICATION := TRUE}
190 {$setc OTKERNEL := FALSE}
191 {$setc PM_USE_SESSION_APIS := TRUE}
192 {$setc TARGET_API_MAC_CARBON := TRUE}
193 {$setc TARGET_API_MAC_OS8 := FALSE}
194 {$setc TARGET_API_MAC_OSX := TRUE}
195 {$setc TARGET_CARBON := TRUE}
196 {$setc TARGET_CPU_68K := FALSE}
197 {$setc TARGET_CPU_MIPS := FALSE}
198 {$setc TARGET_CPU_SPARC := FALSE}
199 {$setc TARGET_OS_UNIX := FALSE}
200 {$setc TARGET_OS_WIN32 := FALSE}
201 {$setc TARGET_RT_MAC_68881 := FALSE}
202 {$setc TARGET_RT_MAC_CFM := FALSE}
203 {$setc TARGET_RT_MAC_MACHO := TRUE}
204 {$setc TYPED_FUNCTION_POINTERS := TRUE}
205 {$setc TYPE_BOOL := FALSE}
206 {$setc TYPE_EXTENDED := FALSE}
207 {$setc TYPE_LONGLONG := TRUE}
208 uses MacTypes,CFBase;
209 {$endc} {not MACOSALLINCLUDE}
210 
211 
212 {$ifc TARGET_OS_MAC}
213 
214 {$ALIGN POWER}
215 
216 
217 {  HandToHand and other memory utilties were moved to MacMemory.h }
218 
219 {  Date and Time utilties were moved to DateTimeUtils.h }
220 
221 
222 {$ALIGN MAC68K}
223 
224 const
225 { result types for RelString Call }
226 	sortsBefore = -1;   {first string < second string}
227 	sortsEqual = 0;    {first string = second string}
228 	sortsAfter = 1;     {first string > second string}
229 
230 const
231 	dummyType = 0;
232 	vType = 1;
233 	ioQType = 2;
234 	drvQType = 3;
235 	evType = 4;
236 	fsQType = 5;
237 	sIQType = 6;
238 	dtQType = 7;
239 	nmType = 8;
240 
241 type
242 	QTypes = SignedByte;
243 	QElemPtr = ^QElem;
244 	QElem = record
245 		qLink: QElemPtr;
246 		qType: SInt16;
247 		qData: array [0..0] of SInt16;
248 	end;
249 type
250 	QHdr = record
251 		qFlags: {volatile} SInt16;
252 		qHead: {volatile} QElemPtr;
253 		qTail: {volatile} QElemPtr;
254 	end;
255 	QHdrPtr = ^QHdr;
256 {
257     In order for MachineLocation to be endian-safe, a new member
258     has been added to the 'u' union in the structure. You are
259     encouraged to use the new member instead of the old one.
260 
261     If your code looked like this:
262 
263         MachineLocation.u.dlsDelta = isDLS? 0x80: 0x00;
264 
265     you should change it to this:
266 
267         MachineLocation.u.dls.Delta = isDLS? 0x80: 0x00;
268 
269     to be endian safe. The gmtDelta remains the same; the low 24-bits
270     are used. Remember that order of assignment DOES matter:
271 
272     This will overwrite results:
273 
274         MachineLocation.u.dls.Delta = 0xAA;         // u = 0xAAGGGGGG; G=Garbage
275         MachineLocation.u.gmtDelta = 0xBBBBBB;      // u = 0x00BBBBBB;
276 
277     when in fact reversing the assignment would have preserved the values:
278 
279         MachineLocation.u.gmtDelta = 0xBBBBBB;      // u = 0x00BBBBBB;
280         MachineLocation.u.dls.Delta = 0xAA;         // u = 0xAABBBBBB;
281 
282     NOTE:   The information regarding dlsDelta in Inside Mac is INCORRECT.
283             It's always 0x80 for daylight-saving time or 0x00 for standard time.
284 }
285 type
286 	MachineLocationPtr = ^MachineLocation;
287 	MachineLocation = packed record
288 		latitude: Fract;
289 		longitude: Fract;
290 		case SInt16 of
291 {$ifc TARGET_RT_BIG_ENDIAN}
292 		0: (
293 			dlsDelta: SInt8;									{ signed byte; daylight savings delta }
294 			);
295 {$endc}
296 		1: (
297 			gmtDelta: SIGNEDLONG;           { use low 24-bits only }
298 			);
299 		2: (
300 {$ifc TARGET_RT_LITTLE_ENDIAN}
301 			pad0,pad1,pad2: SInt8;
302 {$endc}
303 			Delta: SInt8;
304 			);
305 	end;
306 {
307  *  IsMetric()   *** DEPRECATED ***
308  *
309  *  Deprecated:
310  *    Use CFLocaleGetValue() and the property kCFLocaleUsesMetricSystem
311  *    to determine this value.
312  *
313  *  Summary:
314  *    Verifies whether the current script system is using the metric
315  *    system or the English system of measurement.
316  *
317  *  Discussion:
318  *    The IsMetric function examines the metricSys field of the
319  *    numeric-format resource (resource type 'itl0') to determine if
320  *    the current script is using the metric system. A value of 255 in
321  *    the metricSys field indicates that the metric system
322  *    (centimeters, kilometers, milligrams, degrees Celsius, and so on)
323  *    is being used. A value of 0 in the metricSys field indicates that
324  *    the English system of measurement (inches, miles, ounces, degrees
325  *    Fahrenheit, and so on) is used.
326  *    If you want to use units of measurement different from that of
327  *    the current script, you need to override the value of the
328  *    metricSys field in the current numeric-format resource. You can
329  *    do this by using your own version of the numeric-format resource
330  *    instead of the current script system�s default international
331  *    resource.
332  *    The IsMetric function is the same as the IUMetric function, which
333  *    was previously available with the International Utilities Package.
334  *
335  *  Mac OS X threading:
336  *    Not thread safe
337  *
338  *  Result:
339  *    TRUE if the metric system is being used; FALSE if the English
340  *    system is being used.
341  *
342  *  Availability:
343  *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.7
344  *    CarbonLib:        in CarbonLib 1.0 and later
345  *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
346  }
IsMetricnull347 function IsMetric: Boolean; external name '_IsMetric';
348 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
349 
350 
351 {
352  *  Delay()
353  *
354  *  Summary:
355  *    Delays execture for the specified amount of time.
356  *
357  *  Mac OS X threading:
358  *    Thread safe
359  *
360  *  Parameters:
361  *
362  *    numTicks:
363  *      the number of ticks to delay  for
364  *
365  *    finalTicks:
366  *      on return, if not NULL, will contain the value of TickCount()
367  *      at the end of the delay period
368  *
369  *  Availability:
370  *    Mac OS X:         in version 10.0 and later in CoreServices.framework
371  *    CarbonLib:        in CarbonLib 1.0 and later
372  *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
373  }
374 procedure Delay( numTicks: UNSIGNEDLONG; var finalTicks: UNSIGNEDLONG ); external name '_Delay';
375 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
376 
377 
378 {
379  *  Enqueue()
380  *
381  *  Summary:
382  *    Atomically adds a queue element to the given queue
383  *
384  *  Discussion:
385  *    A queue ( represented by a QHdrPtr ) is a singly linked list of
386  *    elements.  Enqueue inserts the given element into the queue in a
387  *    multi-thread safe way.  If the element is already in the queue,
388  *    or in some other queue, the data structures will be corrupted and
389  *    will likely cause a crash or infinite loop.
390  *
391  *  Mac OS X threading:
392  *    Thread safe
393  *
394  *  Parameters:
395  *
396  *    qElement:
397  *      a pointer to the element to be inserted
398  *
399  *    qHeader:
400  *      a pointer to the queue header.
401  *
402  *  Availability:
403  *    Mac OS X:         in version 10.0 and later in CoreServices.framework
404  *    CarbonLib:        in CarbonLib 1.0 and later
405  *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
406  }
407 procedure Enqueue( qElement: QElemPtr; qHeader: QHdrPtr ); external name '_Enqueue';
408 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
409 
410 
411 {
412  *  Dequeue()
413  *
414  *  Summary:
415  *    Atomically removes a queue element from the given queue
416  *
417  *  Discussion:
418  *    A queue ( represented by a QHdrPtr ) is a singly linked list of
419  *    elements.  Dequeue removes the given element from the queue in a
420  *    multi-thread safe way.  If the element is not in the queue, qErr
421  *    is returned.
422  *
423  *  Mac OS X threading:
424  *    Thread safe
425  *
426  *  Parameters:
427  *
428  *    qElement:
429  *      a pointer to the element to be removed
430  *
431  *    qHeader:
432  *      a pointer to the queue header.
433  *
434  *  Availability:
435  *    Mac OS X:         in version 10.0 and later in CoreServices.framework
436  *    CarbonLib:        in CarbonLib 1.0 and later
437  *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
438  }
Dequeuenull439 function Dequeue( qElement: QElemPtr; qHeader: QHdrPtr ): OSErr; external name '_Dequeue';
440 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
441 
442 
443 {$ifc not TARGET_CPU_64}
444 {
445  *  MakeDataExecutable()
446  *
447  *  Summary:
448  *    Notifies the system that the specified data is subject to
449  *    execution.
450  *
451  *  Discussion:
452  *    On some computer architectures it is necessary to tell the
453  *    processor that an area of memory should be made executable.  This
454  *    function does the necessary operations ( if possible ) to make it
455  *    possible to execute code in the given address range.
456  *    MakeDataExecutable is not supported for 64-bit applications. Use
457  *    sys_icache_invalidate(3) and/or mprotect(2) as appropriate.
458  *
459  *  Mac OS X threading:
460  *    Thread safe
461  *
462  *  Parameters:
463  *
464  *    baseAddress:
465  *      the starting address to be made executable
466  *
467  *    length:
468  *      the length of the data pointed to by the baseAddress parameter.
469  *
470  *  Availability:
471  *    Mac OS X:         in version 10.0 and later in CoreServices.framework [32-bit only]
472  *    CarbonLib:        in CarbonLib 1.0 and later
473  *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
474  }
475 procedure MakeDataExecutable( baseAddress: UnivPtr; length: UNSIGNEDLONG ); external name '_MakeDataExecutable';
476 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
477 
478 
479 {$endc} {not TARGET_CPU_64}
480 
481 {
482  *  ReadLocation()
483  *
484  *  Summary:
485  *    Obtains information about a geographic location or time zone.
486  *
487  *  Discussion:
488  *    The latitude and longitude are stored as Fract values, giving
489  *    accuracy to within one foot. For example, a Fract value of 1.0
490  *    equals 90 degrees �1.0 equals �90 degrees and �2.0 equals �180
491  *    degrees.
492  *    To convert these values to a degrees format, you need to convert
493  *    the Fract values first to the Fixed data type, then to the
494  *    LongInt data type. Use the Mathematical and Logical Utilities
495  *    functions Fract2Fix and Fix2Long to accomplish this task.
496  *    The DST value is a signed byte value that specifies the offset
497  *    for the hour field�whether to add one hour, subtract one hour, or
498  *    make no change at all.
499  *    The GMT value is in seconds east of GMT. For example, San
500  *    Francisco is at �28,800 seconds (8 hours * 3,600 seconds per
501  *    hour) east of GMT. The gmtDelta field is a 3-byte value contained
502  *    in a long word, so you must take care to get it properly.
503  *    For more information on the Fract data type and the conversion
504  *    routines Long2Fix, Fix2Fract, Fract2Fix, and Fix2Long, see
505  *    Mathematical and Logical Utilities.
506  *
507  *  Mac OS X threading:
508  *    Not thread safe
509  *
510  *  Parameters:
511  *
512  *    loc:
513  *      On return, the fields of the geographic location structure
514  *      containing the geographic location and the time-zone
515  *      information.
516  *      You can get values for the latitude, longitude, daylight
517  *      savings time (DST), or Greenwich mean time (GMT). If the
518  *      geographic location record has never been set, all fields
519  *      contain 0.
520  *
521  *  Availability:
522  *    Mac OS X:         in version 10.0 and later in CoreServices.framework
523  *    CarbonLib:        in CarbonLib 1.0 and later
524  *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
525  }
526 procedure ReadLocation( var loc: MachineLocation ); external name '_ReadLocation';
527 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
528 
529 
530 {
531  *  TickCount()
532  *
533  *  Summary:
534  *    Obtains the current number of ticks (a tick is approximately 1/60
535  *    of a second) approximately since the system last started up.
536  *
537  *  Discussion:
538  *    The TickCount function returns an unsigned 32-bit integer that
539  *    indicates the current number of ticks since the system last
540  *    started up. You can use this value to compare the number of ticks
541  *    that have elapsed since a given event or other action occurred.
542  *    For example, you could compare the current value returned by
543  *    TickCount with the value of the when field of an event
544  *    structure.
545  *    The tick count rolls over in approximately 2 years 3 months,
546  *    which means you should not use this to time intervals which may
547  *    exceed ( or even approach ) this interval.
548  *    Do not rely on the tick count being exact; it is usually accurate
549  *    to within one tick, but this level of accuracy is not guaranteed.
550  *
551  *  Mac OS X threading:
552  *    Thread safe
553  *
554  *  Result:
555  *    the tick count
556  *
557  *  Availability:
558  *    Mac OS X:         in version 10.0 and later in CoreServices.framework
559  *    CarbonLib:        in CarbonLib 1.0 and later
560  *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
561  }
TickCountnull562 function TickCount: UInt32; external name '_TickCount';
563 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
564 
565 
566 {
567  *  CSCopyUserName()
568  *
569  *  Summary:
570  *    Returns a reference to the CFString that represents the user name.
571  *
572  *  Mac OS X threading:
573  *    Thread safe
574  *
575  *  Parameters:
576  *
577  *    useShortName:
578  *      A Boolean value that specifies whether to return the short name
579  *      or full name of the user.
580  *
581  *  Result:
582  *    the requested name in a CFStringRef.  You should release this
583  *    when you are done with it.
584  *
585  *  Availability:
586  *    Mac OS X:         in version 10.0 and later in CoreServices.framework
587  *    CarbonLib:        in CarbonLib 1.5 and later
588  *    Non-Carbon CFM:   not available
589  }
CSCopyUserNamenull590 function CSCopyUserName( useShortName: Boolean ): CFStringRef; external name '_CSCopyUserName';
591 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
592 
593 
594 {
595  *  CSCopyMachineName()
596  *
597  *  Summary:
598  *    Returns a reference to the CFString that represents the computer
599  *    name.
600  *
601  *  Mac OS X threading:
602  *    Thread safe
603  *
604  *  Result:
605  *    the name of this machine in a CFStringRef.  You should release
606  *    this when you are done with it.
607  *
608  *  Availability:
609  *    Mac OS X:         in version 10.0 and later in CoreServices.framework
610  *    CarbonLib:        in CarbonLib 1.5 and later
611  *    Non-Carbon CFM:   not available
612  }
CSCopyMachineNamenull613 function CSCopyMachineName: CFStringRef; external name '_CSCopyMachineName';
614 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
615 
616 
617 const
618 	useFree = 0;
619 	useATalk = 1;
620 	useAsync = 2;
621 	useExtClk = 3;    {Externally clocked}
622 	useMIDI = 4;
623 
624 const
625 	false32b = 0;    {24 bit addressing error}
626 	true32b = 1;     {32 bit addressing error}
627 
628 type
629 	SysPPtr = UnivPtr;
630 
GetMMUModenull631 function GetMMUMode: SInt8; inline;
632 procedure SwapMMUMode( var mode: SInt8 ); inline;
633 
634 {$ifc not TARGET_CPU_64}
635 {
636  *  GetSysPPtr()   *** DEPRECATED ***
637  *
638  *  Deprecated:
639  *    Don't use this function; it always returns NULL on Mac OS X.
640  *
641  *  Availability:
642  *    Mac OS X:         in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
643  *    CarbonLib:        in CarbonLib 1.0 and later
644  *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
645  }
GetSysPPtrnull646 function GetSysPPtr: SysPPtr; external name '_GetSysPPtr';
647 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
648 
649 
650 {
651     NOTE: SysBeep() has been moved to Sound.h.
652  We could not automatically #include Sound.h in this file
653  because Sound.h indirectly #include's OSUtils.h which
654  would make a circular include.
655  }
656 {$endc} {not TARGET_CPU_64}
657 
658 type
659 	DeferredTaskProcPtr = procedure( dtParam: SIGNEDLONG );
660 	DeferredTaskUPP = DeferredTaskProcPtr;
661 {
662  *  NewDeferredTaskUPP()
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:   available as macro/inline
668  }
NewDeferredTaskUPPnull669 function NewDeferredTaskUPP( userRoutine: DeferredTaskProcPtr ): DeferredTaskUPP; external name '_NewDeferredTaskUPP';
670 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
671 
672 {
673  *  DisposeDeferredTaskUPP()
674  *
675  *  Availability:
676  *    Mac OS X:         in version 10.0 and later in CoreServices.framework
677  *    CarbonLib:        in CarbonLib 1.0 and later
678  *    Non-Carbon CFM:   available as macro/inline
679  }
680 procedure DisposeDeferredTaskUPP( userUPP: DeferredTaskUPP ); external name '_DisposeDeferredTaskUPP';
681 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
682 
683 {
684  *  InvokeDeferredTaskUPP()
685  *
686  *  Availability:
687  *    Mac OS X:         in version 10.0 and later in CoreServices.framework
688  *    CarbonLib:        in CarbonLib 1.0 and later
689  *    Non-Carbon CFM:   available as macro/inline
690  }
691 procedure InvokeDeferredTaskUPP( dtParam: SIGNEDLONG; userUPP: DeferredTaskUPP ); external name '_InvokeDeferredTaskUPP';
692 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
693 
694 type
695 	DeferredTask = record
696 		qLink: {volatile} QElemPtr;
697 		qType: SInt16;
698 		dtFlags: {volatile} SInt16;
699 		dtAddr: DeferredTaskUPP;
700 		dtParam: SIGNEDLONG;
701 		dtReserved: SIGNEDLONG;
702 	end;
703 	DeferredTaskPtr = ^DeferredTask;
704 {$ifc not TARGET_CPU_64}
705 {
706  *  DTInstall()   *** DEPRECATED ***
707  *
708  *  Deprecated:
709  *    The Deferred Task Manager is deprecated.  Look into restructuring
710  *    your code to use threads, or MPTasks, or some other threading
711  *    solution.
712  *
713  *  Summary:
714  *    Adds the specified task record to the deferred-task queue.
715  *
716  *  Mac OS X threading:
717  *    Thread safe
718  *
719  *  Availability:
720  *    Mac OS X:         in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
721  *    CarbonLib:        in CarbonLib 1.0 and later
722  *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
723  }
DTInstallnull724 function DTInstall( dtTaskPtr: DeferredTaskPtr ): OSErr; external name '_DTInstall';
725 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
726 
727 
728 {
729  *  DTUninstall()   *** DEPRECATED ***
730  *
731  *  Deprecated:
732  *    The Deferred Task Manager is deprecated.  Look into restructuring
733  *    your code to use threads, or MPTasks, or some other threading
734  *    solution.
735  *
736  *  Summary:
737  *    Adds the specified task record to the deferred-task queue.
738  *
739  *  Mac OS X threading:
740  *    Thread safe
741  *
742  *  Availability:
743  *    Mac OS X:         in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
744  *    CarbonLib:        not available
745  *    Non-Carbon CFM:   not available
746  }
DTUninstallnull747 function DTUninstall( dtTaskPtr: DeferredTaskPtr ): OSErr; external name '_DTUninstall';
748 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
749 
750 
751 {
752  *  SetCurrentA5()   *** DEPRECATED ***
753  *
754  *  Deprecated:
755  *    You no longer need to use SetCurrentA5() on Mac OS X.
756  *
757  *  Mac OS X threading:
758  *    Thread safe
759  *
760  *  Availability:
761  *    Mac OS X:         in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
762  *    CarbonLib:        in CarbonLib 1.0 and later
763  *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
764  }
SetCurrentA5null765 function SetCurrentA5: SIGNEDLONG; external name '_SetCurrentA5';
766 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
767 
768 
769 {
770  *  SetA5()   *** DEPRECATED ***
771  *
772  *  Deprecated:
773  *    You no longer need to use SetA5() on Mac OS X.
774  *
775  *  Mac OS X threading:
776  *    Thread safe
777  *
778  *  Availability:
779  *    Mac OS X:         in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
780  *    CarbonLib:        in CarbonLib 1.0 and later
781  *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
782  }
SetA5null783 function SetA5( newA5: SIGNEDLONG ): SIGNEDLONG; external name '_SetA5';
784 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
785 
786 
787 {
788  *  InitUtil()   *** DEPRECATED ***
789  *
790  *  Deprecated:
791  *    It is not necessary to call InitUtil on Mac OS X.  You should
792  *    remove all calls to this from your code.
793  *
794  *  Mac OS X threading:
795  *    Thread safe
796  *
797  *  Availability:
798  *    Mac OS X:         in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
799  *    CarbonLib:        in CarbonLib 1.0 and later
800  *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
801  }
InitUtilnull802 function InitUtil: OSErr; external name '_InitUtil';
803 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
804 
805 
806 {
807  *  WriteParam()   *** DEPRECATED ***
808  *
809  *  Deprecated:
810  *    This function no longer does anything on Mac OS X; you should
811  *    remove all calls to it from your code.
812  *
813  *  Mac OS X threading:
814  *    Not thread safe
815  *
816  *  Availability:
817  *    Mac OS X:         in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
818  *    CarbonLib:        in CarbonLib 1.0 and later
819  *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
820  }
WriteParamnull821 function WriteParam: OSErr; external name '_WriteParam';
822 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
823 
824 
825 {
826  *  WriteLocation()   *** DEPRECATED ***
827  *
828  *  Deprecated:
829  *    WriteLocation can not be used to set the geographic information
830  *    on Mac OS X.  You should remove all calls to this function from
831  *    your code.
832  *
833  *  Mac OS X threading:
834  *    Not thread safe
835  *
836  *  Availability:
837  *    Mac OS X:         in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.0
838  *    CarbonLib:        in CarbonLib 1.0 and later
839  *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
840  }
841 procedure WriteLocation( const (*var*) loc: MachineLocation ); external name '_WriteLocation';
842 (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_1, __IPHONE_NA, __IPHONE_NA) *)
843 
844 
845 {$endc} {not TARGET_CPU_64}
846 {$endc} {TARGET_OS_MAC}
847 
848 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
849 implementation
850 
851 {$ifc TARGET_OS_MAC}
852 
853 {$R-}
854 
GetMMUModenull855 function GetMMUMode: SInt8; inline;
856 begin
857 	GetMMUMode:= true32b
858 end;
859 
860 procedure SwapMMUMode( var mode: SInt8 ); inline;
861 begin
862 	mode := true32b;
863 end;
864 
865 
866 {$endc} {TARGET_OS_MAC}
867 
868 end.
869 
870 {$endc} {not MACOSALLINCLUDE}
871