diff --git a/build.txt b/build.txt index d5bc5552fdf912d1a5e5d6deac5f92dbf62bd331..12b3e6393040af8c6acdc102569e0fa189e4580f 100644 --- a/build.txt +++ b/build.txt @@ -1 +1 @@ -13210 \ No newline at end of file +13214 \ No newline at end of file diff --git a/doc/AVATAR/avatar_documentation.tex b/doc/AVATAR/avatar_documentation.tex index a105919060ecdcc0a3c4de43d2be7530a86c26a1..1e6b2e41adf9cf10ed94d284871265cd74279092 100644 --- a/doc/AVATAR/avatar_documentation.tex +++ b/doc/AVATAR/avatar_documentation.tex @@ -593,6 +593,37 @@ Safety pragmas can be inserted in the model. These pragmas follow the following <leadsto> ::= `-->' +<property> ::= <stateproperty> +\alt <intproperty> +\alt <boolproperty> +\alt <property> <binaryop> <property> + +<stateproperty> ::= `BlockName.stateName' + +<intproperty> ::= <intexpr> <intcomparator> <intexpr> + +<boolproperty> ::= <boolexpr> <boolcomparator> <boolexpr> +\alt <boolexpr> + + + +<intexpr> ::= `BlockName.integerattribute' +\alt <intvalue> + +<intexpr> ::= `BlockName.booleanattribute' +\alt <booleanvalue> + + +<binaryop> ::= `&&' | `||' + +<intvalue> :: <integer> + +<booleanvalue> :: `true' | `false' + +<intcomparator> ::= `<' | `>' | `==' | `!=' + +<boolcomparator> ::= `==' | `!=' + \end{grammar} \subsection{Latency Analysis} diff --git a/doc/codegeneration/figures/tp.pdf b/doc/codegeneration/figures/tp.pdf new file mode 100755 index 0000000000000000000000000000000000000000..a597c381ab3f4e1c29eb1f0084709a58101ac70f Binary files /dev/null and b/doc/codegeneration/figures/tp.pdf differ diff --git a/modeling/AVATAR/CoffeeMachine_Avatar.xml b/modeling/AVATAR/CoffeeMachine_Avatar.xml index 8cdb192eac683fd4237f16ab5cf70a297334cca3..2776fd93de8a1480765c3139c69fcda79eabcfef 100644 --- a/modeling/AVATAR/CoffeeMachine_Avatar.xml +++ b/modeling/AVATAR/CoffeeMachine_Avatar.xml @@ -643,7 +643,7 @@ <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector from TGComponent to TGComponent" value="" /> <TGConnectingPoint num="0" id="373" /> -<P1 x="302" y="261" id="417" /> +<P1 x="302" y="261" id="404" /> <P2 x="361" y="261" id="392" /> <AutomaticDrawing data="true" /> </CONNECTOR> @@ -661,7 +661,7 @@ <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector from TGComponent to TGComponent" value="" /> <TGConnectingPoint num="0" id="377" /> -<P1 x="305" y="211" id="404" /> +<P1 x="305" y="211" id="417" /> <P2 x="361" y="211" id="391" /> <AutomaticDrawing data="true" /> </CONNECTOR> @@ -750,11 +750,11 @@ </COMPONENT> <SUBCOMPONENT type="5304" id="414" > <father id="452" num="0" /> -<cdparam x="166" y="191" /> -<sizeparam width="139" height="40" minWidth="100" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<cdparam x="154" y="241" /> +<sizeparam width="148" height="40" minWidth="100" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> -<cdrectangleparam minX="0" maxX="29" minY="0" maxY="114" /> -<infoparam name="TGComponent" value="WaitingForFirstCoin_exit" /> +<cdrectangleparam minX="0" maxX="20" minY="0" maxY="114" /> +<infoparam name="TGComponent" value="WaitingForFirstCoin_enter" /> <TGConnectingPoint num="0" id="402" /> <TGConnectingPoint num="1" id="403" /> <TGConnectingPoint num="2" id="404" /> @@ -770,11 +770,11 @@ </SUBCOMPONENT> <SUBCOMPONENT type="5304" id="427" > <father id="452" num="1" /> -<cdparam x="154" y="241" /> -<sizeparam width="148" height="40" minWidth="100" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<cdparam x="166" y="191" /> +<sizeparam width="139" height="40" minWidth="100" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> -<cdrectangleparam minX="0" maxX="20" minY="0" maxY="114" /> -<infoparam name="TGComponent" value="WaitingForFirstCoin_enter" /> +<cdrectangleparam minX="0" maxX="29" minY="0" maxY="114" /> +<infoparam name="TGComponent" value="WaitingForFirstCoin_exit" /> <TGConnectingPoint num="0" id="415" /> <TGConnectingPoint num="1" id="416" /> <TGConnectingPoint num="2" id="417" /> @@ -904,7 +904,7 @@ <TGConnectingPoint num="0" id="511" /> <TGConnectingPoint num="1" id="512" /> <TGConnectingPoint num="2" id="513" /> -<P1 x="581" y="154" id="587" /> +<P1 x="581" y="154" id="600" /> <P2 x="546" y="305" id="657" /> <Point x="518" y="154" /> <Point x="518" y="305" /> @@ -932,7 +932,7 @@ <infoparam name="connector from TGComponent to TGComponent" value="" /> <TGConnectingPoint num="0" id="516" /> <TGConnectingPoint num="1" id="517" /> -<P1 x="631" y="164" id="582" /> +<P1 x="631" y="164" id="595" /> <P2 x="667" y="310" id="644" /> <Point x="631" y="310" /> <AutomaticDrawing data="true" /> @@ -960,7 +960,7 @@ <infoparam name="connector from TGComponent to TGComponent" value="" /> <TGConnectingPoint num="0" id="522" /> <TGConnectingPoint num="1" id="523" /> -<P1 x="721" y="158" id="593" /> +<P1 x="721" y="158" id="580" /> <P2 x="700" y="204" id="634" /> <Point x="700" y="158" /> <AutomaticDrawing data="true" /> @@ -1115,13 +1115,13 @@ <TGConnectingPoint num="22" id="627" /> <TGConnectingPoint num="23" id="628" /> </COMPONENT> -<SUBCOMPONENT type="5304" id="591" > +<SUBCOMPONENT type="5303" id="591" > <father id="629" num="0" /> -<cdparam x="581" y="125" /> -<sizeparam width="100" height="39" minWidth="100" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<cdparam x="721" y="133" /> +<sizeparam width="100" height="50" minWidth="100" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> -<cdrectangleparam minX="0" maxX="168" minY="0" maxY="76" /> -<infoparam name="TGComponent" value="Start" /> +<cdrectangleparam minX="0" maxX="168" minY="0" maxY="65" /> +<infoparam name="TGComponent" value="nbOfCoins" /> <TGConnectingPoint num="0" id="579" /> <TGConnectingPoint num="1" id="580" /> <TGConnectingPoint num="2" id="581" /> @@ -1134,14 +1134,17 @@ <TGConnectingPoint num="9" id="588" /> <TGConnectingPoint num="10" id="589" /> <TGConnectingPoint num="11" id="590" /> +<extraparam> +<Toggle value="" /> +</extraparam> </SUBCOMPONENT> -<SUBCOMPONENT type="5303" id="604" > +<SUBCOMPONENT type="5304" id="604" > <father id="629" num="1" /> -<cdparam x="721" y="133" /> -<sizeparam width="100" height="50" minWidth="100" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<cdparam x="581" y="125" /> +<sizeparam width="100" height="39" minWidth="100" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> -<cdrectangleparam minX="0" maxX="168" minY="0" maxY="65" /> -<infoparam name="TGComponent" value="nbOfCoins" /> +<cdrectangleparam minX="0" maxX="168" minY="0" maxY="76" /> +<infoparam name="TGComponent" value="Start" /> <TGConnectingPoint num="0" id="592" /> <TGConnectingPoint num="1" id="593" /> <TGConnectingPoint num="2" id="594" /> @@ -1154,9 +1157,6 @@ <TGConnectingPoint num="9" id="601" /> <TGConnectingPoint num="10" id="602" /> <TGConnectingPoint num="11" id="603" /> -<extraparam> -<Toggle value="" /> -</extraparam> </SUBCOMPONENT> <COMPONENT type="5306" id="641" > @@ -1278,7 +1278,7 @@ <MainCode value="void __user_init() {"/> <MainCode value="}"/> <Optimized value="true" /> -<Validated value="Wallet;CoffeeMachine;TeaButton;CoffeeButton;" /> +<Validated value="" /> <Ignored value="" /> <CONNECTOR type="5002" id="695" > @@ -1286,7 +1286,7 @@ <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector from Block1 to Block0" value="" /> <TGConnectingPoint num="0" id="694" /> -<P1 x="559" y="330" id="756" /> +<P1 x="559" y="330" id="731" /> <P2 x="560" y="377" id="789" /> <AutomaticDrawing data="true" /> <extraparam> @@ -1316,7 +1316,7 @@ <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector from Block1 to Block0" value="" /> <TGConnectingPoint num="0" id="698" /> -<P1 x="789" y="326" id="731" /> +<P1 x="789" y="326" id="756" /> <P2 x="790" y="377" id="790" /> <AutomaticDrawing data="true" /> <extraparam> @@ -1417,11 +1417,11 @@ </COMPONENT> <SUBCOMPONENT type="5000" id="749" > <father id="799" num="0" /> -<cdparam x="695" y="224" /> -<sizeparam width="189" height="102" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<cdparam x="464" y="228" /> +<sizeparam width="190" height="102" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> -<cdrectangleparam minX="0" maxX="272" minY="0" maxY="256" /> -<infoparam name="Block1" value="TeaButton" /> +<cdrectangleparam minX="0" maxX="271" minY="0" maxY="256" /> +<infoparam name="Block1" value="CoffeeButton" /> <TGConnectingPoint num="0" id="725" /> <TGConnectingPoint num="1" id="726" /> <TGConnectingPoint num="2" id="727" /> @@ -1455,11 +1455,11 @@ </SUBCOMPONENT> <SUBCOMPONENT type="5000" id="774" > <father id="799" num="1" /> -<cdparam x="464" y="228" /> -<sizeparam width="190" height="102" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<cdparam x="695" y="224" /> +<sizeparam width="189" height="102" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> -<cdrectangleparam minX="0" maxX="271" minY="0" maxY="256" /> -<infoparam name="Block1" value="CoffeeButton" /> +<cdrectangleparam minX="0" maxX="272" minY="0" maxY="256" /> +<infoparam name="Block1" value="TeaButton" /> <TGConnectingPoint num="0" id="750" /> <TGConnectingPoint num="1" id="751" /> <TGConnectingPoint num="2" id="752" /> @@ -1501,8 +1501,8 @@ <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector from start state to Send signal" value="null" /> <TGConnectingPoint num="0" id="805" /> -<P1 x="340" y="233" id="912" /> -<P2 x="353" y="252" id="914" /> +<P1 x="340" y="233" id="923" /> +<P2 x="353" y="252" id="912" /> <AutomaticDrawing data="true" /> </CONNECTOR><SUBCOMPONENT type="-1" id="804" > <father id="806" num="0" /> @@ -1591,7 +1591,7 @@ <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector from Send signal to state0" value="null" /> <TGConnectingPoint num="0" id="826" /> -<P1 x="353" y="282" id="915" /> +<P1 x="353" y="282" id="913" /> <P2 x="399" y="352" id="829" /> <AutomaticDrawing data="true" /> </CONNECTOR><SUBCOMPONENT type="-1" id="825" > @@ -1777,33 +1777,33 @@ <extraparam> </extraparam> </COMPONENT> -<SUBCOMPONENT type="5100" id="913" > +<SUBCOMPONENT type="5103" id="922" > <father id="965" num="0" /> -<cdparam x="333" y="213" /> -<sizeparam width="15" height="15" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> -<hidden value="false" /> -<cdrectangleparam minX="0" maxX="169" minY="0" maxY="115" /> -<infoparam name="start state" value="null" /> -<TGConnectingPoint num="0" id="912" /> -</SUBCOMPONENT> -<SUBCOMPONENT type="5103" id="924" > -<father id="965" num="1" /> <cdparam x="330" y="257" /> <sizeparam width="46" height="20" minWidth="30" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <enabled value="true" /> <cdrectangleparam minX="0" maxX="138" minY="0" maxY="110" /> <infoparam name="Send signal" value="push()" /> -<TGConnectingPoint num="0" id="914" /> -<TGConnectingPoint num="1" id="915" /> -<TGConnectingPoint num="2" id="916" /> -<TGConnectingPoint num="3" id="917" /> -<TGConnectingPoint num="4" id="918" /> -<TGConnectingPoint num="5" id="919" /> -<TGConnectingPoint num="6" id="920" /> -<TGConnectingPoint num="7" id="921" /> -<TGConnectingPoint num="8" id="922" /> -<TGConnectingPoint num="9" id="923" /> +<TGConnectingPoint num="0" id="912" /> +<TGConnectingPoint num="1" id="913" /> +<TGConnectingPoint num="2" id="914" /> +<TGConnectingPoint num="3" id="915" /> +<TGConnectingPoint num="4" id="916" /> +<TGConnectingPoint num="5" id="917" /> +<TGConnectingPoint num="6" id="918" /> +<TGConnectingPoint num="7" id="919" /> +<TGConnectingPoint num="8" id="920" /> +<TGConnectingPoint num="9" id="921" /> +</SUBCOMPONENT> +<SUBCOMPONENT type="5100" id="924" > +<father id="965" num="1" /> +<cdparam x="333" y="213" /> +<sizeparam width="15" height="15" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<hidden value="false" /> +<cdrectangleparam minX="0" maxX="169" minY="0" maxY="115" /> +<infoparam name="start state" value="null" /> +<TGConnectingPoint num="0" id="923" /> </SUBCOMPONENT> @@ -2077,7 +2077,7 @@ <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector from Send signal to stop state" value="null" /> <TGConnectingPoint num="0" id="1095" /> -<P1 x="442" y="527" id="1446" /> +<P1 x="442" y="527" id="1511" /> <P2 x="323" y="748" id="1372" /> <AutomaticDrawing data="true" /> </CONNECTOR><SUBCOMPONENT type="-1" id="1094" > @@ -2108,8 +2108,8 @@ <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector from state0 to Send signal" value="null" /> <TGConnectingPoint num="0" id="1102" /> -<P1 x="326" y="457" id="1473" /> -<P2 x="442" y="497" id="1445" /> +<P1 x="326" y="457" id="1460" /> +<P2 x="442" y="497" id="1510" /> <AutomaticDrawing data="true" /> </CONNECTOR><SUBCOMPONENT type="-1" id="1101" > <father id="1103" num="0" /> @@ -2138,7 +2138,7 @@ <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector from Send signal to stop state" value="null" /> <TGConnectingPoint num="0" id="1109" /> -<P1 x="298" y="554" id="1511" /> +<P1 x="298" y="554" id="1446" /> <P2 x="289" y="748" id="1364" /> <AutomaticDrawing data="true" /> </CONNECTOR><SUBCOMPONENT type="-1" id="1108" > @@ -2170,8 +2170,8 @@ <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector from state0 to Send signal" value="null" /> <TGConnectingPoint num="0" id="1116" /> -<P1 x="293" y="477" id="1484" /> -<P2 x="298" y="524" id="1510" /> +<P1 x="293" y="477" id="1471" /> +<P2 x="298" y="524" id="1445" /> <AutomaticDrawing data="true" /> </CONNECTOR><SUBCOMPONENT type="-1" id="1115" > <father id="1117" num="0" /> @@ -2200,7 +2200,7 @@ <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector from Send signal to stop state" value="null" /> <TGConnectingPoint num="0" id="1123" /> -<P1 x="126" y="554" id="1457" /> +<P1 x="126" y="554" id="1500" /> <P2 x="255" y="748" id="1371" /> <AutomaticDrawing data="true" /> </CONNECTOR><SUBCOMPONENT type="-1" id="1122" > @@ -2232,8 +2232,8 @@ <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector from state0 to Send signal" value="null" /> <TGConnectingPoint num="0" id="1130" /> -<P1 x="227" y="477" id="1483" /> -<P2 x="126" y="524" id="1456" /> +<P1 x="227" y="477" id="1470" /> +<P2 x="126" y="524" id="1499" /> <AutomaticDrawing data="true" /> </CONNECTOR><SUBCOMPONENT type="-1" id="1129" > <father id="1131" num="0" /> @@ -2262,8 +2262,8 @@ <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector from start state to state0" value="null" /> <TGConnectingPoint num="0" id="1137" /> -<P1 x="261" y="421" id="1467" /> -<P2 x="260" y="437" id="1470" /> +<P1 x="261" y="421" id="1497" /> +<P2 x="260" y="437" id="1457" /> <AutomaticDrawing data="true" /> </CONNECTOR><SUBCOMPONENT type="-1" id="1136" > <father id="1138" num="0" /> @@ -2900,14 +2900,14 @@ <extraparam> </extraparam> </COMPONENT> -<SUBCOMPONENT type="5103" id="1455" > +<SUBCOMPONENT type="5104" id="1455" > <father id="1561" num="0" /> -<cdparam x="377" y="502" /> -<sizeparam width="130" height="20" minWidth="30" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<cdparam x="242" y="529" /> +<sizeparam width="112" height="20" minWidth="30" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <enabled value="true" /> -<cdrectangleparam minX="0" maxX="447" minY="0" maxY="334" /> -<infoparam name="Send signal" value="ejectCoin(nbOfCoins)" /> +<cdrectangleparam minX="0" maxX="465" minY="0" maxY="334" /> +<infoparam name="Send signal" value="pushTeaButton()" /> <TGConnectingPoint num="0" id="1445" /> <TGConnectingPoint num="1" id="1446" /> <TGConnectingPoint num="2" id="1447" /> @@ -2920,14 +2920,14 @@ <TGConnectingPoint num="9" id="1454" /> <accessibility /> </SUBCOMPONENT> -<SUBCOMPONENT type="5104" id="1466" > +<SUBCOMPONENT type="5106" id="1496" > <father id="1561" num="1" /> -<cdparam x="63" y="529" /> -<sizeparam width="127" height="20" minWidth="30" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<cdparam x="194" y="437" /> +<sizeparam width="132" height="40" minWidth="40" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <enabled value="true" /> -<cdrectangleparam minX="0" maxX="450" minY="0" maxY="334" /> -<infoparam name="Send signal" value="pushCoffeeButton()" /> +<cdrectangleparam minX="0" maxX="445" minY="0" maxY="314" /> +<infoparam name="state0" value="WaitingForSelection" /> <TGConnectingPoint num="0" id="1456" /> <TGConnectingPoint num="1" id="1457" /> <TGConnectingPoint num="2" id="1458" /> @@ -2938,77 +2938,77 @@ <TGConnectingPoint num="7" id="1463" /> <TGConnectingPoint num="8" id="1464" /> <TGConnectingPoint num="9" id="1465" /> -<accessibility /> +<TGConnectingPoint num="10" id="1466" /> +<TGConnectingPoint num="11" id="1467" /> +<TGConnectingPoint num="12" id="1468" /> +<TGConnectingPoint num="13" id="1469" /> +<TGConnectingPoint num="14" id="1470" /> +<TGConnectingPoint num="15" id="1471" /> +<TGConnectingPoint num="16" id="1472" /> +<TGConnectingPoint num="17" id="1473" /> +<TGConnectingPoint num="18" id="1474" /> +<TGConnectingPoint num="19" id="1475" /> +<TGConnectingPoint num="20" id="1476" /> +<TGConnectingPoint num="21" id="1477" /> +<TGConnectingPoint num="22" id="1478" /> +<TGConnectingPoint num="23" id="1479" /> +<TGConnectingPoint num="24" id="1480" /> +<TGConnectingPoint num="25" id="1481" /> +<TGConnectingPoint num="26" id="1482" /> +<TGConnectingPoint num="27" id="1483" /> +<TGConnectingPoint num="28" id="1484" /> +<TGConnectingPoint num="29" id="1485" /> +<TGConnectingPoint num="30" id="1486" /> +<TGConnectingPoint num="31" id="1487" /> +<TGConnectingPoint num="32" id="1488" /> +<TGConnectingPoint num="33" id="1489" /> +<TGConnectingPoint num="34" id="1490" /> +<TGConnectingPoint num="35" id="1491" /> +<TGConnectingPoint num="36" id="1492" /> +<TGConnectingPoint num="37" id="1493" /> +<TGConnectingPoint num="38" id="1494" /> +<TGConnectingPoint num="39" id="1495" /> +<latencyCheck /> +<extraparam> +</extraparam> </SUBCOMPONENT> -<SUBCOMPONENT type="5100" id="1468" > +<SUBCOMPONENT type="5100" id="1498" > <father id="1561" num="2" /> <cdparam x="254" y="401" /> <sizeparam width="15" height="15" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="0" maxX="562" minY="0" maxY="339" /> <infoparam name="start state" value="null" /> -<TGConnectingPoint num="0" id="1467" /> +<TGConnectingPoint num="0" id="1497" /> </SUBCOMPONENT> -<SUBCOMPONENT type="5106" id="1509" > +<SUBCOMPONENT type="5104" id="1509" > <father id="1561" num="3" /> -<cdparam x="194" y="437" /> -<sizeparam width="132" height="40" minWidth="40" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<cdparam x="63" y="529" /> +<sizeparam width="127" height="20" minWidth="30" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <enabled value="true" /> -<cdrectangleparam minX="0" maxX="445" minY="0" maxY="314" /> -<infoparam name="state0" value="WaitingForSelection" /> -<TGConnectingPoint num="0" id="1469" /> -<TGConnectingPoint num="1" id="1470" /> -<TGConnectingPoint num="2" id="1471" /> -<TGConnectingPoint num="3" id="1472" /> -<TGConnectingPoint num="4" id="1473" /> -<TGConnectingPoint num="5" id="1474" /> -<TGConnectingPoint num="6" id="1475" /> -<TGConnectingPoint num="7" id="1476" /> -<TGConnectingPoint num="8" id="1477" /> -<TGConnectingPoint num="9" id="1478" /> -<TGConnectingPoint num="10" id="1479" /> -<TGConnectingPoint num="11" id="1480" /> -<TGConnectingPoint num="12" id="1481" /> -<TGConnectingPoint num="13" id="1482" /> -<TGConnectingPoint num="14" id="1483" /> -<TGConnectingPoint num="15" id="1484" /> -<TGConnectingPoint num="16" id="1485" /> -<TGConnectingPoint num="17" id="1486" /> -<TGConnectingPoint num="18" id="1487" /> -<TGConnectingPoint num="19" id="1488" /> -<TGConnectingPoint num="20" id="1489" /> -<TGConnectingPoint num="21" id="1490" /> -<TGConnectingPoint num="22" id="1491" /> -<TGConnectingPoint num="23" id="1492" /> -<TGConnectingPoint num="24" id="1493" /> -<TGConnectingPoint num="25" id="1494" /> -<TGConnectingPoint num="26" id="1495" /> -<TGConnectingPoint num="27" id="1496" /> -<TGConnectingPoint num="28" id="1497" /> -<TGConnectingPoint num="29" id="1498" /> -<TGConnectingPoint num="30" id="1499" /> -<TGConnectingPoint num="31" id="1500" /> -<TGConnectingPoint num="32" id="1501" /> -<TGConnectingPoint num="33" id="1502" /> -<TGConnectingPoint num="34" id="1503" /> -<TGConnectingPoint num="35" id="1504" /> -<TGConnectingPoint num="36" id="1505" /> -<TGConnectingPoint num="37" id="1506" /> -<TGConnectingPoint num="38" id="1507" /> -<TGConnectingPoint num="39" id="1508" /> -<latencyCheck /> -<extraparam> -</extraparam> +<cdrectangleparam minX="0" maxX="450" minY="0" maxY="334" /> +<infoparam name="Send signal" value="pushCoffeeButton()" /> +<TGConnectingPoint num="0" id="1499" /> +<TGConnectingPoint num="1" id="1500" /> +<TGConnectingPoint num="2" id="1501" /> +<TGConnectingPoint num="3" id="1502" /> +<TGConnectingPoint num="4" id="1503" /> +<TGConnectingPoint num="5" id="1504" /> +<TGConnectingPoint num="6" id="1505" /> +<TGConnectingPoint num="7" id="1506" /> +<TGConnectingPoint num="8" id="1507" /> +<TGConnectingPoint num="9" id="1508" /> +<accessibility /> </SUBCOMPONENT> -<SUBCOMPONENT type="5104" id="1520" > +<SUBCOMPONENT type="5103" id="1520" > <father id="1561" num="4" /> -<cdparam x="242" y="529" /> -<sizeparam width="112" height="20" minWidth="30" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<cdparam x="377" y="502" /> +<sizeparam width="130" height="20" minWidth="30" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <enabled value="true" /> -<cdrectangleparam minX="0" maxX="465" minY="0" maxY="334" /> -<infoparam name="Send signal" value="pushTeaButton()" /> +<cdrectangleparam minX="0" maxX="447" minY="0" maxY="334" /> +<infoparam name="Send signal" value="ejectCoin(nbOfCoins)" /> <TGConnectingPoint num="0" id="1510" /> <TGConnectingPoint num="1" id="1511" /> <TGConnectingPoint num="2" id="1512" /> diff --git a/src/main/java/cli/Interpreter.java b/src/main/java/cli/Interpreter.java index 7f2603e7fc1949596a64e5dd4adbaabcc173afd7..420044b77dfe96e3e7cab4d13b30f5c2072ed1a8 100644 --- a/src/main/java/cli/Interpreter.java +++ b/src/main/java/cli/Interpreter.java @@ -59,7 +59,7 @@ import java.util.Vector; public class Interpreter implements Runnable, TerminalProviderInterface { public final static Command[] commands = {new Action(), new Help(), new History(), new Print(), new Quit(), - new TestSpecific(), new TML(), new Set(), new Wait()}; + new TestSpecific(), new TML(), new Set(), new Wait(), new Robot()}; // Errors public final static String UNKNOWN = "Unknown command"; @@ -71,6 +71,7 @@ public class Interpreter implements Runnable, TerminalProviderInterface { public final static String TTOOL_NOT_STARTED = "TTool is not yet started. Cannot execute command."; public final static String TTOOL_ALREADY_STARTED = "TTool is already started. Cannot execute command."; public final static String BAD_COMMAND_NAME = "The provided command is invalid"; + public final static String ROBOT_EXCEPTION = "Robot could not be started"; private String script; @@ -108,7 +109,9 @@ public class Interpreter implements Runnable, TerminalProviderInterface { String line; currentLine = 0; while ((line = term.getNextCommand()) != null) { - executeLine(line, currentLine, false); + for(String subCommand: line.split(";")) { + executeLine(subCommand, currentLine, false); + } currentLine++; } } @@ -142,7 +145,10 @@ public class Interpreter implements Runnable, TerminalProviderInterface { while (scanner.hasNextLine()) { String line = scanner.nextLine(); currentLine++; - executeLine(line, currentLine, true); + + for(String subCommand: line.split(";")) { + executeLine(subCommand, currentLine, true); + } } scanner.close(); diff --git a/src/main/java/cli/Robot.java b/src/main/java/cli/Robot.java new file mode 100644 index 0000000000000000000000000000000000000000..e3bd30e6ce36cf1ba604e8bad76a1a4939fa5106 --- /dev/null +++ b/src/main/java/cli/Robot.java @@ -0,0 +1,543 @@ +/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille + * + * ludovic.apvrille AT enst.fr + * + * This software is a computer program whose purpose is to allow the + * edition of TURTLE analysis, design and deployment diagrams, to + * allow the generation of RT-LOTOS or Java code from this diagram, + * and at last to allow the analysis of formal validation traces + * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + * from INRIA Rhone-Alpes. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package cli; + +import common.ConfigurationTTool; +import common.SpecConfigTTool; +import launcher.RTLLauncher; +import myutil.PluginManager; +import myutil.TraceManager; +import tmltranslator.TMLMapping; +import tmltranslator.TMLModeling; +import ui.MainGUI; +import ui.util.IconManager; +import ui.window.JDialogSystemCGeneration; +import ui.*; + +import java.awt.*; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.StringSelection; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.io.File; +import java.util.BitSet; +import java.util.*; +import java.util.List; + +/** + * Class Mouse + * Creation: 30/10/2019 + * Version 1.0 30/10/2019 + * + * @author Ludovic APVRILLE + */ +public class Robot extends Command { + // Action commands + private final static String DOUBLE_CLICK = "leftclick"; + private final static String LCLICK = "leftclick"; + private final static String RCLICK = "rightclick"; + private final static String MOVEA_LCLICK = "moveleftclick"; + private final static String MOVEA_RCLICK = "moverightclick"; + private final static String MOVE_ABS = "movea"; + private final static String MOVE_REL = "mover"; + private final static String ENTER_KEY = "key"; + private final static String ENTER_KEYS = "keys"; + private final static String ENTER_TEXT = "text"; + + private java.awt.Robot robot; + + public Robot() { + } + + public List<Command> getListOfSubCommands() { + return subcommands; + } + + public String getCommand() { + return "robot"; + } + + public String getShortCommand() { + return "r"; + } + + public String getUsage() { + return "robot <subcommand> <options>"; + } + + public String getDescription() { + return "Can be used to perform actions with a mouse/key robot in TTool"; + } + + + + + public void fillSubCommands() { + // Double click + Command dclick = new Command() { + public String getCommand() { + return DOUBLE_CLICK; + } + + public String getShortCommand() { + return "dc"; + } + + public String getDescription() { + return "Double click at current location"; + } + + public String executeCommand(String command, Interpreter interpreter) { + if (!interpreter.isTToolStarted()) { + return Interpreter.TTOOL_NOT_STARTED; + } + + String ret; if ((ret = checkRobot()) != null) return ret; + + click(InputEvent.BUTTON1_DOWN_MASK); + click(InputEvent.BUTTON1_DOWN_MASK); + + return null; + } + }; + + + // Left Click + Command lclick = new Command() { + public String getCommand() { + return LCLICK; + } + + public String getShortCommand() { + return "lc"; + } + + public String getDescription() { + return "Left click at current location"; + } + + public String executeCommand(String command, Interpreter interpreter) { + if (!interpreter.isTToolStarted()) { + return Interpreter.TTOOL_NOT_STARTED; + } + + String ret; if ((ret = checkRobot()) != null) return ret; + + click(InputEvent.BUTTON1_DOWN_MASK); + + return null; + } + }; + + // Right Click + Command rclick = new Command() { + public String getCommand() { + return RCLICK; + } + + public String getShortCommand() { + return "rc"; + } + + public String getDescription() { + return "Right click at current location"; + } + + public String executeCommand(String command, Interpreter interpreter) { + if (!interpreter.isTToolStarted()) { + return Interpreter.TTOOL_NOT_STARTED; + } + + String ret; if ((ret = checkRobot()) != null) return ret; + + click(InputEvent.BUTTON3_DOWN_MASK); + + return null; + } + }; + + // Absolute move + Command movea = new Command() { + public String getCommand() { + return MOVE_ABS; + } + + public String getShortCommand() { + return "ma"; + } + + public String getDescription() { + return "moving mouse to new an absolute location"; + } + + public String executeCommand(String command, Interpreter interpreter) { + if (!interpreter.isTToolStarted()) { + return Interpreter.TTOOL_NOT_STARTED; + } + + String ret; if ((ret = checkRobot()) != null) return ret; + + if ((ret = moveAbsolute(command)) != null) return ret; + + return null; + } + }; + + // Relative move + Command mover = new Command() { + public String getCommand() { + return MOVE_REL; + } + + public String getShortCommand() { + return "mr"; + } + + public String getDescription() { + return "moving mouse to a relative location"; + } + + public String executeCommand(String command, Interpreter interpreter) { + if (!interpreter.isTToolStarted()) { + return Interpreter.TTOOL_NOT_STARTED; + } + + String ret; if ((ret = checkRobot()) != null) return ret; + + if ((ret = moveRelative(command)) != null) return ret; + + + return null; + } + }; + + // Absolute move and left click + Command movealc = new Command() { + public String getCommand() { + return MOVEA_LCLICK; + } + + public String getShortCommand() { + return "malc"; + } + + public String getDescription() { + return "Moving mouse to new an absolute location and make a left click"; + } + + public String executeCommand(String command, Interpreter interpreter) { + if (!interpreter.isTToolStarted()) { + return Interpreter.TTOOL_NOT_STARTED; + } + + String ret; if ((ret = checkRobot()) != null) return ret; + + if ((ret = moveAbsolute(command)) != null) return ret; + + click(InputEvent.BUTTON1_DOWN_MASK); + + return null; + } + }; + + // Absolute move and right click + Command movearc = new Command() { + public String getCommand() { + return MOVEA_RCLICK; + } + + public String getShortCommand() { + return "marc"; + } + + public String getDescription() { + return "Moving mouse to new an absolute location and make a right click"; + } + + public String executeCommand(String command, Interpreter interpreter) { + if (!interpreter.isTToolStarted()) { + return Interpreter.TTOOL_NOT_STARTED; + } + + String ret; if ((ret = checkRobot()) != null) return ret; + + if ((ret = moveAbsolute(command)) != null) return ret; + + click(InputEvent.BUTTON3_DOWN_MASK); + + return null; + } + }; + + // entering x key event + Command keys = new Command() { + public String getCommand() { + return ENTER_KEYS; + } + + public String getShortCommand() { + return "ks"; + } + + public String getDescription() { + return "Enter x times key at current location: <x> then DEL|TAB|SPACE|ENTER|BACKSPACE|UP|DOWN|LEFT|RIGHT"; + } + + public String executeCommand(String command, Interpreter interpreter) { + if (!interpreter.isTToolStarted()) { + return Interpreter.TTOOL_NOT_STARTED; + } + + String ret; if ((ret = checkRobot()) != null) return ret; + + // Find how many times the key must be entered + String[] split = command.trim().split(" "); + if (split.length < 2) { + return Interpreter.BAD; + } + + int nbOfTimes; + + try { + nbOfTimes = Integer.decode(split[0]); + } catch (Exception e) { + return Interpreter.BAD; + } + + if (nbOfTimes < 0) { + return Interpreter.BAD; + } + + for (int i=0; i<nbOfTimes; i++) { + if ((ret = key(split[1])) != null) return ret; + } + + return null; + } + }; + + // entering key event + Command key = new Command() { + public String getCommand() { + return ENTER_KEY; + } + + public String getShortCommand() { + return "k"; + } + + public String getDescription() { + return "Enter key at current location: DEL|TAB|SPACE|ENTER|BACKSPACE|UP|DOWN|LEFT|RIGHT"; + } + + public String executeCommand(String command, Interpreter interpreter) { + if (!interpreter.isTToolStarted()) { + return Interpreter.TTOOL_NOT_STARTED; + } + + String ret; if ((ret = checkRobot()) != null) return ret; + + if ((ret = key(command)) != null) return ret; + + return null; + } + }; + + // Entering text + Command text = new Command() { + public String getCommand() { + return ENTER_TEXT; + } + + public String getShortCommand() { + return "t"; + } + + public String getDescription() { + return "Enter text at current location"; + } + + public String executeCommand(String command, Interpreter interpreter) { + if (!interpreter.isTToolStarted()) { + return Interpreter.TTOOL_NOT_STARTED; + } + + String ret; if ((ret = checkRobot()) != null) return ret; + + if ((ret = text(command)) != null) return ret; + + return null; + } + }; + + addAndSortSubcommand(dclick); + addAndSortSubcommand(lclick); + addAndSortSubcommand(rclick); + addAndSortSubcommand(movea); + addAndSortSubcommand(mover); + addAndSortSubcommand(movealc); + addAndSortSubcommand(movearc); + addAndSortSubcommand(keys); + addAndSortSubcommand(key); + addAndSortSubcommand(text); + + } + + // Needed basic commands + public String checkRobot() { + if (robot == null) { + try { + robot = new java.awt.Robot(); + robot.setAutoDelay(50); + } catch (AWTException e) { + return Interpreter.ROBOT_EXCEPTION + ": " + e.getMessage(); + } + } + return null; + } + + public void click(int button) { + robot.mousePress(button); + robot.mouseRelease(button); + } + + public String moveAbsolute(String cd) { + int indexSpace = cd.indexOf(" "); + if (indexSpace == -1) { + return Interpreter.BAD; + } + + try { + int x = Integer.decode(cd.substring(0, indexSpace)); + int y = Integer.decode(cd.substring(indexSpace + 1, cd.length())); + robot.mouseMove(x, y); + } catch (Exception e) { + return Interpreter.BAD; + } + + + + return null; + } + + public String moveRelative(String cd) { + + int indexSpace = cd.indexOf(" "); + if (indexSpace == -1) { + return Interpreter.BAD; + } + + try { + int x = Integer.decode(cd.substring(0, indexSpace)); + int y = Integer.decode(cd.substring(indexSpace+1, cd.length())); + + PointerInfo pi = MouseInfo.getPointerInfo(); + + robot.mouseMove((int)(pi.getLocation().getX()) + x, (int)(pi.getLocation().getY()) + y); + + robot.mouseMove(x, y); + } catch (Exception e) { + return Interpreter.BAD; + } + + return null; + } + + public String key(String k) { + + int code = stringToKeyEventCode(k); + + if (code < 0) { + return Interpreter.BAD; + } + + robot.keyPress(code); + robot.keyRelease(code); + + + return null; + } + + public String text(String t) { + StringSelection stringSelection = new StringSelection(t); + Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + clipboard.setContents(stringSelection, stringSelection); + + robot.keyPress(KeyEvent.VK_CONTROL); + robot.keyPress(KeyEvent.VK_V); + robot.keyRelease(KeyEvent.VK_V); + robot.keyRelease(KeyEvent.VK_CONTROL); + + return null; + } + + + public int stringToKeyEventCode(String key) { + key = key.trim(); + key = key.toUpperCase(); + + TraceManager.addDev("Selected key: " + key); + + + if (key.equals("DEL")) { + return KeyEvent.VK_DELETE; + } else if (key.equals("TAB")) { + return KeyEvent.VK_TAB; + } else if (key.equals("SPACE")) { + return KeyEvent.VK_SPACE; + } else if (key.equals("ENTER")) { + return KeyEvent.VK_ENTER; + } else if (key.equals("BACKSPACE")) { + return KeyEvent.VK_BACK_SPACE; + } else if (key.equals("UP")) { + return KeyEvent.VK_UP; + } else if (key.equals("DOWN")) { + return KeyEvent.VK_DOWN; + } else if (key.equals("LEFT")) { + return KeyEvent.VK_DOWN; + } else if (key.equals("RIGHT")) { + return KeyEvent.VK_DOWN; + } + + return -1; + } + + +} diff --git a/src/main/java/ui/util/DefaultText.java b/src/main/java/ui/util/DefaultText.java index 31804bc356b82f53887b70421f721ad107df909e..6fb881d791dd2458eea76771e2eed6a5aa7bf9e3 100755 --- a/src/main/java/ui/util/DefaultText.java +++ b/src/main/java/ui/util/DefaultText.java @@ -50,8 +50,8 @@ package ui.util; */ public class DefaultText { - public static String BUILD = "13209"; - public static String DATE = "2019/10/29 03:04:32 CET"; + public static String BUILD = "13213"; + public static String DATE = "2019/10/30 03:07:26 CET"; public static StringBuffer sbAbout = makeAbout();