[ragel-users] Figuring out/referring to FSM states (cs values) outside of action{} blox

Rashid Karimov rashid.karimov at gmail.com
Wed Nov 18 16:14:38 UTC 2009


Say I have a machine defined with a number of states in it:

S1 (

Event1 -> S2 ),

S2 (

Event2 -> S3),

..... and so on .

I access cs as  blah->cs .

If I want to figure out and/or modify , outside of FMS action{} code blocks,
if the current state is S2 or S3,
how do I find out what S2 and S3 translate to, in terms of context->cs value

Outside of exporting FSM as an XML and then going over it, is there a way to
ask Ragel to "export" the state
mappings ? Similar to the  way one can import event definitions like so:

#define Event1 'a'
#define Event2 'b'

can Ragel export state cs values like so:

#define S1 1
#define S2 2

Again, one could use Ragel's dot or XML output to figure out what different
states translate to in terms of cs values
and then map them manually, but I was hoping there's a different, more
automated way to go about it.

When/if the FSM definition is modified - new states included, existing
states deleted,  etc, such manual definitions
would clearly get out of sync  and this is what I am trying to avoid.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20091118/d4b2be30/attachment-0001.html>

More information about the ragel-users mailing list