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 evaluate:interactor:debugger:scope:otherFlags:
evaluateFile:interactor:debugger:scope:otherFlags:
Variable access getValueForVariableNamed:inScope:otherFlags:
setVariableNamed:inScope:toValue:otherFlags:
Value conversion + interpValueClass
objectForValue:flags:
valueForObject:flags:
Interactor help + isExpressionComplete:
isExpressionComplete:
promptForInteractor:
Other currentScope
+ getDefaultInterp
isDead
languageName
languageVersionName




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
  (id)currentScope

Returns the current scope.




evaluate:interactor:debugger:scope:otherFlags:
  (id <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:
  (id <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:
  (id <TTInterpValueProtocol>)getValueForVariableNamed:(NSString*)name
inScope:(id)scope
otherFlags:(unsigned)flags

Returns value for variable name in scope.

See also:  - setVariableNamed:inScope:toValue:otherFlags:




isDead
  (BOOL)isDead

Returns whether the interpreter is usable or not (e.g., if the interpreter can do evaluations).




isExpressionComplete:
  (BOOL)isExpressionComplete:(NSString*)cmd

Returns whether expression cmd is complete or not.

See also:  +isExpressionComplete:




languageName
  (NSString *)languageName

Returns the language name.




languageVersionName
  (NSString *)languageVersionName

Returns the language version.




objectForValue:flags:
  (id)objectForValue:(id <TTInterpValueProtocol>)val flags:(unsigned)f

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:
  (NSString*)promptForInteractor:(id <TTInteractorProtocol>)i

Returns a prompt (reflecting the current interpreter state) that is to be used in interactor i.




setVariableNamed:inScope:toValue:otherFlags:
  (void)setVariableNamed:(NSString*)name
inScope:(id)scope
toValue:(id <TTInterpValueProtocol>)value
otherFlags:(unsigned)flags

Sets variable name in scope to value.

See also:  - getValueForVariableNamed:inScope:otherFlags:




valueForObject:flags:
  (id <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)




###