comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: .compile vs .run
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: .compile vs .run [message #43499] Mon, 18 April 2005 11:30 Go to next message
R.G. Stockwell is currently offline  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 #43509 is a reply to message #43499] Mon, 18 April 2005 07:45 Go to previous messageGo to next message
Benjamin Hornberger is currently offline  Benjamin Hornberger
Messages: 258
Registered: March 2004
Senior Member
m_schellens wrote:
> 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?

I think the above is not a main program. It's a procedure. Main programs
don't have the "PRO ..." line (but they do have the END statement).

> What is the difference between .compile and .run?

I think for functions / procedures, there is no difference. Have a look
at .RUN and .COMPILE in the help index.

Benjamin
Re: .compile vs .run [message #43510 is a reply to message #43509] Mon, 18 April 2005 05:50 Go to previous messageGo to next message
David Fanning is currently offline  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 #43512 is a reply to message #43510] Mon, 18 April 2005 02:13 Go to previous messageGo to next message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
m_schellens wrote:
> 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?

You missed a missing main program. Thats all procedures. A main program
does not start with a pro statement. If t should be your main program
put it at the end.

print,'t'
end

cheers
Reimar

> IDL 6.1

>
> marc
>


--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
============================================================ =======
Re: .compile vs .run [message #43683 is a reply to message #43499] Mon, 18 April 2005 23:18 Go to previous message
m_schellens is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: "?" help-command in linux
Next Topic: IDL - ENVI batch mode question

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 05:12:01 PDT 2025

Total time taken to generate the page: 4.71913 seconds