Browse Source

Fixed compilation problem with bootstrap/*.alc

Yentl Van Tendeloo 8 years ago
parent
commit
abc02010a3

BIN
bootstrap/bootstrap.m.gz


+ 3 - 3
bootstrap/bootstrap.py

@@ -8,9 +8,9 @@ def bootstrap():
     root = ["__hierarchy"]
 
     user_manager = "user_manager"
-    bootstrap_files = glob.glob("bootstrap/*.alc")
-    initial_code_manager = "bootstrap/initial_code_manager.alc"
-    initial_code_user = "bootstrap/initial_code_user.alc"
+    initial_code_manager = "bootstrap/initial_code_manager.alb"
+    initial_code_user = "bootstrap/initial_code_user.alb"
+    bootstrap_files = glob.glob("bootstrap/*.alc") + [initial_code_manager, initial_code_user]
 
     user_data = [   "input",
                     "output",

bootstrap/initial_code_manager.alc → bootstrap/initial_code_manager.alb


bootstrap/initial_code_user.alc → bootstrap/initial_code_user.alb


+ 46 - 0
bootstrap/model_management.alc

@@ -123,3 +123,49 @@ Element function model_retype_on_name(model : Element, new_MM : Element, operati
 	dict_add(model, "metamodel", new_MM)
 
 	return model!
+
+Void function model_join(dst_model : Element, src_model : Element, retyping_key : String):
+	Element queue
+	Element mapping
+	String name
+	String type
+	String src
+	String dst
+
+	queue = set_to_list(dict_keys(src_model["model"]))
+	mapping = create_node()
+
+	while (read_nr_out(queue) > 0):
+		name = list_pop(queue, 0)
+
+		if (is_edge(src_model["model"][name])):
+			// Is an edge, so potentially queue it
+			String src
+			String dst
+
+			src = reverseKeyLookup(src_model["model"], read_edge_src(src_model["model"][name]))
+			dst = reverseKeyLookup(src_model["model"], read_edge_dst(src_model["model"][name]))
+			type = reverseKeyLookup(src_model["metamodel"]["model"], dict_read_node(src_model["type_mapping"], src_model["model"][name]))
+
+			if (bool_and(dict_in(mapping, src), dict_in(mapping, dst))):
+				// All present, so create the link between them
+				dict_add(mapping, name, instantiate_link(dst_model, retyping_key + type, "", mapping[src], mapping[dst]))
+			else:
+				list_append(queue, name)
+
+		elif (has_value(src_model["model"][name])):
+			// Has a value, so copy that as well
+			type = reverseKeyLookup(src_model["metamodel"]["model"], dict_read_node(src_model["type_mapping"], src_model["model"][name]))
+			dict_add(mapping, name, instantiate_value(dst_model, retyping_key + type, "", src_model["model"][name]))
+
+		else:
+			// Is a node
+			type = reverseKeyLookup(src_model["metamodel"]["model"], dict_read_node(src_model["type_mapping"], src_model["model"][name]))
+			dict_add(mapping, name, instantiate_node(dst_model, retyping_key + type, ""))
+
+	return!
+	
+Element function model_split(source_model : Element, target_metamodel : Element, retyping_key : String):
+	Element model
+
+	return model!

+ 31 - 0
bootstrap/modelling.alc

@@ -508,3 +508,34 @@ Void function construct_model():
 				dict_add(global_models, input(), m)
 		else:
 			log("Modelling error: did not understand command " + command)
+
+Element function construct_model_raw(metamodel : Element):
+	String command
+	Element model
+
+	model = instantiate_model(metamodel)
+
+	while (True):
+		command = input()
+		if (command == "add_node"):
+			model_add_node(global_models[input()], input())
+		elif (command == "add_value"):
+			model_add_value(global_models[input()], input(), input())
+		elif (command == "add_edge"):
+			model_add_edge(global_models[input()], input(), input(), input())
+		elif (command == "exit"):
+			return model!
+		elif (command == "instantiate_node"):
+			instantiate_node(global_models[input()], input(), input())
+		elif (command == "instantiate_attribute"):
+			instantiate_attribute(global_models[input()], input(), input(), input())
+		elif (command == "instantiate_attribute_ref"):
+			instantiate_attribute_ref(global_models[input()], input(), input(), input())
+		elif (command == "instantiate_attribute_code"):
+			instantiate_attribute_code(global_models[input()], input(), input(), construct_function())
+		elif (command == "instantiate_link"):
+			instantiate_link(global_models[input()], input(), input(), input(), input())
+		elif (command == "add_constraint"):
+			add_constraint(global_models[input()], input(), construct_function())
+		else:
+			log("Modelling error: did not understand command " + command)

+ 1 - 0
bootstrap/primitives.alc

@@ -279,6 +279,7 @@ Boolean function set_equality(sa : Element, sb : Element):
 	if (read_nr_out(sa) != read_nr_out(sb)):
 		return False!
 
+	Integer i
 	i = 0
 	while (i < read_nr_out(sa)):
 		if (set_in(sb, read_edge_dst(read_out(sa, i)))):

+ 3 - 2
core/core_algorithm.alc

@@ -252,8 +252,9 @@ Void function user_function_skip_init(user_id : String):
 			output("    transformation_add_MT_language	-- Create a RAMified metamodel")
 			output("    transformation_reRAMify			-- RAMify a merged metamodel again")
 			output("    transformation_add_MT			-- Initialize a new model transformation")
-			output("    transformation_add_AL			-- TODO")
-			output("    transformation_execute			-- TODO")
+			output("    transformation_add_AL			-- [TODO] Initialize a new action language transformation")
+			output("    transformation_add_EXT			-- [TODO] Initialize a new external tool transformation")
+			output("    transformation_execute			-- Execute a transformation on a set of input models")
 			output("")
 			output("Model permission operations")
 			output("    permission_modify				-- Change model permissions")