scxml Historic ancestor entry states

Hi,

I have seen in the entryStates the next code:
http://www.w3.org/TR/scxml/#AlgorithmforSCXMLInterpretation

procedure addStatesToEnter(state,root,statesToEnter,statesForDefaultEntry)
...

    if isHistoryState(state):
        if historyValue[state.id]:
            for s in historyValue[state.id]:
                addStatesToEnter(s,statesToEnter,statesForDefaultEntry)
                *for anc in getProperAncestors(s,state):
                    statesToEnter.add(anc)*


Taking in account the next state machine:
roostate-->r
rootState-->s
s-->h
s-->s1
s-->s2
s2-->s21
s2-->s22

Where h is a historic state and the current configuration is s,s2,s22.
There are two transition, one from s-->r (so the state s22 is saved) and
the other r-->h

If I understood well the proper configuration should be again s,s2,s22
after the 2 transitions.

When we execute the previous snippet we will add first the state s22:

 addStatesToEnter(*s22*,statesToEnter,statesForDefaultEntry)


And after we need to add the proper ancestors, which I understand that are
s2 and s.
But, if we execute the highlighted code what we will obtain?

*getProperAncestors(**s22*,*h*)=root???

*h will be never an ancestor of a saved state, maybe a sibling or an "aunt"*

I think the getProperAncestors should be called with the grandparent of the
history state because the parent of the history state is the parent of the
saved state but is also a state to be entered, so if we want
getProperAncestors to return s2 and s we should change for:

*getProperAncestors(**s,state.parent.parent*)


Tell me what do you thing please.

Best regards,
Carlos Verdes.

Received on Tuesday, 13 November 2012 01:18:51 UTC