|
@@ -14,6 +14,7 @@ class ModelverseKernel(object):
|
|
|
self.returnvalue = None
|
|
|
self.success = True
|
|
|
self.generators = {}
|
|
|
+ self.debug = "(init):0"
|
|
|
|
|
|
def execute_yields(self, username, operation, params, reply):
|
|
|
try:
|
|
@@ -39,6 +40,7 @@ class ModelverseKernel(object):
|
|
|
inst, phase = yield [("RD", [user_frame, "IP"]),
|
|
|
("RD", [user_frame, "phase"]),
|
|
|
]
|
|
|
+ self.debug_info=yield [("RD", [inst, "__debug"])]
|
|
|
phase_v, inst_v=yield [("RV", [phase]),
|
|
|
("RV", [inst]),
|
|
|
]
|
|
@@ -53,12 +55,12 @@ class ModelverseKernel(object):
|
|
|
#print("%-30s(%s)" % (inst_v["value"], phase_v))
|
|
|
gen = getattr(self, "%s_%s" % (inst_v["value"], phase_v))(user_root)
|
|
|
elif inst_v is None:
|
|
|
- raise Exception("Could not understand instruction/phase combination: %s -- %s" % (inst_v, phase_v))
|
|
|
+ raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info, inst_v, phase_v))
|
|
|
elif inst_v["value"] == "call":
|
|
|
#print("%-30s(%s)" % ("call", "param"))
|
|
|
gen = self.call_param(user_root)
|
|
|
else:
|
|
|
- raise Exception("Could not understand instruction/phase combination: %s -- %s" % (inst_v, phase_v))
|
|
|
+ raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info, inst_v, phase_v))
|
|
|
|
|
|
try:
|
|
|
inp = None
|
|
@@ -117,7 +119,7 @@ class ModelverseKernel(object):
|
|
|
inp = yield prim.send(inp)
|
|
|
except StopIteration:
|
|
|
# Execution has ended without return value, so we have no idea what to do
|
|
|
- raise Exception("Primitive finished without returning a value!")
|
|
|
+ raise Exception("%s: primitive finished without returning a value!" % (self.debug_info))
|
|
|
except primitive_functions.PrimitiveFinished as e:
|
|
|
# Execution has ended with a returnvalue, so read it out from the exception being thrown
|
|
|
result = e.result
|
|
@@ -413,7 +415,7 @@ class ModelverseKernel(object):
|
|
|
("CNV", ["finish"]),
|
|
|
]
|
|
|
if variable is None:
|
|
|
- raise Exception("Not found as global: %s" % var_name)
|
|
|
+ raise Exception("%s: not found as global: %s" % (self.debug_info, var_name))
|
|
|
else:
|
|
|
phase_link, returnvalue_link, new_phase = \
|
|
|
yield [("RDE", [user_frame, "phase"]),
|
|
@@ -709,9 +711,9 @@ class ModelverseKernel(object):
|
|
|
if len(matches) == 1:
|
|
|
return matches[0]
|
|
|
elif len(matches) > 1:
|
|
|
- raise Exception("Multiple overlapping elements")
|
|
|
+ raise Exception("%s: error: multiple overlapping elements" % self.debug_info)
|
|
|
else:
|
|
|
- raise Exception("Could not find any overlap")
|
|
|
+ raise Exception("%s: error: could not find any overlap" % self.debug_info)
|
|
|
|
|
|
def call_param(self, user_root):
|
|
|
#TODO this code is likely very buggy!
|