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

Home » Public Forums » archive » Pointer Help - Referencing/Dereferencing in Functions & Procedures
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Pointer Help - Referencing/Dereferencing in Functions & Procedures [message #34371] Wed, 12 March 2003 12:40 Go to previous message
Patrick Serengulian is currently offline  Patrick Serengulian
Messages: 2
Registered: March 2003
Junior Member
I'm new to this concept of newsgroups as well as the IDL language. I've been
studying and writing IDL code for only six weeks. I have read L. Gumley's
book 'Practical IDL Programming' cover to cover and still can't figure out
what to do about pointers. From a co-worker, I borrowed Dr. Fanning's book,
'IDL Programming Techniques' and still no luck on the issue of
referencing/dereferencing pointers.

I want to create a pointer in $MAIN$, reference and update the pointer in a
function or procedure, return to $MAIN$ and echo the new value of the
pointer. Here is the code I have written:

PRO NUMBER_PROC
; store 5L in the memory location that number_ptr is pointing to
*number_ptr = 5L
END

;
; $MAIN$
;

; create number pointer using allocate heap
number_ptr = ptr_new(/allocate_heap)

; echo pointer information
print, 'Pointer created and this is the help info:'
help, *number_ptr

; store 17L in the mem location of the number pointer
*number_ptr = 17L

; call procedure to have pointer store a new number in the mem location
number_proc

; echo pointer information
print, *number_ptr
help, *number_ptr, number_ptr

; destroy the pointer if it's still valid
if ( ptr_valid(number_ptr) EQ 1 ) then ptr_free, number_ptr

END

That's it. It compiles fine and then when I run the program, execution halts
and I get the message "% Pointer type required in this context: NUMBER_PTR"

What am I doing wrong? I looked at a widget example from Gumley that uses
pointers and it's almost identical in terms of how the pointer is
dereferenced. Any information on how to correct this issue would be useful.
Thank you.

Patrick Serengulian
Software Engineer,
U.S. Naval Research Laboratory,
Space Science Division,
Washington, D.C.
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Pointer Help - Referencing/Dereferencing in Functions & Procedures
Next Topic: Re: IDL video memory vs. MS Windows Terminal Services

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

Current Time: Fri Oct 10 07:15:05 PDT 2025

Total time taken to generate the page: 1.76080 seconds