coyote: UNDEFINE

NAME
UNDEFINE
PURPOSE
The purpose of this program is to delete or undefine
an IDL program variable from within an IDL program or
at the IDL command line. It is a more powerful DELVAR.
Pointer and structure variables are traversed recursively
to undefine any variables pointed to in the pointer or in
a structure dereference.
AUTHOR
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1642 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
CATEGORY
Utilities.
CALLING SEQUENCE
UNDEFINE, variable
REQUIRED INPUTS
variable: The variable to be deleted. Up to 10 variables may be specified as arguments.
SIDE EFFECTS
The variable no longer exists.
EXAMPLE
To delete the variable "info", type:
 IDL> Undefine, info
 IDL> var = ptr_new({a:ptr_New(5), b:findgen(11), c: {d:ptr_New(10), f:findgen(11)}})
 IDL> Help, /Heap
 Heap Variables:
     # Pointer: 3
     # Object : 0
    LONG      =            5
    LONG      =            10
    STRUCT    = ->  Array[1]
 IDL> Undefine, var
 IDL> Help, /Heap
 Heap Variables:
     # Pointer: 0
     # Object : 0
 IDL> Help, var
  VAR               UNDEFINED = 
MODIFICATION HISTORY
Written by David W. Fanning, 8 June 97, from an original program
given to me by Andrew Cool, DSTO, Adelaide, Australia.
Simplified program so you can pass it an undefined variable. :-) 17 May 2000. DWF
Simplified it even more by removing the unnecessary SIZE function. 28 June 2002. DWF.
Added capability to delete up to 10 variables at suggestion of Craig Markwardt. 10 Jan 2008. DWF.
If the variable is a pointer, object or structure reference the variable is recursively traversed
   to free up all variables pointed to before the variable is itself destroyed. 10 June 2009. DWF.
Updated to allow undefining of pointer arrays. 8 October 2009. DWF.
Valid pointers that point to undefined variable can cause an infinite loop. Now using
    Heap_Free, rather than recursion, with pointers. 30 May 2013. DWF.