Condition Clauses [ SPL to HP C/XL Migration Guide ] MPE/iX 5.0 Documentation
SPL to HP C/XL Migration Guide
Condition Clauses
Table 5-26. Condition Clauses
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
| condition-clause: | condition-clause: |
| | |
| cond-term [{AND | cond-term [{&& |
| OR} cond-term][...] | ||} cond-term][...] |
| | |
---------------------------------------------------------------------------------------------
| | |
| cond-term is one of: | cond-term is one of: |
| | |
| cond-primary | cond-primary |
| (cond-primary [OR cond-primary][...]) | (cond-primary [|| cond-primary][...]) |
| | |
---------------------------------------------------------------------------------------------
| | |
| cond-primary is one of: | Only logical-expression is permitted. |
| | |
| logical-expression | |
| branch-word | |
| | |
---------------------------------------------------------------------------------------------
| | |
| branch-word is one of: | No equivalent. |
| | |
| CARRY NOCARRY OVERFLOW NOOVERFLOW IABZ | These refer to MPE V hardware constructs |
| DABZ IXBZ DXBZ < <= <> = > >= | and must be recoded. |
| | |
| | Some condition code testing is possible |
| | with the HP C/XL function ccode. See the |
| | HP C/XL Library Reference Manual for |
| | details. |
| | |
---------------------------------------------------------------------------------------------
| | |
| In tests for true and false, an odd value | A nonzero value is true; a zero value is |
| is true (bit 15 is on); an even value is | false. |
| false (bit 15 is off). | |
| | |
---------------------------------------------------------------------------------------------
Condition clauses in SPL may appear in IF expressions and in IF, DO, and
WHILE statements.
The SPL hardware branch words (CARRY, NOCARRY, etc.) test hardware
registers built into the MPE V-based architecture. These
hardware-dependent constructs will have to be rewritten using the
intrinsic library routines.
Logical expressions may be combined using AND and OR. These Boolean
operators generate branches to optimize runtime performance by suspending
evaluation of an expression as soon as it is determined to be true or
false. That is, as soon as any logical expression combined with AND is
found to be false, the false branch is taken immediately.
SPL programmers use this feature, aware of the possible differences in
side effects as a result of incomplete evaluation of a condition clause.
The SPL AND operator has a higher precedence than OR. This precedence can
be overridden by parentheses. However, parentheses cannot be placed
around items combined by the AND operator.
In HP C/XL, the "logical AND" operator is "&&". and the "logical OR"
operator is "||". These are identical to the SPL AND and OR
respectively, including the rules of precedence and partial evaluation.
HP C/XL does not restrict parentheses around "&&".
CAUTION In SPL, the Boolean value of a logical expression is determined
only by bit 15 of the value. If bit 15 is on, the expression is
true. If bit 15 is off, the expression is false.
In HP C/XL, the Boolean value of a logical expression is
determined by its numeric value. If it is nonzero, the value is
true. If it is zero, the value is false.
Since a logical expression may be the result of numeric and
logical as well as Boolean operations, you must be careful in
converting it. See "Logical Expressions" above for further
details.
MPE/iX 5.0 Documentation