3 defining a field with variable length, Defining a field with variable length – Teledyne LeCroy UWBTrainer Exerciser Script Language User Manual
Page 24

LeCroy Corporation
UWBTrainer Exerciser - Generation Script Language Reference Manual
16
8.2.3 Defining a Field with Variable Length
If the field length is set to
*
, then the field’s length is defined by the value that is assigned to the
field. If no value is assigned to the variable length field, then the field’s length is set to 0.
Note: When a value is assigned to a variable length field, then the field's length is changed based
on the difference between the previous and current values. In this case, the offsets of following
fields not bound to fixed offsets are shifted by the difference.
Examples
# Declare frame template 'SomeTemplate'.
Frame
Some Template
{
F1 :
16
# Declare the 16-bit field 'F1' at offset 0.
F2 :
32
# Declare the 32-bit field 'F2' at offset 16.
Data :
*
# Declare the variable-length field 'Data'. The field
# length is now 0.
FCS :
32
# Declare the 32-bit field 'FCS' at offset 16+32.
}
# Declare frame template 'SomeTemplate1', inheriting fields from
# 'SomeTemplate'.
Frame
Some Template1 : Some Template
{
Data =
0xAABB
# Assign a value to the 'Data' field.
# Now the field has length 16 bits and the
# field 'FCS' offset is shifted by 16 bits = 16+32+16.
}