Adding New Primitives
Because of Java package and file conventions, keep these two rules in mind
when adding new primitives:
- Package names in the file MUST correspond to the option tree name
(but in lower case).
- Class names in the file are case-sensitive and MUST match the file name
(without the extension)
Additionally, these are the NeXtMidas rules for primitives:
- They are kept in the prim area.
- Primitive file names are all lower case.
There are two way to add new primitives:
- Copy a similar existing primitive from one option tree to
another.
- Enter the entire primitive by hand.
The first method is the easiest way to add a new primitive.
For instance, to write a primitive that takes in one input file
or pipe, and outputs one file or pipe, consider starting with the NOOP command.
Assume an option tree called user is on the path and a
primitive called newprim is desired:
- Copy
NOOP from the prim area SYS option
tree to the prim area of the user option tree
- Rename the
noop.java file in the user option tree
to newprim.java
- Change the package name in
newprim.java from
package nxm.sys.prim; to package nxm.user.prim;
- Change the class name (after public class ) from
noop to newprim
To override a command (keep the same name but in a different option tree),
use the CHECKOUT command.
|