mirror of
https://github.com/gnustep/libs-steptalk.git
synced 2025-02-19 09:50:43 +00:00
Fixed signature creation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@16927 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b276ee0d9d
commit
2015adc94a
3 changed files with 53 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
* NSInvocation+additions: added unknown selector creation; created a
|
||||
workaround for gnustep DO bug
|
||||
* STObjCRuntime: Fixed creation of signature.
|
||||
|
||||
2003 May 11 Stefan Urbanek <urbanek@host.sk>
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ How to open a file using the open panel
|
|||
Text
|
||||
----
|
||||
|
||||
How to display an RTF file
|
||||
How to display a RTF file
|
||||
|
||||
> text := NSAttributedString alloc
|
||||
> text initWithPath: file documentAttributes:nil
|
||||
|
|
|
@ -154,11 +154,61 @@ SEL STSelectorFromString(NSString *aString)
|
|||
return sel;
|
||||
}
|
||||
|
||||
SEL STCreateTypedSelector(SEL sel)
|
||||
{
|
||||
const char *name = sel_get_name(sel);
|
||||
const char *ptr;
|
||||
int argc = 0;
|
||||
|
||||
SEL newSel;
|
||||
|
||||
ptr = name;
|
||||
|
||||
while(*ptr)
|
||||
{
|
||||
if(*ptr == ':')
|
||||
{
|
||||
argc ++;
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if( argc < SELECTOR_TYPES_COUNT )
|
||||
{
|
||||
NSDebugLLog(@"STSending",
|
||||
@"registering selector '%s' "
|
||||
@"with %i arguments, types:'%s'",
|
||||
name,argc,selector_types[argc]);
|
||||
|
||||
newSel = sel_register_typed_name(name, selector_types[argc]);
|
||||
}
|
||||
|
||||
if(!newSel)
|
||||
{
|
||||
[NSException raise:STInternalInconsistencyException
|
||||
format:@"Unable to register typed selector '%s'",
|
||||
name];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return newSel;
|
||||
}
|
||||
|
||||
NSMethodSignature *STMethodSignatureForSelector(SEL sel)
|
||||
{
|
||||
return [NSMethodSignature signatureWithObjCTypes:sel_get_type(sel)];
|
||||
char *types;
|
||||
|
||||
types = sel_get_type(sel);
|
||||
|
||||
if(!types)
|
||||
{
|
||||
sel = STCreateTypedSelector(sel);
|
||||
types = sel_get_type(sel);
|
||||
}
|
||||
return [NSMethodSignature signatureWithObjCTypes:types];
|
||||
}
|
||||
|
||||
|
||||
static NSArray *selectors_from_list(struct objc_method_list *methods)
|
||||
{
|
||||
NSMutableArray *array = [NSMutableArray array];
|
||||
|
|
Loading…
Reference in a new issue