瀏覽代碼

added Unique Event naming in code YAKHMI-338

jos.itemis@gmail.com 13 年之前
父節點
當前提交
269963eae9

+ 5 - 2
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/templates/Expression.ext

@@ -157,17 +157,20 @@ String toCCode(Declaration dec) :
 	"Declartion type not specified";
 
 String toCCode(TimeEvent time_ev) :
-    " ( eventSet_check( &handle->base.eventSet, ev_" + time_ev.name.toLowerCase() + ") ) ";
+    " ( eventSet_check( &handle->base.eventSet, " + time_ev.getEventEnumName() + ") ) ";
 
 String toCCode(VariableDefinition var) :
     " handle->"+ var.getInterface() + "." + var.name.toLowerCase() + " ";
 	
 String toCCode(EventDefinition evDef) :
-    " ( eventSet_check( &handle->base.eventSet, ev_" + evDef.name.toLowerCase() + ") ) ";
+    " ( eventSet_check( &handle->base.eventSet, " + evDef.getEventEnumName() + ") ) ";
 
 String toCCode(EventValueReferenceExpression evrExp) :
 	"((" +evrExp.value.name + "*)handle->base.eventList[" + evrExp.value.getEventEnumName() + "])->value";
 
+String toCCode(EventRaisedReferenceExpression errExp) :
+	" eventSet_check( &handle->base.eventSet, " + errExp.value.getEventEnumName() + ")";
+
 /*
 String getScope(EObject eo) :
 "unkownScope";

+ 11 - 2
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/templates/Naming.ext

@@ -53,9 +53,18 @@ String interfaceName(InterfaceScope this) : this.getExecutionFlow().name.toFirst
 String interfaceClassName(InterfaceScope this) : this.getExecutionFlow().name.toFirstUpper() + "If" + ((this.name == null)?"":this.name.toFirstUpper());
 String interfaceObjectName(InterfaceScope this) : "interface" + ((this.name == null)?"":this.name.toFirstUpper());
 
-String getEventEnumName(EventDefinition this) : "ev_" + this.name.toFirstLower();
+//String getEventEnumName(EventDefinition this) : "ev_"+ ((InterfaceScope)this.eContainer).name + this.name.toFirstLower();
 String getEventEnumName(TimeEvent this) : "ev_" + this.name.toFirstLower();
-String getEventEnumName(Event this) : "ev_" + this.name.toFirstLower();
+String getEventEnumName(Event this) : "ev_" + this.eContainer.getScopeName() + "_" + this.name.toFirstLower();
+
+String getScopeName(emf::EObject eo) :
+	"<scope not defined>";
+
+String getScopeName(InternalScope inScope) :
+ 	"internal";
+ 	
+String getScopeName(InterfaceScope ifScope) :
+	(ifScope.name == null)?"default":ifScope.name;
 
 String getBoolTrue() : "bool_true";
 String getBoolFalse() : "bool_false";