diff options
author | Jan Belle | 2019-09-01 17:36:48 +0000 |
---|---|---|
committer | Jan Belle | 2019-09-01 17:36:48 +0000 |
commit | 54885fda766d9d033faff67294d42d475b8aa1e0 (patch) | |
tree | c6094928211508e426766a0825e0290f9b8fbf9d /examples/org.eclipse.etrice.generator.c.reference/src-gen-ts/cGenRef/Sender.c | |
parent | f83e60ebc1218b4f323fbc15092b22d44313c667 (diff) | |
download | org.eclipse.etrice-54885fda766d9d033faff67294d42d475b8aa1e0.tar.gz org.eclipse.etrice-54885fda766d9d033faff67294d42d475b8aa1e0.tar.xz org.eclipse.etrice-54885fda766d9d033faff67294d42d475b8aa1e0.zip |
[examples] Remove outdated generator reference projects
Change-Id: I2fff45faaf78a6f5f7b9c7aeaee8c687108aba2d
Diffstat (limited to 'examples/org.eclipse.etrice.generator.c.reference/src-gen-ts/cGenRef/Sender.c')
-rw-r--r-- | examples/org.eclipse.etrice.generator.c.reference/src-gen-ts/cGenRef/Sender.c | 197 |
1 files changed, 0 insertions, 197 deletions
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src-gen-ts/cGenRef/Sender.c b/examples/org.eclipse.etrice.generator.c.reference/src-gen-ts/cGenRef/Sender.c deleted file mode 100644 index 686063e4e..000000000 --- a/examples/org.eclipse.etrice.generator.c.reference/src-gen-ts/cGenRef/Sender.c +++ /dev/null @@ -1,197 +0,0 @@ -/** - * @author generated by eTrice - * - * Source File of ActorClass Sender - * - */ - -#include "Sender.h" - -#include "modelbase/etActor.h" -#include "debugging/etLogger.h" -#include "debugging/etMSCLogger.h" -#include "etUnit/etUnit.h" -#include "platform/etMemory.h" - -#include "CommunicationProtocol.h" - - -/* interface item IDs */ -enum interface_items { - IFITEM_dataOut = 1 -}; - - -/* state IDs */ -enum state_ids { - NO_STATE = 0, - STATE_TOP = 1, - STATE_SendingData = 2, - STATE_Done = 3 -}; - -static char* state_names[] = { - "NO_STATE", "TOP", "SendingData", "Done" -}; - -/* transition chains */ -enum chain_ids { - CHAIN_TRANS_INITIAL_TO__SendingData = 1, - CHAIN_TRANS_tr0_FROM_SendingData_TO_Done_BY_receivedDatadataOut = 2 -}; - -/* triggers */ -enum triggers { - POLLING = 0, - TRIG_dataOut__receivedData = IFITEM_dataOut + EVT_SHIFT*CommunicationProtocol_OUT_receivedData -}; - - -static void setState(Sender* self, int new_state) { - etLogger_logInfoF("Sender: setState: new state=%d", new_state); - ET_MSC_LOGGER_CHANGE_STATE("Sender", state_names[new_state]); - self->state = new_state; -} - -/* Entry and Exit Codes */ -static void entry_SendingData(Sender* self) { - CommunicationProtocolConjPort_sendData(&self->constData->dataOut) /* ORIG: dataOut.sendData() */; -} - -/* Action Codes */ - -/** - * calls exit codes while exiting from the current state to one of its - * parent states while remembering the history - * @param current - the current state - * @param to - the final parent state - * @param handler - entry and exit codes are called only if not handler (for handler TransitionPoints) - */ -static void exitTo(Sender* self, int current, int to, boolean handler) { - while (current!=to) { - switch (current) { - case STATE_SendingData: - self->history[STATE_TOP] = STATE_SendingData; - current = STATE_TOP; - break; - case STATE_Done: - self->history[STATE_TOP] = STATE_Done; - current = STATE_TOP; - 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 - the chain ID - * @param generic_data - the generic data pointer - * @return the ID of the final state - */ -static int executeTransitionChain(Sender* self, int chain, InterfaceItemBase* ifitem, void* generic_data) { - switch (chain) { - case CHAIN_TRANS_INITIAL_TO__SendingData: - { - return STATE_SendingData; - } - case CHAIN_TRANS_tr0_FROM_SendingData_TO_Done_BY_receivedDatadataOut: - { - return STATE_Done; - } - } - return NO_STATE; -} - -/** - * calls entry codes while entering a state's history. The ID of the final leaf state is returned - * @param state - the state which is entered - * @param handler - entry code is executed if not handler - * @return - the ID of the final leaf state - */ -static int enterHistory(Sender* self, int state, boolean handler, boolean skip_entry) { - while (TRUE) { - switch (state) { - case STATE_SendingData: - if (!(skip_entry || handler)) entry_SendingData(self); - // in leaf state: return state id - return STATE_SendingData; - case STATE_Done: - // in leaf state: return state id - return STATE_Done; - case STATE_TOP: - state = self->history[STATE_TOP]; - break; - } - skip_entry = FALSE; - } - //return NO_STATE; // required by CDT but detected as unreachable by JDT because of while (true) -} - -static void executeInitTransition(Sender* self) { - int chain = CHAIN_TRANS_INITIAL_TO__SendingData; - int next = executeTransitionChain(self, chain, NULL, NULL); - next = enterHistory(self, next, FALSE, FALSE); - setState(self, next); -} - -/* receiveEvent contains the main implementation of the FSM */ -static void receiveEvent(Sender* self, InterfaceItemBase *ifitem, int evt, void* generic_data) { - int trigger = ifitem->localId + EVT_SHIFT*evt; - int chain = NOT_CAUGHT; - int catching_state = NO_STATE; - boolean is_handler = FALSE; - boolean skip_entry = FALSE; - - if (!handleSystemEvent(ifitem, evt, generic_data)) { - switch (self->state) { - case STATE_SendingData: - switch(trigger) { - case TRIG_dataOut__receivedData: - { - chain = CHAIN_TRANS_tr0_FROM_SendingData_TO_Done_BY_receivedDatadataOut; - catching_state = STATE_TOP; - } - break; - } - break; - case STATE_Done: - break; - } - } - if (chain != NOT_CAUGHT) { - exitTo(self, self->state, catching_state, is_handler); - int next = executeTransitionChain(self, chain, ifitem, generic_data); - next = enterHistory(self, next, is_handler, skip_entry); - setState(self, next); - } -} - -//****************************************** -// END of generated code for FSM -//****************************************** - -void Sender_init(Sender* self){ - ET_MSC_LOGGER_SYNC_ENTRY("Sender", "init") - self->state = STATE_TOP; - { - int i; - for (i=0; i<SENDER_HISTORY_SIZE; ++i) - self->history[i] = NO_STATE; - } - executeInitTransition(self); - ET_MSC_LOGGER_SYNC_EXIT -} - - -void Sender_receiveMessage(void* self, void* ifitem, const etMessage* msg){ - ET_MSC_LOGGER_SYNC_ENTRY("Sender", "_receiveMessage") - - receiveEvent(self, (etPort*)ifitem, msg->evtID, (void*)(((char*)msg)+MEM_CEIL(sizeof(etMessage)))); - - ET_MSC_LOGGER_SYNC_EXIT -} - - -/*--------------------- operations ---------------------*/ - |