diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-03-27 16:46:22 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-03-27 16:46:22 (GMT) |
commit | 24d5c93edd48e7ec2db37cce22b1f98b19adc78b (patch) | |
tree | af4f87d6a72c08d8276733b7e6f39ef9ed143d5e | |
parent | f11664454a92cd6df193f665fa8d7f2f81d2e06d (diff) | |
download | uscxml-24d5c93edd48e7ec2db37cce22b1f98b19adc78b.zip uscxml-24d5c93edd48e7ec2db37cce22b1f98b19adc78b.tar.gz uscxml-24d5c93edd48e7ec2db37cce22b1f98b19adc78b.tar.bz2 |
Some more final touches for PHP
-rw-r--r-- | src/bindings/swig/php/test.php | 16 | ||||
-rw-r--r-- | src/uscxml/Interpreter.cpp | 7 | ||||
-rw-r--r-- | test/samples/uscxml/test-invoked.scxml | 2 |
3 files changed, 17 insertions, 8 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(); diff --git a/test/samples/uscxml/test-invoked.scxml b/test/samples/uscxml/test-invoked.scxml index 54590ff..f34ed5c 100644 --- a/test/samples/uscxml/test-invoked.scxml +++ b/test/samples/uscxml/test-invoked.scxml @@ -15,7 +15,7 @@ bar = "This is some string"; </script> <log expr="'Message from the invoked scxml interpreter'" type="http://www.w3.org/TR/scxml/#Anything" id="thisOne" /> - <send target="#_parent" event="transitionToNext" namelist="foo"> + <send target="#_parent" event="transitionToNext" namelist="foo bar"> <param name="bar" expr="bar" /> <content> This is some content! |