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 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Locating IDL source code file [message #44409] Tue, 14 June 2005 07:59
Craig[1] is currently offline  Craig[1]
Messages: 8
Registered: June 2005
Junior Member
Thanks for your help. I think that the help,/source command will deal
with multiple procedures defined in the same source file.

Craig
Re: Locating IDL source code file [message #44410 is a reply to message #44409] Tue, 14 June 2005 07:57 Go to previous message
Craig[1] is currently offline  Craig[1]
Messages: 8
Registered: June 2005
Junior Member
Thanks. I'm going to try with the "help,/source,out=out" method.
Craig
Re: Locating IDL source code file [message #44411 is a reply to message #44410] Tue, 14 June 2005 07:56 Go to previous message
Craig[1] is currently offline  Craig[1]
Messages: 8
Registered: June 2005
Junior Member
That explains the lack of response on comp.lang.idl :-)

Thanks,
Craig
Re: Locating IDL source code file [message #44414 is a reply to message #44411] Tue, 14 June 2005 06:14 Go to previous message
Benjamin Hornberger is currently offline  Benjamin Hornberger
Messages: 258
Registered: March 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]
>

I believe comp.lang.idl is not about the Interactive Data Language, but
about some Interface Description Language.

>
> 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.
>
> 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.
>
> Any ideas?
> TIA,
> Craig
>

This might help:

http://www.dfanning.com/programs/programrootdir.pro

Still, file_which should also work if the source file is in the IDL
path. And I think you should always have your source files in the path.

Benjamin
Re: Locating IDL source code file [message #44416 is a reply to message #44414] Tue, 14 June 2005 05:41 Go 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
-----------------------------------------------------
Re: Locating IDL source code file [message #44417 is a reply to message #44416] Tue, 14 June 2005 05:25 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
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)

could be done in several ways


* if it is compiled, help,/source,out=out
* look for "current directory" or "get_profile_path" in the google forum or
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/get_profile_path_dbase.pro.html
* file_which if the routine is in !PATH





>
> 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.

you should think on using a startup script which organises the !path for
you. A startup file is used in idlde and idl the same way. just only an
environement variable IDL_STARTUP must be set to this file.

>
> 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.

Then you want to separate between path file and extension.

you should have a look at:
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/file_path_name_ext_dbase.pro.html


cheers
Reimar

--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
============================================================ =======
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL source editor alternatives?
Next Topic: Curvefit

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

Current Time: Wed Oct 08 15:12:41 PDT 2025

Total time taken to generate the page: 0.01005 seconds