The uselogic attribute

The uselogic attribute of the <description> element allows you to define more complex logical relations among multiple descriptors than are available with the default combining method described in the previous section.

HCL ZIETrans adds a default uselogic attribute to the <description> tag when you record the macro. It will be regenerated if you edit the macro in the host terminal or in the macro editors. It will not be regenerated if you edit the macro in the source view.

Note: If you use the uselogic attribute, then the macro runtime ignores the invertmatch and Optional attributes in the individual descriptors.
The value of the uselogic attribute is a simplified logical expression whose terms are 1-based indexes of the descriptors that follow. Figure 1 shows an example of a <description> element that contains a uselogic attribute (some of the attributes of the <string> element are omitted for clarity):
Figure 1. Example of the uselogic attribute of the <description> element
<description uselogic="(1 and 2) or (!1 and 3)" />
   <oia status="NOTINHIBITED" optional="false" invertmatch="false"/>
   <string value="&apos;Foreground&apos; row="5" col="8"/>
   <cursor row="18" col="19" optional="false" invertmatch="false"/>
</description>
In Figure 1, the value of the uselogic attribute is:
(1 and 2) or (!1 and 3)
This logical expression is not a regular logical expression (as described in Conditional and logical operators and expressions) but rather a simplified style of logical expression used only in the uselogic attribute. The rules for this style of logical expression are:
  • The numerals 1, 2, 3, and so on stand for the boolean results of, respectively, the first, second, and third descriptors in the <description> element (<oia>, <string>, and <cursor> in the figure above). You can use any numeral for which a corresponding descriptor exists. For example, if a <description> element has seven descriptors, then you can use 7 to refer to the boolean result of the seventh descriptor, 6 to refer to the boolean result of the sixth descriptor, and so on.
  • Only the following logical operators are allowed:
    Table 1. Logical operators for the uselogic attribute
    Operator: Meaning:
    and Logical AND
    or Logical OR (inclusive)
    ! Logical NOT (inversion)
  • You can use parentheses () to group terms.
  • The following entities are not allowed:
    • Arithmetic operators and expressions
    • Conditional operators and expressions
    • Variables
    • Calls to Java™ methods
In the example in Figure 1 the macro runtime will determine that the description as a whole is true if one of the following occurs:
  • The result of the first descriptor is true and the result of the second descriptor is true (1 and 2)
  • The result of the first descriptor is false and the result of the third descriptor is true (!1 and 3)

Remember that if you use the uselogic attribute, then the macro runtime ignores the invertmatch and the Optional attribute settings in the individual descriptors.