Browse Source

Minor tweaks

Yentl Van Tendeloo 7 years ago
parent
commit
3582cc4c35
2 changed files with 8 additions and 9 deletions
  1. 7 8
      kernel/modelverse_kernel/request_handler.py
  2. 1 1
      wrappers/modelverse_SCCD.py

+ 7 - 8
kernel/modelverse_kernel/request_handler.py

@@ -17,31 +17,30 @@ class RequestHandler(object):
     def handle_request(self, reply):
         while self.generator_stack:
             try:
-                gen = self.generator_stack[-1]
-                requests = gen.send(reply)
+                requests = self.generator_stack[-1].send(reply)
 
                 # Generated new request, so process
                 if requests and requests[0][0] in self.handlers:
                     # Try to add a new generator to branch into
-                    reply = None
                     self.generator_stack.append(None)
                     # 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
                     self.generator_stack[-1] = self.handlers[requests[0][0]](requests[0][1])
+                    reply = None
                 else:
                     # MvS request, so forward that instead
                     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:
                 # Exception, so finished execution of this generator, passing on ex.result to the caller
                 del self.generator_stack[-1]
                 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:
                 # Processing sleep, so pop its generator and reraise
                 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)
 
-Date:   Fri Apr 27 14:13:41 2018
+Date:   Fri Apr 27 15:11:46 2018
 
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server