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

Home » Public Forums » archive » Re: Which like command for IDL?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Which like command for IDL? [message #23102 is a reply to message #23101] Thu, 04 January 2001 18:55 Go to previous messageGo to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Richard G. French (rfrench@wellesley.edu) writes:

> That does the job for a routine you've already compiled, but what if you
> want to find out BEFORE you compile it which display.pro you would end
> up running?

Can't be done. Heisenberg uncertainty principle applies.
You can't possibly know WHICH routine you are using until
the wave function collapses. Or, was that an electron? Humm.
Can't remember ... :-(

> Or even better (JD can probably do this with a recursive
> one-line routine), how about a procedure that goes through your full
> path and finds all of the duplicate filenames?

I'm shocked that you think JD can write better recursive
functions than me. But I'm busy. I'll leave it to him. :-)

> I am sure that I have about six different routines
> called CIRCLE.PRO in libraries that I have gotten from people, and
> having
> a routine that figured this out in advance would be a nice thing.

How about this WHICH program. *Very* quick and dirty.
I'll leave it to others to make perfect. (I can already
think of a couple of ways it can be greatly improved.)
But this finds the *first* program with the given name
of all the names I tested it on. Of course, it can
only find library routines. :-)

IDL> Which, "arrow"
D:\RSI\IDL54\lib\arrow.pro

IDL> Which, "congrid", /Func
D:\RSI\IDL54\lib\congrid.pro


Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155

************************************************************ ******
PRO WHICH, routineName, Funct=funct

Catch, theError
IF theError NE 0 THEN BEGIN
Catch, /Cancel
answer = Dialog_Message("Can't find: " + StrUpCase(routineName) + $
'. Is this a function?', /Question)
IF StrUpCase(answer) EQ 'YES' THEN BEGIN
Catch, theError
IF theError NE 0 THEN BEGIN
Catch, /Cancel
ok = Dialog_Message("Sorry. Can't find: " + $
StrUpCase(routineName) + '. Returning')
RETURN
ENDIF
Which, routineName, /Funct
RETURN
ENDIF ELSE BEGIN
ok = Dialog_Message("Sorry. Can't find: " + $
StrUpCase(routineName) + '. Returning')
RETURN
ENDELSE
ENDIF

Resolve_Routine, routineName, Is_Function=Keyword_Set(funct)
Help, /Source, Output=text

array = StrPos(STRUPCASE(text), STRUPCASE(routineName) + " ", -1)
index = Where(array NE -1, count)
IF count GT 0 THEN Print, text[index[0]] ELSE Print, 'Undetermined'
END
************************************************************ ******
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Map projection and object graphics
Next Topic: Re: GIF again.....

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

Current Time: Wed Oct 08 18:10:44 PDT 2025

Total time taken to generate the page: 0.00472 seconds