A tool for generating formalized state machines.
This is the actual tool which generates the output code.
This is an extensions module to proof of concept the ability to dynamically add FSM language support to FSMGen.
This is the only currently supported implementation of state machines. A reference implementation in C++.
startfsm
Begins FSM definition.
endfsm
Ends FSM definition.
state STATENAME
Begins a state definition with the given name.
endstate
Ends a state definition.
initial
Makes this state the initial state when parent state is entered.
update
Creates an update callback which is called while the state is active.
Interface commands are used to control the state machine from an external source. You define an interface command and then your implement handlers in the state machine itself. For all interface commands, command executes if the generated test function returns InterfaceResult::Success. Command is denied if test function returns InterfaceResult::Failed. Command test continues up state chain if test function returns InterfaceResult::Unhandled
interfacecommand
Define an interface command to be used with the FSM.
transition INTERFACECOMMAND STATENAME
Define a transition to STATENAME on INTERFACECOMMAND. Transitions can only be to sibling states or siblings of parent states.
test INTERFACECOMMAND
Defines a test function which will handle INTERFACECOMMAND but perform no transition.
allow INTERFACECOMMAND
Defines an automatic allow for all INTERFACECOMMAND tests.
deny INTERFACECOMMAND
Defines an automatic deny for all INTERFACECOMMAND tests.
Transitions are polled per frame, and when the test function returns true, the exec function is called and the transition to the new state is performed.
transition STATENAME
Defines an internal transition to STATENAME. Transitions can only be to sibling states or siblings of parent states.
Various commands can have attributes. Those attributes modify the functionality of the given statement.
+allow
Use: transition command Causes transition to not generate a test function, instead allowing the command by default.
+noexec
Causes transition or test to not generate an exec function, useful for when you don't want to implement one.
+noexit
Use: state
Suppresses generation of an onStateExit function
+noenter
Use: state
Suppresses generation of an onStateEnter function
state
__+target__
This modifier for states allows you to use special functionality to jump to a state, no matter where in the hierarchy it is. Note that this requires knowledge of where you are jumping from and to, and can be dangerous.
__timer _TIMERNAME___
This state info creates a named timer which can be referenced to determine how long you were in a state.