Просмотр исходного кода

remove whitespace in generated code

Dominik Tesch 10 лет назад
Родитель
Сommit
d60be0eccc
14 измененных файлов с 61 добавлено и 60 удалено
  1. 4 4
      plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/FlowCode.xtend
  2. 8 8
      plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/StatemachineSource.xtend
  3. 1 1
      plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/Timer.xtend
  4. 3 2
      plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/Types.xtend
  5. 8 8
      plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/StatemachineHeader.xtend
  6. 1 1
      plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/StatemachineImplementation.xtend
  7. 1 1
      plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/Types.xtend
  8. 12 12
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/CycleBasedSynchronizedWrapper.xtend
  9. 2 2
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/EventBasedRunnableWrapper.xtend
  10. 1 1
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/FlowCode.xtend
  11. 1 1
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/JavaGenerator.xtend
  12. 11 11
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/RuntimeService.xtend
  13. 4 4
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/Statemachine.xtend
  14. 4 4
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/TimerService.xtend

+ 4 - 4
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/FlowCode.xtend

@@ -112,10 +112,10 @@ class FlowCode {
 		«flow.type.toFirstLower»_unsetTimer(«scHandle», (sc_eventid) &(«scHandle»->timeEvents.«timeEvent.shortName»_raised) );		
 	'''
 
-	def dispatch CharSequence code(Execution it) 
+	def dispatch CharSequence code(Execution it)
 		'''«statement.code»;'''
 	
-	def dispatch CharSequence code(Call it) 
+	def dispatch CharSequence code(Call it)
 		'''«step.shortName»(«scHandle»);'''
 
 	def dispatch CharSequence code(Sequence it) '''
@@ -125,10 +125,10 @@ class FlowCode {
 		«ENDFOR»
 	'''	
 
-	def dispatch CharSequence code(Check it) 
+	def dispatch CharSequence code(Check it)
 		'''«IF condition != null»«condition.sc_boolean_code»«ELSE»bool_true«ENDIF»'''
 	
-	def dispatch CharSequence code(CheckRef it) 
+	def dispatch CharSequence code(CheckRef it)
 		'''«IF check != null»«check.shortName»(«scHandle»)«ELSE»bool_true«ENDIF»'''
 
 	def dispatch CharSequence code(If it) '''

+ 8 - 8
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/StatemachineSource.xtend

@@ -136,12 +136,12 @@ class StatemachineSource {
 			«ENDFOR»
 			«IF hasLocalScope»
 				«FOR event : internalScope.events»
-				«event.access» = bool_false; 
+				«event.access» = bool_false;
 				«ENDFOR»
 			«ENDIF»
 			«IF timed»
 				«FOR event : timeEventScope.events»
-				«event.access» = bool_false; 
+				«event.access» = bool_false;
 				«ENDFOR»
 			«ENDIF»
 		}
@@ -209,13 +209,13 @@ class StatemachineSource {
 			switch (state)
 			{
 				«FOR s : states»
-				case «s.shortName» : 
+				case «s.shortName» :
 					result = (sc_boolean) («IF s.leaf»«scHandle»->stateConfVector[«s.stateVector.offset»] == «s.shortName»
 					«ELSE»«scHandle»->stateConfVector[«s.stateVector.offset»] >= «s.shortName»
 						&& «scHandle»->stateConfVector[«s.stateVector.offset»] <= «s.subStates.last.shortName»«ENDIF»);
 					break;
 				«ENDFOR»
-				default: 
+				default:
 					result = bool_false;
 					break;
 			}
@@ -248,10 +248,10 @@ class StatemachineSource {
 			 * Always returns 'false' since this state machine can never become final.
 			 */
 			«ENDIF»
-			sc_boolean «isFinalFctID»(const «scHandleDecl») 
+			sc_boolean «isFinalFctID»(const «scHandleDecl»)
 			{
 		''' +
-		// only if the impact vector is completely covered by final states the state machine 
+		// only if the impact vector is completely covered by final states the state machine
 		// can become final
 		{if (finalStateImpactVector.isCompletelyCovered) {'''	return «FOR i : 0 ..<finalStateImpactVector.size SEPARATOR ' && '»(«FOR fs : finalStateImpactVector.get(i) SEPARATOR ' || '»«scHandle»->stateConfVector[«i»] == «IF fs.stateVector.offset == i»«fs.shortName»«ELSE»«null_state»«ENDIF»«ENDFOR»)«ENDFOR»;
 		'''} else {'''   return bool_false;'''} }		
@@ -319,7 +319,7 @@ class StatemachineSource {
 		«exitSequenceFunctions.toPrototypes»
 		«reactFunctions.toPrototypes»
 		static void «clearInEventsFctID»(«scHandleDecl»);
-		static void «clearOutEventsFctID»(«scHandleDecl»);	
+		static void «clearOutEventsFctID»(«scHandleDecl»);
 	'''
 	
 	def constantDefinitions(ExecutionFlow it) '''
@@ -329,7 +329,7 @@ class StatemachineSource {
 			«ENDFOR»
 		«ENDFOR»
 	'''
-	 
+	
 	def toPrototypes(List<Step> steps) '''
 		«FOR s : steps»
 			«s.functionPrototype»

+ 1 - 1
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/Timer.xtend

@@ -56,7 +56,7 @@ class Timer {
 		
 		#ifdef __cplusplus
 		}
-		#endif 
+		#endif
 		 
 		#endif /* «timerModule.define»_H_ */
 	'''

+ 3 - 2
plugins/org.yakindu.sct.generator.c/src/org/yakindu/sct/generator/c/Types.xtend

@@ -54,8 +54,9 @@ class Types {
 		typedef bool			sc_boolean;
 		typedef int_fast16_t	sc_short;
 		typedef uint_fast16_t	sc_ushort;
-		typedef int32_t			sc_integer; 
-		typedef uint32_t		sc_uinteger; 
+		typedef int32_t			sc_integer;
+		typedef uint32_t		sc_uinteger;
+		
 		typedef double			sc_real;
 		
 		typedef void*			sc_eventid;

+ 8 - 8
plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/StatemachineHeader.xtend

@@ -251,27 +251,27 @@ class StatemachineHeader extends org.yakindu.sct.generator.c.StatemachineHeader
 
 	override dispatch functionPrototypes(EventDefinition it) '''
 		«IF direction == Direction::LOCAL»
-			/*! Raises the in event '«name»' that is defined in the «scope.scopeDescription». */ 
+			/*! Raises the in event '«name»' that is defined in the «scope.scopeDescription». */
 			void «asRaiser»(«valueParams»);
 			
-			/*! Checks if the out event '«name»' that is defined in the «scope.scopeDescription» has been raised. */ 
+			/*! Checks if the out event '«name»' that is defined in the «scope.scopeDescription» has been raised. */
 			sc_boolean «asRaised»();
 			
 			«IF hasValue»
-				/*! Gets the value of the out event '«name»' that is defined in the «scope.scopeDescription». */ 
+				/*! Gets the value of the out event '«name»' that is defined in the «scope.scopeDescription». */
 				«type.targetLanguageName» «asGetter»();
 				
 			«ENDIF»
 		«ELSEIF direction == Direction::IN»
-			/*! Raises the in event '«name»' that is defined in the «scope.scopeDescription». */ 
+			/*! Raises the in event '«name»' that is defined in the «scope.scopeDescription». */
 			void «asRaiser»(«valueParams»);
 			
 		«ELSE»
-			/*! Checks if the out event '«name»' that is defined in the «scope.scopeDescription» has been raised. */ 
+			/*! Checks if the out event '«name»' that is defined in the «scope.scopeDescription» has been raised. */
 			sc_boolean «asRaised»();
 			
 			«IF hasValue»
-				/*! Gets the value of the out event '«name»' that is defined in the «scope.scopeDescription». */ 
+				/*! Gets the value of the out event '«name»' that is defined in the «scope.scopeDescription». */
 				«type.targetLanguageName» «asGetter»();
 				
 			«ENDIF»
@@ -279,11 +279,11 @@ class StatemachineHeader extends org.yakindu.sct.generator.c.StatemachineHeader
 	'''
 
 	override dispatch functionPrototypes(VariableDefinition it) '''
-		/*! Gets the value of the variable '«name»' that is defined in the «scope.scopeDescription». */ 
+		/*! Gets the value of the variable '«name»' that is defined in the «scope.scopeDescription». */
 		«IF const»const «ENDIF»«type.targetLanguageName» «it.asGetter»();
 
 		«IF !readonly && !const»
-			/*! Sets the value of the variable '«name»' that is defined in the «scope.scopeDescription». */ 
+			/*! Sets the value of the variable '«name»' that is defined in the «scope.scopeDescription». */
 			void «asSetter»(«type.targetLanguageName» value);
 			
 		«ENDIF»

+ 1 - 1
plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/StatemachineImplementation.xtend

@@ -323,7 +323,7 @@ class StatemachineImplementation {
 					}
 					
 				«ENDIF»
-				«IF event.hasValue» 
+				«IF event.hasValue»
 					«event.type.targetLanguageName» «module»::«scope.interfaceName»::«event.asGetter»()
 					{
 						return «event.localValueAccess»;

+ 1 - 1
plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/Types.xtend

@@ -38,7 +38,7 @@ class Types {
 		#define sc_string		char*
 		
 		typedef unsigned char	sc_ushort;
-		typedef int				sc_integer;  
+		typedef int				sc_integer;
 		typedef double			sc_real;
 		typedef bool			sc_boolean;
 		

+ 12 - 12
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/CycleBasedSynchronizedWrapper.xtend

@@ -70,8 +70,8 @@ class CycleBasedSynchronizedWrapper {
 			«flow.timingFunctions(entry)»
 			
 			/**
-			 * init() will be delegated thread-safely to the wrapped state machine. 
-			 */ 
+			 * init() will be delegated thread-safely to the wrapped state machine.
+			 */
 			public void init() {
 				synchronized(statemachine) {
 					statemachine.init();
@@ -79,8 +79,8 @@ class CycleBasedSynchronizedWrapper {
 			}
 			
 			/**
-			 * enter() will be delegated thread-safely to the wrapped state machine.  
-			 */ 
+			 * enter() will be delegated thread-safely to the wrapped state machine.
+			 */
 			public void enter() {
 				synchronized(statemachine) {
 					statemachine.enter();
@@ -88,8 +88,8 @@ class CycleBasedSynchronizedWrapper {
 			}
 			
 			/**
-			 * exit() will be delegated thread-safely to the wrapped state machine.  
-			 */ 
+			 * exit() will be delegated thread-safely to the wrapped state machine.
+			 */
 			public void exit() {
 				synchronized(statemachine) {
 					statemachine.exit();
@@ -97,8 +97,8 @@ class CycleBasedSynchronizedWrapper {
 			}
 			
 			/**
-			 * isActive() will be delegated thread-safely to the wrapped state machine.  
-			 */ 
+			 * isActive() will be delegated thread-safely to the wrapped state machine.
+			 */
 			public boolean isActive() {
 				synchronized(statemachine) {
 					return statemachine.isActive();
@@ -106,8 +106,8 @@ class CycleBasedSynchronizedWrapper {
 			}
 			
 			/**
-			 * isFinal() will be delegated thread-safely to the wrapped state machine.  
-			 */ 
+			 * isFinal() will be delegated thread-safely to the wrapped state machine.
+			 */
 			public boolean isFinal() {
 				synchronized(statemachine) {
 					return statemachine.isFinal();
@@ -115,7 +115,7 @@ class CycleBasedSynchronizedWrapper {
 			}
 			
 			/**
-			 * isStateActive() will be delegated thread-safely to the wrapped state machine.  
+			 * isStateActive() will be delegated thread-safely to the wrapped state machine.
 			 */
 			public boolean isStateActive(State state) {
 				synchronized(statemachine) {
@@ -124,7 +124,7 @@ class CycleBasedSynchronizedWrapper {
 			}
 			
 			/**
-			 * runCycle() will be delegated thread-safely to the wrapped state machine.  
+			 * runCycle() will be delegated thread-safely to the wrapped state machine.
 			 */ 
 			@Override
 			public void runCycle() {

+ 2 - 2
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/EventBasedRunnableWrapper.xtend

@@ -25,7 +25,7 @@ import org.yakindu.sct.model.sgen.GeneratorEntry
 import org.yakindu.sct.model.stext.stext.InterfaceScope
 
 /**
- * Generates the runnable wrapper for the state machine. This wrapper implies event based execution semantics. 
+ * Generates the runnable wrapper for the state machine. This wrapper implies event based execution semantics.
  */
 class EventBasedRunnableWrapper {
 
@@ -57,7 +57,7 @@ class EventBasedRunnableWrapper {
 		 * the {@link Runnable} interface and can be started in a thread by the client
 		 * code. The run method then starts the main event processing loop for this
 		 * state machine.
-		 * 
+		 *
 		 * Please report bugs and issues...
 		 */
 		

+ 1 - 1
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/FlowCode.xtend

@@ -115,7 +115,7 @@ class FlowCode {
 	
 	def dispatch CharSequence code(If it) '''
 		«stepComment»
-		if («check.code») { 
+		if («check.code») {
 			«thenStep.code»
 		}
 		«IF elseStep != null»

+ 1 - 1
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/JavaGenerator.xtend

@@ -19,7 +19,7 @@ import org.yakindu.sct.generator.java.features.CycleBasedWrapperFeature
 import org.yakindu.sct.model.sexec.naming.INamingService
 
 /**
- * This is the Java code generators main class. 
+ * This is the Java code generators main class.
  * 
  * @author Markus Mühlbrandt
  * @author Axel Terfloth - extensions

+ 11 - 11
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/RuntimeService.xtend

@@ -17,7 +17,7 @@ import com.google.inject.Inject
 class RuntimeService {
 	
 	@Inject
-	extension Naming 
+	extension Naming
 	
 	@Inject
 	extension GenmodelEntries
@@ -73,7 +73,7 @@ class RuntimeService {
 
 				/**
 				 * Adds the given state machine to the TimerTask.
-				 * 
+				 *
 				 * @param statemachine
 				 * @return {@code true} if state machine is added properly.
 				 */
@@ -86,7 +86,7 @@ class RuntimeService {
 
 				/**
 				 * Removes the given state machine from the TimerTask.
-				 * 
+				 *
 				 * @param statemachine
 				 * @return {@code true} if state machine is removed properly.
 				 */
@@ -112,7 +112,7 @@ class RuntimeService {
 
 			/**
 			 * Returns the {@code RuntimeService} instance as singleton.
-			 * 
+			 *
 			 * @return The singleton {@code RuntimeService} instance
 			 */
 			public static RuntimeService getInstance() {
@@ -124,7 +124,7 @@ class RuntimeService {
 
 			/**
 			 * Registers an {@link IStatemachine} for scheduled fixed rate execution
-			 * 
+			 *
 			 * @param statemachine
 			 *            - The state machine to execute
 			 * @param cyclePeriod
@@ -154,7 +154,7 @@ class RuntimeService {
 
 			/**
 			 * Removes the given state machine from runtime service.
-			 * 
+			 *
 			 * @param statemachine
 			 *            - the state machine to be removed
 			 * @param cyclePeriod
@@ -176,7 +176,7 @@ class RuntimeService {
 			 * Cancels the execution of state machines for the given cycle period. This
 			 * stops the execution of state machines which are registered for the given
 			 * cycle period and cancels the executing {@link TimerTask}.
-			 * 
+			 *
 			 * @return {@code true} if poperly cancelled
 			 */
 			public boolean cancelAll(long cyclePeriod) {
@@ -193,10 +193,10 @@ class RuntimeService {
 			/**
 			 * Pauses the execution of all state machines which are registered for the
 			 * given cyclePeriod.
-			 * 
+			 *
 			 * @param cyclePeriod
 			 * @return {@code true} if properly paused
-			 * 
+			 *
 			 */
 			public boolean pauseAll(long cyclePeriod) {
 				if (timerTasks.containsKey(cyclePeriod)) {
@@ -209,10 +209,10 @@ class RuntimeService {
 			/**
 			 * Resumes the execution of all state machines which are registered for the
 			 * given cyclePeriod.
-			 * 
+			 *
 			 * @param cyclePeriod
 			 * @return {@code true} if properly resumed
-			 * 
+			 *
 			 */
 			public boolean resumeAll(long cyclePeriod) {
 				if (timerTasks.containsKey(cyclePeriod)) {

+ 4 - 4
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/Statemachine.xtend

@@ -262,7 +262,7 @@ class Statemachine {
 			
 			return 
 				«FOR i : 0 ..< flow.stateVector.size SEPARATOR '||'»
-				stateVector[«i»] != State.«nullStateName» 
+				stateVector[«i»] != State.«nullStateName»
 				«ENDFOR»;
 		}
 	'''
@@ -276,16 +276,16 @@ class Statemachine {
 			 * Always returns 'false' since this state machine can never become final.
 			 *
 			«ENDIF»
-			 * @see IStatemachine#isFinal() 
+			 * @see IStatemachine#isFinal()
 			 */
 			public boolean isFinal(){
 		''' +
 		
-		// only if the impact vector is completely covered by final states the state machine 
+		// only if the impact vector is completely covered by final states the state machine
 		// can become final
 		{if (finalStateImpactVector.isCompletelyCovered) {'''
 			return «FOR i : 0 ..<finalStateImpactVector.size SEPARATOR ' && '»
-				(«FOR fs : finalStateImpactVector.get(i) SEPARATOR ' || '» 
+				(«FOR fs : finalStateImpactVector.get(i) SEPARATOR ' || '»
 					stateVector[«i»] == «
 					IF fs.stateVector.offset == i
 						»State.«fs.stateName.asEscapedIdentifier»«

+ 4 - 4
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/TimerService.xtend

@@ -39,7 +39,7 @@ class TimerService {
 		
 		/**
 		 * Default timer service implementation.
-		 * 
+		 *
 		 */
 		public class TimerService implements ITimer {
 
@@ -52,7 +52,7 @@ class TimerService {
 			/**
 			 * Timer task that reflects a time event. It's internally used by
 			 * {@link TimerService}.
-			 * 
+			 *
 			 */
 			private class TimeEventTask extends TimerTask {
 			
@@ -62,11 +62,11 @@ class TimerService {
 			
 				/**
 				 * Constructor for a time event.
-				 * 
+				 *
 				 * @param callback
 				 *            : Set to {@code true} if event should be repeated
 				 *            periodically.
-				 * 
+				 *
 				 * @param eventID
 				 *            : Index position within the state machine's timeEvent
 				 *            array.