This section provides an overview of the following basic operational issues in Direct Mode:
Entering Direct Mode
Available functionality
Exiting Direct Mode
To enter Direct Mode, type $gtm_dist/mumps -direct at the shell prompt.
$ $gtm_dist/mumps -direct GTM>
This shows using $gtm_dist/mumps -direct at the prompt to enter Direct Mode.
To create a gtm alias in your shell startup file (in the example below the startup file is assumed to be a .profile file):
Open an edition session for your .profile file by typing:
$vi .profile
Add a function to the file to define your gtm alias:
gtm(){ $gtm_dist/mumps -direct}
Save the file.
Now, when you want to enter Direct Mode for an editing or debugging session, simply type gtm at the shell prompt.
Example:
$ gtm GTM>
This shows that the gtm alias typed at the shell prompt also takes you to the Direct Mode.
This section provides an overview of basic functionality and concepts that enhance your use of Direct Mode.
Direct Mode includes a line command recall function to display previously entered command lines. Use <CTRL-B> or the Up Arrow key at the GTM> prompt to scroll back through command lines. Use the Down Arrow key to scroll forward through the command lines. GT.M displays one command line at a time.You may delete and reenter characters starting at the end of a recalled line.
The RECALL command is another way to access previously entered Direct Mode command lines. RECALL is only valid in Direct Mode and causes an error if it appears in other M code.
The format of the RECALL command is:
REC[ALL] [intlit|strlit]
The optional integer literal specifies a previously entered command by the counting back from the present.
The optional string literal specifies the most recently entered command line that starts with characters matching the (case-sensitive) literal.
When the RECALL command has no argument, it displays up to a maximum of 99 available past Direct Mode entries.
If the Direct Mode session has just started, you may not have entered 99 lines for GT.M to save and therefore you will not have 99 lines to look at. The most recently entered GT.M command line has the number one (1), older lines have higher numbers. GT.M does not include the RECALL command in the listing. If the RECALL command is issued from a location other than the Direct Mode prompt, GT.M issues a run-time error.
Example:
GTM>write $zgbldir /usr/lib/fis-gtm/V5.4-002B_x86/mumps.gld GTM>set $zgbldir="test.gld" GTM>set a=10 GTM>set b=a GTM>recall 1 set b=a 2 set a=10 3 set $zgbldir="test.gld" 4 write $zgbldir GTM>
This REC[ALL] command displays the previously entered commands.
You can also display a selected command by entering RECALL and the line number of the command you want to retrieve.
Example:
GTM>recall 2 GTM>set a=10
This RECALLs the line number two (2).
If the RE[CALL] command includes a text parameter, GT.M displays the most recent command matching the text after the RE[CALL] command.
Example:
GTM>recall write GTM>write $zgbldir
This RECALLs "WRITE", the command most recently beginning with this text. Note that the RECALL command text is case sensitive. The RECALL command with a text argument treats WRITE and write differently, that is, it treats them case sensitively. If you first type the WRITE command in lower-case and then type WRITE in upper-case to recall it, the RECALL command does not find a match.
GT.M permits the use of the GT.M command line editor at the Direct Mode prompt and during M READs from a terminal. The GT.M line editor allows cursor positioning using the <CTRL> key, edit keypad and function keys.
The GT.M Direct Mode line editing keys are as follows:
Backspace: Deletes the character to the left of the cursor
Delete: Deletes the character under the cursor
Up-arrow: Moves to a less recent item in the RECALL list
Down-arrow: Moves to a more recent item in the RECALL list
Left-arrow: Moves the cursor one character to the left
Right-arrow: Moves the cursor one character to the right
<CTRL-A>: Moves the cursor to the beginning of the line
<CTRL-B>: Moves the cursor one character towards the beginning of the line
<CTRL-D>: On an empty line, terminates GT.M and returns control to the shell.
<CTRL-E>: Moves the cursor to the end of the line
<CTRL-F>: Moves the cursor one character towards the end of the line
<CTRL-K>: Deletes all characters from the cursor to the end of the line
<CTRL-U>: Deletes the entire line
Note | |
---|---|
When entering commands at the direct mode prompt, the insert mode can be toggled for that line by using the insert key. When GT.M starts, insert mode is enabled unless the value of the gtm_principal_editing environment variable includes the string NOINSERT. If insert mode is disabled or enabled for the $PRINCIPAL device by an USE statement before returning to direct mode, it will remain disabled or enabled at direct mode. The insert mode can be toggled within a direct mode line using the terminal's INSERT key. |
Important | |
---|---|
GT.M deletes the character under the cursor when you press the key on the keyboard that sends the escape sequence which maps to the kdch1 capability in your current terminfo entry (by convention, the Delete key). If the current terminfo entry is missing the kdch1 capability, GT.M uses a default value derived from members of the DEC VT terminal family, as it does for selected other missing terminfo capabilities. If you wish the Backspace and Delete keys to behave the same, the simplest way is to configure your terminal emulator to send the same character sequences for the Delete key that it does for the Backspace key. You can alternatively modify your terminfo setting: for example, create an editable version of your terminfo entry in a temporary file with a command such as: export TERMINFO=$HOME/.terminfo # You may need to add this to your login profile profilemkdir -p $TERMINFO tic /tmp/$$_$TERM # or whatever your temporary file name was When modifying terminfo capabilities, always look for unintended changes in the behavior of other applications, for example, text editors, that also rely on those capabilities. In the worst case, you may need to toggle between alternate terminfo entries for GT.M and other applications while you evaluate different options. Also, for terminfo entries without the cud1 capability, GT.M uses a linefeed when moving to the next line in direct mode. |
The ANSI M Standard describes certain M operations in terms of how a stack-based virtual machine would operate. A stack is a repository for tracking temporary information on a "last-in/first-out" (LIFO) basis. M program behavior can be understood using a stack-based model. However, the standard is not explicit in defining how an implementation must maintain a stack or even whether it must use one at all.
The stack model provides a trail of routines currently in progress that shows the location of all the M operations that performed the invocations leading to the current point.
The ZSHOW command makes this stack information available within GT.M. For more information, see “Using the Invocation Stack in Debugging” in this chapter, and the command description at “ZSHow”.
Five M commands can terminate a Direct Mode session:
HALT
ZHALT
ZCONTINUE
GOTO
ZGOTO
The HALT command exits Direct Mode and terminates the M process.
The ZHALT command exits Direct Mode and returns the exit status to the calling environment.
The ZCONTINUE command instructs GT.M to exit Direct Mode and resume routine execution at the current point in the M invocation stack. This may be the point where GT.M interrupted execution and entered Direct Mode. However, when the Direct Mode interaction includes a QUIT command, it modifies the invocation stack and causes ZCONTINUE to resume execution at another point.
The GOTO and ZGOTO commands instruct GT.M to leave Direct Mode, and transfer control to a specified entry reference.