;+ ; NAME: ; www_help_ptr ; PURPOSE: ; Manages 'calls' structure ; CATEGORY: ; www_help ; CALLING SEQUENCE: PRO www_help_ptr, calls, ithis, name, free=free ; INPUTS: ; calls heap variable ; OPTIONAL INPUT PARAMETERS: ; name list of header indices of procedures called by 'ithis' ; ithis index of header begin processed ; /free if set all heap variables are destroyed ; OUTPUTS: ; calls updated heap variable (destroyed if /free is set) ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; boost ; PROCEDURE: ; The entries into 'calls' are structures defined as follows ; *calls = {www_help_called, ; name:name, index of procedure header into 'header' array ; called_by:ptr_new(/allocate))} headers that have 'name' in their CALLS section. ; MODIFICATION HISTORY: ; FEB-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; Introduced another heap variable in the 'calls' structure. 'calls' ; is a heap variable containing an array of structures. Each ; structure element contains another heap variable. Cleaning up of ; all heap variable is now done by this procedure using keyword /free. ;- CASE keyword_set(free) OF 0: BEGIN IF name[0] EQ -1 THEN RETURN n = n_elements(name) ; # headers with module name 'name' CASE ptr_valid(calls) OF 0: BEGIN tmp = {www_help_called, name:name[0], called_by:ptr_new(/allocate_heap)} FOR i=1L,n-1 DO tmp = [tmp, {www_help_called, name:name[i], called_by:ptr_new(/allocate_heap)}] calls = ptr_new(tmp) loc = indgen(n) END 1: BEGIN called_names = (*calls).name loc = intarr(n) FOR i=0L,n-1 DO BEGIN loc[i] = (where(called_names EQ name[i]))[0] IF loc[i] EQ -1 THEN BEGIN tmp = {www_help_called, name:name[i], called_by:ptr_new(/allocate_heap)} *calls = [*calls,tmp] loc[i] = n_elements(*calls)-1 ENDIF ENDFOR END ENDCASE FOR i=0L,n-1 DO boost, *(*calls)[loc[i]].called_by, ithis ;FOR i=0L,n-1 DO BEGIN ; CASE n_elements( *(*calls)[loc[i]].called_by ) OF ; 0 : *(*calls)[loc[i]].called_by = ithis ; ELSE: BEGIN ; tmp = *(*calls)[loc[i]].called_by ; IF (where(ithis EQ tmp))[0] EQ -1 THEN *(*calls)[loc[i]].called_by = [tmp, ithis] ; END ; ENDCASE ;ENDFOR END 1: BEGIN ptr_free, (*calls).called_by ptr_free, calls END ENDCASE RETURN & END