[37956] branches/gsoc08-framework/MacPorts.Framework
armahg at macports.org
armahg at macports.org
Mon Jun 30 15:08:04 PDT 2008
Revision: 37956
http://trac.macosforge.org/projects/macports/changeset/37956
Author: armahg at macports.org
Date: 2008-06-30 15:08:03 -0700 (Mon, 30 Jun 2008)
Log Message:
-----------
Modified notifications.m to return a single element dictionary contianing ui_message
Modified Paths:
--------------
branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj
branches/gsoc08-framework/MacPorts.Framework/init.tcl
branches/gsoc08-framework/MacPorts.Framework/notifications.m
Modified: branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj 2008-06-30 22:06:07 UTC (rev 37955)
+++ branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj 2008-06-30 22:08:03 UTC (rev 37956)
@@ -37,8 +37,8 @@
48E992980C82C98C00219DDF /* Tcl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48E992970C82C98C00219DDF /* Tcl.framework */; };
48E993940C82CAAE00219DDF /* MPMacPorts.h in Headers */ = {isa = PBXBuildFile; fileRef = 48E993920C82CAAE00219DDF /* MPMacPorts.h */; settings = {ATTRIBUTES = (Public, ); }; };
48E993950C82CAAE00219DDF /* MPMacPorts.m in Sources */ = {isa = PBXBuildFile; fileRef = 48E993930C82CAAE00219DDF /* MPMacPorts.m */; };
- 48E9939F0C82CEB000219DDF /* init.tcl.mod in Resources */ = {isa = PBXBuildFile; fileRef = 48E9939E0C82CEB000219DDF /* init.tcl.mod */; };
- 6E270BE10E1458DE00BAE687 /* init.tcl in Resources */ = {isa = PBXBuildFile; fileRef = 6E270BE00E1458DE00BAE687 /* init.tcl */; };
+ 48E9939F0C82CEB000219DDF /* init.tcl in Resources */ = {isa = PBXBuildFile; fileRef = 48E9939E0C82CEB000219DDF /* init.tcl */; };
+ 6E270BE10E1458DE00BAE687 /* init.tcl.original in Resources */ = {isa = PBXBuildFile; fileRef = 6E270BE00E1458DE00BAE687 /* init.tcl.original */; };
6E270D090E158CED00BAE687 /* MPNotificationsListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E270D070E158CED00BAE687 /* MPNotificationsListener.h */; settings = {ATTRIBUTES = (Public, ); }; };
6E270D0A0E158CED00BAE687 /* MPNotificationsListener.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E270D080E158CED00BAE687 /* MPNotificationsListener.m */; };
6E49F37B0DFFAB0B0030C3AF /* MPInterpreterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 489DD92E0C94674B00595506 /* MPInterpreterTest.m */; };
@@ -84,10 +84,10 @@
48E992970C82C98C00219DDF /* Tcl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Tcl.framework; path = /System/Library/Frameworks/Tcl.framework; sourceTree = "<absolute>"; };
48E993920C82CAAE00219DDF /* MPMacPorts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPMacPorts.h; sourceTree = "<group>"; };
48E993930C82CAAE00219DDF /* MPMacPorts.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPMacPorts.m; sourceTree = "<group>"; };
- 48E9939E0C82CEB000219DDF /* init.tcl.mod */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = init.tcl.mod; sourceTree = "<group>"; };
+ 48E9939E0C82CEB000219DDF /* init.tcl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = init.tcl; sourceTree = "<group>"; };
48F811BE0CE4636A009630DE /* MPRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPRegistry.h; sourceTree = "<group>"; };
48F811BF0CE4638C009630DE /* MPRegistry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPRegistry.m; sourceTree = "<group>"; };
- 6E270BE00E1458DE00BAE687 /* init.tcl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = init.tcl; sourceTree = "<group>"; };
+ 6E270BE00E1458DE00BAE687 /* init.tcl.original */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = init.tcl.original; sourceTree = "<group>"; };
6E270C080E148F4E00BAE687 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
6E270D070E158CED00BAE687 /* MPNotificationsListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPNotificationsListener.h; sourceTree = "<group>"; };
6E270D080E158CED00BAE687 /* MPNotificationsListener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPNotificationsListener.m; sourceTree = "<group>"; };
@@ -158,12 +158,12 @@
089C1665FE841158C02AAC07 /* Resources */ = {
isa = PBXGroup;
children = (
- 48E9939E0C82CEB000219DDF /* init.tcl.mod */,
+ 48E9939E0C82CEB000219DDF /* init.tcl */,
8DC2EF5A0486A6940098B216 /* Info.plist */,
089C1666FE841158C02AAC07 /* InfoPlist.strings */,
489DD8F50C94365F00595506 /* Test-Info.plist */,
6EAFD8B70DEC614E00E97270 /* dummycommit.test */,
- 6E270BE00E1458DE00BAE687 /* init.tcl */,
+ 6E270BE00E1458DE00BAE687 /* init.tcl.original */,
);
name = Resources;
sourceTree = "<group>";
@@ -345,8 +345,8 @@
buildActionMask = 2147483647;
files = (
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */,
- 48E9939F0C82CEB000219DDF /* init.tcl.mod in Resources */,
- 6E270BE10E1458DE00BAE687 /* init.tcl in Resources */,
+ 48E9939F0C82CEB000219DDF /* init.tcl in Resources */,
+ 6E270BE10E1458DE00BAE687 /* init.tcl.original in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: branches/gsoc08-framework/MacPorts.Framework/init.tcl
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/init.tcl 2008-06-30 22:06:07 UTC (rev 37955)
+++ branches/gsoc08-framework/MacPorts.Framework/init.tcl 2008-06-30 22:08:03 UTC (rev 37956)
@@ -1,8 +1,13 @@
+#catch {source \
+# [file join "/Library/Tcl" macports1.0 macports_fastload.tcl]}
+
+#Trying my own MacPorts build rather than default one on the system
catch {source \
- [file join "/Library/Tcl" macports1.0 macports_fastload.tcl]}
+ [file join "/Users/Armahg/macportsbuild/build1/Library/Tcl" macports1.0 macports_fastload.tcl]}
package require macports
+package require notifications
# ui_options accessor
proc ui_isset {val} {
@@ -67,6 +72,67 @@
}
+#Modifying UI initialization to enable notifications
+proc ui_init {priority prefix channels message} {
+
+ notifications send global testMacPortsNotification "INSIDE UI_INIT"
+
+ # Get the list of channels.
+ try {
+ set channels [ui_channels $priority]
+ } catch * {
+ set channels [ui_channels_default $priority]
+ }
+
+ # Simplify ui_$priority.
+ set nbchans [llength $channels]
+ if {$nbchans == 0} {
+ proc ::ui_$priority {str} {
+ notifications send global testMacPortstNotification "$prefix\$str"
+ }
+ } else {
+ try {
+ set prefix [ui_prefix $priority]
+ } catch * {
+ set prefix [ui_prefix_default $priority]
+ }
+
+ if {$nbchans == 1} {
+ set chan [lindex $channels 0]
+
+ #Redefine ui_$priority here to also throw notifications of some sort
+ proc ::ui_$priority {str} {
+ #[subst { puts $chan "$prefix\$str" }]
+ subst { puts $chan "$prefix\$str" }
+
+ #Send notifications using NSDistributedNotificationCenter for now
+ #We need a way to name notifications based on given input, using
+ #testMacPortsNotification for now
+ notifications send global testMacPortstNotification "$prefix\$str"
+ }
+
+
+ } else {
+
+
+ proc ::ui_$priority {str} {
+ subst {
+ foreach chan \$channels {
+ puts $chan "$prefix\$str"
+ }
+ }
+ #Should we discriminate based on channel?
+ notifications send global testMacPortsNotification "$prefix\$str"
+ }
+ }
+
+ # Call ui_$priority
+ ::ui_$priority $message
+ }
+}
+
+
+
# Initialize dport
# This must be done following parse of global options, as some options are
# evaluated by dportinit.
@@ -74,6 +140,4 @@
global errorInfo
puts "$errorInfo"
fatal "Failed to initialize ports system, $result"
-}
-
-
+}
\ No newline at end of file
Modified: branches/gsoc08-framework/MacPorts.Framework/notifications.m
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/notifications.m 2008-06-30 22:06:07 UTC (rev 37955)
+++ branches/gsoc08-framework/MacPorts.Framework/notifications.m 2008-06-30 22:08:03 UTC (rev 37956)
@@ -39,6 +39,13 @@
#include <Cocoa/Cocoa.h>
int Notifications_Send(int objc, Tcl_Obj *CONST objv[], int global, Tcl_Interp *interpreter) {
+ /*/Debugging code starts here
+ NSLog(@"Inside Notifications_Send!");
+ if(*objv) {
+ NSLog(@"size of STUFF is %d", objc);
+ }
+ //Debugging code ends here*/
+
NSString *name = nil;
NSMutableDictionary *info = nil;
@@ -47,10 +54,51 @@
int i;
const char **tclElements;
+
+ /*/Debugging code starts here
+ if(*objv) {
+ NSLog(@"*objv pointer for name is NOT NULL");
+ }
+ //Debugging code ends here*/
+
name = [NSString stringWithUTF8String:Tcl_GetString(*objv)];
++objv; --objc;
+
+ /*/Debugging code starts here
+ if(*objv) {
+ NSLog(@"*objv pointer for Tcl_SplitList is NOT NULL, name is %@", name);
+ }
+ //Debugging code ends here*/
+
tclResult = Tcl_SplitList(interpreter, Tcl_GetString(*objv), &tclCount, &tclElements);
if (tclResult == TCL_OK) {
+
+ /*/Debugging code starts here
+ if(*objv) {
+ NSLog(@"size of Dictionary is %d", tclCount);
+ }
+ for(i = 0; tclElements[i] != NULL; i++) {
+ NSLog(@"Element in Dictionary is %@", [NSString stringWithUTF8String:tclElements[i]]);
+ }
+ for(i = 0; i < tclCount; i++) {
+ NSLog(@"Element in Dictionary is %@", [NSString stringWithUTF8String:tclElements[i]]);
+ }
+ //Debugging code ends here*/
+
+
+ //For now we return a single element dictionary containing the ui_* log message
+ info = [NSMutableDictionary dictionaryWithCapacity:1];
+ [info setObject:[NSString stringWithString:@"ui_msg"] forKey:[NSString stringWithUTF8String:Tcl_GetString(*objv)]];
+
+ if (global != 0) {
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:name object:nil userInfo:info];
+ } else {
+ [[NSNotificationCenter defaultCenter] postNotificationName:name object:nil userInfo:info];
+ }
+
+
+
+ /*
info = [NSMutableDictionary dictionaryWithCapacity:(tclCount / 2)];
for (i = 0; i < tclCount; i +=2) {
[info setObject:[NSString stringWithUTF8String:tclElements[i + 1]] forKey:[NSString stringWithUTF8String:tclElements[i]]];
@@ -59,7 +107,7 @@
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:name object:nil userInfo:info];
} else {
[[NSNotificationCenter defaultCenter] postNotificationName:name object:nil userInfo:info];
- }
+ }*/
} else {
return TCL_ERROR;
}
@@ -68,6 +116,9 @@
}
int Notifications_Command(ClientData clientData, Tcl_Interp *interpreter, int objc, Tcl_Obj *CONST objv[]) {
+ //Debugging code starts here
+ //NSLog(@"Inside Notifications_Command!");
+ //Debugging code ends here
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSString *action = nil;
@@ -79,6 +130,13 @@
action = [NSString stringWithUTF8String:Tcl_GetString(*objv)];
++objv, --objc;
if ([action isEqualToString:@"send"]) {
+
+ /*/Debugging code starts here
+ //if(*objv) {
+ NSLog(@"*objv pointer in Notifications_Command is NOT NULL");
+ }
+ //Debugging code ends here*/
+
if ([[NSString stringWithUTF8String:Tcl_GetString(*objv)] isEqualToString:@"global"]) {
++objv, --objc;
returnCode = Notifications_Send(objc, objv, 1, interpreter);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080630/bd5eef29/attachment-0001.html
More information about the macports-changes
mailing list