PRO POINTER_SETGETV5, POINTER, VALUE, SET=SET, NO_COPY=NO_COPY ;+ ; NAME: ; POINTER_SETGETV5 ; ; PURPOSE: ; Get or set the value of an existing pointer under IDL5 only. ; ; This is a service routine which is called by POINTER_VALUE, which ; performs the same function but runs under both IDL5 and IDL4. ; POINTER_SETGETV5 is not intended to be called directly. ; ; CATEGORY: ; Pointers ; ; CALLING SEQUENCE: ; POINTER_SETGETV5, POINTER, VALUE ; ; INPUTS: ; POINTER Pointer variable ; VALUE When setting a pointer value, the variable which is to be ; assigned to the pointer. ; ; OPTIONAL INPUTS: ; None. ; ; INPUT KEYWORD PARAMETERS: ; SET If set, causes the pointer value to be set ; (default is to get the pointer value). ; NO_COPY If set, the source value is attached directly to the ; destination value, and the source value becomes undefined ; (default is to copy the source value to the destination ; value, without affecting the source value). ; ; OUTPUT KEYWORD PARAMETERS: ; None. ; ; OUTPUTS: ; VALUE When getting a pointer value (the default), a named variable ; in which the value is returned. ; ; OPTIONAL OUTPUTS: ; None. ; ; COMMON BLOCKS: ; None. ; ; SIDE EFFECTS: ; ; RESTRICTIONS: ; POINTER must be a valid pointer. ; ; EXAMPLE: ; This routine is not intended to be called directly. ; ; MODIFICATION HISTORY: ; Liam.Gumley@ssec.wisc.edu ; $Id: pointer_setgetv5.pro,v 1.2 1999/06/15 15:15:32 gumley Exp $ ;- rcs_id = '$Id: pointer_setgetv5.pro,v 1.2 1999/06/15 15:15:32 gumley Exp $' ;- Check arguments if n_params() ne 2 then message, 'Usage: POINTER_SETGETV5, POINTER, VALUE' if n_elements(pointer) eq 0 then message, 'Argument POINTER is undefined' if n_elements(pointer) gt 1 then message, 'Argument POINTER must be a scalar' ;- Check pointer validity if not pointer_valid(pointer) then $ message, 'Argument POINTER is invalid' ;- Get or set the pointer value case set of ;- Get the pointer value 0 : begin if n_elements(*pointer) eq 0 then message, 'POINTER value is undefined' case no_copy of 0 : value = *pointer else : value = temporary(*pointer) endcase end ;- Set the pointer value else : begin if n_elements(value) eq 0 then message, 'VALUE is undefined' case no_copy of 0 : *pointer = value else : *pointer = temporary(value) endcase end endcase END