]> git.saurik.com Git - apple/cf.git/blob - CFPriv.h
56e28a00c55d095b8de744d04b359d5ea3a98f21
[apple/cf.git] / CFPriv.h
1 /*
2 * Copyright (c) 2009 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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
11 * file.
12 *
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.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /* CFPriv.h
24 Copyright (c) 1998-2009, Apple Inc. All rights reserved.
25 */
26
27 /*
28 APPLE SPI: NOT TO BE USED OUTSIDE APPLE!
29 */
30
31 #if !defined(__COREFOUNDATION_CFPRIV__)
32 #define __COREFOUNDATION_CFPRIV__ 1
33
34 #include <string.h>
35 #include <CoreFoundation/CFBase.h>
36 #include <CoreFoundation/CFArray.h>
37 #include <CoreFoundation/CFString.h>
38 #include <CoreFoundation/CFURL.h>
39 #include <CoreFoundation/CFBundlePriv.h>
40 #include <pthread.h>
41 #include <math.h>
42
43
44
45 #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)
46 #include <CoreFoundation/CFMachPort.h>
47 #endif
48
49 #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) || TARGET_OS_WIN32
50 #include <CoreFoundation/CFRunLoop.h>
51 #include <CoreFoundation/CFSocket.h>
52 #endif
53
54 CF_EXTERN_C_BEGIN
55
56 CF_EXPORT intptr_t _CFDoOperation(intptr_t code, intptr_t subcode1, intptr_t subcode2);
57
58 CF_EXPORT void _CFRuntimeSetCFMPresent(void *a);
59
60 CF_EXPORT const char *_CFProcessPath(void);
61 CF_EXPORT const char **_CFGetProcessPath(void);
62 CF_EXPORT const char **_CFGetProgname(void);
63
64
65 #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)
66 CF_EXPORT CFRunLoopRef CFRunLoopGetMain(void);
67 CF_EXPORT SInt32 CFRunLoopRunSpecific(CFRunLoopRef rl, CFStringRef modeName, CFTimeInterval seconds, Boolean returnAfterSourceHandled);
68
69 CF_EXPORT void _CFRunLoopSetCurrent(CFRunLoopRef rl);
70
71 CF_EXPORT Boolean _CFRunLoopModeContainsMode(CFRunLoopRef rl, CFStringRef modeName, CFStringRef candidateContainedName);
72 CF_EXPORT void _CFRunLoopAddModeToMode(CFRunLoopRef rl, CFStringRef modeName, CFStringRef toModeName);
73 CF_EXPORT void _CFRunLoopRemoveModeFromMode(CFRunLoopRef rl, CFStringRef modeName, CFStringRef fromModeName);
74 CF_EXPORT void _CFRunLoopStopMode(CFRunLoopRef rl, CFStringRef modeName);
75
76 CF_EXPORT CFIndex CFMachPortGetQueuedMessageCount(CFMachPortRef mp);
77
78 CF_EXPORT CFPropertyListRef _CFURLCopyPropertyListRepresentation(CFURLRef url);
79 #endif
80 CF_EXPORT CFPropertyListRef _CFURLCopyPropertyListRepresentation(CFURLRef url);
81 CF_EXPORT CFURLRef _CFURLCreateFromPropertyListRepresentation(CFAllocatorRef alloc, CFPropertyListRef pListRepresentation);
82
83 CF_EXPORT void CFPreferencesFlushCaches(void);
84
85 #if TARGET_OS_WIN32
86 CF_EXPORT Boolean _CFURLGetWideFileSystemRepresentation(CFURLRef url, Boolean resolveAgainstBase, wchar_t *buffer, CFIndex bufferLength);
87 #endif
88
89 #if !__LP64__
90 #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)
91 struct FSSpec;
92 CF_EXPORT
93 Boolean _CFGetFSSpecFromURL(CFAllocatorRef alloc, CFURLRef url, struct FSSpec *spec);
94
95 CF_EXPORT
96 CFURLRef _CFCreateURLFromFSSpec(CFAllocatorRef alloc, const struct FSSpec *voidspec, Boolean isDirectory);
97 #endif
98 #endif
99
100 #if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED
101 enum {
102 kCFURLComponentDecompositionNonHierarchical,
103 kCFURLComponentDecompositionRFC1808, /* use this for RFC 1738 decompositions as well */
104 kCFURLComponentDecompositionRFC2396
105 };
106 typedef CFIndex CFURLComponentDecomposition;
107
108 typedef struct {
109 CFStringRef scheme;
110 CFStringRef schemeSpecific;
111 } CFURLComponentsNonHierarchical;
112
113 typedef struct {
114 CFStringRef scheme;
115 CFStringRef user;
116 CFStringRef password;
117 CFStringRef host;
118 CFIndex port; /* kCFNotFound means ignore/omit */
119 CFArrayRef pathComponents;
120 CFStringRef parameterString;
121 CFStringRef query;
122 CFStringRef fragment;
123 CFURLRef baseURL;
124 } CFURLComponentsRFC1808;
125
126 typedef struct {
127 CFStringRef scheme;
128
129 /* if the registered name form of the net location is used, userinfo is NULL, port is kCFNotFound, and host is the entire registered name. */
130 CFStringRef userinfo;
131 CFStringRef host;
132 CFIndex port;
133
134 CFArrayRef pathComponents;
135 CFStringRef query;
136 CFStringRef fragment;
137 CFURLRef baseURL;
138 } CFURLComponentsRFC2396;
139
140 /* 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 */
141 CF_EXPORT
142 Boolean _CFURLCopyComponents(CFURLRef url, CFURLComponentDecomposition decompositionType, void *components);
143
144 /* Creates and returns the URL described by components; components should point to the CFURLComponents struct defined above that matches decompositionType. */
145 CF_EXPORT
146 CFURLRef _CFURLCreateFromComponents(CFAllocatorRef alloc, CFURLComponentDecomposition decompositionType, const void *components);
147 #define CFURLCopyComponents _CFURLCopyComponents
148 #define CFURLCreateFromComponents _CFURLCreateFromComponents
149 #endif
150
151
152 CF_EXPORT Boolean _CFStringGetFileSystemRepresentation(CFStringRef string, UInt8 *buffer, CFIndex maxBufLen);
153
154 /* If this is publicized, we might need to create a GetBytesPtr type function as well. */
155 CF_EXPORT CFStringRef _CFStringCreateWithBytesNoCopy(CFAllocatorRef alloc, const UInt8 *bytes, CFIndex numBytes, CFStringEncoding encoding, Boolean externalFormat, CFAllocatorRef contentsDeallocator);
156
157 /* These return NULL on MacOS 8 */
158 CF_EXPORT
159 CFStringRef CFGetUserName(void);
160
161 CF_EXPORT
162 CFURLRef CFCopyHomeDirectoryURLForUser(CFStringRef uName); /* Pass NULL for the current user's home directory */
163
164
165 /*
166 CFCopySearchPathForDirectoriesInDomains returns the various
167 standard system directories where apps, resources, etc get
168 installed. Because queries can return multiple directories,
169 you get back a CFArray (which you should free when done) of
170 CFStrings. The directories are returned in search path order;
171 that is, the first place to look is returned first. This API
172 may return directories that do not exist yet. If NSUserDomain
173 is included in a query, then the results will contain "~" to
174 refer to the user's directory. Specify expandTilde to expand
175 this to the current user's home. Some calls might return no
176 directories!
177 ??? On MacOS 8 this function currently returns an empty array.
178 */
179 enum {
180 kCFApplicationDirectory = 1, /* supported applications (Applications) */
181 kCFDemoApplicationDirectory, /* unsupported applications, demonstration versions (Demos) */
182 kCFDeveloperApplicationDirectory, /* developer applications (Developer/Applications) */
183 kCFAdminApplicationDirectory, /* system and network administration applications (Administration) */
184 kCFLibraryDirectory, /* various user-visible documentation, support, and configuration files, resources (Library) */
185 kCFDeveloperDirectory, /* developer resources (Developer) */
186 kCFUserDirectory, /* user home directories (Users) */
187 kCFDocumentationDirectory, /* documentation (Documentation) */
188 kCFDocumentDirectory, /* documents (Library/Documents) */
189 kCFAllApplicationsDirectory = 100, /* all directories where applications can occur (ie Applications, Demos, Administration, Developer/Applications) */
190 kCFAllLibrariesDirectory = 101 /* all directories where resources can occur (Library, Developer) */
191 };
192 typedef CFIndex CFSearchPathDirectory;
193
194 enum {
195 kCFUserDomainMask = 1, /* user's home directory --- place to install user's personal items (~) */
196 kCFLocalDomainMask = 2, /* local to the current machine --- place to install items available to everyone on this machine (/Local) */
197 kCFNetworkDomainMask = 4, /* publically available location in the local area network --- place to install items available on the network (/Network) */
198 kCFSystemDomainMask = 8, /* provided by Apple, unmodifiable (/System) */
199 kCFAllDomainsMask = 0x0ffff /* all domains: all of the above and more, future items */
200 };
201 typedef CFOptionFlags CFSearchPathDomainMask;
202
203 CF_EXPORT
204 CFArrayRef CFCopySearchPathForDirectoriesInDomains(CFSearchPathDirectory directory, CFSearchPathDomainMask domainMask, Boolean expandTilde);
205
206 /* Obsolete keys */
207 CF_EXPORT const CFStringRef kCFFileURLExists;
208 CF_EXPORT const CFStringRef kCFFileURLPOSIXMode;
209 CF_EXPORT const CFStringRef kCFFileURLSize;
210 CF_EXPORT const CFStringRef kCFFileURLDirectoryContents;
211 CF_EXPORT const CFStringRef kCFFileURLLastModificationTime;
212 CF_EXPORT const CFStringRef kCFHTTPURLStatusCode;
213 CF_EXPORT const CFStringRef kCFHTTPURLStatusLine;
214
215
216 /* System Version file access */
217 CF_EXPORT CFStringRef CFCopySystemVersionString(void); // Human-readable string containing both marketing and build version
218 CF_EXPORT CFDictionaryRef _CFCopySystemVersionDictionary(void);
219 CF_EXPORT CFDictionaryRef _CFCopyServerVersionDictionary(void);
220 CF_EXPORT const CFStringRef _kCFSystemVersionProductNameKey;
221 CF_EXPORT const CFStringRef _kCFSystemVersionProductCopyrightKey;
222 CF_EXPORT const CFStringRef _kCFSystemVersionProductVersionKey;
223 CF_EXPORT const CFStringRef _kCFSystemVersionProductVersionExtraKey;
224 CF_EXPORT const CFStringRef _kCFSystemVersionProductUserVisibleVersionKey; // For loginwindow; see 2987512
225 CF_EXPORT const CFStringRef _kCFSystemVersionBuildVersionKey;
226 CF_EXPORT const CFStringRef _kCFSystemVersionProductVersionStringKey; // Localized string for the string "Version"
227 CF_EXPORT const CFStringRef _kCFSystemVersionBuildStringKey; // Localized string for the string "Build"
228
229
230 CF_EXPORT void CFMergeSortArray(void *list, CFIndex count, CFIndex elementSize, CFComparatorFunction comparator, void *context);
231 CF_EXPORT void CFQSortArray(void *list, CFIndex count, CFIndex elementSize, CFComparatorFunction comparator, void *context);
232
233 /* _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.
234 This function caches its results, so no need to cache at call sites.
235
236 Note that for non-MACH this function always returns true.
237 */
238 enum {
239 CFSystemVersionCheetah = 0, /* 10.0 */
240 CFSystemVersionPuma = 1, /* 10.1 */
241 CFSystemVersionJaguar = 2, /* 10.2 */
242 CFSystemVersionPanther = 3, /* 10.3 */
243 CFSystemVersionPinot = 3, /* Deprecated name for Panther */
244 CFSystemVersionTiger = 4, /* 10.4 */
245 CFSystemVersionMerlot = 4, /* Deprecated name for Tiger */
246 CFSystemVersionLeopard = 5, /* 10.5 */
247 CFSystemVersionChablis = 5, /* Deprecated name for Leopard */
248 CFSystemVersionSnowLeopard = 6, /* 10.6 */
249 CFSystemVersionMax, /* This should bump up when new entries are added */
250
251 };
252 typedef CFIndex CFSystemVersion;
253
254 CF_EXPORT Boolean _CFExecutableLinkedOnOrAfter(CFSystemVersion version);
255
256
257 enum {
258 kCFStringGraphemeCluster = 1, /* Unicode Grapheme Cluster */
259 kCFStringComposedCharacterCluster = 2, /* Compose all non-base (including spacing marks) */
260 kCFStringCursorMovementCluster = 3, /* Cluster suitable for cursor movements */
261 kCFStringBackwardDeletionCluster = 4 /* Cluster suitable for backward deletion */
262 };
263 typedef CFIndex CFStringCharacterClusterType;
264
265 CF_EXPORT CFRange CFStringGetRangeOfCharacterClusterAtIndex(CFStringRef string, CFIndex charIndex, CFStringCharacterClusterType type);
266
267 // Compatibility kCFCompare flags. Use the new public kCFCompareDiacriticInsensitive
268 enum {
269 kCFCompareDiacriticsInsensitive = 128 /* Use kCFCompareDiacriticInsensitive */
270 };
271
272 /* kCFCompare flags planned to be publicized (Aki 10/20/2008 Does not work with kCFCompareForceOrdering/CFStringFold). see <rdar://problem/6305147>)
273 */
274 enum {
275 kCFCompareIgnoreNonAlphanumeric = (1UL << 16), // Ignores characters NOT in kCFCharacterSetAlphaNumeric
276 };
277
278
279 /* CFStringEncoding SPI */
280 /* When set, CF encoding conversion engine keeps ASCII compatibility. (i.e. ASCII backslash <-> Unicode backslash in MacJapanese */
281 CF_EXPORT void _CFStringEncodingSetForceASCIICompatibility(Boolean flag);
282
283 extern void __CFSetCharToUniCharFunc(Boolean (*func)(UInt32 flags, UInt8 ch, UniChar *unicodeChar));
284 extern UniChar __CFCharToUniCharTable[256];
285
286
287 #if defined(CF_INLINE)
288 CF_INLINE const UniChar *CFStringGetCharactersPtrFromInlineBuffer(CFStringInlineBuffer *buf, CFRange desiredRange) {
289 if ((desiredRange.location < 0) || ((desiredRange.location + desiredRange.length) > buf->rangeToBuffer.length)) return NULL;
290
291 if (buf->directBuffer) {
292 return buf->directBuffer + buf->rangeToBuffer.location + desiredRange.location;
293 } else {
294 if (desiredRange.length > __kCFStringInlineBufferLength) return NULL;
295
296 if (((desiredRange.location + desiredRange.length) > buf->bufferedRangeEnd) || (desiredRange.location < buf->bufferedRangeStart)) {
297 buf->bufferedRangeStart = desiredRange.location;
298 buf->bufferedRangeEnd = buf->bufferedRangeStart + __kCFStringInlineBufferLength;
299 if (buf->bufferedRangeEnd > buf->rangeToBuffer.length) buf->bufferedRangeEnd = buf->rangeToBuffer.length;
300 CFStringGetCharacters(buf->theString, CFRangeMake(buf->rangeToBuffer.location + buf->bufferedRangeStart, buf->bufferedRangeEnd - buf->bufferedRangeStart), buf->buffer);
301 }
302
303 return buf->buffer + (desiredRange.location - buf->bufferedRangeStart);
304 }
305 }
306
307 CF_INLINE void CFStringGetCharactersFromInlineBuffer(CFStringInlineBuffer *buf, CFRange desiredRange, UniChar *outBuf) {
308 if (buf->directBuffer) {
309 memmove(outBuf, buf->directBuffer + buf->rangeToBuffer.location + desiredRange.location, desiredRange.length * sizeof(UniChar));
310 } else {
311 if ((desiredRange.location >= buf->bufferedRangeStart) && (desiredRange.location < buf->bufferedRangeEnd)) {
312 CFIndex bufLen = desiredRange.length;
313
314 if (bufLen > (buf->bufferedRangeEnd - desiredRange.location)) bufLen = (buf->bufferedRangeEnd - desiredRange.location);
315
316 memmove(outBuf, buf->buffer + (desiredRange.location - buf->bufferedRangeStart), bufLen * sizeof(UniChar));
317 outBuf += bufLen; desiredRange.location += bufLen; desiredRange.length -= bufLen;
318 } else {
319 CFIndex desiredRangeMax = (desiredRange.location + desiredRange.length);
320
321 if ((desiredRangeMax > buf->bufferedRangeStart) && (desiredRangeMax < buf->bufferedRangeEnd)) {
322 desiredRange.length = (buf->bufferedRangeStart - desiredRange.location);
323 memmove(outBuf + desiredRange.length, buf->buffer, (desiredRangeMax - buf->bufferedRangeStart) * sizeof(UniChar));
324 }
325 }
326
327 if (desiredRange.length > 0) CFStringGetCharacters(buf->theString, CFRangeMake(buf->rangeToBuffer.location + desiredRange.location, desiredRange.length), outBuf);
328 }
329 }
330
331 #else
332 #define CFStringGetCharactersPtrFromInlineBuffer(buf, desiredRange) ((buf)->directBuffer ? (buf)->directBuffer + (buf)->rangeToBuffer.location + desiredRange.location : NULL)
333
334 #define CFStringGetCharactersFromInlineBuffer(buf, desiredRange, outBuf) \
335 if (buf->directBuffer) memmove(outBuf, (buf)->directBuffer + (buf)->rangeToBuffer.location + desiredRange.location, desiredRange.length * sizeof(UniChar)); \
336 else CFStringGetCharacters((buf)->theString, CFRangeMake((buf)->rangeToBuffer.location + desiredRange.location, desiredRange.length), outBuf);
337
338 #endif /* CF_INLINE */
339
340 /*
341 CFCharacterSetInlineBuffer related declarations
342 */
343 /*!
344 @typedef CFCharacterSetInlineBuffer
345 @field cset The character set this inline buffer is initialized with.
346 The object is not retained by the structure.
347 @field flags The field is a bit mask that carries various settings.
348 @field rangeStart The beginning of the character range that contains all members.
349 It is guaranteed that there is no member below this value.
350 @field rangeLimit The end of the character range that contains all members.
351 It is guaranteed that there is no member above and equal to this value.
352 @field bitmap The bitmap data representing the membership of the Basic Multilingual Plane characters.
353 If NULL, all BMP characters inside the range are members of the character set.
354 */
355 typedef struct {
356 CFCharacterSetRef cset;
357 uint32_t flags;
358 uint32_t rangeStart;
359 uint32_t rangeLimit;
360 const uint8_t *bitmap;
361 } CFCharacterSetInlineBuffer;
362
363 // Bits for flags field
364 enum {
365 kCFCharacterSetIsCompactBitmap = (1UL << 0),
366 kCFCharacterSetNoBitmapAvailable = (1UL << 1),
367 kCFCharacterSetIsInverted = (1UL << 2)
368 };
369
370 /*!
371 @function CFCharacterSetInitInlineBuffer
372 Initializes buffer with cset.
373 @param cset The character set used to initialized the buffer.
374 If this parameter is not a valid CFCharacterSet, the behavior is undefined.
375 @param buffer The reference to the inline buffer to be initialized.
376 */
377 CF_EXPORT
378 void CFCharacterSetInitInlineBuffer(CFCharacterSetRef cset, CFCharacterSetInlineBuffer *buffer);
379
380 /*!
381 @function CFCharacterSetInlineBufferIsLongCharacterMember
382 Reports whether or not the UTF-32 character is in the character set.
383 @param buffer The reference to the inline buffer to be searched.
384 @param character The UTF-32 character for which to test against the
385 character set.
386 @result true, if the value is in the character set, otherwise false.
387 */
388 #if defined(CF_INLINE)
389 CF_INLINE bool CFCharacterSetInlineBufferIsLongCharacterMember(CFCharacterSetInlineBuffer *buffer, UTF32Char character) {
390 bool isInverted = ((0 == (buffer->flags & kCFCharacterSetIsInverted)) ? false : true);
391
392 if ((character >= buffer->rangeStart) && (character < buffer->rangeLimit)) {
393 if ((character > 0xFFFF) || (0 != (buffer->flags & kCFCharacterSetNoBitmapAvailable))) return (CFCharacterSetIsLongCharacterMember(buffer->cset, character) != 0);
394 if (NULL == buffer->bitmap) {
395 if (0 == (buffer->flags & kCFCharacterSetIsCompactBitmap)) isInverted = !isInverted;
396 } else if (0 == (buffer->flags & kCFCharacterSetIsCompactBitmap)) {
397 if (buffer->bitmap[character >> 3] & (1UL << (character & 7))) isInverted = !isInverted;
398 } else {
399 uint8_t value = buffer->bitmap[character >> 8];
400
401 if (value == 0xFF) {
402 isInverted = !isInverted;
403 } else if (value > 0) {
404 const uint8_t *segment = buffer->bitmap + (256 + (32 * (value - 1)));
405 character &= 0xFF;
406 if (segment[character >> 3] & (1UL << (character % 8))) isInverted = !isInverted;
407 }
408 }
409 }
410 return isInverted;
411 }
412 #else /* CF_INLINE */
413 #define CFCharacterSetInlineBufferIsLongCharacterMember(buffer, character) (CFCharacterSetIsLongCharacterMember(buffer->cset, character))
414 #endif /* CF_INLINE */
415
416
417 #if TARGET_OS_WIN32
418 CF_EXPORT CFMutableStringRef _CFCreateApplicationRepositoryPath(CFAllocatorRef alloc, int nFolder);
419 #endif
420
421 /*
422 CFLocaleGetLanguageRegionEncodingForLocaleIdentifier gets the appropriate language and region codes,
423 and the default legacy script code and encoding, for the specified locale (or language) string.
424 Returns false if CFLocale has no information about the given locale; otherwise may set
425 *langCode and/or *regCode to -1 if there is no appropriate legacy value for the locale.
426 This is a replacement for the CFBundle SPI CFBundleGetLocalizationInfoForLocalization (which was intended to be temporary and transitional);
427 this function is more up-to-date in its handling of locale strings, and is in CFLocale where this functionality should belong. Compared
428 to CFBundleGetLocalizationInfoForLocalization, this function does not spcially interpret a NULL localeIdentifier to mean use the single most
429 preferred localization in the current context (this function returns NO for a NULL localeIdentifier); and in this function
430 langCode, regCode, and scriptCode are all SInt16* (not SInt32* like the equivalent parameters in CFBundleGetLocalizationInfoForLocalization).
431 */
432 CF_EXPORT
433 Boolean CFLocaleGetLanguageRegionEncodingForLocaleIdentifier(CFStringRef localeIdentifier, LangCode *langCode, RegionCode *regCode, ScriptCode *scriptCode, CFStringEncoding *stringEncoding);
434
435 #if TARGET_OS_WIN32
436 CF_EXPORT CFMutableStringRef _CFCreateApplicationRepositoryPath(CFAllocatorRef alloc, int nFolder);
437 #endif
438
439 #if TARGET_OS_WIN32
440 #include <CoreFoundation/CFMessagePort.h>
441
442 #define CF_MESSAGE_PORT_CLONE_MESSAGE_ID -1209
443 CF_EXPORT CFMessagePortRef CFMessagePortCreateUber(CFAllocatorRef allocator, CFStringRef name, CFMessagePortCallBack callout, CFMessagePortContext *context, Boolean *shouldFreeInfo, Boolean isRemote);
444 CF_EXPORT void CFMessagePortSetCloneCallout(CFMessagePortRef ms, CFMessagePortCallBack cloneCallout);
445 #endif
446
447 #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)
448 #include <CoreFoundation/CFMessagePort.h>
449
450 CFMessagePortRef CFMessagePortCreatePerProcessLocal(CFAllocatorRef allocator, CFStringRef name, CFMessagePortCallBack callout, CFMessagePortContext *context, Boolean *shouldFreeInfo);
451 CFMessagePortRef CFMessagePortCreatePerProcessRemote(CFAllocatorRef allocator, CFStringRef name, CFIndex pid);
452 #endif
453
454
455 CF_INLINE CFAbsoluteTime _CFAbsoluteTimeFromFileTimeSpec(struct timespec ts) {
456 return (CFAbsoluteTime)((CFTimeInterval)ts.tv_sec - kCFAbsoluteTimeIntervalSince1970) + (1.0e-9 * (CFTimeInterval)ts.tv_nsec);
457 }
458
459 #if 0
460 CF_INLINE struct timespec _CFFileTimeSpecFromAbsoluteTime(CFAbsoluteTime at) {
461 struct timespec ts;
462 double sec = 0.0;
463 double frac = modf(at, &sec);
464 if (frac < 0.0) {
465 frac += 1.0;
466 sec -= 1.0;
467 }
468 ts.tv_sec = (time_t)(sec + kCFAbsoluteTimeIntervalSince1970);
469 ts.tv_nsec = (long)(NSEC_PER_SEC * frac + 0.5);
470 return ts;
471 }
472 #endif
473
474 #if TARGET_OS_WIN32
475 CF_EXPORT CFStringRef _CFGetWindowsAppleAppDataDirectory(void);
476 CF_EXPORT CFArrayRef _CFGetWindowsBinaryDirectories(void);
477 CF_EXPORT CFStringRef _CFGetWindowsAppleSystemLibraryDirectory(void);
478 #endif
479
480 CF_EXTERN_C_END
481
482 #endif /* ! __COREFOUNDATION_CFPRIV__ */
483