[ragel-users] Re: State Chart Finishing Actions?

Adrian Thurston thurs... at cs.queensu.ca
Tue Apr 15 20:37:01 UTC 2008


Hi Bob,

I think what you want instead of any* is [^>]. The any* will forever
remain active as a thread through the machine, which is why the Starting
action is propagated to every state.

-Adrian

Bob Paddock wrote:
> 
> Am I not understanding something here, or is there
> a bug with State Charts in 6.1?
> 
> I'm dealing with a serial protocol.  I want to stay
> in the starting state until I receive a ">".
> 
> Here is a snippet of have I have:
> 
> action Starting {
>  wxLogVerbose( _("Starting [State{%d}]") , cs );
> }
> 
> bootloader = (
>  start: (
>   '>' @start_signal_received -> UnitID
>   any*                       -> start # Only a '>' means anything to us
> in the starting state
>  )@Starting,
> 
>  UnitID: (
>   '>' @start_signal_received   -> UnitID         |
> 
>  'A' @{ DeviceID_u16 = 1; }    -> FlashSize      |
>  ...
> 
> Everything seems to work but the action 'Starting' is called for
> *EVERY* state in the chart.  If this is what any* does, this
> isn't what I want.  I only want 'Starting' called when I
> transition from 'start' to 'UnitID'.  Once I leave 'start'
> I don't want to see any more 'Starting' message.
> 
> ?
> 
> Example output:
> 13:22:49: >
> 13:22:49: Execute[0x3E]  {Byte passed to write exec}
> 13:22:49: Begin
> 13:22:49: Synchronization Signal Received.
> 13:22:49: Starting [State{2}]  {This is good, it belongs here}
> 
> 13:22:49: [Not printable]
> 13:22:49: Execute[0x95]
> 13:22:49: Starting [State{4}] {This is *BAD*, doesn't belong here}
> 13:22:49: Device_ID=8, EXECCODE=00FF, PageMul = 8
> 
> 13:22:49: o
> 13:22:49: Execute[0x6F]
> 13:22:49: Starting [State{5}] {This is *BAD*, doesn't belong here}
> 13:22:49: DeviceFlashSize = 65536
> 
> If I use *any in other states then they show up in the list when
> then should not as well.
> 
> Compiled on  Windows with Digital Mars Compiler with:
> 
> BootLoaderStateChart.cpp: BootLoaderStateChart.rl
>  G:\U\Ragel61\bin\ragel -s BootLoaderStateChart.rl -o
> BootLoaderStateChart.cpp
> 
>  
> 
> 
> > 



More information about the ragel-users mailing list