FESI language extensions - Basic I/O
Author: Jean-MarcLugrin
Description: Describe the FESI EcmaScript interpreter extensions for basic I/O capabilities
Keywords: EcmaScript, JavaScript, JScript, Java, extension

| Free EcmaScript Interpreter. A JavaScript interpreter written in Java.

Language extensions - BasicIO, BasicIOw and BasicIOs

### BasicIO, BasicIOw and BasicIOs

One of the `BasicIO`, `BasicIOw` and `BasicIOs` extension always loaded by the interactive interpreter program (but not if the interpreter is started by a user program, in which case it may be loaded if so desired). These extensions provide support for basic output (to the standard output), basic error message display, user prompt, file loading and program exit. The only difference is that the `BasicIOw` and `BasicIOs` use windows for the `alert`, `prompt` and `confirm` functions, while `BasicIO` just use the console. `BasicIOw` is for use with `AWT` based programs, and `BasicIOs` is for use with Swing based programs. Using the wrong version is likely to cause various disasters, as `AWT` and Swing to not fit together very well! When using the interactive interperter, `BasicIOw` is loaded via the `-w` option, and `BasicIOs` via the `-s` option.

The following global objects and routines are defined by `BasicIO` and `BasicIOw`:

`alert (message)`
  Write an `[[alert]]` message on the error stream.
`confirm`
  Ask the user for a confirmation.
`exit(status)`
  Exit with the specified status (uses `System.exit()`, so the program is terminated!).
`load (moduleName)`
  Locate the module in the directories and jar/zip files of the property FESI.path or (if the property is not defined) in the classpath (possibly adding the extension ".es", ".esw' or ".js"). Load the module and evaluate its content at run-time.
`prompt (query, [default])`
  Prompt the user for information, proposing the default string.
`write(...)`
  Write the parameters to the current output stream.
`writeln(...)`
  Write the parameters to the current output stream, followed by a new line.
`document`
  An object for compatibility with JavaScript when expanding html files.
`document.close()`
  Dummy routine for compatibility with JavaScript when expanding html files.
`document.open()`
  Dummy routine for compatibility with JavaScript when expanding html files.
`document.URL`
  Current file being processed (if defined by the interpreter).
`document.write(...)`
  Same as `write`.
`document.writeln(...)`
  Same as `writeln`.
`window.alert (message)`
  Same as `alert`.
`window.confirm`
  Same as `confirm`.
`window.prompt (query [default])`
  Same as `prompt`.

The `document` and `window` objects are only used to ease writing scripts which can be tested in a browser as well as with `FESI`. They do not have any "window" or "document" functionality.

Return to the main page

Last update: 12 July 1998