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:
OHMM.init(double, FileOutputStream, FileInputStream)
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.
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
OHMMShell(OHMM ohmm)
Make a new OHMMShell wrapping an
OHMM instance. |
Modifier and Type | Method and Description |
---|---|
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
|
public static final java.lang.String APPNAME
Application title.
public static final java.lang.String PROMPT
Shell prompt.
public static final java.lang.String BANNER
Startup banner.
public static final java.lang.String OHMM_SHELL_API
The name of the scheme bindings for the api.
public static final java.lang.String OHMM_SHELL_EXTRA
The name of the scheme bindings for the extra stuff.
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
.
public static final java.lang.String OHMM_SHELL_SITE_PROP
See OHMM_SHELL_SITE
.
public static final java.lang.String EXTRA_USAGE
Extra command line usage.
protected OHMM ohmm
Our OHMM.
protected jscheme.JScheme js
Our JScheme interpreter.
protected static java.lang.Object interactorLock
Synchronization object if using REPL GUI.
public static boolean charReady() throws java.io.IOException
java.io.IOException
public void readEvalPrintLoop(java.lang.String prompt)
prompt
- the REPL command line promptpublic void readEvalPrintLoop()
readEvalPrintLoop(String)
with default PROMPT
public void interactorREPL(java.lang.String prompt)
Run the scheme REPL in a JScheme Interactor in its own top-level GUI JFrame.
prompt
- the REPL command line promptpublic void interactorREPL()
interactorREPL(String)
with default PROMPT
protected void initJScheme() throws java.io.IOException
Initialize JScheme.
java.io.IOException
protected void setJSGlobals()
protected void loadJSchemeFiles()
protected boolean loadJSchemeFileFromResource(java.lang.String resourceName)
Load a scheme file into js
from a resource for this class.
resourceName
- the name of the resource (i.e. the name of a scheme
file in the same package as this class)public static void main(java.lang.String[] argv) throws java.io.IOException, java.lang.InterruptedException
Command line driver, see OHMM.USAGE
.
java.io.IOException
java.lang.InterruptedException