<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--Converted with LaTeX2HTML 98.1p1 release (March 2nd, 1998) originally by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <TITLE>MIDAS Command Language</TITLE> <META NAME="description" CONTENT="MIDAS Command Language"> <META NAME="keywords" CONTENT="vol1"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <LINK REL="STYLESHEET" HREF="vol1.css"> <LINK REL="next" HREF="node47.html"> <LINK REL="previous" HREF="node37.html"> <LINK REL="up" HREF="node22.html"> <LINK REL="next" HREF="node39.html"> </HEAD> <BODY > <!--Navigation Panel--> <A NAME="tex2html957" HREF="node39.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="icons.gif/next_motif.gif"></A> <A NAME="tex2html953" HREF="node22.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="icons.gif/up_motif.gif"></A> <A NAME="tex2html947" HREF="node37.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="icons.gif/previous_motif.gif"></A> <A NAME="tex2html955" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="icons.gif/contents_motif.gif"></A> <A NAME="tex2html956" HREF="node216.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="icons.gif/index_motif.gif"></A> <BR> <B> Next:</B> <A NAME="tex2html958" HREF="node39.html">Passing Parameters in MIDAS</A> <B> Up:</B> <A NAME="tex2html954" HREF="node22.html">Monitor and Command Language</A> <B> Previous:</B> <A NAME="tex2html948" HREF="node37.html">Execution of Commands</A> <BR> <BR> <!--End of Navigation Panel--> <H1><A NAME="SECTION00660000000000000000"> </A><A NAME="1809"> </A> <A NAME="midas-command-language"> </A> <BR> MIDAS Command Language </H1> <P> The MIDAS command language (<TT>MCL</TT>) 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 <I>procedures</I>. <BR> The <TT>MCL</TT> 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 25 levels deep). <BR> <BR> MIDAS procedures<A NAME="1814"> </A> are handled in the following way: <BR> The ASCII procedure file is read in by the MIDAS monitor<A NAME="1815"> </A> and translated into an internal more compact format. This translated code is then executed inside the Monitor. <BR> 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 <TT>GOTO</TT> 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. <BR> <BR> For a detailed explanation of all the MIDAS Command Language commands see the appendix of this volume or use the MIDAS command <TT>HELP/CL</TT>. <BR> <BR> The following <I>Command Language</I> commands provide the necessary programming constructs like looping and conditional branching for MIDAS procedures, they cannot be used interactively: <BR> <BR> <TT>BRANCH variable comparisons labels</TT> <BR> Compare <I>variable</I> with <I>comparison</I> values and branch to related <I>labels</I> <BR> <BR> <TT>CROSSREF label1 ... label8 </TT> <BR> Define cross reference <I>labels</I> for parameters par1 ... par8 <BR> <BR> <TT>DEFINE/LOCAL key data all_flag level_flag</TT> <BR> Define local keyword <I>key</I> and initialize it using <I>data</I> <BR> <BR> <TT>DEFINE/PARAMETER par def type prompt limits</TT> <BR> Declare <I>default</I> value, <I>type</I>, <I>prompt</I>string and <I>limits</I> for parameter <I>par</I> <BR> <BR> <TT>DO loopvar = begin end step_size</TT> <BR> <TT>...command body...</TT> <BR> <TT>ENDDO</TT> <BR> Execute a do-loop (as in FORTRAN) <BR> <BR> <TT>ENTRY procedure</TT> <BR> Define the beginning of a MIDAS <I>procedure</I> in procedure file with a different name <BR> <BR> <TT>GOTO label</TT> <BR> Jump to a <I>label</I> defined as <I>label:</I>, see below <BR> <BR> <TT>IF par1 op par2 command</TT> <BR> Execute conditional statement (as in FORTRAN) <BR> <BR> <TT>IF par1 op par2 THEN</TT> <BR> <TT>...if-sequence...</TT> <BR> <TT>ELSEIF par1 op par2 THEN</TT> <BR> <TT>...else if-sequence...</TT> <BR> <TT>ELSE</TT> <BR> <TT>...else-sequence...</TT> <BR> <TT>ENDIF</TT> <BR> Execute a conditional statement (as in FORTRAN) <BR> <BR> <TT>INQUIRE/KEYWORD key prompt-string </TT> <BR> Demand value for <I>key</I> from the user <BR> <BR> <TT>label:</TT> <BR> Declare a <I>label</I>, with <I>label</I> a string beginning with a letter, e.g. <TT>Step_A:</TT> <BR> <BR> <TT>RETURN par1 ... par3</TT> <BR> Return to calling procedure or terminal and pass up to 3 parameters <BR> <BR> <TT>PAUSE </TT> <BR> interrupt the current procedure and return to interactive level <BR> <BR> <TT>DEFINE/MAXPAR nopar </TT> <BR> Indicate that max. <I>nopar</I> parameters are expected <BR> <BR> <BR> The following commands may also be used interactively, but are especially useful inside MIDAS procedures: <BR> <BR> <TT>@</TT> (or: <TT>@@</TT>, or: <TT>@a</TT>, or: <TT>@s</TT>, or: <TT>@c proc par1 ... par8</TT>) <BR> Execute the MIDAS procedure <I>proc</I> which is stored <BR> in MID_PROC:, (or in one of the current procedure directories) <BR> or in APP_PROC:, or in STD_PROC:, or in CON_PROC:, respectively <BR><BLOCKQUOTE> <DIV ALIGN="CENTER"> <B>Note</DIV> <I>Up to 4 directories for procedures can be specified via the command <TT>SET/MIDAS PATH=</TT>. By default the current directory and the directory pointed to by the variable <TT>MID_WORK</TT> are used to localize Midas procedures when using the <TT>@@</TT> command.</I></B></BLOCKQUOTE><TT>ECHO/qualif levela,levelb</TT> <BR> Control the display of MIDAS commands (<I>qualif</I> = ON, OFF, FULL) <BR> for procedures executing at a level in the interval [<I>levela,levelb</I>] <BR> <BR> <TT>COMPUTE/KEYWORD reskey = expression</TT> <BR> Evaluate an algebraic <I>expression</I> involving keywordss and constants, store result in <I>reskey</I> <BR> <BR> <TT>SET/FORMAT format_specs</TT> <BR> Define <I>format</I>s used for replacements of keyword and descriptor names <BR> in procedures with their actual values <BR> <BR> <TT>WRITE/OUT text</TT> <BR> Display <I>text</I> on terminal <BR> <BR> <TT>! comment</TT> <BR> Indicate beginning of a <I>comment</I> line <BR><BLOCKQUOTE> <DIV ALIGN="CENTER"> <B>Note</DIV> <I>It is good practice NOT to abbreviate the commands<A NAME="1884"> </A> and qualifiers<A NAME="1885"> </A> 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. <BR> The command <TT>TRANSLATE/SHOW myproc X</TT> will check that all commands and qualifiers are fully specified in procedure <TT>myproc.prg</TT>. <BR> <BR> Also avoid relying on the defaults of parameters of a given command. With the command <TT>CREATE/DEFAULT</TT> these defaults can be changed dynamically. Instead write full command lines specifying all parameters in your procedures.</I></B></BLOCKQUOTE> <P> <BR><HR> <!--Table of Child-Links--> <A NAME="CHILD_LINKS"> </A> <UL> <LI><A NAME="tex2html959" HREF="node39.html">Passing Parameters in MIDAS Procedures</A> <LI><A NAME="tex2html960" HREF="node40.html">Symbol Substitution in Command Procedures</A> <LI><A NAME="tex2html961" HREF="node41.html">DO Loops</A> <LI><A NAME="tex2html962" HREF="node42.html">Local Keywords</A> <LI><A NAME="tex2html963" HREF="node43.html">Conditional Statements, Branching</A> <LI><A NAME="tex2html964" HREF="node44.html">Special Functions</A> <LI><A NAME="tex2html965" HREF="node45.html">Interrupting Procedures</A> <LI><A NAME="tex2html966" HREF="node46.html">Entry points</A> </UL> <!--End of Table of Child-Links--> <HR> <!--Navigation Panel--> <A NAME="tex2html957" HREF="node39.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="icons.gif/next_motif.gif"></A> <A NAME="tex2html953" HREF="node22.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="icons.gif/up_motif.gif"></A> <A NAME="tex2html947" HREF="node37.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="icons.gif/previous_motif.gif"></A> <A NAME="tex2html955" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="icons.gif/contents_motif.gif"></A> <A NAME="tex2html956" HREF="node216.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="icons.gif/index_motif.gif"></A> <BR> <B> Next:</B> <A NAME="tex2html958" HREF="node39.html">Passing Parameters in MIDAS</A> <B> Up:</B> <A NAME="tex2html954" HREF="node22.html">Monitor and Command Language</A> <B> Previous:</B> <A NAME="tex2html948" HREF="node37.html">Execution of Commands</A> <!--End of Navigation Panel--> <ADDRESS> <I>Petra Nass</I> <BR><I>1999-06-09</I> </ADDRESS> </BODY> </HTML>