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

Home » Public Forums » archive » Including files/eps into PS
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: Including files [message #15510 is a reply to message #11442] Tue, 25 May 1999 00:00 Go to previous messageGo to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
J.D. Smith wrote:
>
> [...]

> That is, you must use:
>
> common cblock, var1, var2, var3, var4, ...
>
> everywhere instead of:
>
> common cblock
>
> Normally this is a real pain, since changing the common block requires
> changing all of its definition statements. However, if you put the
> definition in one file and simply do a:
>
> @cblock
>
> at the beginning of all relevant procedures, you can change your common
> block in one place and still not require an initializer.

This is not quite right. You will have to make sure that your common
block gets initialized correctly! For IDL, a common block at the
beginning is nothing else than a list of variable names. The first
procedure that uses these variables determines their type and
dimensions. Once these are set, you have to exit your IDL session and
restart if you want to make any changes. Unless you are certain that it
is always the same procedure that makes first use of the common block
variables, you are in great danger of trapping into conflicting variable
declarations (implicit definitions that is).

Of course ;-) I can also offer you a solution which is to include a
default definition in your include file as well, such as:

----------------------------------------------------
; myinclude.pro === note, this is not a procedure
common bla,var1,var2,svar

if (n_elements(var1) eq 0) then begin
var1 = fltarr(100)
var2 = 100L
svar = ''
endif
----------------------------------------------------

Then, regardles which procedure uses your include (myinclude that is
;-), you will always have the same type and dimension for each variable.


> Of course,
> eliminating the common block is another good solution,
a much better one, I should say!

> but sometimes
> this can't be done.
also true. ;-)

>
> This technique can be extended to other areas also, such as common error
> checking code, etc.
>
> Good Luck,
>
> JD
>
> --
> J.D. Smith |*| WORK: (607) 255-5842
> Cornell University Dept. of Astronomy |*| (607) 255-6263
> 304 Space Sciences Bldg. |*| FAX: (607) 255-5875
> Ithaca, NY 14853 |*|


I really like participating in this newsgroup to get me started in the
morning!
Regards,
Martin.


--

|||||||||||||||\\\\\\\\\\\\\-------------------///////////// //|||||||||||||||
Martin Schultz, DEAS, Harvard University, 29 Oxford St., Pierce 109,
Cambridge, MA 02138 phone (617) 496 8318 fax (617) 495 4551
e-mail mgs@io.harvard.edu web http://www-as/people/staff/mgs/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: When you can't concatenate structures like you expect....
Next Topic: Re: Hex constants interpreted differently in IDL/v5.2

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

Current Time: Sat Oct 11 01:12:33 PDT 2025

Total time taken to generate the page: 2.32010 seconds