//first line
/*This file is generated from StateMGen.java */

#include "ExampleSimpleData.h"
#include <stdio.h>
#include "exampleSimpleStates.h"

//all entry-prototypes:
void entry_Off_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void entry_Ready_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void entry_Running1_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void entry_Running21_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void entry_Running2_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void entry_Running_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void entry_Finit_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void entry_Active1_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void entry_On_a_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void entry_On_b_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void entry_RemainOn_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void entry_ShouldOff_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void entry_Active2_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void entry_Active_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void entry_Work_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);

void exit_Off_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void exit_Ready_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void exit_Running1_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void exit_Running21_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void exit_Running2_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void exit_Running_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void exit_Finit_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void exit_Active1_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void exit_On_a_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void exit_On_b_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void exit_RemainOn_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void exit_ShouldOff_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void exit_Active2_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void exit_Active_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);
void exit_Work_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event);





static void entry_Off_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ //genStateM: entry StateComposite or StateSimple. 
  thiz->state.statetop = kOff_State_ExampleSimpleData;
  thiz->work = 0;
    
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf(" entry Off;\n");
  #endif
}

INLINE_Fwc void exit_Off_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf("   exit Off;\n");
  #endif
  
}



INLINE_Fwc int trans_Off_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ int trans = 0;
  //genStateM: check all conditions of transitions, return on transition with != 0
  if(thiz->on_ready) {
    exit_Off_ExampleSimpleData(thiz, event);
    thiz->work = 1;
    entry_Work_ExampleSimpleData(thiz, event);
    entry_Ready_ExampleSimpleData(thiz, event);
    trans = mTransit_States_Fwc; 
  }
  else 
  if(thiz->on_cont) {
    exit_Off_ExampleSimpleData(thiz, event);
    
    entry_Work_ExampleSimpleData(thiz, event);
    trans = mTransit_States_Fwc; 
  }
  else 
  { //StateMGen: action in state. No transition switched.
    thiz->counter +=1;
    
  }
  return trans;
}






static void entry_Ready_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ //genStateM: entry StateComposite or StateSimple. 
  thiz->state.stateWork = kReady_State_ExampleSimpleData;
  
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf(" entry Ready;\n");
  #endif
}

INLINE_Fwc void exit_Ready_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf("   exit Ready;\n");
  #endif
  
}



INLINE_Fwc int trans_Ready_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ int trans = 0;
  //genStateM: check all conditions of transitions, return on transition with != 0
  if(event == kStart_Event_ExampleSimple) {
    exit_Ready_ExampleSimpleData(thiz, event);
    
    entry_Active_ExampleSimpleData(thiz, event);
    entry_Active1_ExampleSimpleData(thiz, event);
    entry_Active2_ExampleSimpleData(thiz, event);
    entry_Running_ExampleSimpleData(thiz, event);
    entry_RemainOn_ExampleSimpleData(thiz, event);
    entry_Running2_ExampleSimpleData(thiz, event);
    entry_Running21_ExampleSimpleData(thiz, event);
    trans = mTransit_States_Fwc; 
  }
  else 
  { //StateMGen: action in state. No transition switched.
    
  }
  return trans;
}






static void entry_Running1_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ //genStateM: entry StateComposite or StateSimple. 
  thiz->state.stateActive1 = kRunning1_State_ExampleSimpleData;
  
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf(" entry Running1;\n");
  #endif
}

INLINE_Fwc void exit_Running1_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf("   exit Running1;\n");
  #endif
  
}



INLINE_Fwc int trans_Running1_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ int trans = 0;
  //genStateM: check all conditions of transitions, return on transition with != 0
  //genStateM: no transitions.
  //genStateM: transitions of enclosing state: Running
  if(thiz->state.timerActive1 <0) {
    exit_Running_ExampleSimpleData(thiz, event);
    
    entry_Finit_ExampleSimpleData(thiz, event);
    trans = mTransit_States_Fwc; 
  }
  else 
  { //StateMGen: action in state. No transition switched.
    
  }
  return trans;
}






static void entry_Running21_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ //genStateM: entry StateComposite or StateSimple. 
  thiz->state.stateActive1 = kRunning21_State_ExampleSimpleData;
  
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf(" entry Running21;\n");
  #endif
}

