Przeglądaj źródła

Fixed parameter passing

Yentl Van Tendeloo 7 lat temu
rodzic
commit
f16f2c6d9e

+ 2 - 2
kernel/modelverse_kernel/main.py

@@ -389,7 +389,7 @@ class ModelverseKernel(object):
         printed = prev + printed
         printed = prev + printed
         print("Total printed function: ")
         print("Total printed function: ")
         if params:
         if params:
-            func = "def " + suggested_name + "(" + ", ".join(["var_%s" % param for param in params]) + ", **kwargs):\n" + printed
+            func = "def " + suggested_name + "(" + ", ".join([chr(ord('a') + i) for i in range(len(params))]) + ", **kwargs):\n" + "".join(["  var_%s = %s\n" % (param, chr(ord('a') + i)) for i, param in enumerate(params)]) + printed
         else:
         else:
             func = "def " + suggested_name + "(**kwargs):\n" + printed
             func = "def " + suggested_name + "(**kwargs):\n" + printed
         print(func)
         print(func)
@@ -445,6 +445,7 @@ class ModelverseKernel(object):
         # Have the JIT compile the function.
         # Have the JIT compile the function.
         compiled_func, = yield [("CALL_ARGS", [self.jit_compile, (task_root, inst)])]
         compiled_func, = yield [("CALL_ARGS", [self.jit_compile, (task_root, inst)])]
         # Run the compiled function.
         # Run the compiled function.
+        print("Calling function %s with parameters: " % str(compiled_func) + str(parameters))
         results = yield [("CALL_KWARGS", [compiled_func, parameters])]
         results = yield [("CALL_KWARGS", [compiled_func, parameters])]
         if results is None:
         if results is None:
             raise Exception("%s: primitive finished without returning a value!" % (self.debug_info[taskname]))
             raise Exception("%s: primitive finished without returning a value!" % (self.debug_info[taskname]))
@@ -461,7 +462,6 @@ class ModelverseKernel(object):
             #if self.debug_info[self.taskname]:
             #if self.debug_info[self.taskname]:
             #    self.debug_info[self.taskname].pop()
             #    self.debug_info[self.taskname].pop()
 
 
-            print("Exception return: " + str(exception_return))
             if exception_return is not None:
             if exception_return is not None:
                 # The caller has requested that we throw an exception instead of injecting
                 # The caller has requested that we throw an exception instead of injecting
                 # the return value into the caller's frame. Read the comment at
                 # the return value into the caller's frame. Read the comment at

+ 1 - 1
wrappers/modelverse_SCCD.py

@@ -1,7 +1,7 @@
 """
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
 
-Date:   Tue Apr 10 11:41:06 2018
+Date:   Tue Apr 10 11:53:13 2018
 
 
 Model author: Yentl Van Tendeloo
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server
 Model name:   MvK Server