浏览代码

Cleaned up old tests, in particular the pn_interface file and tests

Yentl Van Tendeloo 8 年之前
父节点
当前提交
f65c7e930e

二进制
bootstrap/bootstrap.m.gz


+ 0 - 254
integration/code/mini_modify.alc

@@ -1,254 +0,0 @@
-include "primitives.alh"
-include "constructors.alh"
-include "object_operations.alh"
-include "library.alh"
-include "conformance_scd.alh"
-include "io.alh"
-include "metamodels.alh"
-include "modelling.alh"
-include "compilation_manager.alh"
-
-Element function modify(model : Element):
-	String cmd
-
-	Element attr_list_pn
-	Element attr_keys_pn
-	String attr_key_pn
-	Element metamodel_element_pn
-	String typename
-
-	output("Model loaded, ready for commands!")
-	output("Use 'help' command for a list of possible commands")
-
-	while (True):
-		output("Please give your command.")
-		cmd = input()
-		if (cmd == "help"):
-			output("Generic model operations:")
-			output("  instantiate -- Create a new model element")
-			output("  delete      -- Delete an existing element")
-			output("  attr_add    -- Add an attribute to an element")
-			output("  attr_del    -- Delete an attribute of an element")
-			output("  constrain   -- Add a constraint function to the model")
-			output("  rename      -- Rename an existing element")
-			output("  modify      -- Modify the attributes of an element")
-			output("  list        -- Prints the list of elements in the model")
-			output("  types       -- Prints the list of elements that can be instantiated")
-			output("  read        -- Prints the current state of a model element")
-			output("  verify      -- Check whether the model conforms to the metamodel")
-			output("  retype      -- Change the type of an element")
-			output("  exit        -- Leave the modification interface")
-		elif (cmd == "exit"):
-			return model!
-		elif (cmd == "instantiate"):
-			String mm_type_name
-			output("Type to instantiate?")
-			mm_type_name = input()
-			if (dict_in(model["metamodel"]["model"], mm_type_name)):
-				String element_name
-				output("Name of new element?")
-				element_name = input()
-				if (dict_in(model["model"], element_name)):
-					output("Element already exists; aborting")
-				else:
-					if (is_edge(model["metamodel"]["model"][mm_type_name])):
-						output("Source name?")
-						String src_name
-						src_name = input()
-						if (dict_in(model["model"], src_name)):
-							output("Destination name?")
-							String dst_name
-							dst_name = input()
-							if (dict_in(model["model"], dst_name)):
-								instantiate_link(model, mm_type_name, element_name, src_name, dst_name)
-								output("Instantiation successful!")
-							else:
-								output("Unknown destination; aborting")
-						else:
-							output("Unknown source; aborting")
-					else:
-						instantiate_node(model, mm_type_name, element_name)
-						output("Instantiation successful!")
-			else:
-				output("Unknown type specified; aborting")
-		elif (cmd == "set_inheritance"):
-			String inh_name
-
-			output("Which link in the metamodel is the inheritance link?")
-			inh_name = input()
-
-			if (dict_in(model["metamodel"]["model"], inh_name)):
-				dict_add(model, "inheritance", model["metamodel"]["model"][inh_name])
-				output("Set inheritance link!")
-			else:
-				output("Element not found in metamodel; aborting")
-
-		elif (cmd == "constrain"):
-			output("Element to constrain (empty for global)?")
-			String model_name
-			model_name = input()
-
-			if (model_name == ""):
-				// Global constraint
-				output("Give input to function constructors for GLOBAL constraint!")
-				set_model_constraints(model, construct_function())
-			elif (dict_in(model["model"], model_name)):
-				// Local constraint for this model
-				output("Give input to function constructors for LOCAL constraint!")
-				add_constraint(model, model_name, construct_function())
-				output("Added constraint to model!")
-			else:
-				// Local constraint, but model not found
-				output("Unknown model; aborting")
-		elif (cmd == "modify"):
-			String model_name
-			output("Element to modify?")
-			model_name = input()
-			if (dict_in(model["model"], model_name)):
-				Element attrs
-				attrs = getAttributeList(model, model_name)
-				String attr_name
-				output("Attribute to modify?")
-				attr_name = input()
-				if (set_in(dict_keys(attrs), attr_name)):
-					output("New value?")
-					unset_attribute(model, model_name, attr_name)
-					instantiate_attribute(model, model_name, attr_name, input())
-					output("Modified!")
-				else:
-					output("No such attribute!")
-			else:
-				output("No such model!")
-		elif (cmd == "attr_add"):
-			String model_name
-			output("Which model do you want to assign an attribute to?")
-			model_name = input()
-			if (dict_in(model["model"], model_name)):
-				Element attrs
-				attrs = getAttributeList(model, model_name)
-				String attr_name
-				output("Which attribute do you wish to assign?")
-				attr_name = input()
-				if (set_in(dict_keys(attrs), attr_name)):
-					output("Value of attribute?")
-					instantiate_attribute(model, model_name, attr_name, input())
-					output("Added attribute!")
-				else:
-					output("No such attribute!")
-			else:
-				output("No such model!")
-		elif (cmd == "attr_del"):
-			String model_name
-			output("Which model do you want to remove an attribute of?")
-			model_name = input()
-			if (dict_in(model["model"], model_name)):
-				Element attrs
-				attrs = getAttributeList(model, model_name)
-				String attr_name
-				output("Which attribute do you want to delete?")
-				attr_name = input()
-				if (set_in(dict_keys(attrs), attr_name)):
-					unset_attribute(model, model_name, attr_name)
-					output("Attribute deleted!")
-				else:
-					output("No such attribute!")
-			else:
-				output("No such model!")
-		elif (cmd == "delete"):
-			output("What is the name of the element you want to delete?")
-			cmd = input()
-			if (dict_in(model["model"], cmd)):
-				model_delete_element(model, cmd)
-				output("Deleted!")
-			else:
-				output("No such element; aborting")
-		elif (cmd == "rename"):
-			output("Old name?")
-			String old_name_e
-			old_name_e = input()
-			if (dict_in(model["model"], old_name_e)):
-				output("New name?")
-				String new_name_e
-				new_name_e = input()
-				if (dict_in(model["model"], new_name_e)):
-					output("New name already used; aborting")
-				else:
-					dict_add(model["model"], new_name_e, model["model"][old_name_e])
-					dict_delete(model["model"], old_name_e)
-					output("Rename complete!")
-			else:
-				output("Unknown element; aborting")
-		elif (cmd == "list"):
-			Element keys_m
-			keys_m = dict_keys(model["model"])
-			output("List of all elements:")
-			String v_m
-			while (read_nr_out(keys_m) > 0):
-				v_m = set_pop(keys_m)
-				// Filter out anonymous objects
-				if (bool_not(string_startswith(v_m, "__"))):
-					typename = reverseKeyLookup(model["metamodel"]["model"], dict_read_node(model["type_mapping"], model["model"][v_m]))
-					output((("  " + v_m) + " : ") + typename)
-		elif (cmd == "read"):
-			output("Element to read?")
-			cmd = input()
-			if (dict_in(model["model"], cmd)):
-				Element read_elem
-				read_elem = model["model"][cmd]
-				metamodel_element_pn = dict_read_node(model["type_mapping"], read_elem)
-
-				output("Name: " + cmd)
-				output("Type: " + reverseKeyLookup(model["metamodel"]["model"], metamodel_element_pn))
-				if (is_edge(read_elem)):
-					output("Source: " + reverseKeyLookup(model["model"], read_edge_src(read_elem)))
-					output("Destination: " + reverseKeyLookup(model["model"], read_edge_dst(read_elem)))
-				if (cast_v2s(read_elem) != "None"):
-					output("Value: " + cast_v2s(read_elem))
-				output("Defines attributes:")
-				attr_list_pn = getInstantiatableAttributes(model, read_elem)
-				attr_keys_pn = dict_keys(attr_list_pn)
-				while (0 < read_nr_out(attr_keys_pn)):
-					attr_key_pn = set_pop(attr_keys_pn)
-					output(((("  " + attr_key_pn) + " : ") + cast_v2s(attr_list_pn[attr_key_pn])))
-				output("Attributes:")
-				attr_list_pn = getAttributeList(model, cmd)
-				attr_keys_pn = dict_keys(attr_list_pn)
-				while (0 < read_nr_out(attr_keys_pn)):
-					attr_key_pn = set_pop(attr_keys_pn)
-					output((((("  " + cast_v2s(attr_key_pn)) + " : ") + cast_v2s(attr_list_pn[attr_key_pn])) + " = ") + cast_v2s(read_attribute(model, reverseKeyLookup(model["model"], read_elem), attr_key_pn)))
-			else:
-				output("Unknown element; aborting")
-		elif (cmd == "verify"):
-			output(conformance_scd(model))
-		elif (cmd == "types"):
-			Element keys_t
-			keys_t = dict_keys(model["metamodel"]["model"])
-			output("List of types:")
-			String v_t
-			while (read_nr_out(keys_t) > 0):
-				v_t = set_pop(keys_t)
-				if (bool_not(string_startswith(v_t, "__"))):
-					output(string_join(("  " + v_t) + " : ", reverseKeyLookup(model["metamodel"]["metamodel"]["model"], dict_read_node(model["metamodel"]["type_mapping"], model["metamodel"]["model"][v_t]))))
-		elif (cmd == "retype"):
-			output("Element to retype?")
-			String elementname
-			elementname = input()
-			if (dict_in(model["model"], elementname)):
-				output("New type")
-				typename = input()
-				if (dict_in(model["metamodel"]["model"], typename)):
-					// OK, do the retyping
-					// First try removing the previous type if it exists
-					dict_delete_node(model["type_mapping"], model["model"][elementname])
-					// Now add the new type
-					dict_add(model["type_mapping"], model["model"][elementname], model["metamodel"]["model"][typename])
-					output("Retyped!")
-				else:
-					output("Unknown type; aborting")
-			else:
-				output("Unknown element; aborting")
-		else:
-			output("Unknown command: " + cast_v2s(cmd))
-			output("Use command 'help' to get a list of available commands")
-
-	return model!

