!return, !abort - Exit macro
!return [n]
!abort
The !return directive causes the current macro to exit with a TRUE status, either returning to the caller (if any) or to interactive mode. If an argument n is specified then the return status is determined by the value of n.
!abort has the same effect as !return only returning a FALSE status, this halts the execution of any calling macros. !abort is generally used in conjunction with !bell(4) to sound an audio alarm if the user has performed an invalid action.
The following example checks the monitor type. If the monitor is monochrome then the message is displayed. If the monitor type is not mono no message is displayed.
; Check the monitor type and set %mtyp !if ¬ &seq $TERM "MONO" set-variable %mtyp 1 !return !else set-variable %mtyp 2 !endif ml-write "You are on a MONOCHROME machine (if you are color blind)"
The following example is shows the logic of the !return directive:-
; !return example define-macro i-will-return ml-write "you will see me" !return ml-write "you wont see me" !emacro define-macro test-return ml-write "you will see me" i-will-return ml-write "you will see me" !emacro
Similarly, for the !abort directive
; !abort example define-macro i-will-abort ml-write "you will see me" !abort ml-write "you wont see me" !emacro define-macro test-abort ml-write "you will see me" i-will-abort ml-write "you wont see me" !emacro
For the last two examples above, all the "will"s are displayed and none of the "wont"s are.
(c) Copyright JASSPA 1999
Last Modified: 1999/08/24
Generated On: 1999/12/01