summaryrefslogtreecommitdiff
path: root/MLKRoot.m
diff options
context:
space:
mode:
Diffstat (limited to 'MLKRoot.m')
-rw-r--r--MLKRoot.m20
1 files changed, 19 insertions, 1 deletions
diff --git a/MLKRoot.m b/MLKRoot.m
index 4b8356f..f155733 100644
--- a/MLKRoot.m
+++ b/MLKRoot.m
@@ -523,7 +523,25 @@ static id truify (BOOL value)
for (i = 2; i < [args count]; i++)
{
id argument = denullify ([args objectAtIndex:i]);
- [invocation setArgument:&argument atIndex:i];
+ const char *type = [signature getArgumentTypeAtIndex:i];
+
+ if (strcmp (type, @encode(unichar)) == 0)
+ {
+ unichar arg;
+ if ([argument isKindOfClass:[MLKCharacter class]])
+ arg = [argument unicharValue];
+ else if ([argument isKindOfClass:[MLKInteger class]])
+ arg = [argument intValue];
+ else
+ [NSException raise:@"MLKInvalidArgumentError"
+ format:@"Don't know how to coerce %@ into type \"%s\".",
+ argument, type];
+ [invocation setArgument:&arg atIndex:i];
+ }
+ else
+ {
+ [invocation setArgument:&argument atIndex:i];
+ }
}
[invocation invoke];