[38446] branches/gsoc08-framework/MacPorts_Framework
armahg at macports.org
armahg at macports.org
Sun Jul 20 22:42:16 PDT 2008
Revision: 38446
http://trac.macosforge.org/projects/macports/changeset/38446
Author: armahg at macports.org
Date: 2008-07-20 22:42:15 -0700 (Sun, 20 Jul 2008)
Log Message:
-----------
Added methods to MPInterpreter and MPMacPorts to move load of macports_fastload.tcl from init.tcl to interpreter initialization code. This also enables Framework users to specify their own path for file loading
Modified Paths:
--------------
branches/gsoc08-framework/MacPorts_Framework/MPInterpreter.h
branches/gsoc08-framework/MacPorts_Framework/MPInterpreter.m
branches/gsoc08-framework/MacPorts_Framework/MPMacPorts.h
branches/gsoc08-framework/MacPorts_Framework/MPMacPorts.m
branches/gsoc08-framework/MacPorts_Framework/MacPorts.Framework.xcodeproj/Armahg.mode1v3
branches/gsoc08-framework/MacPorts_Framework/MacPorts.Framework.xcodeproj/project.pbxproj
branches/gsoc08-framework/MacPorts_Framework/init.tcl
Modified: branches/gsoc08-framework/MacPorts_Framework/MPInterpreter.h
===================================================================
--- branches/gsoc08-framework/MacPorts_Framework/MPInterpreter.h 2008-07-20 21:23:26 UTC (rev 38445)
+++ branches/gsoc08-framework/MacPorts_Framework/MPInterpreter.h 2008-07-21 05:42:15 UTC (rev 38446)
@@ -65,6 +65,8 @@
*/
+ (MPInterpreter *)sharedInterpreter;
++ (MPInterpreter *)sharedInterpreterWithPkgPath:(NSString *)path;
+- (id) initWithTclPkgPath:(NSString *)path;
#pragma Port Operations
Modified: branches/gsoc08-framework/MacPorts_Framework/MPInterpreter.m
===================================================================
--- branches/gsoc08-framework/MacPorts_Framework/MPInterpreter.m 2008-07-20 21:23:26 UTC (rev 38445)
+++ branches/gsoc08-framework/MacPorts_Framework/MPInterpreter.m 2008-07-21 05:42:15 UTC (rev 38446)
@@ -151,13 +151,44 @@
Tcl_DeleteInterp(_interpreter);
}
- /*
- //TO DO ...
- //Use client provided .tcl file if any
-
- //Finally load our own init.tcl file
- */
+ Tcl_CreateObjCommand(_interpreter, "notifications", Notifications_Command, NULL, NULL);
+ if (Tcl_PkgProvide(_interpreter, "notifications", "1.0") != TCL_OK) {
+ NSLog(@"Error in Tcl_PkgProvide: %s", Tcl_GetStringResult(_interpreter));
+ Tcl_DeleteInterp(_interpreter);
+ }
+ if( Tcl_EvalFile(_interpreter, [[[NSBundle bundleWithIdentifier:@"org.macports.frameworks.macports"] pathForResource:@"init" ofType:@"tcl"] UTF8String]) != TCL_OK) {
+ NSLog(@"Error in Tcl_EvalFile: %s", Tcl_GetStringResult(_interpreter));
+ Tcl_DeleteInterp(_interpreter);
+ }
+
+ }
+ return self;
+}
+
+
+- (id) initWithTclPkgPath:(NSString *) path {
+ if (self = [super init]) {
+ _interpreter = Tcl_CreateInterp();
+ if(_interpreter == NULL) {
+ NSLog(@"Error in Tcl_CreateInterp, aborting.");
+ }
+ if(Tcl_Init(_interpreter) == TCL_ERROR) {
+ NSLog(@"Error in Tcl_Init: %s", Tcl_GetStringResult(_interpreter));
+ Tcl_DeleteInterp(_interpreter);
+ }
+
+ NSString * tclPkgPath = [[@"[file join "
+ stringByAppendingString:path]
+ stringByAppendingString:@" macports1.0 macports_fastload.tcl]"];
+
+ NSLog(@"tclPkgPath is %@", tclPkgPath);
+
+ if(Tcl_EvalFile(_interpreter, [tclPkgPath UTF8String]) != TCL_ERROR) {
+ NSLog(@"Error in Tcl_EvalFile: %s", Tcl_GetStringResult(_interpreter));
+ Tcl_DeleteInterp(_interpreter);
+ }
+
Tcl_CreateObjCommand(_interpreter, "notifications", Notifications_Command, NULL, NULL);
if (Tcl_PkgProvide(_interpreter, "notifications", "1.0") != TCL_OK) {
@@ -171,17 +202,30 @@
}
return self;
+
}
+
++ (MPInterpreter*)sharedInterpreterWithPkgPath:(NSString *)path {
+ @synchronized(self) {
+ if ([[[NSThread currentThread] threadDictionary] objectForKey:@"sharedMPInterpreter"] == nil) {
+ [[self alloc] initWithTclPkgPath:path ]; // assignment not done here
+ }
+ }
+ return [[[NSThread currentThread] threadDictionary] objectForKey:@"sharedMPInterpreter"];
+}
+
+
+ (MPInterpreter*)sharedInterpreter {
@synchronized(self) {
if ([[[NSThread currentThread] threadDictionary] objectForKey:@"sharedMPInterpreter"] == nil) {
- [[self alloc] init]; // assignment not done here
+ [[self alloc] initWithTclPkgPath:@"\"/Users/Armahg/macportsbuild/build1/Library/Tcl\"" ]; // assignment not done here
}
}
return [[[NSThread currentThread] threadDictionary] objectForKey:@"sharedMPInterpreter"];
}
+
+ (id)allocWithZone:(NSZone*)zone {
@synchronized(self) {
if ([[[NSThread currentThread] threadDictionary] objectForKey:@"sharedMPInterpreter"] == nil) {
Modified: branches/gsoc08-framework/MacPorts_Framework/MPMacPorts.h
===================================================================
--- branches/gsoc08-framework/MacPorts_Framework/MPMacPorts.h 2008-07-20 21:23:26 UTC (rev 38445)
+++ branches/gsoc08-framework/MacPorts_Framework/MPMacPorts.h 2008-07-21 05:42:15 UTC (rev 38446)
@@ -69,6 +69,10 @@
*/
+ (MPMacPorts *)sharedInstance;
++ (MPMacPorts *)sharedInstanceWithPkgPath:(NSString *)path;
+- (id) initWithTclPkgPath:(NSString *)path;
+
+
/*!
@brief Synchronizes the ports tree without checking for upgrades to the MacPorts base.
*/
Modified: branches/gsoc08-framework/MacPorts_Framework/MPMacPorts.m
===================================================================
--- branches/gsoc08-framework/MacPorts_Framework/MPMacPorts.m 2008-07-20 21:23:26 UTC (rev 38445)
+++ branches/gsoc08-framework/MacPorts_Framework/MPMacPorts.m 2008-07-21 05:42:15 UTC (rev 38446)
@@ -46,10 +46,28 @@
return self;
}
+- (id) initWithTclPkgPath:(NSString *)path {
+ if (self = [super init]) {
+ interpreter = [MPInterpreter sharedInterpreterWithPkgPath:path];
+ [self registerForLocalNotifications];
+ }
+ return self;
+}
+
+
++ (MPMacPorts *)sharedInstanceWithPkgPath:(NSString *)path {
+ @synchronized(self) {
+ if ([[[NSThread currentThread] threadDictionary] objectForKey:@"sharedMPMacPorts"] == nil) {
+ [[self alloc] initWithTclPkgPath:path]; // assignment not done here
+ }
+ }
+ return [[[NSThread currentThread] threadDictionary] objectForKey:@"sharedMPMacPorts"];
+}
+
+ (MPMacPorts *)sharedInstance {
@synchronized(self) {
if ([[[NSThread currentThread] threadDictionary] objectForKey:@"sharedMPMacPorts"] == nil) {
- [[self alloc] init]; // assignment not done here
+ [[self alloc] initWithTclPkgPath:@"\"/Users/Armahg/macportsbuild/build1/Library/Tcl\""]; // assignment not done here
}
}
return [[[NSThread currentThread] threadDictionary] objectForKey:@"sharedMPMacPorts"];
Modified: branches/gsoc08-framework/MacPorts_Framework/MacPorts.Framework.xcodeproj/Armahg.mode1v3
===================================================================
--- branches/gsoc08-framework/MacPorts_Framework/MacPorts.Framework.xcodeproj/Armahg.mode1v3 2008-07-20 21:23:26 UTC (rev 38445)
+++ branches/gsoc08-framework/MacPorts_Framework/MacPorts.Framework.xcodeproj/Armahg.mode1v3 2008-07-21 05:42:15 UTC (rev 38446)
@@ -282,13 +282,13 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
- <integer>29</integer>
- <integer>28</integer>
+ <integer>13</integer>
+ <integer>9</integer>
<integer>0</integer>
</array>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
- <string>{{0, 403}, {231, 456}}</string>
+ <string>{{0, 2}, {231, 456}}</string>
</dict>
<key>PBXTopSmartGroupGIDs</key>
<array/>
@@ -325,7 +325,7 @@
<key>PBXProjectModuleGUID</key>
<string>1CE0B20306471E060097A5F4</string>
<key>PBXProjectModuleLabel</key>
- <string>init.tcl</string>
+ <string>MPInterpreter.m</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
@@ -333,11 +333,11 @@
<key>PBXProjectModuleGUID</key>
<string>1CE0B20406471E060097A5F4</string>
<key>PBXProjectModuleLabel</key>
- <string>init.tcl</string>
+ <string>MPInterpreter.m</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>6E7DBFF30E32A82D0056CCBD</string>
+ <string>6E6F87420E345863003A2032</string>
<key>history</key>
<array>
<string>6E1AE7F20E22E34900F6D7BC</string>
@@ -345,14 +345,10 @@
<string>6EF2DB550E290E2C00D896EC</string>
<string>6EEB11E70E2A945400BFEC81</string>
<string>6EEB13780E2C336000BFEC81</string>
- <string>6EEB14300E2CAF3600BFEC81</string>
- <string>6EEB14340E2CAF3600BFEC81</string>
<string>6E449FF70E2DAC0D007DE8EC</string>
<string>6E44A01A0E2DB6C0007DE8EC</string>
<string>6E44A0920E2F3842007DE8EC</string>
- <string>6E49B3CF0E30857700CF6B97</string>
<string>6E49B42F0E30EEF900CF6B97</string>
- <string>6EE7EC520E31382400D3ABC9</string>
<string>6E7DBEC40E3246530056CCBD</string>
<string>6E7DBEF80E3278C70056CCBD</string>
<string>6E7DBF7E0E329FA00056CCBD</string>
@@ -360,22 +356,22 @@
<string>6E7DBFB70E32A5890056CCBD</string>
<string>6E7DBFB80E32A5890056CCBD</string>
<string>6E7DBFB90E32A5890056CCBD</string>
- <string>6E7DBFBA0E32A5890056CCBD</string>
- <string>6E7DBFBB0E32A5890056CCBD</string>
- <string>6E7DBFBC0E32A5890056CCBD</string>
- <string>6E7DBFBD0E32A5890056CCBD</string>
<string>6E7DBFBE0E32A5890056CCBD</string>
<string>6E7DBFBF0E32A5890056CCBD</string>
<string>6E7DBFC00E32A5890056CCBD</string>
<string>6E7DBFDE0E32A6170056CCBD</string>
<string>6E7DBFE40E32A6240056CCBD</string>
- <string>6E7DBFE60E32A6240056CCBD</string>
+ <string>6E6F87150E345528003A2032</string>
+ <string>6E6F87310E34567C003A2032</string>
+ <string>6E6F87330E34567C003A2032</string>
+ <string>6E6F87390E3457CE003A2032</string>
+ <string>6E6F873A0E3457CE003A2032</string>
+ <string>6E6F873B0E3457CE003A2032</string>
</array>
<key>prevStack</key>
<array>
<string>6E1AE7F40E22E34900F6D7BC</string>
<string>6E1AE7F50E22E34900F6D7BC</string>
- <string>6E1AE8130E23198900F6D7BC</string>
<string>6E1AE8260E231A6A00F6D7BC</string>
<string>6EF770480E250CFA00E0115E</string>
<string>6EF770490E250CFA00E0115E</string>
@@ -398,11 +394,25 @@
<string>6EF2DC790E294C7C00D896EC</string>
<string>6EF2DC890E294CE900D896EC</string>
<string>6EEB11EC0E2A945400BFEC81</string>
- <string>6EEB12C90E2BF43E00BFEC81</string>
- <string>6EEB130A0E2BFA7900BFEC81</string>
<string>6EEB132A0E2C021C00BFEC81</string>
<string>6E44A01E0E2DB6C0007DE8EC</string>
<string>6E7DBF2D0E32897B0056CCBD</string>
+ <string>6E6F87190E345528003A2032</string>
+ <string>6E6F871A0E345528003A2032</string>
+ <string>6E6F871B0E345528003A2032</string>
+ <string>6E6F871C0E345528003A2032</string>
+ <string>6E6F871D0E345528003A2032</string>
+ <string>6E6F871E0E345528003A2032</string>
+ <string>6E6F871F0E345528003A2032</string>
+ <string>6E6F87200E345528003A2032</string>
+ <string>6E6F872B0E34554D003A2032</string>
+ <string>6E6F87340E34567C003A2032</string>
+ <string>6E6F87350E34567C003A2032</string>
+ <string>6E6F87360E34567C003A2032</string>
+ <string>6E6F87370E34567C003A2032</string>
+ <string>6E6F873C0E3457CE003A2032</string>
+ <string>6E6F873D0E3457CE003A2032</string>
+ <string>6E6F873E0E3457CE003A2032</string>
</array>
</dict>
<key>SplitCount</key>
@@ -460,9 +470,9 @@
</array>
<key>TableOfContents</key>
<array>
- <string>6E7DBFF00E32A63C0056CCBD</string>
+ <string>6E6F87220E345528003A2032</string>
<string>1CE0B1FE06471DED0097A5F4</string>
- <string>6E7DBFF10E32A63C0056CCBD</string>
+ <string>6E6F87230E345528003A2032</string>
<string>1CE0B20306471E060097A5F4</string>
<string>1CE0B20506471E060097A5F4</string>
</array>
@@ -621,21 +631,21 @@
<key>PBXProjectModuleGUID</key>
<string>1CD0528F0623707200166675</string>
<key>PBXProjectModuleLabel</key>
- <string></string>
+ <string>RunPlatformUnitTests.include</string>
<key>StatusBarVisibility</key>
<true/>
</dict>
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {933, 131}}</string>
+ <string>{{0, 0}, {1195, 42}}</string>
<key>RubberWindowFrame</key>
- <string>0 -48 933 559 0 0 1152 778 </string>
+ <string>83 90 1195 470 0 0 1152 778 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>131pt</string>
+ <string>42pt</string>
</dict>
<dict>
<key>BecomeActive</key>
@@ -643,7 +653,7 @@
<key>ContentConfiguration</key>
<dict>
<key>PBXBuildLogShowsTranscriptDefaultKey</key>
- <string>{{0, 214}, {933, 168}}</string>
+ <string>{{0, 173}, {1195, 209}}</string>
<key>PBXProjectModuleGUID</key>
<string>XCMainBuildResultsModuleGUID</string>
<key>PBXProjectModuleLabel</key>
@@ -656,9 +666,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 136}, {933, 382}}</string>
+ <string>{{0, 47}, {1195, 382}}</string>
<key>RubberWindowFrame</key>
- <string>0 -48 933 559 0 0 1152 778 </string>
+ <string>83 90 1195 470 0 0 1152 778 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -667,7 +677,7 @@
</dict>
</array>
<key>Proportion</key>
- <string>518pt</string>
+ <string>429pt</string>
</dict>
</array>
<key>Name</key>
@@ -681,14 +691,14 @@
<key>TableOfContents</key>
<array>
<string>6E1AE7FA0E22E34900F6D7BC</string>
- <string>6E7DBFF20E32A63C0056CCBD</string>
+ <string>6E6F87270E345528003A2032</string>
<string>1CD0528F0623707200166675</string>
<string>XCMainBuildResultsModuleGUID</string>
</array>
<key>ToolbarConfiguration</key>
<string>xcode.toolbar.config.buildV3</string>
<key>WindowString</key>
- <string>0 -48 933 559 0 0 1152 778 </string>
+ <string>83 90 1195 470 0 0 1152 778 </string>
<key>WindowToolGUID</key>
<string>6E1AE7FA0E22E34900F6D7BC</string>
<key>WindowToolIsVisible</key>
Modified: branches/gsoc08-framework/MacPorts_Framework/MacPorts.Framework.xcodeproj/project.pbxproj
===================================================================
--- branches/gsoc08-framework/MacPorts_Framework/MacPorts.Framework.xcodeproj/project.pbxproj 2008-07-20 21:23:26 UTC (rev 38445)
+++ branches/gsoc08-framework/MacPorts_Framework/MacPorts.Framework.xcodeproj/project.pbxproj 2008-07-21 05:42:15 UTC (rev 38446)
@@ -44,7 +44,6 @@
6E49F37B0DFFAB0B0030C3AF /* MPInterpreterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 489DD92E0C94674B00595506 /* MPInterpreterTest.m */; };
6E49F37F0DFFAFF80030C3AF /* MacPorts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* MacPorts.framework */; };
6EA294590E080DEB00902D12 /* MPMacPortsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E88D1CB0DF4B90B00684E9F /* MPMacPortsTest.m */; };
- 6EEB13000E2BFA3000BFEC81 /* notifications.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EEB12FF0E2BFA3000BFEC81 /* notifications.h */; };
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; };
/* End PBXBuildFile section */
@@ -88,16 +87,13 @@
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>"; };
- 6E270C080E148F4E00BAE687 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
6E270D070E158CED00BAE687 /* MPNotifications.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPNotifications.h; sourceTree = "<group>"; };
6E270D080E158CED00BAE687 /* MPNotifications.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPNotifications.m; sourceTree = "<group>"; };
6E44A00C0E2DAD66007DE8EC /* ToDo.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ToDo.txt; 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; };
- 6EA293570E05C8FC00902D12 /* notifications.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = notifications.m; sourceTree = "<group>"; };
6EAFD8B70DEC614E00E97270 /* dummycommit.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dummycommit.test; sourceTree = "<group>"; };
- 6EEB12FF0E2BFA3000BFEC81 /* notifications.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = notifications.h; sourceTree = "<group>"; };
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* MacPorts.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MacPorts.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
@@ -241,11 +237,8 @@
6EA293540E05C8C600902D12 /* Tcl Notifications */ = {
isa = PBXGroup;
children = (
- 6E270C080E148F4E00BAE687 /* Makefile */,
- 6EA293570E05C8FC00902D12 /* notifications.m */,
6E270D070E158CED00BAE687 /* MPNotifications.h */,
6E270D080E158CED00BAE687 /* MPNotifications.m */,
- 6EEB12FF0E2BFA3000BFEC81 /* notifications.h */,
);
name = "Tcl Notifications ";
sourceTree = "<group>";
@@ -266,7 +259,6 @@
48A866AA0CD364F700B521BC /* MPReceipt.h in Headers */,
481D04A20CDAAAFD00D4A550 /* MPMutableDictionary.h in Headers */,
6E270D090E158CED00BAE687 /* MPNotifications.h in Headers */,
- 6EEB13000E2BFA3000BFEC81 /* notifications.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: branches/gsoc08-framework/MacPorts_Framework/init.tcl
===================================================================
--- branches/gsoc08-framework/MacPorts_Framework/init.tcl 2008-07-20 21:23:26 UTC (rev 38445)
+++ branches/gsoc08-framework/MacPorts_Framework/init.tcl 2008-07-21 05:42:15 UTC (rev 38446)
@@ -2,8 +2,8 @@
# [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 "/Users/Armahg/macportsbuild/build1/Library/Tcl" macports1.0 macports_fastload.tcl]}
+#catch {source \
+# [file join "/Users/Armahg/macportsbuild/build1/Library/Tcl" macports1.0 macports_fastload.tcl]}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080720/15640709/attachment-0001.html
More information about the macports-changes
mailing list