RE: SDL-News: sub-state machine and persistent state


Subject: RE: SDL-News: sub-state machine and persistent state
From: Y Giridhar Appaji Nag (Giridhar.Nag#ubinetics.co.in)
Date: Thu Feb 13 2003 - 06:09:31 GMT


Become an SDL Forum Society member <http://www.sdl-forum.org/Society/members.htm>
The originator of this message is responsible for its content.
-----From Y Giridhar Appaji Nag <Giridhar.Nag#ubinetics.co.in> to sdlnews -----

Hello Scott,

Scott Shen <mailto:Scott.Shen#holleycomm.com> wrote:
> Does anyone know how to model sub-state machine in SDL? Is it correct

You can do this by using SDL procedures with states.

> to say that we can define sub-state machines in procedures but
> whenever the procedure is called the sub-state always starts from
> "start"?

Right and wrong. You can define states in procedures and also the
entry point is _always_ the "Procedure Start" symbol (Just like in
a SDL process the starting point is always the "Process Start".

If your intention is to go into different states within the same
procedure (on enterin it) based on some condition, you can use a
decision to decide where to go.

> Now I want to have multiple sub-state machines (each is run in a
> procedure) running concurrently inside a process, therefore every

Do you mean to say "sub-state machine each is 'implemenented' as a
procedure"?

> time the process leaves and returns to a procedure the revisited

And ... "every time the procedure returns to the calling process"

> procedure should remember what was its last sub-state and resume from
> the same sub-state. Is there any way allow me to do something like
> that in SDL? Or, is there a better (the right way) approach?

Every time a procedure returns, it returns to where it was called
from. This holds for nested procedures also in SDL (meaning, it you
call a procedure within a procedure it would return to where it was
called from).

However if you are looking at something like this ...

Process P call a procedure S and S itself has states S1 and S2. When
S is called from P for the first time, it goes to S1 and later to S2
and then returns to P. When S is called from P the next time, it would
*not* start from S2. The context within the procedure is lost.

In case you want to achieve the above, you might have to remember that
Procedure S returned from S2, pass this as a parameter to the procedure
when it is called again and then in S, go to S2 based on this parameter.

There might be better ways of doing this. I am not very sure though.

Hope this helps.

        Giridhar

--
Y Giridhar Appaji Nag       Giridhar.Nag[#t]ubinetics(.)co.in

Software evolves. It isn't designed. The only question is how strictly you _control_ the evolution, and how open you are to external sources of mutations. And too much control of the evolution will kill you. Inevitably, and without fail. Always. In biology, and in software. - Linus

an individual are not necessarily those of UbiNetics --End text from Y Giridhar Appaji Nag <Giridhar.Nag#ubinetics.co.in> to sdlnews --- For extra SDL Forum Society benefits join at <http://www.sdl-forum.org/Society/members.htm>



This archive was generated by hypermail 2a23 : Thu May 09 2013 - 16:05:49 GMT