Would you like to make this site your homepage? It's fast and easy...
Yes, Please make this my home page!
This page defines all the valid Automated Finite State Machine
transition attributes are required. The rest
cookie) are optional, as noted.
Please see the example page
to see exactly how many of these machine attributes are used.
- For every valid processing state, you must specify a state name.
- For every valid event that can cause a state transition,
you must specify an event name.
Transition entries specify which transitions are valid, based on
the original state and the transition event. It may specify an
advisory destination state, but if it does not, then the transition
defaults to an unchanged result state. Conflicting transition
specifications will silently override each other. This makes specifying
all state or all event type transitions useful.
Every transition must specify one or more initial state attributes
tst) and one or more transition events (
- Transition initial state. You may specify a list of states,
as in `tst = first, second, another;', or you may specify all states
with an asterisk, as in: ``tst = "*";''
- Transition event. You may specify a list of events,
as in `tev = evt-1, evt-2, evt-n;', or you may specify all events
with an asterisk, as in: ``tev = "*";''
- Next state. You may only specify one. If you do not specify
it, the transition will default to not changing state.
- Transition type. Occasionally, it is convenient to handle
different transitions with the same code. Often, when you specify
multiple states or multiple events in a single transition specification.
Specifying this attribute will cause the FSM to invoke the same code.
Specifying `invalid' will render the transition invalid, as if it
had not been specified before.
There are three FSM implementation methods supported,
including no implementation.
That "method" leaves it to you to supply all the code.
You must set the method attribute to one of the following,
or omit it entirely:
switch statement in C. A procedure will
be emitted that contains a giant switch statement. Each case element
will have stylized comments that will enable any code that has been
inserted there to be carried forward to new generations of the code.
You can see an example of this here.
- Instead of containing a transition enumeration, the
transition table will contain pointers to transition procedures.
The main FSM processing routine will indirectly call the proper
procedure for handling each transition. The called procedure
will be stubbed out and contain the same type of stylized comments
case version, above, does.
- No implementation code will be emitted. However, the state,
event, transition enumerations and the transition table are all emitted.
The emitted header file will contain external declarations for the
transition table and transition error procedure, unless you
DEFINE_FSM name. See the file
agen5/pseudo-fsm.h in the AutoGen sources for an example of this.
The machine type must be set to either
loop, unless you are not choosing an implementation
- Normally, a FSM runs until it reaches a terminal state, either
DONE. Sometimes, external code
must control the loop and it must call a transition `step' when a
transition event is detected. For these situations, choose the `step'
machine type. The procedure emitted will return the current state
at the end of each call.
- A looping finite state machine is the normal implementation.
You call it, it initializes itself and runs until a terminal state
- If you do not specify an implementation method, you may omit
the ``type'' attribute.
- External value prefix. This will keep the generated external
values disambiguated. If you do not specify this, it will default
to the base name of the definitions file. Our example FSM specifies ``EX'' for its prefix.
- This must be a C-type plus a name suitable for use in an
ANSI procedure definition. It is used to pass whatever arguments
you need to the transition handling code. For example,
void* cookie'' will pass a void pointer named `cookie'.
Note: the name must be preceeded by a space character
in order to be correctly separated from the type.
AutoGen, AutoOpts, columns, getdefs, AutoFSM, AutoXDR and these web pages
copyright (c) 1999, 2000, 2001 Bruce Korb, all rights reserved.