From 0fc2324c1cc28dd80b13d34a030576a20d887066 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Thu, 31 Jul 2008 12:48:11 +0200 Subject: Reader: Support #\. --- MLKRoot.m | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'MLKRoot.m') 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]; -- cgit v1.2.3