hierarchical state machine library in C