.pg .x of .x otherwise .x Obsolete Macros > of .x Obsolete Macros > otherwise .lt ------------------------------------------------------------------------ CASE index [BASE=base] [TYPE=type] DO label_1: OF ... END label_2: OF ... END . . . label_n: OF ... END OTHERWISE ... END ------------------------------------------------------------------------ .el .b 3 These macros implements the CASEB, CASEW or CASEL VAX instruction, generates the case table from a list of branch distinations and calculates the index limit. .b If ^&base\& is not specified, #0 is assumed. If ^&type\& is not specified, L is assumed. .b The END macro for the OF statement will generate a branch to the end of the case structure. If the branch displacement for CASE is BYTE, a BRB instruction will be generated, if the branch displacement is WORD, a BRW instruction will be generated, and if the branch displacement is LONG, a JMP instruction will be genereated. .b The default branch displacement for CASE is WORD (see BRANCH). .b The OTHERWISE macro begins code statements for the default case (i.e. when the case index is outside the _<^&label-list\&_> supplied). The OTHERWISE macro and it's corresponding code statements are optional. .b For every CASE macro specified, a corresponding END macro must also be specified. The END macro corresponding to the CASE macro will generate the appropriate labels. For every OF macro specified, a corresponding END macro must also be specified. .b .tp 5 For example: .b .lt case r1 base=#1 do one: of statements-1 end two: of statements-2 end three: of statements-3 end otherwise statements-0 end .el .b will generate the following code: .b .lt casel r1,#1,#<<30001$-30000$>/2>-1 30000$: .word one-30000$ .word two-30000$ .word three-30000$ 30001$: brw 20000$ one: statements-1 brw 20001$ two: statements-2 brw 20001$ three: statements-3 brw 20001$ 20000$: statements-0 20001$: .el