瀏覽代碼

For now we stick to the normal procedure, though mark that everything should be cleaned up

Yentl Van Tendeloo 7 年之前
父節點
當前提交
4a83fd2377
共有 2 個文件被更改,包括 12 次插入1 次删除
  1. 11 0
      kernel/modelverse_kernel/main.py
  2. 1 1
      wrappers/modelverse_SCCD.py

+ 11 - 0
kernel/modelverse_kernel/main.py

@@ -205,6 +205,7 @@ class ModelverseKernel(object):
                 false = ""
                 false = ""
 
 
             instruction = "  " * indent + "if (" + cond + "):\n" + true + "\n" + false
             instruction = "  " * indent + "if (" + cond + "):\n" + true + "\n" + false
+            #TODO fix for inline calls
         elif inst_type["value"] == "constant":
         elif inst_type["value"] == "constant":
             node, = yield [("RD", [inst, "node"])]
             node, = yield [("RD", [inst, "node"])]
             node, = yield [("RV", [node])]
             node, = yield [("RV", [node])]
@@ -219,6 +220,7 @@ class ModelverseKernel(object):
                 instruction = "  " * indent + "return %s\n" % value
                 instruction = "  " * indent + "return %s\n" % value
             else:
             else:
                 instruction = "  " * indent + "return\n"
                 instruction = "  " * indent + "return\n"
+            #TODO fix for inline calls
         elif inst_type["value"] == "declare":
         elif inst_type["value"] == "declare":
             instruction = ""
             instruction = ""
         elif inst_type["value"] == "resolve":
         elif inst_type["value"] == "resolve":
@@ -234,6 +236,7 @@ class ModelverseKernel(object):
             var, val = yield [("CALL_ARGS", [self.print_instruction, (var, 0)]),
             var, val = yield [("CALL_ARGS", [self.print_instruction, (var, 0)]),
                               ("CALL_ARGS", [self.print_instruction, (val, 0)])]
                               ("CALL_ARGS", [self.print_instruction, (val, 0)])]
             instruction = "  " * indent + var + " = " + val + "\n"
             instruction = "  " * indent + var + " = " + val + "\n"
+            #TODO fix for inline calls
         elif inst_type["value"] == "call":
         elif inst_type["value"] == "call":
             func_name, = yield [("RD", [inst, "func"])]
             func_name, = yield [("RD", [inst, "func"])]
             func_name, = yield [("CALL_ARGS", [self.print_instruction, (func_name, 0)])]
             func_name, = yield [("CALL_ARGS", [self.print_instruction, (func_name, 0)])]
@@ -250,6 +253,13 @@ class ModelverseKernel(object):
                 instruction = "  " * indent + intrinsics[func_name](*param_list)
                 instruction = "  " * indent + intrinsics[func_name](*param_list)
             else:
             else:
                 instruction = "  " * indent + func_name + "(" + ", ".join(param_list) + ")"
                 instruction = "  " * indent + func_name + "(" + ", ".join(param_list) + ")"
+                """
+                if indent == 0:
+                    #TODO fix for inline calls
+                    instruction = 'result, = yield [("CALL_ARGS", (%s, (' % func_name + ",".join(param_list) + ',)))]'
+                else:
+                    instruction = "  " * indent + 'yield [("CALL_ARGS", (%s, (' % func_name + ",".join(param_list) + ',)))]'
+                """
             if indent:
             if indent:
                 instruction += "\n"
                 instruction += "\n"
         elif inst_type["value"] == "access":
         elif inst_type["value"] == "access":
@@ -261,6 +271,7 @@ class ModelverseKernel(object):
             cond, body = yield [("CALL_ARGS", [self.print_instruction, (cond, 0)]),
             cond, body = yield [("CALL_ARGS", [self.print_instruction, (cond, 0)]),
                                 ("CALL_ARGS", [self.print_instruction, (body, indent+1)])]
                                 ("CALL_ARGS", [self.print_instruction, (body, indent+1)])]
             instruction = "  " * indent + "while (%s):\n" % cond + body
             instruction = "  " * indent + "while (%s):\n" % cond + body
+            #TODO fix for inline calls
 
 
         next_inst, = yield [("RD", [inst, "next"])]
         next_inst, = yield [("RD", [inst, "next"])]
         if next_inst:
         if next_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:   Sat Mar 24 11:14:56 2018
+Date:   Sat Mar 24 11:30:43 2018
 
 
 Model author: Yentl Van Tendeloo
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server
 Model name:   MvK Server