[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Including files




nilsj@unixg.ubc.ca (Nils Johnson) writes:
> 
> The IDL documentation mentions include files, which allows "statements 
> contained in an include file" to be "textually inserted into the including 
> file."
> 
> However, I can not find any mention or examples of how, exactly, to 
> include other files. What is the syntax? Are there any examples in the 
> documentation or sample code that comes with IDL?

It is not particularly good programming style to do this, and hence I
use it all the time! :-)

Here is you you do it:

pro mypro, arg1, arg2

  arg1 = arg2 + 5
  ... etc
@myinclude.pro

  return
end

Note that the standard path is consulted in including myinclude.pro,
otherwise it should be in your current directory.  Text is included
from the file verbatim.  In the example above, @myinclude.pro appears
within a procedure.  Therefore, myinclude.pro should contain neither a
PRO or FUNCTION declaration, nor a final END statement.  Works the
same as a C #include directive.

Happy programming,
Craig

-- 
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D.         EMAIL: craigmnet@astrog.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------