[MacPorts] Notification: MPFramworkGSocWk modified

MacPorts noreply at macports.org
Sun Jul 13 14:48:41 PDT 2008



Changed page "MPFramworkGSocWk" by armahg at macports.org from 139.147.156.115*
Page URL: <http://trac.macports.org/wiki/MPFramworkGSocWk>
Diff URL: <http://trac.macports.org/wiki/MPFramworkGSocWk?action=diff&version=7>
Revision 7

-------8<------8<------8<------8<------8<------8<------8<------8<--------
Index: MPFramworkGSocWk
=========================================================================
--- MPFramworkGSocWk (version: 6)
+++ MPFramworkGSocWk (version: 7)
@@ -60,8 +60,97 @@
 
 
 
+= Weeks 6 & 7 =
+So things took a somewhat different (and I think positive) turn these past
+two weeks. I added some more routines for port activation, deactivation
+and uninstallation to MPMacPorts class.
 
 
+In addition Randall suggested the following method to be used for
+evaluating strings as tcl commands instead of the original NSArray parsing
+we were doing. This meant that code that originally looked like:
+
+{{{
+-(NSURL *)pathToPortIndex:(NSString *)source {
+   return [NSURL fileURLWithPath:
+                 [interpreter evaluateArrayAsString:
+                            [NSArray arrayWithObjects:
+			       @"return [macports::getindex",
+			       source,
+			       @"]",
+			       nil]]];
+}
+}}}
+
+to code that looked like:
+
+{{{
+-(NSURL *)pathToPortIndex:(NSString *)source {
+  return [NSURL fileURLWithPath:
+	   [interpreter evaluateStringAsString:
+	[NSString stringWithFormat:@"return [macports::getindex %@ ]", source]]];
+}
+
+}}}
+
+This definitely made for much more cleaner code. In fact it led to my writing a
+generic function for evaluating a given Tcl command with an array of arguments.
+Each element in this array can be either an NSString or NSArray for flexilbility.
+Also, there's no limit to the size of the argument array. The method looks
+like:
+
+{{{
+- (void)execPortProc:(NSString *)procedure withParams:(NSArray *)params {
+	//params can contain either NSStrings or NSArrays
+	NSString * sparams = [NSString stringWithString:@" "];
+	NSEnumerator * penums = [params objectEnumerator];
+	MPInterpreter *interpreter = [MPInterpreter sharedInterpreter];
+	
+	id elem;
+	
+	while (elem = [penums nextObject]) {
+		if ([elem isMemberOfClass:[NSString class]]) {
+			sparams = [sparams stringByAppendingString:elem];
+			sparams = [sparams stringByAppendingString:@" "];
+		}
+		
+		else if ([elem isKindOfClass:[NSArray class]]) {
+			//Maybe I should be more careful in the above if statement and
+			//explicitly check for the classes i'm interested in?
+			sparams = [sparams stringByAppendingString:[elem componentsJoinedByString:@" "]];
+			sparams = [sparams stringByAppendingString:@" "];
+		}
+	}
+	
+	[interpreter evaluateStringAsString:
+	 [NSString stringWithFormat:@"[%@ %@]" , procedure, sparams]];
+}
+}}}
+thanks Randall.
+
+Second thing worth mentioning I think I have found a solution to Notifications
+in the framework. I won't give too many details but basically it involves
+having a "bridge" singleton instance class between the Tcl API and Framework.
+When a ui_$priority procedure is calls, it in turn calls a notifications procedure
+which calls a method (and this can be any method) of the "bridge"
+class. This method can be a notification, message to a Framework class, delegate
+triggering method ... the important thing is the Framework is notified of the
+change without having to do a system-wide broadcast (e.g. NSDistributedNotification
+center notification). More details after this has been refined. The 
+current code for it has been checked into svn.
+
+Finally, I'll be releasing a MidTerm Evaluation version of the Framework today.
+IT HAS NOT BEEN TESTED. The main purpose is for feedback on the current
+functionality as is being advertised by the Docmentation. The main things it
+is currently lacking are incorporation of Authorization, finished Notifications
+and thorough Testing. Any and all feedback is welcome.
+The .dmg and .zip files can be downloaded from svn by doing
+
+svn co http://svn.macosforge.org/repository/macports/users/armahg/MacPorts_Framework/MPFMidtermRelease.dmg for the dmg
+
+svn co http://svn.macosforge.org/repository/macports/users/armahg/MacPorts_Framework/MPFMidtermRelease.zip for the .zip file
+
+and svn co http://svn.macosforge.org/repository/macports/users/armahg/MacPorts_Framework/MPFMidtermRelease/ for the whole folder
 
 
 

-------8<------8<------8<------8<------8<------8<------8<------8<--------


* The IP shown here might not mean anything if the user is behind a proxy.

--
MacPorts <http://www.macports.org/>
Ports system for Mac OS

This is an automated message. Someone at http://www.macports.org/
added your email address to be notified of changes on MacPorts.
If it was not you, please report to http://www.macports.org/.


More information about the macports-changes mailing list