ソースを参照

Fixed problems in formalism

Yentl Van Tendeloo 8 年 前
コミット
b5892a7495

+ 1 - 1
integration/code/fsa_design.mvc

@@ -23,7 +23,7 @@ SCD FiniteStateAutomata_Design{
         upper_cardinality = 1
     }
 
-    Association Transition {
+    Association Transition (State, State) {
         event : String {
             target_lower_cardinality = 1
             target_upper_cardinality = 1

+ 1 - 1
integration/code/fsa_runtime.mvc

@@ -23,7 +23,7 @@ SCD FiniteStateAutomata_Runtime{
         upper_cardinality = 1
     }
 
-    Association Transition {
+    Association Transition (State, State){
         event : String {
             target_lower_cardinality = 1
             target_upper_cardinality = 1

+ 12 - 9
integration/code/fsa_semantics.alc

@@ -142,7 +142,7 @@ Void function execute_fsa(design_model : Element):
 		if (has_input()):
 			cmd = input()
 		else:
-			if (conforming == "OK"):
+			if (bool_and(conforming == "OK", running)):
 				cmd = "skip"
 			else:
 				cmd = input()
@@ -156,15 +156,18 @@ Void function execute_fsa(design_model : Element):
 			
 		elif (cmd == "pause"):
 			// Pausing merely stops a running simulation
-			simulation_time = time() - start_time
-
-			output("PAUSED")
-			while (cmd != "simulate"):
-				cmd = input()
-
-			start_time = time() - simulation_time
-			output("CONTINUE")
+			if (running):
+				simulation_time = time() - start_time
+				running = False
+				output("PAUSED")
 
+		elif (cmd == "continue"):
+			// Continue simulation, so reset the value
+			if (bool_not(running)):
+				start_time = time() - simulation_time
+				running = True
+				output("CONTINUE")
+			
 		elif (cmd == "auto_sanitize"):
 			automatic_sanitization = input()