summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2013-02-08 09:56:43 (EST)
committer Juergen Haug2013-02-08 09:56:43 (EST)
commit74452514ac799ed4de01a4305dd3b1be9ef1d55e (patch)
treee25c2ee4b86f895e284cb1735c3676d7d43b4c06
parenta6e700137dfd6408042e1cc13d845c7a9fa9f89b (diff)
downloadorg.eclipse.etrice-74452514ac799ed4de01a4305dd3b1be9ef1d55e.zip
org.eclipse.etrice-74452514ac799ed4de01a4305dd3b1be9ef1d55e.tar.gz
org.eclipse.etrice-74452514ac799ed4de01a4305dd3b1be9ef1d55e.tar.bz2
[core.genmodel][generator] (bug 400288) special situation withrefs/changes/52/10252/3
transition point and choice point not handled properly Change-Id: I796e53b874ed8947e23ca011665de1fd65e0d524
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/model/etricegen.ecore2
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ETriceGenPackage.java32
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ITransitionChainVisitor.java3
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/TransitionChain.java29
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenPackageImpl.java13
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java5
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/TransitionChainImpl.java72
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend15
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TransitionChainVisitor.java4
-rw-r--r--plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java55
10 files changed, 40 insertions, 190 deletions
diff --git a/plugins/org.eclipse.etrice.core.genmodel/model/etricegen.ecore b/plugins/org.eclipse.etrice.core.genmodel/model/etricegen.ecore
index d5f4544..9df7921 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/model/etricegen.ecore
+++ b/plugins/org.eclipse.etrice.core.genmodel/model/etricegen.ecore
@@ -152,8 +152,6 @@
<eParameters name="tcv" eType="#//ITransitionChainVisitor"/>
</eOperations>
<eStructuralFeatures xsi:type="ecore:EReference" name="transition" eType="ecore:EClass ../../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.ecore#//Transition"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="skipEntry" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
- defaultValueLiteral="false"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="data" eType="ecore:EClass ../../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.ecore#//VarDecl"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ITransitionChainVisitor" instanceTypeName="ITransitionChainVisitor"
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ETriceGenPackage.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ETriceGenPackage.java
index 85af010..3e1fe62 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ETriceGenPackage.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ETriceGenPackage.java
@@ -1441,22 +1441,13 @@ public interface ETriceGenPackage extends EPackage {
int TRANSITION_CHAIN__TRANSITION = 0;
/**
- * The feature id for the '<em><b>Skip Entry</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int TRANSITION_CHAIN__SKIP_ENTRY = 1;
-
- /**
* The feature id for the '<em><b>Data</b></em>' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int TRANSITION_CHAIN__DATA = 2;
+ int TRANSITION_CHAIN__DATA = 1;
/**
* The number of structural features of the '<em>Transition Chain</em>' class.
@@ -1465,7 +1456,7 @@ public interface ETriceGenPackage extends EPackage {
* @generated
* @ordered
*/
- int TRANSITION_CHAIN_FEATURE_COUNT = 3;
+ int TRANSITION_CHAIN_FEATURE_COUNT = 2;
/**
* The meta object id for the '{@link ITransitionChainVisitor <em>ITransition Chain Visitor</em>}' class.
@@ -2387,17 +2378,6 @@ public interface ETriceGenPackage extends EPackage {
EReference getTransitionChain_Transition();
/**
- * Returns the meta object for the attribute '{@link org.eclipse.etrice.core.genmodel.etricegen.TransitionChain#isSkipEntry <em>Skip Entry</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Skip Entry</em>'.
- * @see org.eclipse.etrice.core.genmodel.etricegen.TransitionChain#isSkipEntry()
- * @see #getTransitionChain()
- * @generated
- */
- EAttribute getTransitionChain_SkipEntry();
-
- /**
* Returns the meta object for the reference '{@link org.eclipse.etrice.core.genmodel.etricegen.TransitionChain#getData <em>Data</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -3112,14 +3092,6 @@ public interface ETriceGenPackage extends EPackage {
EReference TRANSITION_CHAIN__TRANSITION = eINSTANCE.getTransitionChain_Transition();
/**
- * The meta object literal for the '<em><b>Skip Entry</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EAttribute TRANSITION_CHAIN__SKIP_ENTRY = eINSTANCE.getTransitionChain_SkipEntry();
-
- /**
* The meta object literal for the '<em><b>Data</b></em>' reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ITransitionChainVisitor.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ITransitionChainVisitor.java
index 617026e..fd58b34 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ITransitionChainVisitor.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/ITransitionChainVisitor.java
@@ -77,8 +77,9 @@ public interface ITransitionChainVisitor {
/**
* @param state a state
+ * @param executeEntryCode <code>true</code> if entry code of state should be executed
* @return a return statement with the ID of the state
*/
- String genReturnState(State state);
+ String genReturnState(State state, boolean executeEntryCode);
}
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/TransitionChain.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/TransitionChain.java
index 659714a..323a817 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/TransitionChain.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/TransitionChain.java
@@ -29,7 +29,6 @@ import org.eclipse.etrice.core.room.VarDecl;
* The following features are supported:
* <ul>
* <li>{@link org.eclipse.etrice.core.genmodel.etricegen.TransitionChain#getTransition <em>Transition</em>}</li>
- * <li>{@link org.eclipse.etrice.core.genmodel.etricegen.TransitionChain#isSkipEntry <em>Skip Entry</em>}</li>
* <li>{@link org.eclipse.etrice.core.genmodel.etricegen.TransitionChain#getData <em>Data</em>}</li>
* </ul>
* </p>
@@ -65,34 +64,6 @@ public interface TransitionChain extends EObject {
void setTransition(Transition value);
/**
- * Returns the value of the '<em><b>Skip Entry</b></em>' attribute.
- * The default value is <code>"false"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If <code>true</code> then the entry code execution of the state whose history will be entered
- * should be skipped after traversal of this chain.
- * This is the case
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Skip Entry</em>' attribute.
- * @see #setSkipEntry(boolean)
- * @see org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage#getTransitionChain_SkipEntry()
- * @model default="false"
- * @generated
- */
- boolean isSkipEntry();
-
- /**
- * Sets the value of the '{@link org.eclipse.etrice.core.genmodel.etricegen.TransitionChain#isSkipEntry <em>Skip Entry</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Skip Entry</em>' attribute.
- * @see #isSkipEntry()
- * @generated
- */
- void setSkipEntry(boolean value);
-
- /**
* Returns the value of the '<em><b>Data</b></em>' reference.
* <!-- begin-user-doc -->
* <p>
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenPackageImpl.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenPackageImpl.java
index cd80326..edbb512 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenPackageImpl.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ETriceGenPackageImpl.java
@@ -872,17 +872,8 @@ public class ETriceGenPackageImpl extends EPackageImpl implements ETriceGenPacka
* <!-- end-user-doc -->
* @generated
*/
- public EAttribute getTransitionChain_SkipEntry() {
- return (EAttribute)transitionChainEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
public EReference getTransitionChain_Data() {
- return (EReference)transitionChainEClass.getEStructuralFeatures().get(2);
+ return (EReference)transitionChainEClass.getEStructuralFeatures().get(1);
}
/**
@@ -1085,7 +1076,6 @@ public class ETriceGenPackageImpl extends EPackageImpl implements ETriceGenPacka
transitionChainEClass = createEClass(TRANSITION_CHAIN);
createEReference(transitionChainEClass, TRANSITION_CHAIN__TRANSITION);
- createEAttribute(transitionChainEClass, TRANSITION_CHAIN__SKIP_ENTRY);
createEReference(transitionChainEClass, TRANSITION_CHAIN__DATA);
iTransitionChainVisitorEClass = createEClass(ITRANSITION_CHAIN_VISITOR);
@@ -1250,7 +1240,6 @@ public class ETriceGenPackageImpl extends EPackageImpl implements ETriceGenPacka
initEClass(transitionChainEClass, TransitionChain.class, "TransitionChain", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getTransitionChain_Transition(), theRoomPackage.getTransition(), null, "transition", null, 0, 1, TransitionChain.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getTransitionChain_SkipEntry(), ecorePackage.getEBoolean(), "skipEntry", "false", 0, 1, TransitionChain.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getTransitionChain_Data(), theRoomPackage.getVarDecl(), null, "data", null, 0, 1, TransitionChain.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
addEOperation(transitionChainEClass, theRoomPackage.getState(), "getStateContext", 0, 1, IS_UNIQUE, IS_ORDERED);
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java
index cc8977a..637cd8d 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java
@@ -803,11 +803,8 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
return;
// the chain ends if source and destination coincide
- if (tc.getTransition() instanceof NonInitialTransition && node==RoomHelpers.getNode(((NonInitialTransition)tc.getTransition()).getFrom())) {
- if (node instanceof TransitionPoint)
- tc.setSkipEntry(true);
+ if (tc.getTransition() instanceof NonInitialTransition && node==RoomHelpers.getNode(((NonInitialTransition)tc.getTransition()).getFrom()))
return;
- }
for (Transition next : getOutgoingTransitions(node)) {
// from the second transition in the chain on we have:
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/TransitionChainImpl.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/TransitionChainImpl.java
index d9242e4..bf5677c 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/TransitionChainImpl.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/TransitionChainImpl.java
@@ -48,7 +48,6 @@ import org.eclipse.etrice.core.room.util.RoomHelpers;
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.etrice.core.genmodel.etricegen.impl.TransitionChainImpl#getTransition <em>Transition</em>}</li>
- * <li>{@link org.eclipse.etrice.core.genmodel.etricegen.impl.TransitionChainImpl#isSkipEntry <em>Skip Entry</em>}</li>
* <li>{@link org.eclipse.etrice.core.genmodel.etricegen.impl.TransitionChainImpl#getData <em>Data</em>}</li>
* </ul>
* </p>
@@ -67,26 +66,6 @@ public class TransitionChainImpl extends EObjectImpl implements TransitionChain
protected Transition transition;
/**
- * The default value of the '{@link #isSkipEntry() <em>Skip Entry</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isSkipEntry()
- * @generated
- * @ordered
- */
- protected static final boolean SKIP_ENTRY_EDEFAULT = false;
-
- /**
- * The cached value of the '{@link #isSkipEntry() <em>Skip Entry</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isSkipEntry()
- * @generated
- * @ordered
- */
- protected boolean skipEntry = SKIP_ENTRY_EDEFAULT;
-
- /**
* The cached value of the '{@link #getData() <em>Data</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -158,27 +137,6 @@ public class TransitionChainImpl extends EObjectImpl implements TransitionChain
* <!-- end-user-doc -->
* @generated
*/
- public boolean isSkipEntry() {
- return skipEntry;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setSkipEntry(boolean newSkipEntry) {
- boolean oldSkipEntry = skipEntry;
- skipEntry = newSkipEntry;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, ETriceGenPackage.TRANSITION_CHAIN__SKIP_ENTRY, oldSkipEntry, skipEntry));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
public VarDecl getData() {
if (data != null && data.eIsProxy()) {
InternalEObject oldData = (InternalEObject)data;
@@ -297,7 +255,7 @@ public class TransitionChainImpl extends EObjectImpl implements TransitionChain
if (node instanceof TrPoint) {
if (node instanceof TransitionPoint) {
// TransitionPoint is final destination of the chain
- result.append(tcv.genReturnState(getStateContext()));
+ result.append(tcv.genReturnState(getStateContext(), false));
return;
}
else {
@@ -324,7 +282,7 @@ public class TransitionChainImpl extends EObjectImpl implements TransitionChain
// the following assertion should always hold true
assert(node instanceof State): "A transition target can be a ChoicePoint, a TrPoint or a State!";
- result.append(tcv.genReturnState((State) node));
+ result.append(tcv.genReturnState((State) node, true));
}
}
}
@@ -350,8 +308,6 @@ public class TransitionChainImpl extends EObjectImpl implements TransitionChain
case ETriceGenPackage.TRANSITION_CHAIN__TRANSITION:
if (resolve) return getTransition();
return basicGetTransition();
- case ETriceGenPackage.TRANSITION_CHAIN__SKIP_ENTRY:
- return isSkipEntry();
case ETriceGenPackage.TRANSITION_CHAIN__DATA:
if (resolve) return getData();
return basicGetData();
@@ -370,9 +326,6 @@ public class TransitionChainImpl extends EObjectImpl implements TransitionChain
case ETriceGenPackage.TRANSITION_CHAIN__TRANSITION:
setTransition((Transition)newValue);
return;
- case ETriceGenPackage.TRANSITION_CHAIN__SKIP_ENTRY:
- setSkipEntry((Boolean)newValue);
- return;
case ETriceGenPackage.TRANSITION_CHAIN__DATA:
setData((VarDecl)newValue);
return;
@@ -391,9 +344,6 @@ public class TransitionChainImpl extends EObjectImpl implements TransitionChain
case ETriceGenPackage.TRANSITION_CHAIN__TRANSITION:
setTransition((Transition)null);
return;
- case ETriceGenPackage.TRANSITION_CHAIN__SKIP_ENTRY:
- setSkipEntry(SKIP_ENTRY_EDEFAULT);
- return;
case ETriceGenPackage.TRANSITION_CHAIN__DATA:
setData((VarDecl)null);
return;
@@ -411,28 +361,10 @@ public class TransitionChainImpl extends EObjectImpl implements TransitionChain
switch (featureID) {
case ETriceGenPackage.TRANSITION_CHAIN__TRANSITION:
return transition != null;
- case ETriceGenPackage.TRANSITION_CHAIN__SKIP_ENTRY:
- return skipEntry != SKIP_ENTRY_EDEFAULT;
case ETriceGenPackage.TRANSITION_CHAIN__DATA:
return data != null;
}
return super.eIsSet(featureID);
}
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy()) return super.toString();
-
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (skipEntry: ");
- result.append(skipEntry);
- result.append(')');
- return result.toString();
- }
-
} //TransitionChainImpl
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend
index 03ec285..02b4efa 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend
@@ -213,7 +213,7 @@ class GenericStateMachineGenerator {
* 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
+ * @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
*/
«privAccess»«stateType» «opScopePriv»executeTransitionChain(«self»int chain«IF handleEvents», «constIfItemPtr» ifitem, «langExt.voidPointer» generic_data«ENDIF») {
switch (chain) {
@@ -298,7 +298,6 @@ class GenericStateMachineGenerator {
«IF usesHdlr»
«boolType» is_handler = «langExt.booleanConstant(false)»;
«ENDIF»
- «boolType» skip_entry = «langExt.booleanConstant(false)»;
«IF handleEvents»
if (!handleSystemEvent(ifitem, evt, generic_data)) {
@@ -310,6 +309,11 @@ class GenericStateMachineGenerator {
if (chain != NOT_CAUGHT) {
«opScopePriv»exitTo(«langExt.selfPointer(true)»getState(«langExt.selfPointer(false)»), catching_state«IF usesHdlr», is_handler«ENDIF»);
«stateType» next = «opScopePriv»executeTransitionChain(«langExt.selfPointer(true)»chain«IF handleEvents», ifitem, generic_data«ENDIF»);
+ «boolType» skip_entry = «langExt.booleanConstant(false)»;
+ if(next < 0){
+ next = -next;
+ skip_entry = «langExt.booleanConstant(true)»;
+ }
next = «opScopePriv»enterHistory(«langExt.selfPointer(true)»next, «IF usesHdlr»is_handler, «ENDIF»skip_entry);
setState(«langExt.selfPointer(true)»next);
}
@@ -376,10 +380,6 @@ class GenericStateMachineGenerator {
«IF chain.isHandler() && usesHdlr»
is_handler = TRUE;
«ENDIF»
- «IF chain.skipEntry»
- skip_entry = TRUE;
- «ENDIF»
- }
«IF tr!=transitions.last»
else
«ENDIF»
@@ -405,9 +405,6 @@ class GenericStateMachineGenerator {
«IF chain.isHandler() && usesHdlr»
is_handler = «langExt.booleanConstant(true)»;
«ENDIF»
- «IF chain.skipEntry»
- skip_entry = «langExt.booleanConstant(true)»;
- «ENDIF»
}
«ENDFOR»
«IF needData»}«ENDIF»
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TransitionChainVisitor.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TransitionChainVisitor.java
index 43c9f81..148be95 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TransitionChainVisitor.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TransitionChainVisitor.java
@@ -101,8 +101,8 @@ public class TransitionChainVisitor implements ITransitionChainVisitor {
return "}\n";
}
- public String genReturnState(State state) {
- return "return " + CodegenHelpers.getGenStateId(state) + ";";
+ public String genReturnState(State state, boolean executeEntryCode) {
+ return "return " + ((executeEntryCode)?"":"-") + CodegenHelpers.getGenStateId(state) + ";";
}
public String genTypedData(TransitionChain tc) {
diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java
index 3dcccca..c56e4a1 100644
--- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java
+++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java
@@ -516,7 +516,7 @@ public class GenericStateMachineGenerator {
_builder.append("* @param generic_data - the generic data pointer");
_builder.newLine();
_builder.append(" ");
- _builder.append("* @return the ID of the final state");
+ _builder.append("* @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");
_builder.newLine();
_builder.append(" ");
_builder.append("*/");
@@ -941,14 +941,6 @@ public class GenericStateMachineGenerator {
}
}
_builder.append("\t");
- String _boolType_4 = this.boolType();
- _builder.append(_boolType_4, " ");
- _builder.append(" skip_entry = ");
- String _booleanConstant_5 = this.langExt.booleanConstant(false);
- _builder.append(_booleanConstant_5, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- _builder.append("\t");
_builder.newLine();
{
if (handleEvents) {
@@ -1006,6 +998,29 @@ public class GenericStateMachineGenerator {
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
+ String _boolType_4 = this.boolType();
+ _builder.append(_boolType_4, " ");
+ _builder.append(" skip_entry = ");
+ String _booleanConstant_5 = this.langExt.booleanConstant(false);
+ _builder.append(_booleanConstant_5, " ");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.append("if(next < 0){");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("next = -next;");
+ _builder.newLine();
+ _builder.append("\t\t\t");
+ _builder.append("skip_entry = ");
+ String _booleanConstant_6 = this.langExt.booleanConstant(true);
+ _builder.append(_booleanConstant_6, " ");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t\t");
_builder.append("next = ");
_builder.append(opScopePriv, " ");
_builder.append("enterHistory(");
@@ -1230,16 +1245,6 @@ public class GenericStateMachineGenerator {
}
}
{
- boolean _isSkipEntry = chain.isSkipEntry();
- if (_isSkipEntry) {
- _builder.append("\t");
- _builder.append("skip_entry = TRUE;");
- _builder.newLine();
- }
- }
- _builder.append("}");
- _builder.newLine();
- {
Transition _last = IterableExtensions.<Transition>last(transitions);
boolean _notEquals = (!Objects.equal(tr, _last));
if (_notEquals) {
@@ -1330,18 +1335,6 @@ public class GenericStateMachineGenerator {
_builder.newLineIfNotEmpty();
}
}
- {
- boolean _isSkipEntry = chain.isSkipEntry();
- if (_isSkipEntry) {
- _builder.append("\t");
- _builder.append("\t");
- _builder.append("skip_entry = ");
- String _booleanConstant_1 = this.langExt.booleanConstant(true);
- _builder.append(_booleanConstant_1, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
_builder.append("\t");
_builder.append("}");
_builder.newLine();