Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed compiler warnings, removed unnecessary SNOWLEOPARD define, new …

…labelValue method (deprecating labelName)
  • Loading branch information...
commit 4ee2c73acc5c786befc18333d7b50b29945d0024 1 parent 1e1cccb
@timburks authored
Showing with 31 additions and 19 deletions.
  1. +3 −3 Nukefile
  2. +1 −1  objc/Nu.h
  3. +27 −15 objc/Nu.m
View
6 Nukefile
@@ -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__")
View
2  objc/Nu.h
@@ -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;
View
42 objc/Nu.m
@@ -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]];
}
}
@@ -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]);
@@ -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];
@@ -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];
}
}
@@ -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
@@ -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];
}
@@ -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
@@ -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
{
Please sign in to comment.
Something went wrong with that request. Please try again.