Re: where can I find them [message #30574 is a reply to message #30573] |
Tue, 07 May 2002 19:07   |
mperrin+news
Messages: 81 Registered: May 2001
|
Member |
|
|
Xiaoying Jin <xje4e@mizzou.edu> wrote:
> Hi, there,
>
> If I know the name of the function, such as "DILATE", how can I find where
> IDL implement it? Is there a command in IDL to find the .pro or .dll files
> related to it?
I make frequent use of a procedure called "which" which does just this.
I forget where I originally got the code from... Ah, OK. A web search
finds it at
http://www.astro.washington.edu/deutsch-bin/getpro/library02 .html?WHICH
Actually, now that I look at that, that's *not* the same thing as the
"which.pro" that I have. The output is basically the same, but the one
I have is substantially faster. I've included the text of this below.
If anyone has any idea where this code originally came from or who
the author is, please let me know. I hope the unknown "JAV" responsible for
this code doesn't mind my posting it here, as it's really an exceptionally
usefull little bit of software.
- Marshall
-----------------------------------------------------
pro which,proname
;Prints full filenames in IDL !path search order for a particular routine.
; proname (input string) procedure name (.pro will be appended) to find
;24-Aug-92 JAV Create.
;10-Mar-93 JAV Fixed bug; last directory in !path ignored; pad with ': '
if n_params() lt 1 then begin
print,'syntax: which,proname(.pro assumed)'
retall
endif
pathlist = '.:' + !path + ': ' ;build IDL path list
fcount = 0 ;reset file counter
il = strlen(pathlist) - 1 ;length of path string
ib = 0 ;begining substring index
ie = strpos(pathlist,':',ib) ;ending substring index
repeat begin ;true: found path separator
path = strmid(pathlist,ib,ie-ib) ;extract path element
fullname = path + '/' + proname + '.pro' ;build full filename
openr,unit,fullname,error=eno,/get_lun ;try to open file
if eno eq 0 then begin ;true: found file
fcount = fcount + 1 ;increment file counter
if path eq '.' then begin ;true: in current directory
spawn,'pwd',dot ;get current working directory
dot = dot(0) ;convert to scalar
print,fullname + ' (. = ' + dot + ')' ;print filename + current dir
endif else begin ;else: not in current directory
print,fullname ;print full name
endelse
free_lun,unit ;close file
endif
ib = ie + 1 ;point beyond separator
ie = strpos(pathlist,':',ib) ;ending substring index
if ie eq -1 then ie = il ;point at end of path string
endrep until ie eq il ;until end of path reached
if fcount eq 0 then begin ;true: routine not found
print,'which: ' + proname + '.pro not found on IDL !path.'
endif
end
|
|
|