org.erights.e.elang.interp
Interface CmdLoop

All Superinterfaces:
ControlLoop

public interface CmdLoop
extends ControlLoop

Untamed:


Method Summary
 void gc()
          Enabled: First clears temporary state (such as results), then does a System.gc()
 ConstList getArgs()
          Enabled: A list of Strings that's assumed to be the command line args
 boolean getExpand()
          Enabled: Should an input expression be echoed as expanded to Kernel-E as well as evaluated?
 boolean getInteractive()
          Enabled: Is this a read-eval-print loop for an interactive command line?
 Object getPrintFunc()
          Enabled: A function of a value and a TextWriter that prints the value by writing onto the TextWriter.
 ConstMap getProps()
          Enabled: A map from String (property names) to Strings (property values) that's assumed to reflect System.getProperties() and the eprops.txt file.
 Object getResult(int i)
          Enabled:
 boolean getShowEStack()
          Enabled:
 boolean getShowJStack()
          Enabled: Should problem reports show their Java stack trace as well as their E stack trace?
 boolean getShowTransformed()
          Enabled:
 Scope getTopScope()
          Enabled: What scope are top-level expressions evaluated in?
 void pushResult(Object result)
          Enabled:
 void setExpand(boolean flag)
          Enabled:
 void setPrintFunc(Object newPF)
          Enabled:
 void setShowEStack(boolean flag)
          Enabled:
 void setShowJStack(boolean flag)
          Enabled:
 void setShowTransformed(boolean flag)
          Enabled:
 void setTopScope(Scope newScope)
          Enabled:
 
Methods inherited from interface org.erights.e.elang.interp.ControlLoop
blockAtTop, continueAtTop, exitAtTop, exitAtTop, getFinalExitStatusVow, getNextExitStatus, waitAtTop
 

Method Detail

getArgs

public ConstList getArgs()
Enabled: A list of Strings that's assumed to be the command line args


getProps

public ConstMap getProps()
Enabled: A map from String (property names) to Strings (property values) that's assumed to reflect System.getProperties() and the eprops.txt file.


getExpand

public boolean getExpand()
Enabled: Should an input expression be echoed as expanded to Kernel-E as well as evaluated?

If so, the expanded form will be shown in a "# expand: ..." block


getShowTransformed

public boolean getShowTransformed()
Enabled:


getShowJStack

public boolean getShowJStack()
Enabled: Should problem reports show their Java stack trace as well as their E stack trace?

This switch only makes sense while we're interpreting parse trees, rather than compiling E to jvm byte codes. While we're interpreting, the Java stack trace tends to large and uninformative. Once we're compiling, the Java stack trace should be all there is, and should do both jobs well. So, at that time, this flag will be ignored.


getShowEStack

public boolean getShowEStack()
Enabled:


getPrintFunc

public Object getPrintFunc()
Enabled: A function of a value and a TextWriter that prints the value by writing onto the TextWriter.

The default printFunc is:

    def printFunc(value, out :TextWriter) :void {
         out.quote(value)
     }

Note that the printFunc itself may throw an execption. It is up to the caller of the printFunc to protect itself from this possibility.

XXX We should define an interface to represent the result type.


getInteractive

public boolean getInteractive()
Enabled: Is this a read-eval-print loop for an interactive command line?

If so, then the top scope should be mutable, each outcome should be reported, prompts should be generated, and evaluation should continue after errors.

"interactive" is an immutable property, since it's too hard to change.


setExpand

public void setExpand(boolean flag)
Enabled:


setShowTransformed

public void setShowTransformed(boolean flag)
Enabled:


setShowJStack

public void setShowJStack(boolean flag)
Enabled:


setShowEStack

public void setShowEStack(boolean flag)
Enabled:


setPrintFunc

public void setPrintFunc(Object newPF)
Enabled:

Parameters:
newPF -

getTopScope

public Scope getTopScope()
Enabled: What scope are top-level expressions evaluated in?


setTopScope

public void setTopScope(Scope newScope)
Enabled:


getResult

public Object getResult(int i)
Enabled:


pushResult

public void pushResult(Object result)
Enabled:


gc

public void gc()
Enabled: First clears temporary state (such as results), then does a System.gc()



comments?