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("formalisms/SCCD", "formalisms/SimpleClassDiagrams", open("models/SCCD.mvc", 'r').read()) except ModelExists: pass try: model_add("formalisms/SCCD_Trace", "formalisms/SimpleClassDiagrams", open("models/SCCD_Trace.mvc", 'r').read()) except ModelExists: pass # Update the model of the traffic light if "my_SCCD" in [i[0] for i in model_list("models")]: model_delete("models/my_SCCD") #model_add("models/my_SCCD", "formalisms/SCCD", open("models/dynamic_trafficlight.mvc", 'r').read()) model_add("models/my_SCCD", "formalisms/SCCD", open("integration/code/SCCD_all.mvc", 'r').read()) # Add SCCD execution semantics transformation_add_AL({"SCCD": "formalisms/SCCD"}, {"trace": "formalisms/SCCD_Trace"}, "models/SCCD_execute", open("models/SCCD_execute.alc", 'r').read()) # Execute it, while interacting through the console def callback(inp): print(inp) inp = raw_input() if inp == "": return None else: return inp transformation_execute_AL("models/SCCD_execute", {"SCCD": "models/my_SCCD"}, {"trace": "models/my_trace"}, callback=callback)