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