INLINE_Fwc void exit_Running21_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf("   exit Running21;\n");
  #endif
  
}



INLINE_Fwc int trans_Running21_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ int trans = 0;
  //genStateM: check all conditions of transitions, return on transition with != 0
  //genStateM: no transitions.
  //genStateM: transitions of enclosing state: Running2
  //genStateM: no transitions.
  //genStateM: transitions of enclosing state: Running
  if(thiz->state.timerActive1 <0) {
    exit_Running_ExampleSimpleData(thiz, event);
    
    entry_Finit_ExampleSimpleData(thiz, event);
    trans = mTransit_States_Fwc; 
  }
  else 
  { //StateMGen: action in state. No transition switched.
    
  }
  return trans;
}






static void entry_Running2_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ //genStateM: entry StateComposite or StateSimple. 
  thiz->state.stateActive1 = kRunning2_State_ExampleSimpleData;
  
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf(" entry Running2;\n");
  #endif
}

INLINE_Fwc void exit_Running2_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf("   exit Running2;\n");
  #endif
  
}



INLINE_Fwc int trans_Running2_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ int trans = 0;
  //genStateM: check all conditions of transitions, return on transition with != 0
  //genStateM: no transitions.
  //genStateM: transitions of enclosing state: Running
  if(thiz->state.timerActive1 <0) {
    exit_Running_ExampleSimpleData(thiz, event);
    
    entry_Finit_ExampleSimpleData(thiz, event);
    trans = mTransit_States_Fwc; 
  }
  else 
  { //StateMGen: action in state. No transition switched.
    
  }
  return trans;
}






static void entry_Running_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ //genStateM: entry StateComposite or StateSimple. 
  thiz->state.stateActive1 = kRunning_State_ExampleSimpleData;
  thiz->state.timerActive1 = thiz->delay;
  thiz->out = 3; 
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf(" entry Running;\n");
  #endif
}

INLINE_Fwc void exit_Running_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf("   exit Running;\n");
  #endif
  thiz->out = 5; 
}



INLINE_Fwc int trans_Running_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ int trans = 0;
  //genStateM: check all conditions of transitions, return on transition with != 0
  if(thiz->state.timerActive1 <0) {
    exit_Running_ExampleSimpleData(thiz, event);
    
    entry_Finit_ExampleSimpleData(thiz, event);
    trans = mTransit_States_Fwc; 
  }
  else 
  { //StateMGen: action in state. No transition switched.
    
  }
  return trans;
}






static void entry_Finit_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ //genStateM: entry StateComposite or StateSimple. 
  thiz->state.stateActive1 = kFinit_State_ExampleSimpleData;
  
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf(" entry Finit;\n");
  #endif
}

INLINE_Fwc void exit_Finit_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf("   exit Finit;\n");
  #endif
  
}



INLINE_Fwc int trans_Finit_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ int trans = 0;
  //genStateM: check all conditions of transitions, return on transition with != 0
  //genStateM: no transitions.
  //StateMGen: join transition
  if(true && thiz->state.stateActive1 == kFinit_State_ExampleSimpleData && thiz->state.stateActive2 ==
    kShouldOff_State_ExampleSimpleData ) {
    exit_Finit_ExampleSimpleData(thiz, event);
    exit_ShouldOff_ExampleSimpleData(thiz, event);
    exit_Active1_ExampleSimpleData(thiz, event);
    exit_Active2_ExampleSimpleData(thiz, event);
    exit_Active_ExampleSimpleData(thiz, event);
    exit_Work_ExampleSimpleData(thiz, event);
    
    entry_Off_ExampleSimpleData(thiz, event);
    trans = mTransit_States_Fwc; 
  }
  else 
  { //StateMGen: action in state. No transition switched.
    
  }
  return trans;
}






static void entry_Active1_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ //genStateM: entry StateComposite or StateSimple. 
  
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf(" entry Active1;\n");
  #endif
}

INLINE_Fwc void exit_Active1_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf("   exit Active1;\n");
  #endif
  
}



INLINE_Fwc int trans_Active1_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ int trans = 0;
  //genStateM: check all conditions of transitions, return on transition with != 0
  //genStateM: no transitions.
  { //StateMGen: action in state. No transition switched.
    
  }
  return trans;
}






