Bug 538750 - [Designer] [C Generator] Class_init function should be
called in Class_create function

Change-Id: I4805eb562991bc281d59581ceb7fe1b6f23e72a2
Signed-off-by: Shuai Li <shuai.li@cea.fr>
diff --git a/languages/c/org.eclipse.papyrus.designer.languages.c.codegen/src/org/eclipse/papyrus/designer/languages/c/codegen/lib/classScript.xtend b/languages/c/org.eclipse.papyrus.designer.languages.c.codegen/src/org/eclipse/papyrus/designer/languages/c/codegen/lib/classScript.xtend
index 29d85cb..d48e831 100644
--- a/languages/c/org.eclipse.papyrus.designer.languages.c.codegen/src/org/eclipse/papyrus/designer/languages/c/codegen/lib/classScript.xtend
+++ b/languages/c/org.eclipse.papyrus.designer.languages.c.codegen/src/org/eclipse/papyrus/designer/languages/c/codegen/lib/classScript.xtend
@@ -67,6 +67,9 @@
 		«IF (clazz.ownedOperations.filter[hasStereotype(Create)].size == 0)»
 			«clazz.genName()»* «clazz.genName()»_create() {
 				«clazz.genName()»* self = («clazz.genName()»*) malloc(sizeof(«clazz.genName()»));
+				«IF (!clazz.ownedBehaviors.filter(StateMachine).isEmpty || clazz.getAllAttributes.filter[defaultValue !== null].size > 0)»
+					«clazz.genName()»_init(self);
+				«ENDIF»
 				return self;
 			}
 		«ENDIF»
@@ -84,7 +87,7 @@
 	'''
 
 	def public static genDefaultInitialisationProtoype(Class clazz) '''
-		«IF (clazz.getAllAttributes().filter[defaultValue !== null].size > 0)»
+		«IF (!clazz.ownedBehaviors.filter(StateMachine).isEmpty || clazz.getAllAttributes.filter[defaultValue !== null].size > 0)»
 			«clazz.partComment('Default value initialization prototypes')»
 			/**
 			 * Default value initialization