瀏覽代碼

Fix conformance check on AL models

Yentl Van Tendeloo 7 年之前
父節點
當前提交
93b3472bb5

二進制
bootstrap/bootstrap.m.gz


+ 6 - 2
bootstrap/conformance_scd.alc

@@ -167,12 +167,12 @@ String function conformance_scd(model : Element):
 				if (bool_not(is_nominal_instance(model, src_model, src_metamodel))):
 					log("got: " + src_model)
 					log("expected: " + src_metamodel)
-					return "Source of model edge not typed by source of type: " + model_info(model, model_name)!
+					return "Source of model edge not typed by source of type: " + model_info(model, model_name) + " Expected: " + src_metamodel + " Got: " + src_model!
 
 				if (bool_not(is_nominal_instance(model, dst_model, dst_metamodel))):
 					log("got: " + dst_model)
 					log("expected: " + dst_metamodel)
-					return "Destination of model edge not typed by destination of type: " + model_info(model, model_name)!
+					return "Destination of model edge not typed by source of type: " + model_info(model, model_name) + " Expected: " + dst_metamodel + " Got: " + dst_model!
 
 			// Check cardinality for all of our edges
 			//
@@ -318,4 +318,8 @@ Element function set_model_constraints(model : Element, func : Element):
 	return model!
 
 String function model_info(model : Element, name : String):
+	if (is_edge(model["model"][name])):
+		return "EDGE " + name + " (ID: " + cast_id(model["model"][name]) + ")" + "  src: " + readAssociationSource(model, name) + "  dst: " + readAssociationDestination(model, name)!
+	else:
+		return "NODE " + name + " (ID: " + cast_id(model["model"][name]) + ")"!
 	return name!

+ 1 - 1
bootstrap/constructors.alc

@@ -160,7 +160,7 @@ String function construct_funcdef(model : Element, list : Element, mutable : Boo
 	formal = instantiate_value(model, "String", "", formal)
 	func = instantiate_node(model, "funcdef", "")
 	params = instantiate_node(model, "param_dict", "")
-	create_al_link(model, "declare_var", declare, formal, "var")
+	create_al_link(model, "global_var", declare, formal, "var")
 	create_al_link(model, "Statement_next", declare, assign, "next")
 	create_al_link(model, "assign_var", assign, resolve, "var")
 	create_al_link(model, "assign_value", assign, constant, "value")

+ 2 - 0
bootstrap/core_algorithm.alc

@@ -726,7 +726,9 @@ Element function execute_operation(operation_id : String, input_models : Element
 			output("Action Language operation not typed by ActionLanguage metamodel!")
 			return read_root()!
 		func = get_func_AL_model(al)
+		log("Prepare for call!")
 		result = func(merged_model)
+		log("Call made!")
 	else:
 		log("Unknown type of operation: " + exact_type)
 		output("Unknown type of operation: " + exact_type)

+ 1 - 1
bootstrap/metamodels.alt

@@ -240,7 +240,7 @@ Void function initialize_AL(scd_location : String, export_location : String):
 	instantiate_link(model, "Association", "constant_node", "constant", "Element")
 	instantiate_link(model, "Association", "output_node", "output", "Expression")
 	instantiate_link(model, "Association", "global_var", "global", "String")
-	instantiate_link(model, "Association", "declare_var", "declare", "String")
+	instantiate_link(model, "Association", "declare_var", "declare", "Element")
 	instantiate_link(model, "Association", "param_name", "param", "String")
 	instantiate_link(model, "Association", "param_value", "param", "Expression")
 	instantiate_link(model, "Association", "param_next_param", "param", "param")

+ 4 - 0
hybrid_server/classes/task.xml

@@ -36,6 +36,10 @@
                     commands = mvk.execute_yields(taskname, operation, params, reply)
                     if commands is None:
                         break
+                    for x in commands:
+                        if x[0] == "CD" and x[1][2] is None:
+                            print("WRITE NONE")
+                            print("Commands: " + str(commands))
                     reply = [mvs_operations[command[0]](*(command[1])) for command in commands]
                 return (0.0, False)
             except SleepKernel as e:

+ 1 - 0
models/AL_to_py.alc

@@ -187,6 +187,7 @@ String function code_print(node : Element, indentation : Integer):
 
 Boolean function main(model : Element):
 	// Read out the main function
+	log("Start up MAIN function")
 	String initial_function
 	String al_node
 	Element initial_function_element

+ 6 - 0
test_printer.py

@@ -7,5 +7,11 @@ login("admin", "admin")
 
 model_add("formalisms/String", "formalisms/SimpleClassDiagrams", open("models/String.mvc", 'r').read())
 transformation_add_AL({"AL": "formalisms/ActionLanguage"}, {"String": "formalisms/String"}, "models/AL_to_Py", open("models/AL_to_py.alc", 'r').read())
+print("VERIFY")
+print(verify("models/AL_to_Py", "formalisms/ActionLanguage"))
+print("VERIFY END")
 transformation_add_AL({}, {}, "models/test", open("models/test.alc", 'r').read())
+print("VERIFY2")
+print(verify("models/test", "formalisms/ActionLanguage"))
+print("VERIFY2 END")
 transformation_execute_AL("models/AL_to_Py", {"AL": "models/test"}, {"String": "models/printed_string"})

+ 1 - 1
wrappers/modelverse_SCCD.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Wed Apr  4 07:32:12 2018
+Date:   Wed Apr  4 08:53:21 2018
 
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server