[54343] users/toby/objcports

toby at macports.org toby at macports.org
Sat Jul 25 01:17:59 PDT 2009


Revision: 54343
          http://trac.macports.org/changeset/54343
Author:   toby at macports.org
Date:     2009-07-25 01:17:58 -0700 (Sat, 25 Jul 2009)
Log Message:
-----------
config

Modified Paths:
--------------
    users/toby/objcports/objcports.xcodeproj/project.pbxproj
    users/toby/objcports/port.m

Added Paths:
-----------
    users/toby/objcports/MPConfig.h
    users/toby/objcports/MPConfig.m

Added: users/toby/objcports/MPConfig.h
===================================================================
--- users/toby/objcports/MPConfig.h	                        (rev 0)
+++ users/toby/objcports/MPConfig.h	2009-07-25 08:17:58 UTC (rev 54343)
@@ -0,0 +1,8 @@
+ at interface MPConfig : NSObject
+{
+	NSMutableDictionary *_config;
+}
+
++ (MPConfig *)sharedConfig;
+
+ at end

Added: users/toby/objcports/MPConfig.m
===================================================================
--- users/toby/objcports/MPConfig.m	                        (rev 0)
+++ users/toby/objcports/MPConfig.m	2009-07-25 08:17:58 UTC (rev 54343)
@@ -0,0 +1,70 @@
+#include <Foundation/Foundation.h>
+#include <tcl.h>
+
+#include "MPConfig.h"
+
+static MPConfig *sharedConfigInstance = nil;
+
+ at interface MPConfig (priv)
+- (NSString *)macportsConfPath;
+ at end
+
+ at implementation MPConfig
+
++ (MPConfig *)sharedConfig
+{
+	@synchronized (self) {
+		if (sharedConfigInstance == nil) {
+			[[self alloc] init];
+		}
+	}
+
+	return sharedConfigInstance;
+}
+
++ (id)allocWithZone:(NSZone *)zone
+{
+	@synchronized (self) {
+		if (sharedConfigInstance == nil) {
+			sharedConfigInstance = [super allocWithZone:zone];
+			return sharedConfigInstance;
+		}
+	}
+	return nil;
+}
+
+- (id)init
+{
+	NSMutableArray *configFiles;
+
+	self = [super init];
+
+	configFiles = [NSMutableArray arrayWithObject:[[self macportsConfPath] stringByAppendingPathComponent:@"macports.conf"]];
+	for (NSString *f in configFiles) {
+		NSLog(@"%@", f);
+	}
+
+	return self;
+}
+
+- (NSString *)macportsConfPath
+{
+	Tcl_Interp *interp;
+	int rc;
+	const char *path;
+	NSString *result = nil;
+
+	interp = Tcl_CreateInterp(); 
+	rc = Tcl_EvalFile(interp, "/Library/Tcl/macports1.0/macports_autoconf.tcl");
+	if (rc == 0) {
+		path = Tcl_GetVar(interp, "macports::autoconf::macports_conf_path", 0);
+		if (path) {
+			result = [NSString stringWithUTF8String:path];
+		}
+	}
+	Tcl_DeleteInterp(interp);
+
+	return result;
+}
+
+ at end

Modified: users/toby/objcports/objcports.xcodeproj/project.pbxproj
===================================================================
--- users/toby/objcports/objcports.xcodeproj/project.pbxproj	2009-07-25 07:53:03 UTC (rev 54342)
+++ users/toby/objcports/objcports.xcodeproj/project.pbxproj	2009-07-25 08:17:58 UTC (rev 54343)
@@ -8,6 +8,7 @@
 
 /* Begin PBXBuildFile section */
 		8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; };
+		DA13887B101AED7000F73A82 /* MPConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = DA13887A101AED7000F73A82 /* MPConfig.m */; };
 		DA96BED00F7C9C2500362779 /* MPIndex.m in Sources */ = {isa = PBXBuildFile; fileRef = DA96BECF0F7C9C2500362779 /* MPIndex.m */; };
 		DA96BF4C0F7CA1A700362779 /* MPDictionaryAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DA96BF4B0F7CA1A700362779 /* MPDictionaryAdditions.m */; };
 		DAD371710F0280EF0064AFF4 /* port.m in Sources */ = {isa = PBXBuildFile; fileRef = DAD371680F0280EF0064AFF4 /* port.m */; };
@@ -32,6 +33,8 @@
 /* Begin PBXFileReference section */
 		08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
 		8DD76FA10486AA7600D96B5E /* port */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = port; sourceTree = BUILT_PRODUCTS_DIR; };
+		DA138879101AED7000F73A82 /* MPConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPConfig.h; sourceTree = "<group>"; };
+		DA13887A101AED7000F73A82 /* MPConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPConfig.m; sourceTree = "<group>"; };
 		DA96BECE0F7C9C2500362779 /* MPIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPIndex.h; sourceTree = "<group>"; };
 		DA96BECF0F7C9C2500362779 /* MPIndex.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPIndex.m; sourceTree = "<group>"; };
 		DA96BF4A0F7CA1A700362779 /* MPDictionaryAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPDictionaryAdditions.h; sourceTree = "<group>"; };
@@ -86,6 +89,8 @@
 				DAD3716F0F0280EF0064AFF4 /* MPStringAdditions.h */,
 				DAD371700F0280EF0064AFF4 /* MPStringAdditions.m */,
 				FD1CD53B1018F5AD0071534F /* variables.plist */,
+				DA138879101AED7000F73A82 /* MPConfig.h */,
+				DA13887A101AED7000F73A82 /* MPConfig.m */,
 			);
 			name = Source;
 			sourceTree = "<group>";
@@ -163,6 +168,7 @@
 				DA96BED00F7C9C2500362779 /* MPIndex.m in Sources */,
 				DAD371740F0280EF0064AFF4 /* MPPort.m in Sources */,
 				DA96BF4C0F7CA1A700362779 /* MPDictionaryAdditions.m in Sources */,
+				DA13887B101AED7000F73A82 /* MPConfig.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: users/toby/objcports/port.m
===================================================================
--- users/toby/objcports/port.m	2009-07-25 07:53:03 UTC (rev 54342)
+++ users/toby/objcports/port.m	2009-07-25 08:17:58 UTC (rev 54343)
@@ -3,6 +3,7 @@
 
 #include "MPIndex.h"
 #include "MPPort.h"
+#include "MPConfig.h"
 
 int
 main(int argc, char *argv[])
@@ -12,6 +13,8 @@
 	if (argc < 2)
 		exit(1);
 
+	NSLog(@"%@", [MPConfig sharedConfig]);
+	
 #if 0
 	NSString *filename = [[NSString alloc] initWithUTF8String:argv[1]];
 	MPIndex *index = [[MPIndex alloc] initWithPortindex:filename];
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090725/c50b90c4/attachment.html>


More information about the macports-changes mailing list