Commit 73996439 authored by Thanassis Tsiodras's avatar Thanassis Tsiodras

Update the skeleton for the MSC-generated Python scripts.

parent 35382cc3
...@@ -101,7 +101,7 @@ def runScenario(pipe_in=None, pipe_out=None, udpController=None): ...@@ -101,7 +101,7 @@ def runScenario(pipe_in=None, pipe_out=None, udpController=None):
# Queue for getting scenario status # Queue for getting scenario status
log = Queue.Queue() log = Queue.Queue()
if udpController: if udpController:
<inst.CleanName> = Exercise_<inst.CleanName>(log, name='Scenario') <inst.CleanName> = Exercise_<inst.CleanName>(log, name='Exercise_<inst.CleanName>')
udpController.slots.append(<inst.CleanName>.msq_q) udpController.slots.append(<inst.CleanName>.msq_q)
<inst.CleanName>.wait() <inst.CleanName>.wait()
udpController.slots.remove(<inst.CleanName>.msg_q) udpController.slots.remove(<inst.CleanName>.msg_q)
...@@ -109,12 +109,13 @@ def runScenario(pipe_in=None, pipe_out=None, udpController=None): ...@@ -109,12 +109,13 @@ def runScenario(pipe_in=None, pipe_out=None, udpController=None):
else: else:
# Use old-style message queue # Use old-style message queue
poller = PollerThread() poller = PollerThread()
<inst.CleanName> = Exercise_<inst.CleanName>(log, name='Scenario') <inst.CleanName> = Exercise_<inst.CleanName>(log, name='Exercise_<inst.CleanName>')
poller.slots.append(<inst.CleanName>.msg_q) poller.slots.append(<inst.CleanName>.msg_q)
poller.start() poller.start()
<inst.CleanName>.start() <inst.CleanName>.start()
# Wait and log messages from both scenarii # Wait and log messages from both scenarii
while True: while True:
time.sleep(0.001)
try: try:
scenario, severity, msg = log.get(block=False) scenario, severity, msg = log.get(block=False)
except Queue.Empty: except Queue.Empty:
...@@ -165,7 +166,7 @@ poller.slots.append(<inst.CleanName>.msg_q)}>}>}> ...@@ -165,7 +166,7 @@ poller.slots.append(<inst.CleanName>.msg_q)}>}>}>
PrintMscInstance(inst) ::= << PrintMscInstance(inst) ::= <<
@Scenario @Scenario
def Exercise_<inst.CleanName>(queue): def Exercise_<inst.CleanName>(queue): # queue is actually an instance of the Scenario class
'''<inst.CleanName> processing''' '''<inst.CleanName> processing'''
<inst.events:{evt|<PrintEvent(evt)>}; separator="\n"> <inst.events:{evt|<PrintEvent(evt)>}; separator="\n">
return 0 return 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment