Browse Source

Fixed some bugs; leave some bugs

Yentl Van Tendeloo 9 years ago
parent
commit
68fdb81ec5

+ 7 - 0
bootstrap/conformance_scd.alc

@@ -19,6 +19,7 @@ Boolean function is_nominal_subtype(metamodel : Element, subclass : Element, sup
 	Element new_superclass
 	Element result
 
+	log((("Nominal subtype? " + cast_e2s(subclass)) + " --|> ") + cast_e2s(superclass))
 	superclasses = get_superclasses(metamodel, subclass)
 
 	while (0 < list_len(superclasses)):
@@ -126,8 +127,14 @@ String function conformance_scd(model : Element):
 			Integer lower_val
 			Integer upper_val
 			check_type = set_pop(check_list)
+			log("Lookup!")
+			log(cast_e2s(check_type))
+			log(cast_e2s(reverseNameLookup(model, check_type)))
+			log(cast_e2s(reverseNameLookup(metamodel, check_type)))
 			lower_val = read_attribute(metamodel, reverseNameLookup(metamodel, check_type), "target_lower_cardinality")
 			upper_val = read_attribute(metamodel, reverseNameLookup(metamodel, check_type), "target_upper_cardinality")
+			log("Look up " + cast_e2s(element))
+			log("   " + cast_e2s(check_type))
 			instances = list_len(allIncomingAssociationInstances(model, element, check_type))
 			if (element_neq(lower_val, read_root())):
 				// A lower multiplicity was defined at the target

+ 0 - 2
bootstrap/modelling.alc

@@ -118,7 +118,6 @@ Element function get_superclasses(model : Element, elem : Element):
 	num_edges = read_nr_out(elem)
 	log(cast_i2s(num_edges))
 	while (i < num_edges):
-		log("Search SC")
 		edge = read_out(elem, i)
 		log(cast_e2s(edge))
 		if (element_eq(dict_read_node(model["type_mapping"], edge), model["inheritance"])):
@@ -139,7 +138,6 @@ Element function find_attribute_definer(model : Element, elem : Element, name :
 
 		superclasses = get_superclasses(model, elem)
 		while (list_len(superclasses) > 0):
-			log("Search")
 			current = set_pop(superclasses)
 			found = find_attribute_definer(model, current, name)
 			if (bool_not(element_eq(found, read_root()))):

+ 3 - 3
bootstrap/object_operations.alc

@@ -36,13 +36,13 @@ Element function allPossibleIncoming(model : Element, target : String):
 
 	result = create_node()
 	metamodel = model["metamodel"]
-	all_elems = dict_keys(model["metamodel"]["model"])
+	all_elems = dict_keys(metamodel["model"])
 	
 	while (0 < list_len(all_elems)):
 		type = set_pop(all_elems)
 		elem = metamodel["model"][type]
 		if (is_edge(elem)):
-			if (is_nominal_instance(metamodel, model["model"][target], read_edge_src(elem))):
+			if (is_nominal_instance(model, model["model"][target], read_edge_src(elem))):
 				set_add(result, elem)
 	
 	return result
@@ -64,7 +64,7 @@ Element function allPossibleOutgoing(model : Element, source : String):
 		type = set_pop(all_elems)
 		elem = metamodel["model"][type]
 		if (is_edge(elem)):
-			if (is_nominal_instance(metamodel, model["model"][source], read_edge_dst(elem))):
+			if (is_nominal_instance(model, model["model"][source], read_edge_dst(elem))):
 				set_add(result, elem)
 	
 	return result

+ 2 - 2
scripts/compile.py

@@ -3,11 +3,11 @@ import os
 import urllib2
 import subprocess
 
-def do_compile(address, filename, username, modulename, mode):
+def do_compile(address, filename, username, modulename, mode, optionals=[]):
     filename = os.path.realpath(filename)
     try:
         urllib2.urlopen(urllib2.Request(address, 'op=set_input&username=user_manager&element_type=V&value="%s"' % username)).read()
-        subprocess.check_call([sys.executable, "hutn_compiler/compiler.py", filename, "grammars/actionlanguage.g", mode, username, modulename, filename, address], cwd="interface/HUTN")
+        subprocess.check_call([sys.executable, "hutn_compiler/compiler.py", filename, "grammars/actionlanguage.g", mode, username, modulename, filename, address] + optionals, cwd="interface/HUTN")
     except urllib2.URLError:
         return 2
     except:

+ 1 - 1
scripts/make_parallel.py

@@ -16,7 +16,7 @@ username = sys.argv[2]
 files = [a.replace("\\", "/") for a in sum([glob.glob(f) for f in sys.argv[3:]], [])]
 
 def do_compile_wrapper(filename):
-    do_compile(address, filename, str(random.random()), filename, "PO")
+    do_compile(address, filename, str(random.random()), filename, "PO", ["--debug"])
 
 if __name__ == "__main__":
     p = multiprocessing.Pool(multiprocessing.cpu_count())