Kaynağa Gözat

Cleaned up huge number of logs

Yentl Van Tendeloo 8 yıl önce
ebeveyn
işleme
624c96c521

BIN
bootstrap/bootstrap.m.gz


+ 0 - 10
bootstrap/conformance_scd.alc

@@ -250,24 +250,18 @@ String function conformance_scd(model : Element):
 	String complex_type
 	String result
 	all_complex_types = allInstances(model["metamodel"]["metamodel"], "ComplexAttribute")
-	log("Got complex types: " + set_to_string(all_complex_types))
 	while (read_nr_out(all_complex_types) > 0):
 		complex_type = set_pop(all_complex_types)
 		complex_instances = allInstances(model, complex_type)
 
-		log("Instances: " + set_to_string(complex_instances))
-
 		while (read_nr_out(complex_instances) > 0):
 			complex_instance = set_pop(complex_instances)
-			log("Got complex instance: " + complex_instance)
 
 			complex_type = read_attribute(model["metamodel"], read_type(model, complex_instance), "type")
 			result = check_location_conformance(model["model"][complex_instance], complex_type)
 
 			if (result != "OK"):
 				return ((("Complex attribute doesn't match for: " + complex_instance) + "\n Message: ") + result)!
-			else:
-				log("OK for " + complex_instance)
 
 	// Structure seems fine, now do static semantics
 	if (dict_in(metamodel, "constraints")):