static void entry_On_a_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ //genStateM: entry StateComposite or StateSimple. 
  thiz->state.stateActive2 = kOn_a_State_ExampleSimpleData;
  
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf(" entry On_a;\n");
  #endif
}

INLINE_Fwc void exit_On_a_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf("   exit On_a;\n");
  #endif
  
}



INLINE_Fwc int trans_On_a_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ int trans = 0;
  //genStateM: check all conditions of transitions, return on transition with != 0
  if(thiz->bit_a) {
    exit_On_a_ExampleSimpleData(thiz, event);
    
    entry_On_b_ExampleSimpleData(thiz, event);
    trans = mTransit_States_Fwc; 
  }
  else 
  //genStateM: transitions of enclosing state: RemainOn
  if(thiz->offAfterRunning) {
    exit_RemainOn_ExampleSimpleData(thiz, event);
    
    entry_ShouldOff_ExampleSimpleData(thiz, event);
    trans = mTransit_States_Fwc; 
  }
  else 
  { //StateMGen: action in state. No transition switched.
    
  }
  return trans;
}






static void entry_On_b_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ //genStateM: entry StateComposite or StateSimple. 
  thiz->state.stateActive2 = kOn_b_State_ExampleSimpleData;
  
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf(" entry On_b;\n");
  #endif
}

INLINE_Fwc void exit_On_b_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf("   exit On_b;\n");
  #endif
  
}



INLINE_Fwc int trans_On_b_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ int trans = 0;
  //genStateM: check all conditions of transitions, return on transition with != 0
  if(thiz->bit_b) {
    exit_On_b_ExampleSimpleData(thiz, event);
    
    entry_On_a_ExampleSimpleData(thiz, event);
    trans = mTransit_States_Fwc; 
  }
  else 
  //genStateM: transitions of enclosing state: RemainOn
  if(thiz->offAfterRunning) {
    exit_RemainOn_ExampleSimpleData(thiz, event);
    
    entry_ShouldOff_ExampleSimpleData(thiz, event);
    trans = mTransit_States_Fwc; 
  }
  else 
  { //StateMGen: action in state. No transition switched.
    
  }
  return trans;
}






static void entry_RemainOn_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ //genStateM: entry StateComposite or StateSimple. 
  thiz->state.stateActive2 = kRemainOn_State_ExampleSimpleData;
  
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf(" entry RemainOn;\n");
  #endif
}

INLINE_Fwc void exit_RemainOn_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf("   exit RemainOn;\n");
  #endif
  
}



INLINE_Fwc int trans_RemainOn_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ int trans = 0;
  //genStateM: check all conditions of transitions, return on transition with != 0
  if(thiz->offAfterRunning) {
    exit_RemainOn_ExampleSimpleData(thiz, event);
    
    entry_ShouldOff_ExampleSimpleData(thiz, event);
    trans = mTransit_States_Fwc; 
  }
  else 
  { //StateMGen: action in state. No transition switched.
    
  }
  return trans;
}






static void entry_ShouldOff_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ //genStateM: entry StateComposite or StateSimple. 
  thiz->state.stateActive2 = kShouldOff_State_ExampleSimpleData;
  
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf(" entry ShouldOff;\n");
  #endif
}

INLINE_Fwc void exit_ShouldOff_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf("   exit ShouldOff;\n");
  #endif
  
}



INLINE_Fwc int trans_ShouldOff_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ int trans = 0;
  //genStateM: check all conditions of transitions, return on transition with != 0
  if(false /*join:Finit */) {
    exit_ShouldOff_ExampleSimpleData(thiz, event);
    exit_Active2_ExampleSimpleData(thiz, event);
    exit_Active_ExampleSimpleData(thiz, event);
    exit_Work_ExampleSimpleData(thiz, event);
    
    entry_Off_ExampleSimpleData(thiz, event);
    trans = mTransit_States_Fwc; 
  }
  else 
  if(thiz->abort) {
    exit_ShouldOff_ExampleSimpleData(thiz, event);
    exit_Active2_ExampleSimpleData(thiz, event);
    exit_Active_ExampleSimpleData(thiz, event);
    exit_Work_ExampleSimpleData(thiz, event);
    
    entry_Off_ExampleSimpleData(thiz, event);
    trans = mTransit_States_Fwc; 
  }
  else 
  //StateMGen: join transition
  if(true && thiz->state.stateActive1 == kFinit_State_ExampleSimpleData && thiz->state.stateActive2 ==
    kShouldOff_State_ExampleSimpleData ) {
    exit_Finit_ExampleSimpleData(thiz, event);
    exit_ShouldOff_ExampleSimpleData(thiz, event);
    exit_Active1_ExampleSimpleData(thiz, event);
    exit_Active2_ExampleSimpleData(thiz, event);
    exit_Active_ExampleSimpleData(thiz, event);
    exit_Work_ExampleSimpleData(thiz, event);
    
    entry_Off_ExampleSimpleData(thiz, event);
    trans = mTransit_States_Fwc; 
  }
  else 
  { //StateMGen: action in state. No transition switched.
    
  }
  return trans;
}






