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

Home » Public Forums » archive » How does IDL find functions?
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: How does IDL find functions? [message #44546 is a reply to message #44454] Sun, 19 June 2005 23:13 Go to previous message
Antonio Santiago is currently offline  Antonio Santiago
Messages: 201
Registered: February 2004
Senior Member
robertschaefer@gmx.de wrote:
> Hello IDL community,
>
> I'm looking for a smart solution to find functions from my own lib
> inside a self written function or procedure.
> The idea is to get a tree of embedded self written functions.
>

That is: parse a file SOME_FILE.PRO and find if it contains any function
of your own library.

> My solution looks like this but I think there must be an easier way:
>
> -generate a list of functions in user-lib
1- You need to load into memory (array) a list of your functions name.

> -Read the function where to search (openr)
2- Read each file line.

> -compare each line (string) with the list of lib functions
> (how to extract function names egantly? -> strsplit with '=*(' :
> definitely not)

3- I think it will better with a STRMACTH or STREGEX.

This code can help you (extract from the old post
http://groups-beta.google.com/group/comp.lang.idl-pvwave/bro wse_thread/thread/bd3fc18ab72631ea/33089f602feb945c?hl=en#33 089f602feb945c):

Parse an entory file 'file' and found all functions or procedures that
starts with 'findstring'.

;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

> -save coincide functions (strings) and go on searching into found
> functions

4- I dont understand this part. Save the function that coincides with
your function names and then find recursively into functions with
different name??

>
> Does anybody (I'm sure ;-) ) know how IDL find functions on compiling?
> This may be exactly the right (fast) way...
>
> Any ideas? ...Thanks for help...
>
> Best regards
>
> robert
>




--
-----------------------------------------------------
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
Previous Topic: Re: iSurface lighting questions
Next Topic: quick search of array

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

Current Time: Fri Oct 10 10:09:18 PDT 2025

Total time taken to generate the page: 0.56057 seconds