HP 3000 Manuals

SWITCH Declaration [ SPL to HP C/XL Migration Guide ] MPE/iX 5.0 Documentation


SPL to HP C/XL Migration Guide

SWITCH Declaration 

          Table 4-6.  SWITCH Declaration 

---------------------------------------------------------------------------------------------
|                                             |                                             |
|                     SPL                     |             HP C/XL Equivalent              |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| switch-declaration:                         | define-directive:                           |
|                                             |                                             |
|      SWITCH switch-id := label-id0 [,...] ; |      #define switch-id(X)  \                |
|                                             |                                             |
|                                             |      switch (X)  \                          |
|                                             |                                             |
|                                             |      "{"  \                                 |
|                                             |                                             |
|                                             |      case 0: goto label-id0;  \             |
|                                             |                                             |
|                                             |      case 1: goto label-id1;  \             |
|                                             |                                             |
|                                             |      [...]                                  |
|                                             |                                             |
|                                             |      "}"                                    |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| A switch declaration defines and names an   | The corresponding transfer of control may   |
| ordered list of labels that may be          | be executed by specifying the defined macro |
| transferred to by an indexed GOTO statement | with the same index as in SPL:              |
| in the form:                                |                                             |
|                                             |      switch-id(index)                       |
|      GOTO switch-id(index)                  |                                             |
|                                             |                                             |
| See "GO TO Statement".                      |                                             |
|                                             |                                             |
---------------------------------------------------------------------------------------------



MPE/iX 5.0 Documentation