-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_tag.pro
66 lines (59 loc) · 1.61 KB
/
add_tag.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
PRO add_tag, struct, tagname, tagtype, newstr, structyp=structyp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;+
;
; NAME:
; ADD_TAG
;
; PURPOSE:
; Add a new tag to the structure. NOTE: if you want to add more
; than one tag at once, use ADD_TAGS
;
; CALLING SEQUENCE:
; add_tag, oldstruct, tagname, tagtype, newstruct, structyp=structyp
;
; INPUTS:
; oldstruct: The original structure (or array of structures)
; tagname: string containing the new tag name
; tagtype: the initial value of the new tag, e.g. fltarr(5)
; or [3,5,6], or 0L, etc.
;
; KEYWORD PARAMETERS:
; structyp: a string with the name of the new structure.
; if already defined the program will crash.
;
; OUTPUTS:
; newstruct: The structure with the new tag it it.
;
; OPTIONAL OUTPUT
; NONE
;
; CALLED ROUTINES:
; COMBINE_STRUCTS
;
; PROCEDURE:
;
;
;
; REVISION HISTORY:
; 25-OCT-2000, Judith Racusin.
;
;
;-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF n_params() LT 3 THEN BEGIN
print,'Syntax - add_tag,struct, tagname, tagtype, newstr, structyp=structyp'
print,'Use doc_library,"add_tag" for more help.'
return
END
t=tag_names(struct)
w=where(t EQ strupcase(tagname),nw)
IF nw NE 0 THEN BEGIN
print,'Tag ',tagname,' Already Exists'
return
END
tmpstr=create_struct(tagname,tagtype)
tmpstr=replicate(tmpstr,n_elements(struct))
combine_structs,struct,temporary(tmpstr),newstr, structyp=structyp
return
END