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

Home » Public Forums » archive » Re: Functions calling 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
Re: Functions calling functions [message #5241] Thu, 26 October 1995 00:00
David S. Foster/Admin is currently offline  David S. Foster/Admin
Messages: 14
Registered: May 1995
Junior Member
The easiest way to get around this is to put functions that are
referenced by other functions earlier in the source code, before the
functions that reference them. In this way, they are compiled first.

If you are going to use the forward_function statement, I think
you have to give it global scope (don't put it within the context
of a function). Just an idea, I've never used this statement. I've
just always made sure functions which are called later on in the
source file appear first.

David Foster


>
> My question is, why can't I seem to have a function call a function
> that is defined within the same text file. It would seem that this
> should be possible.
>
Re: Functions calling functions [message #5248 is a reply to message #5241] Wed, 25 October 1995 00:00 Go to previous message
rmmoss is currently offline  rmmoss
Messages: 12
Registered: August 1995
Junior Member
I ran this little snippet of code that you provided, and it worked
exactly as expected. I'm running IDL v4.0.1 on SunOS 4.1.3. You did not
mention your OS or IDL version... perhaps that has something to do with it.



> function get_data, inputs
> ;===================================
>
> forward_function define_struct ;define data structure
>
> data = define_struct( inputs )
>
> ; Other Code Goes Here
>
> return, data
>
> end
>
> ;===================================
> ;
> ; Support Routines
> ;
> ;===================================
> function define_struct, inputs
> ;===================================
> data = 'test structures' ;Simplified things for test.
>
> return, data
>
> end


I got the following result, as expected:

idl>.run ~/idl/get_data
idl>print,get_data( 1 )
test structures
idl>

I'm not sure this is much help to you, but there you have it.

-----
Robert M. Moss, Ph.D.
Texaco Inc.
mossrm@texaco.com

This is not necessarily the opinion of Texaco Inc.
-----
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Why does IDL strip unary dimensions from structure elements?
Next Topic: Linking C code

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

Current Time: Wed Oct 08 13:44:20 PDT 2025

Total time taken to generate the page: 0.00516 seconds