mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Mangle/demangle framework names in NSFramework_xxx class names to support
'-' and '+' in framework names git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21455 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fca5434f63
commit
2d2a635967
2 changed files with 30 additions and 3 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,7 +1,15 @@
|
|||
2005-07-12 Nicola Pero <n.pero@mi.flashnet.it>
|
||||
|
||||
* Source/NSBundle.m ([+_addFrameworkFromClass:]),
|
||||
([-executablePath]): Mangle/demangle framework names so that we
|
||||
can support '-' (and '+') in framework names. Requires latest
|
||||
gnustep-make if you have a framework with '_', '-' or '+' in the
|
||||
name.
|
||||
|
||||
2005-07-08 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Testing/GNUmakefile, Testing/nsfilehandle.m: Minor fixes.
|
||||
|
||||
|
||||
2005-07-08 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/objc-load.m: Under mingw print filenames for debug using
|
||||
|
|
|
@ -303,11 +303,19 @@ _find_framework(NSString *name)
|
|||
len = strlen (frameworkClass->name);
|
||||
|
||||
if (len > 12 * sizeof(char)
|
||||
&& !strncmp("NSFramework_", frameworkClass->name, 12))
|
||||
&& !strncmp ("NSFramework_", frameworkClass->name, 12))
|
||||
{
|
||||
/* The name of the framework. */
|
||||
NSString *name = [NSString stringWithCString: &frameworkClass->name[12]];
|
||||
|
||||
/* Important - gnustep-make mangles framework names to encode
|
||||
* them as ObjC class names. Here we need to demangle them. We
|
||||
* apply the reverse transformations in the reverse order.
|
||||
*/
|
||||
name = [name stringByReplacingString: @"_1" withString: @"+"];
|
||||
name = [name stringByReplacingString: @"_0" withString: @"-"];
|
||||
name = [name stringByReplacingString: @"__" withString: @"_"];
|
||||
|
||||
/* Try getting the path to the framework using the dynamic
|
||||
* linker. When it works it's really cool :-) This is the only
|
||||
* really universal way of getting the framework path ... we can
|
||||
|
@ -1561,11 +1569,22 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
}
|
||||
if (_bundleType == NSBUNDLE_FRAMEWORK)
|
||||
{
|
||||
/* Mangle the name before building the _currentFrameworkName,
|
||||
* which really is a class name.
|
||||
*/
|
||||
NSString *mangledName = object;
|
||||
mangledName = [mangledName stringByReplacingString: @"_"
|
||||
withString: @"__"];
|
||||
mangledName = [mangledName stringByReplacingString: @"-"
|
||||
withString: @"_0"];
|
||||
mangledName = [mangledName stringByReplacingString: @"+"
|
||||
withString: @"_1"];
|
||||
|
||||
path = [_path stringByAppendingPathComponent:@"Versions/Current"];
|
||||
|
||||
_currentFrameworkName = RETAIN(([NSString stringWithFormat:
|
||||
@"NSFramework_%@",
|
||||
object]));
|
||||
mangledName]));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue