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