- From: Roger Hoover <roger.hoover@gmail.com>
- Date: Tue, 28 Jul 2009 11:23:42 -0700
- To: Philipp Kolhoff <philipp.kolhoff@googlemail.com>
- Cc: www-voice@w3.org
- Message-ID: <44cb1ba30907281123r3a8a604yeede1aa19579774@mail.gmail.com>
Hi Philipp, Where did you find the description of the SCXML algorithm? I'd like to take a look. Thanks, Roger On Mon, Jul 27, 2009 at 12:55 PM, Philipp Kolhoff < philipp.kolhoff@googlemail.com> wrote: > (Sorry for duplicates, I did not use my registered email before) > Hi there, > I've been working with Statecharts and esp. SCXML for a longer time now. I > started implementing an interpreter in C# and C++ first for my > Diploma-Thesis, which got then published in "Game AI Wisdom 4" and later > found use in my companies Point&Click-Adventure Engine. Now i started to > work on an interpreter written in ActionScript to get a library that any > Flex developer can slap into her RIA/game. So when I came back I found the > description of the Algorithm for interpreting SCXML's and that was a great > help to re-implement my interpreter. > However I stumbled upon a part in the mainEventLoop after implementing it > and running some Test-SCXML's... maybe I did not get it right, but I think > there maybe a mistake: > > Take a scxml snipplet like this: > > <parallel id="InTest"> > <state id="s1"> > <initial> > <transition target="s11"/> > </initial> > <state id="s11"/> > <final id="s12"/> > </state> > <state id="s2"> > <initial> > <transition target="s21"/> > </initial> > <state id="s21"/> > <final id="s22"/> > </state> > <transition event="InTest.Done" target="f"/> > </parallel> > > ....... > > // now take any newly enabled null transitions and any transitions > triggered by internal events > macroStepComplete = false; > until(macroStepComplete): > enabledTransitions = selectEventlessTransitions() > if (enabledTransitions.isEmpty()): internalEvent = > internalQueue.dequeue()// this call returns immediately if no event is > available > if (internalEvent): > datamodel.assignValue("event", internalEvent) > enabledTransitions = selectTransitions(internalEvent) > if (enabledTransitions): > microstep(enabledTransitions.toList() > else: > macroStepComplete = true > ...... > > Suppose during the execution of an external event more than one internal > event is queued. This happens often if a parallel-state is "Done" and its > children are as well. In the case listed above, there would be generated the > events s1.Done, s2.Done and InTest.Done in that order (if proper transitions > would exist and the events would be fired). During the next macro step, the > first internalEvent is dequeued ("s1.Done"), but no transition will be > enabled. That would mark the macroStep as complete and no other internal > event is handled until the next external event is dispatched. > Imho, there should be done something like this more likely: > > if (enabledTransitions): > microstep(enabledTransitions.toList() > else: > macroStepComplete = internalQueue.isEmpty() > > So, if the internalQueue is not empty, the macrostep will dequeue the next > event in the internal queue. > > Any opinions? > > Best regards, > Philipp Kolhoff > > > >
Received on Tuesday, 28 July 2009 21:44:37 UTC