Skip to content

Commit

Permalink
fixed compiler warnings, removed unnecessary SNOWLEOPARD define, new …
Browse files Browse the repository at this point in the history
…labelValue method (deprecating labelName)
  • Loading branch information
timburks committed Jul 26, 2012
1 parent 1e1cccb commit 4ee2c73
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Nukefile
Expand Up @@ -82,13 +82,13 @@ END)
(set @sdkflags "")
(set @sdk
(cond ((NSFileManager directoryExistsNamed:"#{DEVROOT}/SDKs/MacOSX10.8.sdk")
(set @sdkflags "-D__OBJC2__ -DSNOWLEOPARD")
(set @sdkflags "-D__OBJC2__")
("-isysroot #{DEVROOT}/SDKs/MacOSX10.8.sdk"))
((NSFileManager directoryExistsNamed:"#{DEVROOT}/SDKs/MacOSX10.7.sdk")
(set @sdkflags "-D__OBJC2__ -DSNOWLEOPARD")
(set @sdkflags "-D__OBJC2__")
("-isysroot #{DEVROOT}/SDKs/MacOSX10.7.sdk"))
((NSFileManager directoryExistsNamed:"#{DEVROOT}/SDKs/MacOSX10.6.sdk")
(set @sdkflags "-D__OBJC2__ -DSNOWLEOPARD")
(set @sdkflags "-D__OBJC2__")
("-isysroot #{DEVROOT}/SDKs/MacOSX10.6.sdk"))
((NSFileManager directoryExistsNamed:"#{DEVROOT}/SDKs/MacOSX10.5.sdk")
(set @sdkflags "-D__OBJC2__")
Expand Down
2 changes: 1 addition & 1 deletion objc/Nu.h
Expand Up @@ -34,7 +34,7 @@
the list is considered to be a special type of list called a property list (no relation to ObjC plists).
Each member of a property list is evaluated and the resulting list is returned with no further evaluation.
*/
@interface NuSymbol : NSObject <NSCoding>
@interface NuSymbol : NSObject <NSCoding, NSCopying>

/*! Get the global value of a symbol. */
- (id) value;
Expand Down
42 changes: 27 additions & 15 deletions objc/Nu.m
Expand Up @@ -633,17 +633,17 @@ - (id) callWithArguments:(id)cdr context:(NSMutableDictionary *)calling_context
if (lastParameter && ([[lastParameter stringValue] characterAtIndex:0] == '*')) {
if (numberOfArguments < (numberOfParameters - 1)) {
[NSException raise:@"NuIncorrectNumberOfArguments"
format:@"Incorrect number of arguments to block. Received %d but expected %d or more: %@",
numberOfArguments,
numberOfParameters - 1,
format:@"Incorrect number of arguments to block. Received %ld but expected %ld or more: %@",
(unsigned long) numberOfArguments,
(unsigned long) (numberOfParameters - 1),
[parameters stringValue]];
}
}
else {
[NSException raise:@"NuIncorrectNumberOfArguments"
format:@"Incorrect number of arguments to block. Received %d but expected %d: %@",
numberOfArguments,
numberOfParameters,
format:@"Incorrect number of arguments to block. Received %ld but expected %ld: %@",
(unsigned long) numberOfArguments,
(unsigned long) numberOfParameters,
[parameters stringValue]];
}
}
Expand Down Expand Up @@ -737,9 +737,9 @@ - (id) evalWithArguments:(id)cdr context:(NSMutableDictionary *)calling_context
NSUInteger numberOfParameters = [parameters length];
if (numberOfArguments != numberOfParameters) {
[NSException raise:@"NuIncorrectNumberOfArguments"
format:@"Incorrect number of arguments to method. Received %d but expected %d, %@",
numberOfArguments,
numberOfParameters,
format:@"Incorrect number of arguments to method. Received %ld but expected %ld, %@",
(unsigned long) numberOfArguments,
(unsigned long) numberOfParameters,
[parameters stringValue]];
}
// NSLog(@"block eval %@", [cdr stringValue]);
Expand Down Expand Up @@ -1655,6 +1655,10 @@ static id get_nu_value_from_objc_value(void *objc_value, const char *typeString)
id result = *((id *)objc_value);
return result ? result : (id)[NSNull null];
}
else if (!strcmp(typeString, "^{CGColor=}")) {
id result = *((id *)objc_value);
return result ? result : (id)[NSNull null];
}
else {
if (*((unsigned long *)objc_value) == 0)
return [NSNull null];
Expand All @@ -1678,10 +1682,10 @@ static static void raise_argc_exception(SEL s, NSUInteger count, NSUInteger give
{
if (given != count) {
[NSException raise:@"NuIncorrectNumberOfArguments"
format:@"Incorrect number of arguments to selector %s. Received %d but expected %d",
format:@"Incorrect number of arguments to selector %s. Received %ld but expected %ld",
sel_getName(s),
given,
count];
(unsigned long) given,
(unsigned long) count];
}
}

Expand Down Expand Up @@ -6207,7 +6211,7 @@ - (id) evalWithContext:(NSMutableDictionary *) context

- (NSString *) stringValue
{
return [NSString stringWithFormat:@"<%s:%x>", class_getName(object_getClass(self)), (long) self];
return [NSString stringWithFormat:@"<%s:%lx>", class_getName(object_getClass(self)), (long) self];
}

- (id) car
Expand Down Expand Up @@ -8682,7 +8686,7 @@ - (id) callWithArguments:(id)cdr context:(NSMutableDictionary *)context
[command appendString:[[[cursor car] evalWithContext:context] stringValue]];
cursor = [cursor cdr];
}
const char *commandString = [[command stringValue] cStringUsingEncoding:NSUTF8StringEncoding];
const char *commandString = [command cStringUsingEncoding:NSUTF8StringEncoding];
int result = system(commandString) >> 8; // this needs an explanation
return [NSNumber numberWithInt:result];
}
Expand Down Expand Up @@ -10272,7 +10276,7 @@ - (NuProfileStackElement *) parent {return parent;}

- (NSString *) description
{
return [NSString stringWithFormat:@"name:%@ start:%f", name, start];
return [NSString stringWithFormat:@"name:%@ start:%llx", name, start];
}

@end
Expand Down Expand Up @@ -10953,6 +10957,14 @@ - (NSString *) labelName
return [self stringValue];
}

- (NSString *) labelValue
{
if (isLabel)
return [[self stringValue] substringToIndex:[[self stringValue] length] - 1];
else
return [self stringValue];
}

- (id) evalWithContext:(NSMutableDictionary *)context
{

Expand Down

0 comments on commit 4ee2c73

Please sign in to comment.