NXM Help COMMANDS

From ICE Enterprises
Jump to navigation Jump to search
Go to the full list of NXM Help pages.

Installing, finding and running commands.

There are a number of types of commands which may be run from the NextMidas shell:

  1. Command Line Processing
  2. Primitives, Intrinsics, Macros
  3. User Macros
  4. Operating System Commands

Commands are CASE-INSENSITIVE and may be abbreviated depending on how they are entered in the configuration file.

CommandLine - Covers command line syntax and processing.

Command line parameters and switches are specified using a key=value syntax.
If the key= is omitted, the key is obtained from the command dictionary by
its positionally dependent (PD) index.  Only PD args are counted when
determining the PD index. Key=value or /key=value entries are ignored.
See the examples below.
Switches are normally placed directly after the command name before the
1st delimiter.  They may also appear in a parameter slot but do not affect
the PD index mapping.  Switches are specified by preceding the name with
a "/" and must be fully specified. Parameter names, if configured in the
dictionary entry, may be abbreviated.
The PLOT command, for example, has the command dictionary entry:
PLOT,P,8,FILE,SM=LINEAR,CM=MAG,LINE=SOLID,X1,X2,Y1,Y2
The command line:
PLOT/id=psdplot/tl=1k input y1=-100 /name="My Plot" y2=200 /bg
creates an arguments Table with the values:
/ID=PSDPLOT
/TL=3
/NAME=My Plot
FILE=INPUT
SM=LINEAR
CM=MAG
LINE=SOLID
X1=
X2=
Y1=-100
Y2=200
/BG=1
To access the arguments from inside a command:
filename = MA.getS("FILE");
tl = MA.getL("/TL");    or  tl = MA.getL("/TL",-1);
ymin = MA.getD("Y1");   or  ymin = MA.getD("Y1",0.0);
Note that state switches (no =value) must appear directly after the command name
or at the end of all parameters.  If a state switch appears in a parameter list,
it is treated as the "value of" that positionally dependent parameter.  This allows
a more natural syntax for branching on switches applied to a macro from within
the macro.  For instance, if the SD360 macro is run with the /CLIENT switch, a
branch within the macro can be written as:
if /CLIENT gt 0
! do this
endif
To force the shell to treat an entry starting with a / from being treated as a switch
anywhere in the parameter list, escape it with another /.  For instance, to write the
above branch without the "gt 0" so the test defaults to > 0, the /CLIENT parameter must
be escaped to prevent it from being treated as a trailing switch.
if //CLIENT
! do this
endif
For performance reasons, command lines are parsed only once when a macro is loaded.
To allow runtime command line manipulation, carets are evaluated when a parameter is
retrieved.  This helps macros execute fast while still giving some level of macro
parameter manipulation at runtime.  The down side is that multiple arguments or switches
cannot be stored in a caret'ed results parameter and parsed as one can from X-Midas.
The /args=myargs switch can be used to generate a runtime-dependent list of parameters
for a command in a macro.  The switch should point to a table in the results table
that has entries to be added to the currently parsed list.  For instance,
if /client gt 0
set myargs.x1 100
set myargs.x2 200
else
set myargs.y1 100
set myargs.y2 200
endif
plot myfile /args=myargs

Configuration - Adding and finding commands in an option tree.

Adding and finding commands in an option tree.

The following commands may be used to configure and list commands.
UPDATE - to configure a command in an option tree
MENU - to display a list of commands in an option tree

Recall - Recalling and completing commands.

Commands may be recalled by using the bang (!) symbol. For example, the command

nm> status myfile

may be rerun with a partial command (followed by a carriage return).

nM> !stat<CR>
nM> status myfile

Completion - Completing commands.

Commands may be completed by following the command name with a question mark (?). For example,

nM> status ?
followed by a carriage return gives the prompt:
FILE=

and if the user enters 'myfile' followed by a carriage return, <CR> ,the command is completed as follows.

nM> STATUS,FILE=myfile

Intrinsics - shell control and other immediate commands

Primitives - data handling and processing commands

Macros - the NeXtMidas scripting language commands

UserMacros - Creating and Running user macros.

Creating and Running user macros.

User macros (or "%" macros) are typically created as a prototype before the developer
has determined what the "signature" of the macro will be.  User macros are not required
to be "installed".  That is, they do not have to be in the command dictionary.  Any
macro in the HOMEPATH area (see the HOMEPATH command) may be run with a prefix in front
of the macro name.  For example,
nM> homepath
HomePath = /home/midas/nxm160/nextmidas/nxm/sys/mcr/
shows the home path is the MCR area of the SYS option tree.  This means the demo
command may be run in one of two ways:
nM> demo
OR
nM> %demo


OS - Executing Operating System commands

How to run Operating System commands.
OS commands may be run in one of three ways:
  1. Internally
    nM> $os_command
  2. Externally
    nM> $$os_command
  3. Externally (Configured) - <os_command> MUST BE configured in an option
    tree with O-Support
    nM> os_command

Switches - See Users's Guide -> System Operations -> Switches

See the NeXtMidas Users's Guide -> System Operations -> Switches section
for information on switches.