]>
Commit | Line | Data |
---|---|---|
9ce05555 | 1 | /* |
8ca704e1 | 2 | * Copyright (c) 2011 Apple Inc. All rights reserved. |
9ce05555 A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
9ce05555 A |
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 | */ | |
f64f9b69 | 23 | |
9ce05555 | 24 | /* CFBundle_Internal.h |
8ca704e1 | 25 | Copyright (c) 1999-2011, Apple Inc. All rights reserved. |
9ce05555 A |
26 | */ |
27 | ||
28 | #if !defined(__COREFOUNDATION_CFBUNDLE_INTERNAL__) | |
29 | #define __COREFOUNDATION_CFBUNDLE_INTERNAL__ 1 | |
30 | ||
31 | #include <CoreFoundation/CFDate.h> | |
32 | #include <CoreFoundation/CFBundle.h> | |
33 | #include <CoreFoundation/CFPlugIn.h> | |
bd5b749c | 34 | #include <CoreFoundation/CFError.h> |
9ce05555 A |
35 | #include "CFInternal.h" |
36 | #include "CFPlugIn_Factory.h" | |
37 | #include "CFBundle_BinaryTypes.h" | |
38 | ||
bd5b749c | 39 | CF_EXTERN_C_BEGIN |
9ce05555 | 40 | |
bd5b749c A |
41 | #define __kCFLogBundle 3 |
42 | #define __kCFLogPlugIn 3 | |
9ce05555 | 43 | |
cf7d2af9 | 44 | #if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED |
bd5b749c | 45 | #define PLATFORM_PATH_STYLE kCFURLPOSIXPathStyle |
cf7d2af9 | 46 | #elif DEPLOYMENT_TARGET_WINDOWS |
9ce05555 | 47 | #define PLATFORM_PATH_STYLE kCFURLWindowsPathStyle |
9ce05555 | 48 | #else |
bd5b749c | 49 | #error Unknown or unspecified DEPLOYMENT_TARGET |
9ce05555 A |
50 | #endif |
51 | ||
bd5b749c A |
52 | #define CFBundleExecutableNotFoundError 4 |
53 | #define CFBundleExecutableNotLoadableError 3584 | |
54 | #define CFBundleExecutableArchitectureMismatchError 3585 | |
55 | #define CFBundleExecutableRuntimeMismatchError 3586 | |
56 | #define CFBundleExecutableLoadError 3587 | |
57 | #define CFBundleExecutableLinkError 3588 | |
58 | ||
9ce05555 A |
59 | typedef struct __CFResourceData { |
60 | CFMutableDictionaryRef _stringTableCache; | |
61 | Boolean _executableLacksResourceFork; | |
bd5b749c A |
62 | Boolean _infoDictionaryFromResourceFork; |
63 | char _padding[2]; | |
9ce05555 A |
64 | } _CFResourceData; |
65 | ||
66 | extern _CFResourceData *__CFBundleGetResourceData(CFBundleRef bundle); | |
67 | ||
68 | typedef struct __CFPlugInData { | |
69 | Boolean _isPlugIn; | |
70 | Boolean _loadOnDemand; | |
71 | Boolean _isDoingDynamicRegistration; | |
72 | Boolean _unused1; | |
73 | UInt32 _instanceCount; | |
74 | CFMutableArrayRef _factories; | |
75 | } _CFPlugInData; | |
76 | ||
77 | extern _CFPlugInData *__CFBundleGetPlugInData(CFBundleRef bundle); | |
78 | ||
79 | /* Private CFBundle API */ | |
80 | ||
81 | extern Boolean _CFIsResourceAtURL(CFURLRef url, Boolean *isDir); | |
82 | extern Boolean _CFIsResourceAtPath(CFStringRef path, Boolean *isDir); | |
83 | ||
84 | extern Boolean _CFBundleURLLooksLikeBundleVersion(CFURLRef url, UInt8 *version); | |
85 | extern CFDictionaryRef _CFBundleCopyInfoDictionaryInDirectory(CFAllocatorRef alloc, CFURLRef url, UInt8 *version); | |
86 | extern CFDictionaryRef _CFBundleCopyInfoDictionaryInDirectoryWithVersion(CFAllocatorRef alloc, CFURLRef url, UInt8 version); | |
8ca704e1 A |
87 | extern CFURLRef _CFBundleCopySupportFilesDirectoryURLInDirectory(CFURLRef bundleURL, UInt8 version); |
88 | extern CFURLRef _CFBundleCopyResourcesDirectoryURLInDirectory(CFURLRef bundleURL, UInt8 version); | |
9ce05555 A |
89 | |
90 | extern Boolean _CFBundleCouldBeBundle(CFURLRef url); | |
9ce05555 A |
91 | extern CFURLRef _CFBundleCopyResourceForkURLMayBeLocal(CFBundleRef bundle, Boolean mayBeLocal); |
92 | extern CFDictionaryRef _CFBundleCopyInfoDictionaryInResourceForkWithAllocator(CFAllocatorRef alloc, CFURLRef url); | |
93 | extern CFStringRef _CFBundleCopyBundleDevelopmentRegionFromVersResource(CFBundleRef bundle); | |
94 | extern CFDictionaryRef _CFBundleCopyInfoDictionaryInExecutable(CFURLRef url); | |
bd5b749c | 95 | extern CFArrayRef _CFBundleCopyArchitecturesForExecutable(CFURLRef url); |
9ce05555 A |
96 | |
97 | extern void _CFBundleAddPreferredLprojNamesInDirectory(CFAllocatorRef alloc, CFURLRef bundleURL, UInt8 version, CFDictionaryRef infoDict, CFMutableArrayRef lprojNames, CFStringRef devLang); | |
98 | ||
99 | extern CFStringRef _CFBundleGetPlatformExecutablesSubdirectoryName(void); | |
100 | extern CFStringRef _CFBundleGetAlternatePlatformExecutablesSubdirectoryName(void); | |
101 | extern CFStringRef _CFBundleGetOtherPlatformExecutablesSubdirectoryName(void); | |
102 | extern CFStringRef _CFBundleGetOtherAlternatePlatformExecutablesSubdirectoryName(void); | |
103 | ||
104 | extern CFStringRef _CFCreateStringFromVersionNumber(CFAllocatorRef alloc, UInt32 vers); | |
105 | extern UInt32 _CFVersionNumberFromString(CFStringRef versStr); | |
106 | ||
107 | extern void _CFBundleScheduleForUnloading(CFBundleRef bundle); | |
108 | extern void _CFBundleUnscheduleForUnloading(CFBundleRef bundle); | |
109 | extern void _CFBundleUnloadScheduledBundles(void); | |
110 | ||
111 | ||
112 | #if defined(BINARY_SUPPORT_DYLD) | |
113 | // DYLD API | |
114 | extern __CFPBinaryType _CFBundleGrokBinaryType(CFURLRef executableURL); | |
cf7d2af9 A |
115 | extern CFArrayRef _CFBundleDYLDCopyLoadedImagePathsIfChanged(void); |
116 | extern CFArrayRef _CFBundleDYLDCopyLoadedImagePathsForHint(CFStringRef hint); | |
117 | #if !defined(BINARY_SUPPORT_DLFCN) | |
9ce05555 | 118 | extern Boolean _CFBundleDYLDCheckLoaded(CFBundleRef bundle); |
bd5b749c A |
119 | extern Boolean _CFBundleDYLDLoadBundle(CFBundleRef bundle, Boolean forceGlobal, CFErrorRef *error); |
120 | extern Boolean _CFBundleDYLDLoadFramework(CFBundleRef bundle, CFErrorRef *error); | |
9ce05555 A |
121 | extern void _CFBundleDYLDUnloadBundle(CFBundleRef bundle); |
122 | extern void *_CFBundleDYLDGetSymbolByName(CFBundleRef bundle, CFStringRef symbolName); | |
cf7d2af9 | 123 | #endif /* !BINARY_SUPPORT_DLFCN */ |
bd5b749c A |
124 | #endif /* BINARY_SUPPORT_DYLD */ |
125 | ||
126 | #if defined(BINARY_SUPPORT_DLFCN) | |
127 | // dlfcn API | |
128 | extern Boolean _CFBundleDlfcnCheckLoaded(CFBundleRef bundle); | |
129 | extern Boolean _CFBundleDlfcnPreflight(CFBundleRef bundle, CFErrorRef *error); | |
130 | extern Boolean _CFBundleDlfcnLoadBundle(CFBundleRef bundle, Boolean forceGlobal, CFErrorRef *error); | |
131 | extern Boolean _CFBundleDlfcnLoadFramework(CFBundleRef bundle, CFErrorRef *error); | |
132 | extern void _CFBundleDlfcnUnload(CFBundleRef bundle); | |
133 | extern void *_CFBundleDlfcnGetSymbolByName(CFBundleRef bundle, CFStringRef symbolName); | |
134 | #endif /* BINARY_SUPPORT_DLFCN */ | |
9ce05555 | 135 | |
9ce05555 | 136 | #if defined(BINARY_SUPPORT_DLL) |
bd5b749c | 137 | extern Boolean _CFBundleDLLLoad(CFBundleRef bundle, CFErrorRef *error); |
9ce05555 A |
138 | extern void _CFBundleDLLUnload(CFBundleRef bundle); |
139 | extern void *_CFBundleDLLGetSymbolByName(CFBundleRef bundle, CFStringRef symbolName); | |
bd5b749c | 140 | #endif /* BINARY_SUPPORT_DLL */ |
9ce05555 A |
141 | |
142 | ||
143 | /* Private PlugIn-related CFBundle API */ | |
144 | ||
d8925383 | 145 | extern Boolean _CFBundleNeedsInitPlugIn(CFBundleRef bundle); |
9ce05555 | 146 | extern void _CFBundleInitPlugIn(CFBundleRef bundle); |
0ae65c4b | 147 | extern void _CFBundlePlugInLoaded(CFBundleRef bundle); |
9ce05555 A |
148 | extern void _CFBundleDeallocatePlugIn(CFBundleRef bundle); |
149 | ||
150 | extern void _CFPlugInWillUnload(CFPlugInRef plugIn); | |
151 | ||
152 | extern void _CFPlugInAddPlugInInstance(CFPlugInRef plugIn); | |
153 | extern void _CFPlugInRemovePlugInInstance(CFPlugInRef plugIn); | |
154 | ||
155 | extern void _CFPlugInAddFactory(CFPlugInRef plugIn, _CFPFactory *factory); | |
156 | extern void _CFPlugInRemoveFactory(CFPlugInRef plugIn, _CFPFactory *factory); | |
157 | ||
158 | ||
159 | /* Strings for parsing bundle structure */ | |
160 | #define _CFBundleSupportFilesDirectoryName1 CFSTR("Support Files") | |
161 | #define _CFBundleSupportFilesDirectoryName2 CFSTR("Contents") | |
162 | #define _CFBundleResourcesDirectoryName CFSTR("Resources") | |
163 | #define _CFBundleExecutablesDirectoryName CFSTR("Executables") | |
164 | #define _CFBundleNonLocalizedResourcesDirectoryName CFSTR("Non-localized Resources") | |
165 | ||
166 | #define _CFBundleSupportFilesURLFromBase1 CFSTR("Support%20Files/") | |
167 | #define _CFBundleSupportFilesURLFromBase2 CFSTR("Contents/") | |
168 | #define _CFBundleResourcesURLFromBase0 CFSTR("Resources/") | |
169 | #define _CFBundleResourcesURLFromBase1 CFSTR("Support%20Files/Resources/") | |
170 | #define _CFBundleResourcesURLFromBase2 CFSTR("Contents/Resources/") | |
8ca704e1 A |
171 | #define _CFBundleAppStoreReceiptURLFromBase0 CFSTR("_MASReceipt/receipt") |
172 | #define _CFBundleAppStoreReceiptURLFromBase1 CFSTR("Support%20Files/_MASReceipt/receipt") | |
173 | #define _CFBundleAppStoreReceiptURLFromBase2 CFSTR("Contents/_MASReceipt/receipt") | |
9ce05555 A |
174 | #define _CFBundleExecutablesURLFromBase1 CFSTR("Support%20Files/Executables/") |
175 | #define _CFBundleExecutablesURLFromBase2 CFSTR("Contents/") | |
176 | #define _CFBundleInfoURLFromBase0 CFSTR("Resources/Info.plist") | |
177 | #define _CFBundleInfoURLFromBase1 CFSTR("Support%20Files/Info.plist") | |
178 | #define _CFBundleInfoURLFromBase2 CFSTR("Contents/Info.plist") | |
179 | #define _CFBundleInfoURLFromBase3 CFSTR("Info.plist") | |
180 | #define _CFBundleInfoFileName CFSTR("Info.plist") | |
181 | #define _CFBundleInfoURLFromBaseNoExtension0 CFSTR("Resources/Info") | |
182 | #define _CFBundleInfoURLFromBaseNoExtension1 CFSTR("Support%20Files/Info") | |
183 | #define _CFBundleInfoURLFromBaseNoExtension2 CFSTR("Contents/Info") | |
184 | #define _CFBundleInfoURLFromBaseNoExtension3 CFSTR("Info") | |
185 | #define _CFBundleInfoExtension CFSTR("plist") | |
186 | #define _CFBundleLocalInfoName CFSTR("InfoPlist") | |
187 | #define _CFBundlePkgInfoURLFromBase1 CFSTR("Support%20Files/PkgInfo") | |
188 | #define _CFBundlePkgInfoURLFromBase2 CFSTR("Contents/PkgInfo") | |
189 | #define _CFBundlePseudoPkgInfoURLFromBase CFSTR("PkgInfo") | |
190 | #define _CFBundlePrivateFrameworksURLFromBase0 CFSTR("Frameworks/") | |
191 | #define _CFBundlePrivateFrameworksURLFromBase1 CFSTR("Support%20Files/Frameworks/") | |
192 | #define _CFBundlePrivateFrameworksURLFromBase2 CFSTR("Contents/Frameworks/") | |
193 | #define _CFBundleSharedFrameworksURLFromBase0 CFSTR("SharedFrameworks/") | |
194 | #define _CFBundleSharedFrameworksURLFromBase1 CFSTR("Support%20Files/SharedFrameworks/") | |
195 | #define _CFBundleSharedFrameworksURLFromBase2 CFSTR("Contents/SharedFrameworks/") | |
196 | #define _CFBundleSharedSupportURLFromBase0 CFSTR("SharedSupport/") | |
197 | #define _CFBundleSharedSupportURLFromBase1 CFSTR("Support%20Files/SharedSupport/") | |
198 | #define _CFBundleSharedSupportURLFromBase2 CFSTR("Contents/SharedSupport/") | |
199 | #define _CFBundleBuiltInPlugInsURLFromBase0 CFSTR("PlugIns/") | |
200 | #define _CFBundleBuiltInPlugInsURLFromBase1 CFSTR("Support%20Files/PlugIns/") | |
201 | #define _CFBundleBuiltInPlugInsURLFromBase2 CFSTR("Contents/PlugIns/") | |
202 | #define _CFBundleAlternateBuiltInPlugInsURLFromBase0 CFSTR("Plug-ins/") | |
203 | #define _CFBundleAlternateBuiltInPlugInsURLFromBase1 CFSTR("Support%20Files/Plug-ins/") | |
204 | #define _CFBundleAlternateBuiltInPlugInsURLFromBase2 CFSTR("Contents/Plug-ins/") | |
205 | ||
206 | #define _CFBundleLprojExtension CFSTR("lproj") | |
d8925383 | 207 | #define _CFBundleLprojExtensionWithDot CFSTR(".lproj") |
9ce05555 A |
208 | |
209 | #define _CFBundleMacOSXPlatformName CFSTR("macos") | |
210 | #define _CFBundleAlternateMacOSXPlatformName CFSTR("macosx") | |
8ca704e1 | 211 | #define _CFBundleiPhoneOSPlatformName CFSTR("iphoneos") |
9ce05555 A |
212 | #define _CFBundleMacOS8PlatformName CFSTR("macosclassic") |
213 | #define _CFBundleAlternateMacOS8PlatformName CFSTR("macos8") | |
214 | #define _CFBundleWindowsPlatformName CFSTR("windows") | |
215 | #define _CFBundleHPUXPlatformName CFSTR("hpux") | |
216 | #define _CFBundleSolarisPlatformName CFSTR("solaris") | |
217 | #define _CFBundleLinuxPlatformName CFSTR("linux") | |
218 | #define _CFBundleFreeBSDPlatformName CFSTR("freebsd") | |
219 | ||
220 | #define _CFBundleDefaultStringTableName CFSTR("Localizable") | |
221 | #define _CFBundleStringTableType CFSTR("strings") | |
8ca704e1 | 222 | #define _CFBundleStringDictTableType CFSTR("stringsdict") |
9ce05555 A |
223 | |
224 | #define _CFBundleUserLanguagesPreferenceName CFSTR("AppleLanguages") | |
225 | #define _CFBundleOldUserLanguagesPreferenceName CFSTR("NSLanguages") | |
226 | ||
227 | #define _CFBundleLocalizedResourceForkFileName CFSTR("Localized") | |
228 | ||
cf7d2af9 | 229 | #if DEPLOYMENT_TARGET_WINDOWS |
bd5b749c A |
230 | #define _CFBundleWindowsResourceDirectoryExtension CFSTR("resources") |
231 | #endif | |
232 | ||
9ce05555 A |
233 | /* Old platform names (no longer used) */ |
234 | #define _CFBundleMacOSXPlatformName_OLD CFSTR("macintosh") | |
235 | #define _CFBundleAlternateMacOSXPlatformName_OLD CFSTR("nextstep") | |
236 | #define _CFBundleWindowsPlatformName_OLD CFSTR("windows") | |
237 | #define _CFBundleAlternateWindowsPlatformName_OLD CFSTR("winnt") | |
238 | ||
239 | #define _CFBundleMacOSXInfoPlistPlatformName_OLD CFSTR("macos") | |
240 | #define _CFBundleWindowsInfoPlistPlatformName_OLD CFSTR("win32") | |
241 | ||
bd5b749c | 242 | CF_EXTERN_C_END |
9ce05555 A |
243 | |
244 | #endif /* ! __COREFOUNDATION_CFBUNDLE_INTERNAL__ */ | |
245 |