mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-20 12:16:40 +00:00
A huge blob of changes to make -base build with libobjc2, without using the old libobjc2 headers.
Most of these changes involve simply removing direct manipulation of any runtime structures and replacing them with runtime function calls. For example class->name becomes class_getName(class) and so on. libobjc2, like the Apple runtime, the NeXT runtime, and every version of the Objective-C spec, calls the class pointer in id isa. A few files now have #define class_pointer isa at the top. This line replaces class_pointer in the old GNU libobjc headers with isa so either class_pointer or isa can be used for accessing the class of an object. Note: object_getClass() should be used in most cases because, in some future version of the runtime, this will skip things like lock classes and other hidden classes (e.g. KVO classes). All of the old forwarding stuff has been removed. Most of this stuff followed convoluted code paths that ended with an exception. A few simply broke in exciting ways. Hopefully no one has used them for the last ten years or so, but we can bring them back with some #ifndef stuff if they're really needed by anyone. There is currently a bug in configure, which prevents dladdr() from being detected, so you need to manually tweak config.h to build - I have not fixed the fall-back code in objc-load.m to work with libobjc2, I just added a new version that uses the loader's functionality directly. Although -base now builds, it builds with a lot of warnings. <string.h> is missing from a lot of files, so memcpy() and strlen() generate implicit function declaration warnings. Additionally, libobjc2 does still provide the sel_{get,register}_*() functions, but they're wrappers around the newer API ones. These are deprecated and are not exposed in the headers. Although they work, we should be replacing them with the libobjc2 versions as soon as possible. This incorporates a patch by Eric. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31265 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0ed572ef2d
commit
7a80adeb9b
18 changed files with 141 additions and 501 deletions
|
@ -773,18 +773,6 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
* create invocations.
|
||||
*/
|
||||
@implementation NSInvocation (MacroSetup)
|
||||
/**
|
||||
* Internal use.<br />
|
||||
* Initialises the receiver with a known selector and argument list
|
||||
* as supplied to the forward:: method by the ObjectiveC runtime
|
||||
* when it is unable to locate an implementation for the selector
|
||||
* in a class.
|
||||
*/
|
||||
- (id) initWithArgframe: (arglist_t)frame selector: (SEL)aSelector
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
/** <init /><override-subclass />
|
||||
* Initialised an invocation instance which can be used to send messages to
|
||||
|
@ -804,11 +792,6 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
* Provides a return frame that the ObjectiveC runtime can use to
|
||||
* return the result of an invocation to a calling function.
|
||||
*/
|
||||
- (void*) returnFrame: (arglist_t)argFrame
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+ (id) _newProxyForInvocation: (id)target
|
||||
{
|
||||
|
@ -839,10 +822,6 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
#warning Using dummy NSInvocation implementation. It is strongly recommended that you use libffi.
|
||||
@implementation GSDummyInvocation
|
||||
|
||||
- (id) initWithArgframe: (arglist_t)frame selector: (SEL)aSelector
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the de_signated initialiser.
|
||||
|
@ -866,10 +845,6 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
}
|
||||
}
|
||||
|
||||
- (void*) returnFrame: (arglist_t)argFrame
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@end
|
||||
#endif
|
||||
|
||||
|
@ -886,19 +861,6 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
{
|
||||
return invocation;
|
||||
}
|
||||
- (retval_t) forward: (SEL)aSel : (arglist_t)argFrame
|
||||
{
|
||||
NSInvocation *inv;
|
||||
|
||||
if (aSel == 0)
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"%@ null selector given", NSStringFromSelector(_cmd)];
|
||||
|
||||
inv = AUTORELEASE([[NSInvocation alloc] initWithArgframe: argFrame
|
||||
selector: aSel]);
|
||||
[self forwardInvocation: inv];
|
||||
return [inv returnFrame: argFrame];
|
||||
}
|
||||
- (void) forwardInvocation: (NSInvocation*)anInvocation
|
||||
{
|
||||
invocation = anInvocation;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue