;+ ; NAME: ; ; UNDEF ; ; PURPOSE: ; ; Undefine up to 64 variables at a time, releasing any associated ; heap data stored within them. ; ; CATEGORY: ; ; Utility ; ; CALLING SEQUENCE: ; ; undef,var1,[var2,...,var64] ; ; INPUTS: ; ; varN: Variables to remove. ; ; SIDE EFFECTS: ; ; The named variables are removed from the list of variables at the ; calling level, and any heap data (objects or pointer data) stored ; within them is freed, and their associated memory is freed. ; ; RESTRICTIONS: ; ; Will free any heap data associated with subscripted array members ; or structure field members passed, but will not remove them from ; their parent arrays or structures. Only full, named variables -- ; those which are "passed by reference" as procedure arguments -- ; can be 'undefined'. ; ; MODIFICATION HISTORY: ; ; 2004 (J.D. Smith): Written ;- ;############################################################################# ; ; LICENSE ; ; Copyright (C) 2004-2010 J.D. Smith ; ; This file is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published ; by the Free Software Foundation; either version 2, or (at your ; option) any later version. ; ; This file is distributed in the hope that it will be useful, but ; WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ; General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this file; see the file COPYING. If not, write to the ; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ; Boston, MA 02110-1301, USA. ; ;############################################################################## pro undef,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20, $ v21,v22,v23,v24,v25,v26,v27,v28,v29,v30,v31,v32,v33,v34,v35,v36,v37,v38, $ v39,v40,v41,v42,v43,v44,v45,v46,v47,v48,v49,v50,v51,v52,v53,v54,v55,v56, $ v57,v58,v59,v60,v61,v62,v63,v64 for i=1,n_params() do begin name='v'+strtrim(i,2) if n_elements(scope_varfetch(name)) eq 0 then continue heap_free,scope_varfetch(name) void=temporary(scope_varfetch(name)) endfor end