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

Home » Public Forums » archive » Re: Two Questions
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: Two Questions [message #4815] Wed, 09 August 1995 00:00
dave is currently offline  dave
Messages: 31
Registered: February 1994
Member
>>>> > ">" == Joel D Offenberg <offenbrg@fondue.gsfc.nasa.gov> writes:
In article <40ag77$dvs@post.gsfc.nasa.gov> offenbrg@fondue.gsfc.nasa.gov (Joel D. Offenberg) writes:


>> mbrown@olie.wvitcoe.wvnet.edu (Myron Brown) writes: Hi. I have
>> two questions (that were not answered in the FAQ):

>> 2. How do I write programs in IDL using entities similar to C
>> header files? I'd like to do things with some structure (not
>> everyth

Put your info in a file, e.g., defs.h

put the following line in *each routine* that uses whatever is defined
there (common blocks, structure defs, etc.):

@defs.h

Good luck,

David.
--
David Fenyes dave@image6.med.uth.tmc.edu
University of Texas Medical School Houston, Texas
Re: Two Questions [message #4816 is a reply to message #4815] Wed, 09 August 1995 00:00 Go to previous message
Jackel is currently offline  Jackel
Messages: 30
Registered: April 1993
Member
In article <40ag77$dvs@post.gsfc.nasa.gov> offenbrg@fondue.gsfc.nasa.gov (Joel D. Offenberg) writes:

> 1. Global variables do not exist. However, "Common blocks" can be used to
> achieve the same effect. (A "common block" is a group of variables which
> are declared in each function/procedure, but retain their values when out of
> scope, and can be declared in as many functions/procedures as you wish).

While "Global" variables do not exist, System variables do. These are created
with the procedure DEFSYSV, and are globally visible. They can also be
made Read_Only, so that functions cannot change them. Personally, I prefer
common blocks, but the original poster might want to give both possibilities a
try.

Brian Jackel
University of Western Ontario
Re: Two Questions [message #4819 is a reply to message #4815] Wed, 09 August 1995 00:00 Go to previous message
offenbrg is currently offline  offenbrg
Messages: 31
Registered: August 1993
Member
mbrown@olie.wvitcoe.wvnet.edu (Myron Brown) writes:

> Hi. I have two questions (that were not answered in the FAQ):


> 1. How do I declare global variables in IDL. I am used to writing in C
> and other such languages. Am I missing something, or shoul

> 2. How do I write programs in IDL using entities similar to C header
> files? I'd like to do things with some structure (not everyth

OK -
You will find that IDL is very unlike C in many respects. However,
these two things you are asking for can be "faked," if you wish:

1. Global variables do not exist. However, "Common blocks" can be used to
achieve the same effect. (A "common block" is a group of variables which
are declared in each function/procedure, but retain their values when out of
scope, and can be declared in as many functions/procedures as you wish).

2. There aren't C header files in IDL. However, a named structure (once
defined) can not be changed at all, so you only have to define it once.
It is possible to write a simple routine which defines your structures, like

pro define_struc
;
common STRUCTURES, x, y
x = {STRUCT1, RA:0.0, DEC:0.0, EPOCH:0.0, FLUX:0.0}
y = {STRUCT2, ON:"", OFF:0L, THIS:fltarr(10), THAT:""}
end

pro use_struct
;
common STRUCTURES, x,y
define_struc
help,x,y
end

...This would define the structures and create variables X and Y which can
be used as "prototype" versions of the structures, etc.

Good Luck!
Joel
--
"...And I am unanimous in this" - Mrs. Slocumbe
------------------------------------------------------------ ----------
| Joel D Offenberg | offenbrg@fondue.gsfc.nasa.gov |
| Hughes STX, NASA/GSFC/LASP | I get paid to stare into space. |
Re: Two Questions [message #4822 is a reply to message #4815] Tue, 08 August 1995 00:00 Go to previous message
davis is currently offline  davis
Messages: 15
Registered: March 1995
Junior Member
On Tue, 8 Aug 1995 16:24:20 -0400, Myron Brown <mbrown@olie.wvitcoe.wvnet.edu> wrote:
: Hi. I have two questions (that were not answered in the FAQ):
:
: 1. How do I declare global variables in IDL. I am used to writing in C and other such languages. Am I missing something, or shoul
:
: 2. How do I write programs in IDL using entities similar to C header files? I'd like to do things with some structure (not everyth

First of all, you need to get a text editor that:

1. Wraps text.
2. Does not have a 128 character line limit.

Almost any text editor will will meet these requirements.

--John
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: overlaying sat image on base map??
Next Topic: No forward_pro statement !!!!

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

Current Time: Wed Oct 08 15:52:37 PDT 2025

Total time taken to generate the page: 0.00436 seconds