SPL to HP C/XL Migration Guide (30231-90001)

6-2
Table 6-2. GO TO Statement Examples
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
| | |
| 1. GO LABEL1; | 1. goto LABEL1; |
| GOTO LABEL1; | goto LABEL1; |
| GO TO LABEL1; | goto LABEL1; |
| | |
| 2. SWITCH SWITCHLABEL:=L0,L1,L2; | 2. #define SWITCHLABEL(X) \ |
| ... | switch (X) \ |
| GOTO SWITCHLABEL(JUMP); | { \ |
| | case 0: goto L0; \ |
| | case 1: goto L1; \ |
| | case 2: goto L2; \ |
| | } |
| | ... |
| | SWITCHLABEL(JUMP) ; |
| | |
---------------------------------------------------------------------------------------------
DO Statement
Table 6-3. DO Statement
---------------------------------------------------------------------------------------------
|||
| SPL | HP C/XL Equivalent |
|||
---------------------------------------------------------------------------------------------
|||
|
do-statement
: | Similar to SPL: |
|||
|DO
loop-statement
UNTIL
condition-clause
|do
loop-statement
|
|||
| | while ( ! (
condition-clause
)) |
|||
---------------------------------------------------------------------------------------------
|||
| The
loop-statement
(which may be compound) | The
loop-statement
(which may be compound) |
| is executed until the
condition-clause
| is executed until the expression after |
| becomes true. It is always executed at | while becomes false. It is always executed |
| least once. | at least once. |
|||
| | Note that this test is the reverse of the |
| | SPL version. As shown in the syntax above, |
| | the easiest conversion is to enclose the |
| | SPL
condition-clause
in parentheses, |
| | precede it with the logical NOT operator |
| | "!", and then add the outer parentheses |
| | required by HP C/XL. |
|||
| | You could also just invert the condition, |
| | if it's a simple one. For example, "==" |
| | would become "!=" and ">=" would become |
| | "<". |
|||
---------------------------------------------------------------------------------------------