GO TO Statement [ SPL to HP C/XL Migration Guide ] MPE/iX 5.0 Documentation
SPL to HP C/XL Migration Guide
GO TO Statement
Table 6-1. GOTO Statement
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
| goto-statement: | Similar to SPL: |
| | |
| 1. GO [TO] label | 1. goto label ; |
| | |
| 2. GO [TO] [*] switch-id ( index ) | 2. switch-id ( index ) ; |
| | |
---------------------------------------------------------------------------------------------
| | |
| | |
| 1. This syntax may transfer to a label | 1. Same as SPL, except that labels |
| in the current routine (main or | cannot be passed to functions. |
| procedure) or to a label outside a | Passed labels must be recoded, |
| procedure that was passed to the | perhaps as a function return value. |
| procedure as a parameter. | |
| 2. This syntax transfers to a label | 2. The SWITCH declaration should be |
| declared in a SWITCH declaration for | recoded as a #define macro |
| the current routine (main or | directive, as described in "SWITCH |
| procedure). The "*" option turns | Declaration" and "Local SWITCH |
| off bounds checking. | Declarations". Then the conversion |
| | syntax above will execute an HP C/XL |
| | switch transfer to the correct |
| | label. |
| | The SPL "*" option has no HP C/XL |
| | equivalent. Just delete it. |
| | |
---------------------------------------------------------------------------------------------
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) ; |
| | |
---------------------------------------------------------------------------------------------
MPE/iX 5.0 Documentation