TAG_ADD
Name
TAG_ADD
Purpose
Add or update a tag in a structure or hash.
Category
Calling Sequence
tag_add, ss, tag, val
Inputs
ss = given structure or hash. in
Created if undefined.
tag = given tag or key. in
May be a compound tag or key, like
'aaa.bbb.ccc' to allow a nested
value to be added or modified.
The word tag means tag or key below.
val = Value for tag or key. in
The new value may be a different data type from the old
(but not if /ARRAY is used).
Keyword Parameters
Keywords
/ARRAY If tag already exists in the structure then insert
val as the next element in an array for that tag.
Otherwise just replace the old value with the new.
If this keyword is used the new value must be compatible
with the old value to avoid a type conversion error.
MINLEN=mn Minimum tag length to match (def=exact match).
SS may have the tag abbreviated down to mn characters.
(But tag must be at least as long as appears in ss).
AFTER=aft If tag is new then add it after tag aft.
aft='^' to add at front, aft='$' to add at end (default).
This keyword is ignored if the tag is in the structure,
in which case it is updated with the new value.
For a compound tag this keyword applies to the tags at
the target level of nesting, aft is always a single tag.
This keyword is ignored for a hash.
FLAG=flag 0=added, 1=updated.
/NEWHASH If the input ss is undefined then create it as
a hash instead of the default structure.
Outputs
Common Blocks
Notes
Notes: If ss does not contain the tag it is added.
GIVEN TAG MUST BE AS BIG OR BIGGER than the tag to match
in ss or it will be considered a new tag and added.
Modification History
R. Sterner, 2006 Sep 27
R. Sterner, 2007 Dec 18 --- Upgraded to not require matching type.
R. Sterner, 2007 Dec 18 --- Added keyword AFTER=aft.
R. Sterner, 2008 Nov 20 --- New structure created if undefined.
R. Sterner, 2011 Sep 14 --- Added /ARRAY.
R. Sterner, 2012 Oct 09 --- Now handles compound tags to work at depth.
R. Sterner, 2012 Oct 09 --- Now handles hashes, structures, or mixed.
Copyright (C) 2006, Johns Hopkins University/Applied Physics Laboratory
This software may be used, copied, or redistributed as long as it is not
sold and this copyright notice is reproduced on each copy made. This
routine is provided as is without any express or implied warranties
whatsoever. Other limitations apply as described in the file disclaimer.txt.