This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
http://stackoverflow.com/questions/1371460/state-machines-tutorials/1371654#1371654 | |
State machines are very simple in C if you use function pointers. | |
Basically you need 2 arrays - one for state function pointers and one for state | |
transition rules. Every state function returns the code, you lookup state | |
transition table by state and return code to find the next state and then | |
just execute it. | |
*/ |