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

Home » Public Forums » archive » Re: Locating IDL source code file
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: Locating IDL source code file [message #44416 is a reply to message #44414] Tue, 14 June 2005 05:41 Go to previous messageGo to previous message
Antonio Santiago is currently offline  Antonio Santiago
Messages: 201
Registered: February 2004
Senior Member
Craig wrote:
> [copied over from comp.lang.idl - don't know how to properly cross-post
> it in retrospect using Google groups]
>
>
> Hi all,
>
> I'm trying to write some code that will read information (like version
> numbers and dates) from the source files for procedures and functions
> that it uses. In Matlab I would use a command like
>
>
>>> which fred
>
>
> to return the full path to the source file "fred.m". How do I get the
> same result from IDL v6.1? I've tried something like
>
> IDL> ttt = file_which('fred.pro', /include_current_dir)
>
> but just got a null string returned. This might be because I'm using
> the IDLDE, so the routine isn't actually on the search path !PATH, even
> though it has been compiled OK when building the project.
>

I almost nothing have used IDLDE (I use Emacs+IDLwave).
I testes your previous command in the IDL command line interpreter all
works fine. Perhaps you need to modify your IDLDE configuration path or
simething like this.

> Once this problem is solved, I'll also need to determine the filename
> for the source file containing a definition of 'fred', because most of
> the routines in this project don't have their own 'fred.pro' source
> file.
>

That is, yoru file.pro cotains procedured "fred" and "tom" ??
I think there is no function that does this for you, you need to open
and parse the file looking for a "PROCEDURE fred" string.

The next procedure opens a file and search for all procedure/funtions
that starts with the specified "findstring". If you put
findstring='fred' then also match names like 'frederic'.

;PRO parse, file, findstring
;; Open the file test.lis:
OPENR, 1, file
;; Define a string variable:
line = ''
;; Loop until EOF is found:
found = 0
line_number = 0
WHILE (~ EOF(1)) AND (NOT found) DO BEGIN
;; Read a line of text:
READF, 1, line
;; Check if match your procedure/function name
match = STREGEX(STRUPCASE(line), '(PROCEDURE|FUNCTION) ' + $
''+STRUPCASE(findstring), $
/BOOLEAN)
IF match THEN print, line_number, '-', line
line_number++
ENDWHILE
;; Close the file:
CLOSE, 1
END



--
-----------------------------------------------------
Antonio Santiago P�rez
( email: santiago<<at>>grahi.upc.edu )
( www: http://www.grahi.upc.edu/santiago )
( www: http://asantiago.blogsite.org )
-----------------------------------------------------
GRAHI - Grup de Recerca Aplicada en Hidrometeorologia
Universitat Polit�cnica de Catalunya
-----------------------------------------------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL source editor alternatives?
Next Topic: Curvefit

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

Current Time: Fri Oct 10 10:31:55 PDT 2025

Total time taken to generate the page: 0.64150 seconds