Avaya Logo

Previous Topic

Next Topic

Book Contents

Book Index

case

The case instruction calls a function if the values are equal.

Synopsis

case(type.src,type.src[,subroutine_label]goto_label)
case(type.src,type.src[,
subroutine_label ()]goto_label)
case(type.src,type.src[,
subroutine_label(type.src)]goto_label)
case(type.src,type.src[,
subroutine_label](type.src,type.src)goto_label)

Description

The case instruction provides a conditional subroutine call that compares two source values. If they are equal, the subroutine is called, and on return, execution continues at the goto_label address. If they are unequal, the statement is treated as a no-op instruction and execution continues. If the subroutine_label is -1, no subroutine call is made and execution continues at the goto_label. If the goto_label is -1, execution continues with the next instruction.

As is normal for subroutine calls, calling the specified subroutine saves the values of all registers except r.0. Register 3 contains the first optional subroutine argument and register 2 contains the second optional subroutine argument.

Example

Based on the value of int.FOLLOW_UP, one of two telephone numbers is dialed.

case(int.FOLLOW_UP,F_ATD_A,CALL(APHONE),w4answ)
case(int.FOLLOW_UP,F_ATD_B,CALL(BPHONE),w4answ)
...
w4answ:
...

CALL: /* Call an attendant. Phone number is at address in r.3 */
tic('o', int.ATDTIC, *ch.3)
rts()

© 2006 Avaya Inc. All Rights Reserved.