-evaluateArrayAsString:
Returns the NSstring result of evaluating a Tcl expression
-evaluateStringAsString:
Returns the NSString result of evaluating a Tcl expression
-arrayFromTclListAsString:
Returns an NSArray whose elements are the the elements of a Tcl list in the form of an NSString
-dictionaryFromTclListAsString:
Returns an NSDictionary whose elements are the the elements of a Tcl list in the form of an NSString
-mutableDictionaryFromTclListAsString:
Same as dictionaryFromTclListAsString method. Returns an NSMutableDictionary
-getVariableAsArray:
Returns an NSArray whose elements are the contents of a Tcl variable
-getVariableAsString:
Returns an NSString representation of a Tcl variable

evaluateArrayAsString:


Returns the NSstring result of evaluating a Tcl expression

- (NSString *)evaluateArrayAsString:(NSArray *)statement; 
Parameters
statement
An NSArray containing the Tcl expression
Discussion

For example, here is the header definition of a MacPorts Tcl API call proc macports::getindex {source}. This is how to call this procedure in Tcl: [macports::getindex $source]. Calling the macports::getindex procedure from Objective-C code with -evaluateArrayAsString however takes the following form:

[SomeMPInterpreterObject evaluateArrayAsString:[NSArray arrayWithObjects: @"return [macports::getindex", [NSString stringWithString:@"SomeValidMacPortsSourcePath"], @"]", nil]];

Each element in the array is an NSString. Note the "return" in the first element of the statement NSArray.


evaluateStringAsString:


Returns the NSString result of evaluating a Tcl expression

- (NSString *)evaluateStringAsString:(NSString *)statement; 
Parameters
statement
An NSString containing the Tcl expression
Discussion

Using the macports::getindex {source} procedure as an example (see discussion for -evaluateArrayAsString), we have the following Objective-C form for calling the macports::getindex procedure:

[SomeMPInterpreterObject evaluateStringAsString: [NSString stringWithString:@"return [macports::getindex SomeValidMacPortsSourcePath]"]];


arrayFromTclListAsString:


Returns an NSArray whose elements are the the elements of a Tcl list in the form of an NSString

- (NSArray *)arrayFromTclListAsString:(NSString *)list; 
Parameters
list
A Tcl list in the form of an NSString
Discussion

This method usually takes the result of a call to the evaluateStringAsString and evaluateArrayAsString methods which is a Tcl list and parses it into an NSArray.


dictionaryFromTclListAsString:


Returns an NSDictionary whose elements are the the elements of a Tcl list in the form of an NSString

- (NSDictionary *)dictionaryFromTclListAsString:(NSString *)list; 
Parameters
list
A Tcl list in the form of an NSString
Discussion

The returned NSDictionary is of the form {k1, v1, k2, v2, ...} with ki being the keys and vi the values in the dictionary. These keys and values are obtained from an NSString Tcl list of the form {k1 v1 k2 v2 ...}


mutableDictionaryFromTclListAsString:


Same as dictionaryFromTclListAsString method. Returns an NSMutableDictionary

- (NSMutableDictionary *)
        mutableDictionaryFromTclListAsString:(NSString *)list; 
Discussion

rather than NSDictionary.


getVariableAsArray:


Returns an NSArray whose elements are the contents of a Tcl variable

- (NSArray *)getVariableAsArray:(NSString *)variable; 
Parameters
variable
An NSString representation of a Tcl variable


getVariableAsString:


Returns an NSString representation of a Tcl variable

- (NSString *)getVariableAsString:(NSString *)variable; 
Parameters
variable
An NSString representtion of a Tcl variable

Last Updated: Sunday, July 13, 2008