STRUCTINFO Procedure
Gathers information about the tags of a PV-WAVE structure variable.
Usage
STRUCTINFO, struct
Input Parameters
struct—An instance of a PV-WAVE structure variable.
Returned value
None.
Keywords
Ntags—Returns the number of tags found in the structure. This number can vary for a given structure depending on whether the Levels keyword is used.
Levels—Returns an Ntags-length array of integers indicating the structure depth of the corresponding tag in the Tagnames array. The depth of tags in the top-level structure is 1 with this number increasing with each level of structure nesting. If this keyword is not present, then the Ntags value reflects only the tags in the top-level structure and nested structures are not examined.
Tagnames—Returns an Ntags-length string array containing all of the tag names in the order in which they appear in a depth-first search of the structure, and, if the Levels keyword is present, any nested structures.
Structnames—Returns an Ntags-length string array containing all of the structure names corresponding to the tags in the Tagnames array.
Tagtypes—Returns an Ntags-length array of integers containing the PV‑WAVE data type code for each corresponding tag in the Tagnames array. The type codes are shown below (the PV‑WAVE designation is shown in parentheses).
*0—Undefined
*1—Byte (BYTE)
*2—Integer (INT)
*3—Longword integer (LONG)
*4—Floating point (FLOAT)
*5—Double precision floating (DOUBLE)
*6—Complex single-precision floating (COMPLEX)
*7—String (STRING)
*8—Structure
*9—UPVAR (the variable type pointed to by UPVAR)
*10—List (LIST)
*11—Associative array (ASARR)
*12—Complex double-precision floating (DCOMPLEX)
*13—32-bit integer (INT32)
Discussion
Other compound data types such as LIST and ASARR are treated like normal, non-structure tags and not searched.
Example
a={ struct1, t1:0.0, t2:{ struct2, t2_1:LISTARR(10), $
   t2_2:{ , t2_2_1:0.0} } , t3: 23i}
STRUCTINFO,a, Ntags=ntags, TagTypes=types, Tagnames=tnames, $
   Structnames=snames
PRINT, ntags
; PV-WAVE prints: 3
PRINT, types
; PV-WAVE prints: 4     8     13
PRINT, tnames
; PV-WAVE prints: T1 T2 T3
PRINT, snames
; PV-WAVE prints: STRUCT1 STRUCT1 STRUCT1
STRUCTINFO,a, Ntags=ntags, Tagtypes=types, Tagnames=tnames, $
   Levels=levels, Structnames=snames
PRINT, ntags
; PV-WAVE prints: 6
PRINT, types
; PV-WAVE prints: 4     8     10     8     4     13
PRINT, tnames
; PV-WAVE prints: T1 T2 T2_1 T2_2 T2_2_1 T3
PRINT, levels
; PV-WAVE prints: 1       1       2       2       3       1
PRINT, snames
; PV-WAVE prints: STRUCT1 STRUCT1 STRUCT2 STRUCT2 $1 STRUCT1