Back Home Up Next

Subchapters:

Executing Program Files

1) Automatic Execution

When a file is specified by typing only the filename at the IDL prompt, IDL searches first if this file corresponds to an already compiled program, and execute it. If not, IDL search in the current directory for filename.pro (where filename is the specified file) and then for filename.sav. If no file is found in the current directory, IDL searches in the same way in each directory specified by !PATH. If a file is found, IDL automatically compiles the contents and executes any functions or procedures that have the same name as the specified file (excluding the suffix).

2) Explicit Execution

When a file is specified with the .RUN, .RNEW, .COMPILE, or @ commands, IDL searches the current directory for filename.pro (where filename is the file specified) and then for filename. Even if the file corresponds to an already compiled program, it will re-compile it from the source file. It's the way to let IDL know that you change something into a file. If no file is found in the current directory, IDL searches in the same way in each directory specified by !PATH. If a file is found, IDL compiles or runs the file as specified by the executive command used.

3) Interrupting Program Execution

Programs that are running can be manually stopped by typing Control-C. This action is called a keyboard interrupt. A message indicating the statement number and program unit being executed is issued on the terminal acknowledging the interrupt. The values of variables can be examined, statements can be entered from the keyboard, and variables can be changed. The program can be resumed by typing the executive command .CONTINUE to resume or .S to execute the next statement and stop.

4) Variable Context After Interruption

The variable context after a keyboard interruption is that of the program unit in which the interruption occurred. By typing the statement RETURN, the program context will revert to the next higher calling level. The RETALL command returns control to the main program level. If any doubt arises as to which program unit in which the interrupt occurred, the HELP procedure can be used to determine the program context. IDL checks after each statement to see if an interruption has been typed. Execution does not stop until the statement that was active finishes; thus, a long time can elapse from the time the interrupt is typed to the time the program interrupts.

5) Bach programs and journal

Bach programs are saved into .pro files and are called by @ at the IDL prompt, or
into a program. They are not programs, they can't contain blocks (that means there is no place for any kind of end in those files). They are just like a copy of what you could type at the IDL prompt (except .run and .rnew if not followed by a valid name of file ).
You can create a bach file with the command journal:

        IDL> journal
        IDL> tab = findgen(10)
              0.00000      1.00000      2.00000      3.00000      4.00000      5.00000
              6.00000      7.00000      8.00000      9.00000
        IDL> print,tab
        IDL> journal

The file idlsave.pro where open with the first journal call, all the commands (and the
responses of IDL as comments) are saved in this file, witch is closed by the second call of journal. idlsave.pro looks like:

; IDL Version 5.0 (sunos sparc)
; Journal File for morisset@andromeda
; Working directory: /work5/morisset/www/idl
; Date: Thu Oct 30 15:26:39 1997
 

tab = findgen(10)
print,tab
;      0.00000      1.00000      2.00000      3.00000      4.00000      5.00000
;      6.00000      7.00000      8.00000      9.00000

You can recall the sequence of commands from idlsave.pro by:
 

        IDL> @idlsave
              0.00000      1.00000      2.00000      3.00000      4.00000      5.00000
              6.00000      7.00000      8.00000      9.00000

 

IDL courses C. Morisset © 2004 IA/UNAM V 2.2

Back Home Up Next