|
@@ -60,11 +60,11 @@ class ModelverseKernel(object):
|
|
elif isinstance(phase_v, string_types):
|
|
elif isinstance(phase_v, string_types):
|
|
if phase_v == "init" and inst in self.compiled:
|
|
if phase_v == "init" and inst in self.compiled:
|
|
#print("%-30s(%s)" % ("COMPILED " + str(self.primitives[inst]), phase_v))
|
|
#print("%-30s(%s)" % ("COMPILED " + str(self.primitives[inst]), phase_v))
|
|
- gen = self.execute_primitive(user_root, inst)
|
|
|
|
|
|
+ gen = self.execute_primitive(user_root, inst, username)
|
|
elif inst_v is None:
|
|
elif inst_v is None:
|
|
raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info, inst_v, phase_v))
|
|
raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info, inst_v, phase_v))
|
|
else:
|
|
else:
|
|
- print("%-30s(%s)" % (inst_v["value"], phase_v))
|
|
|
|
|
|
+ #print("%-30s(%s)" % (inst_v["value"], phase_v))
|
|
gen = getattr(self, "%s_%s" % (inst_v["value"], phase_v))(user_root)
|
|
gen = getattr(self, "%s_%s" % (inst_v["value"], phase_v))(user_root)
|
|
elif inst_v is None:
|
|
elif inst_v is None:
|
|
raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info, inst_v, phase_v))
|
|
raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info, inst_v, phase_v))
|
|
@@ -96,7 +96,7 @@ class ModelverseKernel(object):
|
|
self.primitives[bodies[i]] = getattr(primitive_functions, function_names[i])
|
|
self.primitives[bodies[i]] = getattr(primitive_functions, function_names[i])
|
|
self.compiled.update(self.primitives)
|
|
self.compiled.update(self.primitives)
|
|
|
|
|
|
- def execute_primitive(self, user_root, inst):
|
|
|
|
|
|
+ def execute_primitive(self, user_root, inst, username):
|
|
# execute_primitive
|
|
# execute_primitive
|
|
user_frame = yield [("RD", [user_root, "frame"])]
|
|
user_frame = yield [("RD", [user_root, "frame"])]
|
|
symbols = yield [("RD", [user_frame, "symbols"])]
|
|
symbols = yield [("RD", [user_frame, "symbols"])]
|
|
@@ -121,6 +121,8 @@ class ModelverseKernel(object):
|
|
parameters = dict(zip(dict_keys, dict_values))
|
|
parameters = dict(zip(dict_keys, dict_values))
|
|
|
|
|
|
parameters["root"] = self.root
|
|
parameters["root"] = self.root
|
|
|
|
+ parameters["user_root"] = user_root
|
|
|
|
+ parameters["username"] = username
|
|
|
|
|
|
# prim is a generator itself!
|
|
# prim is a generator itself!
|
|
try:
|
|
try:
|