]> git.saurik.com Git - apple/cf.git/blob - CFBundle_Internal.h
CF-550.13.tar.gz
[apple/cf.git] / CFBundle_Internal.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
24 /* CFBundle_Internal.h
25 Copyright (c) 1999-2009, Apple Inc. All rights reserved.
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>
34 #include <CoreFoundation/CFError.h>
35 #include "CFInternal.h"
36 #include "CFPlugIn_Factory.h"
37 #include "CFBundle_BinaryTypes.h"
38
39 CF_EXTERN_C_BEGIN
40
41 #define __kCFLogBundle 3
42 #define __kCFLogPlugIn 3
43
44 #if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED
45 #define PLATFORM_PATH_STYLE kCFURLPOSIXPathStyle
46 #elif DEPLOYMENT_TARGET_WINDOWS
47 #define PLATFORM_PATH_STYLE kCFURLWindowsPathStyle
48 #else
49 #error Unknown or unspecified DEPLOYMENT_TARGET
50 #endif
51
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
59 typedef struct __CFResourceData {
60 CFMutableDictionaryRef _stringTableCache;
61 Boolean _executableLacksResourceFork;
62 Boolean _infoDictionaryFromResourceFork;
63 char _padding[2];
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);
87 extern CFURLRef _CFBundleCopySupportFilesDirectoryURLInDirectory(CFAllocatorRef alloc, CFURLRef bundleURL, UInt8 version);
88 extern CFURLRef _CFBundleCopyResourcesDirectoryURLInDirectory(CFAllocatorRef alloc, CFURLRef bundleURL, UInt8 version);
89
90 extern Boolean _CFBundleCouldBeBundle(CFURLRef url);
91 extern CFURLRef _CFBundleCopyFrameworkURLForExecutablePath(CFAllocatorRef alloc, CFStringRef executablePath);
92 extern CFURLRef _CFBundleCopyResourceForkURLMayBeLocal(CFBundleRef bundle, Boolean mayBeLocal);
93 extern CFDictionaryRef _CFBundleCopyInfoDictionaryInResourceForkWithAllocator(CFAllocatorRef alloc, CFURLRef url);
94 extern CFStringRef _CFBundleCopyBundleDevelopmentRegionFromVersResource(CFBundleRef bundle);
95 extern CFDictionaryRef _CFBundleCopyInfoDictionaryInExecutable(CFURLRef url);
96 extern CFArrayRef _CFBundleCopyArchitecturesForExecutable(CFURLRef url);
97
98 extern void _CFBundleAddPreferredLprojNamesInDirectory(CFAllocatorRef alloc, CFURLRef bundleURL, UInt8 version, CFDictionaryRef infoDict, CFMutableArrayRef lprojNames, CFStringRef devLang);
99
100 extern CFStringRef _CFBundleGetPlatformExecutablesSubdirectoryName(void);
101 extern CFStringRef _CFBundleGetAlternatePlatformExecutablesSubdirectoryName(void);
102 extern CFStringRef _CFBundleGetOtherPlatformExecutablesSubdirectoryName(void);
103 extern CFStringRef _CFBundleGetOtherAlternatePlatformExecutablesSubdirectoryName(void);
104
105 extern CFStringRef _CFCreateStringFromVersionNumber(CFAllocatorRef alloc, UInt32 vers);
106 extern UInt32 _CFVersionNumberFromString(CFStringRef versStr);
107
108 extern void _CFBundleScheduleForUnloading(CFBundleRef bundle);
109 extern void _CFBundleUnscheduleForUnloading(CFBundleRef bundle);
110 extern void _CFBundleUnloadScheduledBundles(void);
111
112
113 #if defined(BINARY_SUPPORT_DYLD)
114 // DYLD API
115 extern __CFPBinaryType _CFBundleGrokBinaryType(CFURLRef executableURL);
116 extern CFArrayRef _CFBundleDYLDCopyLoadedImagePathsIfChanged(void);
117 extern CFArrayRef _CFBundleDYLDCopyLoadedImagePathsForHint(CFStringRef hint);
118 #if !defined(BINARY_SUPPORT_DLFCN)
119 extern Boolean _CFBundleDYLDCheckLoaded(CFBundleRef bundle);
120 extern Boolean _CFBundleDYLDLoadBundle(CFBundleRef bundle, Boolean forceGlobal, CFErrorRef *error);
121 extern Boolean _CFBundleDYLDLoadFramework(CFBundleRef bundle, CFErrorRef *error);
122 extern void _CFBundleDYLDUnloadBundle(CFBundleRef bundle);
123 extern void *_CFBundleDYLDGetSymbolByName(CFBundleRef bundle, CFStringRef symbolName);
124 #endif /* !BINARY_SUPPORT_DLFCN */
125 #endif /* BINARY_SUPPORT_DYLD */
126
127 #if defined(BINARY_SUPPORT_DLFCN)
128 // dlfcn API
129 extern Boolean _CFBundleDlfcnCheckLoaded(CFBundleRef bundle);
130 extern Boolean _CFBundleDlfcnPreflight(CFBundleRef bundle, CFErrorRef *error);
131 extern Boolean _CFBundleDlfcnLoadBundle(CFBundleRef bundle, Boolean forceGlobal, CFErrorRef *error);
132 extern Boolean _CFBundleDlfcnLoadFramework(CFBundleRef bundle, CFErrorRef *error);
133 extern void _CFBundleDlfcnUnload(CFBundleRef bundle);
134 extern void *_CFBundleDlfcnGetSymbolByName(CFBundleRef bundle, CFStringRef symbolName);
135 #endif /* BINARY_SUPPORT_DLFCN */
136
137
138 #if defined(BINARY_SUPPORT_DLL)
139 extern Boolean _CFBundleDLLLoad(CFBundleRef bundle, CFErrorRef *error);
140 extern void _CFBundleDLLUnload(CFBundleRef bundle);
141 extern void *_CFBundleDLLGetSymbolByName(CFBundleRef bundle, CFStringRef symbolName);
142 #endif /* BINARY_SUPPORT_DLL */
143
144
145 /* Private PlugIn-related CFBundle API */
146
147 extern Boolean _CFBundleNeedsInitPlugIn(CFBundleRef bundle);
148 extern void _CFBundleInitPlugIn(CFBundleRef bundle);
149 extern void _CFBundlePlugInLoaded(CFBundleRef bundle);
150 extern void _CFBundleDeallocatePlugIn(CFBundleRef bundle);
151
152 extern void _CFPlugInWillUnload(CFPlugInRef plugIn);
153
154 extern void _CFPlugInAddPlugInInstance(CFPlugInRef plugIn);
155 extern void _CFPlugInRemovePlugInInstance(CFPlugInRef plugIn);
156
157 extern void _CFPlugInAddFactory(CFPlugInRef plugIn, _CFPFactory *factory);
158 extern void _CFPlugInRemoveFactory(CFPlugInRef plugIn, _CFPFactory *factory);
159
160
161 /* Strings for parsing bundle structure */
162 #define _CFBundleSupportFilesDirectoryName1 CFSTR("Support Files")
163 #define _CFBundleSupportFilesDirectoryName2 CFSTR("Contents")
164 #define _CFBundleResourcesDirectoryName CFSTR("Resources")
165 #define _CFBundleExecutablesDirectoryName CFSTR("Executables")
166 #define _CFBundleNonLocalizedResourcesDirectoryName CFSTR("Non-localized Resources")
167
168 #define _CFBundleSupportFilesURLFromBase1 CFSTR("Support%20Files/")
169 #define _CFBundleSupportFilesURLFromBase2 CFSTR("Contents/")
170 #define _CFBundleResourcesURLFromBase0 CFSTR("Resources/")
171 #define _CFBundleResourcesURLFromBase1 CFSTR("Support%20Files/Resources/")
172 #define _CFBundleResourcesURLFromBase2 CFSTR("Contents/Resources/")
173 #define _CFBundleExecutablesURLFromBase1 CFSTR("Support%20Files/Executables/")
174 #define _CFBundleExecutablesURLFromBase2 CFSTR("Contents/")
175 #define _CFBundleInfoURLFromBase0 CFSTR("Resources/Info.plist")
176 #define _CFBundleInfoURLFromBase1 CFSTR("Support%20Files/Info.plist")
177 #define _CFBundleInfoURLFromBase2 CFSTR("Contents/Info.plist")
178 #define _CFBundleInfoURLFromBase3 CFSTR("Info.plist")
179 #define _CFBundleInfoFileName CFSTR("Info.plist")
180 #define _CFBundleInfoURLFromBaseNoExtension0 CFSTR("Resources/Info")
181 #define _CFBundleInfoURLFromBaseNoExtension1 CFSTR("Support%20Files/Info")
182 #define _CFBundleInfoURLFromBaseNoExtension2 CFSTR("Contents/Info")
183 #define _CFBundleInfoURLFromBaseNoExtension3 CFSTR("Info")
184 #define _CFBundleInfoExtension CFSTR("plist")
185 #define _CFBundleLocalInfoName CFSTR("InfoPlist")
186 #define _CFBundlePkgInfoURLFromBase1 CFSTR("Support%20Files/PkgInfo")
187 #define _CFBundlePkgInfoURLFromBase2 CFSTR("Contents/PkgInfo")
188 #define _CFBundlePseudoPkgInfoURLFromBase CFSTR("PkgInfo")
189 #define _CFBundlePrivateFrameworksURLFromBase0 CFSTR("Frameworks/")
190 #define _CFBundlePrivateFrameworksURLFromBase1 CFSTR("Support%20Files/Frameworks/")
191 #define _CFBundlePrivateFrameworksURLFromBase2 CFSTR("Contents/Frameworks/")
192 #define _CFBundleSharedFrameworksURLFromBase0 CFSTR("SharedFrameworks/")
193 #define _CFBundleSharedFrameworksURLFromBase1 CFSTR("Support%20Files/SharedFrameworks/")
194 #define _CFBundleSharedFrameworksURLFromBase2 CFSTR("Contents/SharedFrameworks/")
195 #define _CFBundleSharedSupportURLFromBase0 CFSTR("SharedSupport/")
196 #define _CFBundleSharedSupportURLFromBase1 CFSTR("Support%20Files/SharedSupport/")
197 #define _CFBundleSharedSupportURLFromBase2 CFSTR("Contents/SharedSupport/")
198 #define _CFBundleBuiltInPlugInsURLFromBase0 CFSTR("PlugIns/")
199 #define _CFBundleBuiltInPlugInsURLFromBase1 CFSTR("Support%20Files/PlugIns/")
200 #define _CFBundleBuiltInPlugInsURLFromBase2 CFSTR("Contents/PlugIns/")
201 #define _CFBundleAlternateBuiltInPlugInsURLFromBase0 CFSTR("Plug-ins/")
202 #define _CFBundleAlternateBuiltInPlugInsURLFromBase1 CFSTR("Support%20Files/Plug-ins/")
203 #define _CFBundleAlternateBuiltInPlugInsURLFromBase2 CFSTR("Contents/Plug-ins/")
204
205 #define _CFBundleLprojExtension CFSTR("lproj")
206 #define _CFBundleLprojExtensionWithDot CFSTR(".lproj")
207
208 #define _CFBundleMacOSXPlatformName CFSTR("macos")
209 #define _CFBundleAlternateMacOSXPlatformName CFSTR("macosx")
210 #define _CFBundleMacOS8PlatformName CFSTR("macosclassic")
211 #define _CFBundleAlternateMacOS8PlatformName CFSTR("macos8")
212 #define _CFBundleWindowsPlatformName CFSTR("windows")
213 #define _CFBundleHPUXPlatformName CFSTR("hpux")
214 #define _CFBundleSolarisPlatformName CFSTR("solaris")
215 #define _CFBundleLinuxPlatformName CFSTR("linux")
216 #define _CFBundleFreeBSDPlatformName CFSTR("freebsd")
217
218 #define _CFBundleDefaultStringTableName CFSTR("Localizable")
219 #define _CFBundleStringTableType CFSTR("strings")
220
221 #define _CFBundleUserLanguagesPreferenceName CFSTR("AppleLanguages")
222 #define _CFBundleOldUserLanguagesPreferenceName CFSTR("NSLanguages")
223
224 #define _CFBundleLocalizedResourceForkFileName CFSTR("Localized")
225
226 #if DEPLOYMENT_TARGET_WINDOWS
227 #define _CFBundleWindowsResourceDirectoryExtension CFSTR("resources")
228 #endif
229
230 /* Old platform names (no longer used) */
231 #define _CFBundleMacOSXPlatformName_OLD CFSTR("macintosh")
232 #define _CFBundleAlternateMacOSXPlatformName_OLD CFSTR("nextstep")
233 #define _CFBundleWindowsPlatformName_OLD CFSTR("windows")
234 #define _CFBundleAlternateWindowsPlatformName_OLD CFSTR("winnt")
235
236 #define _CFBundleMacOSXInfoPlistPlatformName_OLD CFSTR("macos")
237 #define _CFBundleWindowsInfoPlistPlatformName_OLD CFSTR("win32")
238
239 CF_EXTERN_C_END
240
241 #endif /* ! __COREFOUNDATION_CFBUNDLE_INTERNAL__ */
242