Explorar el Código

Add code to raise events

Yentl Van Tendeloo hace 8 años
padre
commit
16b01040c0
Se han modificado 2 ficheros con 6 adiciones y 8 borrados
  1. 0 1
      integration/code/minimal_SCCD.mvc
  2. 6 7
      models/SCCD_execute.alc

+ 0 - 1
integration/code/minimal_SCCD.mvc

@@ -61,7 +61,6 @@ CompositeState main_statechart {
     }
 }
 
-
 transition (x_a, x_b) {
     name = "X"
     event = "X"

+ 6 - 7
models/SCCD_execute.alc

@@ -122,7 +122,6 @@ Element function get_enabled_transitions(model : Element, state : String, data :
 	while (read_nr_out(to_filter) > 0):
 		transition = set_pop(to_filter)
 		attr = read_attribute(model, transition, "event")
-		log("Check attr in event list: " + set_to_string(data["events"]))
 		if (bool_or(element_eq(attr, read_root()), set_in(data["events"], attr))):
 			// Event is OK
 			cond = read_attribute(model, transition, "cond")
@@ -144,12 +143,14 @@ Element function execute_transition(model : Element, data : Element, class : Str
 	script = read_attribute(model, transition, "script")
 	if (element_neq(script, read_root())):
 		script = get_func_AL_model(import_node(script))
-		log("Calling script with attributes: " + dict_to_string(data["classes"][class]["attributes"]))
 		script(data["classes"][class]["attributes"])
-		log("Called script with attributes: " + dict_to_string(data["classes"][class]["attributes"]))
 
-	// Raise events
-	// TODO
+	// Raise events (if any)
+	Element events
+	events = allAssociationDestinations(model, transition, "SCCD/transition_raises")
+	while (read_nr_out(events) > 0):
+		event = set_pop(events)
+		set_add(data["events"], read_attribute(model, event, "event"))
 
 	// Return new set of states
 	return expand_state(model, readAssociationDestination(model, transition))!
@@ -166,7 +167,6 @@ Float function step_class(model : Element, data : Element, class : String):
 	Float t_min
 	Float t_current
 
-	log("Step class " + class)
 	states = set_copy(data["classes"][class]["states"])
 	new_states = create_node()
 
@@ -202,7 +202,6 @@ Float function step(model : Element, data : Element):
 
 	t_min = 1.0
 	classes = dict_keys(data["classes"])
-	log("Got classes: " + set_to_string(classes))
 
 	while (read_nr_out(classes) > 0):
 		class = set_pop(classes)