static void entry_Active2_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ //genStateM: entry StateComposite or StateSimple. 
  
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf(" entry Active2;\n");
  #endif
}

INLINE_Fwc void exit_Active2_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf("   exit Active2;\n");
  #endif
  
}



INLINE_Fwc int trans_Active2_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ int trans = 0;
  //genStateM: check all conditions of transitions, return on transition with != 0
  //genStateM: no transitions.
  { //StateMGen: action in state. No transition switched.
    
  }
  return trans;
}





//genStateM: stateParallel
static void entry_Active_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ //genStateM: entry StateParallel.
  thiz->state.stateWork = kActive_State_ExampleSimpleData;
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf(" entry Active; parallel\n");
  #endif
}


INLINE_Fwc void exit_Active_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ //genStateM: it is a parallelState , it is its own rootstate: Work
  //thiz->state.stateActive = 0;  //if a parallel state has a history, set bit and preserve state nr
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf("   exit Active;\n");
  #endif
}


INLINE_Fwc int trans_Active_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ //genStateM: parallelState
  //TODO transitions
  return 0;
}






static void entry_Work_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ //genStateM: entry StateComposite or StateSimple. 
  thiz->state.statetop = kWork_State_ExampleSimpleData;
  thiz->work = 1;
    
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf(" entry Work;\n");
  #endif
}

INLINE_Fwc void exit_Work_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{
  #ifdef __DEBUG_entryprintf_States_Fwc__
    printf("   exit Work;\n");
  #endif
  //It is a composite state with a history state. Mark the state number with the inactive bit:
  thiz->state.stateWork |= 0x80000000; 
  thiz->work = 0;
    
}



INLINE_Fwc int trans_Work_ExampleSimpleData(struct ExampleSimpleData_t* thiz, int event)
{ int trans = 0;
  //genStateM: check all conditions of transitions, return on transition with != 0
  //xxx trans = switchStates_WorkState_ExampleSimpleData(thiz, event);
  if(thiz->off) {
    exit_Work_ExampleSimpleData(thiz, event);
    
    entry_Off_ExampleSimpleData(thiz, event);
    trans = mTransit_States_Fwc; 
  }
  else 
  { //StateMGen: action in state. No transition switched.
    
  }
  return trans;
}



//This method should be called in any step time. It decrements all timer which are set.
//
void stepStateTimer_State_ExampleSimpleData( struct ExampleSimpleData_t* thiz, int event )
{
  if(thiz->state.timerActive1 >=0) {
    thiz->state.timerActive1 -=1;
  }

}






