فهرست منبع

Generate signature of function as well

Yentl Van Tendeloo 7 سال پیش
والد
کامیت
f898810769
2فایلهای تغییر یافته به همراه4 افزوده شده و 3 حذف شده
  1. 3 2
      kernel/modelverse_kernel/main.py
  2. 1 1
      wrappers/modelverse_SCCD.py

+ 3 - 2
kernel/modelverse_kernel/main.py

@@ -188,7 +188,6 @@ class ModelverseKernel(object):
             cond, true, false = yield [("RD", [inst, "cond"]),
                                        ("RD", [inst, "then"]),
                                        ("RD", [inst, "else"])]
-            #print("Cond: %s; True: %s; False: %s" % (cond, true, false))
             cond, = yield [("CALL_ARGS", [self.print_instruction, (cond, 0)])]
             true, = yield [("CALL_ARGS", [self.print_instruction, (true, indent+1)])]
             if false:
@@ -264,7 +263,7 @@ class ModelverseKernel(object):
         initial_instruction = inst
         suggested_name = self.jit.get_global_name(inst)
 
-        (_, _, is_mutable), = yield [("CALL_ARGS", [self.jit.jit_signature, (inst,)])]
+        (params, _, is_mutable), = yield [("CALL_ARGS", [self.jit.jit_signature, (inst,)])]
         if suggested_name is None or is_mutable:
             print("Ignoring mutable or unreadable: %s" % suggested_name)
             raise jit.JitCompilationFailedException("FAIL")
@@ -272,6 +271,8 @@ class ModelverseKernel(object):
         print("Reading function: %s" % suggested_name)
         printed, = yield [("CALL_ARGS", [self.print_instruction, (inst, 1)])]
         print("Total printed function: ")
+        signature = "def " + suggested_name + "(" + ",".join(["var_%s" % param for param in params]) + "):\n"
+        print(signature)
         print(printed)
 
     def jit_compile(self, task_root, inst):

+ 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)
 
-Date:   Fri Mar 23 09:24:17 2018
+Date:   Sat Mar 24 11:04:45 2018
 
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server