Re: Automatic Compiliation of IDL Programs, Was: Lost Functions [message #10317 is a reply to message #10261] |
Thu, 06 November 1997 00:00   |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------446B794B15FB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
David Fanning wrote:
>
> Martin Schultz (mgs@io.harvard.edu) writes:
>
> [...] It would
>> certainly be useful to have a tool which would look for all
>> the routines that may be called from a "command" (i.e. pro or function
>> identical to filename), and lists the files in which they are found. Of
>> course, this does depend on your installation (order of searchable
>> libraries). I guess it would come down to a real or pseudo compilation
>> and could possibly be achieved by
>> some tricky use of the journal output ??? Has anyone written something
>> like this ?
>
> It would be useful to have a tool like this.
[...]
--
Thanks for this tip (why can't they put a link to RESOLVE_ROUTINE in the
.COMPILE section of the manual ???
With the help of the RESOLVE_... routines and the ROUTINE_INFO function
I put together a small tool that does gather all the files one needs for
a program distribution (attached below). The drawback is that this list
also contains the routines that are only needed in order to find the
routines that are needed AND everything that had been compiled before
(e.g. the startup file). If it does not happen too frequently, one can
delete these files manually, but it would be nice if there were a better
way to restrict the output to only the routines associated with the one
in question.
Martin.
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Earth&Planetary Sciences, Harvard University
186 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA
phone: (617)-496-8318
fax : (617)-495-4551
e-mail: mgs@io.harvard.edu
IDL-homepage: http://www-as.harvard.edu/people/staff/mgs/idl/
------------------------------------------------------------ -------
--------------446B794B15FB
Content-Type: text/plain; charset=us-ascii; name="distribute.pro"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="distribute.pro"
pro distribute,routinename
; first compile the routine of interest
resolve_routine,routinename
; and all the routines called therein
resolve_all
; then obtain information on all the routines and functions
; that are currently compiled
r1 = routine_info(/source)
r2 = routine_info(/source,/functions)
; seperate path and name information
path = [ r1.path, r2.path ]
name = [ r1.name, r2.name ]
; get uniq path (i.e. single files)
si = path(sort(path))
upath = si(uniq(si))
; print out results (filenames and sorted routine names):
; 1. routines in local directory
ind = where(strpos(upath,'/') lt 0)
if (ind(0) ge 0) then $
for i=0,n_elements(ind)-1 do print,upath(ind(i))
; 2. routines in directories that do not contain "lib" or "rsi"
ind = where(strpos(upath,'lib') lt 0 AND strpos(upath,'rsi') lt 0 $
AND strpos(upath,'/') ge 0)
if (ind(0) ge 0) then $
for i=0,n_elements(ind)-1 do print,upath(ind(i))
; 3. routines in directories that contain "lib" but not "rsi"
ind = where(strpos(upath,'lib') ge 0 AND strpos(upath,'rsi') lt 0 $
AND strpos(upath,'/') ge 0)
if (ind(0) ge 0) then $
for i=0,n_elements(ind)-1 do print,upath(ind(i))
; 4. routines in directories that contain "rsi"
ind = where(strpos(upath,'rsi') ge 0 $
AND strpos(upath,'/') ge 0)
if (ind(0) ge 0) then $
for i=0,n_elements(ind)-1 do print,upath(ind(i))
si = sort(name)
print,';'
for i=0,n_elements(path)-1 do $
print,'; ',name(si(i)),' : ',path(si(i))
return
end
--------------446B794B15FB--
|
|
|