@@ -281,13 +275,9 @@ String function check_location_conformance(instance_location : String, type_loca
 	// Check whether the instance is typed by the type
 	Element instance
 	Element type
-	log("INSTANCE " + instance_location)
-	log("TYPE     " + type_location)
 
 	instance = import_node(instance_location)
 	type = import_node(type_location)
-	log(" --> " + cast_e2s(instance))
-	log(" --> " + cast_e2s(type))
 
 	if (element_neq(instance["metamodel"], type)):
 		return "Instance not statically typed by specified metamodel"!

+ 0 - 8
bootstrap/modelling.alc

@@ -371,7 +371,6 @@ Element function read_attribute(model : Element, element : String, attribute : S
 					return read_edge_dst(edge)!
 			i = i + 1
 
-		log("Attribute not found!")
 	else:
 		log("Element does not exist!")
 
@@ -410,7 +409,6 @@ Void function add_AL_links(model : Element, list : Element, element : Element, t
 	dict_add(model["model"], link_name, link)
 	dict_add(model["type_mapping"], link_name, (type + "_") + linkname)
 
-	log("Added element " + link_name)
 	// The name link
 	link = read_out(link, 0)
 	link_name = "__" + cast_id2s(link)
@@ -425,9 +423,6 @@ Void function add_AL_links(model : Element, list : Element, element : Element, t
 	if (bool_not(set_in_node(model["model"], link))):
 		dict_add(model["model"], link_name, link)
 		dict_add(model["type_mapping"], link_name, "StringAttr")
-		log("And assigned name")
-	else:
-		log("But didn't assign name")
 
 	// Now add the destination to the worker list
 	set_add(list, create_tuple(element[linkname], expected_type))
@@ -517,7 +512,6 @@ String function add_AL(model : Element, element : Element):
 	String initial
 	initial = instantiate_node(model, "Initial", "")
 	instantiate_link(model, "initial_funcdef", "", initial, reverseKeyLookup(model["model"], element))
-	log("Added initial link to!")
 
 	return reverseKeyLookup(model["model"], element)!
 
@@ -528,7 +522,6 @@ Void function construct_model():
 
 	while (True):
 		command = input()
-		log(command)
 		if (command == "instantiate_bottom"):
 			Element m
 			m = instantiate_bottom()
@@ -592,7 +585,6 @@ Element function construct_model_raw(metamodel : Element):
 
 	while (True):
 		command = input()
-		log("EXEC " + command)
 		if (command == "add_node"):
 			input()
 			model_add_node(model, input())

+ 0 - 10
bootstrap/ramify.alc

@@ -134,7 +134,6 @@ Element function ramify(model : Element):
 			// Got an attribute, so find out the source and name
 			old_source = reverseKeyLookup(model["model"], read_edge_src(entry))
 			attr_name = read_attribute(model, key, "name")
-			log("Got " + set_to_string(dict_keys(new_model["model"])))
 
 			// TODO distinguish between Simple and Complex Attributes
 
@@ -143,12 +142,8 @@ Element function ramify(model : Element):
 				if (is_nominal_instance(model, old_source, "Element")):
 					// If the attribute is one used in the conformance check, we should mask it
 					// Add the attribute in the new model, altering its name and making it optional
-					log("Adding attribute " + attr_name)
-					log("  to " + old_source)
 					model_define_attribute(new_model, "Pre_" + old_source, "constraint_" + attr_name, True, "ActionLanguage")
 					model_define_attribute(new_model, "Post_" + old_source, "value_" + attr_name, True, "ActionLanguage")
-				else:
-					log("Non-element origin for attribute link " + key)
 			else:
 				// Queue for later
 				list_append(keys, key)
@@ -188,13 +183,8 @@ Element function ramify(model : Element):
 				old_source = reverseKeyLookup(model["model"], read_edge_src(entry))
 
 				if (set_in(copied_attributes, attr_name)):
-					log("Copy attribute " + attr_name)
-					log("  to " + old_source)
 					instantiate_attribute(new_model, "Pre_" + old_source, attr_name, read_attribute(model, old_source, attr_name))
 					instantiate_attribute(new_model, "Post_" + old_source, attr_name, read_attribute(model, old_source, attr_name))
-				else:
-					log("Masked attribute: " + attr_name)
-					log("  for " + old_source)
 
 	// Define schedule over these elements
 

+ 1 - 48
bootstrap/transform.alc

@@ -73,40 +73,28 @@ Element function get_possible_bindings(host_model : Element, schedule_model : El
 	typename = read_type(schedule_model, current_element)
 	original_typename = string_substr(typename, 4, string_len(typename))
 	
-	log("Getting possible bindings for " + current_element)
-	log("    type: " + typename)
-
 	if (is_edge(schedule_model["model"][current_element])):
-		log("    is_edge")
 		// Is an edge, so check for already bound source/target
 		src_label = read_attribute(schedule_model, reverseKeyLookup(schedule_model["model"], read_edge_src(schedule_model["model"][current_element])), "label")
 		dst_label = read_attribute(schedule_model, reverseKeyLookup(schedule_model["model"], read_edge_dst(schedule_model["model"][current_element])), "label")
 
 		if (bool_and(set_in(dict_keys(map), src_label), set_in(dict_keys(map), dst_label))):
 			// Source and destination are bound
-			log("    SD bound")
 			options = allOutgoingAssociationInstances(host_model, map[src_label], original_typename)
-			log("    Outgoing associations instances: " + set_to_string(options))
-			log("    Incoming associations instances: " + set_to_string(allIncomingAssociationInstances(host_model, map[dst_label], original_typename)))
 			options = set_overlap(options, allIncomingAssociationInstances(host_model, map[dst_label], original_typename))
 
 		elif (set_in(dict_keys(map), src_label)):
 			// Source is bound
-			log("    S bound")
 			options = allOutgoingAssociationInstances(host_model, map[src_label], original_typename)
 
 		elif (set_in(dict_keys(map), dst_label)):
 			// Destination is bound
-			log("    D bound")
 			options = allIncomingAssociationInstances(host_model, map[dst_label], original_typename)
 
 		else:
 			// Neither is bound, so just get all of them
-			log("ERROR: unbound source/target for association!")
-			//TODO should actually return all
-			return create_node()!
+			return allInstances(host_model, original_typename)!
 	else:
-		log("    is_node")
 		// Is a node, so find whether or not there are some connections that are already resolved
 		Element ic
 		Element oc
@@ -117,21 +105,18 @@ Element function get_possible_bindings(host_model : Element, schedule_model : El
 
 		while (bool_and(read_nr_out(ic) > 0, read_nr_out(options) == 0)):
 			poll = set_pop(ic)
-			log("    poll I " + poll)
 			if (dict_in(map, read_attribute(schedule_model, poll, "label"))):
 				// This incoming link is already defined, so we just have one option: the destination of the link we matched
 				set_add(options, readAssociationDestination(host_model, map[read_attribute(schedule_model, poll, "label")]))
 			
 		while (bool_and(read_nr_out(oc) > 0, read_nr_out(options) == 0)):
 			poll = set_pop(oc)
-			log("    poll O " + poll)
 			if (dict_in(map, read_attribute(schedule_model, poll, "label"))):
 				// This incoming link is already defined, so we just have one option: the destination of the link we matched
 				set_add(options, readAssociationSource(host_model, map[read_attribute(schedule_model, poll, "label")]))
 
 		if (read_nr_out(options) == 0):
 			// Is a node and no connections, so we just pick all options
-			log("    empty")
 			options = allInstances(host_model, original_typename)
 		elif (read_nr_out(options) > 1):
 			// Multiple "only" options, which will not work out: no options!
@@ -142,8 +127,6 @@ Element function get_possible_bindings(host_model : Element, schedule_model : El
 	Element filtered_options
 	String option
 
-	log("    Got options: " + set_to_string(options))
-
 	filtered_options = create_node()
 	while (read_nr_out(options) > 0):
 		option = set_pop(options)
@@ -166,9 +149,6 @@ Element function get_possible_bindings(host_model : Element, schedule_model : El
 				func = get_func_AL_model(constraint_function)
 				result = func(host_model, option)
 
-				log("Execute constraint on " + dict_to_string(option))
-				log("Result: " + cast_e2s(result))
-
 				if (result):
 					set_add(filtered_options, option)
 
@@ -181,16 +161,13 @@ Element function get_possible_bindings(host_model : Element, schedule_model : El
 
 	options = filtered_options
 	filtered_options = create_node()
-	log("Checking options: " + set_to_string(options))
 
 	// Check whether all attributes have a satisfied condition
 	attributes_copy = dict_keys(getAttributeList(schedule_model, current_element))
-	log("Defined attributes: " + set_to_string(attributes_copy))
 
 	while (read_nr_out(options) > 0):
 		option = set_pop(options)
 		attributes = set_copy(attributes_copy)
-		log(" opt: " + option)
 
 		result = True
 		while (read_nr_out(attributes) > 0):
@@ -198,20 +175,12 @@ Element function get_possible_bindings(host_model : Element, schedule_model : El
 			if (bool_not(string_startswith(attribute, "constraint_"))):
 				continue!
 
-			log("Check attribute: " + attribute)
 			value = read_attribute(schedule_model, current_element, attribute)
 			// Attribute might be undefined, so skip if it is
 			if (element_neq(value, read_root())):
-				log("Read value: " + cast_e2s(value))
 				func = get_func_AL_model(value)
-				log("Func: " + cast_e2s(func))
-				log("EXEC")
-				log("Read attribute with name: " + string_substr(attribute, string_len("constraint_"), string_len(attribute) + 1))
-				log("Value: " + cast_e2s(read_attribute(host_model, option, string_substr(attribute, string_len("constraint_"), string_len(attribute) + 1))))
 				result = func(read_attribute(host_model, option, string_substr(attribute, string_len("constraint_"), string_len(attribute) + 1)))
-				log("Got result of constraint eval: " + cast_v2s(result))
 			else:
-				log("Attribute unconstrained, so add always")
 				result = True
 
 			if (bool_not(result)):
@@ -219,10 +188,7 @@ Element function get_possible_bindings(host_model : Element, schedule_model : El
 
 		// Check value of last result, which will be True if all passed, or False otherwise
 		if (result):
-			log("Adding")
 			set_add(filtered_options, option)
-		else:
-			log("Dropping")
 
 	options = filtered_options
 	return options!
@@ -313,9 +279,6 @@ Element function match(host_model : Element, schedule_model : Element, LHS : Str
 			func = get_func_AL_model(constraint)
 			result = func(host_model, map)
 
-			log("Execute global constraint on " + dict_to_string(map))
-			log("Result: " + cast_e2s(result))
-
 			if (result):
 				set_add(new_mappings, map)
 		mappings = new_mappings
@@ -408,25 +371,17 @@ Void function rewrite(host_model : Element, schedule_model : Element, RHS : Stri
 			if (bool_not(string_startswith(attribute, "value_"))):
 				continue!
 
-			log("Execute attribute " + attribute)
 			value = read_attribute(schedule_model, RHS_map[label], attribute)
 			if (element_neq(value, read_root())):
 				func = get_func_AL_model(value)
-				log("Func: " + cast_e2s(func))
-				log("EXEC")
 				result = func(host_model, new_mapping[label], mapping)
-				log("Got result of constraint eval: " + cast_v2s(result))
 
 				if (has_value(result)):
 					// New value defined, so assign!
 					instantiate_attribute(host_model, new_mapping[label], string_substr(attribute, string_len("value_"), string_len(attribute) + 1), result)
-					log("Created new value for attribute!")
 				else:
 					// Non-value return means to destroy the attribute!
 					unset_attribute(host_model, new_mapping[label], string_substr(attribute, string_len("value_"), string_len(attribute) + 1))
-					log("Deleted attribute!")
-			else:
-				log("Attribute undefined, so leave it be!")
 
 		// Do the global action of each element
 		action = read_attribute(schedule_model, RHS_map[label], "action")
@@ -486,7 +441,6 @@ Boolean function transform_composite(host_model : Element, schedule_model : Elem
 	while (is_nominal_instance(schedule_model, current, "Rule")):
 		// Still a rule that we must execute
 		typename = read_type(schedule_model, current)
-		log("RULE: " + current)
 		if (typename == "Atomic"):
 			result = transform_atomic(host_model, schedule_model, current)
 		elif (typename == "Query"):
@@ -540,7 +494,6 @@ Boolean function transform_forall(host_model : Element, schedule_model : Element
 	while (read_nr_out(mappings) > 0):
 		mapping = set_pop(mappings)
 		// TODO check if there are actually no deletions happening in the meantime of other matched elements...
-		log("Execute RHS for binding: " + dict_to_string(mapping))
 		RHS = set_pop(allAssociationDestinations(schedule_model, current, "RHSLink"))
 		rewrite(host_model, schedule_model, RHS, mapping)