implementorsOfSelector: added

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@14979 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Stefan Urbanek 2002-11-11 21:45:46 +00:00
parent af4a57c69d
commit 50ce3dfbd7
4 changed files with 36 additions and 5 deletions

View file

@ -1,6 +1,7 @@
2002 Nov 11
* ObjectiveC module: added selectorsContainingString:
* ObjectiveC module: added selectorsContainingString: and
implementorsOfSelector:
2002 Nov 5

View file

@ -28,7 +28,7 @@
#import <objc/objc-api.h>
#import <StepTalk/STunctions.h>
#import <StepTalk/STObjCRuntime.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSString.h>
@ -91,6 +91,33 @@ static ObjectiveCRuntime *sharedRuntime=nil;
return [NSArray arrayWithArray:sels];
}
- (NSArray *)implementorsOfSelector:(NSString *)selector
{
NSMutableArray *array = [NSMutableArray array];
NSEnumerator *enumerator;
NSDictionary *classes = STAllObjectiveCClasses();
NSString *className;
NSArray *methods;
Class class;
enumerator = [classes keyEnumerator];
while( (className = [enumerator nextObject]) )
{
class = [classes objectForKey:className];
if([class respondsToSelector:@selector(instanceMethodNames)])
{
methods = [class instanceMethodNames];
if([methods containsObject:selector])
{
[array addObject:className];
}
}
}
return [NSArray arrayWithArray:array];
}
@end

View file

@ -76,6 +76,8 @@
int rem;
self = [super init];
NSDebugLLog(@"STStructure",
@"creating structure of type '%s' value ptr %p",type,value);
@ -107,11 +109,9 @@
{
offset += align - rem;
}
}
return [super init];
return self;
}
- (void)dealloc
{
@ -296,11 +296,13 @@
- (id)origin
{
NSLog(@"Origin %@", [fields objectAtIndex:0]);
return [fields objectAtIndex:0];
}
- (id)size
{
NSLog(@"Size %@", [fields objectAtIndex:1]);
return [fields objectAtIndex:1] ;
}

1
TODO
View file

@ -4,3 +4,4 @@ TODO list
2 fix class-info lookup for proxies in STEnvironment
3 implement NSRect object
4 write documentation for developers and users
5 Smalltalk: separate compiler and compilation context