next up previous contents index
Next: Debugging of Procedures Up: Monitor and Command Previous: Context Levels

Running a Program within MIDAS

 

To execute a user--written MIDAS application program  (coded in FORTRAN or C), employ the command RUN. The command RUN MYPROG or RUN myprog will execute myprog.exe in a subprocess like any other MIDAS command.
It is better practice to embed the command RUN MYPROG in a MIDAS command procedure. Typical tasks of this procedure would be to provide default values for all parameters , to check the validity of parameter values, and to store the parameters into the keywords your program will use.
Let us assume you have written your special filter program and stored the executable module as bestfilt.exe on disk. Program bestfilt just needs the names of the input and output image which are obtained inside the program from the keywords IN_A and OUT_A .
The following MIDAS procedure:

!+
! MIDAS procedure bestfilt.prg
!+
CROSSREF INPUT RESULT
DEFINE/PARAMETER P1 ? IMA "Enter input frame: "
DEFINE/PARAMETER P2 ? IMA "Enter output frame: "
DEFINE/MAXPAR 2 ! max. 2 parameters expected
!
WRITE/KEYWORD IN_A P1
WRITE/KEYWORD OUT_A P2
RUN BESTFILT ! .exe is the default type

will check, that the two parameters are valid MIDAS file names and prompt for input if any parameter is not given. Together with the MIDAS command

CREATE/COMMAND BESTFILT/IMAGE @@ bestfilt

your application will then be integrated smoothly into MIDAS.
Now, you can apply your own filtering algorithm to the image lobo.bdf by typing e.g.
BESTFILT/IMAGE res=perrito in=lobo.
As with data files you can specify a search path for executables via the command
SET/MIDAS_SYSTEM EPATH=directory which is then used by the RUN command. Furthermore, if your module is written in C you can pass parameters to the executable in the usual way ( argc, arv stuff) via, e.g.
RUN BESTFILT par1 par2 ...





next up previous contents index
Next: Debugging of Procedures Up: Monitor and Command Previous: Context Levels



Rein Warmels
Mon Jan 22 12:06:29 MET 1996