jp-embedded / scxmlcc

The SCXML state machine to C++ compiler
GNU General Public License v3.0
140 stars 34 forks source link

Wrong behaviour with multiple parallel states #94

Closed sstiller closed 5 years ago

sstiller commented 5 years ago

Some states (children of parallel) are left if another parallel state is entered.

<?xml version="1.0" encoding="UTF-8"?>
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" binding="early" name="multiparallel" initial="P1">
    <parallel id="P1">
        <state id="P1S1">
        </state>
        <parallel id="P1P1">
            <state id="P1P1S1">
            </state>
            <state id="P1P1S2">
            </state>
        </parallel>
    </parallel>
</scxml>

C++ code:

#include "multi-parallel.h"

int main(int argc, char *argv[])
{
    sc_multiparallel sc;
    sc.init();

    return 0;
}

On start, all the states should be active, but as you can see, when entering P1P1S1, the state P1S1 is left:

sc_multiparallel: transition [initial] sc_multiparallel::scxml -> sc_multiparallel::state_P1
sc_multiparallel: enter sc_multiparallel::state_P1
sc_multiparallel: transition [initial] sc_multiparallel::state_P1 -> sc_multiparallel::state_P1S1
sc_multiparallel: enter sc_multiparallel::state_P1S1
sc_multiparallel: enter sc_multiparallel::state_P1P1
sc_multiparallel: transition [initial] sc_multiparallel::state_P1P1 -> sc_multiparallel::state_P1P1S1
sc_multiparallel: exit sc_multiparallel::state_P1S1
sc_multiparallel: enter sc_multiparallel::state_P1P1S1
sc_multiparallel: enter sc_multiparallel::state_P1P1S2
jp-embedded commented 5 years ago

Thanks. I will have a look at this, when possible :-)