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 
Switch to threaded view of this topic Create a new topic Submit Reply
How does IDL find functions? [message #44454] Fri, 17 June 2005 12:07 Go to next message
robertschaefer is currently offline  robertschaefer
Messages: 10
Registered: August 2004
Junior Member
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.

My solution looks like this but I think there must be an easier way:

-generate a list of functions in user-lib
-Read the function where to search (openr)
-compare each line (string) with the list of lib functions
(how to extract function names egantly? -> strsplit with '=*(' :
definitely not)
-save coincide functions (strings) and go on searching into found
functions

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
Re: How does IDL find functions? [message #44540 is a reply to message #44454] Mon, 20 June 2005 14:52 Go to previous messageGo to next message
R.G. Stockwell is currently offline  R.G. Stockwell
Messages: 363
Registered: July 1999
Senior Member
"Mark Hadfield" <m.hadfield@niwa.co.nz> wrote in message
news:d97ceq$g2q$1@newsreader.mailgate.org...
> 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.
>
> What do you mean by "self-written"?

Hmmm, self-written, interesting challenge....

-bob
Re: How does IDL find functions? [message #44541 is a reply to message #44454] Mon, 20 June 2005 14:28 Go to previous messageGo to next message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
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.

What do you mean by "self-written"?


--
Mark Hadfield "Kei puwaha te tai nei, Hoea tahi tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
Re: How does IDL find functions? [message #44546 is a reply to message #44454] Sun, 19 June 2005 23:13 Go to previous messageGo to next 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
-----------------------------------------------------
Re: How does IDL find functions? [message #44574 is a reply to message #44540] Thu, 23 June 2005 05:40 Go to previous message
robertschaefer is currently offline  robertschaefer
Messages: 10
Registered: August 2004
Junior Member
Thank you Benjamin, Reimar, Andrew and Antonio for your help, Antonios
example to use the "STREGEX" Function helped me to solve the problem
without compiling.

@ Mark: Maybe I have to excuse, that my english is not so good. With
"self written functions" i meant the functions belonging to my user
lib.
...but the previous authors understand my problem... so...?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: iSurface lighting questions
Next Topic: quick search of array

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

Current Time: Wed Oct 08 16:01:12 PDT 2025

Total time taken to generate the page: 0.00518 seconds