浏览代码

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