12345678910111213141516171819202122232425262728 |
- import sys
- sys.path.append("wrappers")
- from modelverse import *
- init()
- login("admin", "admin")
- # Assume that we don't change the SCCD MM
- try:
- model_add("SCCD", "SimpleClassDiagrams", open("models/SCCD.mvc", 'r').read())
- except ModelExists:
- pass
- # Update the model of the traffic light
- if "my_SCCD" in [i[0] for i in model_list()]:
- model_delete("my_SCCD")
- model_add("my_SCCD", "SCCD", open("models/dynamic_trafficlight.mvc", 'r').read())
- # Add SCCD execution semantics
- transformation_add_AL({"SCCD": "SCCD"}, {}, "SCCD_execute", open("models/SCCD_execute.alc", 'r').read())
- # Execute it, while interacting through the console
- def callback(inp):
- print(inp)
- return raw_input()
- transformation_execute_AL("SCCD_execute", {"SCCD": "my_SCCD"}, {}, callback=callback)
|