+ 0 - 1
integration/code/mini_modify.alh

@@ -1 +0,0 @@
-Element function modify(model : Element)

+ 4 - 0
integration/code/petrinets.mvc

@@ -1,3 +1,5 @@
+import models/SimpleClassDiagrams as SimpleClassDiagrams
+
 SimpleClassDiagrams PetriNets{
     Class Natural {}
     Class Place{
@@ -11,3 +13,5 @@ SimpleClassDiagrams PetriNets{
         weight : Natural
     }
 }
+
+export PetriNets to models/PetriNets

+ 0 - 494
integration/code/pn_interface.alc

@@ -1,494 +0,0 @@
-include "primitives.alh"
-include "constructors.alh"
-include "object_operations.alh"
-include "library.alh"
-include "conformance_scd.alh"
-include "io.alh"
-include "metamodels.alh"
-include "modelling.alh"
-include "compilation_manager.alh"
-include "ramify.alh"
-include "transform.alh"
-include "model_management.alh"
-include "ftg.alh"
-
-Element function model_loaded(model : Element):
-	String cmd
-
-	Element attr_list_pn
-	Element attr_keys_pn
-	String attr_key_pn
-	Element metamodel_element_pn
-	String typename
-	Boolean bottom
-	Element other_metamodel
-
-	bottom = False
-	other_metamodel = create_node()
-	dict_add(other_metamodel, "model", model["model"])
-	dict_add(other_metamodel, "type_mapping", create_node())
-	dict_add(other_metamodel, "metamodel", import_node("models/LTM_bottom"))
-	dict_add(other_metamodel, "inheritance", other_metamodel["metamodel"]["model"]["__Inheritance"])
-
-	output("Model loaded, ready for commands!")
-	output("Use 'help' command for a list of possible commands")
-
-	while (True):
-		output("Please give your command.")
-		cmd = input()
-		if (cmd == "help"):
-			output("Generic model operations:")
-			output("  instantiate -- Create a new model element")
-			output("  delete      -- Delete an existing element")
-			output("  attr_add    -- Add an attribute to an element")
-			output("  attr_add_code -- Add a code attribute to an element")
-			output("  attr_del    -- Delete an attribute of an element")
-			output("  attr_def    -- Define a new attribute")
-			output("  constrain   -- Add a constraint function to the model")
-			output("  rename      -- Rename an existing element")
-			output("  modify      -- Modify the attributes of an element")
-			output("  list        -- Prints the list of elements in the model")
-			output("  types       -- Prints the list of elements that can be instantiated")
-			output("  read        -- Prints the current state of a model element")
-			output("  verify      -- Check whether the model conforms to the metamodel")
-			output("  retype      -- Change the type of an element")
-			output("  switch      -- Switch between conformance bottom and the linguistic metamodel")
-			output("  exit        -- Unload the model and go back to the loading prompt")
-		elif (cmd == "exit"):
-			return model!
-		elif (cmd == "attr_def"):
-			String name
-			String attr
-			String type
-			output("Which element do you want to define an attribute for?")
-			name = input()
-			output("What is the name of the attribute?")
-			attr = input()
-			output("Type of attribute?")
-			type = input()
-			model_define_attribute(model, name, attr, type)
-		elif (cmd == "instantiate"):
-			String mm_type_name
-			output("Type to instantiate?")
-			mm_type_name = input()
-			if (dict_in(model["metamodel"]["model"], mm_type_name)):
-				String element_name
-				output("Name of new element?")
-				element_name = input()
-				if (dict_in(model["model"], element_name)):
-					output("Element already exists; aborting")
-				else:
-					if (is_edge(model["metamodel"]["model"][mm_type_name])):
-						output("Source name?")
-						String src_name
-						src_name = input()
-						if (dict_in(model["model"], src_name)):
-							output("Destination name?")
-							String dst_name
-							dst_name = input()
-							if (dict_in(model["model"], dst_name)):
-								instantiate_link(model, mm_type_name, element_name, src_name, dst_name)
-								output("Instantiation successful!")
-							else:
-								output("Unknown destination; aborting")
-						else:
-							output("Unknown source; aborting")
-					else:
-						instantiate_node(model, mm_type_name, element_name)
-						output("Instantiation successful!")
-			else:
-				output("Unknown type specified; aborting")
-		elif (cmd == "set_inheritance"):
-			String inh_name
-
-			output("Which link in the metamodel is the inheritance link?")
-			inh_name = input()
-
-			if (dict_in(model["metamodel"]["model"], inh_name)):
-				dict_add(model, "inheritance", model["metamodel"]["model"][inh_name])
-				output("Set inheritance link!")
-			else:
-				output("Element not found in metamodel; aborting")
-
-		elif (cmd == "constrain"):
-			output("Give input to function constructors for GLOBAL constraint!")
-			set_model_constraints(model, construct_function())
-		elif (cmd == "modify"):
-			String model_name
-			output("Element to modify?")
-			model_name = input()
-			if (dict_in(model["model"], model_name)):
-				Element attrs
-				attrs = getAttributeList(model, model_name)
-				String attr_name
-				output("Attribute to modify?")
-				attr_name = input()
-				if (set_in(dict_keys(attrs), attr_name)):
-					output("New value?")
-					unset_attribute(model, model_name, attr_name)
-					instantiate_attribute(model, model_name, attr_name, input())
-					output("Modified!")
-				else:
-					output("No such attribute!")
-			else:
-				output("No such model!")
-		elif (cmd == "attr_add"):
-			String model_name
-			output("Which model do you want to assign an attribute to?")
-			model_name = input()
-			if (dict_in(model["model"], model_name)):
-				Element attrs
-				attrs = getAttributeList(model, model_name)
-				String attr_name
-				output("Which attribute do you wish to assign?")
-				attr_name = input()
-				if (set_in(dict_keys(attrs), attr_name)):
-					output("Value of attribute?")
-					instantiate_attribute(model, model_name, attr_name, input())
-					output("Added attribute!")
-				else:
-					output("No such attribute!")
-			else:
-				output("No such model!")
-		elif (cmd == "attr_add_code"):
-			String model_name
-			output("Which model do you want to assign a coded attribute to?")
-			model_name = input()
-			if (dict_in(model["model"], model_name)):
-				Element attrs
-				attrs = getAttributeList(model, model_name)
-				String attr_name
-				output("Which attribute do you wish to assign?")
-				attr_name = input()
-				if (set_in(dict_keys(attrs), attr_name)):
-					output("Constructors for code?")
-					instantiate_attribute_code(model, model_name, attr_name, construct_function())
-					output("Added code!")
-				else:
-					output("No such attribute!")
-			else:
-				output("No such model!")
-		elif (cmd == "attr_del"):
-			String model_name
-			output("Which model do you want to remove an attribute of?")
-			model_name = input()
-			if (dict_in(model["model"], model_name)):
-				Element attrs
-				attrs = getAttributeList(model, model_name)
-				String attr_name
-				output("Which attribute do you want to delete?")
-				attr_name = input()
-				if (set_in(dict_keys(attrs), attr_name)):
-					unset_attribute(model, model_name, attr_name)
-					output("Attribute deleted!")
-				else:
-					output("No such attribute!")
-			else:
-				output("No such model!")
-		elif (cmd == "delete"):
-			output("What is the name of the element you want to delete?")
-			cmd = input()
-			if (dict_in(model["model"], cmd)):
-				model_delete_element(model, cmd)
-				output("Deleted!")
-			else:
-				output("No such element; aborting")
-		elif (cmd == "rename"):
-			output("Old name?")
-			String old_name_e
-			old_name_e = input()
-			if (dict_in(model["model"], old_name_e)):
-				output("New name?")
-				String new_name_e
-				new_name_e = input()
-				if (dict_in(model["model"], new_name_e)):
-					output("New name already used; aborting")
-				else:
-					dict_add(model["model"], new_name_e, model["model"][old_name_e])
-					dict_delete(model["model"], old_name_e)
-					output("Rename complete!")
-			else:
-				output("Unknown element; aborting")
-		elif (cmd == "list"):
-			Element keys_m
-			keys_m = dict_keys(model["model"])
-			output("List of all elements:")
-			String v_m
-			while (read_nr_out(keys_m) > 0):
-				v_m = set_pop(keys_m)
-				// Filter out anonymous objects
-				if (bool_not(string_startswith(v_m, "__"))):
-					typename = reverseKeyLookup(model["metamodel"]["model"], dict_read_node(model["type_mapping"], model["model"][v_m]))
-					output((("  " + v_m) + " : ") + typename)
-		elif (cmd == "read"):
-			output("Element to read?")
-			cmd = input()
-			if (dict_in(model["model"], cmd)):
-				Element read_elem
-				read_elem = model["model"][cmd]
-				metamodel_element_pn = dict_read_node(model["type_mapping"], read_elem)
-
-				output("Name: " + cmd)
-				output("Type: " + reverseKeyLookup(model["metamodel"]["model"], metamodel_element_pn))
-				if (is_edge(read_elem)):
-					output("Source: " + reverseKeyLookup(model["model"], read_edge_src(read_elem)))
-					output("Destination: " + reverseKeyLookup(model["model"], read_edge_dst(read_elem)))
-				if (cast_v2s(read_elem) != "None"):
-					output("Value: " + cast_v2s(read_elem))
-				output("Defines attributes:")
-				attr_list_pn = getInstantiatableAttributes(model, cmd)
-				attr_keys_pn = dict_keys(attr_list_pn)
-				while (0 < read_nr_out(attr_keys_pn)):
-					attr_key_pn = set_pop(attr_keys_pn)
-					output(((("  " + attr_key_pn) + " : ") + cast_v2s(attr_list_pn[attr_key_pn])))
-				output("Attributes:")
-				attr_list_pn = getAttributeList(model, cmd)
-				attr_keys_pn = dict_keys(attr_list_pn)
-				while (0 < read_nr_out(attr_keys_pn)):
-					attr_key_pn = set_pop(attr_keys_pn)
-					output((((("  " + cast_v2s(attr_key_pn)) + " : ") + cast_v2s(attr_list_pn[attr_key_pn])) + " = ") + cast_v2s(read_attribute(model, reverseKeyLookup(model["model"], read_elem), attr_key_pn)))
-			else:
-				output("Unknown element; aborting")
-		elif (cmd == "verify"):
-			output(conformance_scd(model))
-		elif (cmd == "types"):
-			Element keys_t
-			keys_t = dict_keys(model["metamodel"]["model"])
-			output("List of types:")
-			String v_t
-			while (read_nr_out(keys_t) > 0):
-				v_t = set_pop(keys_t)
-				if (bool_not(string_startswith(v_t, "__"))):
-					output(string_join(("  " + v_t) + " : ", reverseKeyLookup(model["metamodel"]["metamodel"]["model"], dict_read_node(model["metamodel"]["type_mapping"], model["metamodel"]["model"][v_t]))))
-		elif (cmd == "retype"):
-			output("Element to retype?")
-			String elementname
-			elementname = input()
-			if (dict_in(model["model"], elementname)):
-				output("New type")
-				typename = input()
-				if (dict_in(model["metamodel"]["model"], typename)):
-					// OK, do the retyping
-					// First try removing the previous type if it exists
-					dict_delete_node(model["type_mapping"], model["model"][elementname])
-					// Now add the new type
-					dict_add(model["type_mapping"], model["model"][elementname], model["metamodel"]["model"][typename])
-					output("Retyped!")
-				else:
-					output("Unknown type; aborting")
-			else:
-				output("Unknown element; aborting")
-		elif (cmd == "switch"):
-			bottom = bool_not(bottom)
-
-			Element tmp_model
-			tmp_model = model
-			model = other_metamodel
-			other_metamodel = tmp_model
-
-			if (bottom):
-				// The type mapping we are using is probably not complete for our model
-				// so we completely recreate it from the model we have.
-				output("Switching to conformance bottom mode!")
-				generate_bottom_type_mapping(model)
-			else:
-				// We already switched the models and such, so we are already done!
-				output("Switching to linguistic metamodel!")
-		else:
-			output("Unknown command: " + cast_v2s(cmd))
-			output("Use command 'help' to get a list of available commands")
-
-	return model!
-
-Void function main():
-	output("Welcome to the Model Management Interface, running live on the Modelverse!")
-	output("Use 'help' command for a list of possible commands")
-	String command
-	Element root
-	Element metamodel
-	String name
-	Element my_model
-	String mm_name
-
-	root = create_metamodels()
-
-	while (True):
-		output("Please give your command.")
-		command = input()
-		if (command == "help"):
-			output("Currently no model is loaded, so your operations are limited to:")
-			output("  new    -- Create a new model and save it for future use")
-			output("  load   -- Load a previously made model")
-			output("  rename -- Rename a previously made model")
-			output("  delete -- Delete a previously made model")
-			output("  list   -- Show a list of all stored models")
-			output("  upload -- Upload a model using the model constructor commands")
-			output("  ramify -- RAMify existing metamodels to generate a language for transformations")
-			output("  transform -- Execute a previously defined model transformation")
-			output("  help   -- Show a list of possible commands")
-		elif (command == "new"):
-			output("Metamodel to instantiate?")
-			mm_name = input()
-			if (dict_in(root, mm_name)):
-				output("Name of model?")
-				name = input()
-				if (dict_in(root, name)):
-					output("Model exists; aborting")
-				else:
-					my_model = instantiate_model(root[mm_name])
-					dict_add(root, name, my_model)
-					model_loaded(my_model)
-			else:
-				output("Unknown metamodel; aborting")
-		elif (command == "upload"):
-			construct_model()
-		elif (command == "load"):
-			output("Model to load?")
-			name = input()
-			if (dict_in(root, name)):
-				my_model = root[name]
-				model_loaded(my_model)
-			else:
-				output("Model not found; aborting")
-		elif (command == "list"):
-			Element keys
-			String m_menu_list
-			keys = dict_keys(root)
-			output("Found models:")
-			while (read_nr_out(keys) > 0):
-				m_menu_list = set_pop(keys)
-				if (bool_not(string_startswith(m_menu_list, "__"))):
-					output((("  " + m_menu_list) + " : ") + reverseKeyLookup(root, root[m_menu_list]["metamodel"]))
-		elif (command == "delete"):
-			output("Model to delete?")
-			name = input()
-			if (dict_in(root, name)):
-				dict_delete(root, name)
-				output("Deleted!")
-			else:
-				output("Model not found; aborting")
-		elif (command == "rename"):
-			output("Old name?")
-			String old_name
-			old_name = input()
-			if (dict_in(root, old_name)):
-				output("New name?")
-				String new_name
-				new_name = input()
-				if (dict_in(root, new_name)):
-					output("Model exists; aborting")
-				else:
-					dict_add(root, new_name, root[old_name])
-					dict_delete(root, old_name)
-					output("Rename complete!")
-			else:
-				output("Model not found; aborting")
-		elif (command == "actions"):
-			output("Switching to compilation manager!")
-			compilation_manager()
-			output("Back in model manager!")
-		elif (command == "unify"):
-			String mm1
-			String mm2
-			String name1
-			String name2
-			Element result
-			name = input()
-			if (dict_in(root, name)):
-				output("Already exists; aborting")
-			else:
-				output("Which language do you want to unify?")
-				mm1 = input()
-				if (dict_in(root, mm1)):
-					output("Name of this language in the unification")
-					name1 = input()
-					output("Second language to unify?")
-					mm2 = input()
-					if (dict_in(root, mm2)):
-						output("Name of this language in the unification")
-						name2 = input()
-						log("Calling model_fuse")
-						result = model_fuse(name1, root[mm1], name2, root[mm2])
-						dict_add(root, name, result)
-					else:
-						output("Second model not found; aborting")
-				else:
-					output("Model not found; aborting")
-		elif (command == "split"):
-			String mm_name
-			String value
-
-			output("Name of the model to split up?")
-			name = input()
-			if (dict_in(root, name)):
-				output("Name of new metamodel?")
-				mm_name = input()
-				if (dict_in(root, mm_name)):
-					output("Typename to split?")
-					value = input()
-					model_retype_on_name(root[name], root[mm_name], "-", value)
-				else:
-					output("No such metamodel; aborting")
-			else:
-				output("No such model; aborting")
-		elif (command == "join"):
-			String mm_name
-			String value
-
-			output("Model name?")
-			name = input()
-			if (dict_in(root, name)):
-				output("New metamodel?")
-				mm_name = input()
-				if (dict_in(root, mm_name)):
-					value = input()
-					model_retype_on_name(root[name], root[mm_name], "+", value)
-				else:
-					output("No such metamodel; aborting")
-			else:
-				output("No such model; aborting")
-		elif (command == "ramify"):
-			Element result
-			String old_name
-			output("Name of the RAMified metamodel to create")
-			name = input()
-			if (dict_in(root, name)):
-				output("Already exists; aborting")
-			else:
-				output("Source language?")
-				String source
-				source = input()
-				if (dict_in(root, source)):
-					result = ramify(root[source])
-					dict_add(root, name, result)
-				else:
-					output("Unknown source language; aborting")
-		elif (command == "transform"):
-			Element result
-			String schedule
-			output("Which model do you want to transform?")
-			name = input()
-			if (dict_in(root, name)):
-				output("Which schedule do you want to execute?")
-				schedule = input()
-				if (dict_in(root, schedule)):
-					result = transform(root[name], root[schedule])
-					output("Transformation result: " + cast_v2s(result))
-				else:
-					output("Unknown transformation selected!")
-			else:
-				output("Unknown host model selected!")
-		elif (command == "generate_ftg"):
-			Element ftg
-			output("Name to store the FTG?")
-			name = input()
-
-			if (dict_in(root, name)):
-				output("Model already exists; aborting")
-			else:
-				ftg = create_ftg(root)
-				dict_add(root, name, ftg)
-		else:
-			output("Command not recognized, use 'help' for a list of possible commands")
-
-	return!

+ 0 - 33
integration/my_petrinet_with_MM_and_constraints.mvc

@@ -1,33 +0,0 @@
-import models/SimpleClassDiagrams as SCD
-
-SCD PetriNets{
-    Class Natural {}
-    Class Place{
-        tokens : Natural
-    }
-    Class Transition{}
-    Association P2T (Place, Transition) {
-        weight : Natural
-    }
-    Association T2P (Transition, Place) {
-        weight : Natural
-    }
-}
-
-PetriNets my_petrinet {
-    Place p1 {
-        tokens = 1
-    }
-    Place p2 {
-        tokens = 3
-    }
-    Transition t1 {}
-    P2T (p1, t1) {
-        weight = 1
-    }
-    T2P (t1, p2) {
-        weight = 2
-    }
-}
-
-export my_petrinet to models/my_petrinet

+ 0 - 662
integration/test_pn_interface.py

@@ -1,662 +0,0 @@
-import unittest
-
-from utils import run_file, get_constructor, get_model_constructor
-
-set_inheritance = [
-        "Which link in the metamodel is the inheritance link?",
-        "Set inheritance link!",
-    ]
-
-join = ["Model name?",
-        "New metamodel?",
-       ]
-
-unify = ["Which language do you want to unify?",
-         "Name of this language in the unification",
-         "Second language to unify?",
-         "Name of this language in the unification",
-         ]
-
-ramify = ["Name of the RAMified metamodel to create",
-          "Source language?"]
-
-transform = ["Which model do you want to transform?",
-             "Which schedule do you want to execute?",
-            ]
-
-transform_result_true = ["Transformation result: True"]
-transform_result_false = ["Transformation result: False"]
-
-split = ["Name of the model to split up?",
-         "Name of new metamodel?",
-         "Typename to split?",
-        ]
-
-do_instantiate_simple = [
-            "new", "PetriNets", "abc",
-            "instantiate", "Transition", "t1",
-            "instantiate", "Place", "p1", "attr_add", "p1", "tokens", 5,
-            "instantiate", "Place", "p2", "attr_add", "p2", "tokens", 0,
-            "instantiate", "P2T", "p2t", "p1", "t1", "attr_add", "p2t", "weight", 2,
-            "instantiate", "T2P", "t2p", "t1", "p2", "attr_add", "t2p", "weight", 1]
-
-instantiate_node = ["Type to instantiate?",
-                    "Name of new element?",
-                    "Instantiation successful!"]
-
-instantiate_edge = ["Type to instantiate?",
-                    "Name of new element?",
-                    "Source name?",
-                    "Destination name?",
-                    "Instantiation successful!"]
-
-all_files = [   "pn_interface.alc",
-                "primitives.alc",
-                "object_operations.alc",
-                "conformance_scd.alc",
-                "library.alc",
-                "ftg.alc",
-                "transform.alc",
-                "model_management.alc",
-                "ramify.alc",
-                "metamodels.alc",
-                "random.alc",
-                "constructors.alc",
-                "modelling.alc",
-                "compilation_manager.alc",
-            ]
-
-greeting =          ["Welcome to the Model Management Interface, running live on the Modelverse!",
-                     "Use 'help' command for a list of possible commands"]
-new =               ["Metamodel to instantiate?",
-                     "Name of model?"]
-prompt =            ["Please give your command."]
-loaded =            ["Model loaded, ready for commands!",
-                     "Use 'help' command for a list of possible commands"] + prompt
-load =              ["Model to load?"]
-instantiate =       ["Type to instantiate?"]
-instantiate_name =  ["Name of new element?"]
-instantiate_ok =    ["Instantiation successful!"]
-instantiate_source= ["Source name?"]
-instantiate_destination = ["Destination name?"]
-
-def list_menu(defined):
-    defined.append(("PetriNets", "SimpleClassDiagrams"))
-    defined.append(("SimpleClassDiagrams", "SimpleClassDiagrams"))
-    defined.append(("LTM_bottom", "LTM_bottom"))
-    defined.append(("FTG", "SimpleClassDiagrams"))
-    return ["Found models:",
-            set(["  %s : %s" % (m, mm) for m, mm in defined])]
-
-def list_model(defined):
-    return ["List of all elements:",
-            set(["  %s : %s" % (m, mm) for m, mm in defined])]
-
-def read_node(name, t, defs, attrs):
-    return ["Element to read?",
-            "Name: %s" % name, 
-            "Type: %s" % t,
-            "Defines attributes:"] + \
-            ([set(["  %s : %s" % (m, mm) for m, mm in defs])] if defs else []) + \
-            ["Attributes:"] + \
-            ([set(['  "%s" : "%s" = %s' % (m, mm, v) for m, mm, v in attrs])] if attrs else [])
-
-def read_edge(name, t, src, dst, defs, attrs):
-    return ["Element to read?",
-            "Name: %s" % name, 
-            "Type: %s" % t,
-            "Source: %s" % src,
-            "Destination: %s" % dst,
-            "Defines attributes:"] + \
-            ([set(["  %s : %s" % (m, mm) for m, mm in defs])] if defs else []) + \
-            ["Attributes:"] + \
-            ([set(['  "%s" : "%s" = %s' % (m, mm, v) for m, mm, v in attrs])] if attrs else [])
-
-delete =            ["Model to delete?", "Deleted!"]
-rename =            ["Old name?", "New name?", "Rename complete!"]
-attr_add =          ["Which model do you want to assign an attribute to?",
-                     "Which attribute do you wish to assign?",
-                     "Value of attribute?",
-                     "Added attribute!"]
-attr_del =          ["Which model do you want to remove an attribute of?",
-                     "Which attribute do you want to delete?",
-                     "Attribute deleted!",
-                    ]
-
-help_root =         ["Currently no model is loaded, so your operations are limited to:",
-                     "  new    -- Create a new model and save it for future use"
-                     "  load   -- Load a previously made model",
-                     "  rename -- Rename a previously made model",
-                     "  delete -- Delete a previously made model",
-                     "  list   -- Show a list of all stored models",
-                     "  help   -- Show a list of possible commands"]
-verify_fail_weight= ["Natural number not larger than or equal to zero"]
-verify_fail_tokens= ["Natural number not larger than or equal to zero"]
-verify_fail_structure = ["Source of model edge not typed by source of type: p2t"]
-
-init = greeting + prompt
-
-did_instantiate_simple = init + \
-                         new + \
-                         loaded +\
-                         instantiate_node + \
-                         prompt + \
-                         instantiate_node + \
-                         prompt + \
-                         attr_add + \
-                         prompt + \
-                         instantiate_node + \
-                         prompt + \
-                         attr_add + \
-                         prompt + \
-                         instantiate_edge + \
-                         prompt + \
-                         attr_add + \
-                         prompt + \
-                         instantiate_edge + \
-                         prompt + \
-                         attr_add + \
-                         prompt
-
-def list_types(t):
-    return ["List of types:"] + \
-            [set(["  %s : %s" % (m, mm) for m, mm in t])]
-
-modify =            ["Element to modify?", 
-                     "Attribute to modify?",
-                     "New value?",
-                     "Modified!",]
-
-class TestPetrinetInterface(unittest.TestCase):
-    def test_po_pn_interface_manage(self):
-        self.pn_interface_manage("PO")
-
-    def test_co_pn_interface_manage(self):
-        self.pn_interface_manage("CO")
-
-    def pn_interface_manage(self, mode):
-        self.assertTrue(run_file(all_files,
-            ["list",
-             "new", "PetriNets", "abc", "exit",
-             "list",
-             "new", "PetriNets", "def", "exit",
-             "list",
-             "delete", "def",
-             "list",
-             "rename", "abc", "a",
-             "list",
-             "delete", "a",
-             "list",
-             ],
-            init + \
-                list_menu([]) + prompt + \
-                new + loaded + prompt + list_menu([("abc", "PetriNets")]) + prompt + \
-                new + loaded + prompt + list_menu([("abc", "PetriNets"), ("def", "PetriNets")]) + prompt + \
-                delete + prompt + list_menu([("abc", "PetriNets")]) + prompt + \
-                rename + prompt + list_menu([("a", "PetriNets")]) + prompt + \
-                delete + prompt + list_menu([]) + prompt,
-            mode))
-
-    def test_po_pn_interface_new_reload(self):
-        self.pn_interface_new_reload("PO")
-
-    def test_co_pn_interface_new_reload(self):
-        self.pn_interface_new_reload("CO")
-
-    def pn_interface_new_reload(self, mode):
-        self.assertTrue(run_file(all_files,
-            ["new", "PetriNets", "abc", "exit", "load", "abc"],
-            init + new + loaded + prompt + load + loaded,
-            mode))
-
-    def test_po_pn_interface_instantiate_place(self):
-        self.pn_interface_instantiate_place("PO")
-
-    def test_co_pn_interface_instantiate_place(self):
-        self.pn_interface_instantiate_place("CO")
-
-    def pn_interface_instantiate_place(self, mode):
-        self.assertTrue(run_file(all_files,
-            ["new", "PetriNets", "abc",
-            "instantiate", "Place", "p1",
-            "attr_add", "p1", "tokens", 5,
-            "list",
-            "read", "p1",
-            "instantiate", "Transition", "t1",
-            "list",
-            "read", "t1"],
-            init + new + loaded + \
-                instantiate_node + prompt + \
-                attr_add + prompt + \
-                list_model([("p1", "Place"), ("p1.tokens", "Natural")]) + prompt + \
-                read_node("p1", "Place", [], [("tokens", "Natural", 5)]) + prompt + \
-                instantiate_node + prompt + \
-                list_model([("p1", "Place"), ("t1", "Transition"), ("p1.tokens", "Natural")]) + prompt + \
-                read_node("t1", "Transition", [], []) + prompt,
-            mode))
-
-    def test_po_pn_interface_instantiate_arcs(self):
-        self.pn_interface_instantiate_arcs("PO")
-
-    def test_co_pn_interface_instantiate_arcs(self):
-        self.pn_interface_instantiate_arcs("CO")
-
-    def pn_interface_instantiate_arcs(self, mode):
-        self.assertTrue(run_file(all_files,
-            do_instantiate_simple + [
-                    "read", "p1",
-                    "read", "p2",
-                    "read", "t1",
-                    "read", "p2t",
-                    "read", "t2p",
-                ],
-            did_instantiate_simple + \
-                read_node("p1", "Place", [], [("tokens", "Natural", 5)]) + prompt + \
-                read_node("p2", "Place", [], [("tokens", "Natural", 0)]) + prompt + \
-                read_node("t1", "Transition", [], []) + prompt + \
-                read_edge("p2t", "P2T", "p1", "t1", [], [("weight", "Natural", 2)]) + prompt + \
-                read_edge("t2p", "T2P", "t1", "p2", [], [("weight", "Natural", 1)]) + prompt,
-            mode))
-
-    def test_po_pn_interface_verify_OK(self):
-        self.pn_interface_verify_OK("PO")
-
-    def test_co_pn_interface_verify_OK(self):
-        self.pn_interface_verify_OK("CO")
-
-    def pn_interface_verify_OK(self, mode):
-        self.assertTrue(run_file(all_files,
-            do_instantiate_simple + ["verify"],
-            did_instantiate_simple + ["OK"], mode))
-
-    def test_po_pn_interface_verify_fail_tokens(self):
-        self.pn_interface_verify_fail_tokens("PO")
-
-    def test_co_pn_interface_verify_fail_tokens(self):
-        self.pn_interface_verify_fail_tokens("CO")
-
-    def pn_interface_verify_fail_tokens(self, mode):
-        self.assertTrue(run_file(all_files,
-            do_instantiate_simple + ["modify", "p1", "tokens", -5, "verify"],
-            did_instantiate_simple + modify + prompt + verify_fail_tokens + prompt, mode))
-
-    def test_po_pn_interface_verify_fail_weight(self):
-        self.pn_interface_verify_fail_weight("PO")
-
-    def test_co_pn_interface_verify_fail_weight(self):
-        self.pn_interface_verify_fail_weight("CO")
-
-    def pn_interface_verify_fail_weight(self, mode):
-        self.assertTrue(run_file(all_files,
-            do_instantiate_simple + ["modify", "p2t", "weight", -2, "verify"],
-            did_instantiate_simple + modify + prompt + verify_fail_weight + prompt, mode))
-
-    def test_po_pn_interface_verify_fail_structure(self):
-        self.pn_interface_verify_fail_structure("PO")
-
-    def test_co_pn_interface_verify_fail_structure(self):
-        self.pn_interface_verify_fail_structure("CO")
-
-    def pn_interface_verify_fail_structure(self, mode):
-        self.assertTrue(run_file(all_files,
-            ["new", "PetriNets", "abc",
-            "instantiate", "Transition", "t1",
-            "instantiate", "Place", "p1", "attr_add", "p1", "tokens", 5,
-            "instantiate", "P2T", "p2t", "t1", "p1", "attr_add", "p2t", "weight", 2, "verify"],
-            init + new + loaded + \
-                instantiate_node + prompt + \
-                instantiate_node + prompt + attr_add + prompt + \
-                instantiate_edge + prompt + attr_add + prompt + \
-                verify_fail_structure,
-            mode))
-
-    def test_po_pn_interface_types(self):
-        self.pn_interface_types("PO")
-
-    def test_co_pn_interface_types(self):
-        self.pn_interface_types("CO")
-
-    def pn_interface_types(self, mode):
-        self.assertTrue(run_file(all_files,
-            ["new", "PetriNets", "abc", "types"],
-            init + new + loaded + list_types([("Place", "Class"),
-                                              ("Transition", "Class"),
-                                              ("P2T", "Association"),
-                                              ("T2P", "Association"),
-                                              ("Natural", "Class"),
-                                              ("Place_tokens", "Association"),
-                                              ("Place_tokens.name", "String"),
-                                              ("Place_tokens.target_lower_cardinality", "Natural"),
-                                              ("Place_tokens.target_upper_cardinality", "Natural"),
-                                              ("P2T_weight", "Association"),
-                                              ("P2T_weight.name", "String"),
-                                              ("P2T_weight.target_lower_cardinality", "Natural"),
-                                              ("P2T_weight.target_upper_cardinality", "Natural"),
-                                              ("T2P_weight", "Association"),
-                                              ("T2P_weight.name", "String"),
-                                              ("T2P_weight.target_lower_cardinality", "Natural"),
-                                              ("T2P_weight.target_upper_cardinality", "Natural"),
-                    ]) + prompt,
-            mode))
-
-    def test_po_pn_interface_modify_place(self):
-        self.pn_interface_modify_place("PO")
-
-    def test_co_pn_interface_modify_place(self):
-        self.pn_interface_modify_place("CO")
-
-    def pn_interface_modify_place(self, mode):
-        self.assertTrue(run_file(all_files,
-            ["new", "PetriNets", "abc",
-                "instantiate", "Place", "p1", "attr_add", "p1", "tokens", 5,
-                "read", "p1",
-                "modify", "p1", "tokens", 1, "read", "p1"],
-            init + new + loaded + \
-                instantiate_node + prompt + attr_add + prompt + \
-                read_node("p1", "Place", [], [("tokens", "Natural", 5)]) + prompt + \
-                modify + prompt + \
-                read_node("p1", "Place", [], [("tokens", "Natural", 1)]) + prompt,
-            mode))
-
-    def test_po_pn_interface_verify_fail_attr_lower_cardinality(self):
-        self.pn_interface_verify_fail_attr_lower_cardinality("PO")
-
-    def test_co_pn_interface_verify_fail_attr_lower_cardinality(self):
-        self.pn_interface_verify_fail_attr_lower_cardinality("CO")
-
-    def pn_interface_verify_fail_attr_lower_cardinality(self, mode):
-        self.assertTrue(run_file(all_files,
-            do_instantiate_simple + ["instantiate", "Place", "p999", "verify"],
-            did_instantiate_simple + instantiate_node + prompt + ["Lower cardinality violation for outgoing edge of type Place_tokens at p999"] + prompt,
-            mode))
-
-    def test_po_pn_interface_verify_fail_attr_upper_cardinality(self):
-        self.pn_interface_verify_fail_attr_upper_cardinality("PO")
-
-    def test_co_pn_interface_verify_fail_attr_upper_cardinality(self):
-        self.pn_interface_verify_fail_attr_upper_cardinality("CO")
-
-    def pn_interface_verify_fail_attr_upper_cardinality(self, mode):
-        self.assertTrue(run_file(all_files,
-            do_instantiate_simple + ["attr_add", "p1", "tokens", 5, "verify"],
-            did_instantiate_simple + attr_add + prompt + ["Upper cardinality violation for outgoing edge of type Place_tokens at p1"] + prompt,
-            mode))
-
-    def test_po_pn_interface_verify_natural(self):
-        self.pn_interface_verify_natural("PO")
-
-    def test_co_pn_interface_verify_natural(self):
-        self.pn_interface_verify_natural("CO")
-
-    def pn_interface_verify_natural(self, mode):
-        self.assertTrue(run_file(all_files,
-            ["new", "PetriNets", "abc",
-            "instantiate", "Place", "p1",
-            "attr_add", "p1", "tokens", -5,
-            "attr_del", "p1", "tokens",
-            "attr_add", "p1", "tokens", 4,
-            "verify"],
-            init + new + loaded + \
-            instantiate_node + prompt + \
-            attr_add + prompt + \
-            attr_del + prompt + \
-            attr_add + prompt + \
-            ["OK"] + prompt,
-            mode))
-
-    def test_po_pn_interface_verify_PN_OK(self):
-        self.pn_interface_verify_PN_OK("PO")
-
-    def test_co_pn_interface_verify_PN_OK(self):
-        self.pn_interface_verify_PN_OK("CO")
-
-    def pn_interface_verify_PN_OK(self, mode):
-        self.assertTrue(run_file(all_files,
-            ["load", "PetriNets", "verify"],
-            init + load + loaded + ["OK"], mode))
-
-    def test_po_rpgame(self):
-        self.rpgame("PO")
-
-    def test_co_rpgame(self):
-        self.rpgame("CO")
-
-    def rpgame(self, mode):
-
-        constraint_code = \
-            """
-include "primitives.alh"
-include "object_operations.alh"
-
-Element function constraint(model : Element, name : String):
-	Element associations
-	Element back_associations
-	Element association
-	String destination
-	associations = allOutgoingAssociationInstances(model, name, "tile_left")
-	while (0 < list_len(associations)):
-		association = set_pop(associations)
-		destination = readAssociationDestination(model, association)
-		back_associations = allOutgoingAssociationInstances(model, destination, "tile_right")
-		if (list_len(back_associations) < 1):
-			return "Left link does not have a right link back"!
-		else:
-			association = set_pop(back_associations)
-			destination = readAssociationDestination(model, association)
-			if (destination != name):
-				return "Right link does not have a left link back to the same tile"!
-	associations = allOutgoingAssociationInstances(model, name, "tile_right")
-	while (0 < list_len(associations)):
-		association = set_pop(associations)
-		destination = readAssociationDestination(model, association)
-		back_associations = allOutgoingAssociationInstances(model, destination, "tile_left")
-		if (list_len(back_associations) < 1):
-			return "Right link does not have a left link back"!
-		else:
-			association = set_pop(back_associations)
-			destination = readAssociationDestination(model, association)
-			if (destination != name):
-				return "Right link does not have a left link back to the same tile"!
-	associations = allOutgoingAssociationInstances(model, name, "tile_top")
-	while (0 < list_len(associations)):
-		association = set_pop(associations)
-		destination = readAssociationDestination(model, association)
-		back_associations = allOutgoingAssociationInstances(model, destination, "tile_bottom")
-		if (list_len(back_associations) < 1):
-			return "Top link does not have a bottom link back"!
-		else:
-			association = set_pop(back_associations)
-			destination = readAssociationDestination(model, association)
-			if (destination != name):
-				return "Top link does not have a bottom link back to the same tile"!
-	associations = allOutgoingAssociationInstances(model, name, "tile_bottom")
-	while (0 < list_len(associations)):
-		association = set_pop(associations)
-		destination = readAssociationDestination(model, association)
-		back_associations = allOutgoingAssociationInstances(model, destination, "tile_top")
-		if (list_len(back_associations) < 1):
-			return "Bottom link does not have a top link back"!
-		else:
-			association = set_pop(back_associations)
-			destination = readAssociationDestination(model, association)
-			if (destination != name):
-				return "Bottom link does not have a top link back to the same tile"!
-	return "OK"!
-            """
-
-        constructors = get_constructor(constraint_code)
-
-        self.assertTrue(run_file(all_files,
-            ["new", "SimpleClassDiagrams", "RPGame",
-                "set_inheritance", "Inheritance",
-                "instantiate", "Class", "Scene",
-                "instantiate", "Class", "Tile",
-                "instantiate", "Class", "Item",
-                "instantiate", "Class", "Goal",
-                "instantiate", "Class", "Character",
-                "instantiate", "Class", "Hero",
-                "instantiate", "Association", "scene_has_tiles", "Scene", "Tile",
-                "instantiate", "Association", "tile_left", "Tile", "Tile",
-                "instantiate", "Association", "tile_right", "Tile", "Tile",
-                "instantiate", "Association", "tile_top", "Tile", "Tile",
-                "instantiate", "Association", "tile_bottom", "Tile", "Tile",
-                "instantiate", "Association", "character_on", "Character", "Tile",
-                "instantiate", "Association", "item_on", "Item", "Tile",
-                "instantiate", "Inheritance", "hero_is_character", "Hero", "Character",
-                "instantiate", "Inheritance", "goal_is_item", "Goal", "Item",
-                "attr_add", "Scene", "lower_cardinality", 1,
-                "attr_add", "Scene", "upper_cardinality", 1,
-                "attr_add", "Goal", "lower_cardinality", 1,
-                "attr_add", "scene_has_tiles", "source_lower_cardinality", 1,
-                "attr_add", "scene_has_tiles", "source_upper_cardinality", 1,
-                "attr_add", "scene_has_tiles", "target_lower_cardinality", 1,
-                "attr_add", "item_on", "target_lower_cardinality", 1,
-                "attr_add", "item_on", "target_upper_cardinality", 1,
-                "attr_add", "item_on", "source_upper_cardinality", 1,
-                "attr_add", "character_on", "target_lower_cardinality", 1,
-                "attr_add", "character_on", "target_upper_cardinality", 1,
-                "attr_add", "character_on", "source_upper_cardinality", 1,
-                "attr_add", "tile_left", "source_upper_cardinality", 1,
-                "attr_add", "tile_left", "target_upper_cardinality", 1,
-                "attr_add", "tile_right", "source_upper_cardinality", 1,
-                "attr_add", "tile_right", "target_upper_cardinality", 1,
-                "attr_add", "tile_top", "source_upper_cardinality", 1,
-                "attr_add", "tile_top", "target_upper_cardinality", 1,
-                "attr_add", "tile_bottom", "source_upper_cardinality", 1,
-                "attr_add", "tile_bottom", "target_upper_cardinality", 1,
-                "attr_add_code", "Tile", "constraint",
-            ] + constructors + ["verify"] + ["exit"] + [
-                "new", "RPGame", "my_game",
-                "instantiate", "Scene", "scene",
-                "instantiate", "Hero", "Link",
-                "instantiate", "Goal", "goal",
-                "instantiate", "Tile", "tile_00",
-                "instantiate", "Tile", "tile_01",
-                "instantiate", "Tile", "tile_10",
-                "instantiate", "Tile", "tile_11",
-                "instantiate", "scene_has_tiles", "", "scene", "tile_00",
-                "instantiate", "scene_has_tiles", "", "scene", "tile_01",
-                "instantiate", "scene_has_tiles", "", "scene", "tile_10",
-                "instantiate", "scene_has_tiles", "", "scene", "tile_11",
-                "instantiate", "character_on", "",  "Link", "tile_00",
-                "instantiate", "item_on", "", "goal", "tile_11",
-                "instantiate", "tile_left", "", "tile_01", "tile_00",
-                "instantiate", "tile_left", "", "tile_11", "tile_10",
-                "instantiate", "tile_right", "", "tile_00", "tile_01",
-                "instantiate", "tile_right", "", "tile_10", "tile_11",
-                "instantiate", "tile_top", "", "tile_10", "tile_00",
-                "instantiate", "tile_top", "", "tile_11", "tile_01",
-                "instantiate", "tile_bottom", "", "tile_00", "tile_10",
-                "instantiate", "tile_bottom", "", "tile_01", "tile_11",
-                "verify",
-            ],
-            init + new + loaded + \
-                set_inheritance + prompt + \
-                (instantiate_node + prompt) * 6 + \
-                (instantiate_edge + prompt) * 9 + \
-                (attr_add + prompt) * 20 + \
-                ["Which model do you want to assign a coded attribute to?",
-                 "Which attribute do you wish to assign?",
-                 "Constructors for code?",
-                 "Added code!"] + \
-                prompt + \
-                ["OK"] + \
-                prompt + prompt + new + loaded + \
-                (instantiate_node + prompt) * 7 + \
-                (instantiate_edge + prompt) * 14 + \
-                ["OK"],
-            mode))
-
-    def test_po_pn_interface_model_transform_pn(self):
-        PN_runtime = open("integration/code/pn_runtime.mvc", "r").read()
-        PN_model = open("integration/code/pn_runtime_model.mvc", "r").read()
-        schedule_model = open("integration/code/pn_simulate.mvc", "r").read()
-
-        self.assertTrue(run_file(all_files,
-            get_model_constructor(PN_runtime) + [
-                ] + get_model_constructor(PN_model) + [
-                "load", "pn", 
-                    "read", "t1",
-                    "read", "p1",
-                    "read", "p2",
-                    "read", "p3",
-                    "exit",
-                "ramify", "RAM_PetriNets_Runtime", "PetriNets_Runtime",
-                ] + get_model_constructor(schedule_model) + [
-                "transform", "pn", "pn_simulate",
-                "transform", "pn", "pn_simulate",
-                "load", "pn",
-                    "verify",
-                    "read", "t1",
-                    "read", "p1",
-                    "read", "p2",
-                    "read", "p3",
-                    "exit",
-            ],
-          greeting + prompt * 3 +
-            load + loaded +
-            read_node("t1", "Transition", [], [("executing", "Boolean", False)]) + prompt +
-            read_node("p1", "Place", [], [("tokens", "Natural", 1), ("name", "String", '"p1"')]) + prompt +
-            read_node("p2", "Place", [], [("tokens", "Natural", 2), ("name", "String", '"p2"')]) + prompt +
-            read_node("p3", "Place", [], [("tokens", "Natural", 3), ("name", "String", '"p3"')]) + prompt +
-            prompt +
-            ramify + prompt + 
-            prompt +
-            transform + transform_result_true + prompt +
-            transform + transform_result_false + prompt +
-            load + loaded +
-            ["OK"] + prompt +
-            read_node("t1", "Transition", [], [("executing", "Boolean", False)]) + prompt +
-            read_node("p1", "Place", [], [("tokens", "Natural", 0), ("name", "String", '"p1"')]) + prompt +
-            read_node("p2", "Place", [], [("tokens", "Natural", 1), ("name", "String", '"p2"')]) + prompt +
-            read_node("p3", "Place", [], [("tokens", "Natural", 5), ("name", "String", '"p3"')]) + prompt, 
-          "PO"))
-
-    def test_po_pn_interface_transform_pn_to_runtime(self):
-        PN_runtime = open("integration/code/pn_runtime.mvc", "r").read()
-        PN_design = open("integration/code/pn_design.mvc", "r").read()
-        PN_model = open("integration/code/pn_design_model.mvc", "r").read()
-        schedule_model_design_to_runtime = open("integration/code/pn_design_to_runtime.mvc", "r").read()
-        schedule_model_print = open("integration/code/pn_print.mvc", "r").read()
-        schedule_model_simulate = open("integration/code/pn_simulate.mvc", "r").read()
-
-        self.assertTrue(run_file(all_files,
-            get_model_constructor(PN_runtime) + \
-                get_model_constructor(PN_design) + \
-                get_model_constructor(PN_model) + [
-                "unify", "PetriNets_Design_to_Runtime", "PetriNets_Design", "SOURCE_", "PetriNets_Runtime", "TARGET_",
-                "join", "pn", "PetriNets_Design_to_Runtime", "SOURCE_",
-                "load", "PetriNets_Design_to_Runtime",
-                    "instantiate", "Association", "PlaceLink", "SOURCE_Place", "TARGET_Place",
-                    "instantiate", "Association", "TransitionLink", "SOURCE_Transition", "TARGET_Transition",
-                    "exit",
-                "ramify", "RAM_PetriNets_Design_Runtime", "PetriNets_Design_to_Runtime",
-                "ramify", "RAM_PetriNets_Runtime", "PetriNets_Runtime",
-                ] + get_model_constructor(schedule_model_design_to_runtime) + [
-                ] + get_model_constructor(schedule_model_print) + [
-                ] + get_model_constructor(schedule_model_simulate) + [
-                "transform", "pn", "pn_annotate",
-                "split", "pn", "PetriNets_Runtime", "TARGET_",
-                "transform", "pn", "pn_print",
-                "transform", "pn", "pn_simulate",
-                "transform", "pn", "pn_print",
-            ],
-          greeting + prompt * 4 +
-            unify + prompt +
-            join + prompt +
-            load + loaded +
-            instantiate_edge + prompt +
-            instantiate_edge + prompt +
-            prompt +
-            ramify + prompt +
-            ramify + prompt + 
-            prompt +
-            prompt +
-            prompt +
-            transform + transform_result_true + prompt +
-            split + prompt +
-            transform + [set(['"p1" --> 1', '"p2" --> 2', '"p3" --> 3'])] + transform_result_true + prompt +
-            transform + transform_result_true + prompt +
-            transform + [set(['"p1" --> 0', '"p2" --> 1', '"p3" --> 5'])] + transform_result_true + prompt
-            , 
-          "PO"))

+ 7 - 11
scripts/prompt.py

@@ -28,18 +28,14 @@ def remote_print(string):
     print(string)
 
 local_print("Welcome to the local shell!")
-local_print("Please specify Modelverse location (default: 127.0.0.1:8001)")
-
-location = raw_input()
-if location == "":
-    address = "http://127.0.0.1:8001/"
-
-local_print("Username (default: test)")
-username = raw_input()
-if username == "":
+try:
+    address = sys.argv[1]
+except IndexError:
+    address = "http://127.0.0.1:8001"
+try:
+    username = sys.argv[2]
+except IndexError:
     username = "test"
-else:
-    username = username.strip()
 
 # If user doesn't exist yet, we create it
 urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "set_input", "value": '"%s"' % username, "username": "user_manager"}))).read()