Changeset 37865


Ignore:
Timestamp:
Jun 26, 2008, 11:54:01 PM (12 years ago)
Author:
armahg@…
Message:

Made initial changes for addingNotifications

Location:
branches/gsoc08-framework/MacPorts.Framework
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/gsoc08-framework/MacPorts.Framework/MPInterpreter.m

    r37746 r37865  
    130130
    131131- (NSDictionary *)dictionaryFromTclListAsString:(NSString *)list {
    132         return [NSDictionary dictionaryWithDictionary:[self  :list]];
     132        return [NSDictionary dictionaryWithDictionary:[self  mutableDictionaryFromTclListAsString:list]];
    133133}
    134134
  • branches/gsoc08-framework/MacPorts.Framework/MPInterpreterTest.m

    r37746 r37865  
    6666       
    6767}
    68 - (void)testEvaluateStringAsString; {
     68- (void)testEvaluateStringAsString {
    6969       
    7070}
  • branches/gsoc08-framework/MacPorts.Framework/MPMacPorts.h

    r37746 r37865  
    3434 */
    3535
     36
    3637#import <Cocoa/Cocoa.h>
    3738#import "MPInterpreter.h"
    3839#import "MPPort.h"
    3940
     41
    4042#define MPPortsAll      @".+"
     43
    4144
    4245/*!
  • branches/gsoc08-framework/MacPorts.Framework/MPPort.h

    r37746 r37865  
    3434 */
    3535
    36 /*!
    37  @class MPPort
    38  @abstract      A representation of a port.
    39  */
    4036
    4137#import <Cocoa/Cocoa.h>
     
    4440#import "MPReceipt.h"
    4541#import "MPRegistry.h"
     42
     43
     44
    4645
    4746#define MPPortStateUnknown              0
     
    5554#define MPPortWillExecuteTarget @"org.macports.framework.port.willExecuteTarget"
    5655#define MPPortDidExecuteTarget  @"org.macports.framework.port.didExecuteTarget"
    57 
     56/*!
     57 @class MPPort
     58 @abstract      A representation of a port.
     59 */
    5860@interface MPPort : MPMutableDictionary {
    59 
    6061}
    6162
  • branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj

    r37746 r37865  
    3939                48E993950C82CAAE00219DDF /* MPMacPorts.m in Sources */ = {isa = PBXBuildFile; fileRef = 48E993930C82CAAE00219DDF /* MPMacPorts.m */; };
    4040                48E9939F0C82CEB000219DDF /* init.tcl in Resources */ = {isa = PBXBuildFile; fileRef = 48E9939E0C82CEB000219DDF /* init.tcl */; };
     41                6E270BE10E1458DE00BAE687 /* init.tcl.original in Resources */ = {isa = PBXBuildFile; fileRef = 6E270BE00E1458DE00BAE687 /* init.tcl.original */; };
    4142                6E49F37B0DFFAB0B0030C3AF /* MPInterpreterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 489DD92E0C94674B00595506 /* MPInterpreterTest.m */; };
    4243                6E49F37F0DFFAFF80030C3AF /* MacPorts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* MacPorts.framework */; };
     
    8687                48F811BE0CE4636A009630DE /* MPRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPRegistry.h; sourceTree = "<group>"; };
    8788                48F811BF0CE4638C009630DE /* MPRegistry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPRegistry.m; sourceTree = "<group>"; };
     89                6E270BE00E1458DE00BAE687 /* init.tcl.original */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = init.tcl.original; sourceTree = "<group>"; };
    8890                6E88D1CA0DF4B90B00684E9F /* MPMacPortsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPMacPortsTest.h; sourceTree = "<group>"; };
    8991                6E88D1CB0DF4B90B00684E9F /* MPMacPortsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPMacPortsTest.m; sourceTree = "<group>"; };
     
    158160                                489DD8F50C94365F00595506 /* Test-Info.plist */,
    159161                                6EAFD8B70DEC614E00E97270 /* dummycommit.test */,
     162                                6E270BE00E1458DE00BAE687 /* init.tcl.original */,
    160163                        );
    161164                        name = Resources;
     
    335338                                8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */,
    336339                                48E9939F0C82CEB000219DDF /* init.tcl in Resources */,
     340                                6E270BE10E1458DE00BAE687 /* init.tcl.original in Resources */,
    337341                        );
    338342                        runOnlyForDeploymentPostprocessing = 0;
     
    534538                        isa = XCBuildConfiguration;
    535539                        buildSettings = {
    536                                 ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)";
    537                                 ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386";
     540                                ARCHS = "$(NATIVE_ARCH)";
    538541                                COPY_PHASE_STRIP = YES;
    539542                                FRAMEWORK_SEARCH_PATHS = (
  • branches/gsoc08-framework/MacPorts.Framework/dummycommit.test

    r37746 r37865  
    1 I have modified this file
    2 Now I should do another commit to make sure my
    3 modifications are ok.
    41
    5 George.
    62
    7 //NSString * initFile = [[NSBundle bundleWithIdentifier:@"org.macports.frameworks.macports"]
    8                 //                                         pathForResource:@"init"
    9                 //                                         ofType:@"tcl"];
    10                 NSBundle * tbun = [NSBundle bundleWithIdentifier:@"org.macports.frameworks.macports"];
    11                 if(tbun) {
    12                         NSLog(@"File found with path %@", [[NSBundle bundleForClass:[MPInterpreter class]] bundlePath]);
    13                 }
    14                 else{
    15                         NSLog(@"File not found with path %@", [[NSBundle bundleForClass:[MPInterpreter class]] bundlePath]);
    16                 }
    17                
    18                 if( Tcl_EvalFile(_interpreter, [[tbun pathForResource:@"init"
    19                                                                                                            ofType:@"tcl"] UTF8String]) != TCL_OK) {
    20                         NSLog(@"Error in Tcl_EvalFile: %s", Tcl_GetStringResult(_interpreter));
    21                         Tcl_DeleteInterp(_interpreter);
    22                 }
    23                
     3
  • branches/gsoc08-framework/MacPorts.Framework/init.tcl

    r37395 r37865  
     1#catch {source \
     2#       [file join "/Library/Tcl" macports1.0 macports_fastload.tcl]}
     3
     4#Trying my own MacPorts build rather than default one on the system
    15catch {source \
    2         [file join "/Library/Tcl" macports1.0 macports_fastload.tcl]}
    3        
     6        [file join "/Users/Armahg/macportsbuild/build1/Library/Tcl" macports1.0 macports_fastload.tcl]}
     7
     8
    49package require macports
     10package require notifications
    511
    612# ui_options accessor
     
    6773
    6874
     75#Modifying UI initialization to enable notifications
     76proc ui_init {priority prefix channels message} {
     77    # Get the list of channels.
     78    try {
     79        set channels [ui_channels $priority]
     80    } catch * {
     81        set channels [ui_channels_default $priority]
     82    }
     83
     84    # Simplify ui_$priority.
     85    set nbchans [llength $channels]
     86    if {$nbchans == 0} {
     87        proc ::ui_$priority {str} {
     88                notifications send global testMacPortstNotification "$prefix\$str"
     89                }
     90    } else {
     91        try {
     92            set prefix [ui_prefix $priority]
     93        } catch * {
     94            set prefix [ui_prefix_default $priority]
     95        }
     96           
     97                if {$nbchans == 1} {
     98                set chan [lindex $channels 0]
     99                               
     100                                #Redefine ui_$priority here to also throw notifications of some sort
     101                                proc ::ui_$priority {str} {
     102                                        #[subst { puts $chan "$prefix\$str" }]
     103                                        subst { puts $chan "$prefix\$str" }
     104
     105                                        #Send notifications using NSDistributedNotificationCenter for now
     106                                        #We need a way to name notifications based on given input, using
     107                                        #testMacPortsNotification for now
     108                                        notifications send global testMacPortstNotification "$prefix\$str"
     109                                }
     110                               
     111                               
     112            } else {
     113                       
     114                       
     115                proc ::ui_$priority {str} {
     116                                        subst {
     117                                                foreach chan \$channels {
     118                                                        puts $chan "$prefix\$str"
     119                                                }
     120                                        }
     121                                        #Should we discriminate based on channel?
     122                                        notifications send global testMacPortsNotification "$prefix\$str"
     123                                }
     124            }
     125                       
     126        # Call ui_$priority
     127        ::ui_$priority $message
     128    }
     129}
     130
     131
     132
    69133# Initialize dport
    70134# This must be done following parse of global options, as some options are
     
    75139        fatal "Failed to initialize ports system, $result"
    76140}
    77 
    78 
Note: See TracChangeset for help on using the changeset viewer.