HP 3000 Manuals

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


SPL to HP C/XL Migration Guide

Local SWITCH Declarations 

See "SWITCH Declaration" for further details.

          Table 8-19.  Local 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;  \             |
|                                             |                                             |
|                                             |      [...]                                  |
|                                             |                                             |
|                                             |      "}"                                    |
|                                             |                                             |
|                                             |      ...                                    |
|                                             |                                             |
|                                             |      #undef switch-id                       |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| switch-reference:                           | define-reference:                           |
|                                             |                                             |
|      GOTO switch-id(index)                  |      switch-id(index)                       |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| The scope of a local SWITCH declaration is  | The scope of a #define directive is not     |
| the procedure.                              | local.  It is known to all following source |
|                                             | code.  To turn it off, insert the #undef    |
|                                             | directive at the end of the function.       |
|                                             |                                             |
---------------------------------------------------------------------------------------------



MPE/iX 5.0 Documentation