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

6-1
Chapter 6 Program Control Statements
This chapter discusses conversion issues that correspond to sections in
Chapter 5 of the
Systems Programming Language Reference Manual
.
Program Control
SPL has nine basic methods of altering the normal sequential execution
of instructions: CASE, DO, FOR, GOTO, IF, RETURN, and WHILE statements,
and procedure and subroutine call statements.
HP C/XL has equivalents for all these control statements, with some
variations in syntax. In general, HP C/XL provides more options and
control than SPL.
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. |
| | |
---------------------------------------------------------------------------------------------