Next: The libonyx library
Up: Contents
Previous: Onyx Language Reference
  Contents
  Index
Subsections
onyx is a stand-alone Onyx interpreter, with an integrated command
line editor. The Onyx language is documented in a separate
chapter, so this chapter documents only the differences from
the main Onyx language documentation.
onyx -h
onyx -V
onyx -e <expr>
onyx <file> [<args>]
- -e <expr>:
- Execute <expr> as Onyx code.
- -h:
- Display usage information and exit.
- -V:
- Display the version number and exit.
- ONYX_EDITOR:
- By default, the command line editor uses emacs key
bindings. Use this variable to explicitly set the key bindings to either
``emacs'' or ``vi''.
- ONYX_MPATH:
- A colon-separated list of additional paths that are
searched by mrequire (documented in
Section 2.3).
- ONYX_RPATH:
- A colon-separated list of additional paths that are
searched by require (documented in
Section 2.3).
Language differences
If onyx is being run interactively:
- The name ``stop'' is redefined in the initial thread's errordict to
recursively execute the stdin file in a stopped context in order to keep the
interpreter from exiting on error. It is possible (though generally unlikely,
since the user must type a very long line of code) for buffering of stdin to
cause strange things to occur; any additional program execution after an error
is a result of this.
- The name ``resume'' is defined in the initial thread's threaddict as an
alias to the stop operator. Thus, when an error occurs, when the user is ready
to continue running after addressing any issues the error caused, resume can be
called as a more intuitive name for resuming.
- The name ``promptstring'' is defined in systemdict; it takes no arguments
and returns a string. The return string is used as the interactive prompt.
If onyx is being run non-interactively:
- The name ``stop'' in errordict is redefined to call the die operator
with an argument of 1.
In addition, the following definitions exist regardless of execution mode:
-
- path symbol modload -:
-
- Input(s):
-
- path:
- A string that represents a module filename.
- symbol:
- A string that represents the symbol name of a
module initialization function to be executed.
- Output(s):
- None.
- Errors(s):
-
- invalidfileaccess.
-
- stackunderflow.
-
- typecheck.
-
- undefined.
-
- Description:
- Dynamically load a module, create a hook object that
encapsulates the handle returned by dlopen(3) (hook data
pointer) and the module initialization function (hook
evaluation function), and evaluate the hook.
- Example(s):
onyx:0> `/usr/local/share/canonware/onyx/nxmod/gtk.nxm' `_cw_modgtk_init'
onyx:2> modload
onyx:0>
- module symbol mrequire -:
-
- Input(s):
-
- module:
- A string that represents a module filename. The
module is searched for in the directories listed in
the ONYX_MPATH environment variable.
- symbol:
- A string that represents the symbol name of a
module initialization function to be executed.
- Output(s):
- None.
- Errors(s):
-
- invalidfileaccess.
-
- stackunderflow.
-
- typecheck.
-
- undefined.
-
- undefinedfilename.
-
- Description:
- Load a module using the ONYX_MPATH environment variable.
- Example(s):
onyx:0> `gtk.nxm' `_cw_modgtk_init' mrequire
onyx:0>
- file require -:
-
- Input(s):
-
- file:
- A string that represents an Onyx source filename. The
file is searched for in the directories listed in
the ONYX_RPATH environment variable.
- Output(s):
- None.
- Errors(s):
-
- stackunderflow.
-
- typecheck.
-
- undefinedfilename.
-
- Description:
- Execute an Onyx source file using the ONYX_RPATH
environment variable.
- Example(s):
onyx:0> `ls.nx' require flush
1001 1001 512 994886434000000000 .
1001 1001 512 994848629000000000 ..
1001 1001 512 994884381000000000 CVS
1001 1001 512 994884387000000000 bin
1001 1001 66 981033481000000000 .cvsignore
1001 1001 300 992069954000000000 COPYING
1001 1001 435 994831422000000000 ChangeLog
1001 1001 5084 994839465000000000 Cookfile.in
1001 1001 3633 993470163000000000 INSTALL
1001 1001 501 991968935000000000 README
1001 1001 3778 993470163000000000 aclocal.m4
1001 1001 26702 949579579000000000 config.guess
1001 1001 19814 949579579000000000 config.sub
1001 1001 101712 994840482000000000 configure
1001 1001 7812 994840477000000000 configure.in
1001 1001 5585 949579579000000000 install-sh
1001 1001 512 994845044000000000 doc
1001 1001 512 994754556000000000 lib
1001 1001 512 994830956000000000 mod
1001 1001 512 994884962000000000 test
1001 1001 3271 994884963000000000 config.log
1001 1001 3448 994884961000000000 config.cache
1001 1001 16934 994884961000000000 config.status
1001 1001 64838 994884988000000000 Cookfile.list
1001 1001 5985 994884961000000000 Cookfile
onyx:0>
Next: The libonyx library
Up: Contents
Previous: Onyx Language Reference
  Contents
  Index
Jason Evans
2001-08-21