2 * Copyright (c) 2011 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
25 Copyright (c) 1998-2011, Apple Inc. All rights reserved.
29 APPLE SPI: NOT TO BE USED OUTSIDE APPLE!
32 #if !defined(__COREFOUNDATION_CFPRIV__)
33 #define __COREFOUNDATION_CFPRIV__ 1
36 #include <CoreFoundation/CFBase.h>
37 #include <CoreFoundation/CFArray.h>
38 #include <CoreFoundation/CFString.h>
39 #include <CoreFoundation/CFURL.h>
40 #include <CoreFoundation/CFLocale.h>
41 #include <CoreFoundation/CFDate.h>
46 #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_LINUX)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)
47 #include <CoreFoundation/CFMachPort.h>
50 #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) || TARGET_OS_WIN32
51 #include <CoreFoundation/CFRunLoop.h>
52 #include <CoreFoundation/CFSocket.h>
53 #include <CoreFoundation/CFBundlePriv.h>
58 CF_EXPORT
intptr_t _CFDoOperation(intptr_t code
, intptr_t subcode1
, intptr_t subcode2
);
60 CF_EXPORT
void _CFRuntimeSetCFMPresent(void *a
);
62 CF_EXPORT
const char *_CFProcessPath(void);
63 CF_EXPORT
const char **_CFGetProcessPath(void);
64 CF_EXPORT
const char **_CFGetProgname(void);
67 #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_LINUX)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)
68 CF_EXPORT CFRunLoopRef
CFRunLoopGetMain(void);
69 CF_EXPORT SInt32
CFRunLoopRunSpecific(CFRunLoopRef rl
, CFStringRef modeName
, CFTimeInterval seconds
, Boolean returnAfterSourceHandled
);
71 CF_EXPORT
void _CFRunLoopSetCurrent(CFRunLoopRef rl
);
73 CF_EXPORT
void _CFRunLoopStopMode(CFRunLoopRef rl
, CFStringRef modeName
);
75 CF_EXPORT CFIndex
CFMachPortGetQueuedMessageCount(CFMachPortRef mp
);
77 CF_EXPORT CFPropertyListRef
_CFURLCopyPropertyListRepresentation(CFURLRef url
);
79 CF_EXPORT CFPropertyListRef
_CFURLCopyPropertyListRepresentation(CFURLRef url
);
80 CF_EXPORT CFURLRef
_CFURLCreateFromPropertyListRepresentation(CFAllocatorRef alloc
, CFPropertyListRef pListRepresentation
);
82 CF_EXPORT
void CFPreferencesFlushCaches(void);
85 CF_EXPORT Boolean
_CFURLGetWideFileSystemRepresentation(CFURLRef url
, Boolean resolveAgainstBase
, wchar_t *buffer
, CFIndex bufferLength
);
89 #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)
92 Boolean
_CFGetFSSpecFromURL(CFAllocatorRef alloc
, CFURLRef url
, struct FSSpec
*spec
);
95 CFURLRef
_CFCreateURLFromFSSpec(CFAllocatorRef alloc
, const struct FSSpec
*voidspec
, Boolean isDirectory
);
100 kCFURLComponentDecompositionNonHierarchical
,
101 kCFURLComponentDecompositionRFC1808
, /* use this for RFC 1738 decompositions as well */
102 kCFURLComponentDecompositionRFC2396
104 typedef CFIndex CFURLComponentDecomposition
;
108 CFStringRef schemeSpecific
;
109 } CFURLComponentsNonHierarchical
;
114 CFStringRef password
;
116 CFIndex port
; /* kCFNotFound means ignore/omit */
117 CFArrayRef pathComponents
;
118 CFStringRef parameterString
;
120 CFStringRef fragment
;
122 } CFURLComponentsRFC1808
;
127 /* if the registered name form of the net location is used, userinfo is NULL, port is kCFNotFound, and host is the entire registered name. */
128 CFStringRef userinfo
;
132 CFArrayRef pathComponents
;
134 CFStringRef fragment
;
136 } CFURLComponentsRFC2396
;
138 /* Fills components and returns TRUE if the URL can be decomposed according to decompositionType; FALSE (leaving components unchanged) otherwise. components should be a pointer to the CFURLComponents struct defined above that matches decompositionStyle */
140 Boolean
_CFURLCopyComponents(CFURLRef url
, CFURLComponentDecomposition decompositionType
, void *components
);
142 /* Creates and returns the URL described by components; components should point to the CFURLComponents struct defined above that matches decompositionType. */
144 CFURLRef
_CFURLCreateFromComponents(CFAllocatorRef alloc
, CFURLComponentDecomposition decompositionType
, const void *components
);
145 #define CFURLCopyComponents _CFURLCopyComponents
146 #define CFURLCreateFromComponents _CFURLCreateFromComponents
150 CF_EXPORT Boolean
_CFStringGetFileSystemRepresentation(CFStringRef string
, UInt8
*buffer
, CFIndex maxBufLen
);
152 /* If this is publicized, we might need to create a GetBytesPtr type function as well. */
153 CF_EXPORT CFStringRef
_CFStringCreateWithBytesNoCopy(CFAllocatorRef alloc
, const UInt8
*bytes
, CFIndex numBytes
, CFStringEncoding encoding
, Boolean externalFormat
, CFAllocatorRef contentsDeallocator
);
155 /* These return NULL on MacOS 8 */
156 // This one leaks the returned string in order to be thread-safe.
157 // CF cannot help you in this matter if you continue to use this SPI.
159 CFStringRef
CFGetUserName(void);
162 CFStringRef
CFCopyUserName(void);
165 CFURLRef
CFCopyHomeDirectoryURLForUser(CFStringRef uName
); /* Pass NULL for the current user's home directory */
169 CFCopySearchPathForDirectoriesInDomains returns the various
170 standard system directories where apps, resources, etc get
171 installed. Because queries can return multiple directories,
172 you get back a CFArray (which you should free when done) of
173 CFURLs. The directories are returned in search path order;
174 that is, the first place to look is returned first. This API
175 may return directories that do not exist yet. If NSUserDomain
176 is included in a query, then the results will contain "~" to
177 refer to the user's directory. Specify expandTilde to expand
178 this to the current user's home. Some calls might return no
180 ??? On MacOS 8 this function currently returns an empty array.
183 kCFApplicationDirectory
= 1, /* supported applications (Applications) */
184 kCFDemoApplicationDirectory
, /* unsupported applications, demonstration versions (Demos) */
185 kCFDeveloperApplicationDirectory
, /* developer applications (Developer/Applications) */
186 kCFAdminApplicationDirectory
, /* system and network administration applications (Administration) */
187 kCFLibraryDirectory
, /* various user-visible documentation, support, and configuration files, resources (Library) */
188 kCFDeveloperDirectory
, /* developer resources (Developer) */
189 kCFUserDirectory
, /* user home directories (Users) */
190 kCFDocumentationDirectory
, /* documentation (Documentation) */
191 kCFDocumentDirectory
, /* documents (Library/Documents) */
192 kCFAllApplicationsDirectory
= 100, /* all directories where applications can occur (ie Applications, Demos, Administration, Developer/Applications) */
193 kCFAllLibrariesDirectory
= 101 /* all directories where resources can occur (Library, Developer) */
195 typedef CFIndex CFSearchPathDirectory
;
198 kCFUserDomainMask
= 1, /* user's home directory --- place to install user's personal items (~) */
199 kCFLocalDomainMask
= 2, /* local to the current machine --- place to install items available to everyone on this machine (/Local) */
200 kCFNetworkDomainMask
= 4, /* publically available location in the local area network --- place to install items available on the network (/Network) */
201 kCFSystemDomainMask
= 8, /* provided by Apple, unmodifiable (/System) */
202 kCFAllDomainsMask
= 0x0ffff /* all domains: all of the above and more, future items */
204 typedef CFOptionFlags CFSearchPathDomainMask
;
207 CFArrayRef
CFCopySearchPathForDirectoriesInDomains(CFSearchPathDirectory directory
, CFSearchPathDomainMask domainMask
, Boolean expandTilde
);
210 CF_EXPORT
const CFStringRef kCFFileURLExists
;
211 CF_EXPORT
const CFStringRef kCFFileURLPOSIXMode
;
212 CF_EXPORT
const CFStringRef kCFFileURLSize
;
213 CF_EXPORT
const CFStringRef kCFFileURLDirectoryContents
;
214 CF_EXPORT
const CFStringRef kCFFileURLLastModificationTime
;
215 CF_EXPORT
const CFStringRef kCFHTTPURLStatusCode
;
216 CF_EXPORT
const CFStringRef kCFHTTPURLStatusLine
;
219 /* System Version file access */
220 CF_EXPORT CFStringRef
CFCopySystemVersionString(void); // Human-readable string containing both marketing and build version
221 CF_EXPORT CFDictionaryRef
_CFCopySystemVersionDictionary(void);
222 CF_EXPORT CFDictionaryRef
_CFCopyServerVersionDictionary(void);
223 CF_EXPORT
const CFStringRef _kCFSystemVersionProductNameKey
;
224 CF_EXPORT
const CFStringRef _kCFSystemVersionProductCopyrightKey
;
225 CF_EXPORT
const CFStringRef _kCFSystemVersionProductVersionKey
;
226 CF_EXPORT
const CFStringRef _kCFSystemVersionProductVersionExtraKey
;
227 CF_EXPORT
const CFStringRef _kCFSystemVersionProductUserVisibleVersionKey
; // For loginwindow; see 2987512
228 CF_EXPORT
const CFStringRef _kCFSystemVersionBuildVersionKey
;
229 CF_EXPORT
const CFStringRef _kCFSystemVersionProductVersionStringKey
; // Localized string for the string "Version"
230 CF_EXPORT
const CFStringRef _kCFSystemVersionBuildStringKey
; // Localized string for the string "Build"
233 CF_EXPORT
void CFMergeSortArray(void *list
, CFIndex count
, CFIndex elementSize
, CFComparatorFunction comparator
, void *context
);
234 CF_EXPORT
void CFQSortArray(void *list
, CFIndex count
, CFIndex elementSize
, CFComparatorFunction comparator
, void *context
);
236 /* _CFExecutableLinkedOnOrAfter(releaseVersionName) will return YES if the current executable seems to be linked on or after the specified release. Example: If you specify CFSystemVersionPuma (10.1), you will get back true for executables linked on Puma or Jaguar(10.2), but false for those linked on Cheetah (10.0) or any of its software updates (10.0.x). You will also get back false for any app whose version info could not be figured out.
237 This function caches its results, so no need to cache at call sites.
239 Note that for non-MACH this function always returns true.
242 CFSystemVersionCheetah
= 0, /* 10.0 */
243 CFSystemVersionPuma
= 1, /* 10.1 */
244 CFSystemVersionJaguar
= 2, /* 10.2 */
245 CFSystemVersionPanther
= 3, /* 10.3 */
246 CFSystemVersionTiger
= 4, /* 10.4 */
247 CFSystemVersionLeopard
= 5, /* 10.5 */
248 CFSystemVersionSnowLeopard
= 6, /* 10.6 */
249 CFSystemVersionLion
= 7, /* 10.7 */
250 CFSystemVersionMax
, /* This should bump up when new entries are added */
253 typedef CFIndex CFSystemVersion
;
255 CF_EXPORT Boolean
_CFExecutableLinkedOnOrAfter(CFSystemVersion version
);
259 kCFStringGraphemeCluster
= 1, /* Unicode Grapheme Cluster */
260 kCFStringComposedCharacterCluster
= 2, /* Compose all non-base (including spacing marks) */
261 kCFStringCursorMovementCluster
= 3, /* Cluster suitable for cursor movements */
262 kCFStringBackwardDeletionCluster
= 4 /* Cluster suitable for backward deletion */
264 typedef CFIndex CFStringCharacterClusterType
;
266 CF_EXPORT CFRange
CFStringGetRangeOfCharacterClusterAtIndex(CFStringRef string
, CFIndex charIndex
, CFStringCharacterClusterType type
);
268 // Compatibility kCFCompare flags. Use the new public kCFCompareDiacriticInsensitive
270 kCFCompareDiacriticsInsensitive
= 128 /* Use kCFCompareDiacriticInsensitive */
273 /* kCFCompare flags planned to be publicized (Aki 10/20/2008 Does not work with kCFCompareForceOrdering/CFStringFold). see <rdar://problem/6305147>)
276 kCFCompareIgnoreNonAlphanumeric
= (1UL << 16), // Ignores characters NOT in kCFCharacterSetAlphaNumeric
280 /* CFStringEncoding SPI */
281 /* When set, CF encoding conversion engine keeps ASCII compatibility. (i.e. ASCII backslash <-> Unicode backslash in MacJapanese */
282 CF_EXPORT
void _CFStringEncodingSetForceASCIICompatibility(Boolean flag
);
284 extern void __CFSetCharToUniCharFunc(Boolean (*func
)(UInt32 flags
, UInt8 ch
, UniChar
*unicodeChar
));
285 extern UniChar __CFCharToUniCharTable
[256];
288 #if defined(CF_INLINE)
289 CF_INLINE
const UniChar
*CFStringGetCharactersPtrFromInlineBuffer(CFStringInlineBuffer
*buf
, CFRange desiredRange
) {
290 if ((desiredRange
.location
< 0) || ((desiredRange
.location
+ desiredRange
.length
) > buf
->rangeToBuffer
.length
)) return NULL
;
292 if (buf
->directBuffer
) {
293 return buf
->directBuffer
+ buf
->rangeToBuffer
.location
+ desiredRange
.location
;
295 if (desiredRange
.length
> __kCFStringInlineBufferLength
) return NULL
;
297 if (((desiredRange
.location
+ desiredRange
.length
) > buf
->bufferedRangeEnd
) || (desiredRange
.location
< buf
->bufferedRangeStart
)) {
298 buf
->bufferedRangeStart
= desiredRange
.location
;
299 buf
->bufferedRangeEnd
= buf
->bufferedRangeStart
+ __kCFStringInlineBufferLength
;
300 if (buf
->bufferedRangeEnd
> buf
->rangeToBuffer
.length
) buf
->bufferedRangeEnd
= buf
->rangeToBuffer
.length
;
301 CFStringGetCharacters(buf
->theString
, CFRangeMake(buf
->rangeToBuffer
.location
+ buf
->bufferedRangeStart
, buf
->bufferedRangeEnd
- buf
->bufferedRangeStart
), buf
->buffer
);
304 return buf
->buffer
+ (desiredRange
.location
- buf
->bufferedRangeStart
);
308 CF_INLINE
void CFStringGetCharactersFromInlineBuffer(CFStringInlineBuffer
*buf
, CFRange desiredRange
, UniChar
*outBuf
) {
309 if (buf
->directBuffer
) {
310 memmove(outBuf
, buf
->directBuffer
+ buf
->rangeToBuffer
.location
+ desiredRange
.location
, desiredRange
.length
* sizeof(UniChar
));
312 if ((desiredRange
.location
>= buf
->bufferedRangeStart
) && (desiredRange
.location
< buf
->bufferedRangeEnd
)) {
313 CFIndex bufLen
= desiredRange
.length
;
315 if (bufLen
> (buf
->bufferedRangeEnd
- desiredRange
.location
)) bufLen
= (buf
->bufferedRangeEnd
- desiredRange
.location
);
317 memmove(outBuf
, buf
->buffer
+ (desiredRange
.location
- buf
->bufferedRangeStart
), bufLen
* sizeof(UniChar
));
318 outBuf
+= bufLen
; desiredRange
.location
+= bufLen
; desiredRange
.length
-= bufLen
;
320 CFIndex desiredRangeMax
= (desiredRange
.location
+ desiredRange
.length
);
322 if ((desiredRangeMax
> buf
->bufferedRangeStart
) && (desiredRangeMax
< buf
->bufferedRangeEnd
)) {
323 desiredRange
.length
= (buf
->bufferedRangeStart
- desiredRange
.location
);
324 memmove(outBuf
+ desiredRange
.length
, buf
->buffer
, (desiredRangeMax
- buf
->bufferedRangeStart
) * sizeof(UniChar
));
328 if (desiredRange
.length
> 0) CFStringGetCharacters(buf
->theString
, CFRangeMake(buf
->rangeToBuffer
.location
+ desiredRange
.location
, desiredRange
.length
), outBuf
);
333 #define CFStringGetCharactersPtrFromInlineBuffer(buf, desiredRange) ((buf)->directBuffer ? (buf)->directBuffer + (buf)->rangeToBuffer.location + desiredRange.location : NULL)
335 #define CFStringGetCharactersFromInlineBuffer(buf, desiredRange, outBuf) \
336 if (buf->directBuffer) memmove(outBuf, (buf)->directBuffer + (buf)->rangeToBuffer.location + desiredRange.location, desiredRange.length * sizeof(UniChar)); \
337 else CFStringGetCharacters((buf)->theString, CFRangeMake((buf)->rangeToBuffer.location + desiredRange.location, desiredRange.length), outBuf);
339 #endif /* CF_INLINE */
342 CFCharacterSetInlineBuffer related declarations
345 @typedef CFCharacterSetInlineBuffer
346 @field cset The character set this inline buffer is initialized with.
347 The object is not retained by the structure.
348 @field flags The field is a bit mask that carries various settings.
349 @field rangeStart The beginning of the character range that contains all members.
350 It is guaranteed that there is no member below this value.
351 @field rangeLimit The end of the character range that contains all members.
352 It is guaranteed that there is no member above and equal to this value.
353 @field bitmap The bitmap data representing the membership of the Basic Multilingual Plane characters.
354 If NULL, all BMP characters inside the range are members of the character set.
357 CFCharacterSetRef cset
;
361 const uint8_t *bitmap
;
362 } CFCharacterSetInlineBuffer
;
364 // Bits for flags field
366 kCFCharacterSetIsCompactBitmap
= (1UL << 0),
367 kCFCharacterSetNoBitmapAvailable
= (1UL << 1),
368 kCFCharacterSetIsInverted
= (1UL << 2)
372 @function CFCharacterSetInitInlineBuffer
373 Initializes buffer with cset.
374 @param cset The character set used to initialized the buffer.
375 If this parameter is not a valid CFCharacterSet, the behavior is undefined.
376 @param buffer The reference to the inline buffer to be initialized.
379 void CFCharacterSetInitInlineBuffer(CFCharacterSetRef cset
, CFCharacterSetInlineBuffer
*buffer
);
382 @function CFCharacterSetInlineBufferIsLongCharacterMember
383 Reports whether or not the UTF-32 character is in the character set.
384 @param buffer The reference to the inline buffer to be searched.
385 @param character The UTF-32 character for which to test against the
387 @result true, if the value is in the character set, otherwise false.
389 #if defined(CF_INLINE)
390 CF_INLINE
bool CFCharacterSetInlineBufferIsLongCharacterMember(CFCharacterSetInlineBuffer
*buffer
, UTF32Char character
) {
391 bool isInverted
= ((0 == (buffer
->flags
& kCFCharacterSetIsInverted
)) ? false : true);
393 if ((character
>= buffer
->rangeStart
) && (character
< buffer
->rangeLimit
)) {
394 if ((character
> 0xFFFF) || (0 != (buffer
->flags
& kCFCharacterSetNoBitmapAvailable
))) return (CFCharacterSetIsLongCharacterMember(buffer
->cset
, character
) != 0);
395 if (NULL
== buffer
->bitmap
) {
396 if (0 == (buffer
->flags
& kCFCharacterSetIsCompactBitmap
)) isInverted
= !isInverted
;
397 } else if (0 == (buffer
->flags
& kCFCharacterSetIsCompactBitmap
)) {
398 if (buffer
->bitmap
[character
>> 3] & (1UL << (character
& 7))) isInverted
= !isInverted
;
400 uint8_t value
= buffer
->bitmap
[character
>> 8];
403 isInverted
= !isInverted
;
404 } else if (value
> 0) {
405 const uint8_t *segment
= buffer
->bitmap
+ (256 + (32 * (value
- 1)));
407 if (segment
[character
>> 3] & (1UL << (character
% 8))) isInverted
= !isInverted
;
413 #else /* CF_INLINE */
414 #define CFCharacterSetInlineBufferIsLongCharacterMember(buffer, character) (CFCharacterSetIsLongCharacterMember(buffer->cset, character))
415 #endif /* CF_INLINE */
419 CF_EXPORT CFMutableStringRef
_CFCreateApplicationRepositoryPath(CFAllocatorRef alloc
, int nFolder
);
422 CF_EXPORT CFTypeRef
_CFTryRetain(CFTypeRef cf
);
423 CF_EXPORT Boolean
_CFIsDeallocating(CFTypeRef cf
);
426 CFLocaleGetLanguageRegionEncodingForLocaleIdentifier gets the appropriate language and region codes,
427 and the default legacy script code and encoding, for the specified locale (or language) string.
428 Returns false if CFLocale has no information about the given locale; otherwise may set
429 *langCode and/or *regCode to -1 if there is no appropriate legacy value for the locale.
430 This is a replacement for the CFBundle SPI CFBundleGetLocalizationInfoForLocalization (which was intended to be temporary and transitional);
431 this function is more up-to-date in its handling of locale strings, and is in CFLocale where this functionality should belong. Compared
432 to CFBundleGetLocalizationInfoForLocalization, this function does not spcially interpret a NULL localeIdentifier to mean use the single most
433 preferred localization in the current context (this function returns NO for a NULL localeIdentifier); and in this function
434 langCode, regCode, and scriptCode are all SInt16* (not SInt32* like the equivalent parameters in CFBundleGetLocalizationInfoForLocalization).
437 Boolean
CFLocaleGetLanguageRegionEncodingForLocaleIdentifier(CFStringRef localeIdentifier
, LangCode
*langCode
, RegionCode
*regCode
, ScriptCode
*scriptCode
, CFStringEncoding
*stringEncoding
);
440 CF_EXPORT CFMutableStringRef
_CFCreateApplicationRepositoryPath(CFAllocatorRef alloc
, int nFolder
);
444 #include <CoreFoundation/CFMessagePort.h>
446 #define CF_MESSAGE_PORT_CLONE_MESSAGE_ID -1209
447 CF_EXPORT CFMessagePortRef
CFMessagePortCreateUber(CFAllocatorRef allocator
, CFStringRef name
, CFMessagePortCallBack callout
, CFMessagePortContext
*context
, Boolean
*shouldFreeInfo
, Boolean isRemote
);
448 CF_EXPORT
void CFMessagePortSetCloneCallout(CFMessagePortRef ms
, CFMessagePortCallBack cloneCallout
);
451 #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_LINUX)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)
452 #include <CoreFoundation/CFMessagePort.h>
454 CF_EXPORT CFMessagePortRef
CFMessagePortCreatePerProcessLocal(CFAllocatorRef allocator
, CFStringRef name
, CFMessagePortCallBack callout
, CFMessagePortContext
*context
, Boolean
*shouldFreeInfo
);
455 CF_EXPORT CFMessagePortRef
CFMessagePortCreatePerProcessRemote(CFAllocatorRef allocator
, CFStringRef name
, CFIndex pid
);
458 typedef CFDataRef (*CFMessagePortCallBackEx
)(CFMessagePortRef local
, SInt32 msgid
, CFDataRef data
, void *info
, void *trailer
, uintptr_t);
460 CF_EXPORT CFMessagePortRef
_CFMessagePortCreateLocalEx(CFAllocatorRef allocator
, CFStringRef name
, Boolean perPID
, uintptr_t unused
, CFMessagePortCallBackEx callout2
, CFMessagePortContext
*context
, Boolean
*shouldFreeInfo
);
464 #if TARGET_OS_MAC || TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_LINUX
467 // Avoid including the pthread header
468 #ifndef HAVE_STRUCT_TIMESPEC
469 #define HAVE_STRUCT_TIMESPEC 1
470 struct timespec
{ long tv_sec
; long tv_nsec
; };
474 CF_INLINE CFAbsoluteTime
_CFAbsoluteTimeFromFileTimeSpec(struct timespec ts
) {
475 return (CFAbsoluteTime
)((CFTimeInterval
)ts
.tv_sec
- kCFAbsoluteTimeIntervalSince1970
) + (1.0e-9 * (CFTimeInterval
)ts
.tv_nsec
);
478 CF_INLINE
struct timespec
_CFFileTimeSpecFromAbsoluteTime(CFAbsoluteTime at
) {
481 double frac
= modf(at
, &sec
);
487 ts
.tv_sec
= (long)(sec
+ kCFAbsoluteTimeIntervalSince1970
);
489 ts
.tv_sec
= (time_t)(sec
+ kCFAbsoluteTimeIntervalSince1970
);
491 ts
.tv_nsec
= (long)(1000000000UL * frac
+ 0.5);
495 CF_EXPORT
bool _CFPropertyListCreateSingleValue(CFAllocatorRef allocator
, CFDataRef data
, CFOptionFlags option
, CFStringRef keyPath
, CFPropertyListRef
*value
, CFErrorRef
*error
);
499 #include <CoreFoundation/CFNotificationCenter.h>
501 CF_EXPORT CFStringRef
_CFGetWindowsAppleAppDataDirectory(void);
502 CF_EXPORT CFArrayRef
_CFGetWindowsBinaryDirectories(void);
503 CF_EXPORT CFStringRef
_CFGetWindowsAppleSystemLibraryDirectory(void);
505 // If your Windows application does not use a CFRunLoop on the main thread (perhaps because it is reserved for handling UI events via Windows API), then call this function to make distributed notifications arrive using a different run loop.
506 CF_EXPORT
void _CFNotificationCenterSetRunLoop(CFNotificationCenterRef nc
, CFRunLoopRef rl
);
508 CF_EXPORT
uint32_t /*DWORD*/ _CFRunLoopGetWindowsMessageQueueMask(CFRunLoopRef rl
, CFStringRef modeName
);
509 CF_EXPORT
void _CFRunLoopSetWindowsMessageQueueMask(CFRunLoopRef rl
, uint32_t /*DWORD*/ mask
, CFStringRef modeName
);
511 CF_EXPORT
uint32_t /*DWORD*/ _CFRunLoopGetWindowsThreadID(CFRunLoopRef rl
);
513 typedef void (*CFWindowsMessageQueueHandler
)(void);
515 // Run Loop parameter must be the current thread's run loop for the next two functions; you cannot use another thread's run loop
516 CF_EXPORT CFWindowsMessageQueueHandler
_CFRunLoopGetWindowsMessageQueueHandler(CFRunLoopRef rl
, CFStringRef modeName
);
517 CF_EXPORT
void _CFRunLoopSetWindowsMessageQueueHandler(CFRunLoopRef rl
, CFStringRef modeName
, CFWindowsMessageQueueHandler func
);
522 CF_EXPORT CFArrayRef
CFDateFormatterCreateDateFormatsFromTemplates(CFAllocatorRef allocator
, CFArrayRef tmplates
, CFOptionFlags options
, CFLocaleRef locale
);
527 #endif /* ! __COREFOUNDATION_CFPRIV__ */