.pg .x case .x do .x break .x default .x end .lt ------------------------------------------------------------------------ CASE index [BASE=base] [TYPE=type] DO label_1: ... label_2: ... label_n: ... DEFAULT ... 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 _._._. statements can take on two forms: .b .ls .le .lt statements break .el .b The BREAK macro 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. .le .lt statements .el .b If no BREAK macro is used, the program will continue to execute into the next case label. .els The default branch displacement for CASE is WORD (see BRANCH). .b The DEFAULT macro begins code statements for the default case (i.e. when the case index is outside the _<^&label-list\&_> supplied). The DEFAULT 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. .b .tp 5 For example: .b .lt case r1 base=#1 do one: statements-1 break two: statements-2 break three: statements-3 break DEFAULT 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