Question about nested state charts

Zed A. Shaw zeds... at
Thu Dec 21 06:41:19 UTC 2006


I'm looking for some advice on doing a nested state chart.  First, here's a sample:

Connection = (
  start: ( open -> Accepting ),

  Accepting: (
    start: ( logged_in -> Processing ),
    Processing: ( receive -> Delivering | close -> Connection::Aborting ),
    Delivering: ( delivered -> Processing ),

  Aborting: ( finalized -> final )
) >begin %finish @!error;

So my first question is if I'm just crazy for doing it this way?  The manual doesn't *really* say you can nest state chart style machines like this, so the "| close -> Aborting" doesn't actually resolve.  The manual does talk about Resolving Names but "Connection::Aborting" doesn't work for breaking out of the Accepting::Processing state and into Aborting.

Also, I'm doing this as an experiment in using Ragel machines for specifying a server's logic execution.  Not sure what the end result will be, but it's already simplified quite a bit of code.  My only complaint is that there's tons of duplication between the source and the ragel file.  For example, I have to say logged_in='L' in the .rl and then again in a .h somewhere.  It would be nicer if I can tell ragel, "Anything you can resolve should be used symbolically since I defined it someplace else."  Could work for actions too where ragel assumes any action it knows nothing about is a direct function call with a certain signature.


Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu -- The Mongrel Book -- Come get help.

More information about the ragel-users mailing list