-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSAFER_imp.imp
54 lines (47 loc) · 877 Bytes
/
SAFER_imp.imp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* SAFER_imp
* Author:
* Creation date: Sun Nov 23 2008
*/
IMPLEMENTATION
SAFER_imp
REFINES
SAFER
IMPORTS
BASIC_IO, DISPLAY, av.Avionics
SEES
SAFER_TYPE
CONCRETE_VARIABLES
power
INVARIANT
power : SWITCH
INITIALISATION
power := OFF
OPERATIONS
main=
VAR Choice, counter IN
power := OFF;
Choice := 1;
counter := MAXINT;
WHILE (( Choice /= 0 ) & ( counter > 0 )) DO
counter := counter - 1;
display_menu;
Choice <-- INTERVAL_READ(0,4);
IF Choice = 0 THEN skip
END;
IF Choice = 1 THEN av.switch(ON)
END;
IF Choice = 2 THEN av.switch(OFF)
END;
IF Choice = 3 & power = ON THEN
av.translation(POS); av.move
END;
IF Choice = 4 & power = ON THEN
av.translation(NEG); av.move
END
INVARIANT
Choice : 0..4 & counter : NAT
VARIANT
counter
END
END
END