genlib/fsm: add entering/ongoing/leaving methods