Release 5. Copyright ©1994-1998 by TipTop Software, Inc. All Rights Reserved.
TTInterpProtocol
| Adopted By: | TTObjPyInterp, TTObjTclInterp, TTObjPerlInterp, ... |
| Declared In: | <ObjCore/TTInterpProtocol.h> |
Protocol Description
Each language interpreter (Python, Tcl, Perl, ...) implements this protocol. The protocol specifies the most essential languge interpreter functionalities such as variable access, expression evaluation, etc.
Method Types
| Evaluation | |
| Variable access | |
| Value conversion | + interpValueClass |
| Interactor help | + isExpressionComplete: |
| Other | + getDefaultInterp |
Class Methods
getDefaultInterp
| + (id <TTInterpProtocol>)getDefaultInterp |
Returns a default interpreter object for language.
isExpressionComplete:
| + (BOOL)isExpressionComplete:(NSString*)cmd |
Returns whether expression cmd is a self-contained expression which can be evaluated in the interpreter. For example, this method checks if braces, parenthesies, etc are balanced.
See also: - isExpressionComplete:
interpValueClass
| + (Class)interpValueClass |
Returns the default value class for this language.
See also: - objectForValue:flags:, - valueForObject:flags:
Instance Methods
currentScope
Returns the current scope.
evaluate:interactor:debugger:scope:otherFlags:
| <TTInterpValueProtocol>)evaluate:(NSString *)expr interactor:(id <TTInteractorProtocol>)i debugger:(id)debugger scope:(id)scope otherFlags:(unsigned)flags |
Evaluates expression expr in scope scope.
evaluateFile:interactor:debugger:scope:otherFlags:
| <TTInterpValueProtocol>)evaluateFile:(NSString *)path interactor:(id <TTInteractorProtocol>)i debugger:(id)debugger scope:(id)scope otherFlags:(unsigned)flags |
Evaluates contents of file path in scope scope.
getValueForVariableNamed:inScope:otherFlags:
| <TTInterpValueProtocol>)getValueForVariableNamed:(NSString*)name inScope:(id)scope otherFlags:(unsigned)flags |
Returns value for variable name in scope.
See also: - setVariableNamed:inScope:toValue:otherFlags:
isDead
Returns whether the interpreter is usable or not (e.g., if the interpreter can do evaluations).
isExpressionComplete:
Returns whether expression cmd is complete or not.
See also: +isExpressionComplete:
languageName
Returns the language name.
languageVersionName
Returns the language version.
objectForValue:flags:
Converts language-specific value val to a corresponding object. This method is normally implemented as:
{
return [value objectValueInInterp:self flags:f];
}
See also: - valueForObject:flags:, -objectValueInInterp:flags: (TTInterpValueProtocol)
promptForInteractor:
Returns a prompt (reflecting the current interpreter state) that is to be used in interactor i.
setVariableNamed:inScope:toValue:otherFlags:
| inScope:(id)scope toValue:(id <TTInterpValueProtocol>)value otherFlags:(unsigned)flags |
Sets variable name in scope to value.
See also: - getValueForVariableNamed:inScope:otherFlags:
valueForObject:flags:
| <TTInterpValueProtocol>)valueForObject:(id)obj flags:(unsigned)f |
Converts object obj to a corresponding language-specific value. This method is normally implemented as:
{
id <TTInterpValueProtocol> val;
val=[[[self class] interpValueClass] alloc];
val=[val initForObject:obj inInterp:self flags:f];
[val autorelease];
return val;
}
See also: - valueForObject:flags:, -objectValueInInterp:flags: (TTInterpValueProtocol)
###