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

Home » Public Forums » archive » Re: Named and Anonymous structures ?
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: Named and Anonymous structures ? [message #5111] Mon, 09 October 1995 00:00
rivers is currently offline  rivers
Messages: 228
Registered: March 1991
Senior Member
In article <DG1EBF.FrJ@rivm.nl>, robk@rivm.nl (Rob Koopman) writes:
> I could use a refreshing idea to get me out of a problem related to
> structures in IDL:
>
> I must read binary data with variable format and had no problem to
> write an extraction programme that reads one file per IDL session,
> but my main problem now is that named structures cannot be changed once
> defined, and at the same time, anonymous structures (which can be
> changed) cannot be part of other anonymous structures.

I just ran a test under IDL 4.0.1 and created an anonymous structure which
contained another anonymous structure. I seem to recall that that limitation
was lifted some time ago. I think you need to upgrade to a more recent
release of IDL.

____________________________________________________________
Mark Rivers (312) 702-2279 (office)
CARS (312) 702-9951 (secretary)
Univ. of Chicago (312) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars3.uchicago.edu (Internet)
Re: Named and Anonymous structures ? [message #5113 is a reply to message #5111] Mon, 09 October 1995 00:00 Go to previous message
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
In article <DG1EBF.FrJ@rivm.nl>, robk@rivm.nl (Rob Koopman) writes:
|>
[snip]
|> struc3 = { made_to_measure_struc,
|> first_array: fltarr(number_of_rows, 10), $ ; dynamic
|> another_arr: intarr(number_of_rows, 25), $ ; arrays
|> };
|>
|> array_of_struc3s = replicate({file_specific_struc},struc2.nmbr_o_records)
|> readu,unit,array_of_struc3s
|> free_lun,unit
|> struc_back_to_main = { pret_a_porter_struc $
|> first: struc1 , $
|> secnd: struc2 , $
|> (3): ...... , $
|> (4): ...... , $
|> fifth: array_of_struc3s , $
|> (6): ...... $
|> };
|> end
|> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;
|>
|>
|> But here's my problem. I can make "struc_back_to_main" an anonymous
|> structure, and this allows me to read files with different "nmr_o_records"
|> but as soon as there's a file with a different "number_of_rows" I'm in
|> trouble: "struc3" should then also be anonymous, but unfortunately
|> anonymous structures cannot be part of other anonymous structures
|> as I've just found out after writing several main programs that call
|> this procedure :-(
|> Once this struc_back_to_main is passed to the caller, struc3
|> can be destroyed, as far as I'm concerned, but the only way I've
|> managed to do that, is by exiting the IDL session.
|>
|> Is there another way to destroy named structures?

As far as I can tell (haven't had too much experience with version 4.0),
there's only one solution (other than rewriting your code substantially
with your own storage allocation system):

Use:

dymmy=execute( $
"struc3={made_to_measure_" + trim(number_of_rows) + "," +$
"first_array: fltarr(number_of_rows, 10),"+ $ ; dynamic
"another_arr: intarr(number_of_rows, 25) }" $ ; arrays
)

where trim(N) \equiv strcompress(string(N),/remove_all)

This will give you named structures e.g., "MADE_TO_MEASURE_100"
for storing 100 rows, and "...._200" for storing 200 rows.

Stein Vidar
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: X-windows black on white
Next Topic: X-windows black on white

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

Current Time: Thu Oct 09 07:54:46 PDT 2025

Total time taken to generate the page: 1.36132 seconds