int stepStates_State_ExampleSimpleData( struct ExampleSimpleData_t* thiz, int event )
{ int trans = 0;                //set to true if transition has fired.
  int ctSwitchState = 10;     //prevent too many transitions - a endless loop
  do {
    trans &= ~mTransit_States_Fwc;
    switch(thiz->state.statetop) {
               //if the state was entried newly without define an inner state, then the statedefault will be entered
                 now.
               //Note that the default state cannot be entered on entry action because it is unknown in that time
               //whether there will be an entry to a designated state.
      case 0: entry_Off_ExampleSimpleData(thiz, event); //without break, do trans:
      //switch to the current state:
      case kOff_State_ExampleSimpleData: trans |= trans_Off_ExampleSimpleData(thiz, event); break;
      case kWork_State_ExampleSimpleData: { 
        int ctSwitchState = 10;     //prevent too many transitions - a endless loop
        do {
          trans &= ~mTransit_States_Fwc;
          switch(thiz->state.stateWork) {
                     //if the state was entried newly without define an inner state, then the statedefault will be
                       entered now.
                     //Note that the default state cannot be entered on entry action because it is unknown in that time
                     //whether there will be an entry to a designated state.
            case 0: entry_Ready_ExampleSimpleData(thiz, event); //without break, do trans:
            //switch to the current state:
            case kReady_State_ExampleSimpleData: trans |= trans_Ready_ExampleSimpleData(thiz, event); break;
            case kActive_State_ExampleSimpleData: {
               { //genStateM: Parallel state switch
                  int ctSwitchState = 10;     //prevent too many transitions - a endless loop
                  do {
                    trans &= ~mTransit_States_Fwc;
                    switch(thiz->state.stateActive1) {
                            //if the state was entried newly without define an inner state, then the statedefault will
                              be entered now.
                            //Note that the default state cannot be entered on entry action because it is unknown in
                              that time
                            //whether there will be an entry to a designated state.
                      case 0: entry_Running_ExampleSimpleData(thiz, event); //without break, do trans:
                      //switch to the current state:
                      case kRunning1_State_ExampleSimpleData: trans |= trans_Running1_ExampleSimpleData(thiz, event);
                        break;
                      case kRunning21_State_ExampleSimpleData: trans |= trans_Running21_ExampleSimpleData(thiz, event);
                        break;
                      case kFinit_State_ExampleSimpleData: trans |= trans_Finit_ExampleSimpleData(thiz, event); break;
                    } //switch
                  } while((trans & mTransit_States_Fwc)    //continue checking transitions if one of the has fired, it
                    is run to completion.
                      && thiz->state.stateActive1 !=0  //don't continue if the composite is inactive now.
                      && --ctSwitchState >0);     //don't execute too may loops, only a safety check. 
                  //
                  //for all parallel states: switch only if this state is the active one still. Regard a leave of the
                    state from any substate.
               }
               { //genStateM: Parallel state switch
                  int ctSwitchState = 10;     //prevent too many transitions - a endless loop
                  do {
                    trans &= ~mTransit_States_Fwc;
                    switch(thiz->state.stateActive2) {
                            //if the state was entried newly without define an inner state, then the statedefault will
                              be entered now.
                            //Note that the default state cannot be entered on entry action because it is unknown in
                              that time
                            //whether there will be an entry to a designated state.
                      case 0: entry_RemainOn_ExampleSimpleData(thiz, event); //without break, do trans:
                      //switch to the current state:
                      case kOn_a_State_ExampleSimpleData: trans |= trans_On_a_ExampleSimpleData(thiz, event); break;
                      case kOn_b_State_ExampleSimpleData: trans |= trans_On_b_ExampleSimpleData(thiz, event); break;
                      case kShouldOff_State_ExampleSimpleData: trans |= trans_ShouldOff_ExampleSimpleData(thiz, event);
                        break;
                    } //switch
                  } while((trans & mTransit_States_Fwc)    //continue checking transitions if one of the has fired, it
                    is run to completion.
                      && thiz->state.stateActive2 !=0  //don't continue if the composite is inactive now.
                      && --ctSwitchState >0);     //don't execute too may loops, only a safety check. 
                  //
                  //for all parallel states: switch only if this state is the active one still. Regard a leave of the
                    state from any substate.
               }
              trans |= trans_Active_ExampleSimpleData(thiz, event);
            } break; 
          } //switch
        } while((trans & mTransit_States_Fwc)    //continue checking transitions if one of the has fired, it is run to
          completion.
            && thiz->state.stateWork !=0  //don't continue if the composite is inactive now.
            && --ctSwitchState >0);     //don't execute too may loops, only a safety check. 
        //
        //for all parallel states: switch only if this state is the active one still. Regard a leave of the state from
          any substate.
      } break; //composite state
    } //switch
  } while((trans & mTransit_States_Fwc)    //continue checking transitions if one of the has fired, it is run to
    completion.
      && thiz->state.statetop !=0  //don't continue if the composite is inactive now.
      && --ctSwitchState >0);     //don't execute too may loops, only a safety check. 
  //
  //for all parallel states: switch only if this state is the active one still. Regard a leave of the state from any
    substate.
  return trans;
}