Toolboxes
A toolbox is an optional add-on: a folder of .m files and, optionally, a compiled
library. Nexus finds installed toolboxes by itself when it starts. Nothing in Nexus lists a
toolbox, so removing the folder removes the toolbox, and anyone can ship one.
Where Nexus looks
In this order (a toolbox name found in an earlier folder wins):
- the folders in the environment variable
NEXUS_TOOLBOX_PATH(separated likePATH) ~/.local/share/nexus/toolboxes<prefix>/share/nexus/toolboxes
Every sub-folder that contains an m folder, an nxo folder or a file
nexus_toolbox_init.m is a toolbox.
Layout
my-toolbox/
nexus_toolbox_init.m run once at start-up (optional)
m/ .m files; every folder below it goes on the path
(@class, +package and private folders work as usual)
nxo/ compiled .nxo files (optional)
toolbox.conf name, version, title (used by the build tooling)
Toolbox folders are appended to the path, so a toolbox can add functions but cannot replace
a Nexus function of the same name. To prefer a toolbox function in your own session, use
addpath (..., '-begin').
Start-up script and extension points
nexus_toolbox_init.m runs before any startup.m. It can register
compiled functions (autoload) and handlers for the extension points Nexus offers:
nexus_toolbox_hook ('register', 'table_coerce', @my_coerce);
A product call nexus_toolbox_hook ('point', x, ...) returns x
unchanged when no toolbox handles point; with handlers it passes the value through
them in the order they were registered. Points: worker_bootstrap (stages of a
parallel worker's start-up), pool_started, table_coerce,
mat_save_normalize, shims_paths, shims_reset.
Compiled part
Build with nexus-mex against the installed Nexus; put the result in
nxo/. A compiled toolbox may also install interpreter hooks (function dispatch,
class method and property dispatch, loop handling, JIT policy) from C++ through the
nexus-extensions.h header.
Language dialect
Write toolbox .m files in MATLAB syntax by default. Only mark a file
%#dialect: octave when it needs Octave-only surface syntax. Do not paste GNU
Octave GPL sources into toolboxes. Full note:
Octave dialect — note for toolbox authors.
Turning toolboxes off
Start Nexus with NEXUS_NO_TOOLBOXES=1 to run with none (useful to check that a
problem is not caused by a toolbox).