Conditional expressions

Tarma Installer allows the use of conditional expressions in many places. The conditional expression syntax is defined as follows; this also defines (implicitly) the order of precedence of the various constructs. You can override the order of precedence by enclosing a term in parentheses.

value	::= symbol | literal | integer
relop	::= < | <= | > | >= | = | <> | >< | << | >> | ~relop
term	::= value | value relop value | ( imp-term )
not-term	::= term | NOT term
and-term	::= not-term | not-term AND and-term
or-term	::= and-term | and-term OR or-term
xor-term	::= or-term | or-term XOR xor-term
eqv-term	::= xor-term | xor-term EQV eqv-term
imp-term	::= eqv-term | eqv-term IMP imp-term
symbol	::= varname | varref | %envvar | $compname | ?compname | &featname | !featname
literal	::= "...any text..."
integer	::= ...sequence of decimal digits... | 0x...sequence of hexadecimal digits...
varname	::= ...name of a symbolic variable (case-insensitive)...
varref	::= ...symbolic expression enclosed in < and > (case-insensitive)...
envvar	::= ...environment variable name (case-insensitive)...
compname	::= ...component name (case-insensitive)...
featname	::= ...feature name (case-insensitive)...

Symbolic expressions

Tarma Installer allows the use of all symbolic expressions as part of conditional expressions. You can therefore also perform registry and INI file lookup (<@reg_path> and <#file?section?value>), retrieve file paths (<#file_alias>), and execute symbolic functions such as $fverpcmp as part of conditional expressions. It also means that the following are equivalent for Tarma Installer:

Note: To prevent confusion between symbolic expressions and some of the relational operators, you should place spaces on either side of a relational operator. For example, use TsuStatus < 0 rather than TsuStatus<0.

Logical operators

The following logical operators are defined. Their names are case-insensitive.

Operator Meaning
NOT Negates the value of its operand.
AND True if both operands are True.
OR True if at least one of its operands is True.
XOR True if exactly one of its operands is True.
EQV True if its operands are both True or both False.
IMP True if its left operand is False or its right operand is True.

Relational operators (relop)

The following relational operators are defined. Their meaning depends on the type of their operands:

This means, for example, that the expression TsuRunMode > 0 is evaluated with an integer comparison, while TsuRunMode > "0" uses a string comparison.

Operator Version Integer String
< True if the left operand is a lower version number than the right operand. True if the left operand is numerically less than the right operand. True if the left operand sorts before the right operand.
<= True if the left operand is a lower than or equal version number as the right operand. True if the left operand is numerically less than or equal to the right operand. True if the left operand sorts before or is equal to the right operand.
> True if the left operand is a higher version number than the right operand. True if the left operand is numerically greater than the right operand. True if the left operand sorts after the right operand.
>= True if the left operand is a higher than or equal version number as the right operand. True if the left operand is numerically greater than or equal to the right operand. True if the left operand sorts after or is equal to the right operand.
= True if the left operand is the same version number as the right operand. True if the left operand is equal to the right operand. True if the left operand is equal to the right operand.
<> True if the left operand is a different version number than the right operand. True if the left operand is not equal to the right operand. True if the left operand is not equal to the right operand.
>< Not supported True if the left and right operands have any bits in common (binary AND). True if the left operand contains the right operand.
<< Not supported True if the 16 most significant bits of the (32-bit) left operand are equal to the right operand (HIWORD). True if the left operand starts with the right operand.
>> Not supported True if the 16 least significant bits of the left operand are equal to the right operand (LOWORD). True if the left operand ends with the right operand.
~ (as prefix) Not supported Not supported Makes the comparison case-insensitive.

Symbol prefixes

The following prefixes can be used on symbol items.

Symbol prefix Operand Result
% Name of environment variable Value of the environment variable
$ Name of component Component action (see below)
? Name of component Component state (see below)
& Name of feature Feature action (see below)
! Name of feature Feature state (see below)

The following values are returned for the component and feature actions and states:

Value Action State
-1 No action State is unknown
1 Feature will be advertised Feature is advertised
2 Component/feature will be removed Component/feature is not present
3 Component/feature will be installed locally Component/feature is installed locally
4 Component/feature will be installed to run from source Component/feature runs from source