2019-12-31 15:56:23 -05:00

649 lines
22 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<model version="4.6.0" links="1">
<documentation>The improved Calculator model with QMsm state machine implementation strategy, no &quot;me-&gt;&quot; pointer, and Sub-Machines.</documentation>
<!--${qpcpp}-->
<framework name="qpcpp" license="../../../QPCPP-EVAL.qlc"/>
<!--${Events}-->
<package name="Events" stereotype="0x01">
<!--${Events::CalcEvt}-->
<class name="CalcEvt" superclass="qpcpp::QEvt">
<!--${Events::CalcEvt::key_code}-->
<attribute name="key_code" type="uint8_t" visibility="0x00" properties="0x00"/>
</class>
</package>
<!--${SMs}-->
<package name="SMs" stereotype="0x02">
<!--${SMs::Calc}-->
<class name="Calc" superclass="qpcpp::QMsm">
<documentation>Calculator state machine</documentation>
<!--${SMs::Calc::inst}-->
<attribute name="inst" type="Calc" visibility="0x00" properties="0x01">
<documentation>the single inst of the Calc class</documentation>
</attribute>
<!--${SMs::Calc::m_op1}-->
<attribute name="m_op1" type="double" visibility="0x02" properties="0x00"/>
<!--${SMs::Calc::m_op2}-->
<attribute name="m_op2" type="double" visibility="0x02" properties="0x00"/>
<!--${SMs::Calc::m_oper1}-->
<attribute name="m_oper1" type="uint8_t" visibility="0x02" properties="0x00"/>
<!--${SMs::Calc::m_oper2}-->
<attribute name="m_oper2" type="uint8_t" visibility="0x02" properties="0x00"/>
<!--${SMs::Calc::Calc}-->
<operation name="Calc" type="" visibility="0x00" properties="0x00">
<documentation>constructor</documentation>
<code> : QMsm(&amp;initial)</code>
</operation>
<!--${SMs::Calc::eval}-->
<operation name="eval" type="bool" visibility="0x00" properties="0x00">
<documentation>// guard function to evaluate the current expression
// taking into account the precedence of operands.
// return: true if evaluation successfull
// false when error encountered</documentation>
<!--${SMs::Calc::eval::op}-->
<parameter name="op" type="double"/>
<!--${SMs::Calc::eval::oper}-->
<parameter name="oper" type="uint8_t"/>
<code>double result;
if ((oper == KEY_NULL) || (oper == KEY_PLUS) || (oper == KEY_MINUS)) {
switch (m_oper2) {
case KEY_MULT: {
m_op2 *= op;
break;
}
case KEY_DIVIDE: {
if ((-1e-30 &lt; op) &amp;&amp; (op &lt; 1e-30)) {
BSP_display_error(&quot; Error 0 &quot;); // divide by zero
return false;
}
m_op2 /= op;
break;
}
default: { /* no op2 yet */
m_op2 = op;
m_oper2 = oper;
break;
}
}
switch (m_oper1) {
case KEY_PLUS: {
m_op1 += m_op2;
break;
}
case KEY_MINUS: {
m_op1 -= m_op2;
break;
}
case KEY_MULT: {
m_op1 *= m_op2;
break;
}
case KEY_DIVIDE: {
if ((-1e-30 &lt; m_op2) &amp;&amp; (m_op2 &lt; 1e-30)) {
BSP_display_error(&quot; Error 0 &quot;); // divide by zero
return false;
}
m_op1 /= m_op2;
break;
}
default: {
Q_ERROR();
break;
}
}
m_oper1 = oper;
m_oper2 = KEY_NULL;
result = m_op1;
}
else { // (oper == KEY_MULT) || (oper == KEY_DIV)
switch (m_oper2) {
case KEY_MULT: {
m_op2 *= op;
break;
}
case KEY_DIVIDE: {
if ((-1e-30 &lt; op) &amp;&amp; (op &lt; 1e-30)) {
BSP_display_error(&quot; Error 0 &quot;); // divide by zero
return false;
}
m_op2 /= op;
break;
}
default: { // oper2 not provided yet
m_op2 = op;
break;
}
}
m_oper2 = oper;
result = m_op2;
}
if ((result &lt; -99999999.0) || (99999999.0 &lt; result)) {
BSP_display_error(&quot; Error 1 &quot;); // out of range
return false;
}
if ((-0.0000001 &lt; result) &amp;&amp; (result &lt; 0.0000001)) {
result = 0.0;
}
BSP_display(result);
return true;</code>
</operation>
<!--${SMs::Calc::SM}-->
<statechart properties="0x02">
<!--${SMs::Calc::SM::initial}-->
<initial target="../1">
<action>BSP_clear();
(void)e; // unused parameter</action>
<initial_glyph conn="2,2,5,1,92,4,-2">
<action box="1,-2,13,4"/>
</initial_glyph>
</initial>
<!--${SMs::Calc::SM::on}-->
<state name="on">
<entry>BSP_message(&quot;on-ENTRY;&quot;);</entry>
<exit>BSP_message(&quot;on-EXIT;&quot;);</exit>
<!--${SMs::Calc::SM::on::initial}-->
<initial target="../3">
<action>BSP_message(&quot;on-INIT;&quot;);</action>
<initial_glyph conn="15,9,5,1,45,9,-2">
<action box="1,0,5,2"/>
</initial_glyph>
</initial>
<!--${SMs::Calc::SM::on::C}-->
<tran trig="C" target="..">
<action>BSP_clear();</action>
<tran_glyph conn="2,12,3,1,90">
<action box="0,-2,4,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::on::OFF}-->
<tran trig="OFF" target="../../2">
<tran_glyph conn="2,14,3,1,92,80,-75">
<action box="0,0,5,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::on::ready}-->
<state name="ready">
<entry>BSP_message(&quot;ready-ENTRY;&quot;);
m_oper2 = KEY_NULL;</entry>
<exit>BSP_message(&quot;ready-EXIT;&quot;);</exit>
<!--${SMs::Calc::SM::on::ready::initial}-->
<initial target="../6">
<action>BSP_message(&quot;ready-INIT;&quot;);</action>
<initial_glyph conn="18,20,5,0,20,2">
<action box="0,-2,6,2"/>
</initial_glyph>
</initial>
<!--${SMs::Calc::SM::on::ready::DIGIT_0}-->
<tran trig="DIGIT_0" target="../../4" cpref="../../../3/0">
<action>BSP_clear();</action>
<tran_glyph conn="16,34,2,0,5">
<action box="1,0,6,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::on::ready::DIGIT_1_9}-->
<tran trig="DIGIT_1_9" target="../../4" cpref="../../../3/1">
<action>BSP_clear();
BSP_insert(Q_EVT_CAST(CalcEvt)-&gt;key_code);</action>
<tran_glyph conn="32,34,2,0,3,1,2">
<action box="1,0,9,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::on::ready::POINT}-->
<tran trig="POINT" target="../../4" cpref="../../../3/2">
<action>BSP_clear();
BSP_insert((int)'0');
BSP_insert((int)'.');</action>
<tran_glyph conn="49,34,2,0,3,1,2">
<action box="0,0,6,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::on::ready::OPER}-->
<tran trig="OPER" target="../../5">
<action>m_op1 = BSP_get_value();
m_oper1 = Q_EVT_CAST(CalcEvt)-&gt;key_code;</action>
<tran_glyph conn="58,24,1,1,32,36,-32">
<action box="0,-2,6,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::on::ready::result}-->
<state name="result">
<entry>BSP_message(&quot;result-ENTRY;&quot;);</entry>
<exit>BSP_message(&quot;result-EXIT;&quot;);</exit>
<state_glyph node="14,22,10,10">
<entry box="1,2,5,2"/>
<exit box="1,4,5,2"/>
</state_glyph>
</state>
<!--${SMs::Calc::SM::on::ready::begin}-->
<state name="begin">
<entry>BSP_message(&quot;begin-ENTRY;&quot;);</entry>
<exit>BSP_message(&quot;begin-EXIT;&quot;);</exit>
<!--${SMs::Calc::SM::on::ready::begin::OPER}-->
<tran trig="OPER">
<!--${SMs::Calc::SM::on::ready::begin::OPER::[e->key=='-']}-->
<choice target="../../../../4" cpref="../../../../../3/3">
<guard brief="e-&gt;key == '-'">Q_EVT_CAST(CalcEvt)-&gt;key_code == KEY_MINUS</guard>
<choice_glyph conn="40,30,5,0,28,9">
<action box="1,0,11,2"/>
</choice_glyph>
</choice>
<!--${SMs::Calc::SM::on::ready::begin::OPER::[else]}-->
<choice>
<guard>else</guard>
<choice_glyph conn="40,30,4,-1,-4,4">
<action box="1,-3,6,2"/>
</choice_glyph>
</choice>
<tran_glyph conn="30,30,3,-1,10">
<action box="0,-2,6,2"/>
</tran_glyph>
</tran>
<state_glyph node="30,22,16,10">
<entry box="1,2,5,2"/>
<exit box="1,4,5,2"/>
</state_glyph>
</state>
<state_glyph node="8,16,50,18">
<entry box="1,2,5,2"/>
<exit box="1,4,5,2"/>
</state_glyph>
</state>
<!--${SMs::Calc::SM::on::operand1}-->
<smstate name="operand1" submachine="../../3">
<!--${SMs::Calc::SM::on::operand1::CE}-->
<xpseg xpref="../../../3/4" target="../../3">
<action>BSP_message(&quot;operand1:XP-CE;&quot;);</action>
<xpseg_glyph conn="84,47,1,1,4,-21,-30">
<action box="1,0,10,2"/>
</xpseg_glyph>
</xpseg>
<!--${SMs::Calc::SM::on::operand1::OPER}-->
<tran trig="OPER" target="../../5">
<action>m_op1 = BSP_get_value();
m_oper1 = Q_EVT_CAST(CalcEvt)-&gt;key_code;</action>
<tran_glyph conn="42,52,2,0,4">
<action box="0,0,6,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::on::operand1::EQUALS}-->
<tran trig="EQUALS" target="../../3/5">
<tran_glyph conn="8,48,3,3,-2,-22,8">
<action box="-2,-3,9,2"/>
</tran_glyph>
</tran>
<smstate_glyph node="8,40,76,12"/>
</smstate>
<!--${SMs::Calc::SM::on::opEntered}-->
<state name="opEntered">
<entry>BSP_message(&quot;opEntered-ENTRY;&quot;);</entry>
<exit>BSP_message(&quot;opEntered-EXIT;&quot;);</exit>
<!--${SMs::Calc::SM::on::opEntered::DIGIT_0}-->
<tran trig="DIGIT_0" target="../../6" cpref="../../../3/0">
<action>BSP_clear();</action>
<tran_glyph conn="27,70,2,0,2,-11,3">
<action box="1,0,6,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::on::opEntered::DIGIT_1_9}-->
<tran trig="DIGIT_1_9" target="../../6" cpref="../../../3/1">
<action>BSP_clear();
BSP_insert(Q_EVT_CAST(CalcEvt)-&gt;key_code);</action>
<tran_glyph conn="34,70,2,0,4,-1,1">
<action box="1,0,9,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::on::opEntered::POINT}-->
<tran trig="POINT" target="../../6" cpref="../../../3/2">
<action>BSP_clear();
BSP_insert((int)'0');
BSP_insert((int)'.');</action>
<tran_glyph conn="49,70,2,0,3,1,2">
<action box="0,0,6,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::on::opEntered::OPER}-->
<tran trig="OPER">
<!--${SMs::Calc::SM::on::opEntered::OPER::[e->key=='-']}-->
<choice target="../../../6" cpref="../../../../3/3">
<guard brief="e-&gt;key == '-'">Q_EVT_CAST(CalcEvt)-&gt;key_code == KEY_MINUS</guard>
<choice_glyph conn="34,66,5,0,34,9">
<action box="1,0,11,2"/>
</choice_glyph>
</choice>
<!--${SMs::Calc::SM::on::opEntered::OPER::[else]}-->
<choice>
<guard>else</guard>
<choice_glyph conn="34,66,4,-1,-4,4">
<action box="1,-3,6,2"/>
</choice_glyph>
</choice>
<tran_glyph conn="26,66,3,-1,8">
<action box="0,-2,6,2"/>
</tran_glyph>
</tran>
<state_glyph node="26,56,32,14">
<entry box="1,2,5,2"/>
<exit box="1,4,5,2"/>
</state_glyph>
</state>
<!--${SMs::Calc::SM::on::operand2}-->
<smstate name="operand2" submachine="../../3">
<!--${SMs::Calc::SM::on::operand2::CE}-->
<xpseg xpref="../../../3/4" target="../../5">
<action>BSP_message(&quot;operand2:XP-CE;&quot;);</action>
<xpseg_glyph conn="84,83,1,1,4,-21,-30">
<action box="1,0,10,2"/>
</xpseg_glyph>
</xpseg>
<!--${SMs::Calc::SM::on::operand2::OPER}-->
<tran trig="OPER">
<!--${SMs::Calc::SM::on::operand2::OPER::[else]}-->
<choice target="../../../7">
<guard>else</guard>
<choice_glyph conn="6,67,4,3,-5,5">
<action box="0,-5,6,2"/>
</choice_glyph>
</choice>
<!--${SMs::Calc::SM::on::operand2::OPER::[eval()]}-->
<choice target="../../../5">
<guard brief="eval()">eval(BSP_get_value(), Q_EVT_CAST(CalcEvt)-&gt;key_code)</guard>
<choice_glyph conn="6,67,5,3,16,-5,4">
<action box="1,0,10,2"/>
</choice_glyph>
</choice>
<tran_glyph conn="8,80,3,-1,-2,-13">
<action box="-2,-2,8,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::on::operand2::EQUALS}-->
<tran trig="EQUALS">
<!--${SMs::Calc::SM::on::operand2::EQUALS::[else]}-->
<choice target="../../../7">
<guard>else</guard>
<choice_glyph conn="4,58,5,3,7">
<action box="1,0,6,2"/>
</choice_glyph>
</choice>
<!--${SMs::Calc::SM::on::operand2::EQUALS::[eval()]}-->
<choice target="../../../3/5">
<guard brief="eval()">eval(BSP_get_value(), KEY_NULL)</guard>
<choice_glyph conn="4,58,4,3,-34,10">
<action box="0,-4,10,2"/>
</choice_glyph>
</choice>
<tran_glyph conn="8,84,3,-1,-4,-26">
<action box="-4,-2,8,2"/>
</tran_glyph>
</tran>
<smstate_glyph node="8,76,76,12"/>
</smstate>
<!--${SMs::Calc::SM::on::error}-->
<state name="error">
<entry>BSP_message(&quot;error-ENTRY;&quot;);</entry>
<exit>BSP_message(&quot;error-EXIT;&quot;);</exit>
<state_glyph node="11,56,9,8">
<entry box="1,2,5,2"/>
<exit box="1,4,5,2"/>
</state_glyph>
</state>
<state_glyph node="2,4,90,86">
<entry box="1,2,5,2"/>
<exit box="1,4,5,2"/>
</state_glyph>
</state>
<!--${SMs::Calc::SM::final}-->
<state name="final">
<entry>BSP_message(&quot;final-ENTRY;&quot;);
BSP_exit();</entry>
<state_glyph node="2,92,17,6">
<entry box="1,2,5,2"/>
</state_glyph>
</state>
<!--${SMs::Calc::SM::operand}-->
<submachine name="operand">
<entry>BSP_message(&quot;operand-ENTRY;&quot;);</entry>
<exit>BSP_message(&quot;operand-EXIT;&quot;);</exit>
<!--${SMs::Calc::SM::operand::EP-zero}-->
<epseg name="zero" target="../7">
<action>BSP_message(&quot;operand::EP-zero;&quot;);</action>
<epseg_glyph conn="11,2,0,0,8">
<name box="1,-2,10,2"/>
<action box="1,0,10,2"/>
</epseg_glyph>
</epseg>
<!--${SMs::Calc::SM::operand::EP-intgr}-->
<epseg name="intgr" target="../8">
<action>BSP_message(&quot;operand::EP-intgr;&quot;);</action>
<epseg_glyph conn="29,2,0,0,8">
<name box="1,-2,10,2"/>
<action box="1,0,10,2"/>
</epseg_glyph>
</epseg>
<!--${SMs::Calc::SM::operand::EP-frac}-->
<epseg name="frac" target="../9">
<action>BSP_message(&quot;operand::EP-frac;&quot;);</action>
<epseg_glyph conn="47,2,0,0,8">
<name box="1,-2,10,2"/>
<action box="1,0,10,2"/>
</epseg_glyph>
</epseg>
<!--${SMs::Calc::SM::operand::EP-neg}-->
<epseg name="neg" target="../10">
<action>BSP_message(&quot;operand::EP-neg;&quot;);</action>
<epseg_glyph conn="67,2,0,0,8">
<name box="1,-2,10,2"/>
<action box="1,0,10,2"/>
</epseg_glyph>
</epseg>
<!--${SMs::Calc::SM::operand::XP-CE}-->
<xp name="CE">
<xp_glyph point="84,20,1">
<name box="-3,-3,5,2"/>
</xp_glyph>
</xp>
<!--${SMs::Calc::SM::operand::initial}-->
<initial target="../7">
<action>BSP_message(&quot;operand-INIT;&quot;);</action>
<initial_glyph conn="20,6,5,0,-6,4">
<action box="0,-2,10,2"/>
</initial_glyph>
</initial>
<!--${SMs::Calc::SM::operand::CE}-->
<tran trig="CE" target=".." cpref="../4">
<action>BSP_message(&quot;operand::CE;&quot;);
BSP_clear();</action>
<tran_glyph conn="80,32,2,1,-12,3">
<action box="0,-2,10,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::operand::zero}-->
<state name="zero">
<entry>BSP_message(&quot;operand::zero-ENTRY;&quot;);</entry>
<exit>BSP_message(&quot;operand::zero-EXIT;&quot;);</exit>
<!--${SMs::Calc::SM::operand::zero::DIGIT_0}-->
<tran trig="DIGIT_0">
<action>;</action>
<tran_glyph conn="4,21,3,-1,10">
<action box="0,-2,7,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::operand::zero::DIGIT_1_9}-->
<tran trig="DIGIT_1_9" target="../../8">
<action>BSP_insert(Q_EVT_CAST(CalcEvt)-&gt;key_code);</action>
<tran_glyph conn="4,18,3,3,16,-6,2">
<action box="0,-2,9,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::operand::zero::POINT}-->
<tran trig="POINT" target="../../9">
<action>BSP_insert((int)'0');
BSP_insert((int)'.');</action>
<tran_glyph conn="6,23,2,2,2,40,-2">
<action box="1,0,6,2"/>
</tran_glyph>
</tran>
<state_glyph node="4,10,14,13">
<entry box="1,2,5,2"/>
<exit box="1,4,5,2"/>
</state_glyph>
</state>
<!--${SMs::Calc::SM::operand::intgr}-->
<state name="intgr">
<entry>BSP_message(&quot;operand::intgr-ENTRY;&quot;);</entry>
<exit>BSP_message(&quot;operand::intgr-EXIT;&quot;);</exit>
<!--${SMs::Calc::SM::operand::intgr::POINT}-->
<tran trig="POINT" target="../../9">
<action>BSP_insert((int)'.');</action>
<tran_glyph conn="22,18,3,3,16,-6,2">
<action box="0,-2,6,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::operand::intgr::DIGIT_0, DIGIT_1_9}-->
<tran trig="DIGIT_0, DIGIT_1_9">
<action>BSP_insert(Q_EVT_CAST(CalcEvt)-&gt;key_code);</action>
<tran_glyph conn="22,21,3,-1,10">
<action box="0,-2,14,2"/>
</tran_glyph>
</tran>
<state_glyph node="22,10,14,13">
<entry box="1,2,5,2"/>
<exit box="1,4,5,2"/>
</state_glyph>
</state>
<!--${SMs::Calc::SM::operand::frac}-->
<state name="frac">
<entry>BSP_message(&quot;operand::frac-ENTRY;&quot;);</entry>
<exit>BSP_message(&quot;operand::frac-EXIT;&quot;);</exit>
<!--${SMs::Calc::SM::operand::frac::POINT}-->
<tran trig="POINT">
<action>;</action>
<tran_glyph conn="40,21,3,-1,10">
<action box="0,-2,6,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::operand::frac::DIGIT_0, DIGIT_1_9}-->
<tran trig="DIGIT_0, DIGIT_1_9">
<action>BSP_insert(Q_EVT_CAST(CalcEvt)-&gt;key_code);</action>
<tran_glyph conn="40,18,3,-1,10">
<action box="0,-2,15,2"/>
</tran_glyph>
</tran>
<state_glyph node="40,10,14,13">
<entry box="1,2,5,2"/>
<exit box="1,4,5,2"/>
</state_glyph>
</state>
<!--${SMs::Calc::SM::operand::neg}-->
<state name="neg">
<entry>BSP_message(&quot;operand::neg-ENTRY;&quot;);
BSP_negate();</entry>
<exit>BSP_message(&quot;operand::neg-EXIT;&quot;);</exit>
<!--${SMs::Calc::SM::operand::neg::DIGIT_0}-->
<tran trig="DIGIT_0" target="../../7">
<action>BSP_insert(Q_EVT_CAST(CalcEvt)-&gt;key_code);</action>
<tran_glyph conn="58,23,2,2,4,-44,-4">
<action box="0,0,6,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::operand::neg::DIGIT_1_9}-->
<tran trig="DIGIT_1_9" target="../../8">
<action>BSP_insert(Q_EVT_CAST(CalcEvt)-&gt;key_code);</action>
<tran_glyph conn="65,23,2,2,5,-35,-5">
<action box="0,0,9,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::operand::neg::POINT}-->
<tran trig="POINT" target="../../9">
<action>BSP_insert(Q_EVT_CAST(CalcEvt)-&gt;key_code);</action>
<tran_glyph conn="73,23,2,2,6,-25,-6">
<action box="1,0,6,2"/>
</tran_glyph>
</tran>
<!--${SMs::Calc::SM::operand::neg::OPER}-->
<tran trig="OPER">
<!--${SMs::Calc::SM::operand::neg::OPER::[else]}-->
<choice>
<guard>else</guard>
<choice_glyph conn="66,18,4,-1,-4,8">
<action box="1,-4,6,2"/>
</choice_glyph>
</choice>
<!--${SMs::Calc::SM::operand::neg::OPER::[e->key=='-']}-->
<choice>
<guard brief="e-&gt;key == '-'">Q_EVT_CAST(CalcEvt)-&gt;key_code == KEY_MINUS</guard>
<action>;</action>
<choice_glyph conn="66,18,5,-1,8">
<action box="1,0,11,2"/>
</choice_glyph>
</choice>
<tran_glyph conn="56,18,3,-1,10">
<action box="0,-2,6,2"/>
</tran_glyph>
</tran>
<state_glyph node="56,10,22,13">
<entry box="1,2,5,2"/>
<exit box="1,4,5,2"/>
</state_glyph>
</state>
<submachine_diagram size="82,30">
<entry box="1,2,6,2"/>
<exit box="1,4,6,2"/>
</submachine_diagram>
</submachine>
<state_diagram size="96,100"/>
</statechart>
</class>
<!--${SMs::the_calc}-->
<attribute name="the_calc" type="QP::QHsm * const" visibility="0x00" properties="0x00">
<documentation>opaque pointer to the Calc state machine</documentation>
<code>= &amp;Calc::inst;</code>
</attribute>
</package>
<!--${.}-->
<directory name=".">
<!--${.::calc1_sub.hpp}-->
<file name="calc1_sub.hpp">
<text>#ifndef CALC1_SUB_HPP
#define CALC1_SUB_HPP
enum CalcSignals {
C_SIG = QP::Q_USER_SIG,
CE_SIG,
DIGIT_0_SIG,
DIGIT_1_9_SIG,
POINT_SIG,
OPER_SIG,
EQUALS_SIG,
OFF_SIG
};
$declare${Events::CalcEvt}
$declare${SMs::the_calc}
#endif // CALC1_SUB_HPP
</text>
</file>
<!--${.::calc1_sub.cpp}-->
<file name="calc1_sub.cpp">
<text>#include &quot;qpcpp.hpp&quot; // QP/C++ API
#include &quot;bsp.hpp&quot; // board support package
#include &quot;calc1_sub.hpp&quot; // application
Q_DEFINE_THIS_FILE
#define KEY_NULL '\0'
#define KEY_PLUS '+'
#define KEY_MINUS '-'
#define KEY_MULT '*'
#define KEY_DIVIDE '/'
$declare${SMs::Calc}
$define${SMs::the_calc}
$define${SMs::Calc}</text>
</file>
</directory>
</model>