This template collection will produce a finite state machine based on a
description of such a machine. The presumption is that you generally
do not need to know what the current state is in order to determine what
kind of transition is to be taken. That is to say, there is a global
transition table that is indexed by the current state and the next
transition type to determine the next state and trigger any optional
transition handling code.
The finite state machine may be either the master, driving the other
parts of the program, or act as a subroutine keeping track of state
between calls. Consequently, the "type" attribute may be set to:
If the machine processes transitions until it reaches a terminal
state (error or done).
If the FSM code will process a single transition and then return.
This method is much the same as stepping, except that the caller
must save the current state and provide it on the next call.
In this fashion, an FSM may be used in a multi threaded application.
The machine can be constructed in either of three formats, depending
on the value of the "method" attribute:
This method will use a callout table instead of a switch statement
to implement the machine.
This is the alternate implementation method.
Do not supply the "method" attribute. Choosing this will cause only
the dispatch table to be created. The implementation code is omitted.
The "type" attribute is then ignored.
Files generated by example.def:
Additional Templates for autofsm:
This template produces a header file with an enumeration of all the defined
bits. If the bit collection fits in a 32 or 64 bit word, then the bit values
will also be #defined. A set of macros will also be defined for manipulating
the bit collections. The interface to these macros is consistent, even if
the implementation has to resort to arrays of words to hold all the bits.
(That is, if there are more than 64 bits.)
Unless suppressed, a .c file is also produced with two routines for convert-
ing from a list of bit names to a bit collection and back again.
Files generated by b-test.def:
Additional Templates for bits:
This template will produce a header file and one or two source files.
You supply a list of commands as values for "cmd" and it will produce
an enumeration of these commands and code that will match strings against
these command names. The input command name need only be as long as
needed for a unique partial match. For example, if there is only one
command that starts with "x", then the single letter "x" is sufficient
for a unique match.
Files generated by greek.def: