diff options
Diffstat (limited to 'runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/SequentialTestExecutor.c')
-rw-r--r-- | runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/SequentialTestExecutor.c | 220 |
1 files changed, 0 insertions, 220 deletions
diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/SequentialTestExecutor.c b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/SequentialTestExecutor.c deleted file mode 100644 index 4f5bf3747..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/SequentialTestExecutor.c +++ /dev/null @@ -1,220 +0,0 @@ -/** - * @author generated by eTrice - * - * Source File of ActorClass SequentialTestExecutor - * - */ - -#include "SequentialTestExecutor.h" - -#include "modelbase/etActor.h" -#include "debugging/etLogger.h" -#include "debugging/etMSCLogger.h" -#include "etUnit/etUnit.h" -#include "base/etMemory.h" - -#include "room/basic/test/PTestControl.h" - -#include "SequentialTestExecutor_Utils.h" - -/*--------------------- begin user code ---------------------*/ -#include "etUnit/etUnit.h" -/*--------------------- end user code ---------------------*/ - -/* interface item IDs */ -enum interface_items { - IFITEM_control = 1 -}; - -/* state IDs */ -enum state_ids { - NO_STATE = 0, - STATE_TOP = 1, - STATE_execute = 2, - STATE_MAX = 3 -}; - -/* transition chains */ -enum ChainIDs { - CHAIN_TRANS_INITIAL_TO__execute = 1, - CHAIN_TRANS_tr0_FROM_execute_TO_execute_BY_donecontrol_tr0 = 2 -}; - -/* triggers */ -enum triggers { - POLLING = 0, - TRIG_control__done = IFITEM_control + EVT_SHIFT*PTestControl_OUT_done -}; - -/* state names */ -static char* stateStrings[] = {"<no state>","<top>","execute" -}; - -static void setState(SequentialTestExecutor* self, etInt16 new_state) { - self->state = new_state; - ET_MSC_LOGGER_CHANGE_STATE(self->constData->instName, stateStrings[new_state]) -} - -static etInt16 getState(SequentialTestExecutor* self) { - return self->state; -} - -/* Entry and Exit Codes */ -static void entry_execute(SequentialTestExecutor* self) { - if(next < self->constData->control.size){ - control_start(next++); - } else { - etUnit_testFinished(0); - } -} - -/* Action Codes */ - -/* State Switch Methods */ -/** - * calls exit codes while exiting from the current state to one of its - * parent states while remembering the history - * @param current__et - the current state - * @param to - the final parent state - */ -static void exitTo(SequentialTestExecutor* self, etInt16 current__et, etInt16 to) { - while (current__et!=to) { - switch (current__et) { - case STATE_execute: - self->history[STATE_TOP] = STATE_execute; - current__et = STATE_TOP; - break; - default: - /* should not occur */ - break; - } - } -} - -/** - * calls action, entry and exit codes along a transition chain. The generic data are cast to typed data - * matching the trigger of this chain. The ID of the final state is returned - * @param chain__et - the chain ID - * @param generic_data__et - the generic data pointer - * @return the +/- ID of the final state either with a positive sign, that indicates to execute the state's entry code, or a negative sign vice versa - */ -static etInt16 executeTransitionChain(SequentialTestExecutor* self, int chain__et, const InterfaceItemBase* ifitem, void* generic_data__et) { - switch (chain__et) { - case CHAIN_TRANS_INITIAL_TO__execute: - { - return STATE_execute; - } - case CHAIN_TRANS_tr0_FROM_execute_TO_execute_BY_donecontrol_tr0: - { - bool success = *((bool*) generic_data__et); - return STATE_execute; - } - default: - /* should not occur */ - break; - } - return NO_STATE; -} - -/** - * calls entry codes while entering a state's history. The ID of the final leaf state is returned - * @param state__et - the state which is entered - * @return - the ID of the final leaf state - */ -static etInt16 enterHistory(SequentialTestExecutor* self, etInt16 state__et) { - etBool skip_entry__et = ET_FALSE; - if (state__et >= STATE_MAX) { - state__et = (etInt16) (state__et - STATE_MAX); - skip_entry__et = ET_TRUE; - } - while (ET_TRUE) { - switch (state__et) { - case STATE_execute: - if (!(skip_entry__et)) entry_execute(self); - /* in leaf state: return state id */ - return STATE_execute; - case STATE_TOP: - state__et = self->history[STATE_TOP]; - break; - default: - /* should not occur */ - break; - } - skip_entry__et = ET_FALSE; - } - /* return NO_STATE; // required by CDT but detected as unreachable by JDT because of while (true) */ -} - -static void SequentialTestExecutor_executeInitTransition(SequentialTestExecutor* self) { - int chain__et = CHAIN_TRANS_INITIAL_TO__execute; - etInt16 next__et = executeTransitionChain(self, chain__et, NULL, NULL); - next__et = enterHistory(self, next__et); - setState(self, next__et); -} - -/* receiveEvent contains the main implementation of the FSM */ -static void SequentialTestExecutor_receiveEventInternal(SequentialTestExecutor* self, InterfaceItemBase* ifitem, int localId, int evt, void* generic_data__et) { - int trigger__et = localId + EVT_SHIFT*evt; - int chain__et = NOT_CAUGHT; - etInt16 catching_state__et = NO_STATE; - ((void)trigger__et); /* avoids unused warning */ - - if (!handleSystemEvent(ifitem, evt, generic_data__et)) { - switch (getState(self)) { - case STATE_execute: - switch(trigger__et) { - case TRIG_control__done: - { - chain__et = CHAIN_TRANS_tr0_FROM_execute_TO_execute_BY_donecontrol_tr0; - catching_state__et = STATE_TOP; - } - break; - default: - /* should not occur */ - break; - } - break; - default: - /* should not occur */ - break; - } - } - if (chain__et != NOT_CAUGHT) { - exitTo(self, getState(self), catching_state__et); - { - etInt16 next__et = executeTransitionChain(self, chain__et, ifitem, generic_data__et); - next__et = enterHistory(self, next__et); - setState(self, next__et); - } - } -} -static void SequentialTestExecutor_receiveEvent(SequentialTestExecutor* self, InterfaceItemBase* ifitem, int evt, void* generic_data__et) { - int localId = (ifitem==NULL)? 0 : ifitem->localId; - SequentialTestExecutor_receiveEventInternal(self, ifitem, localId, evt, generic_data__et); -} - -void SequentialTestExecutor_init(SequentialTestExecutor* self){ - ET_MSC_LOGGER_SYNC_ENTRY("SequentialTestExecutor", "init") - self->state = STATE_TOP; - { - int i; - for (i=0; i<SEQUENTIALTESTEXECUTOR_HISTORY_SIZE; ++i) - self->history[i] = NO_STATE; - } - SequentialTestExecutor_executeInitTransition(self); - ET_MSC_LOGGER_SYNC_EXIT -} - - -void SequentialTestExecutor_receiveMessage(void* self, const void* ifitem, const etMessage* msg){ - ET_MSC_LOGGER_SYNC_ENTRY("SequentialTestExecutor", "_receiveMessage") - SequentialTestExecutor_receiveEvent(self, (etPort*)ifitem, msg->evtID, (void*)(((char*)msg)+MEM_CEIL(sizeof(etMessage)))); - - ET_MSC_LOGGER_SYNC_EXIT -} - - -/*--------------------- user constructor/destructor ---------------------*/ - -/*--------------------- operations ---------------------*/ - |