How do I be "done" from within a State Chart action?
Bob Paddock
graceindustr... at gmail.com
Thu Apr 24 15:21:10 UTC 2008
I have a serial protocol where I call Execute() as each character
comes in.
At the end of my data transfer I know that I am done from within
an action. With the knowledge that the transfer is complete how
do I get Execute() to return that the machine matched?
There will be no more characters coming in to drive the machine.
My attempts at using fbreak, which does nothing by staying in the
current state (as it should I believe), or '' -> final which
breaks the transfer protocol, have not worked.
How do I be "done" from within a State Chart action?
int StateChart::Execute( const uint8_t *data )
{
const char *p = (const char *) data;
const char *pe = p+1;
const char *eof = 0; // This fixes compiler bug for Ragel 6.1 with DMC
8.5.x
wxLogVerbose( _("Execute[%02X]"), *data );
if( (cs == StateChart_error) ||
(cs == StateChart_first_final)
)
{
wxLogVerbose( _("-1 Error B4 write cs = [State{%d}]") , cs );
return -1; /* Error */
}
%% write exec;
if ( cs == StateChart_error )
{
wxLogVerbose( _("-1 Error after write cs = [State{%d}]") , cs );
return -1; /* Error */
}
if( cs >= StateChart_first_final )
{
wxLogVerbose( _("!*Matched*! cs = [State{%d}]") , cs );
return 1; /* Matched */
}
wxLogVerbose( _("No Matched cs = [State{%d}]") , cs );
return 0; /* No Match */
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.colm.net/pipermail/ragel/attachments/20080424/93b6b5a7/attachment.html>
More information about the ragel-users
mailing list