Yentl Van Tendeloo 7 年 前
コミット
3582cc4c35

+ 7 - 8
kernel/modelverse_kernel/request_handler.py

@@ -17,31 +17,30 @@ class RequestHandler(object):
     def handle_request(self, reply):
     def handle_request(self, reply):
         while self.generator_stack:
         while self.generator_stack:
             try:
             try:
-                gen = self.generator_stack[-1]
-                requests = gen.send(reply)
+                requests = self.generator_stack[-1].send(reply)
 
 
                 # Generated new request, so process
                 # Generated new request, so process
                 if requests and requests[0][0] in self.handlers:
                 if requests and requests[0][0] in self.handlers:
                     # Try to add a new generator to branch into
                     # Try to add a new generator to branch into
-                    reply = None
                     self.generator_stack.append(None)
                     self.generator_stack.append(None)
                     # This next command potentially raises a finished message already, meaning that we should stop already
                     # This next command potentially raises a finished message already, meaning that we should stop already
                     # We avoid an extra try/except block by putting the None on the stack already
                     # We avoid an extra try/except block by putting the None on the stack already
                     self.generator_stack[-1] = self.handlers[requests[0][0]](requests[0][1])
                     self.generator_stack[-1] = self.handlers[requests[0][0]](requests[0][1])
+                    reply = None
                 else:
                 else:
                     # MvS request, so forward that instead
                     # MvS request, so forward that instead
                     return requests
                     return requests
 
 
-            except StopIteration:
-                # Exception, so finished execution of this generator, passing on None to the caller
-                del self.generator_stack[-1]
-                reply = [None]
-                
             except primitive_functions.PrimitiveFinished as ex:
             except primitive_functions.PrimitiveFinished as ex:
                 # Exception, so finished execution of this generator, passing on ex.result to the caller
                 # Exception, so finished execution of this generator, passing on ex.result to the caller
                 del self.generator_stack[-1]
                 del self.generator_stack[-1]
                 reply = [ex.result]
                 reply = [ex.result]
 
 
+            except StopIteration:
+                # Exception, so finished execution of this generator, passing on None to the caller
+                del self.generator_stack[-1]
+                reply = [None]
+                
             except primitive_functions.SleepKernel:
             except primitive_functions.SleepKernel:
                 # Processing sleep, so pop its generator and reraise
                 # Processing sleep, so pop its generator and reraise
                 del self.generator_stack[-1]
                 del self.generator_stack[-1]

+ 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 Apr 27 14:13:41 2018
+Date:   Fri Apr 27 15:11:46 2018
 
 
 Model author: Yentl Van Tendeloo
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server
 Model name:   MvK Server