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

Home » Public Forums » archive » compiling many routines at once
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
compiling many routines at once [message #54244] Fri, 01 June 2007 06:12 Go to next message
kostis is currently offline  kostis
Messages: 17
Registered: December 2006
Junior Member
I use a main program main.pro that includes many other programs and
functions.
Each time i recompile amin.pro i have to compile all included routines
seperately...
Functions are compiled automatically with the command FORWARD_FUNCTION
but that doesnt work with routines...
How can i compile everything at once with .r main.pro ?
Re: compiling many routines at once [message #54368 is a reply to message #54244] Fri, 01 June 2007 15:42 Go to previous message
Robbie is currently offline  Robbie
Messages: 165
Registered: February 2006
Senior Member
The way that you compile in IDL is ultimately about personal
preference and coding style. Things like 'resolve_all' will pick up
most things, but will miss objects and functions called using execute/
call_procedure/call_function

You can simply run your program and pray that you covered every line
of code. Resolve all and then save, /ROUTINE.

A project is toublesome if you are importing a large amount of
external code. I have had difficulties when I wanted to 'merge' or
update an external project. Particularly when there are more than
just .pro files.

My personal favourite is to compile all .pro files within a given
pathspec. After all, this is the same method that IDL uses to locate
routines. Why not use it to compile them as well? I prefer this method
because I can incorporate it into my WIX (Windows Installer XML) build
scripts.

Robbie


Example usage:
nmacomplile, 'itools.sav',['lib/itools','lib/igamma.pro'], ROOT_DIR=!
DIR

pro nmacompile, target, source, ROOT_DIR=root_dir,
ITRESOLVE=itresolve, NO_SAVE=no_save

if (keyword_set(itresolve)) then ITRESOLVE

ThisRoutine = Routine_Info('nmacompile', /Source)

if (n_elements(root_dir) eq 0) then $

root_dir = FILE_DIRNAME(FILE_DIRNAME(FILE_DIRNAME(ThisRoutine.path)))

for i=0,n_elements(source)-1 do begin

path = FILEPATH(source[i],ROOT_DIR=root_dir)

if (file_test(path,/DIRECTORY)) then $

programs = FILE_BASENAME(FILE_SEARCH(path, "*.pro"),'.pro') $

else $

programs = FILE_BASENAME(path,'.pro')

help, CALLS=calls

for j=0,n_elements(calls)-1 do calls[j] = (strsplit(calls[j], ' ',/
EXTRACT))[0]

for j=0,n_elements(programs) -1 do begin

inds = where(strupcase(programs[j]) eq calls,count)

if (count gt 0) then continue



catch, errorvalue

if (errorvalue ne 0) then begin

catch, /CANCEL

endif else begin

RESOLVE_ROUTINE, programs[j], /EITHER

endelse

catch, /cancel

endfor

endfor

RESOLVE_ALL, /CONTINUE_ON_ERROR

catch, /cancel

if (~ keyword_set(no_save)) then $

save, FILENAME=target, /ROUTINES

end
Re: compiling many routines at once [message #54382 is a reply to message #54244] Fri, 01 June 2007 08:19 Go to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Jun 1, 8:12 am, kostis <kostis...@gmail.com> wrote:
> I use a main program main.pro that includes many other programs and
> functions.
> Each time i recompile amin.pro i have to compile all included routines
> seperately...
> Functions are compiled automatically with the command FORWARD_FUNCTION
> but that doesnt work with routines...
> How can i compile everything at once with .r main.pro ?

resolve_all?
Re: compiling many routines at once [message #54383 is a reply to message #54244] Fri, 01 June 2007 08:11 Go to previous message
KRDean is currently offline  KRDean
Messages: 69
Registered: July 2006
Member
Use IDL's Projects!

For years I would remove the the Project Window on the left side of
IDLDE by unchecking the Preference -> Project. My style of programming
was to place all the PRO and FUNCTION routines in the same file,
making sure FUNCTION routines were at the top. Or use the Preference -
> Path to insert the path of my code.

However, recently, I started inheriting IDL code in my department
that was written by other people that have left or are still around. I
needed a way to manage all these snippets of code. I learn to use the
IDLDE Project. Whenever, I start a new IDL application or given new
code, I'll create an IDL Project.

IDL Project allow you to add and remove IDL files, have quick access
to the routines if changes are require, search through all the files
(helpful for debugging), and compiles all the routines with a click of
the button.

All in all, IDL projects has made me an efficient application
developer.

Kelly Dean
Fort Collins, CO


On Jun 1, 7:12 am, kostis <kostis...@gmail.com> wrote:
> I use a main program main.pro that includes many other programs and
> functions.
> Each time i recompile amin.pro i have to compile all included routines
> seperately...
> Functions are compiled automatically with the command FORWARD_FUNCTION
> but that doesnt work with routines...
> How can i compile everything at once with .r main.pro ?
Re: compiling many routines at once [message #54388 is a reply to message #54244] Fri, 01 June 2007 07:06 Go to previous message
Jo Klein is currently offline  Jo Klein
Messages: 54
Registered: January 2006
Member
Also, you could create a batch file with .comp statements, and then use
@mybatchfile to run it.
Jo
Re: compiling many routines at once [message #54389 is a reply to message #54244] Fri, 01 June 2007 06:58 Go to previous message
Maarten[1] is currently offline  Maarten[1]
Messages: 176
Registered: November 2005
Senior Member
On Jun 1, 1:12 pm, kostis <kostis...@gmail.com> wrote:
> I use a main program main.pro that includes many other programs and
> functions.
> Each time i recompile amin.pro i have to compile all included routines
> seperately...
> Functions are compiled automatically with the command FORWARD_FUNCTION
> but that doesnt work with routines...
> How can i compile everything at once with .r main.pro ?

make sure your program files have the correct name, and are stored in
a location where IDL can find them. See http://www.dfanning.com/tips/namefiles.html

Maarten
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: get image from widget_draw
Next Topic: make_scalar?

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

Current Time: Wed Oct 08 15:17:40 PDT 2025

Total time taken to generate the page: 0.04226 seconds