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

Home » Public Forums » archive » Re: Getting generic routine to call function.
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: Getting generic routine to call function. [message #1413] Fri, 19 November 1993 07:13 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
black@signal.dra.hmg.gb (John Black) writes:

> Ooops, Sorry managed to somehow post a zero length message

> OK that message again.

> Here's the situation. I have a generic numerical routine such as a numerical
> integration routine, or a Newton-Raphson routine. Ideally I'd like to write
> them so that they can operate on any routine that evaluates a function.
> However IDL/WAVE doesn't seem to allow you to pass the name of the routine
> that evaluates a function into the generic routine, so that the generic
> routine can use it. This situation is obviously best if it can be achieved,
> because it means that you don't have to have multiple copies of the generic
> routine all caled something different, but only differ in detail in that they
> call a different function evaluating routine

> So has anyone come up with a way to do this or a way to structure code to
> get around this problem?

> Thanks in advance,

Yeah, that's easy. :^) Simply pass the name of the function as a character
string to the routine and then use EXECUTE to evaluate the function. Here are
the relevant lines from one of my own routines that uses this technique:

PRO LSTSQR,X,Y,FNAME,PARAM,PERR
.
.
.
TEST = EXECUTE('F = ' + FNAME + '(X,PARAM,FDER)')
.
.
.

Bill Thompson
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Creating shared libs with gcc ?
Next Topic: HDF's Vdata

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

Current Time: Fri Oct 10 15:09:00 PDT 2025

Total time taken to generate the page: 2.40197 seconds