selecting a starting state or how to serialize a machine

skk skkib... at earthlink.net
Sun Feb 25 03:19:24 UTC 2007


What I have done with a text editor in a windows control is build the
initial state machine so things transition through the basic states as
required.  I validate this machine first.  Then I build in transitions
from the start state into the internal states with the input that
represents the current state.  In the text editor, build the machine
to handle the cursor movement, character insert, delete, insert/
overwright, skip mask characters and so on.  When entering the machine
I then create a transition from the initial state into the internal
states after computing the current state of the cursor.  The current
state of the cursor can be far left/right, insert/overwright, valid
character to the left/right/both, etc.  This is encoded into an
integer (all input is in integers, not characters) and is fed in as
the first character thus putting me exactly where I want to be for the
next keyboard input character (integer).  This is necessary because
the user may have moved the text cursor with the mouse and the last
state I was in is not valid any more.

On Feb 23, 9:08 pm, "Jason" <jason2... at jasonjobe.com> wrote:
> I am finding more uses for ragel all the time :-)
> Now I am experimenting with using a ragel to model work flow logic.
> For example, a document has an associated state, approved, rejected,
> pending, etc. So I want to load the document and "post" events that
> will drive the document status to new states, triggering actions
> along
> the way.
>
> So the question is: How do I tell a ragel machine I want to start at
> a
> particular point (where it left off before)?
>
> Do I just archive the entire machine variables (fixing up pointers of
> course)?
>
> thanks,
> Jason



More information about the ragel-users mailing list