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

Home » Public Forums » archive » Re: structure information
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: structure information [message #26475] Thu, 06 September 2001 14:33 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Todd Clements (mole6e23@hotmail.com) writes:

> Here's my entry!

Oh, shoot! Now that I don't have anything to do in
that huge slot of time I blocked out on the weekend,
I'll probably have to do the yard work I've been
putting off. :-(

But nice job, Todd. A hug and a kiss for sure,
next time I see you. :-)

Cheers,

David

P.S. Let's just say if the invitations ever get
back from the discount engravers, you might get
an invite to the big IDL Expert Programmers Association
bash this October. Rumor has it that the entertainment
is somebody BIG!

--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: structure information [message #26477 is a reply to message #26475] Thu, 06 September 2001 14:05 Go to previous messageGo to next message
Todd Clements is currently offline  Todd Clements
Messages: 23
Registered: January 2001
Junior Member
> Who can write this so that the print-out has
> the *names* of the fields listed, too?
>
> Let's see, my usual prize when my kids do something
> like this is a "hug and a kiss". But I've met a few
> of you .... Maybe a handshake and the user group's
> undying admiration.
>
> Deadline is Monday, Sept 10th, so work productivity
> doesn't push the world economy into a real recession.
>

Here's my entry!

Todd

; --------------- Begin code -------------------
pro test
a = {struct1, x: fltarr(512), y: fltarr(512)}
b = {struct2, z: fltarr(512), q: {struct1}}
c = {struct3, a: {struct2}, b: {struct1}}
d = {struct4, w: {struct3}, y: 4}


result = s_info( d )
for i=0l, n_elements(result)-1 do print, result[i]
end

function s_info, struct, recurse
if( size(struct, /type ) ne 8 ) then return, ''

if( n_elements( recurse ) eq 0 ) then recurse = 0

help, struct, /structure, out=out

structLocations = strpos( out, '->' )

ntags = n_tags( struct )

if( recurse gt 0 ) then $
spaces = string(replicate(byte(' '),3*recurse)) else spaces=''

outString = spaces + out[0]

for i=1, ntags do begin
outString = [outString, spaces+out[i] ]
if( structLocations[i] ne -1 ) then begin
result = s_info(struct.(i-1), recurse+1)
if( result[0] ne '' ) then outString = [outString, result]
endif
endfor

return, outString
end ;; s_info
; ----------------- End code -----------------------

Result of running test:

** Structure STRUCT4, 2 tags, length=10244:
W STRUCT -> STRUCT3 Array[1]
** Structure STRUCT3, 2 tags, length=10240:
A STRUCT -> STRUCT2 Array[1]
** Structure STRUCT2, 2 tags, length=6144:
Z FLOAT Array[512]
Q STRUCT -> STRUCT1 Array[1]
** Structure STRUCT1, 2 tags, length=4096:
X FLOAT Array[512]
Y FLOAT Array[512]
B STRUCT -> STRUCT1 Array[1]
** Structure STRUCT1, 2 tags, length=4096:
X FLOAT Array[512]
Y FLOAT Array[512]
Y INT 4
Re: structure information [message #26485 is a reply to message #26477] Thu, 06 September 2001 10:06 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Markus Reichstein (markus.reichstein@uni-bayreuth.de) writes:

> can I get recursive information about structures in IDL? (In PV-WAVE
> you can do this with info, <varname>, /struct, /full) But in IDL I
> only get one hierarchical level.

Now here is contest material, for sure!

Who can write this so that the print-out has
the *names* of the fields listed, too?

Let's see, my usual prize when my kids do something
like this is a "hug and a kiss". But I've met a few
of you .... Maybe a handshake and the user group's
undying admiration.

Deadline is Monday, Sept 10th, so work productivity
doesn't push the world economy into a real recession.

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: structure information [message #26548 is a reply to message #26475] Fri, 07 September 2001 14:10 Go to previous message
Phillip David is currently offline  Phillip David
Messages: 36
Registered: April 1999
Member
David Fanning wrote:
> ... you might get
> an invite to the big IDL Expert Programmers Association
> bash this October. Rumor has it that the entertainment
> is somebody BIG!

How big? I know one person who might do it. Last I checked, he weighed
over 500 lbs. :-)
Re: structure information [message #26572 is a reply to message #26475] Thu, 06 September 2001 20:46 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
> But nice job, Todd. A hug and a kiss for sure,
> next time I see you. :-)

And the group's undying admiration!

As someone used to say, "For that and $1 you could buy a cup of coffee."

---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield
National Institute for Water and Atmospheric Research



--
Posted from clam.niwa.cri.nz [202.36.29.1]
via Mailgate.ORG Server - http://www.Mailgate.ORG
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Problem combining structures
Next Topic: Re: call_method

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

Current Time: Wed Oct 08 15:36:30 PDT 2025

Total time taken to generate the page: 0.00739 seconds