Previous Next        Current Page: NeXtMidas User's Guide / Installation and Customization / Adding New Commands / Adding Primitives
back
FAQs   
Release Information   
Getting Help   
Basic Concepts   
Result Parameters   
XML Support   
Files   
System Operation   
Macros   
WebStart Intro   
Graphics   
X-Midas Interoperability   
Third-Party Compatibility   
Installation and Customization   
   - System Installation   
   - Using OS Environment Variables   
   - Option Tree Configuration   
   - Adding New Commands   
      - Creating a New Macro   
      - Adding Intrinsics   
      - Adding Primitives   
      - Creating Command Help   
   - Tailor the NeXtMidas Environment   
   - Compilation   
   - Compile Native Code on Windows   
Running NeXtMidas Independently   
Glossary   


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:

  1. Copy NOOP from the prim area SYS option tree to the prim area of the user option tree
  2. Rename the noop.java file in the user option tree to newprim.java
  3. Change the package name in newprim.java from package nxm.sys.prim; to package nxm.user.prim;
  4. 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.


back