ohmm
Class OHMMShell

java.lang.Object
  extended by ohmm.OHMMShell

public class OHMMShell
extends java.lang.Object

OHMM JScheme command shell.

This is a JScheme interpreter for debug and exercise of the OHMM high level processor library. The main(java.lang.String[]) method can be invoked in the usual Java way. In addition, OHMMShell is specified as the main-class of OHMM.jar.

Communications are established according to command-line parameters:

The scheme symbol ohmm is bound to the OHMM instance. ohmm-shell-api.scm and ohmm-shell-extra.scm are loaded to define the scheme-level API and conveniences. A site-specific scheme file is also loaded iff present, see OHMM_SHELL_SITE.

The optional command line parameter -repl-gui causes the JScheme read-eval-print loop to run in a GUI window. Otherwise it runs on the command line.

Communication errors including timeouts are internally detected, and the ErrorHandler, if any, is notified.

Author:
Marsette Vona

Field Summary
static java.lang.String APPNAME
          Application title.
static java.lang.String BANNER
          Startup banner.
static java.lang.String EXTRA_USAGE
          Extra command line usage.
protected static java.lang.Object interactorLock
          Synchronization object if using REPL GUI.
protected  jscheme.JScheme js
          Our JScheme interpreter.
protected  OHMM ohmm
          Our OHMM.
static java.lang.String OHMM_SHELL_API
          The name of the scheme bindings for the api.
static java.lang.String OHMM_SHELL_EXTRA
          The name of the scheme bindings for the extra stuff.
static java.lang.String OHMM_SHELL_SITE
          Default name of scheme bindings for any site-local stuff.
static java.lang.String OHMM_SHELL_SITE_PROP
          See OHMM_SHELL_SITE.
static java.lang.String PROMPT
          Shell prompt.
 
Constructor Summary
OHMMShell(OHMM ohmm)
          Make a new OHMMShell wrapping an OHMM instance.
 
Method Summary
static boolean charReady()
          jscheme does not implement char-ready?
protected  void initJScheme()
          Initialize JScheme.
 void interactorREPL()
          interactorREPL(String) with default PROMPT
 void interactorREPL(java.lang.String prompt)
          Run the scheme REPL in a JScheme Interactor in its own top-level GUI JFrame.
protected  boolean loadJSchemeFileFromResource(java.lang.String resourceName)
          Load a scheme file into js from a resource for this class.
protected  void loadJSchemeFiles()
          load initial JScheme values
static void main(java.lang.String[] argv)
          Command line driver, see OHMM.USAGE.
 void readEvalPrintLoop()
          readEvalPrintLoop(String) with default PROMPT
 void readEvalPrintLoop(java.lang.String prompt)
          Run the scheme REPL.
protected  void setJSGlobals()
          bind global JScheme values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APPNAME

public static final java.lang.String APPNAME

Application title.

See Also:
Constant Field Values

PROMPT

public static final java.lang.String PROMPT

Shell prompt.

See Also:
Constant Field Values

BANNER

public static final java.lang.String BANNER

Startup banner.

See Also:
Constant Field Values

OHMM_SHELL_API

public static final java.lang.String OHMM_SHELL_API

The name of the scheme bindings for the api.

See Also:
Constant Field Values

OHMM_SHELL_EXTRA

public static final java.lang.String OHMM_SHELL_EXTRA

The name of the scheme bindings for the extra stuff.

See Also:
Constant Field Values

OHMM_SHELL_SITE

public static final java.lang.String OHMM_SHELL_SITE

Default name of scheme bindings for any site-local stuff.

May be overriden by the java property OHMM_SHELL_SITE_PROP.

See Also:
Constant Field Values

OHMM_SHELL_SITE_PROP

public static final java.lang.String OHMM_SHELL_SITE_PROP

See OHMM_SHELL_SITE.

See Also:
Constant Field Values

EXTRA_USAGE

public static final java.lang.String EXTRA_USAGE

Extra command line usage.

See Also:
Constant Field Values

ohmm

protected OHMM ohmm

Our OHMM.


js

protected jscheme.JScheme js

Our JScheme interpreter.


interactorLock

protected static java.lang.Object interactorLock

Synchronization object if using REPL GUI.

Constructor Detail

OHMMShell

public OHMMShell(OHMM ohmm)
          throws java.io.IOException
Make a new OHMMShell wrapping an OHMM instance.

Throws:
java.io.IOException
Method Detail

charReady

public static boolean charReady()
                         throws java.io.IOException
jscheme does not implement char-ready?

Throws:
java.io.IOException

readEvalPrintLoop

public void readEvalPrintLoop(java.lang.String prompt)
Run the scheme REPL. This call will block until the REPL is (exit)ed.

Parameters:
prompt - the REPL command line prompt

readEvalPrintLoop

public void readEvalPrintLoop()
readEvalPrintLoop(String) with default PROMPT


interactorREPL

public void interactorREPL(java.lang.String prompt)

Run the scheme REPL in a JScheme Interactor in its own top-level GUI JFrame.

Parameters:
prompt - the REPL command line prompt

interactorREPL

public void interactorREPL()
interactorREPL(String) with default PROMPT


initJScheme

protected void initJScheme()
                    throws java.io.IOException

Initialize JScheme.

Throws:
java.io.IOException

setJSGlobals

protected void setJSGlobals()
bind global JScheme values


loadJSchemeFiles

protected void loadJSchemeFiles()
load initial JScheme values


loadJSchemeFileFromResource

protected boolean loadJSchemeFileFromResource(java.lang.String resourceName)

Load a scheme file into js from a resource for this class.

Parameters:
resourceName - the name of the resource (i.e. the name of a scheme file in the same package as this class)
Returns:
true iff the file was loaded

main

public static void main(java.lang.String[] argv)
                 throws java.io.IOException,
                        java.lang.InterruptedException

Command line driver, see OHMM.USAGE.

Throws:
java.io.IOException
java.lang.InterruptedException