Skip to content

mrcharles/FSMGen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FSMGen

A tool for generating formalized state machines.

FSMGen

This is the actual tool which generates the output code.

FSMExtensions

This is an extensions module to proof of concept the ability to dynamically add FSM language support to FSMGen.

FSMCpp

This is the only currently supported implementation of state machines. A reference implementation in C++.

FSM Definition

startfsm

Begins FSM definition.

endfsm

Ends FSM definition.

State Definition

state STATENAME

Begins a state definition with the given name.

endstate

Ends a state definition.

State information

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

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.

Internal Transitions

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.

Attributes

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

FSM Extension Functionality

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.

About

A tool for generating formalized state machines.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors