-
Notifications
You must be signed in to change notification settings - Fork 0
/
undefine_fhd.pro
39 lines (38 loc) · 1.33 KB
/
undefine_fhd.pro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
PRO undefine_fhd,param,param1,param2,param3,param4,param5,param6,param7,param8,param9,level=level
;program to delete fhd pointers, particularly the mapping functions
;note: this works just fine even if undefined parameters are supplied
IF N_Elements(level) EQ 0 THEN level_use=0 ELSE level_use=level+1
np=N_Params()
SWITCH np OF
10:undefine_fhd,param9
9:undefine_fhd,param8
8:undefine_fhd,param7
7:undefine_fhd,param6
6:undefine_fhd,param5
5:undefine_fhd,param4
4:undefine_fhd,param3
3:undefine_fhd,param2
2:undefine_fhd,param1
1:BEGIN
type=size(param,/type)
IF type EQ 8 THEN BEGIN ;structure type
FOR t_i=0L,N_tags(param)-1 DO BEGIN
type1=size(param.(t_i),/type)
IF (type1 EQ 8) OR (type1 EQ 10) THEN undefine_fhd,param.(t_i),level=level_use
ENDFOR
ENDIF
IF type EQ 10 THEN BEGIN ;pointer type
ptr_i=where(Ptr_valid(param),n_valid)
FOR p_i=0L,n_valid-1 DO BEGIN
type1=size(*param[ptr_i[p_i]],/type)
IF (type1 EQ 8) OR (type1 EQ 10) THEN undefine_fhd,*param[ptr_i[p_i]],level=level_use
ENDFOR
ptr_free,param
ENDIF
IF level_use EQ 0 THEN BEGIN
param=0
dummy=Temporary(param)
ENDIF
END
ENDSWITCH
END