Skip to content
Permalink
Browse files

Made initial changes for addingNotifications

  • Loading branch information
George Armah
George Armah committed Jun 26, 2008
1 parent 98f2579 commit cfdc5ab158ef6a73786095cd62f1b48e2014d24d
@@ -129,7 +129,7 @@ - (NSArray *)arrayFromTclListAsString:(NSString *)list {
}

- (NSDictionary *)dictionaryFromTclListAsString:(NSString *)list {
return [NSDictionary dictionaryWithDictionary:[self :list]];
return [NSDictionary dictionaryWithDictionary:[self mutableDictionaryFromTclListAsString:list]];
}

- (NSMutableDictionary *)mutableDictionaryFromTclListAsString:(NSString *)list {
@@ -65,7 +65,7 @@ - (void)testGetVariableAsArray {
- (void)testMutableDictionaryFromTclListAsString {

}
- (void)testEvaluateStringAsString; {
- (void)testEvaluateStringAsString {

}

@@ -33,12 +33,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/


#import <Cocoa/Cocoa.h>
#import "MPInterpreter.h"
#import "MPPort.h"


#define MPPortsAll @".+"


/*!
@class MPMacPorts
@abstract Object representation of the MacPorts system
@@ -33,17 +33,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

/*!
@class MPPort
@abstract A representation of a port.
*/

#import <Cocoa/Cocoa.h>
#import "MPInterpreter.h"
#import "MPMutableDictionary.h"
#import "MPReceipt.h"
#import "MPRegistry.h"




#define MPPortStateUnknown 0
#define MPPortStateLearnState 1

@@ -54,9 +53,11 @@

#define MPPortWillExecuteTarget @"org.macports.framework.port.willExecuteTarget"
#define MPPortDidExecuteTarget @"org.macports.framework.port.didExecuteTarget"

/*!
@class MPPort
@abstract A representation of a port.
*/
@interface MPPort : MPMutableDictionary {

}

/*!
@@ -38,6 +38,7 @@
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 in Resources */ = {isa = PBXBuildFile; fileRef = 48E9939E0C82CEB000219DDF /* init.tcl */; };
6E270BE10E1458DE00BAE687 /* init.tcl.original in Resources */ = {isa = PBXBuildFile; fileRef = 6E270BE00E1458DE00BAE687 /* init.tcl.original */; };
6E49F37B0DFFAB0B0030C3AF /* MPInterpreterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 489DD92E0C94674B00595506 /* MPInterpreterTest.m */; };
6E49F37F0DFFAFF80030C3AF /* MacPorts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* MacPorts.framework */; };
6EA293580E05C8FC00902D12 /* notifications.m in Sources */ = {isa = PBXBuildFile; fileRef = 6EA293570E05C8FC00902D12 /* notifications.m */; };
@@ -85,6 +86,7 @@
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.original */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = init.tcl.original; sourceTree = "<group>"; };
6E88D1CA0DF4B90B00684E9F /* MPMacPortsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPMacPortsTest.h; sourceTree = "<group>"; };
6E88D1CB0DF4B90B00684E9F /* MPMacPortsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPMacPortsTest.m; sourceTree = "<group>"; };
6EA0F56E0DFEB55E00C15082 /* Tcl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Tcl.framework; path = System/Library/Frameworks/Tcl.framework; sourceTree = SDKROOT; };
@@ -157,6 +159,7 @@
089C1666FE841158C02AAC07 /* InfoPlist.strings */,
489DD8F50C94365F00595506 /* Test-Info.plist */,
6EAFD8B70DEC614E00E97270 /* dummycommit.test */,
6E270BE00E1458DE00BAE687 /* init.tcl.original */,
);
name = Resources;
sourceTree = "<group>";
@@ -334,6 +337,7 @@
files = (
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */,
48E9939F0C82CEB000219DDF /* init.tcl in Resources */,
6E270BE10E1458DE00BAE687 /* init.tcl.original in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -533,8 +537,7 @@
489DD8F80C94366000595506 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)";
ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386";
ARCHS = "$(NATIVE_ARCH)";
COPY_PHASE_STRIP = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(value)",
@@ -1,23 +1,3 @@
I have modified this file
Now I should do another commit to make sure my
modifications are ok.

George.

//NSString * initFile = [[NSBundle bundleWithIdentifier:@"org.macports.frameworks.macports"]
// pathForResource:@"init"
// ofType:@"tcl"];
NSBundle * tbun = [NSBundle bundleWithIdentifier:@"org.macports.frameworks.macports"];
if(tbun) {
NSLog(@"File found with path %@", [[NSBundle bundleForClass:[MPInterpreter class]] bundlePath]);
}
else{
NSLog(@"File not found with path %@", [[NSBundle bundleForClass:[MPInterpreter class]] bundlePath]);
}

if( Tcl_EvalFile(_interpreter, [[tbun pathForResource:@"init"
ofType:@"tcl"] UTF8String]) != TCL_OK) {
NSLog(@"Error in Tcl_EvalFile: %s", Tcl_GetStringResult(_interpreter));
Tcl_DeleteInterp(_interpreter);
}


@@ -1,7 +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} {
@@ -66,13 +72,69 @@ proc ui_channels {priority} {
}


#Modifying UI initialization to enable notifications
proc ui_init {priority prefix channels message} {
# 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.
if {[catch {mportinit ui_options global_options global_variations} result]} {
global errorInfo
puts "$errorInfo"
fatal "Failed to initialize ports system, $result"
}


}

0 comments on commit cfdc5ab

Please sign in to comment.
You can’t perform that action at this time.