Re: compiling many routines at once [message #54368 is a reply to message #54244] |
Fri, 01 June 2007 15:42   |
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
|
|
|