Author image Barrie Slaymaker

NAME

StateML - State Machine Markup Language, with GraphViz and template-driven code generation

SYNOPSIS

   ## See the stml command for command line use (recommended)

   ## Here's what a .stml file might look like:

   <machine
       id="main"
       xmlns="http://slaysys.com/StateML/1.0"
       xmlns:C="http://your.com/path/to/ns/for/C/code"
       xmlns:Perl="http://your.com/path/to/ns/for/perl/code"
       xmlns:Java="http://your.com/path/to/ns/for/Java/code"
       ...
    >
       <event id="init">
           <C:api>void init_event_handler()</C:api>
       </event>
       <state id="#ALL" graphviz:style="dashed">
           <arc event_id="init" goto="running">
               <C:handler>init_device()</C:handler>
           </arc>
       </state>
       <state id="running"/>
   </machine>

   use StateML;

   my $machine = StateML->parse( $source ); ## filename, GLOB, etc.

   StateML->parse( $source, $machine ); ## Add to existing machine

   ... process $machine as needed, see stml source for ideas...

DESCRIPTION

WARNING: Alpha code. I use it in production, but you may want to limit your use to development only.

StateML is an XML dialect and a tool (stml) that reads this dialect (by default from files with a ".stml" extension) and converts it to source code using source code to a data structure.

It can then emit the data structure as a graphviz-generated image or graph specification or you may take the data structure and do what you want with it (bin/stml can pass it to template toolkit, for instance).

parse
    my $m = StateML->parse( \$StateML_string ) ;
    my $m = StateML->parse( \*F ) ;

graphviz Support

Any XML attributes in the namespace

    http://slaysys.com/StateML/1.0/GraphViz

(generally mapped to the "graphviz:" prefix), like

    <machine
      id="foo"
      xmlns="http://slaysys.com/StateML/1.0"
      xmlns:graphviz="http://slaysys.com/StateML/1.0/GraphViz"
    >

      <event graphviz:style="bold">

      <state id="foo"
        graphviz:style="dashed"
        graphviz:peripheries="2"
      >
    </machine>

are passed to the dot program. See the dot program for details. StateML does not police these.

LIMITATIONS

Alpha code. Ok test suite, but we may need to change things in non-backward compatible ways.

COPYRIGHT

    Copyright 2003, R. Barrie Slaymaker, Jr., All Rights Reserved

LICENSE

You may use this module under the terms of the BSD, Artistic, or GPL licenses, any version.

AUTHOR

Barrie Slaymaker <barries@slaysys.com>