|
Application Programming: Creating and Running Programs in IDL |
|
IDL program files, identified with a .pro extension, can be compiled and executed using the following methods:
To run an IDL program using the IDLDE interface, do the following:
Open
ITT\IDL63\examples\demo\demosrc\d_uscensus.pro
Compile filename
where filename is the name of the file opened in the IDLDE editor (d_uscensus.pro, in this example).
run filename
where filename is the name of the file opened in the IDLDE editor (d_uscensus.pro, in this example).
When a file is specified by typing only the filename at the IDL prompt, IDL searches the current directory for filename.pro (where filename is the file specified) 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 file specified (excluding the extension). See Automatic Compilation for additional details.
Using the previous example, run the US Census Data demo by entering the following at the command line:
d_uscensus
When a file is specified using either the .RUN, .RNEW, .COMPILE, or @ command followed by the filename, IDL searches the current directory for filename.pro (where filename is the file specified) 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 compiles or runs the file as specified by the executive command used. Executive commands can be entered only at the IDL command prompt, and are often used when executing $MAIN$ program files. See About Executive Commands for more information.
If you are compiling files that do not exist in your path, make sure to compile functions before procedures. This keeps IDL from misinterpreting a function call as subscribed variable or array definition. See Compiling Your Program for details.
| Warning If the current directory contains a subdirectory with the same name as filename, IDL will consider the file to have been found and stop searching. To avoid this problem, specify the extension ( .pro or .sav, usually) when entering the run, compile, or batch file executive command. |
The details of how !PATH is initialized and used differ between the various operating systems, although the overall concept is the same. See !PATH for more information.
IDL Online Help (March 06, 2007)