[28906] users/rhwood/MacPorts.Framework

source_changes at macosforge.org source_changes at macosforge.org
Tue Sep 11 03:00:40 PDT 2007


Revision: 28906
          http://trac.macosforge.org/projects/macports/changeset/28906
Author:   rhwood at macports.org
Date:     2007-09-11 03:00:39 -0700 (Tue, 11 Sep 2007)

Log Message:
-----------
New method: - [MPInterpreter (NSString *)evaluateAsString:(NSString *)statement] which evaluates an NSString as a Tcl statement and returns the result string.

Modified Paths:
--------------
    users/rhwood/MacPorts.Framework/MPInterpreter.h
    users/rhwood/MacPorts.Framework/MPInterpreter.m

Modified: users/rhwood/MacPorts.Framework/MPInterpreter.h
===================================================================
--- users/rhwood/MacPorts.Framework/MPInterpreter.h	2007-09-11 08:48:02 UTC (rev 28905)
+++ users/rhwood/MacPorts.Framework/MPInterpreter.h	2007-09-11 10:00:39 UTC (rev 28906)
@@ -27,6 +27,8 @@
 
 - (void)dumpConfiguration;
 
+- (NSString *)evaluateAsString:(NSString *)statement;
+
 - (NSArray *)getVariableAsArray:(NSString *)variable;
 - (NSString *)getVariableAsString:(NSString *)variable;
 

Modified: users/rhwood/MacPorts.Framework/MPInterpreter.m
===================================================================
--- users/rhwood/MacPorts.Framework/MPInterpreter.m	2007-09-11 08:48:02 UTC (rev 28905)
+++ users/rhwood/MacPorts.Framework/MPInterpreter.m	2007-09-11 10:00:39 UTC (rev 28906)
@@ -90,6 +90,11 @@
 	NSLog([NSString stringWithUTF8String:Tcl_GetStringResult(_interpreter)]);
 }
 
+- (NSString *)evaluateAsString:(NSString *)statement {
+	Tcl_Eval(_interpreter, [statement UTF8String]);
+	return [NSString stringWithUTF8String:Tcl_GetStringResult(_interpreter)];
+}
+
 - (NSArray *)getVariableAsArray:(NSString *)variable {
 	NSMutableArray *array;
 	int tclCount;
@@ -113,5 +118,4 @@
 	return [NSString stringWithUTF8String:Tcl_GetVar(_interpreter, [variable UTF8String], 0)];
 }
 
-
 @end

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070911/b1f19e43/attachment.html


More information about the macports-changes mailing list