summaryrefslogtreecommitdiffstats
path: root/test/uscxml/promela/test-syntax.scxml
blob: 101c97ad87190e89c4495ae2422641e2c3b3411a (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<scxml datamodel="promela" binding="early" >
  <!--
    promela-event-source:
      foo.bar
      foo.baz foo.foo
      error.communication 
      error.platform 
      err.foo
  -->
  <datamodel>
    <data>
      bool b1;
    </data>
    <data>
      int fooSum = 0;
      int fooIndex = 0;
      int fooItem;
      int foos[10];
    </data>
    <data>
      bool b2, b3, b4;
    </data>
    <data>
      bool b5, b6 = 3 + 4, b7, b8, b9;
    </data>
    <data>
      bool c1; bool c2; bool c3; bool c4;
      bool c5; bool c6; bool c7, c8 = 4 + 6, c9;
    </data>
    <data>
      byte state = 1;
      mtype = {
        FATAL, NON_FATAL, COMPLETE, INCOMPLETE,
        red, white, blue
      }
    </data>
    <data>
      bool busy[3];
      bool lazy[4];
    </data>
    <data>
      bool v3, v2 = 1;
    </data>
    
  </datamodel>
  <state id="init">
		<invoke type="xhtml" id="xhtml1" src="resources/gui.xhtml">
		  <!-- #promela-event-source:
		    foo.bar
		    foo.baz foo.foo
		    error.communication 
		    error.platform 
		    err.foo
		  -->
		</invoke>
		
    <invoke type="scxml">
      <!--
        promela-event-source:
        innerFoo
      -->
      
      <final id="stop">
        <onentry>
          <send target="#_parent" event="innerFoo" />
        </onentry>
      </final>
    </invoke>
    <onentry>
      <!--
        #promela-inline:
        progress: skip;
      -->
      <raise event="foo.bar" />
      <script>
        busy[4 - 3] = 1;
      </script>
      <log label="foos" expr="foos" />
      <foreach item="fooItem" array="foos" index="fooIndex">
        <script>
          foos[fooIndex] = fooIndex;
        </script>
      </foreach>
      <log label="foos" expr="foos" />
      <foreach item="fooItem" array="foos" index="fooIndex">
        <log label="fooItem" expr="fooItem" />
        <script>
          fooSum = fooSum + fooItem;
        </script>
      </foreach>
      <log label="fooSum" expr="fooSum" />
      <if cond="b1==0">
        <script>
          b2=1; b3=1;
        </script>
      <elseif cond="b1==1" />
        <script>
          b2=1; b3=1;
        </script>
      <else />
        <script>
          b2=1; b3=1;
        </script>
      </if>
      <script>
        v2=1; v3=1;
      </script>
    </onentry>
    <transition target="pass" cond="v2==v3 &amp;&amp; busy[1] == 1" event="foo.bar">
      <!--
        promela-inline:
        progress: skip;
      -->
    </transition>
    <transition target="fail" event="*">
      <!--
        promela-inline:
        progress: skip;
      -->
    </transition>
  </state>
  <final id="pass">
    <onentry>
      <log label="Outcome" expr="'pass'"/>
    </onentry>
  </final>
  <final id="fail">
    <onentry>
      <log label="Outcome" expr="'fail'"/>
    </onentry>
  </final>
</scxml>