[48608] users/toby/objcports

toby at macports.org toby at macports.org
Wed Mar 25 23:27:19 PDT 2009


Revision: 48608
          http://trac.macports.org/changeset/48608
Author:   toby at macports.org
Date:     2009-03-25 23:27:19 -0700 (Wed, 25 Mar 2009)
Log Message:
-----------
rename some methods for clarity

Modified Paths:
--------------
    users/toby/objcports/MPParser.m
    users/toby/objcports/MPPort.h
    users/toby/objcports/MPPort.m
    users/toby/objcports/port.m

Modified: users/toby/objcports/MPParser.m
===================================================================
--- users/toby/objcports/MPParser.m	2009-03-26 06:17:57 UTC (rev 48607)
+++ users/toby/objcports/MPParser.m	2009-03-26 06:27:19 UTC (rev 48608)
@@ -106,7 +106,7 @@
 			arch = [args objectAtIndex:2];
 		}
 
-		if ([_port addPlatform:[NSArray arrayWithObjects:os, release, arch, nil]]) {
+		if ([_port testAndRecordPlatform:[NSArray arrayWithObjects:os, release, arch, nil]]) {
 			Tcl_Eval(_interp, [[args lastObject] UTF8String]);
 		}
 	} else if ([command isEqualToString:@"variant"]) {
@@ -129,7 +129,7 @@
 			[props setObject:[args objectAtIndex:i+1] forKey:[args objectAtIndex:i]];
 		}
 
-		if ([_port addVariant:name properties:props]) {
+		if ([_port testAndRecordVariant:name withProperties:props]) {
 			Tcl_Eval(_interp, [[args lastObject] UTF8String]);
 		}
 	} else if ([_port isTarget:command]) {

Modified: users/toby/objcports/MPPort.h
===================================================================
--- users/toby/objcports/MPPort.h	2009-03-26 06:17:57 UTC (rev 48607)
+++ users/toby/objcports/MPPort.h	2009-03-26 06:27:19 UTC (rev 48608)
@@ -29,10 +29,10 @@
 - (void)variable:(NSString *)var append:(NSArray *)value;
 - (void)variable:(NSString *)var delete:(NSArray *)value;
 
-- (BOOL)addPlatform:(NSArray *)platform;
-- (NSArray *)platforms;
+- (NSArray *)definedPlatforms;
+- (BOOL)testAndRecordPlatform:(NSArray *)platform;
 
-- (BOOL)addVariant:(NSString *)variant properties:(NSDictionary *)props;
-- (NSArray *)variants;
+- (NSArray *)definedVariants;
+- (BOOL)testAndRecordVariant:(NSString *)variant withProperties:(NSDictionary *)props;
 
 @end

Modified: users/toby/objcports/MPPort.m
===================================================================
--- users/toby/objcports/MPPort.m	2009-03-26 06:17:57 UTC (rev 48607)
+++ users/toby/objcports/MPPort.m	2009-03-26 06:27:19 UTC (rev 48608)
@@ -154,8 +154,17 @@
 	[tmp release];
 }
 
-- (BOOL)addPlatform:(NSArray *)platform
+- (NSArray *)definedPlatforms
 {
+	NSMutableArray *ret = [NSMutableArray arrayWithCapacity:0];
+	for (NSArray *plat in _platforms) {
+		[ret addObject:[plat componentsJoinedByString:@"_"]];
+	}
+	return ret;
+}
+
+- (BOOL)testAndRecordPlatform:(NSArray *)platform
+{
 	struct utsname u;
 	NSString *os;
 	NSNumber *release;
@@ -187,12 +196,12 @@
 	return YES;
 }
 
-- (NSArray *)platforms
+- (NSArray *)definedVariants
 {
-	return _platforms;
+	return [_variants allKeys];
 }
 
-- (BOOL)addVariant:(NSString *)variant properties:(NSDictionary *)props
+- (BOOL)testAndRecordVariant:(NSString *)variant withProperties:(NSDictionary *)props
 {
 	// XXX: check for dupes (w/ platforms too)
 	[_variants setObject:props forKey:variant];
@@ -200,9 +209,4 @@
 	return YES;
 }
 
-- (NSArray *)variants
-{
-	return [_variants allKeys];
-}
-
 @end

Modified: users/toby/objcports/port.m
===================================================================
--- users/toby/objcports/port.m	2009-03-26 06:17:57 UTC (rev 48607)
+++ users/toby/objcports/port.m	2009-03-26 06:27:19 UTC (rev 48608)
@@ -13,8 +13,8 @@
 
 	MPPort *port = [[MPPort alloc] initWithPortfile:[NSString stringWithUTF8String:argv[1]] options:nil];
 	NSLog(@"%@ @%@ (%@)", [port variable:@"name"], [port variable:@"version"], [port variable:@"categories"]);
-	NSLog(@"Variants:             %@", [[port variants] componentsJoinedByString:@", "]);
-	NSLog(@"PlatformVariants:     %@", [[port platforms] componentsJoinedByString:@", "]);
+	NSLog(@"Variants:             %@", [[port definedVariants] componentsJoinedByString:@", "]);
+	NSLog(@"PlatformVariants:     %@", [[port definedPlatforms] componentsJoinedByString:@", "]);
 	NSLog(@"Brief Description:    %@", [port variable:@"description"]);
 	NSLog(@"Description:          %@", [port variable:@"long_description"]);
 	NSLog(@"Homepage:             %@", [port variable:@"homepage"]);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090325/865680c5/attachment-0001.html>


More information about the macports-changes mailing list