Re: .compile vs .run [message #43499] |
Mon, 18 April 2005 11:30  |
R.G. Stockwell
Messages: 363 Registered: July 1999
|
Senior Member |
|
|
"m_schellens" <mschellens@gmail.com> wrote in message
news:1113803159.824679.58050@l41g2000cwc.googlegroups.com...
> I have the following file 't.pro':
>
> pro t1
> print,'t1'
> end
Hi Marc,
others have answered your question. I'd just mention that you can
add a "main program" at the end of your procedure as follows:
pro t1
print,'t1'
end ; end of procedure
; main level code here
t1, 17
end ; end of main level code
If that is saved as your file t1.pro, it works as a procedure, but you
can also execute the file.
IDL>.run t1
17
The utility of this is that testing you can test the code nicely, and it
serves as
an example of how to use the code. I find it quite handy.
Cheers,
bob
|
|
|
|
Re: .compile vs .run [message #43510 is a reply to message #43509] |
Mon, 18 April 2005 05:50   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
m_schellens writes:
> I have the following file 't.pro':
>
> pro t1
> print,'t1'
> end
>
> pro t
> print,'t'
> end
>
> pro t3
> print,'t3'
> end
>
>
> IDL 6.1 gives:
>
> IDL> .comp t
> % Compiled module: T1.
> % Compiled module: T.
> % Compiled module: T3.
> IDL> .run t
> % Compiled module: T1.
> % Compiled module: T.
> % Compiled module: T3.
>
> Isn't .run supposed to EXECUTE the main program?
> What is the difference between .compile and .run?
> Or what am I missing?
I think probably your definition of "main program" is not
the same as the definition used by IDL, since there is
no "main program" (using the IDL definition) in your example.
Their definition of a main program is a sequence of IDL
statements (not beginning with a procedure or function
definition statement), followed by an END statement.
print, 'main program'
a = 5
print, a
END
In the absence of a "main program", the .RUN and .COMPILE
executive commands act exactly the same.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
|
Re: .compile vs .run [message #43683 is a reply to message #43499] |
Mon, 18 April 2005 23:18  |
m_schellens
Messages: 31 Registered: February 2005
|
Member |
|
|
Thanks everybody.
I never used this (or used it many years ago and then forgot about it
- don't remeber :-)
But well, seems to have its right.
marc
|
|
|