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

Home » Public Forums » archive » Re: Defining constants in IDL?
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: Defining constants in IDL? [message #31314 is a reply to message #31307] Sat, 22 June 2002 09:55 Go to previous messageGo to previous message
ronn is currently offline  ronn
Messages: 123
Registered: April 1999
Senior Member
in article af0nid$1ets$1@agate.berkeley.edu, Marshall Perrin at
mperrin+news@arkham.berkeley.edu wrote on 6/21/02 10:31 PM:

> Dominic Zarro <dzarro@yahoo.com> wrote:
>> IDL is very forgiving. Just define a constant to be any name and set its
>> value. For example,
>>
>> IDL> a = 100
>>
>> Just be careful not to redefine and, hence, overwrite the variable 'a'.
>
> The problem with this approach is that it is only visible within one
> particular file. There's no mechanism akin to C's header files for
> getting a constant into multiple source files, something I frequently find
> myself missing.

Hi Marshall,

Actually there is something similiar to including a header file. What you
need is a file with no header (i.e. pro or function as the first line) and
no end statement. For example,

a = 0
True = 1
False = 0
yes = 'YES'

could be saved in a file called constants.pro.

To include this in your own code you would do this.

pro myProcedure, p1, p2

@constants

...
...

end

The @ sign acts as an include statement to the compiler.

-Ronn


--
Ronn Kling
KRS, inc.
email: ronn@rlkling.com
"Application Development with IDL"� programming book updated for IDL5.5!
"Calling C from IDL, Using DLM's to extend your IDL code"
http://www.rlkling.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Delvar?
Next Topic: Re: write_jpeg and TVRD()

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

Current Time: Sun Oct 26 02:37:21 PDT 2025

Total time taken to generate the page: 1.38536 seconds