Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.sao.ru/precise/Midas_doc/doc/95NOV/vol1/node40.html
Дата изменения: Fri Feb 23 12:56:50 1996 Дата индексирования: Tue Oct 2 17:12:01 2012 Кодировка: Поисковые слова: п п п п п п п п п п п п п п п п п п п п п п п |
The MIDAS command language ( MCL)
consists of all the commands which you enter
interactively, and an additional set of commands to provide the necessary tools
to write MIDAS ``programs'', called MIDAS procedures.
The MCL is a flexible and powerful tool to integrate
application modules into MIDAS and to do rapid prototyping. But it is not
intended to be a
full blown programming language - for programming tasks MIDAS supports the
standard interfaces in FORTRAN 77 and C (cf. the MIDAS Environment document).
It is an interpreted language, so you do not need
to compile MIDAS procedures. It is also a ``Macro'' language in the sense that
you can build complex procedures, attach these procedures to a MIDAS command
and qualifier combination and then put a single line with that command name
into yet another procedure (up to 20 levels deep).
MIDAS procedures are handled in the following way:
The ASCII procedure file is read in by the MIDAS monitor and translated into
an internal more compact format. This translated code is then executed inside
the Monitor.
The individual lines of code are parsed and decoded in two
passes: In the first pass, all symbol substitutions are done using the specified
formats to convert from binary to ASCII. In the second pass,
all control and conditional
statements are processed directly by the Monitor (e.g. positioning the internal
program pointer to the command line referred to by a GOTO statement)
until
an ``executable'' command line is found which is passed on to the usual
command input pipeline of MIDAS as if it were typed in by the user.
For a detailed explanation of all the MIDAS Command Language commands see
the appendix of this volume or use the MIDAS command HELP/CL.
The following Command Language commands provide the necessary programming
constructs like looping and conditional branching for MIDAS procedures, they
cannot be used interactively:
BRANCH variable comparisons labels
Compare variable with comparison
values and branch to related labels
CROSSREF label1 ... label8
Define cross reference labels for
parameters par1 ... par8
DEFINE/LOCAL key data all_flag level_flag
Define local keyword key and initialize it using data
DEFINE/PARAMETER par def type prompt limits
Declare default value, type,
promptstring and limits for parameter par
DO loopvar = begin end step_size
... command body...
ENDDO
Execute a do--loop (as in FORTRAN)
ENTRY procedure
Define the beginning of a MIDAS procedure
in procedure file with a different name
GOTO label
Jump to a label defined as label:, see below
IF par1 op par2 command
Execute conditional statement (as in FORTRAN)
IF par1 op par2 THEN
... if-sequence...
ELSEIF par1 op par2 THEN
... else if-sequence...
ELSE
... else-sequence...
ENDIF
Execute a conditional statement (as in FORTRAN)
INQUIRE/KEYWORD key prompt-string
Demand value for key from the user
label:
Declare a label,e.g. HOME:
RETURN par1 ... par3
Return to calling procedure or terminal and
pass up to 3 parameters
PAUSE
interrupt the current procedure and return to interactive level
DEFINE/MAXPAR nopar
Indicate that max. nopar parameters are expected
The following commands may also be used interactively, but are especially
useful inside MIDAS procedures:
@ (or: @@, or: @a, or: @s, or:
@c proc par1 ... par8)
Execute the MIDAS procedure proc which is stored
in MID_PROC:, (or in the current directory or MID_WORK:),
or in APP_PROC:, or in STD_PROC:, or in CON_PROC:,
respectively
ECHO/qualif levela,levelb
Control the display of MIDAS commands
( qualif = ON, OFF, FULL)
for procedures executing at a level in the
interval [ levela,levelb]
COMPUTE/KEYWORD reskey = expression
Evaluate an algebraic expression
involving keywordss and constants, store result in reskey
SET/FORMAT I-format E-format
Define formats used for replacements
of keyword and descriptor names
in procedures with their actual values
WRITE/OUT text
Display text on terminal
! comment
Indicate beginning of a comment line
Note is good practice not to abbreviate the commands and qualifiers of a MIDAS command inside a procedure. Since new MIDAS commands can be created any time an abbreviated command may work at one time but become ambiguous at other times and cause the procedure to fail.
The command TRANSLATE/SHOW myproc X will check that all commands and qualifiers are fully specified in procedure myproc.prg.