<!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>Entry points</TITLE> <META NAME="description" CONTENT="Entry points"> <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="previous" HREF="node45.html"> <LINK REL="up" HREF="node38.html"> <LINK REL="next" HREF="node47.html"> </HEAD> <BODY > <!--Navigation Panel--> <A NAME="tex2html1059" HREF="node47.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="icons.gif/next_motif.gif"></A> <A NAME="tex2html1055" HREF="node38.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="icons.gif/up_motif.gif"></A> <A NAME="tex2html1051" HREF="node45.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="icons.gif/previous_motif.gif"></A> <A NAME="tex2html1057" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="icons.gif/contents_motif.gif"></A> <A NAME="tex2html1058" 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="tex2html1060" HREF="node47.html">Context Levels</A> <B> Up:</B> <A NAME="tex2html1056" HREF="node38.html">MIDAS Command Language</A> <B> Previous:</B> <A NAME="tex2html1052" HREF="node45.html">Interrupting Procedures</A> <BR> <BR> <!--End of Navigation Panel--> <H2><A NAME="SECTION00668000000000000000"> </A><A NAME="2381"> </A> <BR> Entry points </H2> <P> It is sometimes desirable to group several related procedures into a single file. In MIDAS, the <TT>ENTRY</TT> command defines entry points for different procedures in the same file. These individual procedures are executed by specifying also their entry point besides the file name in the <TT>`@@'</TT> command. <P> <BLOCKQUOTE> <TT>!+ <BR> ! Example 18, MIDAS procedure exa18.prg <BR> !+ <BR> DEFINE/PARAM P1 11 NUMBER "Enter input number: " <BR> DEFINE/MAXPAR 1 </TT>! only one parameter expected<TT> <BR> WRITE/OUT "Parameter 1 = </TT><IMG WIDTH="17" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img178.gif" ALT="$\{$"><TT>P1</TT><IMG WIDTH="16" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img179.gif" ALT="$\}$"><TT>" <BR> ! <BR> ENTRY 2 <BR> DEFINE/PARAM P1 new C "Enter input: " <BR> DEFINE/MAXPAR 1 </TT>! only one parameter expected<TT> <BR> WRITE/OUT "Parameter 1 = </TT><IMG WIDTH="17" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img180.gif" ALT="$\{$"><TT>P1</TT><IMG WIDTH="16" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img181.gif" ALT="$\}$"><TT>" <BR> ! <BR> ENTRY third <BR> DEFINE/PARAM P1 spiral IMA "Enter input image: " <BR> DEFINE/MAXPAR 1 </TT>! only one parameter expected<TT> <BR> WRITE/OUT "Parameter 1 = </TT><IMG WIDTH="17" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img182.gif" ALT="$\{$"><TT>P1</TT><IMG WIDTH="16" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img183.gif" ALT="$\}$"><TT>" <BR></TT></BLOCKQUOTE> <BR> The string following the <TT>ENTRY</TT> command (max. 8 characters) is used in the <TT>`@@'</TT> command to select the code segment in the file <TT>exa18.prg</TT>. Thus, <TT>@@ exa18,2 old</TT> will result in the display of the line: <TT>`Parameter 1 = old'</TT>; the following <TT>ENTRY</TT> statements indicates the end of this code segment and acts like a <TT>RETURN</TT> statement. Entering <TT>@@ exa18,third</TT> produces the output: <TT>`Parameter 1 = spiral'</TT>; and <TT>@@ exa18 -12</TT> will execute the lines with no preceding <TT>ENTRY</TT> statement, i.e. write: <TT>`Parameter 1 = -12'</TT>. This example also shows that parameter P1 is not global, that means it has to be defined in each <TT>ENTRY</TT> segment of the procedure file. <BR> Entries may also be used to structure the contents of a MIDAS procedure. In the following example, the procedure <TT>exa18.prg</TT> executes different code segments according to its first parameter. <P> <BLOCKQUOTE> <TT>!+ <BR> ! Example 19, MIDAS procedure exa19.prg <BR> !+ <BR> DEFINE/PARAM P1 000 C "Enter control flags for entries: " <BR> DEFINE/PARAM P2 sombrero IMA "Enter image to work with: " <BR> DEFINE/MAXPAR 2 </TT>! max 2 parameters expected<TT> <BR> ! <BR> DEFINE/LOCAL LOOP/I/1/1 0 <BR> DEFINE/LOCAL CCC/C/1/3 </TT><IMG WIDTH="17" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img184.gif" ALT="$\{$"><TT>P1(1:3)</TT><IMG WIDTH="16" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img185.gif" ALT="$\}$"><TT> <BR> SET/FORMAT I1 <BR> DO LOOP = 1 3 <BR> IF CCC(</TT><IMG WIDTH="17" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img186.gif" ALT="$\{$"><TT>LOOP</TT><IMG WIDTH="16" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img187.gif" ALT="$\}$"><TT>:</TT><IMG WIDTH="17" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img188.gif" ALT="$\{$"><TT>LOOP</TT><IMG WIDTH="16" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img189.gif" ALT="$\}$"><TT>) .EQ. "1" @@ exa19,000</TT><IMG WIDTH="17" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img190.gif" ALT="$\{$"><TT>LOOP</TT><IMG WIDTH="16" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img191.gif" ALT="$\}$"><IMG WIDTH="17" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img192.gif" ALT="$\{$"><TT>P2</TT><IMG WIDTH="16" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img193.gif" ALT="$\}$"><TT> <BR> ENDDO <BR> ! <BR> ! here the different sub-procedures <BR> ! <BR> ENTRY 0001 <BR> ! <BR> CREATE/IMAGE </TT><IMG WIDTH="17" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img194.gif" ALT="$\{$"><TT>P1</TT><IMG WIDTH="16" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img195.gif" ALT="$\}$"><TT> 2,256,256 ? gauss 128.5,128,128.5,128 <BR> ! <BR> ENTRY 0002 <BR> ! <BR> READ/DESCR </TT><IMG WIDTH="17" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img196.gif" ALT="$\{$"><TT>P1</TT><IMG WIDTH="16" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img197.gif" ALT="$\}$"><TT> <BR> ! <BR> ENTRY 0003 <BR> ! <BR> STATIST/IMAGE </TT><IMG WIDTH="17" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img198.gif" ALT="$\{$"><TT>P1</TT><IMG WIDTH="16" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img199.gif" ALT="$\}$"><TT> <BR></TT></BLOCKQUOTE> <BR> Then, to read the standard descriptors of image frame <TT>luna.bdf</TT> we would enter the command <TT>@@ exa19 010 luna</TT>; to create the frame <TT>sol.bdf</TT> we enter <TT>@@ exa19 100 sol</TT>. Finally, in order to create a gaussian image <TT>estrella.spc</TT>, and read its standard descriptors and do the statistics on the newly created image, we type the command <BR> <TT>@@ exa19 111 estrella.spc</TT>. <HR> <!--Navigation Panel--> <A NAME="tex2html1059" HREF="node47.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="icons.gif/next_motif.gif"></A> <A NAME="tex2html1055" HREF="node38.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="icons.gif/up_motif.gif"></A> <A NAME="tex2html1051" HREF="node45.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="icons.gif/previous_motif.gif"></A> <A NAME="tex2html1057" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="icons.gif/contents_motif.gif"></A> <A NAME="tex2html1058" 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="tex2html1060" HREF="node47.html">Context Levels</A> <B> Up:</B> <A NAME="tex2html1056" HREF="node38.html">MIDAS Command Language</A> <B> Previous:</B> <A NAME="tex2html1052" HREF="node45.html">Interrupting Procedures</A> <!--End of Navigation Panel--> <ADDRESS> <I>Petra Nass</I> <BR><I>1999-06-09</I> </ADDRESS> </BODY> </HTML>