sm fsm.cpp initial version v0.1