diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/swig/php/test.php | 16 | ||||
-rw-r--r-- | src/uscxml/Interpreter.cpp | 7 |
2 files changed, 16 insertions, 7 deletions
diff --git a/src/bindings/swig/php/test.php b/src/bindings/swig/php/test.php index d87856f..e6566b2 100644 --- a/src/bindings/swig/php/test.php +++ b/src/bindings/swig/php/test.php @@ -47,7 +47,7 @@ $interpreter->addMonitor($monitor); $interpreter->interpret(); // start interpreter as a thread -$interpreter = Interpreter::fromURI('https://raw.github.com/tklab-tud/uscxml/master/test/samples/uscxml/test-invoked.scxml'); +$interpreter = Interpreter::fromURI('/Users/sradomski/Documents/TK/Code/uscxml/test/samples/uscxml/test-invoked.scxml'); $parentQueue = new ParentQueue(); $interpreter->setParentQueue($parentQueue); $interpreter->start(); @@ -55,21 +55,23 @@ $interpreter->start(); while($interpreter->isRunning()) { $event = $parentQueue->pop(); print("Name: " . $event->getName() . "\n"); - print("Content: " . $event->getContent() . "\n"); + print("Type: " . $event->getType() . "\n"); + print("Origin: " . $event->getOrigin() . "\n"); + print("OriginType: " . $event->getOriginType() . "\n"); + print("Content " . strlen($event->getContent()) . "bytes: \n'" . $event->getContent() . "'\n"); - print("Namelist: \n"); $namelist = $event->getNameList(); - print("\tSize: ". $namelist->size() ."\n"); + print("Namelist ".$namelist->size()." elements: \n"); $keys = $event->getNameListKeys(); for ($i = 0; $i < $keys->size(); $i++) { - print("\t" . $namelist->get($keys->get($i)) . "\n"); + print($keys->get($i) . "\t" . $namelist->get($keys->get($i)) . "\n"); } - print("Params: \n"); $params = $event->getParams(); - print("\tSize: ". $params->size() ."\n"); + print("Params ". $params->size() ." elements: \n"); $keys = $event->getParamKeys(); for ($i = 0; $i < $keys->size(); $i++) { + print($keys->get($i)."\n"); $paramList = $params->get($keys->get($i)); for ($j = 0; $j < $paramList->size(); $j++) { print("\t" . $paramList->get($i) . "\n"); diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp index 16b3209..8e9165e 100644 --- a/src/uscxml/Interpreter.cpp +++ b/src/uscxml/Interpreter.cpp @@ -355,6 +355,13 @@ void Interpreter::interpret() { // assert(hasLegalConfiguration()); mainEventLoop(); + if (_parentQueue) { + // send one final event to unblock eventual listeners + Event quit; + quit.name = "done.state.scxml"; + _parentQueue->push(quit); + } + // set datamodel to null from this thread if(_dataModel) _dataModel = DataModel(); |