challenge.pr 1.77 KB
Newer Older
Maxime Perrotin's avatar
Maxime Perrotin committed
1
2
3
PROCESS challenge;
state on;
    substructure
4
5
        in (via_totO);
        out (reT0);
Maxime Perrotin's avatar
Maxime Perrotin committed
6
        start;
7
8
9
10
11
12
13
14
15
16
            call writeln('start without via');
            nextstate hello;
        start via_Toto;
            call writeln('start via toto, returning ret0');
            return ret0;
        state hello;
            input run;
                call writeln('hello substate');
                return;
        endstate;
Maxime Perrotin's avatar
Maxime Perrotin committed
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
55
56
57
58
59
60
61
62
endsubstructure;

/* CIF TEXT (-159, 1), (298, 140) */
-- This system tests nested states
/* CIF ENDTEXT */
/* CIF PROCEDURE (-70, 264), (70, 35) */
PROCEDURE toto;
/* CIF TEXT (371, 134), (298, 140) */
-- Declare your variables

-- Syntax: DCL <variable name> <type name>;

dcl i T_Int8  := 1;
/* CIF ENDTEXT */
/* CIF START (178, 86), (70, 35) */
START;
/* CIF DECISION (178, 136), (70, 50) */
DECISION i;
/* CIF ANSWER (131, 206), (73, 23) */
(1):
/* CIF TASK (127, 244), (80, 35) */
TASK i := i + 1;
/* CIF RETURN (150, 294), (35, 35) */
RETURN ;
/* CIF ANSWER (223, 206), (70, 23) */
ELSE:
/* CIF RETURN (240, 244), (35, 35) */
RETURN ;
ENDDECISION;
ENDPROCEDURE;
/* CIF START (227, -15), (68, 37) */
START;
/* CIF NEXTSTATE (226, 37), (70, 35) */
NEXTSTATE OFF;


/* CIF STATE (407, -3), (65, 35) */
STATE ON;
/* CIF INPUT (351, 52), (88, 35) */
INPUT any_one;
/* CIF NEXTSTATE (338, 102), (113, 35) */
NEXTSTATE ON;
/* CIF INPUT (455, 52), (78, 35) */
INPUT go_off;
/* CIF NEXTSTATE (459, 102), (70, 35) */
NEXTSTATE OFF;
63
64
65
connect ret0;
call writeln('Connect and going to OFF');
nextstate off;
Maxime Perrotin's avatar
Maxime Perrotin committed
66
67
68
69
70
71
72
ENDSTATE;

/* CIF STATE (226, 37), (70, 35) */
STATE OFF;
/* CIF INPUT (226, 92), (70, 35) */
INPUT run;
/* CIF PROCEDURECALL (178, 142), (166, 35) */
73
CALL writeln('Going ON VIA TOTO');
Maxime Perrotin's avatar
Maxime Perrotin committed
74
/* CIF NEXTSTATE (226, 192), (70, 35) */
75
NEXTSTATE ON VIA via_TOTO;
Maxime Perrotin's avatar
Maxime Perrotin committed
76
77
ENDSTATE;
ENDPROCESS challenge;