two state machines in single source - I cannot believe
mitchell
mforal.n... at gmail.com
Sat Jun 7 05:45:42 UTC 2008
Hi,
> there must be a way to instantiate two (or more) state machine within
> a single .rl source file.
Use fgoto or fcall to move between machines.
e.g:
%%{
machine foo;
bar := 'bar';
baz := 'baz' @{ fgoto bar; }
}%%
You can pick and choose which machine to start when exec is called by
setting the cs variable to [machine name]_en_[machine definition].
e.g:
int cs;
%%{
machine foo;
bar := 'bar';
baz := 'baz';
}%%
write init;
cs = (condition) ? foo_bar : foo_baz;
write exec;
Take care,
More information about the ragel-users
mailing list