2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
25 /* CFBundle_Internal.h
26 Copyright (c) 1999-2003, Apple, Inc. All rights reserved.
29 #if !defined(__COREFOUNDATION_CFBUNDLE_INTERNAL__)
30 #define __COREFOUNDATION_CFBUNDLE_INTERNAL__ 1
32 #include <CoreFoundation/CFDate.h>
33 #include <CoreFoundation/CFBundle.h>
34 #include <CoreFoundation/CFPlugIn.h>
35 #include "CFInternal.h"
36 #include "CFPlugIn_Factory.h"
37 #include "CFBundle_BinaryTypes.h"
39 #if defined(__cplusplus)
43 #define __kCFLogBundle 21
44 #define __kCFLogPlugIn 22
47 #define PLATFORM_PATH_STYLE kCFURLWindowsPathStyle
48 #elif defined (__MACOS8__)
49 #define PLATFORM_PATH_STYLE kCFURLHFSPathStyle
51 #define PLATFORM_PATH_STYLE kCFURLPOSIXPathStyle
54 typedef struct __CFResourceData
{
55 CFMutableDictionaryRef _stringTableCache
;
56 Boolean _executableLacksResourceFork
;
60 extern _CFResourceData
*__CFBundleGetResourceData(CFBundleRef bundle
);
62 typedef struct __CFPlugInData
{
64 Boolean _loadOnDemand
;
65 Boolean _isDoingDynamicRegistration
;
67 UInt32 _instanceCount
;
68 CFMutableArrayRef _factories
;
71 extern _CFPlugInData
*__CFBundleGetPlugInData(CFBundleRef bundle
);
73 /* Private CFBundle API */
75 extern Boolean
_CFIsResourceAtURL(CFURLRef url
, Boolean
*isDir
);
76 extern Boolean
_CFIsResourceAtPath(CFStringRef path
, Boolean
*isDir
);
78 extern Boolean
_CFBundleURLLooksLikeBundleVersion(CFURLRef url
, UInt8
*version
);
79 extern CFDictionaryRef
_CFBundleCopyInfoDictionaryInDirectory(CFAllocatorRef alloc
, CFURLRef url
, UInt8
*version
);
80 extern CFDictionaryRef
_CFBundleCopyInfoDictionaryInDirectoryWithVersion(CFAllocatorRef alloc
, CFURLRef url
, UInt8 version
);
81 extern CFURLRef
_CFBundleCopySupportFilesDirectoryURLInDirectory(CFAllocatorRef alloc
, CFURLRef bundleURL
, UInt8 version
);
82 extern CFURLRef
_CFBundleCopyResourcesDirectoryURLInDirectory(CFAllocatorRef alloc
, CFURLRef bundleURL
, UInt8 version
);
84 extern Boolean
_CFBundleCouldBeBundle(CFURLRef url
);
85 extern CFURLRef
_CFBundleCopyFrameworkURLForExecutablePath(CFAllocatorRef alloc
, CFStringRef executablePath
);
86 extern CFURLRef
_CFBundleCopyResourceForkURLMayBeLocal(CFBundleRef bundle
, Boolean mayBeLocal
);
87 extern CFDictionaryRef
_CFBundleCopyInfoDictionaryInResourceForkWithAllocator(CFAllocatorRef alloc
, CFURLRef url
);
88 extern CFStringRef
_CFBundleCopyBundleDevelopmentRegionFromVersResource(CFBundleRef bundle
);
89 extern CFDictionaryRef
_CFBundleCopyInfoDictionaryInExecutable(CFURLRef url
);
91 extern void _CFBundleAddPreferredLprojNamesInDirectory(CFAllocatorRef alloc
, CFURLRef bundleURL
, UInt8 version
, CFDictionaryRef infoDict
, CFMutableArrayRef lprojNames
, CFStringRef devLang
);
93 extern CFStringRef
_CFBundleGetPlatformExecutablesSubdirectoryName(void);
94 extern CFStringRef
_CFBundleGetAlternatePlatformExecutablesSubdirectoryName(void);
95 extern CFStringRef
_CFBundleGetOtherPlatformExecutablesSubdirectoryName(void);
96 extern CFStringRef
_CFBundleGetOtherAlternatePlatformExecutablesSubdirectoryName(void);
98 extern CFStringRef
_CFCreateStringFromVersionNumber(CFAllocatorRef alloc
, UInt32 vers
);
99 extern UInt32
_CFVersionNumberFromString(CFStringRef versStr
);
101 extern void _CFBundleScheduleForUnloading(CFBundleRef bundle
);
102 extern void _CFBundleUnscheduleForUnloading(CFBundleRef bundle
);
103 extern void _CFBundleUnloadScheduledBundles(void);
106 #if defined(BINARY_SUPPORT_DYLD)
108 extern __CFPBinaryType
_CFBundleGrokBinaryType(CFURLRef executableURL
);
109 extern Boolean
_CFBundleDYLDCheckLoaded(CFBundleRef bundle
);
110 extern Boolean
_CFBundleDYLDLoadBundle(CFBundleRef bundle
);
111 extern Boolean
_CFBundleDYLDLoadFramework(CFBundleRef bundle
);
112 extern void _CFBundleDYLDUnloadBundle(CFBundleRef bundle
);
113 extern void *_CFBundleDYLDGetSymbolByName(CFBundleRef bundle
, CFStringRef symbolName
);
115 extern CFArrayRef
_CFBundleDYLDCopyLoadedImagePathsIfChanged(void);
116 extern CFArrayRef
_CFBundleDYLDCopyLoadedImagePathsForHint(CFStringRef hint
);
119 #if defined(BINARY_SUPPORT_CFM)
121 #if defined(__MACOS8__)
122 #include <CodeFragments.h>
124 #include <CarbonCore/CodeFragments.h>
126 extern Boolean
_CFBundleCFMLoad(CFBundleRef bundle
);
127 extern void _CFBundleCFMConnect(CFBundleRef bundle
);
128 extern void _CFBundleCFMUnload(CFBundleRef bundle
);
129 extern void *__CFBundleCFMGetSymbol(void *connID
, ConstStr255Param name
, CFragSymbolClass
class);
130 extern void *_CFBundleCFMGetSymbolByName(CFBundleRef bundle
, CFStringRef symbolName
, CFragSymbolClass
class);
131 #endif /* BINARY_SUPPORT_CFM */
133 #if defined(BINARY_SUPPORT_DLL)
134 extern Boolean
_CFBundleDLLLoad(CFBundleRef bundle
);
135 extern void _CFBundleDLLUnload(CFBundleRef bundle
);
136 extern void *_CFBundleDLLGetSymbolByName(CFBundleRef bundle
, CFStringRef symbolName
);
137 #endif BINARY_SUPPORT_DLL
140 /* Private PlugIn-related CFBundle API */
142 extern void _CFBundleInitPlugIn(CFBundleRef bundle
);
143 extern void _CFBundleDeallocatePlugIn(CFBundleRef bundle
);
145 extern void _CFPlugInWillUnload(CFPlugInRef plugIn
);
147 extern void _CFPlugInAddPlugInInstance(CFPlugInRef plugIn
);
148 extern void _CFPlugInRemovePlugInInstance(CFPlugInRef plugIn
);
150 extern void _CFPlugInAddFactory(CFPlugInRef plugIn
, _CFPFactory
*factory
);
151 extern void _CFPlugInRemoveFactory(CFPlugInRef plugIn
, _CFPFactory
*factory
);
154 /* Strings for parsing bundle structure */
155 #define _CFBundleSupportFilesDirectoryName1 CFSTR("Support Files")
156 #define _CFBundleSupportFilesDirectoryName2 CFSTR("Contents")
157 #define _CFBundleResourcesDirectoryName CFSTR("Resources")
158 #define _CFBundleExecutablesDirectoryName CFSTR("Executables")
159 #define _CFBundleNonLocalizedResourcesDirectoryName CFSTR("Non-localized Resources")
161 #define _CFBundleSupportFilesURLFromBase1 CFSTR("Support%20Files/")
162 #define _CFBundleSupportFilesURLFromBase2 CFSTR("Contents/")
163 #define _CFBundleResourcesURLFromBase0 CFSTR("Resources/")
164 #define _CFBundleResourcesURLFromBase1 CFSTR("Support%20Files/Resources/")
165 #define _CFBundleResourcesURLFromBase2 CFSTR("Contents/Resources/")
166 #define _CFBundleExecutablesURLFromBase1 CFSTR("Support%20Files/Executables/")
167 #define _CFBundleExecutablesURLFromBase2 CFSTR("Contents/")
168 #define _CFBundleInfoURLFromBase0 CFSTR("Resources/Info.plist")
169 #define _CFBundleInfoURLFromBase1 CFSTR("Support%20Files/Info.plist")
170 #define _CFBundleInfoURLFromBase2 CFSTR("Contents/Info.plist")
171 #define _CFBundleInfoURLFromBase3 CFSTR("Info.plist")
172 #define _CFBundleInfoFileName CFSTR("Info.plist")
173 #define _CFBundleInfoURLFromBaseNoExtension0 CFSTR("Resources/Info")
174 #define _CFBundleInfoURLFromBaseNoExtension1 CFSTR("Support%20Files/Info")
175 #define _CFBundleInfoURLFromBaseNoExtension2 CFSTR("Contents/Info")
176 #define _CFBundleInfoURLFromBaseNoExtension3 CFSTR("Info")
177 #define _CFBundleInfoExtension CFSTR("plist")
178 #define _CFBundleLocalInfoName CFSTR("InfoPlist")
179 #define _CFBundlePkgInfoURLFromBase1 CFSTR("Support%20Files/PkgInfo")
180 #define _CFBundlePkgInfoURLFromBase2 CFSTR("Contents/PkgInfo")
181 #define _CFBundlePseudoPkgInfoURLFromBase CFSTR("PkgInfo")
182 #define _CFBundlePrivateFrameworksURLFromBase0 CFSTR("Frameworks/")
183 #define _CFBundlePrivateFrameworksURLFromBase1 CFSTR("Support%20Files/Frameworks/")
184 #define _CFBundlePrivateFrameworksURLFromBase2 CFSTR("Contents/Frameworks/")
185 #define _CFBundleSharedFrameworksURLFromBase0 CFSTR("SharedFrameworks/")
186 #define _CFBundleSharedFrameworksURLFromBase1 CFSTR("Support%20Files/SharedFrameworks/")
187 #define _CFBundleSharedFrameworksURLFromBase2 CFSTR("Contents/SharedFrameworks/")
188 #define _CFBundleSharedSupportURLFromBase0 CFSTR("SharedSupport/")
189 #define _CFBundleSharedSupportURLFromBase1 CFSTR("Support%20Files/SharedSupport/")
190 #define _CFBundleSharedSupportURLFromBase2 CFSTR("Contents/SharedSupport/")
191 #define _CFBundleBuiltInPlugInsURLFromBase0 CFSTR("PlugIns/")
192 #define _CFBundleBuiltInPlugInsURLFromBase1 CFSTR("Support%20Files/PlugIns/")
193 #define _CFBundleBuiltInPlugInsURLFromBase2 CFSTR("Contents/PlugIns/")
194 #define _CFBundleAlternateBuiltInPlugInsURLFromBase0 CFSTR("Plug-ins/")
195 #define _CFBundleAlternateBuiltInPlugInsURLFromBase1 CFSTR("Support%20Files/Plug-ins/")
196 #define _CFBundleAlternateBuiltInPlugInsURLFromBase2 CFSTR("Contents/Plug-ins/")
198 #define _CFBundleLprojExtension CFSTR("lproj")
200 #define _CFBundleMacOSXPlatformName CFSTR("macos")
201 #define _CFBundleAlternateMacOSXPlatformName CFSTR("macosx")
202 #define _CFBundleMacOS8PlatformName CFSTR("macosclassic")
203 #define _CFBundleAlternateMacOS8PlatformName CFSTR("macos8")
204 #define _CFBundleWindowsPlatformName CFSTR("windows")
205 #define _CFBundleHPUXPlatformName CFSTR("hpux")
206 #define _CFBundleSolarisPlatformName CFSTR("solaris")
207 #define _CFBundleLinuxPlatformName CFSTR("linux")
208 #define _CFBundleFreeBSDPlatformName CFSTR("freebsd")
210 #define _CFBundleDefaultStringTableName CFSTR("Localizable")
211 #define _CFBundleStringTableType CFSTR("strings")
213 #define _CFBundleUserLanguagesPreferenceName CFSTR("AppleLanguages")
214 #define _CFBundleOldUserLanguagesPreferenceName CFSTR("NSLanguages")
216 #define _CFBundleLocalizedResourceForkFileName CFSTR("Localized")
218 /* Old platform names (no longer used) */
219 #define _CFBundleMacOSXPlatformName_OLD CFSTR("macintosh")
220 #define _CFBundleAlternateMacOSXPlatformName_OLD CFSTR("nextstep")
221 #define _CFBundleWindowsPlatformName_OLD CFSTR("windows")
222 #define _CFBundleAlternateWindowsPlatformName_OLD CFSTR("winnt")
224 #define _CFBundleMacOSXInfoPlistPlatformName_OLD CFSTR("macos")
225 #define _CFBundleWindowsInfoPlistPlatformName_OLD CFSTR("win32")
227 #if defined(__cplusplus)
231 #endif /* ! __COREFOUNDATION_CFBUNDLE_INTERNAL__ */