Technical data

8. Documentation for Developers
Expressions
Expressions link values and operators to a new value. Such a value can be an normal variable,
an array element, or a constant (Number, string or version number). All string constants in
expressions are subject to variable substitution (Page 300).
Operators allow just about everything you could want from a programming language. A
test for the equality of two variables could look like this:
var1 == var2
"$var1" == "$var2"
It should be noted that the comparison is done depending on the type that was defined for
the variable in check/<PACKAGE>.txt. If one of the two variables is numeric (Page 300) the
comparison is made numeric-based, meaning that the strings are converted to numbers and
then compared. Otherwise, the comparison is done string-based; comparing "05" == "5" gives
the result “false”, a comparison "18" < "9" “true” due to the lexicographical string order: the
digit “1” precedes the digit “9” in the ASCII character set.
For the comparison of version numbers the construct numeric(version) is introduced, which
generates the numeric value of a version number for comparison purposes. Here applies:
numeric(version) := major * 10000 + minor * 1000 + sub
whereas “major” is the first component of the version number, “minor” the second and “sub”
the third. If “sub” is missing the term in the addition above is omitted (in other words “sub”
will be equalled to zero).
A complete list of all expressions can be found in table 8.3. “val” stands for any value of
any type, “number” for a numeric value and “string”for a string.
Table 8.3.: Logical Epressions
Expression true if
id id == “yes”
val == val values of identical type are equal
val != val values of identical type are unequal
val == number numeric value of val == number
val != number numeric value of val != number
val number numeric value of val number
val number numeric value of val number
val == version numeric(val) == numeric(version)
val version numeric(val) numeric(version)
val version numeric(val) numeric(version)
val =~ string regular expression in string matches val
( expr ) Expression in brackets is true
expr && expr both expressions are true
expr || expr at least one of both expressions is true
copy_pending(id) see description
samenet (string1, string2) string1 describes the same net as string2
subnet (string1, string2) string1 describes a subnet of string2
311