Преглед на файлове

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