diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-06 21:17:13 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-06 21:17:13 (GMT) |
commit | 1e6ba139ac12c688f025745812d381915775b1fb (patch) | |
tree | 1d49070eddd4502ec6aa25a769ab7c47d04a1c30 | |
parent | 139439f0675ec05e936fd4297086462037cd618e (diff) | |
download | uscxml-1e6ba139ac12c688f025745812d381915775b1fb.zip uscxml-1e6ba139ac12c688f025745812d381915775b1fb.tar.gz uscxml-1e6ba139ac12c688f025745812d381915775b1fb.tar.bz2 |
See detailled log
Added new revised W3C tests
Hide Interpreter via PIMPL
Implemented SCXMLIOProcessor
-rw-r--r-- | CMakeLists.txt | 26 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | apps/mmi-browser.cpp | 19 | ||||
-rw-r--r-- | src/bindings/swig/java/uscxml.i | 8 | ||||
-rw-r--r-- | src/bindings/swig/php/CMakeLists.txt | 8 | ||||
-rw-r--r-- | src/bindings/swig/php/uscxml.i | 8 | ||||
-rw-r--r-- | src/bindings/swig/php/uscxmlNativePHP.php | 338 | ||||
-rw-r--r-- | src/uscxml/Factory.cpp | 17 | ||||
-rw-r--r-- | src/uscxml/Factory.h | 34 | ||||
-rw-r--r-- | src/uscxml/Interpreter.cpp | 257 | ||||
-rw-r--r-- | src/uscxml/Interpreter.h | 329 | ||||
-rw-r--r-- | src/uscxml/Message.h | 2 | ||||
-rw-r--r-- | src/uscxml/debug/SCXMLDotWriter.h | 4 | ||||
-rw-r--r-- | src/uscxml/interpreter/InterpreterDraft6.cpp | 50 | ||||
-rw-r--r-- | src/uscxml/interpreter/InterpreterDraft6.h | 2 | ||||
-rw-r--r-- | src/uscxml/interpreter/InterpreterDraft7.h | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp | 10 | ||||
-rw-r--r-- | src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/element/fetch/FetchElement.cpp | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/element/fetch/FetchElement.h | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/element/postpone/PostponeElement.cpp | 22 | ||||
-rw-r--r-- | src/uscxml/plugins/element/postpone/PostponeElement.h | 14 | ||||
-rw-r--r-- | src/uscxml/plugins/element/response/ResponseElement.cpp | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/element/response/ResponseElement.h | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/http/HTTPServletInvoker.h | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/sample/SampleInvoker.cpp | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/sample/SampleInvoker.h | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp | 25 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h | 6 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.cpp | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/system/SystemInvoker.cpp | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/system/SystemInvoker.h | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp | 4 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/umundo/UmundoInvoker.h | 4 | ||||
-rw-r--r-- | src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp (renamed from src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.cpp) | 24 | ||||
-rw-r--r-- | src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h (renamed from src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h) | 18 | ||||
-rw-r--r-- | src/uscxml/plugins/ioprocessor/dom/DOMIOProcessor.cpp | 0 | ||||
-rw-r--r-- | src/uscxml/plugins/ioprocessor/dom/DOMIOProcessor.h | 0 | ||||
-rw-r--r-- | src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp | 141 | ||||
-rw-r--r-- | src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h | 36 | ||||
-rw-r--r-- | src/uscxml/server/InterpreterServlet.cpp | 4 | ||||
-rw-r--r-- | src/uscxml/server/InterpreterServlet.h | 6 | ||||
-rw-r--r-- | test/CMakeLists.txt | 2 | ||||
-rwxr-xr-x | test/samples/w3c/convert-tests.sh | 13 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test144.scxml (renamed from test/samples/w3c/tests/test144.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test147.scxml (renamed from test/samples/w3c/tests/test147.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test148.scxml (renamed from test/samples/w3c/tests/test148.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test149.scxml (renamed from test/samples/w3c/tests/test149.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test150.scxml (renamed from test/samples/w3c/tests/test150.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test151.scxml (renamed from test/samples/w3c/tests/test151.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test152.scxml (renamed from test/samples/w3c/tests/test152.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test153.scxml (renamed from test/samples/w3c/tests/test153.scxml) | 2 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test155.scxml (renamed from test/samples/w3c/tests/test155.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test156.scxml (renamed from test/samples/w3c/tests/test156.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test158.scxml (renamed from test/samples/w3c/tests/test158.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test159.scxml (renamed from test/samples/w3c/tests/test159.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test172.scxml (renamed from test/samples/w3c/tests/test172.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test173.scxml (renamed from test/samples/w3c/tests/test173.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test174.scxml (renamed from test/samples/w3c/tests/test174.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test175.scxml (renamed from test/samples/w3c/tests/test175.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test176.scxml (renamed from test/samples/w3c/tests/test176.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test178.scxml (renamed from test/samples/w3c/tests/test178.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test179.scxml (renamed from test/samples/w3c/tests/test179.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test183.scxml (renamed from test/samples/w3c/tests/test183.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test185.scxml (renamed from test/samples/w3c/tests/test185.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test186.scxml (renamed from test/samples/w3c/tests/test186.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test187.scxml (renamed from test/samples/w3c/tests/test187.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test189.scxml | 22 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test190.scxml | 35 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test191.scxml | 31 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test192.scxml | 55 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test194.scxml (renamed from test/samples/w3c/tests/test194.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test198.scxml (renamed from test/samples/w3c/tests/test198.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test199.scxml (renamed from test/samples/w3c/tests/test199.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test200.scxml (renamed from test/samples/w3c/tests/test200.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test201.scxml (renamed from test/samples/w3c/tests/test201.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test205.scxml (renamed from test/samples/w3c/tests/test205.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test207.scxml (renamed from test/samples/w3c/tests/test207.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test208.scxml (renamed from test/samples/w3c/tests/test208.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test210.scxml (renamed from test/samples/w3c/tests/test210.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test215.scxml (renamed from test/samples/w3c/tests/test215.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test216.scxml (renamed from test/samples/w3c/tests/test216.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test216sub1.scxml (renamed from test/samples/w3c/tests/test216sub1.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test220.scxml (renamed from test/samples/w3c/tests/test220.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test223.scxml (renamed from test/samples/w3c/tests/test223.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test224.scxml (renamed from test/samples/w3c/tests/test224.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test225.scxml (renamed from test/samples/w3c/tests/test225.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test226.scxml (renamed from test/samples/w3c/tests/test226.scxml) | 2 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test226sub1.scxml (renamed from test/samples/w3c/tests/test226sub1.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test228.scxml (renamed from test/samples/w3c/tests/test228.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test229.scxml (renamed from test/samples/w3c/tests/test229.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test230.scxml (renamed from test/samples/w3c/tests/test230.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test232.scxml (renamed from test/samples/w3c/tests/test232.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test233.scxml (renamed from test/samples/w3c/tests/test233.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test234.scxml (renamed from test/samples/w3c/tests/test234.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test235.scxml (renamed from test/samples/w3c/tests/test235.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test236.scxml (renamed from test/samples/w3c/tests/test236.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test237.scxml (renamed from test/samples/w3c/tests/test237.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test239.scxml (renamed from test/samples/w3c/tests/test239.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test239sub1.scxml (renamed from test/samples/w3c/tests/test239sub1.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test240.scxml (renamed from test/samples/w3c/tests/test240.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test241.scxml (renamed from test/samples/w3c/tests/test241.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test242.scxml (renamed from test/samples/w3c/tests/test242.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test242sub1.scxml (renamed from test/samples/w3c/tests/test242sub1.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test243.scxml (renamed from test/samples/w3c/tests/test243.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test244.scxml (renamed from test/samples/w3c/tests/test244.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test245.scxml (renamed from test/samples/w3c/tests/test245.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test247.scxml (renamed from test/samples/w3c/tests/test247.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test250.scxml (renamed from test/samples/w3c/tests/test250.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test252.scxml (renamed from test/samples/w3c/tests/test252.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test253.scxml (renamed from test/samples/w3c/tests/test253.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test276.scxml (renamed from test/samples/w3c/tests/test276.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test276sub1.scxml (renamed from test/samples/w3c/tests/test276sub1.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test277.scxml | 28 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test278.scxml (renamed from test/samples/w3c/tests/test278.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test279.scxml (renamed from test/samples/w3c/tests/test279.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test280.scxml (renamed from test/samples/w3c/tests/test280.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test286.scxml (renamed from test/samples/w3c/tests/test286.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test287.scxml (renamed from test/samples/w3c/tests/test287.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test294.scxml (renamed from test/samples/w3c/tests/test294.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test298.scxml (renamed from test/samples/w3c/tests/test298.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test301.scxml (renamed from test/samples/w3c/tests/test301.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test302.scxml (renamed from test/samples/w3c/tests/test302.scxml) | 2 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test303.scxml (renamed from test/samples/w3c/tests/test303.scxml) | 2 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test304.scxml (renamed from test/samples/w3c/tests/test304.scxml) | 2 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test307.scxml (renamed from test/samples/w3c/tests/test307.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test309.scxml (renamed from test/samples/w3c/tests/test309.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test310.scxml (renamed from test/samples/w3c/tests/test310.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test311.scxml (renamed from test/samples/w3c/tests/test311.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test312.scxml (renamed from test/samples/w3c/tests/test312.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test313.scxml (renamed from test/samples/w3c/tests/test313.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test314.scxml (renamed from test/samples/w3c/tests/test314.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test318.scxml (renamed from test/samples/w3c/tests/test318.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test319.scxml (renamed from test/samples/w3c/tests/test319.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test321.scxml (renamed from test/samples/w3c/tests/test321.scxml) | 2 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test322.scxml (renamed from test/samples/w3c/tests/test322.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test323.scxml (renamed from test/samples/w3c/tests/test323.scxml) | 2 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test324.scxml (renamed from test/samples/w3c/tests/test324.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test325.scxml (renamed from test/samples/w3c/tests/test325.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test326.scxml (renamed from test/samples/w3c/tests/test326.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test329.scxml (renamed from test/samples/w3c/tests/test329.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test330.scxml (renamed from test/samples/w3c/tests/test330.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test331.scxml (renamed from test/samples/w3c/tests/test331.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test332.scxml (renamed from test/samples/w3c/tests/test332.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test333.scxml (renamed from test/samples/w3c/tests/test333.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test335.scxml (renamed from test/samples/w3c/tests/test335.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test336.scxml (renamed from test/samples/w3c/tests/test336.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test337.scxml (renamed from test/samples/w3c/tests/test337.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test338.scxml (renamed from test/samples/w3c/tests/test338.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test339.scxml (renamed from test/samples/w3c/tests/test339.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test342.scxml (renamed from test/samples/w3c/tests/test342.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test343.scxml (renamed from test/samples/w3c/tests/test343.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test344.scxml (renamed from test/samples/w3c/tests/test344.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test346.scxml (renamed from test/samples/w3c/tests/test346.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test347.scxml | 40 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test348.scxml | 18 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test349.scxml | 29 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test350.scxml | 22 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test351.scxml | 48 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test352.scxml | 29 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test355.scxml (renamed from test/samples/w3c/tests/test355.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test364.scxml (renamed from test/samples/w3c/tests/test364.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test372.scxml (renamed from test/samples/w3c/tests/test372.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test375.scxml (renamed from test/samples/w3c/tests/test375.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test376.scxml (renamed from test/samples/w3c/tests/test376.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test377.scxml (renamed from test/samples/w3c/tests/test377.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test378.scxml (renamed from test/samples/w3c/tests/test378.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test387.scxml (renamed from test/samples/w3c/tests/test387.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test388.scxml (renamed from test/samples/w3c/tests/test388.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test396.scxml (renamed from test/samples/w3c/tests/test396.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test399.scxml (renamed from test/samples/w3c/tests/test399.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test401.scxml (renamed from test/samples/w3c/tests/test401.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test402.scxml (renamed from test/samples/w3c/tests/test402.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test403a.scxml (renamed from test/samples/w3c/tests/test403a.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test403b.scxml (renamed from test/samples/w3c/tests/test403b.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test403c.scxml (renamed from test/samples/w3c/tests/test403c.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test404.scxml (renamed from test/samples/w3c/tests/test404.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test405.scxml (renamed from test/samples/w3c/tests/test405.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test406.scxml (renamed from test/samples/w3c/tests/test406.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test407.scxml (renamed from test/samples/w3c/tests/test407.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test409.scxml (renamed from test/samples/w3c/tests/test409.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test411.scxml (renamed from test/samples/w3c/tests/test411.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test412.scxml (renamed from test/samples/w3c/tests/test412.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test413.scxml (renamed from test/samples/w3c/tests/test413.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test416.scxml (renamed from test/samples/w3c/tests/test416.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test417.scxml (renamed from test/samples/w3c/tests/test417.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test419.scxml (renamed from test/samples/w3c/tests/test419.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test421.scxml (renamed from test/samples/w3c/tests/test421.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test422.scxml (renamed from test/samples/w3c/tests/test422.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test423.scxml (renamed from test/samples/w3c/tests/test423.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test436.scxml (renamed from test/samples/w3c/tests/test436.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test444.scxml (renamed from test/samples/w3c/tests/test444.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test445.scxml (renamed from test/samples/w3c/tests/test445.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test448.scxml (renamed from test/samples/w3c/tests/test448.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test449.scxml (renamed from test/samples/w3c/tests/test449.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test451.scxml (renamed from test/samples/w3c/tests/test451.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test452.scxml (renamed from test/samples/w3c/tests/test452.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test453.scxml (renamed from test/samples/w3c/tests/test453.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test456.scxml (renamed from test/samples/w3c/tests/test456.scxml) | 2 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test457.scxml (renamed from test/samples/w3c/tests/test457.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test460.scxml (renamed from test/samples/w3c/tests/test460.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test463.scxml (renamed from test/samples/w3c/tests/test463.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test464.scxml (renamed from test/samples/w3c/tests/test464.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test465.scxml (renamed from test/samples/w3c/tests/test465.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test466.scxml (renamed from test/samples/w3c/tests/test466.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test467.scxml (renamed from test/samples/w3c/tests/test467.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test468.scxml (renamed from test/samples/w3c/tests/test468.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test469.scxml (renamed from test/samples/w3c/tests/test469.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test470.scxml (renamed from test/samples/w3c/tests/test470.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test473.scxml (renamed from test/samples/w3c/tests/test473.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test474.scxml (renamed from test/samples/w3c/tests/test474.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test475.scxml (renamed from test/samples/w3c/tests/test475.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test476.scxml (renamed from test/samples/w3c/tests/test476.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test477.scxml (renamed from test/samples/w3c/tests/test477.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test478.scxml (renamed from test/samples/w3c/tests/test478.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test479.scxml (renamed from test/samples/w3c/tests/test479.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test480.scxml (renamed from test/samples/w3c/tests/test480.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test481.scxml (renamed from test/samples/w3c/tests/test481.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test482.scxml (renamed from test/samples/w3c/tests/test482.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test487.scxml (renamed from test/samples/w3c/tests/test487.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test488.scxml (renamed from test/samples/w3c/tests/test488.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test495.scxml | 23 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test500.scxml | 15 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test501.scxml | 19 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test503.scxml (renamed from test/samples/w3c/tests/test503.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test504.scxml (renamed from test/samples/w3c/tests/test504.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test505.scxml (renamed from test/samples/w3c/tests/test505.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test506.scxml (renamed from test/samples/w3c/tests/test506.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test521.scxml (renamed from test/samples/w3c/tests/test521.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test525.scxml (renamed from test/samples/w3c/tests/test525.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test527.scxml (renamed from test/samples/w3c/tests/test527.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test528.scxml (renamed from test/samples/w3c/tests/test528.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test529.scxml (renamed from test/samples/w3c/tests/test529.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test530.scxml (renamed from test/samples/w3c/tests/test530.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test533.scxml (renamed from test/samples/w3c/tests/test533.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test537.scxml (renamed from test/samples/w3c/tests/test537.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test539.scxml (renamed from test/samples/w3c/tests/test539.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test539.txt (renamed from test/samples/w3c/tests/test539.txt) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test540.scxml (renamed from test/samples/w3c/tests/test540.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test540.txt (renamed from test/samples/w3c/tests/test540.txt) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test542.scxml (renamed from test/samples/w3c/tests/test542.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test544.scxml (renamed from test/samples/w3c/tests/test544.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test546.scxml (renamed from test/samples/w3c/tests/test546.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test547.scxml (renamed from test/samples/w3c/tests/test547.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test550.scxml (renamed from test/samples/w3c/tests/test550.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test551.scxml (renamed from test/samples/w3c/tests/test551.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test552.scxml (renamed from test/samples/w3c/tests/test552.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test552.txt (renamed from test/samples/w3c/tests/test552.txt) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test553.scxml (renamed from test/samples/w3c/tests/test553.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test554.scxml (renamed from test/samples/w3c/tests/test554.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test555.scxml (renamed from test/samples/w3c/tests/test555.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test557.scxml (renamed from test/samples/w3c/tests/test557.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test557.txt (renamed from test/samples/w3c/tests/test557.txt) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test558.scxml (renamed from test/samples/w3c/tests/test558.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test558.txt (renamed from test/samples/w3c/tests/test558.txt) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test560.scxml (renamed from test/samples/w3c/tests/test560.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test561.scxml (renamed from test/samples/w3c/tests/test561.scxml) | 4 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test562.scxml (renamed from test/samples/w3c/tests/test562.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test568.scxml | 15 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test569.scxml (renamed from test/samples/w3c/tests/test569.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test570.scxml (renamed from test/samples/w3c/tests/test570.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test576.scxml (renamed from test/samples/w3c/tests/test576.scxml) | 0 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test578.scxml | 19 | ||||
-rw-r--r-- | test/samples/w3c/tests/test441a.scxml | 44 | ||||
-rw-r--r-- | test/samples/w3c/tests/test441b.scxml | 44 | ||||
-rw-r--r-- | test/samples/w3c/tests/test486b.scxml | 14 | ||||
-rw-r--r-- | test/samples/w3c/txml/robots.txt | 96 | ||||
-rw-r--r-- | test/samples/w3c/txml/test189.txml | 25 | ||||
-rw-r--r-- | test/samples/w3c/txml/test190.txml | 38 | ||||
-rw-r--r-- | test/samples/w3c/txml/test191.txml | 34 | ||||
-rw-r--r-- | test/samples/w3c/txml/test192.txml | 58 | ||||
-rw-r--r-- | test/samples/w3c/txml/test226.txml | 2 | ||||
-rw-r--r-- | test/samples/w3c/txml/test302.txml | 2 | ||||
-rw-r--r-- | test/samples/w3c/txml/test303.txml | 3 | ||||
-rw-r--r-- | test/samples/w3c/txml/test304.txml | 3 | ||||
-rw-r--r-- | test/samples/w3c/txml/test321.txml | 2 | ||||
-rw-r--r-- | test/samples/w3c/txml/test323.txml | 2 | ||||
-rw-r--r-- | test/samples/w3c/txml/test347.txml | 44 | ||||
-rw-r--r-- | test/samples/w3c/txml/test348.txml | 20 | ||||
-rw-r--r-- | test/samples/w3c/txml/test349.txml | 33 | ||||
-rw-r--r-- | test/samples/w3c/txml/test350.txml | 26 | ||||
-rw-r--r-- | test/samples/w3c/txml/test351.txml | 52 | ||||
-rw-r--r-- | test/samples/w3c/txml/test352.txml | 32 | ||||
-rw-r--r-- | test/samples/w3c/txml/test441a.txml | 47 | ||||
-rw-r--r-- | test/samples/w3c/txml/test441b.txml | 47 | ||||
-rw-r--r-- | test/samples/w3c/txml/test456.txml | 2 | ||||
-rw-r--r-- | test/samples/w3c/txml/test486b.txml | 18 | ||||
-rw-r--r-- | test/samples/w3c/txml/test495.txml | 26 | ||||
-rw-r--r-- | test/samples/w3c/txml/test500.txml | 19 | ||||
-rw-r--r-- | test/samples/w3c/txml/test501.txml | 23 | ||||
-rw-r--r-- | test/samples/w3c/txml/test578.txml | 24 | ||||
-rw-r--r-- | test/src/scxml-test-framework-client.cpp | 55 | ||||
-rw-r--r-- | test/src/test-predicates.cpp | 39 | ||||
-rw-r--r-- | test/src/test-url.cpp | 5 | ||||
-rw-r--r-- | test/src/test-w3c.cpp | 13 |
309 files changed, 2045 insertions, 800 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index cf59195..87f6ef8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -459,19 +459,37 @@ endif() # LIBEVENT basichttp ioprocessor - this one is already required above -file(GLOB_RECURSE LIBEVENT_IOPROCESSOR +file(GLOB_RECURSE BASICHTTP_IOPROCESSOR src/uscxml/plugins/ioprocessor/basichttp/*.cpp src/uscxml/plugins/ioprocessor/basichttp/*.h ) -source_group("IOProcessor\\basichttp" FILES ${LIBEVENT_IOPROCESSOR}) +source_group("IOProcessor\\basichttp" FILES ${BASICHTTP_IOPROCESSOR}) if (BUILD_AS_PLUGINS) add_library( ioprocessor_basichttp SHARED - ${LIBEVENT_IOPROCESSOR}) + ${BASICHTTP_IOPROCESSOR}) target_link_libraries(ioprocessor_basichttp uscxml) set_target_properties(ioprocessor_basichttp PROPERTIES FOLDER "Plugin IOProcessor") else() - list (APPEND USCXML_FILES ${LIBEVENT_IOPROCESSOR}) + list (APPEND USCXML_FILES ${BASICHTTP_IOPROCESSOR}) +endif() + + +# scxml ioprocessor - this one is already required above + +file(GLOB_RECURSE SCXML_IOPROCESSOR + src/uscxml/plugins/ioprocessor/scxml/*.cpp + src/uscxml/plugins/ioprocessor/scxml/*.h +) +source_group("IOProcessor\\scxml" FILES ${SCXML_IOPROCESSOR}) +if (BUILD_AS_PLUGINS) + add_library( + ioprocessor_scxml SHARED + ${SCXML_IOPROCESSOR}) + target_link_libraries(ioprocessor_scxml uscxml) + set_target_properties(ioprocessor_scxml PROPERTIES FOLDER "Plugin IOProcessor") +else() + list (APPEND USCXML_FILES ${SCXML_IOPROCESSOR}) endif() @@ -34,7 +34,7 @@ the respective build-process. <table> <tr><th>Test#</th><th>Status</th><th>Comment</th></tr> <tr><td><tt>153</tt></td><td><tt>Failed / Fix in test</tt></td> - <td>The XSLT transformation leave some gibberish in the file</td> + <td>The XSLT transformation leave some gibberish in the file (Saxon HE XSLT)</td> <tr><td><tt>178</tt></td><td><tt>Failed / Fix in draft</tt></td> <td>A manual test that relies on an unspecified _event.raw attribute</td> <tr><td><tt>226</tt></td><td><tt>Failed / Fix in test</tt></td> diff --git a/apps/mmi-browser.cpp b/apps/mmi-browser.cpp index b432296..ff326f1 100644 --- a/apps/mmi-browser.cpp +++ b/apps/mmi-browser.cpp @@ -19,12 +19,12 @@ #endif class VerboseMonitor : public uscxml::InterpreterMonitor { - void onStableConfiguration(uscxml::Interpreter* interpreter) { - printConfig(interpreter->getConfiguration()); + void onStableConfiguration(uscxml::Interpreter interpreter) { + printConfig(interpreter.getConfiguration()); } - void beforeCompletion(uscxml::Interpreter* interpreter) { - printConfig(interpreter->getConfiguration()); + void beforeCompletion(uscxml::Interpreter interpreter) { + printConfig(interpreter.getConfiguration()); } void printConfig(const Arabica::XPath::NodeSet<std::string>& config) { @@ -164,20 +164,19 @@ int main(int argc, char** argv) { // std::cout << optind << std::endl; LOG(INFO) << "Processing " << argv[optind]; - Interpreter* interpreter = Interpreter::fromURI(argv[optind]); + Interpreter interpreter = Interpreter::fromURI(argv[optind]); if (interpreter) { - interpreter->setCmdLineOptions(argc, argv); + interpreter.setCmdLineOptions(argc, argv); // interpreter->setCapabilities(Interpreter::CAN_NOTHING); // interpreter->setCapabilities(Interpreter::CAN_BASIC_HTTP | Interpreter::CAN_GENERIC_HTTP); if (verbose) { VerboseMonitor* vm = new VerboseMonitor(); - interpreter->addMonitor(vm); + interpreter.addMonitor(vm); } - interpreter->start(); - while(interpreter->runOnMainThread(25)); - delete interpreter; + interpreter.start(); + while(interpreter.runOnMainThread(25)); } return EXIT_SUCCESS; diff --git a/src/bindings/swig/java/uscxml.i b/src/bindings/swig/java/uscxml.i index ccd6fe0..760846c 100644 --- a/src/bindings/swig/java/uscxml.i +++ b/src/bindings/swig/java/uscxml.i @@ -14,6 +14,11 @@ # %shared_ptr(uscxml::dom::Element); # %shared_ptr(uscxml::dom::Executable); +%rename(equals) operator==; +%rename(isValid) operator bool; +%ignore operator!=; +%ignore operator<; +%ignore operator=; //************************************************** // This ends up in the generated wrapper code @@ -30,6 +35,9 @@ using namespace uscxml; %rename(toString) operator<<; +%ignore uscxml::NumAttr; +%ignore uscxml::SCXMLParser; +%ignore uscxml::InterpreterImpl; //*********************************************** // Parse the header file to generate wrappers diff --git a/src/bindings/swig/php/CMakeLists.txt b/src/bindings/swig/php/CMakeLists.txt index 1ef54e7..efe6ef4 100644 --- a/src/bindings/swig/php/CMakeLists.txt +++ b/src/bindings/swig/php/CMakeLists.txt @@ -84,6 +84,14 @@ if (PHP_DEBUG_ENABLED) set(PHP_COMPILE_FLAGS "${PHP_COMPILE_FLAGS} -DZEND_DEBUG") endif() +ADD_CUSTOM_COMMAND( + TARGET uscxmlNativePHP + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_BINARY_DIR}/uscxmlNativePHP.php + ${PROJECT_SOURCE_DIR}/src/bindings/swig/php/uscxmlNativePHP.php +) + set_target_properties(uscxmlNativePHP PROPERTIES COMPILE_FLAGS ${PHP_COMPILE_FLAGS}) set_target_properties(uscxmlNativePHP PROPERTIES FOLDER "Bindings") diff --git a/src/bindings/swig/php/uscxml.i b/src/bindings/swig/php/uscxml.i index ba58678..5f0b930 100644 --- a/src/bindings/swig/php/uscxml.i +++ b/src/bindings/swig/php/uscxml.i @@ -9,6 +9,13 @@ // disable warning related to unknown base class #pragma SWIG nowarn=401 +%rename(c_array) array; +%rename(equals) operator==; +%rename(isValid) operator bool; +%ignore operator!=; +%ignore operator<; +%ignore operator=; + //************************************************** // This ends up in the generated wrapper code //************************************************** @@ -32,6 +39,7 @@ void*** tsrm_ls; %ignore uscxml::NumAttr; %ignore uscxml::SCXMLParser; +%ignore uscxml::InterpreterImpl; //*********************************************** // Parse the header file to generate wrappers diff --git a/src/bindings/swig/php/uscxmlNativePHP.php b/src/bindings/swig/php/uscxmlNativePHP.php index 7a1b9f8..34984ab 100644 --- a/src/bindings/swig/php/uscxmlNativePHP.php +++ b/src/bindings/swig/php/uscxmlNativePHP.php @@ -147,6 +147,7 @@ class Event { function __get($var) { if ($var === 'data') return new Data(Event_data_get($this->_cPtr)); + if ($var === 'namelist') return new NameList(Event_namelist_get($this->_cPtr)); $func = 'Event_'.$var.'_get'; if (function_exists($func)) return call_user_func($func,$this->_cPtr); if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr); @@ -159,14 +160,15 @@ class Event { const PLATFORM = 3; - function __construct($xmlString=null) { - if (is_resource($xmlString) && get_resource_type($xmlString) === '_p_uscxml__Event') { - $this->_cPtr=$xmlString; + function __construct($name_or_xmlString=null,$type=null) { + if (is_resource($name_or_xmlString) && get_resource_type($name_or_xmlString) === '_p_uscxml__Event') { + $this->_cPtr=$name_or_xmlString; return; } switch (func_num_args()) { case 0: $this->_cPtr=new_Event(); break; - default: $this->_cPtr=new_Event($xmlString); + case 1: $this->_cPtr=new_Event($name_or_xmlString); break; + default: $this->_cPtr=new_Event($name_or_xmlString,$type); } } @@ -265,6 +267,46 @@ class Event { function toXMLString() { return Event_toXMLString($this->_cPtr); } + + function getNameList() { + $r=Event_getNameList($this->_cPtr); + if (is_resource($r)) { + $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3)); + if (class_exists($c)) return new $c($r); + return new NameList($r); + } + return $r; + } + + function getNameListKeys() { + $r=Event_getNameListKeys($this->_cPtr); + if (is_resource($r)) { + $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3)); + if (class_exists($c)) return new $c($r); + return new ParamList($r); + } + return $r; + } + + function getParams() { + $r=Event_getParams($this->_cPtr); + if (is_resource($r)) { + $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3)); + if (class_exists($c)) return new $c($r); + return new Params($r); + } + return $r; + } + + function getParamKeys() { + $r=Event_getParamKeys($this->_cPtr); + if (is_resource($r)) { + $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3)); + if (class_exists($c)) return new $c($r); + return new ParamList($r); + } + return $r; + } } class InvokeRequest extends Event { @@ -284,7 +326,6 @@ class InvokeRequest extends Event { } function __get($var) { - if ($var === 'namelist') return new NameList(InvokeRequest_namelist_get($this->_cPtr)); $func = 'InvokeRequest_'.$var.'_get'; if (function_exists($func)) return call_user_func($func,$this->_cPtr); if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr); @@ -326,46 +367,6 @@ class InvokeRequest extends Event { InvokeRequest_setAutoForwarded($this->_cPtr,$autoForward); } - function getNameList() { - $r=InvokeRequest_getNameList($this->_cPtr); - if (is_resource($r)) { - $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3)); - if (class_exists($c)) return new $c($r); - return new NameList($r); - } - return $r; - } - - function getNameListKeys() { - $r=InvokeRequest_getNameListKeys($this->_cPtr); - if (is_resource($r)) { - $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3)); - if (class_exists($c)) return new $c($r); - return new ParamList($r); - } - return $r; - } - - function getParams() { - $r=InvokeRequest_getParams($this->_cPtr); - if (is_resource($r)) { - $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3)); - if (class_exists($c)) return new $c($r); - return new Params($r); - } - return $r; - } - - function getParamKeys() { - $r=InvokeRequest_getParamKeys($this->_cPtr); - if (is_resource($r)) { - $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3)); - if (class_exists($c)) return new $c($r); - return new ParamList($r); - } - return $r; - } - static function fromXML($xmlString) { $r=InvokeRequest_fromXML($xmlString); if (is_resource($r)) { @@ -402,7 +403,6 @@ class SendRequest extends Event { } function __get($var) { - if ($var === 'namelist') return new NameList(SendRequest_namelist_get($this->_cPtr)); $func = 'SendRequest_'.$var.'_get'; if (function_exists($func)) return call_user_func($func,$this->_cPtr); if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr); @@ -444,46 +444,6 @@ class SendRequest extends Event { SendRequest_setDelayMs($this->_cPtr,$delayMs); } - function getNameList() { - $r=SendRequest_getNameList($this->_cPtr); - if (is_resource($r)) { - $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3)); - if (class_exists($c)) return new $c($r); - return new NameList($r); - } - return $r; - } - - function getNameListKeys() { - $r=SendRequest_getNameListKeys($this->_cPtr); - if (is_resource($r)) { - $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3)); - if (class_exists($c)) return new $c($r); - return new ParamList($r); - } - return $r; - } - - function getParams() { - $r=SendRequest_getParams($this->_cPtr); - if (is_resource($r)) { - $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3)); - if (class_exists($c)) return new $c($r); - return new Params($r); - } - return $r; - } - - function getParamKeys() { - $r=SendRequest_getParamKeys($this->_cPtr); - if (is_resource($r)) { - $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3)); - if (class_exists($c)) return new $c($r); - return new ParamList($r); - } - return $r; - } - static function fromXML($xmlString) { $r=SendRequest_fromXML($xmlString); if (is_resource($r)) { @@ -503,75 +463,6 @@ class SendRequest extends Event { } } -class InterpreterMonitor { - public $_cPtr=null; - protected $_pData=array(); - - function __set($var,$value) { - if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value); - $this->_pData[$var] = $value; - } - - function __isset($var) { - if ($var === 'thisown') return true; - return array_key_exists($var, $this->_pData); - } - - function __get($var) { - if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr); - return $this->_pData[$var]; - } - - function onStableConfiguration($interpreter) { - InterpreterMonitor_onStableConfiguration($this->_cPtr,$interpreter); - } - - function beforeCompletion($interpreter) { - InterpreterMonitor_beforeCompletion($this->_cPtr,$interpreter); - } - - function afterCompletion($interpreter) { - InterpreterMonitor_afterCompletion($this->_cPtr,$interpreter); - } - - function beforeMicroStep($interpreter) { - InterpreterMonitor_beforeMicroStep($this->_cPtr,$interpreter); - } - - function beforeTakingTransitions($interpreter,$transitions) { - InterpreterMonitor_beforeTakingTransitions($this->_cPtr,$interpreter,$transitions); - } - - function beforeEnteringStates($interpreter,$statesToEnter) { - InterpreterMonitor_beforeEnteringStates($this->_cPtr,$interpreter,$statesToEnter); - } - - function afterEnteringStates($interpreter) { - InterpreterMonitor_afterEnteringStates($this->_cPtr,$interpreter); - } - - function beforeExitingStates($interpreter,$statesToExit) { - InterpreterMonitor_beforeExitingStates($this->_cPtr,$interpreter,$statesToExit); - } - - function afterExitingStates($interpreter) { - InterpreterMonitor_afterExitingStates($this->_cPtr,$interpreter); - } - - function __construct($res=null) { - if (is_resource($res) && get_resource_type($res) === '_p_uscxml__InterpreterMonitor') { - $this->_cPtr=$res; - return; - } - if (get_class($this) === 'InterpreterMonitor') { - $_this = null; - } else { - $_this = $this; - } - $this->_cPtr=new_InterpreterMonitor($_this); - } -} - class Interpreter { public $_cPtr=null; protected $_pData=array(); @@ -590,22 +481,9 @@ class Interpreter { if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr); return $this->_pData[$var]; } - function __construct($h) { - $this->_cPtr=$h; - } - - const EARLY = 0; - - const LATE = 1; - - const CAN_NOTHING = 0; - - const CAN_BASIC_HTTP = 1; - const CAN_GENERIC_HTTP = 2; - - static function fromDOM($node) { - $r=Interpreter_fromDOM($node); + static function fromDOM($dom) { + $r=Interpreter_fromDOM($dom); if (is_resource($r)) { $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3)); if (class_exists($c)) return new $c($r); @@ -644,12 +522,27 @@ class Interpreter { return $r; } - function start() { - Interpreter_start($this->_cPtr); + function __construct($impl_or_other=null) { + if (is_resource($impl_or_other) && get_resource_type($impl_or_other) === '_p_uscxml__Interpreter') { + $this->_cPtr=$impl_or_other; + return; + } + switch (func_num_args()) { + case 0: $this->_cPtr=new_Interpreter(); break; + default: $this->_cPtr=new_Interpreter($impl_or_other); + } + } + + function isValid() { + return Interpreter_isValid($this->_cPtr); } - static function run($arg1) { - Interpreter_run($arg1); + function equals($other) { + return Interpreter_equals($this->_cPtr,$other); + } + + function start() { + Interpreter_start($this->_cPtr); } function join() { @@ -726,14 +619,14 @@ class Interpreter { return Interpreter_getXMLPrefixForNS($this->_cPtr,$ns); } - function receive($event,$toFront=false) { - Interpreter_receive($this->_cPtr,$event,$toFront); - } - function receiveInternal($event) { Interpreter_receiveInternal($this->_cPtr,$event); } + function receive($event,$toFront=false) { + Interpreter_receive($this->_cPtr,$event,$toFront); + } + function getCurrentEvent() { $r=Interpreter_getCurrentEvent($this->_cPtr); if (is_resource($r)) { @@ -752,6 +645,10 @@ class Interpreter { Interpreter_setConfiguration($this->_cPtr,$states); } + function setInvokeRequest($req) { + Interpreter_setInvokeRequest($this->_cPtr,$req); + } + function getState($stateId) { return Interpreter_getState($this->_cPtr,$stateId); } @@ -780,6 +677,14 @@ class Interpreter { return Interpreter_getSessionId($this->_cPtr); } + function getIOProcessors() { + return Interpreter_getIOProcessors($this->_cPtr); + } + + function getInvokers() { + return Interpreter_getInvokers($this->_cPtr); + } + function runOnMainThread($fps,$blocking=true) { return Interpreter_runOnMainThread($this->_cPtr,$fps,$blocking); } @@ -862,6 +767,14 @@ class Interpreter { return Interpreter_getChildStates($state); } + static function getParentState($element) { + return Interpreter_getParentState($element); + } + + static function getAncestorElement($node,$tagName) { + return Interpreter_getAncestorElement($node,$tagName); + } + function getTargetStates($transition) { return Interpreter_getTargetStates($this->_cPtr,$transition); } @@ -887,6 +800,75 @@ class Interpreter { } } +class InterpreterMonitor { + public $_cPtr=null; + protected $_pData=array(); + + function __set($var,$value) { + if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value); + $this->_pData[$var] = $value; + } + + function __isset($var) { + if ($var === 'thisown') return true; + return array_key_exists($var, $this->_pData); + } + + function __get($var) { + if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr); + return $this->_pData[$var]; + } + + function onStableConfiguration($interpreter) { + InterpreterMonitor_onStableConfiguration($this->_cPtr,$interpreter); + } + + function beforeCompletion($interpreter) { + InterpreterMonitor_beforeCompletion($this->_cPtr,$interpreter); + } + + function afterCompletion($interpreter) { + InterpreterMonitor_afterCompletion($this->_cPtr,$interpreter); + } + + function beforeMicroStep($interpreter) { + InterpreterMonitor_beforeMicroStep($this->_cPtr,$interpreter); + } + + function beforeTakingTransitions($interpreter,$transitions) { + InterpreterMonitor_beforeTakingTransitions($this->_cPtr,$interpreter,$transitions); + } + + function beforeEnteringStates($interpreter,$statesToEnter) { + InterpreterMonitor_beforeEnteringStates($this->_cPtr,$interpreter,$statesToEnter); + } + + function afterEnteringStates($interpreter) { + InterpreterMonitor_afterEnteringStates($this->_cPtr,$interpreter); + } + + function beforeExitingStates($interpreter,$statesToExit) { + InterpreterMonitor_beforeExitingStates($this->_cPtr,$interpreter,$statesToExit); + } + + function afterExitingStates($interpreter) { + InterpreterMonitor_afterExitingStates($this->_cPtr,$interpreter); + } + + function __construct($res=null) { + if (is_resource($res) && get_resource_type($res) === '_p_uscxml__InterpreterMonitor') { + $this->_cPtr=$res; + return; + } + if (get_class($this) === 'InterpreterMonitor') { + $_this = null; + } else { + $_this = $this; + } + $this->_cPtr=new_InterpreterMonitor($_this); + } +} + class ParentQueue { public $_cPtr=null; protected $_pData=array(); diff --git a/src/uscxml/Factory.cpp b/src/uscxml/Factory.cpp index 41a3b5a..e927693 100644 --- a/src/uscxml/Factory.cpp +++ b/src/uscxml/Factory.cpp @@ -10,7 +10,8 @@ # include "uscxml/plugins/Plugins.h" #else -# include "uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h" +# include "uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h" +# include "uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h" # include "uscxml/plugins/invoker/scxml/USCXMLInvoker.h" # include "uscxml/plugins/invoker/http/HTTPServletInvoker.h" # include "uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h" @@ -165,7 +166,11 @@ Factory::Factory() { registerInvoker(invoker); } { - EventIOProcessor* ioProcessor = new EventIOProcessor(); + BasicHTTPIOProcessor* ioProcessor = new BasicHTTPIOProcessor(); + registerIOProcessor(ioProcessor); + } + { + SCXMLIOProcessor* ioProcessor = new SCXMLIOProcessor(); registerIOProcessor(ioProcessor); } { @@ -240,7 +245,7 @@ void Factory::registerExecutableContent(ExecutableContentImpl* executableContent } -boost::shared_ptr<InvokerImpl> Factory::createInvoker(const std::string& type, Interpreter* interpreter) { +boost::shared_ptr<InvokerImpl> Factory::createInvoker(const std::string& type, InterpreterImpl* interpreter) { Factory* factory = getInstance(); if (factory->_invokerAliases.find(type) == factory->_invokerAliases.end()) { LOG(ERROR) << "No " << type << " Invoker known"; @@ -256,7 +261,7 @@ boost::shared_ptr<InvokerImpl> Factory::createInvoker(const std::string& type, I return boost::static_pointer_cast<InvokerImpl>(factory->_invokers[canonicalName]->create(interpreter)); } -boost::shared_ptr<DataModelImpl> Factory::createDataModel(const std::string& type, Interpreter* interpreter) { +boost::shared_ptr<DataModelImpl> Factory::createDataModel(const std::string& type, InterpreterImpl* interpreter) { Factory* factory = getInstance(); if (factory->_dataModelAliases.find(type) == factory->_dataModelAliases.end()) { LOG(ERROR) << "No " << type << " DataModel known"; @@ -272,7 +277,7 @@ boost::shared_ptr<DataModelImpl> Factory::createDataModel(const std::string& typ return factory->_dataModels[canonicalName]->create(interpreter); } -boost::shared_ptr<IOProcessorImpl> Factory::createIOProcessor(const std::string& type, Interpreter* interpreter) { +boost::shared_ptr<IOProcessorImpl> Factory::createIOProcessor(const std::string& type, InterpreterImpl* interpreter) { Factory* factory = getInstance(); if (factory->_ioProcessorAliases.find(type) == factory->_ioProcessorAliases.end()) { LOG(ERROR) << "No " << type << " IOProcessor known"; @@ -288,7 +293,7 @@ boost::shared_ptr<IOProcessorImpl> Factory::createIOProcessor(const std::string& return factory->_ioProcessors[canonicalName]->create(interpreter); } -boost::shared_ptr<ExecutableContentImpl> Factory::createExecutableContent(const std::string& localName, const std::string& nameSpace, Interpreter* interpreter) { +boost::shared_ptr<ExecutableContentImpl> Factory::createExecutableContent(const std::string& localName, const std::string& nameSpace, InterpreterImpl* interpreter) { Factory* factory = getInstance(); std::string actualNameSpace = (nameSpace.length() == 0 ? "http://www.w3.org/2005/07/scxml" : nameSpace); if (factory->_executableContent.find(std::make_pair(localName, actualNameSpace)) == factory->_executableContent.end()) { diff --git a/src/uscxml/Factory.h b/src/uscxml/Factory.h index 990b035..c396e63 100644 --- a/src/uscxml/Factory.h +++ b/src/uscxml/Factory.h @@ -33,15 +33,15 @@ inline bool isNumeric( const char* pszInput, int nNumberBase) { return (input.find_first_not_of(base.substr(0, nNumberBase)) == std::string::npos); } -class Interpreter; +class InterpreterImpl; class ExecutableContentImpl { public: ExecutableContentImpl() {}; virtual ~ExecutableContentImpl() {}; - virtual boost::shared_ptr<ExecutableContentImpl> create(Interpreter* interpreter) = 0; + virtual boost::shared_ptr<ExecutableContentImpl> create(InterpreterImpl* interpreter) = 0; - virtual void setInterpreter(Interpreter* interpreter) { + virtual void setInterpreter(InterpreterImpl* interpreter) { _interpreter = interpreter; } @@ -52,7 +52,7 @@ public: virtual bool processChildren() = 0; ///< Whether or not the interpreter should process this elements children. protected: - Interpreter* _interpreter; + InterpreterImpl* _interpreter; }; class ExecutableContent { @@ -79,7 +79,7 @@ public: return *this; } - void setInterpreter(Interpreter* interpreter) { + void setInterpreter(InterpreterImpl* interpreter) { _impl->setInterpreter(interpreter); } @@ -107,10 +107,10 @@ class IOProcessorImpl { public: IOProcessorImpl() {}; virtual ~IOProcessorImpl() {}; - virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter) = 0; + virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter) = 0; virtual std::set<std::string> getNames() = 0; - virtual void setInterpreter(Interpreter* interpreter) { + virtual void setInterpreter(InterpreterImpl* interpreter) { _interpreter = interpreter; } void setInvokeId(const std::string& invokeId) { @@ -128,7 +128,7 @@ public: void returnEvent(Event& event); protected: - Interpreter* _interpreter; + InterpreterImpl* _interpreter; std::string _invokeId; std::string _type; }; @@ -171,7 +171,7 @@ public: return _impl->runOnMainThread(); } - void setInterpreter(Interpreter* interpreter) { + void setInterpreter(InterpreterImpl* interpreter) { _impl->setInterpreter(interpreter); } void setInvokeId(const std::string& invokeId) { @@ -183,13 +183,13 @@ public: protected: boost::shared_ptr<IOProcessorImpl> _impl; - friend class Interpreter; + friend class InterpreterImpl; }; class InvokerImpl : public IOProcessorImpl { public: virtual void invoke(const InvokeRequest& req) = 0; - virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter) = 0; + virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter) = 0; }; class Invoker : public IOProcessor { @@ -228,7 +228,7 @@ protected: class DataModelImpl { public: virtual ~DataModelImpl() {} - virtual boost::shared_ptr<DataModelImpl> create(Interpreter* interpreter) = 0; + virtual boost::shared_ptr<DataModelImpl> create(InterpreterImpl* interpreter) = 0; virtual std::set<std::string> getNames() = 0; virtual bool validate(const std::string& location, const std::string& schema) = 0; @@ -249,7 +249,7 @@ public: virtual bool isDeclared(const std::string& expr) = 0; protected: - Interpreter* _interpreter; + InterpreterImpl* _interpreter; }; class DataModel { @@ -332,10 +332,10 @@ public: void registerInvoker(InvokerImpl* invoker); void registerExecutableContent(ExecutableContentImpl* executableContent); - static boost::shared_ptr<DataModelImpl> createDataModel(const std::string& type, Interpreter* interpreter); - static boost::shared_ptr<IOProcessorImpl> createIOProcessor(const std::string& type, Interpreter* interpreter); - static boost::shared_ptr<InvokerImpl> createInvoker(const std::string& type, Interpreter* interpreter); - static boost::shared_ptr<ExecutableContentImpl> createExecutableContent(const std::string& localName, const std::string& nameSpace, Interpreter* interpreter); + static boost::shared_ptr<DataModelImpl> createDataModel(const std::string& type, InterpreterImpl* interpreter); + static boost::shared_ptr<IOProcessorImpl> createIOProcessor(const std::string& type, InterpreterImpl* interpreter); + static boost::shared_ptr<InvokerImpl> createInvoker(const std::string& type, InterpreterImpl* interpreter); + static boost::shared_ptr<ExecutableContentImpl> createExecutableContent(const std::string& localName, const std::string& nameSpace, InterpreterImpl* interpreter); static Factory* getInstance(); diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp index 86f40c1..48410a9 100644 --- a/src/uscxml/Interpreter.cpp +++ b/src/uscxml/Interpreter.cpp @@ -40,12 +40,15 @@ namespace uscxml { using namespace Arabica::XPath; using namespace Arabica::DOM; -boost::uuids::random_generator Interpreter::uuidGen; -const std::string Interpreter::getUUID() { +std::map<std::string, boost::weak_ptr<InterpreterImpl> > Interpreter::_instances; +tthread::recursive_mutex Interpreter::_instanceMutex; + +boost::uuids::random_generator InterpreterImpl::uuidGen; +const std::string InterpreterImpl::getUUID() { return boost::lexical_cast<std::string>(uuidGen()); } -Interpreter::Interpreter() { +InterpreterImpl::InterpreterImpl() { _lastRunOnMainThread = 0; _nsURL = "*"; _thread = NULL; @@ -63,13 +66,17 @@ Interpreter::Interpreter() { #endif } -Interpreter* Interpreter::fromDOM(const Arabica::DOM::Document<std::string>& dom) { - Interpreter* interpreter = new InterpreterDraft6(); - interpreter->_document = dom; +Interpreter Interpreter::fromDOM(const Arabica::DOM::Document<std::string>& dom) { + tthread::lock_guard<tthread::recursive_mutex> lock(_instanceMutex); + boost::shared_ptr<InterpreterDraft6> interpreterImpl = boost::shared_ptr<InterpreterDraft6>(new InterpreterDraft6); + Interpreter interpreter(interpreterImpl); + interpreterImpl->_document = dom; + interpreterImpl->init(); + _instances[interpreterImpl->getSessionId()] = interpreterImpl; return interpreter; } -Interpreter* Interpreter::fromXML(const std::string& xml) { +Interpreter Interpreter::fromXML(const std::string& xml) { std::stringstream* ss = new std::stringstream(); (*ss) << xml; // we need an auto_ptr for arabica to assume ownership @@ -79,16 +86,16 @@ Interpreter* Interpreter::fromXML(const std::string& xml) { return fromInputSource(inputSource); } -Interpreter* Interpreter::fromURI(const std::string& uri) { +Interpreter Interpreter::fromURI(const std::string& uri) { URL absUrl(uri); if (!absUrl.isAbsolute()) { if (!absUrl.toAbsoluteCwd()) { LOG(ERROR) << "Given URL is not absolute or does not have file schema"; - return NULL; + return Interpreter(); } } - Interpreter* interpreter = NULL; + Interpreter interpreter; if (boost::iequals(absUrl.scheme(), "file")) { Arabica::SAX::InputSource<std::string> inputSource; @@ -105,21 +112,22 @@ Interpreter* Interpreter::fromURI(const std::string& uri) { ss << absUrl; if (absUrl.downloadFailed()) { LOG(ERROR) << "Downloading SCXML document from " << absUrl << " failed"; - return NULL; + return interpreter; } interpreter = fromXML(ss.str()); } // try to establish URI root for relative src attributes in document if (interpreter) - interpreter->_baseURI = toBaseURI(absUrl); + interpreter._impl->_baseURI = InterpreterImpl::toBaseURI(absUrl); return interpreter; } -Interpreter* Interpreter::fromInputSource(Arabica::SAX::InputSource<std::string>& source) { - Interpreter* interpreter = new InterpreterDraft6(); - - SCXMLParser* parser = new SCXMLParser(interpreter); +Interpreter Interpreter::fromInputSource(Arabica::SAX::InputSource<std::string>& source) { + tthread::lock_guard<tthread::recursive_mutex> lock(_instanceMutex); + boost::shared_ptr<InterpreterDraft6> interpreterImpl = boost::shared_ptr<InterpreterDraft6>(new InterpreterDraft6); + Interpreter interpreter; + SCXMLParser* parser = new SCXMLParser(interpreterImpl.get()); if(!parser->parse(source) || !parser->getDocument().hasChildNodes()) { if(parser->_errorHandler.errorsReported()) { LOG(ERROR) << "could not parse input:"; @@ -130,18 +138,18 @@ Interpreter* Interpreter::fromInputSource(Arabica::SAX::InputSource<std::string> LOG(ERROR) << source.getSystemId() << ": no such file"; } } - delete parser; - delete interpreter; - return NULL; } else { - interpreter->_document = parser->getDocument(); + interpreterImpl->_document = parser->getDocument(); + interpreterImpl->init(); + interpreter = Interpreter(interpreterImpl); + _instances[interpreterImpl->getSessionId()] = interpreterImpl; } // interpreter->init(); delete parser; return interpreter; } -SCXMLParser::SCXMLParser(Interpreter* interpreter) : _interpreter(interpreter) { +SCXMLParser::SCXMLParser(InterpreterImpl* interpreter) : _interpreter(interpreter) { Arabica::SAX::CatchErrorHandler<std::string> errorHandler; setErrorHandler(errorHandler); } @@ -169,7 +177,7 @@ void SCXMLParser::startPrefixMapping(const std::string& prefix, const std::strin } } -void Interpreter::setName(const std::string& name) { +void InterpreterImpl::setName(const std::string& name) { if (!_running) { _name = name; } else { @@ -177,7 +185,7 @@ void Interpreter::setName(const std::string& name) { } } -URL Interpreter::toBaseURI(const URL& uri) { +URL InterpreterImpl::toBaseURI(const URL& uri) { std::stringstream ssBaseURI; if (uri.scheme().size() > 0) { ssBaseURI << uri.scheme() << "://"; @@ -197,7 +205,7 @@ URL Interpreter::toBaseURI(const URL& uri) { return URL(ssBaseURI.str()); } -bool Interpreter::toAbsoluteURI(URL& uri) { +bool InterpreterImpl::toAbsoluteURI(URL& uri) { if (uri.isAbsolute()) return true; @@ -209,7 +217,7 @@ bool Interpreter::toAbsoluteURI(URL& uri) { return false; } -Interpreter::~Interpreter() { +InterpreterImpl::~InterpreterImpl() { tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); if (_thread) { _running = false; @@ -225,16 +233,16 @@ Interpreter::~Interpreter() { // delete _httpServlet; } -void Interpreter::start() { +void InterpreterImpl::start() { _done = false; - _thread = new tthread::thread(Interpreter::run, this); + _thread = new tthread::thread(InterpreterImpl::run, this); } -void Interpreter::run(void* instance) { - ((Interpreter*)instance)->interpret(); +void InterpreterImpl::run(void* instance) { + ((InterpreterImpl*)instance)->interpret(); } -bool Interpreter::runOnMainThread(int fps, bool blocking) { +bool InterpreterImpl::runOnMainThread(int fps, bool blocking) { if (_done) return false; @@ -267,7 +275,7 @@ bool Interpreter::runOnMainThread(int fps, bool blocking) { return (_thread != NULL); } -void Interpreter::init() { +void InterpreterImpl::init() { if (_document) { NodeList<std::string> scxmls = _document.getElementsByTagNameNS(_nsURL, "scxml"); if (scxmls.getLength() > 0) { @@ -281,9 +289,6 @@ void Interpreter::init() { normalize(_scxml); -// if (_capabilities & CAN_GENERIC_HTTP) -// _httpServlet = new InterpreterServlet(this); - _sendQueue = new DelayedEventQueue(); _sendQueue->start(); @@ -296,23 +301,27 @@ void Interpreter::init() { LOG(ERROR) << "Interpreter has no DOM at all!" << std::endl; _done = true; } + + if (_sessionId.length() == 0) + _sessionId = getUUID(); + _isInitialized = true; } /** * Called with a single data element from the topmost datamodel element. */ -void Interpreter::initializeData(const Node<std::string>& data) { +void InterpreterImpl::initializeData(const Node<std::string>& data) { if (!_dataModel) { LOG(ERROR) << "Cannot initialize data when no datamodel is given!"; return; } - + if (!HAS_ATTR(data, "id")) { LOG(ERROR) << "Data element has no id!"; return; } - + /// test 240 - initialize from invoke request if (_invokeReq.params.find(ATTR(data, "id")) != _invokeReq.params.end()) { try { @@ -332,7 +341,7 @@ void Interpreter::initializeData(const Node<std::string>& data) { } return; } - + try { std::string contentToProcess; if (HAS_ATTR(data, "expr")) { @@ -341,13 +350,13 @@ void Interpreter::initializeData(const Node<std::string>& data) { _dataModel.assign(ATTR(data, "id"), value); return; } - + if (HAS_ATTR(data, "src")) { // fetch us some string and proess below URL srcURL(ATTR(data, "src")); if (!srcURL.isAbsolute()) toAbsoluteURI(srcURL); - + std::stringstream ss; if (_cachedURLs.find(srcURL.asString()) != _cachedURLs.end()) { ss << _cachedURLs[srcURL.asString()]; @@ -384,7 +393,7 @@ void Interpreter::initializeData(const Node<std::string>& data) { } contentChild = contentChild.getNextSibling(); } - + if (contentChild && presentAsDom) { Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation(); Document<std::string> dom = domFactory.createDocument(contentChild.getNamespaceURI(), "", 0); @@ -422,7 +431,7 @@ void Interpreter::initializeData(const Node<std::string>& data) { } else { _dataModel.assign(ATTR(data, "id"), "undefined"); } - + } catch (Event e) { LOG(ERROR) << "Syntax error in data element:" << std::endl << e << std::endl; /// test 487 @@ -430,7 +439,9 @@ void Interpreter::initializeData(const Node<std::string>& data) { } } -void Interpreter::normalize(Arabica::DOM::Element<std::string>& scxml) { +void InterpreterImpl::normalize(Arabica::DOM::Element<std::string>& scxml) { + // TODO: Resolve XML includes + // make sure every state has an id and set isFirstEntry to true Arabica::XPath::NodeSet<std::string> states = _xpath.evaluate("//" + _xpathPrefix + "state", _scxml).asNodeSet(); for (int i = 0; i < states.size(); i++) { @@ -488,14 +499,14 @@ void Interpreter::normalize(Arabica::DOM::Element<std::string>& scxml) { std::cout << _scxml <<std::endl; #endif } - -void Interpreter::receiveInternal(const Event& event) { + +void InterpreterImpl::receiveInternal(const Event& event) { std::cout << "receiveInternal: " << event.name << std::endl; _internalQueue.push_back(event); } -void Interpreter::internalDoneSend(const Arabica::DOM::Node<std::string>& state) { +void InterpreterImpl::internalDoneSend(const Arabica::DOM::Node<std::string>& state) { if (!isState(state)) return; @@ -520,7 +531,7 @@ void Interpreter::internalDoneSend(const Arabica::DOM::Node<std::string>& state) } -void Interpreter::processContentElement(const Arabica::DOM::Node<std::string>& content, Arabica::DOM::Document<std::string>& dom, std::string& text) { +void InterpreterImpl::processContentElement(const Arabica::DOM::Node<std::string>& content, Arabica::DOM::Document<std::string>& dom, std::string& text) { try { if (HAS_ATTR(content, "expr")) { if (_dataModel) { @@ -579,7 +590,7 @@ void Interpreter::processContentElement(const Arabica::DOM::Node<std::string>& c } } -void Interpreter::processParamChilds(const Arabica::DOM::Node<std::string>& element, std::multimap<std::string, std::string>& params) { +void InterpreterImpl::processParamChilds(const Arabica::DOM::Node<std::string>& element, std::multimap<std::string, std::string>& params) { NodeSet<std::string> paramElems = filterChildElements(_xmlNSPrefix + "param", element); try { for (int i = 0; i < paramElems.size(); i++) { @@ -611,7 +622,7 @@ void Interpreter::processParamChilds(const Arabica::DOM::Node<std::string>& elem } } -void Interpreter::send(const Arabica::DOM::Node<std::string>& element) { +void InterpreterImpl::send(const Arabica::DOM::Node<std::string>& element) { SendRequest sendReq; // test 331 sendReq.Event::type = Event::EXTERNAL; @@ -752,51 +763,19 @@ void Interpreter::send(const Arabica::DOM::Node<std::string>& element) { assert(_sendIds.find(sendReq.sendid) == _sendIds.end()); _sendIds[sendReq.sendid] = std::make_pair(this, sendReq); if (sendReq.delayMs > 0) { - _sendQueue->addEvent(sendReq.sendid, Interpreter::delayedSend, sendReq.delayMs, &_sendIds[sendReq.sendid]); + _sendQueue->addEvent(sendReq.sendid, InterpreterImpl::delayedSend, sendReq.delayMs, &_sendIds[sendReq.sendid]); } else { delayedSend(&_sendIds[sendReq.sendid], sendReq.name); } } -void Interpreter::delayedSend(void* userdata, std::string eventName) { - std::pair<Interpreter*, SendRequest>* data = (std::pair<Interpreter*, SendRequest>*)(userdata); +void InterpreterImpl::delayedSend(void* userdata, std::string eventName) { + std::pair<InterpreterImpl*, SendRequest>* data = (std::pair<InterpreterImpl*, SendRequest>*)(userdata); - Interpreter* INSTANCE = data->first; + InterpreterImpl* INSTANCE = data->first; SendRequest sendReq = data->second; - // test 253 - if (sendReq.origintype.length() == 0) - sendReq.origintype = "http://www.w3.org/TR/scxml/#SCXMLEventProcessor"; - - // see http://www.w3.org/TR/scxml/#SendTargets - if (boost::iequals(sendReq.target, "#_parent")) { - // send to parent scxml session - if (INSTANCE->_parentQueue != NULL) { -// LOG(ERROR) << "Pushing into parent queue: " << INSTANCE->_parentQueue << std::endl; - INSTANCE->_parentQueue->push(sendReq); - } else { - LOG(ERROR) << "Can not send to parent, we were not invoked" << std::endl; - } - } else if (boost::iequals(sendReq.target, "#_internal")) { - INSTANCE->receiveInternal(sendReq); - } else if (sendReq.target.find_first_of("#_") == 0) { - // send to invoker - std::string invokeId = sendReq.target.substr(2, sendReq.target.length() - 2); - if (INSTANCE->_invokers.find(invokeId) != INSTANCE->_invokers.end()) { - tthread::lock_guard<tthread::recursive_mutex> lock(INSTANCE->_mutex); - try { - INSTANCE->_invokers[invokeId].send(sendReq); - } catch(...) { - LOG(ERROR) << "Exception caught while sending event to invoker " << invokeId; - } - } else { - LOG(ERROR) << "Can not send to invoked component '" << invokeId << "', no such invokeId" << std::endl; - Event e("error.communication", Event::PLATFORM); - INSTANCE->receiveInternal(e); - } - } else if (sendReq.target.length() == 0 && - (sendReq.type.length() == 0 || - boost::equals(sendReq.type, "http://www.w3.org/TR/scxml/#SCXMLEventProcessor"))) { + if (sendReq.target.length() == 0) { /** * If neither the 'target' nor the 'targetexpr' attribute is specified, the * SCXML Processor must add the event will be added to the external event @@ -804,9 +783,13 @@ void Interpreter::delayedSend(void* userdata, std::string eventName) { */ INSTANCE->_externalQueue.push(sendReq); } else { - IOProcessor ioProc; - if (sendReq.type.length() > 0) - ioProc = INSTANCE->getIOProcessor(sendReq.type); + /** + * If neither the 'type' nor the 'typeexpr' is defined, the SCXML Processor + * must assume the default value of http://www.w3.org/TR/scxml/#SCXMLEventProcessor + */ + if (sendReq.type.length() == 0) + sendReq.type = "http://www.w3.org/TR/scxml/#SCXMLEventProcessor"; + IOProcessor ioProc = INSTANCE->getIOProcessor(sendReq.type); if (ioProc) { try { ioProc.send(sendReq); @@ -814,10 +797,12 @@ void Interpreter::delayedSend(void* userdata, std::string eventName) { LOG(ERROR) << "Exception caught while sending event to ioprocessor " << sendReq.type; } } else { - Event exceptionEvent; - exceptionEvent.name = "error.execution"; - exceptionEvent.type = Event::PLATFORM; - exceptionEvent.sendid = sendReq.sendid; + /** + * If the SCXML Processor does not support the type that is specified, it + * must place the event error.execution on the internal event queue. + */ + Event exceptionEvent("error.execution", Event::PLATFORM); +// exceptionEvent.sendid = sendReq.sendid; INSTANCE->receiveInternal(exceptionEvent); } } @@ -825,7 +810,7 @@ void Interpreter::delayedSend(void* userdata, std::string eventName) { INSTANCE->_sendIds.erase(sendReq.sendid); } -void Interpreter::invoke(const Arabica::DOM::Node<std::string>& element) { +void InterpreterImpl::invoke(const Arabica::DOM::Node<std::string>& element) { InvokeRequest invokeReq; invokeReq.Event::type = Event::EXTERNAL; try { @@ -903,7 +888,7 @@ void Interpreter::invoke(const Arabica::DOM::Node<std::string>& element) { // test 422 if (invokeReq.type.size() == 0) invokeReq.type = "http://www.w3.org/TR/scxml/"; - + Invoker invoker(Factory::createInvoker(invokeReq.type, this)); if (invoker) { tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); @@ -937,7 +922,7 @@ void Interpreter::invoke(const Arabica::DOM::Node<std::string>& element) { } } -void Interpreter::cancelInvoke(const Arabica::DOM::Node<std::string>& element) { +void InterpreterImpl::cancelInvoke(const Arabica::DOM::Node<std::string>& element) { std::string invokeId; if (HAS_ATTR(element, "idlocation") && _dataModel) { invokeId = _dataModel.evalAsString(ATTR(element, "idlocation")); @@ -965,7 +950,7 @@ void Interpreter::cancelInvoke(const Arabica::DOM::Node<std::string>& element) { // see: http://www.w3.org/TR/scxml/#EventDescriptors -bool Interpreter::nameMatch(const std::string& transitionEvent, const std::string& event) { +bool InterpreterImpl::nameMatch(const std::string& transitionEvent, const std::string& event) { if(transitionEvent.length() == 0 || event.length() == 0) return false; @@ -1007,7 +992,7 @@ bool Interpreter::nameMatch(const std::string& transitionEvent, const std::strin } -bool Interpreter::hasConditionMatch(const Arabica::DOM::Node<std::string>& conditional) { +bool InterpreterImpl::hasConditionMatch(const Arabica::DOM::Node<std::string>& conditional) { if (HAS_ATTR(conditional, "cond") && ATTR(conditional, "cond").length() > 0) { if (!_dataModel) { @@ -1027,7 +1012,7 @@ bool Interpreter::hasConditionMatch(const Arabica::DOM::Node<std::string>& condi } -void Interpreter::executeContent(const NodeList<std::string>& content, bool rethrow) { +void InterpreterImpl::executeContent(const NodeList<std::string>& content, bool rethrow) { for (unsigned int i = 0; i < content.getLength(); i++) { if (content.item(i).getNodeType() != Node_base::ELEMENT_NODE) continue; @@ -1035,7 +1020,7 @@ void Interpreter::executeContent(const NodeList<std::string>& content, bool reth } } -void Interpreter::executeContent(const NodeSet<std::string>& content, bool rethrow) { +void InterpreterImpl::executeContent(const NodeSet<std::string>& content, bool rethrow) { for (unsigned int i = 0; i < content.size(); i++) { if (content[i].getNodeType() != Node_base::ELEMENT_NODE) continue; @@ -1043,7 +1028,7 @@ void Interpreter::executeContent(const NodeSet<std::string>& content, bool rethr } } -void Interpreter::executeContent(const Arabica::DOM::Node<std::string>& content, bool rethrow) { +void InterpreterImpl::executeContent(const Arabica::DOM::Node<std::string>& content, bool rethrow) { if (content.getNodeType() != Node_base::ELEMENT_NODE) return; @@ -1258,7 +1243,7 @@ void Interpreter::executeContent(const Arabica::DOM::Node<std::string>& content, } } -void Interpreter::returnDoneEvent(const Arabica::DOM::Node<std::string>& state) { +void InterpreterImpl::returnDoneEvent(const Arabica::DOM::Node<std::string>& state) { if (_parentQueue != NULL) { Event done; done.name = "done.invoke." + _sessionId; @@ -1266,7 +1251,7 @@ void Interpreter::returnDoneEvent(const Arabica::DOM::Node<std::string>& state) } } -bool Interpreter::parentIsScxmlState(Arabica::DOM::Node<std::string> state) { +bool InterpreterImpl::parentIsScxmlState(const Arabica::DOM::Node<std::string>& state) { Arabica::DOM::Element<std::string> stateElem = (Arabica::DOM::Element<std::string>)state; Arabica::DOM::Element<std::string> parentElem = (Arabica::DOM::Element<std::string>)state.getParentNode(); if (boost::iequals(TAGNAME(parentElem), _xmlNSPrefix + "scxml")) @@ -1274,7 +1259,7 @@ bool Interpreter::parentIsScxmlState(Arabica::DOM::Node<std::string> state) { return false; } -bool Interpreter::isInFinalState(const Arabica::DOM::Node<std::string>& state) { +bool InterpreterImpl::isInFinalState(const Arabica::DOM::Node<std::string>& state) { if (isCompound(state)) { Arabica::XPath::NodeSet<std::string> childs = getChildStates(state); for (int i = 0; i < childs.size(); i++) { @@ -1292,7 +1277,7 @@ bool Interpreter::isInFinalState(const Arabica::DOM::Node<std::string>& state) { return false; } -bool Interpreter::isMember(const Arabica::DOM::Node<std::string>& node, const Arabica::XPath::NodeSet<std::string>& set) { +bool InterpreterImpl::isMember(const Arabica::DOM::Node<std::string>& node, const Arabica::XPath::NodeSet<std::string>& set) { for (int i = 0; i < set.size(); i++) { if (set[i] == node) return true; @@ -1300,7 +1285,7 @@ bool Interpreter::isMember(const Arabica::DOM::Node<std::string>& node, const Ar return false; } -Arabica::XPath::NodeSet<std::string> Interpreter::getChildStates(const Arabica::DOM::Node<std::string>& state) { +Arabica::XPath::NodeSet<std::string> InterpreterImpl::getChildStates(const Arabica::DOM::Node<std::string>& state) { Arabica::XPath::NodeSet<std::string> childs; Arabica::DOM::NodeList<std::string> childElems = state.getChildNodes(); @@ -1312,7 +1297,7 @@ Arabica::XPath::NodeSet<std::string> Interpreter::getChildStates(const Arabica:: return childs; } -Arabica::DOM::Node<std::string> Interpreter::getParentState(const Arabica::DOM::Node<std::string>& element) { +Arabica::DOM::Node<std::string> InterpreterImpl::getParentState(const Arabica::DOM::Node<std::string>& element) { Arabica::DOM::Node<std::string> parent = element.getParentNode(); while(parent && !isState(parent)) { parent = parent.getParentNode(); @@ -1320,7 +1305,7 @@ Arabica::DOM::Node<std::string> Interpreter::getParentState(const Arabica::DOM:: return parent; } -Arabica::DOM::Node<std::string> Interpreter::getAncestorElement(const Arabica::DOM::Node<std::string>& node, const std::string tagName) { +Arabica::DOM::Node<std::string> InterpreterImpl::getAncestorElement(const Arabica::DOM::Node<std::string>& node, const std::string tagName) { Arabica::DOM::Node<std::string> parent = node.getParentNode(); while(parent) { if (parent.getNodeType() == Node_base::ELEMENT_NODE && @@ -1340,7 +1325,7 @@ Arabica::DOM::Node<std::string> Interpreter::getAncestorElement(const Arabica::D we are speaking of proper ancestor (parent or parent of a parent, etc.) the LCCA is never a member of stateList. */ -Arabica::DOM::Node<std::string> Interpreter::findLCCA(const Arabica::XPath::NodeSet<std::string>& states) { +Arabica::DOM::Node<std::string> InterpreterImpl::findLCCA(const Arabica::XPath::NodeSet<std::string>& states) { #if 0 std::cout << "findLCCA: "; for (int i = 0; i < states.size(); i++) { @@ -1378,7 +1363,7 @@ NEXT_ANCESTOR: return ancestor; } -Arabica::XPath::NodeSet<std::string> Interpreter::getStates(const std::vector<std::string>& stateIds) { +Arabica::XPath::NodeSet<std::string> InterpreterImpl::getStates(const std::vector<std::string>& stateIds) { Arabica::XPath::NodeSet<std::string> states; std::vector<std::string>::const_iterator tokenIter = stateIds.begin(); while(tokenIter != stateIds.end()) { @@ -1388,7 +1373,7 @@ Arabica::XPath::NodeSet<std::string> Interpreter::getStates(const std::vector<st return states; } -Arabica::DOM::Node<std::string> Interpreter::getState(const std::string& stateId) { +Arabica::DOM::Node<std::string> InterpreterImpl::getState(const std::string& stateId) { if (_cachedStates.find(stateId) != _cachedStates.end()) { return _cachedStates[stateId]; @@ -1426,7 +1411,7 @@ FOUND: return Arabica::DOM::Node<std::string>(); } -Arabica::DOM::Node<std::string> Interpreter::getSourceState(const Arabica::DOM::Node<std::string>& transition) { +Arabica::DOM::Node<std::string> InterpreterImpl::getSourceState(const Arabica::DOM::Node<std::string>& transition) { if (boost::iequals(TAGNAME(transition.getParentNode()), _xmlNSPrefix + "initial")) return transition.getParentNode().getParentNode(); return transition.getParentNode(); @@ -1439,7 +1424,7 @@ Arabica::DOM::Node<std::string> Interpreter::getSourceState(const Arabica::DOM:: * attribute nor an <initial> element is specified, the SCXML Processor must use * the first child state in document order as the default initial state. */ -Arabica::XPath::NodeSet<std::string> Interpreter::getInitialStates(Arabica::DOM::Node<std::string> state) { +Arabica::XPath::NodeSet<std::string> InterpreterImpl::getInitialStates(Arabica::DOM::Node<std::string> state) { if (!state) { state = _scxml; } @@ -1477,7 +1462,7 @@ Arabica::XPath::NodeSet<std::string> Interpreter::getInitialStates(Arabica::DOM: return Arabica::XPath::NodeSet<std::string>(); } -NodeSet<std::string> Interpreter::getTargetStates(const Arabica::DOM::Node<std::string>& transition) { +NodeSet<std::string> InterpreterImpl::getTargetStates(const Arabica::DOM::Node<std::string>& transition) { NodeSet<std::string> targetStates; assert(boost::iequals(LOCALNAME(transition), "transition")); @@ -1495,7 +1480,7 @@ NodeSet<std::string> Interpreter::getTargetStates(const Arabica::DOM::Node<std:: std::string targetId = ((Arabica::DOM::Element<std::string>)transition).getAttribute("target"); - std::vector<std::string> targetIds = Interpreter::tokenizeIdRefs(ATTR(transition, "target")); + std::vector<std::string> targetIds = InterpreterImpl::tokenizeIdRefs(ATTR(transition, "target")); for (int i = 0; i < targetIds.size(); i++) { Arabica::DOM::Node<std::string> state = getState(targetIds[i]); assert(HAS_ATTR(state, "id")); @@ -1504,7 +1489,7 @@ NodeSet<std::string> Interpreter::getTargetStates(const Arabica::DOM::Node<std:: return targetStates; } -std::vector<std::string> Interpreter::tokenizeIdRefs(const std::string& idRefs) { +std::vector<std::string> InterpreterImpl::tokenizeIdRefs(const std::string& idRefs) { std::vector<std::string> ids; if (idRefs.length() > 0) { @@ -1518,7 +1503,7 @@ std::vector<std::string> Interpreter::tokenizeIdRefs(const std::string& idRefs) return ids; } -NodeSet<std::string> Interpreter::filterChildElements(const std::string& tagName, const NodeSet<std::string>& nodeSet) { +NodeSet<std::string> InterpreterImpl::filterChildElements(const std::string& tagName, const NodeSet<std::string>& nodeSet) { NodeSet<std::string> filteredChildElems; for (unsigned int i = 0; i < nodeSet.size(); i++) { filteredChildElems.push_back(filterChildElements(tagName, nodeSet[i])); @@ -1526,7 +1511,7 @@ NodeSet<std::string> Interpreter::filterChildElements(const std::string& tagName return filteredChildElems; } -NodeSet<std::string> Interpreter::filterChildElements(const std::string& tagName, const Node<std::string>& node) { +NodeSet<std::string> InterpreterImpl::filterChildElements(const std::string& tagName, const Node<std::string>& node) { NodeSet<std::string> filteredChildElems; NodeList<std::string> childs = node.getChildNodes(); for (unsigned int i = 0; i < childs.getLength(); i++) { @@ -1538,7 +1523,7 @@ NodeSet<std::string> Interpreter::filterChildElements(const std::string& tagName return filteredChildElems; } -NodeSet<std::string> Interpreter::getProperAncestors(const Arabica::DOM::Node<std::string>& s1, +NodeSet<std::string> InterpreterImpl::getProperAncestors(const Arabica::DOM::Node<std::string>& s1, const Arabica::DOM::Node<std::string>& s2) { NodeSet<std::string> ancestors; if (isState(s1)) { @@ -1558,8 +1543,8 @@ NodeSet<std::string> Interpreter::getProperAncestors(const Arabica::DOM::Node<st return ancestors; } -bool Interpreter::isDescendant(const Arabica::DOM::Node<std::string>& s1, - const Arabica::DOM::Node<std::string>& s2) { +bool InterpreterImpl::isDescendant(const Arabica::DOM::Node<std::string>& s1, + const Arabica::DOM::Node<std::string>& s2) { Arabica::DOM::Node<std::string> parent = s1.getParentNode(); while(parent) { if (s2 == parent) @@ -1569,7 +1554,7 @@ bool Interpreter::isDescendant(const Arabica::DOM::Node<std::string>& s1, return false; } -bool Interpreter::isTargetless(const Arabica::DOM::Node<std::string>& transition) { +bool InterpreterImpl::isTargetless(const Arabica::DOM::Node<std::string>& transition) { if (transition.hasAttributes()) { if (((Arabica::DOM::Element<std::string>)transition).hasAttribute("target")) return false; @@ -1577,7 +1562,7 @@ bool Interpreter::isTargetless(const Arabica::DOM::Node<std::string>& transition return true; } -bool Interpreter::isState(const Arabica::DOM::Node<std::string>& state) { +bool InterpreterImpl::isState(const Arabica::DOM::Node<std::string>& state) { if (!state) return false; if (state.getNodeType() != Arabica::DOM::Node_base::ELEMENT_NODE) @@ -1597,7 +1582,7 @@ bool Interpreter::isState(const Arabica::DOM::Node<std::string>& state) { return false; } -bool Interpreter::isFinal(const Arabica::DOM::Node<std::string>& state) { +bool InterpreterImpl::isFinal(const Arabica::DOM::Node<std::string>& state) { std::string tagName = LOCALNAME(state); if (boost::iequals("final", tagName)) return true; @@ -1606,7 +1591,7 @@ bool Interpreter::isFinal(const Arabica::DOM::Node<std::string>& state) { return false; } -bool Interpreter::isInitial(const Arabica::DOM::Node<std::string>& state) { +bool InterpreterImpl::isInitial(const Arabica::DOM::Node<std::string>& state) { if (!isState(state)) return false; @@ -1620,7 +1605,7 @@ bool Interpreter::isInitial(const Arabica::DOM::Node<std::string>& state) { return false; } -bool Interpreter::isPseudoState(const Arabica::DOM::Node<std::string>& state) { +bool InterpreterImpl::isPseudoState(const Arabica::DOM::Node<std::string>& state) { std::string tagName = LOCALNAME(state); if (boost::iequals("initial", tagName)) return true; @@ -1629,11 +1614,11 @@ bool Interpreter::isPseudoState(const Arabica::DOM::Node<std::string>& state) { return false; } -bool Interpreter::isTransitionTarget(const Arabica::DOM::Node<std::string>& elem) { +bool InterpreterImpl::isTransitionTarget(const Arabica::DOM::Node<std::string>& elem) { return (isState(elem) || boost::iequals(LOCALNAME(elem), "history")); } -bool Interpreter::isAtomic(const Arabica::DOM::Node<std::string>& state) { +bool InterpreterImpl::isAtomic(const Arabica::DOM::Node<std::string>& state) { if (boost::iequals("final", LOCALNAME(state))) return true; @@ -1648,13 +1633,13 @@ bool Interpreter::isAtomic(const Arabica::DOM::Node<std::string>& state) { return true; } -bool Interpreter::isHistory(const Arabica::DOM::Node<std::string>& state) { +bool InterpreterImpl::isHistory(const Arabica::DOM::Node<std::string>& state) { if (boost::iequals("history", LOCALNAME(state))) return true; return false; } -bool Interpreter::isParallel(const Arabica::DOM::Node<std::string>& state) { +bool InterpreterImpl::isParallel(const Arabica::DOM::Node<std::string>& state) { if (!isState(state)) return false; if (boost::iequals("parallel", LOCALNAME(state))) @@ -1663,7 +1648,7 @@ bool Interpreter::isParallel(const Arabica::DOM::Node<std::string>& state) { } -bool Interpreter::isCompound(const Arabica::DOM::Node<std::string>& state) { +bool InterpreterImpl::isCompound(const Arabica::DOM::Node<std::string>& state) { if (!isState(state)) return false; @@ -1678,7 +1663,7 @@ bool Interpreter::isCompound(const Arabica::DOM::Node<std::string>& state) { return false; } -void Interpreter::setupIOProcessors() { +void InterpreterImpl::setupIOProcessors() { tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); std::map<std::string, IOProcessorImpl*>::iterator ioProcIter = Factory::getInstance()->_ioProcessors.begin(); while(ioProcIter != Factory::getInstance()->_ioProcessors.end()) { @@ -1723,7 +1708,7 @@ void Interpreter::setupIOProcessors() { } } -IOProcessor Interpreter::getIOProcessor(const std::string& type) { +IOProcessor InterpreterImpl::getIOProcessor(const std::string& type) { tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); if (_ioProcessors.find(type) == _ioProcessors.end()) { LOG(ERROR) << "No ioProcessor known for type " << type; @@ -1732,7 +1717,7 @@ IOProcessor Interpreter::getIOProcessor(const std::string& type) { return _ioProcessors[type]; } -void Interpreter::setCmdLineOptions(int argc, char** argv) { +void InterpreterImpl::setCmdLineOptions(int argc, char** argv) { char* key = NULL; char* value = NULL; for (int i = 0; i < argc; i++) { @@ -1758,7 +1743,7 @@ void Interpreter::setCmdLineOptions(int argc, char** argv) { /** * See: http://www.w3.org/TR/scxml/#LegalStateConfigurations */ -bool Interpreter::hasLegalConfiguration() { +bool InterpreterImpl::hasLegalConfiguration() { #if 0 std::cout << "Checking whether {"; @@ -1841,7 +1826,7 @@ bool Interpreter::hasLegalConfiguration() { return true; } -void Interpreter::dump() { +void InterpreterImpl::dump() { if (!_document) return; std::cout << _document; diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h index c2e24fa..6701eff 100644 --- a/src/uscxml/Interpreter.h +++ b/src/uscxml/Interpreter.h @@ -29,20 +29,7 @@ namespace uscxml { class HTTPServletInvoker; - -class InterpreterMonitor { -public: - virtual ~InterpreterMonitor() {} - virtual void onStableConfiguration(Interpreter* interpreter) {} - virtual void beforeCompletion(Interpreter* interpreter) {} - virtual void afterCompletion(Interpreter* interpreter) {} - virtual void beforeMicroStep(Interpreter* interpreter) {} - virtual void beforeTakingTransitions(Interpreter* interpreter, const Arabica::XPath::NodeSet<std::string>& transitions) {} - virtual void beforeEnteringStates(Interpreter* interpreter, const Arabica::XPath::NodeSet<std::string>& statesToEnter) {} - virtual void afterEnteringStates(Interpreter* interpreter) {} - virtual void beforeExitingStates(Interpreter* interpreter, const Arabica::XPath::NodeSet<std::string>& statesToExit) {} - virtual void afterExitingStates(Interpreter* interpreter) {} -}; +class InterpreterMonitor; class NumAttr { public: @@ -71,32 +58,28 @@ public: class SCXMLParser : public Arabica::SAX2DOM::Parser<std::string> { public: - SCXMLParser(Interpreter* interpreter); + SCXMLParser(InterpreterImpl* interpreter); void startPrefixMapping(const std::string& /* prefix */, const std::string& /* uri */); Arabica::SAX::CatchErrorHandler<std::string> _errorHandler; - Interpreter* _interpreter; + InterpreterImpl* _interpreter; }; -class Interpreter { +enum Capabilities { + CAN_NOTHING = 0, + CAN_BASIC_HTTP = 1, + CAN_GENERIC_HTTP = 2, +}; + +class InterpreterImpl : public boost::enable_shared_from_this<InterpreterImpl> { public: + enum Binding { EARLY = 0, LATE = 1 }; - enum Capabilities { - CAN_NOTHING = 0, - CAN_BASIC_HTTP = 1, - CAN_GENERIC_HTTP = 2, - }; - - virtual ~Interpreter(); - - static Interpreter* fromDOM(const Arabica::DOM::Document<std::string>& dom); - static Interpreter* fromXML(const std::string& xml); - static Interpreter* fromURI(const std::string& uri); - static Interpreter* fromInputSource(Arabica::SAX::InputSource<std::string>& source); + virtual ~InterpreterImpl(); void start(); static void run(void*); @@ -202,6 +185,10 @@ public: return _ioProcessors; } + const std::map<std::string, Invoker>& getInvokers() { + return _invokers; + } + bool runOnMainThread(int fps, bool blocking = true); static bool isMember(const Arabica::DOM::Node<std::string>& node, const Arabica::XPath::NodeSet<std::string>& set); @@ -237,7 +224,7 @@ public: static const std::string getUUID(); protected: - Interpreter(); + InterpreterImpl(); void init(); void normalize(Arabica::DOM::Element<std::string>& scxml); @@ -261,7 +248,7 @@ protected: bool _running; bool _done; bool _isInitialized; - Binding _binding; + InterpreterImpl::Binding _binding; Arabica::XPath::NodeSet<std::string> _configuration; Arabica::XPath::NodeSet<std::string> _statesToInvoke; std::vector<std::string> _userDefinedStartConfiguration; @@ -298,7 +285,7 @@ protected: static bool nameMatch(const std::string& transitionEvent, const std::string& event); bool hasConditionMatch(const Arabica::DOM::Node<std::string>& conditional); bool isInFinalState(const Arabica::DOM::Node<std::string>& state); - bool parentIsScxmlState(Arabica::DOM::Node<std::string> state); + bool parentIsScxmlState(const Arabica::DOM::Node<std::string>& state); static boost::uuids::random_generator uuidGen; @@ -312,7 +299,7 @@ protected: IOProcessor getIOProcessor(const std::string& type); std::map<std::string, IOProcessor> _ioProcessors; - std::map<std::string, std::pair<Interpreter*, SendRequest> > _sendIds; + std::map<std::string, std::pair<InterpreterImpl*, SendRequest> > _sendIds; std::map<std::string, Invoker> _invokers; std::map<std::string, Invoker> _autoForwardees; std::map<Arabica::DOM::Node<std::string>, ExecutableContent> _executableContent; @@ -323,6 +310,282 @@ protected: friend class SCXMLParser; friend class USCXMLInvoker; + friend class SCXMLIOProcessor; + friend class Interpreter; +}; + +class Interpreter { +public: + static Interpreter fromDOM(const Arabica::DOM::Document<std::string>& dom); + static Interpreter fromXML(const std::string& xml); + static Interpreter fromURI(const std::string& uri); + static Interpreter fromInputSource(Arabica::SAX::InputSource<std::string>& source); + + Interpreter() : _impl() {} + Interpreter(boost::shared_ptr<InterpreterImpl> const impl) : _impl(impl) { } + Interpreter(const Interpreter& other) : _impl(other._impl) { } + virtual ~Interpreter() {}; + + operator bool() const { + return _impl; + } + bool operator< (const Interpreter& other) const { + return _impl < other._impl; + } + bool operator==(const Interpreter& other) const { + return _impl == other._impl; + } + bool operator!=(const Interpreter& other) const { + return _impl != other._impl; + } + Interpreter& operator= (const Interpreter& other) { + _impl = other._impl; + return *this; + } + + void start() { + return _impl->start(); + } + void join() { + return _impl->join(); + }; + bool isRunning() { + return _impl->isRunning(); + } + + void interpret() { + _impl->interpret(); + }; + + void addMonitor(InterpreterMonitor* monitor) { + return _impl->addMonitor(monitor); + } + + void removeMonitor(InterpreterMonitor* monitor) { + return _impl->removeMonitor(monitor); + } + + void setBaseURI(std::string baseURI) { + return _impl->setBaseURI(baseURI); + } + URL getBaseURI() { + return _impl->getBaseURI(); + } + bool toAbsoluteURI(URL& uri) { + return _impl->toAbsoluteURI(uri); + } + + void setCmdLineOptions(int argc, char** argv) { + return _impl->setCmdLineOptions(argc, argv); + } + Data getCmdLineOptions() { + return _impl->getCmdLineOptions(); + } + + InterpreterServlet* getHTTPServlet() { + return _impl->getHTTPServlet(); + } + + DataModel getDataModel() { + return _impl->getDataModel(); + } + void setParentQueue(uscxml::concurrency::BlockingQueue<SendRequest>* parentQueue) { + return _impl->setParentQueue(parentQueue); + } + std::string getXPathPrefix() { + return _impl->getXPathPrefix(); + } + std::string getXMLPrefix() { + return _impl->getXMLPrefix(); + } + Arabica::XPath::StandardNamespaceContext<std::string>& getNSContext() { + return _impl->getNSContext(); + } + std::string getXMLPrefixForNS(const std::string& ns) { + return _impl->getXMLPrefixForNS(ns); + } + + void inline receiveInternal(const Event& event) { + return _impl->receiveInternal(event); + } + void receive(const Event& event, bool toFront = false) { + return _impl->receive(event, toFront); + } + + Event getCurrentEvent() { + return _impl->getCurrentEvent(); + } + + Arabica::XPath::NodeSet<std::string> getConfiguration() { + return _impl->getConfiguration(); + } + void setConfiguration(const std::vector<std::string>& states) { + return _impl->setConfiguration(states); + } + void setInvokeRequest(const InvokeRequest& req) { + return _impl->setInvokeRequest(req); + } + + Arabica::DOM::Node<std::string> getState(const std::string& stateId) { + return _impl->getState(stateId); + } + Arabica::XPath::NodeSet<std::string> getStates(const std::vector<std::string>& stateIds) { + return _impl->getStates(stateIds); + } + + Arabica::DOM::Document<std::string>& getDocument() { + return _impl->getDocument(); + } + + void setCapabilities(unsigned int capabilities) { + return _impl->setCapabilities(capabilities); + } + + void setName(const std::string& name) { + return _impl->setName(name); + } + + const std::string& getName() { + return _impl->getName(); + } + const std::string& getSessionId() { + return _impl->getSessionId(); + } + + const std::map<std::string, IOProcessor>& getIOProcessors() { + return _impl->getIOProcessors(); + } + + const std::map<std::string, Invoker>& getInvokers() { + return _impl->getInvokers(); + } + + bool runOnMainThread(int fps, bool blocking = true) { + return _impl->runOnMainThread(fps, blocking); + } + + static bool isMember(const Arabica::DOM::Node<std::string>& node, const Arabica::XPath::NodeSet<std::string>& set) { + return InterpreterImpl::isMember(node, set); + } + + void dump() { + return _impl->dump(); + } + bool hasLegalConfiguration() { + return _impl->hasLegalConfiguration(); + } + + static bool isState(const Arabica::DOM::Node<std::string>& state) { + return InterpreterImpl::isState(state); + } + static bool isPseudoState(const Arabica::DOM::Node<std::string>& state) { + return InterpreterImpl::isPseudoState(state); + } + static bool isTransitionTarget(const Arabica::DOM::Node<std::string>& elem) { + return InterpreterImpl::isTransitionTarget(elem); + } + static bool isTargetless(const Arabica::DOM::Node<std::string>& transition) { + return InterpreterImpl::isTargetless(transition); + } + static bool isAtomic(const Arabica::DOM::Node<std::string>& state) { + return InterpreterImpl::isAtomic(state); + } + static bool isFinal(const Arabica::DOM::Node<std::string>& state) { + return InterpreterImpl::isFinal(state); + } + static bool isHistory(const Arabica::DOM::Node<std::string>& state) { + return InterpreterImpl::isHistory(state); + } + static bool isParallel(const Arabica::DOM::Node<std::string>& state) { + return InterpreterImpl::isParallel(state); + } + static bool isCompound(const Arabica::DOM::Node<std::string>& state) { + return InterpreterImpl::isCompound(state); + } + static bool isDescendant(const Arabica::DOM::Node<std::string>& s1, const Arabica::DOM::Node<std::string>& s2) { + return InterpreterImpl::isDescendant(s1, s2); + } + + static std::vector<std::string> tokenizeIdRefs(const std::string& idRefs) { + return InterpreterImpl::tokenizeIdRefs(idRefs); + } + + bool isInitial(const Arabica::DOM::Node<std::string>& state) { + return _impl->isInitial(state); + } + Arabica::XPath::NodeSet<std::string> getInitialStates(Arabica::DOM::Node<std::string> state = Arabica::DOM::Node<std::string>()) { + return _impl->getInitialStates(state); + } + static Arabica::XPath::NodeSet<std::string> getChildStates(const Arabica::DOM::Node<std::string>& state) { + return InterpreterImpl::getChildStates(state); + } + static Arabica::DOM::Node<std::string> getParentState(const Arabica::DOM::Node<std::string>& element) { + return InterpreterImpl::getParentState(element); + } + static Arabica::DOM::Node<std::string> getAncestorElement(const Arabica::DOM::Node<std::string>& node, const std::string tagName) { + return InterpreterImpl::getAncestorElement(node, tagName); + } + Arabica::XPath::NodeSet<std::string> getTargetStates(const Arabica::DOM::Node<std::string>& transition) { + return _impl->getTargetStates(transition); + } + Arabica::DOM::Node<std::string> getSourceState(const Arabica::DOM::Node<std::string>& transition) { + return _impl->getSourceState(transition); + } + + static Arabica::XPath::NodeSet<std::string> filterChildElements(const std::string& tagname, const Arabica::DOM::Node<std::string>& node) { + return InterpreterImpl::filterChildElements(tagname, node); + } + static Arabica::XPath::NodeSet<std::string> filterChildElements(const std::string& tagName, const Arabica::XPath::NodeSet<std::string>& nodeSet) { + return InterpreterImpl::filterChildElements(tagName, nodeSet); + } + Arabica::DOM::Node<std::string> findLCCA(const Arabica::XPath::NodeSet<std::string>& states) { + return _impl->findLCCA(states); + } + Arabica::XPath::NodeSet<std::string> getProperAncestors(const Arabica::DOM::Node<std::string>& s1, const Arabica::DOM::Node<std::string>& s2) { + return _impl->getProperAncestors(s1, s2); + } + static const std::string getUUID() { + return InterpreterImpl::getUUID(); + } + +#ifndef SWIG + boost::shared_ptr<InterpreterImpl> getImpl() { + return _impl; + } + + static std::map<std::string, boost::weak_ptr<InterpreterImpl> > getInstances() { + tthread::lock_guard<tthread::recursive_mutex> lock(_instanceMutex); + std::map<std::string, boost::weak_ptr<InterpreterImpl> >::iterator instIter = _instances.begin(); + while(instIter != _instances.end()) { + if (!instIter->second.lock()) { + _instances.erase(instIter++); + } else { + instIter++; + } + } + return _instances; + } + +#endif + +protected: + boost::shared_ptr<InterpreterImpl> _impl; + static std::map<std::string, boost::weak_ptr<InterpreterImpl> > _instances; + static tthread::recursive_mutex _instanceMutex; +}; + +class InterpreterMonitor { +public: + virtual ~InterpreterMonitor() {} + virtual void onStableConfiguration(Interpreter interpreter) {} + virtual void beforeCompletion(Interpreter interpreter) {} + virtual void afterCompletion(Interpreter interpreter) {} + virtual void beforeMicroStep(Interpreter interpreter) {} + virtual void beforeTakingTransitions(Interpreter interpreter, const Arabica::XPath::NodeSet<std::string>& transitions) {} + virtual void beforeEnteringStates(Interpreter interpreter, const Arabica::XPath::NodeSet<std::string>& statesToEnter) {} + virtual void afterEnteringStates(Interpreter interpreter) {} + virtual void beforeExitingStates(Interpreter interpreter, const Arabica::XPath::NodeSet<std::string>& statesToExit) {} + virtual void afterExitingStates(Interpreter interpreter) {} }; } diff --git a/src/uscxml/Message.h b/src/uscxml/Message.h index ae88225..72a2a99 100644 --- a/src/uscxml/Message.h +++ b/src/uscxml/Message.h @@ -81,7 +81,7 @@ protected: protected: Arabica::DOM::Document<std::string> toNode(const Arabica::DOM::Document<std::string>& factory, const Data& data); -#ifndef SWIGJAVA +#ifndef SWIG friend std::ostream& operator<< (std::ostream& os, const Data& data); #endif }; diff --git a/src/uscxml/debug/SCXMLDotWriter.h b/src/uscxml/debug/SCXMLDotWriter.h index e6e2215..0666aa5 100644 --- a/src/uscxml/debug/SCXMLDotWriter.h +++ b/src/uscxml/debug/SCXMLDotWriter.h @@ -18,10 +18,10 @@ public: std::string content; }; - SCXMLDotWriter(Interpreter* interpreter); + SCXMLDotWriter(InterpreterImpl* interpreter); ~SCXMLDotWriter(); - static void toDot(const std::string& filename, Interpreter* interpreter); + static void toDot(const std::string& filename, InterpreterImpl* interpreter); void writeSCXMLElement(std::ostream& os, const Arabica::DOM::Element<std::string>& elem); void writeStateElement(std::ostream& os, const Arabica::DOM::Element<std::string>& elem); void writeTransitionElement(std::ostream& os, const Arabica::DOM::Element<std::string>& elem); diff --git a/src/uscxml/interpreter/InterpreterDraft6.cpp b/src/uscxml/interpreter/InterpreterDraft6.cpp index 2f05be9..3c97805 100644 --- a/src/uscxml/interpreter/InterpreterDraft6.cpp +++ b/src/uscxml/interpreter/InterpreterDraft6.cpp @@ -19,8 +19,8 @@ void InterpreterDraft6::interpret() { } // dump(); - if (_sessionId.length() == 0) - _sessionId = getUUID(); + // just make sure we have a session id + assert(_sessionId.length() > 0); std::string datamodelName; if (datamodelName.length() == 0 && HAS_ATTR(_scxml, "datamodel")) @@ -137,7 +137,7 @@ void InterpreterDraft6::mainEventLoop() { monIter = _monitors.begin(); while(monIter != _monitors.end()) { try { - (*monIter)->beforeMicroStep(this); + (*monIter)->beforeMicroStep(shared_from_this()); } catch (Event e) { LOG(ERROR) << "Syntax error when calling beforeMicroStep on monitors: " << std::endl << e << std::endl; } catch (...) { @@ -165,7 +165,7 @@ void InterpreterDraft6::mainEventLoop() { monIter = _monitors.begin(); while(monIter != _monitors.end()) { try { - (*monIter)->beforeTakingTransitions(this, enabledTransitions); + (*monIter)->beforeTakingTransitions(shared_from_this(), enabledTransitions); } catch (Event e) { LOG(ERROR) << "Syntax error when calling beforeTakingTransitions on monitors: " << std::endl << e << std::endl; } catch (...) { @@ -197,7 +197,7 @@ void InterpreterDraft6::mainEventLoop() { // if (!_sendQueue || _sendQueue->isEmpty()) { while(monIter != _monitors.end()) { try { - (*monIter)->onStableConfiguration(this); + (*monIter)->onStableConfiguration(shared_from_this()); } catch (Event e) { LOG(ERROR) << "Syntax error when calling onStableConfiguration on monitors: " << std::endl << e << std::endl; } catch (...) { @@ -276,7 +276,7 @@ EXIT_INTERPRETER: monIter = _monitors.begin(); while(monIter != _monitors.end()) { try { - (*monIter)->beforeCompletion(this); + (*monIter)->beforeCompletion(shared_from_this()); } catch (Event e) { LOG(ERROR) << "Syntax error when calling beforeCompletion on monitors: " << std::endl << e << std::endl; } catch (...) { @@ -287,7 +287,7 @@ EXIT_INTERPRETER: exitInterpreter(); if (_sendQueue) { - std::map<std::string, std::pair<Interpreter*, SendRequest> >::iterator sendIter = _sendIds.begin(); + std::map<std::string, std::pair<InterpreterImpl*, SendRequest> >::iterator sendIter = _sendIds.begin(); while(sendIter != _sendIds.end()) { _sendQueue->cancelEvent(sendIter->first); sendIter++; @@ -297,7 +297,7 @@ EXIT_INTERPRETER: monIter = _monitors.begin(); while(monIter != _monitors.end()) { try { - (*monIter)->afterCompletion(this); + (*monIter)->afterCompletion(shared_from_this()); } catch (Event e) { LOG(ERROR) << "Syntax error when calling afterCompletion on monitors: " << std::endl << e << std::endl; } catch (...) { @@ -343,10 +343,10 @@ Arabica::XPath::NodeSet<std::string> InterpreterDraft6::selectTransitions(const states.push_back(parent); } } - LOOP: +LOOP: index++; } - + #if 0 std::cout << "Enabled transitions: " << std::endl; for (int i = 0; i < enabledTransitions.size(); i++) { @@ -354,7 +354,7 @@ Arabica::XPath::NodeSet<std::string> InterpreterDraft6::selectTransitions(const } std::cout << std::endl; #endif - + enabledTransitions = filterPreempted(enabledTransitions); return enabledTransitions; } @@ -373,9 +373,9 @@ bool InterpreterDraft6::isEnabledTransition(const Node<std::string>& transition, } else { return false; } - + std::vector<std::string> eventNames = tokenizeIdRefs(eventName); - + if (eventNames.size() > 0 && hasConditionMatch(transition)) { std::vector<std::string>::iterator eventIter = eventNames.begin(); while(eventIter != eventNames.end()) { @@ -387,7 +387,7 @@ bool InterpreterDraft6::isEnabledTransition(const Node<std::string>& transition, } return false; } - + Arabica::XPath::NodeSet<std::string> InterpreterDraft6::selectEventlessTransitions() { Arabica::XPath::NodeSet<std::string> enabledTransitions; @@ -423,7 +423,7 @@ Arabica::XPath::NodeSet<std::string> InterpreterDraft6::selectEventlessTransitio states.push_back(parent); } } - LOOP: +LOOP: index++; } @@ -451,7 +451,7 @@ Arabica::XPath::NodeSet<std::string> InterpreterDraft6::filterPreempted(const Ar if (isPreemptingTransition(t2, t)) { #if 0 std::cout << "#####" << std::endl << "Transition " << std::endl - << t2 << std::endl << " preempts " << std::endl << t << std::endl << "#####" << std::endl; + << t2 << std::endl << " preempts " << std::endl << t << std::endl << "#####" << std::endl; #endif goto LOOP; } @@ -500,7 +500,7 @@ bool InterpreterDraft6::isCrossingBounds(const Node<std::string>& transition) { bool InterpreterDraft6::isWithinParallel(const Node<std::string>& transition) { if (isTargetless(transition)) return false; - + Node<std::string> source; if (HAS_ATTR(transition, "type") && boost::iequals(ATTR(transition, "type"), "internal")) { source = getSourceState(transition); @@ -509,7 +509,7 @@ bool InterpreterDraft6::isWithinParallel(const Node<std::string>& transition) { } NodeSet<std::string> targets = getTargetStates(transition); targets.push_back(source); - + Node<std::string> lcpa = findLCPA(targets); return lcpa; } @@ -526,7 +526,7 @@ Node<std::string> InterpreterDraft6::findLCPA(const Arabica::XPath::NodeSet<std: } ancestor = ancestors[i]; break; - NEXT_ANCESTOR: +NEXT_ANCESTOR: ; } return ancestor; @@ -619,7 +619,7 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e for (int j = 0; j < _configuration.size(); j++) { if (isDescendant(_configuration[j], ancestor)) statesToExit.push_back(_configuration[j]); - } + } } } // remove statesToExit from _statesToInvoke @@ -642,11 +642,11 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e } std::cout << std::endl; #endif - + monIter = _monitors.begin(); while(monIter != _monitors.end()) { try { - (*monIter)->beforeExitingStates(this, statesToExit); + (*monIter)->beforeExitingStates(shared_from_this(), statesToExit); } catch (Event e) { LOG(ERROR) << "Syntax error when calling beforeExitingStates on monitors: " << std::endl << e << std::endl; } catch (...) { @@ -707,7 +707,7 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e monIter = _monitors.begin(); while(monIter != _monitors.end()) { try { - (*monIter)->afterExitingStates(this); + (*monIter)->afterExitingStates(shared_from_this()); } catch (Event e) { LOG(ERROR) << "Syntax error when calling afterExitingStates on monitors: " << std::endl << e << std::endl; } catch (...) { @@ -824,7 +824,7 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>& monIter = _monitors.begin(); while(monIter != _monitors.end()) { try { - (*monIter)->beforeEnteringStates(this, statesToEnter); + (*monIter)->beforeEnteringStates(shared_from_this(), statesToEnter); } catch (Event e) { LOG(ERROR) << "Syntax error when calling beforeEnteringStates on monitors: " << std::endl << e << std::endl; } catch (...) { @@ -891,7 +891,7 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>& monIter = _monitors.begin(); while(monIter != _monitors.end()) { try { - (*monIter)->afterEnteringStates(this); + (*monIter)->afterEnteringStates(shared_from_this()); } catch (Event e) { LOG(ERROR) << "Syntax error when calling afterEnteringStates on monitors: " << std::endl << e << std::endl; } catch (...) { diff --git a/src/uscxml/interpreter/InterpreterDraft6.h b/src/uscxml/interpreter/InterpreterDraft6.h index 9ecfd3b..36dedce 100644 --- a/src/uscxml/interpreter/InterpreterDraft6.h +++ b/src/uscxml/interpreter/InterpreterDraft6.h @@ -5,7 +5,7 @@ namespace uscxml { -class InterpreterDraft6 : public Interpreter { +class InterpreterDraft6 : public InterpreterImpl { protected: void interpret(); void mainEventLoop(); diff --git a/src/uscxml/interpreter/InterpreterDraft7.h b/src/uscxml/interpreter/InterpreterDraft7.h index 1dc9350..7600041 100644 --- a/src/uscxml/interpreter/InterpreterDraft7.h +++ b/src/uscxml/interpreter/InterpreterDraft7.h @@ -5,7 +5,7 @@ namespace uscxml { -class InterpreterDraft7 : public Interpreter { +class InterpreterDraft7 : public InterpreterImpl { void interpret(); void mainEventLoop(); void exitInterpreter(); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp index 1d01e12..e653607 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp @@ -26,7 +26,7 @@ V8DataModel::V8DataModel() { // _contexts.push_back(v8::Context::New()); } -boost::shared_ptr<DataModelImpl> V8DataModel::create(Interpreter* interpreter) { +boost::shared_ptr<DataModelImpl> V8DataModel::create(InterpreterImpl* interpreter) { boost::shared_ptr<V8DataModel> dm = boost::shared_ptr<V8DataModel>(new V8DataModel()); dm->_interpreter = interpreter; v8::Locker locker; @@ -246,17 +246,17 @@ Data V8DataModel::getValueAsData(const v8::Handle<v8::Value>& value) { v8::Handle<v8::Value> V8DataModel::getDocumentAsValue(const Arabica::DOM::Document<std::string>& doc) { v8::Handle<v8::Function> retCtor = Arabica::DOM::V8Document::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); - + struct Arabica::DOM::V8Document::V8DocumentPrivate* retPrivData = new Arabica::DOM::V8Document::V8DocumentPrivate(); retPrivData->dom = _dom; retPrivData->nativeObj = new Arabica::DOM::Document<std::string>(doc); - + retObj->SetInternalField(0, Arabica::DOM::V8DOM::toExternal(retPrivData)); retObj.MakeWeak(0, Arabica::DOM::V8Document::jsDestructor); - + return retObj; } - + v8::Handle<v8::Value> V8DataModel::getDataAsValue(const Data& data) { if (data.compound.size() > 0) { v8::Handle<v8::Object> value = v8::Object::New(); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h index e67e4ca..760b638 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h @@ -22,7 +22,7 @@ class V8DataModel : public DataModelImpl { public: V8DataModel(); virtual ~V8DataModel(); - virtual boost::shared_ptr<DataModelImpl> create(Interpreter* interpreter); + virtual boost::shared_ptr<DataModelImpl> create(InterpreterImpl* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; diff --git a/src/uscxml/plugins/element/fetch/FetchElement.cpp b/src/uscxml/plugins/element/fetch/FetchElement.cpp index eabe0a2..56c1815 100644 --- a/src/uscxml/plugins/element/fetch/FetchElement.cpp +++ b/src/uscxml/plugins/element/fetch/FetchElement.cpp @@ -18,7 +18,7 @@ bool connect(pluma::Host& host) { } #endif -boost::shared_ptr<ExecutableContentImpl> FetchElement::create(Interpreter* interpreter) { +boost::shared_ptr<ExecutableContentImpl> FetchElement::create(InterpreterImpl* interpreter) { boost::shared_ptr<FetchElement> invoker = boost::shared_ptr<FetchElement>(new FetchElement()); invoker->_interpreter = interpreter; return invoker; diff --git a/src/uscxml/plugins/element/fetch/FetchElement.h b/src/uscxml/plugins/element/fetch/FetchElement.h index b553293..e293afe 100644 --- a/src/uscxml/plugins/element/fetch/FetchElement.h +++ b/src/uscxml/plugins/element/fetch/FetchElement.h @@ -13,7 +13,7 @@ class FetchElement : public ExecutableContentImpl, public URLMonitor { public: FetchElement() {} virtual ~FetchElement(); - boost::shared_ptr<ExecutableContentImpl> create(Interpreter* interpreter); + boost::shared_ptr<ExecutableContentImpl> create(InterpreterImpl* interpreter); std::string getLocalName() { return "fetch"; diff --git a/src/uscxml/plugins/element/postpone/PostponeElement.cpp b/src/uscxml/plugins/element/postpone/PostponeElement.cpp index baa8e62..54f2499 100644 --- a/src/uscxml/plugins/element/postpone/PostponeElement.cpp +++ b/src/uscxml/plugins/element/postpone/PostponeElement.cpp @@ -16,7 +16,7 @@ bool connect(pluma::Host& host) { } #endif -boost::shared_ptr<ExecutableContentImpl> PostponeElement::create(Interpreter* interpreter) { +boost::shared_ptr<ExecutableContentImpl> PostponeElement::create(InterpreterImpl* interpreter) { boost::shared_ptr<PostponeElement> invoker = boost::shared_ptr<PostponeElement>(new PostponeElement()); invoker->_interpreter = interpreter; return invoker; @@ -97,21 +97,21 @@ void PostponeElement::enterElement(const Arabica::DOM::Node<std::string>& node) void PostponeElement::exitElement(const Arabica::DOM::Node<std::string>& node) { } -void PostponeElement::Resubmitter::postpone(const Event& event, std::string until, uint64_t timeout, bool chained, Interpreter* interpreter) { +void PostponeElement::Resubmitter::postpone(const Event& event, std::string until, uint64_t timeout, bool chained, InterpreterImpl* interpreter) { Resubmitter* resubmitter = getInstance(interpreter); resubmitter->_postponedEvents.push_back(Postponed(event, until, timeout, chained)); } -void PostponeElement::Resubmitter::onStableConfiguration(Interpreter* interpreter) { +void PostponeElement::Resubmitter::onStableConfiguration(Interpreter interpreter) { std::list<Postponed>::iterator eventIter = _postponedEvents.begin(); bool dispatched = false; while(eventIter != _postponedEvents.end()) { try { // LOG(INFO) << "Reevaluating: >> " << eventIter->first << " <<"; - if ((!dispatched || eventIter->chaining) && interpreter->getDataModel().evalAsBool(eventIter->until)) { + if ((!dispatched || eventIter->chaining) && interpreter.getDataModel().evalAsBool(eventIter->until)) { // LOG(INFO) << " -> is TRUE"; eventIter->event.name += ".postponed"; - interpreter->receive(eventIter->event, true); + interpreter.receive(eventIter->event, true); _postponedEvents.erase(eventIter); dispatched = true; } @@ -127,21 +127,21 @@ void PostponeElement::Resubmitter::onStableConfiguration(Interpreter* interprete } -void PostponeElement::Resubmitter::afterCompletion(Interpreter* interpreter) { +void PostponeElement::Resubmitter::afterCompletion(Interpreter interpreter) { tthread::lock_guard<tthread::recursive_mutex> lock(PostponeElement::Resubmitter::_accessLock); _instances.erase(interpreter); delete this; // committing suicide is ok if we are careful } -std::map<Interpreter*, PostponeElement::Resubmitter*> PostponeElement::Resubmitter::_instances; +std::map<Interpreter, PostponeElement::Resubmitter*> PostponeElement::Resubmitter::_instances; tthread::recursive_mutex PostponeElement::Resubmitter::_accessLock; -PostponeElement::Resubmitter* PostponeElement::Resubmitter::getInstance(Interpreter* interpreter) { +PostponeElement::Resubmitter* PostponeElement::Resubmitter::getInstance(InterpreterImpl* interpreter) { tthread::lock_guard<tthread::recursive_mutex> lock(PostponeElement::Resubmitter::_accessLock); - if (_instances.find(interpreter) == _instances.end()) { - _instances[interpreter] = new Resubmitter(interpreter); + if (_instances.find(interpreter->shared_from_this()) == _instances.end()) { + _instances[interpreter->shared_from_this()] = new Resubmitter(interpreter); } - return _instances[interpreter]; + return _instances[interpreter->shared_from_this()]; } }
\ No newline at end of file diff --git a/src/uscxml/plugins/element/postpone/PostponeElement.h b/src/uscxml/plugins/element/postpone/PostponeElement.h index 7886415..f0c42c0 100644 --- a/src/uscxml/plugins/element/postpone/PostponeElement.h +++ b/src/uscxml/plugins/element/postpone/PostponeElement.h @@ -23,7 +23,7 @@ public: PostponeElement() {} virtual ~PostponeElement() {} - boost::shared_ptr<ExecutableContentImpl> create(Interpreter* interpreter); + boost::shared_ptr<ExecutableContentImpl> create(InterpreterImpl* interpreter); std::string getLocalName() { return "postpone"; @@ -44,19 +44,19 @@ protected: // once per interpreter class Resubmitter : public InterpreterMonitor { public: - Resubmitter(Interpreter* interpreter) { + Resubmitter(InterpreterImpl* interpreter) { interpreter->addMonitor(this); } - static Resubmitter* getInstance(Interpreter* interpreter); - static void postpone(const Event& event, std::string until, uint64_t timeout, bool chained, Interpreter* interpreter); + static Resubmitter* getInstance(InterpreterImpl* interpreter); + static void postpone(const Event& event, std::string until, uint64_t timeout, bool chained, InterpreterImpl* interpreter); // InterpreterMonitor - void onStableConfiguration(Interpreter* interpreter); - void afterCompletion(Interpreter* interpreter); + void onStableConfiguration(Interpreter interpreter); + void afterCompletion(Interpreter interpreter); std::list<Postponed> _postponedEvents; - static std::map<Interpreter*, Resubmitter*> _instances; + static std::map<Interpreter, Resubmitter*> _instances; static tthread::recursive_mutex _accessLock; }; diff --git a/src/uscxml/plugins/element/response/ResponseElement.cpp b/src/uscxml/plugins/element/response/ResponseElement.cpp index cd7ef2d..675bc1e 100644 --- a/src/uscxml/plugins/element/response/ResponseElement.cpp +++ b/src/uscxml/plugins/element/response/ResponseElement.cpp @@ -16,7 +16,7 @@ bool connect(pluma::Host& host) { } #endif -boost::shared_ptr<ExecutableContentImpl> ResponseElement::create(Interpreter* interpreter) { +boost::shared_ptr<ExecutableContentImpl> ResponseElement::create(InterpreterImpl* interpreter) { boost::shared_ptr<ResponseElement> invoker = boost::shared_ptr<ResponseElement>(new ResponseElement()); invoker->_interpreter = interpreter; return invoker; diff --git a/src/uscxml/plugins/element/response/ResponseElement.h b/src/uscxml/plugins/element/response/ResponseElement.h index de3991c..333dd98 100644 --- a/src/uscxml/plugins/element/response/ResponseElement.h +++ b/src/uscxml/plugins/element/response/ResponseElement.h @@ -13,7 +13,7 @@ class ResponseElement : public ExecutableContentImpl { public: ResponseElement() {} virtual ~ResponseElement() {} - boost::shared_ptr<ExecutableContentImpl> create(Interpreter* interpreter); + boost::shared_ptr<ExecutableContentImpl> create(InterpreterImpl* interpreter); std::string getLocalName() { return "response"; diff --git a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp index 05af363..aaf6bc4 100644 --- a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp +++ b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp @@ -24,7 +24,7 @@ FFMPEGInvoker::FFMPEGInvoker() { FFMPEGInvoker::~FFMPEGInvoker() { }; -boost::shared_ptr<IOProcessorImpl> FFMPEGInvoker::create(Interpreter* interpreter) { +boost::shared_ptr<IOProcessorImpl> FFMPEGInvoker::create(InterpreterImpl* interpreter) { boost::shared_ptr<FFMPEGInvoker> invoker = boost::shared_ptr<FFMPEGInvoker>(new FFMPEGInvoker()); invoker->_interpreter = interpreter; return invoker; diff --git a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h index 734467f..972c4ff 100644 --- a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h +++ b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h @@ -13,7 +13,7 @@ class FFMPEGInvoker : public InvokerImpl { public: FFMPEGInvoker(); virtual ~FFMPEGInvoker(); - virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp index 65ea531..b2a16f3 100644 --- a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp +++ b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp @@ -37,7 +37,7 @@ DirMonInvoker::~DirMonInvoker() { _thread->join(); }; -boost::shared_ptr<IOProcessorImpl> DirMonInvoker::create(Interpreter* interpreter) { +boost::shared_ptr<IOProcessorImpl> DirMonInvoker::create(InterpreterImpl* interpreter) { boost::shared_ptr<DirMonInvoker> invoker = boost::shared_ptr<DirMonInvoker>(new DirMonInvoker()); invoker->_interpreter = interpreter; return invoker; diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h index e2abf54..a58da10 100644 --- a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h +++ b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h @@ -56,7 +56,7 @@ class DirMonInvoker : public InvokerImpl, public DirectoryWatchMonitor { public: DirMonInvoker(); virtual ~DirMonInvoker(); - virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp index 3b1a828..932452e 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp @@ -22,7 +22,7 @@ OSGInvoker::OSGInvoker() { OSGInvoker::~OSGInvoker() { }; -boost::shared_ptr<IOProcessorImpl> OSGInvoker::create(Interpreter* interpreter) { +boost::shared_ptr<IOProcessorImpl> OSGInvoker::create(InterpreterImpl* interpreter) { boost::shared_ptr<OSGInvoker> invoker = boost::shared_ptr<OSGInvoker> (new OSGInvoker()); invoker->_interpreter = interpreter; return invoker; diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h index acfa55c..e79b250 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h @@ -20,7 +20,7 @@ class OSGInvoker : public InvokerImpl, public Arabica::DOM::Events::EventListene public: OSGInvoker(); virtual ~OSGInvoker(); - virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp index 93a238c..de39424 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp @@ -52,7 +52,7 @@ OSGConverter::~OSGConverter() { } }; -boost::shared_ptr<IOProcessorImpl> OSGConverter::create(Interpreter* interpreter) { +boost::shared_ptr<IOProcessorImpl> OSGConverter::create(InterpreterImpl* interpreter) { boost::shared_ptr<OSGConverter> invoker = boost::shared_ptr<OSGConverter>(new OSGConverter()); invoker->_interpreter = interpreter; return invoker; diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h index 28c908d..d3cee30 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h @@ -15,7 +15,7 @@ class OSGConverter : public InvokerImpl { public: OSGConverter(); virtual ~OSGConverter(); - virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; diff --git a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp index 6371a43..b69f569 100644 --- a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp +++ b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp @@ -22,7 +22,7 @@ HeartbeatInvoker::~HeartbeatInvoker() { cancel(""); }; -boost::shared_ptr<IOProcessorImpl> HeartbeatInvoker::create(Interpreter* interpreter) { +boost::shared_ptr<IOProcessorImpl> HeartbeatInvoker::create(InterpreterImpl* interpreter) { boost::shared_ptr<HeartbeatInvoker> invoker = boost::shared_ptr<HeartbeatInvoker>(new HeartbeatInvoker()); invoker->_interpreter = interpreter; return invoker; diff --git a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h index 11be295..5a6272e 100644 --- a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h +++ b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h @@ -13,7 +13,7 @@ class HeartbeatInvoker : public InvokerImpl { public: HeartbeatInvoker(); virtual ~HeartbeatInvoker(); - virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; diff --git a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp index 223fe03..03e62bd 100644 --- a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp +++ b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp @@ -25,7 +25,7 @@ HTTPServletInvoker::~HTTPServletInvoker() { }; -boost::shared_ptr<IOProcessorImpl> HTTPServletInvoker::create(Interpreter* interpreter) { +boost::shared_ptr<IOProcessorImpl> HTTPServletInvoker::create(InterpreterImpl* interpreter) { boost::shared_ptr<HTTPServletInvoker> invoker = boost::shared_ptr<HTTPServletInvoker>(new HTTPServletInvoker()); invoker->_interpreter = interpreter; return invoker; diff --git a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h index 229ead5..06a286c 100644 --- a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h +++ b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h @@ -14,7 +14,7 @@ class HTTPServletInvoker : public InvokerImpl, public HTTPServlet { public: HTTPServletInvoker(); virtual ~HTTPServletInvoker(); - virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; diff --git a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp b/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp index 1a1416a..786c196 100644 --- a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp +++ b/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp @@ -25,7 +25,7 @@ MilesSessionInvoker::MilesSessionInvoker() { MilesSessionInvoker::~MilesSessionInvoker() { }; -boost::shared_ptr<IOProcessorImpl> MilesSessionInvoker::create(Interpreter* interpreter) { +boost::shared_ptr<IOProcessorImpl> MilesSessionInvoker::create(InterpreterImpl* interpreter) { boost::shared_ptr<MilesSessionInvoker> invoker = boost::shared_ptr<MilesSessionInvoker>(new MilesSessionInvoker()); invoker->_interpreter = interpreter; return invoker; diff --git a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h b/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h index fa66038..c552d1f 100644 --- a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h +++ b/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h @@ -24,7 +24,7 @@ class MilesSessionInvoker : public InvokerImpl { public: MilesSessionInvoker(); virtual ~MilesSessionInvoker(); - virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; diff --git a/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp b/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp index e7c2e10..d226784 100644 --- a/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp +++ b/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp @@ -21,7 +21,7 @@ SampleInvoker::SampleInvoker() { SampleInvoker::~SampleInvoker() { }; -boost::shared_ptr<IOProcessorImpl> SampleInvoker::create(Interpreter* interpreter) { +boost::shared_ptr<IOProcessorImpl> SampleInvoker::create(InterpreterImpl* interpreter) { boost::shared_ptr<SampleInvoker> invoker = boost::shared_ptr<SampleInvoker>(new SampleInvoker()); invoker->_interpreter = interpreter; return invoker; diff --git a/src/uscxml/plugins/invoker/sample/SampleInvoker.h b/src/uscxml/plugins/invoker/sample/SampleInvoker.h index d689bda..9261f2e 100644 --- a/src/uscxml/plugins/invoker/sample/SampleInvoker.h +++ b/src/uscxml/plugins/invoker/sample/SampleInvoker.h @@ -13,7 +13,7 @@ class SampleInvoker : public InvokerImpl { public: SampleInvoker(); virtual ~SampleInvoker(); - virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp index a142231..fc2ac2b 100644 --- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp +++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp @@ -21,10 +21,9 @@ USCXMLInvoker::USCXMLInvoker() : _cancelled(false) { USCXMLInvoker::~USCXMLInvoker() { _cancelled = true; - delete _invokedInterpreter; }; -boost::shared_ptr<IOProcessorImpl> USCXMLInvoker::create(Interpreter* interpreter) { +boost::shared_ptr<IOProcessorImpl> USCXMLInvoker::create(InterpreterImpl* interpreter) { boost::shared_ptr<USCXMLInvoker> invoker = boost::shared_ptr<USCXMLInvoker>(new USCXMLInvoker()); invoker->_parentInterpreter = interpreter; return invoker; @@ -36,7 +35,7 @@ Data USCXMLInvoker::getDataModelVariables() { } void USCXMLInvoker::send(const SendRequest& req) { - _invokedInterpreter->_externalQueue.push(req); + _invokedInterpreter.getImpl()->_externalQueue.push(req); } void USCXMLInvoker::cancel(const std::string sendId) { @@ -54,27 +53,27 @@ void USCXMLInvoker::invoke(const InvokeRequest& req) { LOG(ERROR) << "Cannot invoke nested SCXML interpreter, neither src attribute nor DOM is given"; } if (_invokedInterpreter) { - DataModel dataModel(_invokedInterpreter->getDataModel()); + DataModel dataModel(_invokedInterpreter.getImpl()->getDataModel()); if (dataModel) { } - _invokedInterpreter->setParentQueue(this); + _invokedInterpreter.getImpl()->setParentQueue(this); // transfer namespace prefixes - _invokedInterpreter->_nsURL = _parentInterpreter->_nsURL; - _invokedInterpreter->_xpathPrefix = _parentInterpreter->_xpathPrefix; - _invokedInterpreter->_nsToPrefix = _parentInterpreter->_nsToPrefix; + _invokedInterpreter.getImpl()->_nsURL = _parentInterpreter->_nsURL; + _invokedInterpreter.getImpl()->_xpathPrefix = _parentInterpreter->_xpathPrefix; + _invokedInterpreter.getImpl()->_nsToPrefix = _parentInterpreter->_nsToPrefix; std::map<std::string, std::string>::iterator nsIter = _parentInterpreter->_nsToPrefix.begin(); while(nsIter != _parentInterpreter->_nsToPrefix.end()) { - _invokedInterpreter->_nsContext.addNamespaceDeclaration(nsIter->first, nsIter->second); + _invokedInterpreter.getImpl()->_nsContext.addNamespaceDeclaration(nsIter->first, nsIter->second); nsIter++; } - _invokedInterpreter->_xmlNSPrefix = _parentInterpreter->_xmlNSPrefix; - _invokedInterpreter->_sessionId = req.invokeid; + _invokedInterpreter.getImpl()->_xmlNSPrefix = _parentInterpreter->_xmlNSPrefix; + _invokedInterpreter.getImpl()->_sessionId = req.invokeid; /// test240 assumes that invoke request params will carry over to the datamodel - _invokedInterpreter->setInvokeRequest(req); + _invokedInterpreter.getImpl()->setInvokeRequest(req); - _invokedInterpreter->start(); + _invokedInterpreter.getImpl()->start(); } else { /// test 530 _parentInterpreter->receive(Event("done.invoke." + _invokeId, Event::PLATFORM)); diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h index b1386b1..4b2c2d5 100644 --- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h +++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h @@ -20,7 +20,7 @@ class USCXMLInvoker : public: USCXMLInvoker(); virtual ~USCXMLInvoker(); - virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; names.insert("scxml"); @@ -39,8 +39,8 @@ public: protected: bool _cancelled; - Interpreter* _invokedInterpreter; - Interpreter* _parentInterpreter; + Interpreter _invokedInterpreter; + InterpreterImpl* _parentInterpreter; }; #ifdef BUILD_AS_PLUGINS diff --git a/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.cpp b/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.cpp index e217eaa..1d563ec 100644 --- a/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.cpp +++ b/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.cpp @@ -21,7 +21,7 @@ Sqlite3Invoker::Sqlite3Invoker() { Sqlite3Invoker::~Sqlite3Invoker() { }; -boost::shared_ptr<IOProcessorImpl> Sqlite3Invoker::create(Interpreter* interpreter) { +boost::shared_ptr<IOProcessorImpl> Sqlite3Invoker::create(InterpreterImpl* interpreter) { boost::shared_ptr<Sqlite3Invoker> invoker = boost::shared_ptr<Sqlite3Invoker>(new Sqlite3Invoker()); invoker->_interpreter = interpreter; return invoker; diff --git a/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h b/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h index 505d263..35bfec4 100644 --- a/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h +++ b/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h @@ -13,7 +13,7 @@ class Sqlite3Invoker : public InvokerImpl { public: Sqlite3Invoker(); virtual ~Sqlite3Invoker(); - virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; diff --git a/src/uscxml/plugins/invoker/system/SystemInvoker.cpp b/src/uscxml/plugins/invoker/system/SystemInvoker.cpp index 492d6d3..468628c 100644 --- a/src/uscxml/plugins/invoker/system/SystemInvoker.cpp +++ b/src/uscxml/plugins/invoker/system/SystemInvoker.cpp @@ -21,7 +21,7 @@ SystemInvoker::SystemInvoker() { SystemInvoker::~SystemInvoker() { }; -boost::shared_ptr<IOProcessorImpl> SystemInvoker::create(Interpreter* interpreter) { +boost::shared_ptr<IOProcessorImpl> SystemInvoker::create(InterpreterImpl* interpreter) { boost::shared_ptr<SystemInvoker> invoker = boost::shared_ptr<SystemInvoker>(new SystemInvoker()); invoker->_interpreter = interpreter; return invoker; diff --git a/src/uscxml/plugins/invoker/system/SystemInvoker.h b/src/uscxml/plugins/invoker/system/SystemInvoker.h index 67bd1a9..0292d41 100644 --- a/src/uscxml/plugins/invoker/system/SystemInvoker.h +++ b/src/uscxml/plugins/invoker/system/SystemInvoker.h @@ -13,7 +13,7 @@ class SystemInvoker : public InvokerImpl { public: SystemInvoker(); virtual ~SystemInvoker(); - virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp index 4005d03..5439413 100644 --- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp +++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp @@ -28,7 +28,7 @@ UmundoInvoker::~UmundoInvoker() { } }; -boost::shared_ptr<IOProcessorImpl> UmundoInvoker::create(Interpreter* interpreter) { +boost::shared_ptr<IOProcessorImpl> UmundoInvoker::create(InterpreterImpl* interpreter) { boost::shared_ptr<UmundoInvoker> invoker = boost::shared_ptr<UmundoInvoker>(new UmundoInvoker()); invoker->_interpreter = interpreter; return invoker; @@ -250,7 +250,7 @@ void UmundoInvoker::changed(umundo::ServiceDescription desc) { } std::multimap<std::string, std::pair<std::string, umundo::Node*> > UmundoInvoker::_nodes; -umundo::Node* UmundoInvoker::getNode(Interpreter* interpreter, const std::string& domain) { +umundo::Node* UmundoInvoker::getNode(InterpreterImpl* interpreter, const std::string& domain) { std::pair<_nodes_t::iterator, _nodes_t::iterator> range = _nodes.equal_range(interpreter->getName()); for (_nodes_t::iterator it = range.first; it != range.second; it++) { if (it->second.first.compare(domain) == 0) diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h index a7f45f1..db944cd 100644 --- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h +++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h @@ -20,7 +20,7 @@ class UmundoInvoker : public InvokerImpl, public umundo::TypedReceiver, public u public: UmundoInvoker(); virtual ~UmundoInvoker(); - virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; @@ -57,7 +57,7 @@ protected: static std::multimap<std::string, std::pair<std::string, umundo::Node*> > _nodes; typedef std::multimap<std::string, std::pair<std::string, umundo::Node*> > _nodes_t; - static umundo::Node* getNode(Interpreter* interpreter, const std::string& domain); + static umundo::Node* getNode(InterpreterImpl* interpreter, const std::string& domain); }; #ifdef BUILD_AS_PLUGINS diff --git a/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp index a1f803d..9ae62a8 100644 --- a/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.cpp +++ b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp @@ -3,7 +3,7 @@ #include <windows.h> #endif -#include "uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h" +#include "uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h" #include "uscxml/Message.h" #include <iostream> #include <event2/dns.h> @@ -29,24 +29,24 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR bool connect(pluma::Host& host) { - host.add( new EventIOProcessorProvider() ); + host.add( new BasicHTTPIOProcessorProvider() ); return true; } #endif // see http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor -EventIOProcessor::EventIOProcessor() { +BasicHTTPIOProcessor::BasicHTTPIOProcessor() { } -EventIOProcessor::~EventIOProcessor() { +BasicHTTPIOProcessor::~BasicHTTPIOProcessor() { HTTPServer* httpServer = HTTPServer::getInstance(); httpServer->unregisterServlet(this); } -boost::shared_ptr<IOProcessorImpl> EventIOProcessor::create(Interpreter* interpreter) { - boost::shared_ptr<EventIOProcessor> io = boost::shared_ptr<EventIOProcessor>(new EventIOProcessor()); +boost::shared_ptr<IOProcessorImpl> BasicHTTPIOProcessor::create(InterpreterImpl* interpreter) { + boost::shared_ptr<BasicHTTPIOProcessor> io = boost::shared_ptr<BasicHTTPIOProcessor>(new BasicHTTPIOProcessor()); io->_interpreter = interpreter; // register at http server @@ -61,14 +61,14 @@ boost::shared_ptr<IOProcessorImpl> EventIOProcessor::create(Interpreter* interpr return io; } -Data EventIOProcessor::getDataModelVariables() { +Data BasicHTTPIOProcessor::getDataModelVariables() { Data data; assert(_url.length() > 0); data.compound["location"] = Data(_url, Data::VERBATIM); return data; } -void EventIOProcessor::httpRecvRequest(const HTTPServer::Request& req) { +void BasicHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) { Event reqEvent = req; reqEvent.type = Event::EXTERNAL; bool scxmlStructFound = false; @@ -116,7 +116,7 @@ void EventIOProcessor::httpRecvRequest(const HTTPServer::Request& req) { evhttp_send_reply(req.curlReq, 200, "OK", NULL); } -void EventIOProcessor::send(const SendRequest& req) { +void BasicHTTPIOProcessor::send(const SendRequest& req) { bool isLocal = false; std::string target; @@ -167,9 +167,9 @@ void EventIOProcessor::send(const SendRequest& req) { } } -void EventIOProcessor::downloadStarted(const URL& url) {} +void BasicHTTPIOProcessor::downloadStarted(const URL& url) {} -void EventIOProcessor::downloadCompleted(const URL& url) { +void BasicHTTPIOProcessor::downloadCompleted(const URL& url) { std::map<std::string, std::pair<URL, SendRequest> >::iterator reqIter = _sendRequests.begin(); while(reqIter != _sendRequests.end()) { if (reqIter->second.first == url) { @@ -181,7 +181,7 @@ void EventIOProcessor::downloadCompleted(const URL& url) { assert(false); } -void EventIOProcessor::downloadFailed(const URL& url, int errorCode) { +void BasicHTTPIOProcessor::downloadFailed(const URL& url, int errorCode) { std::map<std::string, std::pair<URL, SendRequest> >::iterator reqIter = _sendRequests.begin(); while(reqIter != _sendRequests.end()) { diff --git a/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h index c549b2b..1848e5e 100644 --- a/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h +++ b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h @@ -1,5 +1,5 @@ -#ifndef EVENTIOPROCESSOR_H_2CUY93KU -#define EVENTIOPROCESSOR_H_2CUY93KU +#ifndef BASICHTTPIOPROCESSOR_H_2CUY93KU +#define BASICHTTPIOPROCESSOR_H_2CUY93KU #include "uscxml/concurrency/eventqueue/DelayedEventQueue.h" #include "uscxml/server/HTTPServer.h" @@ -18,13 +18,11 @@ namespace uscxml { -class EventIOServer; - -class EventIOProcessor : public IOProcessorImpl, public HTTPServlet, public URLMonitor { +class BasicHTTPIOProcessor : public IOProcessorImpl, public HTTPServlet, public URLMonitor { public: - EventIOProcessor(); - virtual ~EventIOProcessor(); - virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::Interpreter* interpreter); + BasicHTTPIOProcessor(); + virtual ~BasicHTTPIOProcessor(); + virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; @@ -58,9 +56,9 @@ protected: }; #ifdef BUILD_AS_PLUGINS -PLUMA_INHERIT_PROVIDER(EventIOProcessor, IOProcessorImpl); +PLUMA_INHERIT_PROVIDER(BasicHTTPIOProcessor, IOProcessorImpl); #endif } -#endif /* end of include guard: EVENTIOPROCESSOR_H_2CUY93KU */
\ No newline at end of file +#endif /* end of include guard: BASICHTTPIOPROCESSOR_H_2CUY93KU */
\ No newline at end of file diff --git a/src/uscxml/plugins/ioprocessor/dom/DOMIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/dom/DOMIOProcessor.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/uscxml/plugins/ioprocessor/dom/DOMIOProcessor.cpp diff --git a/src/uscxml/plugins/ioprocessor/dom/DOMIOProcessor.h b/src/uscxml/plugins/ioprocessor/dom/DOMIOProcessor.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/uscxml/plugins/ioprocessor/dom/DOMIOProcessor.h diff --git a/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp new file mode 100644 index 0000000..387075b --- /dev/null +++ b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp @@ -0,0 +1,141 @@ +#ifdef _WIN32 +#include <winsock2.h> +#include <windows.h> +#endif + +#include "uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h" +#include "uscxml/Message.h" +#include <iostream> +#include <event2/dns.h> +#include <event2/buffer.h> +#include <event2/keyvalq_struct.h> + +#include <string.h> + +#include <io/uri.hpp> +#include <glog/logging.h> + +#ifndef _WIN32 +#include <netdb.h> +#include <arpa/inet.h> +#endif + +#ifdef BUILD_AS_PLUGINS +#include <Pluma/Connector.hpp> +#endif + +namespace uscxml { + +#ifdef BUILD_AS_PLUGINS +PLUMA_CONNECTOR +bool connect(pluma::Host& host) { + host.add( new SCXMLIOProcessorProvider() ); + return true; +} +#endif + +// see http://www.w3.org/TR/scxml/#SCXMLEventProcessor + +SCXMLIOProcessor::SCXMLIOProcessor() { +} + +SCXMLIOProcessor::~SCXMLIOProcessor() { +} + + +boost::shared_ptr<IOProcessorImpl> SCXMLIOProcessor::create(InterpreterImpl* interpreter) { + boost::shared_ptr<SCXMLIOProcessor> io = boost::shared_ptr<SCXMLIOProcessor>(new SCXMLIOProcessor()); + io->_interpreter = interpreter; + + // register at http server + std::string path = interpreter->getName(); + int i = 2; + while (!HTTPServer::registerServlet(path + "/scxml", io.get())) { + std::stringstream ss; + ss << interpreter->getName() << i++; + path = ss.str(); + } + return io; +} + +Data SCXMLIOProcessor::getDataModelVariables() { + Data data; + assert(_url.length() > 0); + data.compound["location"] = Data(_url, Data::VERBATIM); + return data; +} + + +void SCXMLIOProcessor::send(const SendRequest& req) { + // see http://www.w3.org/TR/scxml/#SendTargets + + SendRequest reqCopy(req); + // test 253 + reqCopy.origintype = "scxml"; + reqCopy.origin = _url; + + if (false) { + } else if (boost::iequals(reqCopy.target, "#_internal")) { + /** + * #_internal: If the target is the special term '#_internal', the Processor + * must add the event to the internal event queue of the sending session. + */ + _interpreter->receiveInternal(reqCopy); + + } else if(reqCopy.target.find_first_of("#_scxml_") == 0) { + /** + * #_scxml_sessionid: If the target is the special term '#_scxml_sessionid', + * where sessionid is the id of an SCXML session that is accessible to the + * Processor, the Processor must add the event to the external queue of that + * session. The set of SCXML sessions that are accessible to a given SCXML + * Processor is platform-dependent. + */ + std::string sessionId = reqCopy.target.substr(8, reqCopy.target.length() - 8); + std::map<std::string, boost::weak_ptr<InterpreterImpl> > instances = Interpreter::getInstances(); + if (instances.find(sessionId) != instances.end()) { + boost::shared_ptr<InterpreterImpl> other = instances[sessionId].lock(); + other->receive(reqCopy); + } else { + LOG(ERROR) << "Can not send to scxml session " << sessionId << " - not known" << std::endl; + _interpreter->receiveInternal(Event("error.communication", Event::PLATFORM)); + } + + + } else if (boost::iequals(reqCopy.target, "#_parent")) { + /** + * #_parent: If the target is the special term '#_parent', the Processor must + * add the event to the external event queue of the SCXML session that invoked + * the sending session, if there is one. + */ + if (_interpreter->_parentQueue != NULL) { + _interpreter->_parentQueue->push(reqCopy); + } else { + LOG(ERROR) << "Can not send to parent, we were not invoked" << std::endl; + _interpreter->receiveInternal(Event("error.communication", Event::PLATFORM)); + } + } else if (reqCopy.target.find_first_of("#_") == 0) { + /** + * #_invokeid: If the target is the special term '#_invokeid', where invokeid + * is the invokeid of an SCXML session that the sending session has created + * by <invoke>, the Processor must add the event to the external queue of that + * session. + */ + std::string invokeId = reqCopy.target.substr(2, reqCopy.target.length() - 2); + if (_interpreter->_invokers.find(invokeId) != _interpreter->_invokers.end()) { + tthread::lock_guard<tthread::recursive_mutex> lock(_interpreter->_mutex); + try { + _interpreter->_invokers[invokeId].send(reqCopy); + } catch(...) { + LOG(ERROR) << "Exception caught while sending event to invoker " << invokeId; + } + } else { + LOG(ERROR) << "Can not send to invoked component '" << invokeId << "', no such invokeId" << std::endl; + _interpreter->receiveInternal(Event("error.communication", Event::PLATFORM)); + } + } else { + } +} + + + +}
\ No newline at end of file diff --git a/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h new file mode 100644 index 0000000..a4f3f7c --- /dev/null +++ b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h @@ -0,0 +1,36 @@ +#ifndef SCXMLIOProcessor_H_2CUY93KU +#define SCXMLIOProcessor_H_2CUY93KU + +#include "uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h" + +#ifdef BUILD_AS_PLUGINS +#include "uscxml/plugins/Plugins.h" +#endif + +namespace uscxml { + +class SCXMLIOProcessor : public BasicHTTPIOProcessor { +public: + SCXMLIOProcessor(); + virtual ~SCXMLIOProcessor(); + virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter); + + virtual std::set<std::string> getNames() { + std::set<std::string> names; + names.insert("http://www.w3.org/TR/scxml/#SCXMLEventProcessor"); + names.insert("scxml"); + return names; + } + + virtual void send(const SendRequest& req); + + Data getDataModelVariables(); +}; + +#ifdef BUILD_AS_PLUGINS +PLUMA_INHERIT_PROVIDER(SCXMLIOProcessor, IOProcessorImpl); +#endif + +} + +#endif /* end of include guard: SCXMLIOProcessor_H_2CUY93KU */
\ No newline at end of file diff --git a/src/uscxml/server/InterpreterServlet.cpp b/src/uscxml/server/InterpreterServlet.cpp index 99b81b2..0386c3b 100644 --- a/src/uscxml/server/InterpreterServlet.cpp +++ b/src/uscxml/server/InterpreterServlet.cpp @@ -4,7 +4,7 @@ namespace uscxml { -InterpreterServlet::InterpreterServlet(Interpreter* interpreter) { +InterpreterServlet::InterpreterServlet(InterpreterImpl* interpreter) { _interpreter = interpreter; std::stringstream path; @@ -18,7 +18,7 @@ InterpreterServlet::InterpreterServlet(Interpreter* interpreter) { _path = path.str(); } -boost::shared_ptr<IOProcessorImpl> InterpreterServlet::create(Interpreter* interpreter) { +boost::shared_ptr<IOProcessorImpl> InterpreterServlet::create(InterpreterImpl* interpreter) { // we instantiate directly in Interpreter boost::shared_ptr<IOProcessorImpl> io = boost::shared_ptr<InterpreterServlet>(new InterpreterServlet(interpreter)); return io; diff --git a/src/uscxml/server/InterpreterServlet.h b/src/uscxml/server/InterpreterServlet.h index 18e1d28..6c61e47 100644 --- a/src/uscxml/server/InterpreterServlet.h +++ b/src/uscxml/server/InterpreterServlet.h @@ -11,10 +11,10 @@ class Interpreter; class InterpreterServlet : public HTTPServlet, public IOProcessorImpl { public: InterpreterServlet() {}; - InterpreterServlet(Interpreter* interpreter); + InterpreterServlet(InterpreterImpl* interpreter); virtual ~InterpreterServlet() {} - virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; @@ -50,7 +50,7 @@ public: } protected: - Interpreter* _interpreter; + InterpreterImpl* _interpreter; tthread::recursive_mutex _mutex; std::map<std::string, HTTPServer::Request> _requests; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 19dc7dd..d7c305e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -69,7 +69,7 @@ if (RUN_W3C_TESTS) set_target_properties(test-w3c PROPERTIES FOLDER "Tests") file(GLOB_RECURSE W3C_TESTS - samples/w3c/tests/*.scxml + samples/w3c/ecma/*.scxml ) foreach( W3C_TEST ${W3C_TESTS} ) diff --git a/test/samples/w3c/convert-tests.sh b/test/samples/w3c/convert-tests.sh new file mode 100755 index 0000000..5ee8faa --- /dev/null +++ b/test/samples/w3c/convert-tests.sh @@ -0,0 +1,13 @@ +ME=`basename $0` +DIR="$( cd "$( dirname "$0" )" && pwd )" +cd $DIR + +TXMLS=`ls txml/*.txml` + +# see http://saxon.sourceforge.net/saxon6.5.1/using-xsl.html +for TXML in $TXMLS +do + DEST=ecma/`basename $TXML .txml`.scxml + echo "Processing $TXML to $DEST" + java -jar /Users/sradomski/Developer/Applications/SaxonHE9-4-0-7J/saxon9he.jar $TXML confEcma.xsl -o:$DEST +done diff --git a/test/samples/w3c/tests/test144.scxml b/test/samples/w3c/ecma/test144.scxml index fcec83a..fcec83a 100644 --- a/test/samples/w3c/tests/test144.scxml +++ b/test/samples/w3c/ecma/test144.scxml diff --git a/test/samples/w3c/tests/test147.scxml b/test/samples/w3c/ecma/test147.scxml index f877ecf..f877ecf 100644 --- a/test/samples/w3c/tests/test147.scxml +++ b/test/samples/w3c/ecma/test147.scxml diff --git a/test/samples/w3c/tests/test148.scxml b/test/samples/w3c/ecma/test148.scxml index acebba7..acebba7 100644 --- a/test/samples/w3c/tests/test148.scxml +++ b/test/samples/w3c/ecma/test148.scxml diff --git a/test/samples/w3c/tests/test149.scxml b/test/samples/w3c/ecma/test149.scxml index b7626c6..b7626c6 100644 --- a/test/samples/w3c/tests/test149.scxml +++ b/test/samples/w3c/ecma/test149.scxml diff --git a/test/samples/w3c/tests/test150.scxml b/test/samples/w3c/ecma/test150.scxml index 41e1895..41e1895 100644 --- a/test/samples/w3c/tests/test150.scxml +++ b/test/samples/w3c/ecma/test150.scxml diff --git a/test/samples/w3c/tests/test151.scxml b/test/samples/w3c/ecma/test151.scxml index 119bb65..119bb65 100644 --- a/test/samples/w3c/tests/test151.scxml +++ b/test/samples/w3c/ecma/test151.scxml diff --git a/test/samples/w3c/tests/test152.scxml b/test/samples/w3c/ecma/test152.scxml index 8af51a8..8af51a8 100644 --- a/test/samples/w3c/tests/test152.scxml +++ b/test/samples/w3c/ecma/test152.scxml diff --git a/test/samples/w3c/tests/test153.scxml b/test/samples/w3c/ecma/test153.scxml index 9917789..ad54994 100644 --- a/test/samples/w3c/tests/test153.scxml +++ b/test/samples/w3c/ecma/test153.scxml @@ -13,7 +13,7 @@ it ever isn't, set Var4 to 0, indicating failure --><scxml xmlns="http://www.w3. <state id="s0"> <onentry> <foreach item="Var2" array="Var3"> - <if cond="Var1/text() <Var2/text() "> + <if cond="Var1<Var2 "> <assign location="Var1" expr="Var2"/> <else/> <!-- values are out of order, record failure --> diff --git a/test/samples/w3c/tests/test155.scxml b/test/samples/w3c/ecma/test155.scxml index 17d3a70..17d3a70 100644 --- a/test/samples/w3c/tests/test155.scxml +++ b/test/samples/w3c/ecma/test155.scxml diff --git a/test/samples/w3c/tests/test156.scxml b/test/samples/w3c/ecma/test156.scxml index aa9e2b0..aa9e2b0 100644 --- a/test/samples/w3c/tests/test156.scxml +++ b/test/samples/w3c/ecma/test156.scxml diff --git a/test/samples/w3c/tests/test158.scxml b/test/samples/w3c/ecma/test158.scxml index f1a583f..f1a583f 100644 --- a/test/samples/w3c/tests/test158.scxml +++ b/test/samples/w3c/ecma/test158.scxml diff --git a/test/samples/w3c/tests/test159.scxml b/test/samples/w3c/ecma/test159.scxml index d144855..d144855 100644 --- a/test/samples/w3c/tests/test159.scxml +++ b/test/samples/w3c/ecma/test159.scxml diff --git a/test/samples/w3c/tests/test172.scxml b/test/samples/w3c/ecma/test172.scxml index 28f2bcb..28f2bcb 100644 --- a/test/samples/w3c/tests/test172.scxml +++ b/test/samples/w3c/ecma/test172.scxml diff --git a/test/samples/w3c/tests/test173.scxml b/test/samples/w3c/ecma/test173.scxml index fa2a289..fa2a289 100644 --- a/test/samples/w3c/tests/test173.scxml +++ b/test/samples/w3c/ecma/test173.scxml diff --git a/test/samples/w3c/tests/test174.scxml b/test/samples/w3c/ecma/test174.scxml index f78feee..f78feee 100644 --- a/test/samples/w3c/tests/test174.scxml +++ b/test/samples/w3c/ecma/test174.scxml diff --git a/test/samples/w3c/tests/test175.scxml b/test/samples/w3c/ecma/test175.scxml index 4876821..4876821 100644 --- a/test/samples/w3c/tests/test175.scxml +++ b/test/samples/w3c/ecma/test175.scxml diff --git a/test/samples/w3c/tests/test176.scxml b/test/samples/w3c/ecma/test176.scxml index 4b120ec..4b120ec 100644 --- a/test/samples/w3c/tests/test176.scxml +++ b/test/samples/w3c/ecma/test176.scxml diff --git a/test/samples/w3c/tests/test178.scxml b/test/samples/w3c/ecma/test178.scxml index 91b4681..91b4681 100644 --- a/test/samples/w3c/tests/test178.scxml +++ b/test/samples/w3c/ecma/test178.scxml diff --git a/test/samples/w3c/tests/test179.scxml b/test/samples/w3c/ecma/test179.scxml index 170b105..170b105 100644 --- a/test/samples/w3c/tests/test179.scxml +++ b/test/samples/w3c/ecma/test179.scxml diff --git a/test/samples/w3c/tests/test183.scxml b/test/samples/w3c/ecma/test183.scxml index 2c17ea8..2c17ea8 100644 --- a/test/samples/w3c/tests/test183.scxml +++ b/test/samples/w3c/ecma/test183.scxml diff --git a/test/samples/w3c/tests/test185.scxml b/test/samples/w3c/ecma/test185.scxml index cdf8a77..cdf8a77 100644 --- a/test/samples/w3c/tests/test185.scxml +++ b/test/samples/w3c/ecma/test185.scxml diff --git a/test/samples/w3c/tests/test186.scxml b/test/samples/w3c/ecma/test186.scxml index 20f0063..20f0063 100644 --- a/test/samples/w3c/tests/test186.scxml +++ b/test/samples/w3c/ecma/test186.scxml diff --git a/test/samples/w3c/tests/test187.scxml b/test/samples/w3c/ecma/test187.scxml index d03c16d..d03c16d 100644 --- a/test/samples/w3c/tests/test187.scxml +++ b/test/samples/w3c/ecma/test187.scxml diff --git a/test/samples/w3c/ecma/test189.scxml b/test/samples/w3c/ecma/test189.scxml new file mode 100644 index 0000000..683b874 --- /dev/null +++ b/test/samples/w3c/ecma/test189.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- we test that #_internal as a target of <send> puts the event on the internal queue. If it does, +event1 will be processed before event2, because event1 is added to the internal queue while event2 is +added to the external queue (event though event2 is generated first) --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> + + +<state id="s0"> + <onentry> + <!-- goes to the external queue --> + <send event="event2"/> + <!-- to the internal queue --> + <send event="event1" target="#_internal"/> + </onentry> + + <!-- once we've entered the state, we should check for internal events first --> + <transition event="event1" target="pass"/> + <transition event="event2" target="fail"/> + </state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test190.scxml b/test/samples/w3c/ecma/test190.scxml new file mode 100644 index 0000000..a1f6d56 --- /dev/null +++ b/test/samples/w3c/ecma/test190.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- we test that #_scxml_sessionid as a target of <send> puts the event on the external queue. If it does, +event1 will be processed before event2, because event1 is added to the internal queue while event2 is +added to the external queue (event though event2 is generated first). we have to make sure that event2 +is actually delivered. The delayed <send> makes sure another event is generated (so the test doesn't hang) --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> +<datamodel> + <data id="Var1" expr="'#_scxml_'"/> + <data id="Var2" expr="_sessionid"/> + </datamodel> + +<state id="s0"> + <onentry> + <assign location="Var1" expr="Var1 + Var2"/> + <!-- goes to the external queue --> + <send event="event2" targetexpr="Var1"/> + <!-- to the internal queue --> + <raise event="event1"/> + <!-- this should get added to the external queue after event2 --> + <send event="timeout"/> + </onentry> + + <!-- once we've entered the state, we should check for internal events first --> + <transition event="event1" target="s1"/> + <transition event="*" target="fail"/> + </state> + +<!-- now check that we get event2 and not a timeout --> +<state id="s1"> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test191.scxml b/test/samples/w3c/ecma/test191.scxml new file mode 100644 index 0000000..a44856b --- /dev/null +++ b/test/samples/w3c/ecma/test191.scxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- we test that #_parent works as a target of <send> . a subscript is invoked and sends the event +childToParent to its parent session (ths session) using #_parent as the target. If we get this event, we +pass, otherwise we fail. The timer insures that some event is generated and that the test does not hang. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> + + +<state id="s0"> + <onentry> + <send event="timeout" delay="5s"/> + </onentry> + <invoke type="scxml"> + <content> + <!-- send an event to the parent session using #_parent as the target --> + <scxml initial="sub0" version="1.0" datamodel="ecmascript"> + <state id="sub0"> + <onentry> + <send event="childToParent" target="#_parent"/> + </onentry> + <transition target="subFinal"/> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="childToParent" target="pass"/> + <transition event="*" target="pass"/> +</state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test192.scxml b/test/samples/w3c/ecma/test192.scxml new file mode 100644 index 0000000..a74a05e --- /dev/null +++ b/test/samples/w3c/ecma/test192.scxml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- we test that #_invokeid works as a target of <send> . A child script is invoked and sends us +childToParent once its running. Then we send it the event parentToChild using its invokeid as the target. +If it receives this event, it sends sends the event eventReceived to its parent session (ths session). +If we get this event, we pass, otherwise the child script eventually times out sends invoke.done and we fail. +We also set a timeout in this process to make sure the test doesn't hang --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0"> + +<state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="5s"/> + </onentry> + + <invoke type="scxml" id="invokedChild"> + <content> + <!-- let the parent session know we're running by sending childToParent, then wait for parentToChild. + If we get it, send eventReceived. If we don't we eventually time out --> + <scxml initial="sub0" version="1.0" datamodel="ecmascript"> + + <state id="sub0"> + <onentry> + <send event="childToParent" target="#_parent"/> + <send event="timeout" delay="3s"/> + </onentry> + + <transition event="parentToChild" target="subFinal"> + <send target="#_parent" event="eventReceived"/> + </transition> + + <transition event="timeout" target="subFinal"/> + </state> + + <final id="subFinal"/> + + </scxml> + </content> + </invoke> + + <transition event="timeout" target="fail"/> + <transition event="done.invoke" target="fail"/> + +<state id="s01"> + <transition event="childToParent" target="s02"> + <send target="#_invokedChild" event="parentToChild"/> + </transition> +</state> + +<state id="s02"> + <transition event="eventReceived" target="pass"/> + </state> + +</state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/tests/test194.scxml b/test/samples/w3c/ecma/test194.scxml index e7dcd76..e7dcd76 100644 --- a/test/samples/w3c/tests/test194.scxml +++ b/test/samples/w3c/ecma/test194.scxml diff --git a/test/samples/w3c/tests/test198.scxml b/test/samples/w3c/ecma/test198.scxml index e804625..e804625 100644 --- a/test/samples/w3c/tests/test198.scxml +++ b/test/samples/w3c/ecma/test198.scxml diff --git a/test/samples/w3c/tests/test199.scxml b/test/samples/w3c/ecma/test199.scxml index 2119cd8..2119cd8 100644 --- a/test/samples/w3c/tests/test199.scxml +++ b/test/samples/w3c/ecma/test199.scxml diff --git a/test/samples/w3c/tests/test200.scxml b/test/samples/w3c/ecma/test200.scxml index 2aa85a9..2aa85a9 100644 --- a/test/samples/w3c/tests/test200.scxml +++ b/test/samples/w3c/ecma/test200.scxml diff --git a/test/samples/w3c/tests/test201.scxml b/test/samples/w3c/ecma/test201.scxml index 6460bbb..6460bbb 100644 --- a/test/samples/w3c/tests/test201.scxml +++ b/test/samples/w3c/ecma/test201.scxml diff --git a/test/samples/w3c/tests/test205.scxml b/test/samples/w3c/ecma/test205.scxml index 5adefbe..5adefbe 100644 --- a/test/samples/w3c/tests/test205.scxml +++ b/test/samples/w3c/ecma/test205.scxml diff --git a/test/samples/w3c/tests/test207.scxml b/test/samples/w3c/ecma/test207.scxml index aa5786a..aa5786a 100644 --- a/test/samples/w3c/tests/test207.scxml +++ b/test/samples/w3c/ecma/test207.scxml diff --git a/test/samples/w3c/tests/test208.scxml b/test/samples/w3c/ecma/test208.scxml index 6faa9c1..6faa9c1 100644 --- a/test/samples/w3c/tests/test208.scxml +++ b/test/samples/w3c/ecma/test208.scxml diff --git a/test/samples/w3c/tests/test210.scxml b/test/samples/w3c/ecma/test210.scxml index e29b65d..e29b65d 100644 --- a/test/samples/w3c/tests/test210.scxml +++ b/test/samples/w3c/ecma/test210.scxml diff --git a/test/samples/w3c/tests/test215.scxml b/test/samples/w3c/ecma/test215.scxml index 97e6a39..97e6a39 100644 --- a/test/samples/w3c/tests/test215.scxml +++ b/test/samples/w3c/ecma/test215.scxml diff --git a/test/samples/w3c/tests/test216.scxml b/test/samples/w3c/ecma/test216.scxml index 97b2a77..97b2a77 100644 --- a/test/samples/w3c/tests/test216.scxml +++ b/test/samples/w3c/ecma/test216.scxml diff --git a/test/samples/w3c/tests/test216sub1.scxml b/test/samples/w3c/ecma/test216sub1.scxml index 3c3a88d..3c3a88d 100644 --- a/test/samples/w3c/tests/test216sub1.scxml +++ b/test/samples/w3c/ecma/test216sub1.scxml diff --git a/test/samples/w3c/tests/test220.scxml b/test/samples/w3c/ecma/test220.scxml index 2d447c4..2d447c4 100644 --- a/test/samples/w3c/tests/test220.scxml +++ b/test/samples/w3c/ecma/test220.scxml diff --git a/test/samples/w3c/tests/test223.scxml b/test/samples/w3c/ecma/test223.scxml index 63ceadd..63ceadd 100644 --- a/test/samples/w3c/tests/test223.scxml +++ b/test/samples/w3c/ecma/test223.scxml diff --git a/test/samples/w3c/tests/test224.scxml b/test/samples/w3c/ecma/test224.scxml index e2e8a32..e2e8a32 100644 --- a/test/samples/w3c/tests/test224.scxml +++ b/test/samples/w3c/ecma/test224.scxml diff --git a/test/samples/w3c/tests/test225.scxml b/test/samples/w3c/ecma/test225.scxml index 467d1ba..467d1ba 100644 --- a/test/samples/w3c/tests/test225.scxml +++ b/test/samples/w3c/ecma/test225.scxml diff --git a/test/samples/w3c/tests/test226.scxml b/test/samples/w3c/ecma/test226.scxml index c831a1d..e1c6d3f 100644 --- a/test/samples/w3c/tests/test226.scxml +++ b/test/samples/w3c/ecma/test226.scxml @@ -9,7 +9,7 @@ success. otherwise it will hang and the timeout in this doc signifies failure. </onentry> - <invoke type="http://www.w3.org/TR/scxml/" src="file:test226sub1.txml"> + <invoke type="http://www.w3.org/TR/scxml/" src="file:test226sub1.scxml"> <param name="Var1" expr="1"/> </invoke> diff --git a/test/samples/w3c/tests/test226sub1.scxml b/test/samples/w3c/ecma/test226sub1.scxml index 809efb0..809efb0 100644 --- a/test/samples/w3c/tests/test226sub1.scxml +++ b/test/samples/w3c/ecma/test226sub1.scxml diff --git a/test/samples/w3c/tests/test228.scxml b/test/samples/w3c/ecma/test228.scxml index b44de56..b44de56 100644 --- a/test/samples/w3c/tests/test228.scxml +++ b/test/samples/w3c/ecma/test228.scxml diff --git a/test/samples/w3c/tests/test229.scxml b/test/samples/w3c/ecma/test229.scxml index e3aeecb..e3aeecb 100644 --- a/test/samples/w3c/tests/test229.scxml +++ b/test/samples/w3c/ecma/test229.scxml diff --git a/test/samples/w3c/tests/test230.scxml b/test/samples/w3c/ecma/test230.scxml index ae13476..ae13476 100644 --- a/test/samples/w3c/tests/test230.scxml +++ b/test/samples/w3c/ecma/test230.scxml diff --git a/test/samples/w3c/tests/test232.scxml b/test/samples/w3c/ecma/test232.scxml index 9515e15..9515e15 100644 --- a/test/samples/w3c/tests/test232.scxml +++ b/test/samples/w3c/ecma/test232.scxml diff --git a/test/samples/w3c/tests/test233.scxml b/test/samples/w3c/ecma/test233.scxml index 3900d28..3900d28 100644 --- a/test/samples/w3c/tests/test233.scxml +++ b/test/samples/w3c/ecma/test233.scxml diff --git a/test/samples/w3c/tests/test234.scxml b/test/samples/w3c/ecma/test234.scxml index b874fe9..b874fe9 100644 --- a/test/samples/w3c/tests/test234.scxml +++ b/test/samples/w3c/ecma/test234.scxml diff --git a/test/samples/w3c/tests/test235.scxml b/test/samples/w3c/ecma/test235.scxml index 17d0cf0..17d0cf0 100644 --- a/test/samples/w3c/tests/test235.scxml +++ b/test/samples/w3c/ecma/test235.scxml diff --git a/test/samples/w3c/tests/test236.scxml b/test/samples/w3c/ecma/test236.scxml index 700c6f8..700c6f8 100644 --- a/test/samples/w3c/tests/test236.scxml +++ b/test/samples/w3c/ecma/test236.scxml diff --git a/test/samples/w3c/tests/test237.scxml b/test/samples/w3c/ecma/test237.scxml index b23811d..b23811d 100644 --- a/test/samples/w3c/tests/test237.scxml +++ b/test/samples/w3c/ecma/test237.scxml diff --git a/test/samples/w3c/tests/test239.scxml b/test/samples/w3c/ecma/test239.scxml index 4fcfc92..4fcfc92 100644 --- a/test/samples/w3c/tests/test239.scxml +++ b/test/samples/w3c/ecma/test239.scxml diff --git a/test/samples/w3c/tests/test239sub1.scxml b/test/samples/w3c/ecma/test239sub1.scxml index 0f099d3..0f099d3 100644 --- a/test/samples/w3c/tests/test239sub1.scxml +++ b/test/samples/w3c/ecma/test239sub1.scxml diff --git a/test/samples/w3c/tests/test240.scxml b/test/samples/w3c/ecma/test240.scxml index 6d74d4c..6d74d4c 100644 --- a/test/samples/w3c/tests/test240.scxml +++ b/test/samples/w3c/ecma/test240.scxml diff --git a/test/samples/w3c/tests/test241.scxml b/test/samples/w3c/ecma/test241.scxml index af1471f..af1471f 100644 --- a/test/samples/w3c/tests/test241.scxml +++ b/test/samples/w3c/ecma/test241.scxml diff --git a/test/samples/w3c/tests/test242.scxml b/test/samples/w3c/ecma/test242.scxml index f0fa504..f0fa504 100644 --- a/test/samples/w3c/tests/test242.scxml +++ b/test/samples/w3c/ecma/test242.scxml diff --git a/test/samples/w3c/tests/test242sub1.scxml b/test/samples/w3c/ecma/test242sub1.scxml index 0f099d3..0f099d3 100644 --- a/test/samples/w3c/tests/test242sub1.scxml +++ b/test/samples/w3c/ecma/test242sub1.scxml diff --git a/test/samples/w3c/tests/test243.scxml b/test/samples/w3c/ecma/test243.scxml index 18f2175..18f2175 100644 --- a/test/samples/w3c/tests/test243.scxml +++ b/test/samples/w3c/ecma/test243.scxml diff --git a/test/samples/w3c/tests/test244.scxml b/test/samples/w3c/ecma/test244.scxml index d251c59..d251c59 100644 --- a/test/samples/w3c/tests/test244.scxml +++ b/test/samples/w3c/ecma/test244.scxml diff --git a/test/samples/w3c/tests/test245.scxml b/test/samples/w3c/ecma/test245.scxml index 58838b2..58838b2 100644 --- a/test/samples/w3c/tests/test245.scxml +++ b/test/samples/w3c/ecma/test245.scxml diff --git a/test/samples/w3c/tests/test247.scxml b/test/samples/w3c/ecma/test247.scxml index b543bf1..b543bf1 100644 --- a/test/samples/w3c/tests/test247.scxml +++ b/test/samples/w3c/ecma/test247.scxml diff --git a/test/samples/w3c/tests/test250.scxml b/test/samples/w3c/ecma/test250.scxml index f5228ab..f5228ab 100644 --- a/test/samples/w3c/tests/test250.scxml +++ b/test/samples/w3c/ecma/test250.scxml diff --git a/test/samples/w3c/tests/test252.scxml b/test/samples/w3c/ecma/test252.scxml index 14c6686..14c6686 100644 --- a/test/samples/w3c/tests/test252.scxml +++ b/test/samples/w3c/ecma/test252.scxml diff --git a/test/samples/w3c/tests/test253.scxml b/test/samples/w3c/ecma/test253.scxml index e8924ec..e8924ec 100644 --- a/test/samples/w3c/tests/test253.scxml +++ b/test/samples/w3c/ecma/test253.scxml diff --git a/test/samples/w3c/tests/test276.scxml b/test/samples/w3c/ecma/test276.scxml index 233c171..233c171 100644 --- a/test/samples/w3c/tests/test276.scxml +++ b/test/samples/w3c/ecma/test276.scxml diff --git a/test/samples/w3c/tests/test276sub1.scxml b/test/samples/w3c/ecma/test276sub1.scxml index b18ceb2..b18ceb2 100644 --- a/test/samples/w3c/tests/test276sub1.scxml +++ b/test/samples/w3c/ecma/test276sub1.scxml diff --git a/test/samples/w3c/ecma/test277.scxml b/test/samples/w3c/ecma/test277.scxml new file mode 100644 index 0000000..eb6a1ee --- /dev/null +++ b/test/samples/w3c/ecma/test277.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that platform creates undound variable if we assign an illegal value to it. Thus + we can assign to it later in state s1. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> + <datamodel> + <data id="Var1" expr="return"/> + </datamodel> + + <state id="s0"> + <onentry> + <raise event="foo"/> + </onentry> + + <transition event="error.execution" cond="typeof Var1 === 'undefined' " target="s1"/> + <transition event="*" target="fail"/> + </state> + + <state id="s1"> + <onentry> + <assign location="Var1" expr="1"/> + </onentry> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + + </state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/tests/test278.scxml b/test/samples/w3c/ecma/test278.scxml index b26c6f2..b26c6f2 100644 --- a/test/samples/w3c/tests/test278.scxml +++ b/test/samples/w3c/ecma/test278.scxml diff --git a/test/samples/w3c/tests/test279.scxml b/test/samples/w3c/ecma/test279.scxml index 2de6fd2..2de6fd2 100644 --- a/test/samples/w3c/tests/test279.scxml +++ b/test/samples/w3c/ecma/test279.scxml diff --git a/test/samples/w3c/tests/test280.scxml b/test/samples/w3c/ecma/test280.scxml index 78865bf..78865bf 100644 --- a/test/samples/w3c/tests/test280.scxml +++ b/test/samples/w3c/ecma/test280.scxml diff --git a/test/samples/w3c/tests/test286.scxml b/test/samples/w3c/ecma/test286.scxml index 596f2ba..596f2ba 100644 --- a/test/samples/w3c/tests/test286.scxml +++ b/test/samples/w3c/ecma/test286.scxml diff --git a/test/samples/w3c/tests/test287.scxml b/test/samples/w3c/ecma/test287.scxml index 030c6b5..030c6b5 100644 --- a/test/samples/w3c/tests/test287.scxml +++ b/test/samples/w3c/ecma/test287.scxml diff --git a/test/samples/w3c/tests/test294.scxml b/test/samples/w3c/ecma/test294.scxml index efd26f4..efd26f4 100644 --- a/test/samples/w3c/tests/test294.scxml +++ b/test/samples/w3c/ecma/test294.scxml diff --git a/test/samples/w3c/tests/test298.scxml b/test/samples/w3c/ecma/test298.scxml index 6a82a95..6a82a95 100644 --- a/test/samples/w3c/tests/test298.scxml +++ b/test/samples/w3c/ecma/test298.scxml diff --git a/test/samples/w3c/tests/test301.scxml b/test/samples/w3c/ecma/test301.scxml index 59125c8..59125c8 100644 --- a/test/samples/w3c/tests/test301.scxml +++ b/test/samples/w3c/ecma/test301.scxml diff --git a/test/samples/w3c/tests/test302.scxml b/test/samples/w3c/ecma/test302.scxml index c72a311..166b4fc 100644 --- a/test/samples/w3c/tests/test302.scxml +++ b/test/samples/w3c/ecma/test302.scxml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?><!-- test that a script is evaluated at load time. <conf:script> shoudl assign the value 1 to Var1. Hence, if script is evaluated at download time, Var1 has a value in the initial state s0. -This test is valid only for datamodels that support scripting --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s0"> +This test is valid only for datamodels that support scripting --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="ecmascript" initial="s0"> <script>var Var1 = 1</script> <state id="s0"> diff --git a/test/samples/w3c/tests/test303.scxml b/test/samples/w3c/ecma/test303.scxml index dcb3490..0b1e11c 100644 --- a/test/samples/w3c/tests/test303.scxml +++ b/test/samples/w3c/ecma/test303.scxml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?><!-- to test that scripts are run as part of executable content, we check that it changes the value of a var at the -right point. This test is valid only for datamodels that support scripting --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s0"> +right point. This test is valid only for datamodels that support scripting --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="ecmascript" initial="s0"> <datamodel> <data id="Var1" expr="0"/> </datamodel> diff --git a/test/samples/w3c/tests/test304.scxml b/test/samples/w3c/ecma/test304.scxml index cdb4c22..250d0cd 100644 --- a/test/samples/w3c/tests/test304.scxml +++ b/test/samples/w3c/ecma/test304.scxml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?><!-- test that a variable declared by a script can be accessed like any other part of the data model --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s0"> +<?xml version="1.0" encoding="UTF-8"?><!-- test that a variable declared by a script can be accessed like any other part of the data model --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="ecmascript" version="1.0" initial="s0"> <script>var Var1 = 1</script> <state id="s0"> diff --git a/test/samples/w3c/tests/test307.scxml b/test/samples/w3c/ecma/test307.scxml index 3f93f10..3f93f10 100644 --- a/test/samples/w3c/tests/test307.scxml +++ b/test/samples/w3c/ecma/test307.scxml diff --git a/test/samples/w3c/tests/test309.scxml b/test/samples/w3c/ecma/test309.scxml index 7ac405c..7ac405c 100644 --- a/test/samples/w3c/tests/test309.scxml +++ b/test/samples/w3c/ecma/test309.scxml diff --git a/test/samples/w3c/tests/test310.scxml b/test/samples/w3c/ecma/test310.scxml index e939ded..e939ded 100644 --- a/test/samples/w3c/tests/test310.scxml +++ b/test/samples/w3c/ecma/test310.scxml diff --git a/test/samples/w3c/tests/test311.scxml b/test/samples/w3c/ecma/test311.scxml index 851f3ad..851f3ad 100644 --- a/test/samples/w3c/tests/test311.scxml +++ b/test/samples/w3c/ecma/test311.scxml diff --git a/test/samples/w3c/tests/test312.scxml b/test/samples/w3c/ecma/test312.scxml index a9741e5..a9741e5 100644 --- a/test/samples/w3c/tests/test312.scxml +++ b/test/samples/w3c/ecma/test312.scxml diff --git a/test/samples/w3c/tests/test313.scxml b/test/samples/w3c/ecma/test313.scxml index fcec4ac..fcec4ac 100644 --- a/test/samples/w3c/tests/test313.scxml +++ b/test/samples/w3c/ecma/test313.scxml diff --git a/test/samples/w3c/tests/test314.scxml b/test/samples/w3c/ecma/test314.scxml index ed78e79..ed78e79 100644 --- a/test/samples/w3c/tests/test314.scxml +++ b/test/samples/w3c/ecma/test314.scxml diff --git a/test/samples/w3c/tests/test318.scxml b/test/samples/w3c/ecma/test318.scxml index 15bf7f8..15bf7f8 100644 --- a/test/samples/w3c/tests/test318.scxml +++ b/test/samples/w3c/ecma/test318.scxml diff --git a/test/samples/w3c/tests/test319.scxml b/test/samples/w3c/ecma/test319.scxml index adac328..adac328 100644 --- a/test/samples/w3c/tests/test319.scxml +++ b/test/samples/w3c/ecma/test319.scxml diff --git a/test/samples/w3c/tests/test321.scxml b/test/samples/w3c/ecma/test321.scxml index fe70937..66fcf58 100644 --- a/test/samples/w3c/tests/test321.scxml +++ b/test/samples/w3c/ecma/test321.scxml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?><!-- test that _sessionid is bound on startup --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0" name="machineName"> <datamodel> - <data id="Var1" expr="$_sessionid"/> + <data id="Var1" expr="_sessionid"/> </datamodel> <state id="s0"> diff --git a/test/samples/w3c/tests/test322.scxml b/test/samples/w3c/ecma/test322.scxml index 2d0fee1..2d0fee1 100644 --- a/test/samples/w3c/tests/test322.scxml +++ b/test/samples/w3c/ecma/test322.scxml diff --git a/test/samples/w3c/tests/test323.scxml b/test/samples/w3c/ecma/test323.scxml index 01ca4cb..43fa9c8 100644 --- a/test/samples/w3c/tests/test323.scxml +++ b/test/samples/w3c/ecma/test323.scxml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?><!-- test that _name is bound on startup --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript" name="machineName"> <datamodel> - <data id="Var1" expr="$_name"/> + <data id="Var1" expr="_name"/> </datamodel> <state id="s0"> diff --git a/test/samples/w3c/tests/test324.scxml b/test/samples/w3c/ecma/test324.scxml index 7e5023e..7e5023e 100644 --- a/test/samples/w3c/tests/test324.scxml +++ b/test/samples/w3c/ecma/test324.scxml diff --git a/test/samples/w3c/tests/test325.scxml b/test/samples/w3c/ecma/test325.scxml index eaa4c22..eaa4c22 100644 --- a/test/samples/w3c/tests/test325.scxml +++ b/test/samples/w3c/ecma/test325.scxml diff --git a/test/samples/w3c/tests/test326.scxml b/test/samples/w3c/ecma/test326.scxml index f18a661..f18a661 100644 --- a/test/samples/w3c/tests/test326.scxml +++ b/test/samples/w3c/ecma/test326.scxml diff --git a/test/samples/w3c/tests/test329.scxml b/test/samples/w3c/ecma/test329.scxml index 9a95643..9a95643 100644 --- a/test/samples/w3c/tests/test329.scxml +++ b/test/samples/w3c/ecma/test329.scxml diff --git a/test/samples/w3c/tests/test330.scxml b/test/samples/w3c/ecma/test330.scxml index 5cbf4bc..5cbf4bc 100644 --- a/test/samples/w3c/tests/test330.scxml +++ b/test/samples/w3c/ecma/test330.scxml diff --git a/test/samples/w3c/tests/test331.scxml b/test/samples/w3c/ecma/test331.scxml index e1271f0..e1271f0 100644 --- a/test/samples/w3c/tests/test331.scxml +++ b/test/samples/w3c/ecma/test331.scxml diff --git a/test/samples/w3c/tests/test332.scxml b/test/samples/w3c/ecma/test332.scxml index da68cf4..da68cf4 100644 --- a/test/samples/w3c/tests/test332.scxml +++ b/test/samples/w3c/ecma/test332.scxml diff --git a/test/samples/w3c/tests/test333.scxml b/test/samples/w3c/ecma/test333.scxml index cb9721a..cb9721a 100644 --- a/test/samples/w3c/tests/test333.scxml +++ b/test/samples/w3c/ecma/test333.scxml diff --git a/test/samples/w3c/tests/test335.scxml b/test/samples/w3c/ecma/test335.scxml index 57da1ba..57da1ba 100644 --- a/test/samples/w3c/tests/test335.scxml +++ b/test/samples/w3c/ecma/test335.scxml diff --git a/test/samples/w3c/tests/test336.scxml b/test/samples/w3c/ecma/test336.scxml index 92bd3dd..92bd3dd 100644 --- a/test/samples/w3c/tests/test336.scxml +++ b/test/samples/w3c/ecma/test336.scxml diff --git a/test/samples/w3c/tests/test337.scxml b/test/samples/w3c/ecma/test337.scxml index c4c663e..c4c663e 100644 --- a/test/samples/w3c/tests/test337.scxml +++ b/test/samples/w3c/ecma/test337.scxml diff --git a/test/samples/w3c/tests/test338.scxml b/test/samples/w3c/ecma/test338.scxml index fef53be..fef53be 100644 --- a/test/samples/w3c/tests/test338.scxml +++ b/test/samples/w3c/ecma/test338.scxml diff --git a/test/samples/w3c/tests/test339.scxml b/test/samples/w3c/ecma/test339.scxml index 7ffbabf..7ffbabf 100644 --- a/test/samples/w3c/tests/test339.scxml +++ b/test/samples/w3c/ecma/test339.scxml diff --git a/test/samples/w3c/tests/test342.scxml b/test/samples/w3c/ecma/test342.scxml index 2934704..2934704 100644 --- a/test/samples/w3c/tests/test342.scxml +++ b/test/samples/w3c/ecma/test342.scxml diff --git a/test/samples/w3c/tests/test343.scxml b/test/samples/w3c/ecma/test343.scxml index 9765739..9765739 100644 --- a/test/samples/w3c/tests/test343.scxml +++ b/test/samples/w3c/ecma/test343.scxml diff --git a/test/samples/w3c/tests/test344.scxml b/test/samples/w3c/ecma/test344.scxml index cd1c8a2..cd1c8a2 100644 --- a/test/samples/w3c/tests/test344.scxml +++ b/test/samples/w3c/ecma/test344.scxml diff --git a/test/samples/w3c/tests/test346.scxml b/test/samples/w3c/ecma/test346.scxml index 622de71..622de71 100644 --- a/test/samples/w3c/tests/test346.scxml +++ b/test/samples/w3c/ecma/test346.scxml diff --git a/test/samples/w3c/ecma/test347.scxml b/test/samples/w3c/ecma/test347.scxml new file mode 100644 index 0000000..7ed7cca --- /dev/null +++ b/test/samples/w3c/ecma/test347.scxml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that the scxml event I/O processor works by sending events back and forth between an invoked child +and its parent process --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0"> + + +<state id="s0" initial="s01"> + <invoke id="child" type="scxml"> + <content> + <scxml initial="sub0" version="1.0" datamodel="ecmascript" name="machineName"> + <state id="sub0"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" target="#_parent" event="childToParent"/> + </onentry> + <transition event="parentToChild" target="subFinal"/> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <onentry> + <send delay="20s" event="timeout"/> + </onentry> + <transition event="timeout" target="fail"/> + + <state id="s01"> + <transition event="childToParent" target="s02"/> + </state> + + <state id="s02"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" target="#_child" event="parentToChild"/> + </onentry> + <transition event="done.invoke" target="pass"/> + <transition event="error" target="fail"/> + </state> +</state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test348.scxml b/test/samples/w3c/ecma/test348.scxml new file mode 100644 index 0000000..dc4b301 --- /dev/null +++ b/test/samples/w3c/ecma/test348.scxml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0"> + + <!-- test that event param of send sets the name of the event --> + +<state id="s0"> + + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" event="s0Event"/> + </onentry> + <transition event="s0Event" target="pass"/> + <transition event="*" target="fail"/> + +</state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test349.scxml b/test/samples/w3c/ecma/test349.scxml new file mode 100644 index 0000000..7fe2408 --- /dev/null +++ b/test/samples/w3c/ecma/test349.scxml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that value in origin field can be used to send an event back to the sender --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> +<datamodel> + <data id="Var1"/> + </datamodel> + +<state id="s0"> + + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" event="s0Event"/> + </onentry> + <transition event="s0Event" target="s2"> + <assign location="Var1" expr="_event.origin"/> + </transition> + <transition event="*" target="fail"/> + +</state> + +<state id="s2"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" targetexpr="Var1" event="s0Event2"/> + </onentry> + <transition event="s0Event2" target="pass"/> + <transition event="*" target="fail"/> +</state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test350.scxml b/test/samples/w3c/ecma/test350.scxml new file mode 100644 index 0000000..b401ab1 --- /dev/null +++ b/test/samples/w3c/ecma/test350.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that target value is used to decide what session to deliver the event to. A session should be +able to send an event to itself using its own session ID as the target --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0"> +<datamodel> + <data id="Var1" expr="'#_scxml_' + _sessionid"/> + </datamodel> + +<state id="s0"> + + <onentry> + <send delay="5s" event="timeout"/> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" targetexpr="Var1" event="s0Event"/> + </onentry> + <transition event="s0Event" target="pass"/> + <transition event="*" target="fail"/> + +</state> + + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test351.scxml b/test/samples/w3c/ecma/test351.scxml new file mode 100644 index 0000000..a308a14 --- /dev/null +++ b/test/samples/w3c/ecma/test351.scxml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that sendid is set in event if present in send, blank otherwise --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0"> +<datamodel> + <data id="Var1"/> + <data id="Var2"/> + </datamodel> + + +<state id="s0"> + + <onentry> + <send delay="5s" event="timeout"/> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" id="send1" event="s0Event"/> + </onentry> + <transition event="s0Event" target="s1"> + <assign location="Var1" expr="_event.sendid"/> + </transition> + <transition event="*" target="fail"> + </transition> + +</state> + +<state id="s1"> + <transition cond="Var1=='send1'" target="s2"/> + <transition target="fail"/> + </state> + +<state id="s2"> + + <onentry> + <send delay="5s" event="timeout"/> + <send event="s0Event2"/> + </onentry> + <transition event="s0Event2" target="s3"> + <assign location="Var2" expr="_event.sendid"/> + </transition> + <transition event="*" target="fail"/> +</state> + +<state id="s3"> + <transition cond="!Var2" target="pass"/> + <transition target="fail"/> + </state> + + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test352.scxml b/test/samples/w3c/ecma/test352.scxml new file mode 100644 index 0000000..513089a --- /dev/null +++ b/test/samples/w3c/ecma/test352.scxml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test the origintype is 'http://www.w3.org/TR/scxml/#SCXMLEventProcessor' --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> +<datamodel> + <data id="Var1"/> + </datamodel> + + +<state id="s0"> + <onentry> + <send delay="5s" event="timeout"/> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" event="s0Event"/> + </onentry> + <transition event="s0Event" target="s1"> + <assign location="Var1" expr="_event.origintype"/> + </transition> + <transition event="*" target="fail"> + </transition> + +</state> + +<state id="s1"> + <transition cond="Var1=='http://www.w3.org/TR/scxml/#SCXMLEventProcessor'" target="pass"/> + <transition target="fail"/> + </state> + + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/tests/test355.scxml b/test/samples/w3c/ecma/test355.scxml index 6a77251..6a77251 100644 --- a/test/samples/w3c/tests/test355.scxml +++ b/test/samples/w3c/ecma/test355.scxml diff --git a/test/samples/w3c/tests/test364.scxml b/test/samples/w3c/ecma/test364.scxml index ac57647..ac57647 100644 --- a/test/samples/w3c/tests/test364.scxml +++ b/test/samples/w3c/ecma/test364.scxml diff --git a/test/samples/w3c/tests/test372.scxml b/test/samples/w3c/ecma/test372.scxml index 9b6c7ec..9b6c7ec 100644 --- a/test/samples/w3c/tests/test372.scxml +++ b/test/samples/w3c/ecma/test372.scxml diff --git a/test/samples/w3c/tests/test375.scxml b/test/samples/w3c/ecma/test375.scxml index 1652588..1652588 100644 --- a/test/samples/w3c/tests/test375.scxml +++ b/test/samples/w3c/ecma/test375.scxml diff --git a/test/samples/w3c/tests/test376.scxml b/test/samples/w3c/ecma/test376.scxml index 1da5a9a..1da5a9a 100644 --- a/test/samples/w3c/tests/test376.scxml +++ b/test/samples/w3c/ecma/test376.scxml diff --git a/test/samples/w3c/tests/test377.scxml b/test/samples/w3c/ecma/test377.scxml index 49549c8..49549c8 100644 --- a/test/samples/w3c/tests/test377.scxml +++ b/test/samples/w3c/ecma/test377.scxml diff --git a/test/samples/w3c/tests/test378.scxml b/test/samples/w3c/ecma/test378.scxml index 34501fb..34501fb 100644 --- a/test/samples/w3c/tests/test378.scxml +++ b/test/samples/w3c/ecma/test378.scxml diff --git a/test/samples/w3c/tests/test387.scxml b/test/samples/w3c/ecma/test387.scxml index 35fb910..35fb910 100644 --- a/test/samples/w3c/tests/test387.scxml +++ b/test/samples/w3c/ecma/test387.scxml diff --git a/test/samples/w3c/tests/test388.scxml b/test/samples/w3c/ecma/test388.scxml index 6a93fd0..6a93fd0 100644 --- a/test/samples/w3c/tests/test388.scxml +++ b/test/samples/w3c/ecma/test388.scxml diff --git a/test/samples/w3c/tests/test396.scxml b/test/samples/w3c/ecma/test396.scxml index dbbb124..dbbb124 100644 --- a/test/samples/w3c/tests/test396.scxml +++ b/test/samples/w3c/ecma/test396.scxml diff --git a/test/samples/w3c/tests/test399.scxml b/test/samples/w3c/ecma/test399.scxml index e5a951e..e5a951e 100644 --- a/test/samples/w3c/tests/test399.scxml +++ b/test/samples/w3c/ecma/test399.scxml diff --git a/test/samples/w3c/tests/test401.scxml b/test/samples/w3c/ecma/test401.scxml index 9ce7217..9ce7217 100644 --- a/test/samples/w3c/tests/test401.scxml +++ b/test/samples/w3c/ecma/test401.scxml diff --git a/test/samples/w3c/tests/test402.scxml b/test/samples/w3c/ecma/test402.scxml index 104483d..104483d 100644 --- a/test/samples/w3c/tests/test402.scxml +++ b/test/samples/w3c/ecma/test402.scxml diff --git a/test/samples/w3c/tests/test403a.scxml b/test/samples/w3c/ecma/test403a.scxml index 89a4ad9..89a4ad9 100644 --- a/test/samples/w3c/tests/test403a.scxml +++ b/test/samples/w3c/ecma/test403a.scxml diff --git a/test/samples/w3c/tests/test403b.scxml b/test/samples/w3c/ecma/test403b.scxml index 18acfb5..18acfb5 100644 --- a/test/samples/w3c/tests/test403b.scxml +++ b/test/samples/w3c/ecma/test403b.scxml diff --git a/test/samples/w3c/tests/test403c.scxml b/test/samples/w3c/ecma/test403c.scxml index 9e7fd12..9e7fd12 100644 --- a/test/samples/w3c/tests/test403c.scxml +++ b/test/samples/w3c/ecma/test403c.scxml diff --git a/test/samples/w3c/tests/test404.scxml b/test/samples/w3c/ecma/test404.scxml index ad6bb24..ad6bb24 100644 --- a/test/samples/w3c/tests/test404.scxml +++ b/test/samples/w3c/ecma/test404.scxml diff --git a/test/samples/w3c/tests/test405.scxml b/test/samples/w3c/ecma/test405.scxml index 114cf22..114cf22 100644 --- a/test/samples/w3c/tests/test405.scxml +++ b/test/samples/w3c/ecma/test405.scxml diff --git a/test/samples/w3c/tests/test406.scxml b/test/samples/w3c/ecma/test406.scxml index a8f8f99..a8f8f99 100644 --- a/test/samples/w3c/tests/test406.scxml +++ b/test/samples/w3c/ecma/test406.scxml diff --git a/test/samples/w3c/tests/test407.scxml b/test/samples/w3c/ecma/test407.scxml index 0407c99..0407c99 100644 --- a/test/samples/w3c/tests/test407.scxml +++ b/test/samples/w3c/ecma/test407.scxml diff --git a/test/samples/w3c/tests/test409.scxml b/test/samples/w3c/ecma/test409.scxml index 9b4f1aa..9b4f1aa 100644 --- a/test/samples/w3c/tests/test409.scxml +++ b/test/samples/w3c/ecma/test409.scxml diff --git a/test/samples/w3c/tests/test411.scxml b/test/samples/w3c/ecma/test411.scxml index 8e1c673..8e1c673 100644 --- a/test/samples/w3c/tests/test411.scxml +++ b/test/samples/w3c/ecma/test411.scxml diff --git a/test/samples/w3c/tests/test412.scxml b/test/samples/w3c/ecma/test412.scxml index 4a8b26a..4a8b26a 100644 --- a/test/samples/w3c/tests/test412.scxml +++ b/test/samples/w3c/ecma/test412.scxml diff --git a/test/samples/w3c/tests/test413.scxml b/test/samples/w3c/ecma/test413.scxml index 94e32a2..94e32a2 100644 --- a/test/samples/w3c/tests/test413.scxml +++ b/test/samples/w3c/ecma/test413.scxml diff --git a/test/samples/w3c/tests/test416.scxml b/test/samples/w3c/ecma/test416.scxml index 45799e4..45799e4 100644 --- a/test/samples/w3c/tests/test416.scxml +++ b/test/samples/w3c/ecma/test416.scxml diff --git a/test/samples/w3c/tests/test417.scxml b/test/samples/w3c/ecma/test417.scxml index 5ca6144..5ca6144 100644 --- a/test/samples/w3c/tests/test417.scxml +++ b/test/samples/w3c/ecma/test417.scxml diff --git a/test/samples/w3c/tests/test419.scxml b/test/samples/w3c/ecma/test419.scxml index c4de17e..c4de17e 100644 --- a/test/samples/w3c/tests/test419.scxml +++ b/test/samples/w3c/ecma/test419.scxml diff --git a/test/samples/w3c/tests/test421.scxml b/test/samples/w3c/ecma/test421.scxml index 1747334..1747334 100644 --- a/test/samples/w3c/tests/test421.scxml +++ b/test/samples/w3c/ecma/test421.scxml diff --git a/test/samples/w3c/tests/test422.scxml b/test/samples/w3c/ecma/test422.scxml index 803f75f..803f75f 100644 --- a/test/samples/w3c/tests/test422.scxml +++ b/test/samples/w3c/ecma/test422.scxml diff --git a/test/samples/w3c/tests/test423.scxml b/test/samples/w3c/ecma/test423.scxml index f6287ab..f6287ab 100644 --- a/test/samples/w3c/tests/test423.scxml +++ b/test/samples/w3c/ecma/test423.scxml diff --git a/test/samples/w3c/tests/test436.scxml b/test/samples/w3c/ecma/test436.scxml index d8b2ca2..d8b2ca2 100644 --- a/test/samples/w3c/tests/test436.scxml +++ b/test/samples/w3c/ecma/test436.scxml diff --git a/test/samples/w3c/tests/test444.scxml b/test/samples/w3c/ecma/test444.scxml index c689674..c689674 100644 --- a/test/samples/w3c/tests/test444.scxml +++ b/test/samples/w3c/ecma/test444.scxml diff --git a/test/samples/w3c/tests/test445.scxml b/test/samples/w3c/ecma/test445.scxml index f1ae24b..f1ae24b 100644 --- a/test/samples/w3c/tests/test445.scxml +++ b/test/samples/w3c/ecma/test445.scxml diff --git a/test/samples/w3c/tests/test448.scxml b/test/samples/w3c/ecma/test448.scxml index adbc121..adbc121 100644 --- a/test/samples/w3c/tests/test448.scxml +++ b/test/samples/w3c/ecma/test448.scxml diff --git a/test/samples/w3c/tests/test449.scxml b/test/samples/w3c/ecma/test449.scxml index d06cc9a..d06cc9a 100644 --- a/test/samples/w3c/tests/test449.scxml +++ b/test/samples/w3c/ecma/test449.scxml diff --git a/test/samples/w3c/tests/test451.scxml b/test/samples/w3c/ecma/test451.scxml index e939ded..e939ded 100644 --- a/test/samples/w3c/tests/test451.scxml +++ b/test/samples/w3c/ecma/test451.scxml diff --git a/test/samples/w3c/tests/test452.scxml b/test/samples/w3c/ecma/test452.scxml index 4f38ca7..4f38ca7 100644 --- a/test/samples/w3c/tests/test452.scxml +++ b/test/samples/w3c/ecma/test452.scxml diff --git a/test/samples/w3c/tests/test453.scxml b/test/samples/w3c/ecma/test453.scxml index 33b904d..33b904d 100644 --- a/test/samples/w3c/tests/test453.scxml +++ b/test/samples/w3c/ecma/test453.scxml diff --git a/test/samples/w3c/tests/test456.scxml b/test/samples/w3c/ecma/test456.scxml index 35925e4..2865fb2 100644 --- a/test/samples/w3c/tests/test456.scxml +++ b/test/samples/w3c/ecma/test456.scxml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?><!-- we can't test that _any_ ecmascript is valid inside <script>, so we just run a simple one and check that it can update the data model. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> <datamodel> - <data id="Var1"/> + <data id="Var1" expr="0"/> </datamodel> <state id="s0"> diff --git a/test/samples/w3c/tests/test457.scxml b/test/samples/w3c/ecma/test457.scxml index 86cf156..86cf156 100644 --- a/test/samples/w3c/tests/test457.scxml +++ b/test/samples/w3c/ecma/test457.scxml diff --git a/test/samples/w3c/tests/test460.scxml b/test/samples/w3c/ecma/test460.scxml index 8ba3e5e..8ba3e5e 100644 --- a/test/samples/w3c/tests/test460.scxml +++ b/test/samples/w3c/ecma/test460.scxml diff --git a/test/samples/w3c/tests/test463.scxml b/test/samples/w3c/ecma/test463.scxml index 4f32b84..4f32b84 100644 --- a/test/samples/w3c/tests/test463.scxml +++ b/test/samples/w3c/ecma/test463.scxml diff --git a/test/samples/w3c/tests/test464.scxml b/test/samples/w3c/ecma/test464.scxml index bd640f2..bd640f2 100644 --- a/test/samples/w3c/tests/test464.scxml +++ b/test/samples/w3c/ecma/test464.scxml diff --git a/test/samples/w3c/tests/test465.scxml b/test/samples/w3c/ecma/test465.scxml index a91bb06..a91bb06 100644 --- a/test/samples/w3c/tests/test465.scxml +++ b/test/samples/w3c/ecma/test465.scxml diff --git a/test/samples/w3c/tests/test466.scxml b/test/samples/w3c/ecma/test466.scxml index 1431fab..1431fab 100644 --- a/test/samples/w3c/tests/test466.scxml +++ b/test/samples/w3c/ecma/test466.scxml diff --git a/test/samples/w3c/tests/test467.scxml b/test/samples/w3c/ecma/test467.scxml index 130b7bc..130b7bc 100644 --- a/test/samples/w3c/tests/test467.scxml +++ b/test/samples/w3c/ecma/test467.scxml diff --git a/test/samples/w3c/tests/test468.scxml b/test/samples/w3c/ecma/test468.scxml index 3b6902d..3b6902d 100644 --- a/test/samples/w3c/tests/test468.scxml +++ b/test/samples/w3c/ecma/test468.scxml diff --git a/test/samples/w3c/tests/test469.scxml b/test/samples/w3c/ecma/test469.scxml index 02fe476..02fe476 100644 --- a/test/samples/w3c/tests/test469.scxml +++ b/test/samples/w3c/ecma/test469.scxml diff --git a/test/samples/w3c/tests/test470.scxml b/test/samples/w3c/ecma/test470.scxml index 3c26bb1..3c26bb1 100644 --- a/test/samples/w3c/tests/test470.scxml +++ b/test/samples/w3c/ecma/test470.scxml diff --git a/test/samples/w3c/tests/test473.scxml b/test/samples/w3c/ecma/test473.scxml index 4a57129..4a57129 100644 --- a/test/samples/w3c/tests/test473.scxml +++ b/test/samples/w3c/ecma/test473.scxml diff --git a/test/samples/w3c/tests/test474.scxml b/test/samples/w3c/ecma/test474.scxml index decad75..decad75 100644 --- a/test/samples/w3c/tests/test474.scxml +++ b/test/samples/w3c/ecma/test474.scxml diff --git a/test/samples/w3c/tests/test475.scxml b/test/samples/w3c/ecma/test475.scxml index 0f9cdfe..0f9cdfe 100644 --- a/test/samples/w3c/tests/test475.scxml +++ b/test/samples/w3c/ecma/test475.scxml diff --git a/test/samples/w3c/tests/test476.scxml b/test/samples/w3c/ecma/test476.scxml index d3fe8e8..d3fe8e8 100644 --- a/test/samples/w3c/tests/test476.scxml +++ b/test/samples/w3c/ecma/test476.scxml diff --git a/test/samples/w3c/tests/test477.scxml b/test/samples/w3c/ecma/test477.scxml index 1726866..1726866 100644 --- a/test/samples/w3c/tests/test477.scxml +++ b/test/samples/w3c/ecma/test477.scxml diff --git a/test/samples/w3c/tests/test478.scxml b/test/samples/w3c/ecma/test478.scxml index 9821608..9821608 100644 --- a/test/samples/w3c/tests/test478.scxml +++ b/test/samples/w3c/ecma/test478.scxml diff --git a/test/samples/w3c/tests/test479.scxml b/test/samples/w3c/ecma/test479.scxml index 3d5b1ac..3d5b1ac 100644 --- a/test/samples/w3c/tests/test479.scxml +++ b/test/samples/w3c/ecma/test479.scxml diff --git a/test/samples/w3c/tests/test480.scxml b/test/samples/w3c/ecma/test480.scxml index 0fde260..0fde260 100644 --- a/test/samples/w3c/tests/test480.scxml +++ b/test/samples/w3c/ecma/test480.scxml diff --git a/test/samples/w3c/tests/test481.scxml b/test/samples/w3c/ecma/test481.scxml index a0505f6..a0505f6 100644 --- a/test/samples/w3c/tests/test481.scxml +++ b/test/samples/w3c/ecma/test481.scxml diff --git a/test/samples/w3c/tests/test482.scxml b/test/samples/w3c/ecma/test482.scxml index 00eb3fe..00eb3fe 100644 --- a/test/samples/w3c/tests/test482.scxml +++ b/test/samples/w3c/ecma/test482.scxml diff --git a/test/samples/w3c/tests/test487.scxml b/test/samples/w3c/ecma/test487.scxml index 30a50eb..30a50eb 100644 --- a/test/samples/w3c/tests/test487.scxml +++ b/test/samples/w3c/ecma/test487.scxml diff --git a/test/samples/w3c/tests/test488.scxml b/test/samples/w3c/ecma/test488.scxml index 45e775c..45e775c 100644 --- a/test/samples/w3c/tests/test488.scxml +++ b/test/samples/w3c/ecma/test488.scxml diff --git a/test/samples/w3c/ecma/test495.scxml b/test/samples/w3c/ecma/test495.scxml new file mode 100644 index 0000000..e3a8e58 --- /dev/null +++ b/test/samples/w3c/ecma/test495.scxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that the scxml event i/o processor puts events in the correct queues.--><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> + + +<state id="s0"> + <onentry> + <!-- default target is external queue --> + <send event="event1" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor"/> + <send event="event2" target="#_internal" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor"/> + </onentry> + <!-- we should get the internal event first --> + <transition event="event1" target="fail"/> + <transition event="event2" target="s1"/> + </state> + +<state id="s1"> + <transition event="event1" target="pass"/> + <transition event="*" target="fail"/> + </state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test500.scxml b/test/samples/w3c/ecma/test500.scxml new file mode 100644 index 0000000..26beec6 --- /dev/null +++ b/test/samples/w3c/ecma/test500.scxml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that location field is found inside entry for SCXML Event I/O processor --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> +<datamodel> + <data id="Var1" expr="_ioprocessors['http://www.w3.org/TR/scxml/#SCXMLEventProcessor'].location"/> + </datamodel> + +<state id="s0"> + <transition cond="Var1" target="pass"/> + <transition target="fail"/> + + </state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test501.scxml b/test/samples/w3c/ecma/test501.scxml new file mode 100644 index 0000000..6cca0f5 --- /dev/null +++ b/test/samples/w3c/ecma/test501.scxml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that the location entry for the SCXML Event I/O processor can be used as the target for an event --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> +<datamodel> + <data id="Var1" expr="_ioprocessors['http://www.w3.org/TR/scxml/#SCXMLEventProcessor'].location"/> + </datamodel> + +<state id="s0"> + <onentry> + <send targetexpr="Var1" event="foo"/> + <send event="timeout" delay="2s"/> + </onentry> + <transition event="foo" target="pass"/> + <transition event="*" target="fail"/> + + </state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/tests/test503.scxml b/test/samples/w3c/ecma/test503.scxml index 6e1ab2b..6e1ab2b 100644 --- a/test/samples/w3c/tests/test503.scxml +++ b/test/samples/w3c/ecma/test503.scxml diff --git a/test/samples/w3c/tests/test504.scxml b/test/samples/w3c/ecma/test504.scxml index 6e2679b..6e2679b 100644 --- a/test/samples/w3c/tests/test504.scxml +++ b/test/samples/w3c/ecma/test504.scxml diff --git a/test/samples/w3c/tests/test505.scxml b/test/samples/w3c/ecma/test505.scxml index 01d326b..01d326b 100644 --- a/test/samples/w3c/tests/test505.scxml +++ b/test/samples/w3c/ecma/test505.scxml diff --git a/test/samples/w3c/tests/test506.scxml b/test/samples/w3c/ecma/test506.scxml index 1a7a1da..1a7a1da 100644 --- a/test/samples/w3c/tests/test506.scxml +++ b/test/samples/w3c/ecma/test506.scxml diff --git a/test/samples/w3c/tests/test521.scxml b/test/samples/w3c/ecma/test521.scxml index e4b00d8..e4b00d8 100644 --- a/test/samples/w3c/tests/test521.scxml +++ b/test/samples/w3c/ecma/test521.scxml diff --git a/test/samples/w3c/tests/test525.scxml b/test/samples/w3c/ecma/test525.scxml index 432e760..432e760 100644 --- a/test/samples/w3c/tests/test525.scxml +++ b/test/samples/w3c/ecma/test525.scxml diff --git a/test/samples/w3c/tests/test527.scxml b/test/samples/w3c/ecma/test527.scxml index 426cc6c..426cc6c 100644 --- a/test/samples/w3c/tests/test527.scxml +++ b/test/samples/w3c/ecma/test527.scxml diff --git a/test/samples/w3c/tests/test528.scxml b/test/samples/w3c/ecma/test528.scxml index 9f1ebd4..9f1ebd4 100644 --- a/test/samples/w3c/tests/test528.scxml +++ b/test/samples/w3c/ecma/test528.scxml diff --git a/test/samples/w3c/tests/test529.scxml b/test/samples/w3c/ecma/test529.scxml index 91dc002..91dc002 100644 --- a/test/samples/w3c/tests/test529.scxml +++ b/test/samples/w3c/ecma/test529.scxml diff --git a/test/samples/w3c/tests/test530.scxml b/test/samples/w3c/ecma/test530.scxml index 9361181..9361181 100644 --- a/test/samples/w3c/tests/test530.scxml +++ b/test/samples/w3c/ecma/test530.scxml diff --git a/test/samples/w3c/tests/test533.scxml b/test/samples/w3c/ecma/test533.scxml index a4550e3..a4550e3 100644 --- a/test/samples/w3c/tests/test533.scxml +++ b/test/samples/w3c/ecma/test533.scxml diff --git a/test/samples/w3c/tests/test537.scxml b/test/samples/w3c/ecma/test537.scxml index 350d422..350d422 100644 --- a/test/samples/w3c/tests/test537.scxml +++ b/test/samples/w3c/ecma/test537.scxml diff --git a/test/samples/w3c/tests/test539.scxml b/test/samples/w3c/ecma/test539.scxml index 450bfd9..450bfd9 100644 --- a/test/samples/w3c/tests/test539.scxml +++ b/test/samples/w3c/ecma/test539.scxml diff --git a/test/samples/w3c/tests/test539.txt b/test/samples/w3c/ecma/test539.txt index de1b0a1..de1b0a1 100644 --- a/test/samples/w3c/tests/test539.txt +++ b/test/samples/w3c/ecma/test539.txt diff --git a/test/samples/w3c/tests/test540.scxml b/test/samples/w3c/ecma/test540.scxml index 641509f..641509f 100644 --- a/test/samples/w3c/tests/test540.scxml +++ b/test/samples/w3c/ecma/test540.scxml diff --git a/test/samples/w3c/tests/test540.txt b/test/samples/w3c/ecma/test540.txt index 2191239..2191239 100644 --- a/test/samples/w3c/tests/test540.txt +++ b/test/samples/w3c/ecma/test540.txt diff --git a/test/samples/w3c/tests/test542.scxml b/test/samples/w3c/ecma/test542.scxml index 1101471..1101471 100644 --- a/test/samples/w3c/tests/test542.scxml +++ b/test/samples/w3c/ecma/test542.scxml diff --git a/test/samples/w3c/tests/test544.scxml b/test/samples/w3c/ecma/test544.scxml index fd09502..fd09502 100644 --- a/test/samples/w3c/tests/test544.scxml +++ b/test/samples/w3c/ecma/test544.scxml diff --git a/test/samples/w3c/tests/test546.scxml b/test/samples/w3c/ecma/test546.scxml index 728843b..728843b 100644 --- a/test/samples/w3c/tests/test546.scxml +++ b/test/samples/w3c/ecma/test546.scxml diff --git a/test/samples/w3c/tests/test547.scxml b/test/samples/w3c/ecma/test547.scxml index 8c04c95..8c04c95 100644 --- a/test/samples/w3c/tests/test547.scxml +++ b/test/samples/w3c/ecma/test547.scxml diff --git a/test/samples/w3c/tests/test550.scxml b/test/samples/w3c/ecma/test550.scxml index 0ca4c1a..0ca4c1a 100644 --- a/test/samples/w3c/tests/test550.scxml +++ b/test/samples/w3c/ecma/test550.scxml diff --git a/test/samples/w3c/tests/test551.scxml b/test/samples/w3c/ecma/test551.scxml index cd267eb..cd267eb 100644 --- a/test/samples/w3c/tests/test551.scxml +++ b/test/samples/w3c/ecma/test551.scxml diff --git a/test/samples/w3c/tests/test552.scxml b/test/samples/w3c/ecma/test552.scxml index 94267c6..94267c6 100644 --- a/test/samples/w3c/tests/test552.scxml +++ b/test/samples/w3c/ecma/test552.scxml diff --git a/test/samples/w3c/tests/test552.txt b/test/samples/w3c/ecma/test552.txt index d8263ee..d8263ee 100644 --- a/test/samples/w3c/tests/test552.txt +++ b/test/samples/w3c/ecma/test552.txt diff --git a/test/samples/w3c/tests/test553.scxml b/test/samples/w3c/ecma/test553.scxml index 114c4a2..114c4a2 100644 --- a/test/samples/w3c/tests/test553.scxml +++ b/test/samples/w3c/ecma/test553.scxml diff --git a/test/samples/w3c/tests/test554.scxml b/test/samples/w3c/ecma/test554.scxml index b328ae9..b328ae9 100644 --- a/test/samples/w3c/tests/test554.scxml +++ b/test/samples/w3c/ecma/test554.scxml diff --git a/test/samples/w3c/tests/test555.scxml b/test/samples/w3c/ecma/test555.scxml index 79dea75..79dea75 100644 --- a/test/samples/w3c/tests/test555.scxml +++ b/test/samples/w3c/ecma/test555.scxml diff --git a/test/samples/w3c/tests/test557.scxml b/test/samples/w3c/ecma/test557.scxml index 6f4eed1..6f4eed1 100644 --- a/test/samples/w3c/tests/test557.scxml +++ b/test/samples/w3c/ecma/test557.scxml diff --git a/test/samples/w3c/tests/test557.txt b/test/samples/w3c/ecma/test557.txt index a8e51da..a8e51da 100644 --- a/test/samples/w3c/tests/test557.txt +++ b/test/samples/w3c/ecma/test557.txt diff --git a/test/samples/w3c/tests/test558.scxml b/test/samples/w3c/ecma/test558.scxml index a075100..a075100 100644 --- a/test/samples/w3c/tests/test558.scxml +++ b/test/samples/w3c/ecma/test558.scxml diff --git a/test/samples/w3c/tests/test558.txt b/test/samples/w3c/ecma/test558.txt index bb2bcc7..bb2bcc7 100644 --- a/test/samples/w3c/tests/test558.txt +++ b/test/samples/w3c/ecma/test558.txt diff --git a/test/samples/w3c/tests/test560.scxml b/test/samples/w3c/ecma/test560.scxml index d283b1a..d283b1a 100644 --- a/test/samples/w3c/tests/test560.scxml +++ b/test/samples/w3c/ecma/test560.scxml diff --git a/test/samples/w3c/tests/test561.scxml b/test/samples/w3c/ecma/test561.scxml index 40f414a..e50e00c 100644 --- a/test/samples/w3c/tests/test561.scxml +++ b/test/samples/w3c/ecma/test561.scxml @@ -1,5 +1,5 @@ -<?xml version="1.0" encoding="UTF-8"?><!-- in the ECMA data model, test that processor creates correct DOM structure in - _event.data when receiving XML in an event --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> +<?xml version="1.0" encoding="UTF-8"?><!-- in the ECMA data model, test that processor creates an ECMAScript object + _event.data when receiving JSON in an event --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> <state id="s0"> diff --git a/test/samples/w3c/tests/test562.scxml b/test/samples/w3c/ecma/test562.scxml index f5997bb..f5997bb 100644 --- a/test/samples/w3c/tests/test562.scxml +++ b/test/samples/w3c/ecma/test562.scxml diff --git a/test/samples/w3c/ecma/test568.scxml b/test/samples/w3c/ecma/test568.scxml new file mode 100644 index 0000000..79d7c92 --- /dev/null +++ b/test/samples/w3c/ecma/test568.scxml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that location field is found inside entry for SCXML Event I/O processor in the XPath +data model. The tests for the relevant event i/o processors will test that it can be used to +send events. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + + +<state id="s0"> + <transition cond="$_ioprocessors/scxml/location/text()" target="pass"/> + <transition target="fail"/> + + </state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/tests/test569.scxml b/test/samples/w3c/ecma/test569.scxml index 832a0c0..832a0c0 100644 --- a/test/samples/w3c/tests/test569.scxml +++ b/test/samples/w3c/ecma/test569.scxml diff --git a/test/samples/w3c/tests/test570.scxml b/test/samples/w3c/ecma/test570.scxml index 2f5ccbe..2f5ccbe 100644 --- a/test/samples/w3c/tests/test570.scxml +++ b/test/samples/w3c/ecma/test570.scxml diff --git a/test/samples/w3c/tests/test576.scxml b/test/samples/w3c/ecma/test576.scxml index 2bed2ca..2bed2ca 100644 --- a/test/samples/w3c/tests/test576.scxml +++ b/test/samples/w3c/ecma/test576.scxml diff --git a/test/samples/w3c/ecma/test578.scxml b/test/samples/w3c/ecma/test578.scxml new file mode 100644 index 0000000..bdb5e2d --- /dev/null +++ b/test/samples/w3c/ecma/test578.scxml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- in the ECMA data model, test that processor creates an ECMAScript object + _event.data when receiving JSON in an event --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> + + +<state id="s0"> + <onentry> + <send event="foo"> + <content>{ productName : "bar", size : 27 }</content> + </send> + </onentry> + <transition event="foo" cond="_event.data.productName == 'bar'" target="pass"/> + <transition event="*" target="fail"/> + </state> + + +<final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> +<final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/tests/test441a.scxml b/test/samples/w3c/tests/test441a.scxml deleted file mode 100644 index 31ed3b2..0000000 --- a/test/samples/w3c/tests/test441a.scxml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="null" version="1.0" exmode="lax" initial="s01"> - -<!-- since exmode=lax, the processor should ignore all datamodel elements and complete without an error --> -<datamodel> - <data id="Var1" expr="1"/> - </datamodel> - -<state id="s0"> - <onentry> - <assign location="foo" expr="2"/> - <script> - x = y - </script> - <foreach array="baz" item="bat"> - <log expr="this is a mistake"/> - </foreach> - </onentry> - - <state id="s01" initial="s01final"> - <final id="s01final"> - <donedata> - <param name="result" expr="foo"/> - </donedata> - </final> - </state> - - <transition cond="Var1==1" target="fail"/> - <transition event="error" target="fail"/> - <transition event="done" target="s1"/> - </state> - -<state id="s1"> - <onentry> - <raise event="noerror"/> - </onentry> - <transition event="error" target="fail"/> - <transition event="noerror" target="pass"/> - </state> - -<final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> -<final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> - - -</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/tests/test441b.scxml b/test/samples/w3c/tests/test441b.scxml deleted file mode 100644 index 1a35eba..0000000 --- a/test/samples/w3c/tests/test441b.scxml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="null" version="1.0" exmode="strict" initial="s01"> - -<!-- since exmode=strict, the processor should reject this document. Therefore this is a manual test --> -<datamodel> - <data id="Var1" expr="1"/> - </datamodel> - -<state id="s0"> - <onentry> - <assign location="foo" expr="2"/> - <script> - x = y - </script> - <foreach array="baz" item="bat"> - <log expr="this is a mistake"/> - </foreach> - </onentry> - - - <state id="s01" initial="s01final"> - <final id="s01final"> - <donedata> - <param name="result" expr="foo"/> - </donedata> - </final> - </state> - - <transition target="fail"/> - - </state> - -<state id="s1"> - <onentry> - <raise event="noerror"/> - </onentry> - <transition event="error" target="fail"/> - <transition event="noerror" target="pass"/> - </state> - -<final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> -<final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> - - -</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/tests/test486b.scxml b/test/samples/w3c/tests/test486b.scxml deleted file mode 100644 index c6cf7be..0000000 --- a/test/samples/w3c/tests/test486b.scxml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><!-- test that <script> is processed according to 'exmode'. In this - case, the entire file should be rejected (hence this is a manual test --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" name="scxmltest" exmode="strict" initial="s0" version="1.0" datamodel="xpath"> - <script>some script</script> - -<state id="s0"> - - <transition target="fail"/> - - </state> - -<final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> -<final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> - -</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/robots.txt b/test/samples/w3c/txml/robots.txt new file mode 100644 index 0000000..54f3e01 --- /dev/null +++ b/test/samples/w3c/txml/robots.txt @@ -0,0 +1,96 @@ +# +# robots.txt for http://www.w3.org/ +# +# $Id: robots.txt,v 1.66 2012/07/17 21:30:56 gerald Exp $ +# + +# For use by search.w3.org +User-agent: W3C-gsa +Disallow: /Out-Of-Date + +User-agent: W3T_SE +Disallow: /Out-Of-Date + +User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT; MS Search 4.0 Robot) +Disallow: / + +# W3C Link checker +User-agent: W3C-checklink +Disallow: + +# the following settings apply to all bots +User-agent: * +# Blogs - WordPress +# https://codex.wordpress.org/Search_Engine_Optimization_for_WordPress#Robots.txt_Optimization +Disallow: /*/wp-admin/ +Disallow: /*/wp-includes/ +Disallow: /*/wp-content/plugins/ +Disallow: /*/wp-content/cache/ +Disallow: /*/wp-content/themes/ +Disallow: /blog/*/trackback/ +Disallow: /blog/*/feed/ +Disallow: /blog/*/comments/ +Disallow: /blog/*/category/*/* +Disallow: /blog/*/*/trackback/ +Disallow: /blog/*/*/feed/ +Disallow: /blog/*/*/comments/ +Disallow: /blog/*/*? +Disallow: /community/trackback/ +Disallow: /community/feed/ +Disallow: /community/comments/ +Disallow: /community/category/*/* +Disallow: /community/*/trackback/ +Disallow: /community/*/feed/ +Disallow: /community/*/comments/ +Disallow: /community/*/category/*/* +Disallow: /community/*? +Disallow: /Consortium/Offices/trackback/ +Disallow: /Consortium/Offices/feed/ +Disallow: /Consortium/Offices/comments/ +Disallow: /Consortium/Offices/category/*/* +Disallow: /Consortium/Offices/*/trackback/ +Disallow: /Consortium/Offices/*/feed/ +Disallow: /Consortium/Offices/*/comments/ +Disallow: /Consortium/Offices/*? +# Wikis - Mediawiki +# https://www.mediawiki.org/wiki/Manual:Robots.txt +Disallow: /wiki/index.php? +Disallow: /wiki/index.php/Help +Disallow: /wiki/index.php/MediaWiki +Disallow: /wiki/index.php/Special: +Disallow: /wiki/index.php/Template +Disallow: /wiki/skins/ +Disallow: /*/wiki/index.php? +Disallow: /*/wiki/index.php/Help +Disallow: /*/wiki/index.php/MediaWiki +Disallow: /*/wiki/index.php/Special: +Disallow: /*/wiki/index.php/Template +# various other access-controlled or expensive areas +Disallow: /2004/ontaria/basic +Disallow: /Team/ +Disallow: /Project +Disallow: /Web +Disallow: /Systems +Disallow: /History +Disallow: /Out-Of-Date +Disallow: /2002/02/mid +Disallow: /mid/ +Disallow: /2005/06/blog/ +Disallow: /2004/08/W3CTalks +Disallow: /2007/11/Talks/search +Disallow: /People/all/ +Disallow: /RDF/Validator/ARPServlet +Disallow: /2003/03/Translations/byLanguage +Disallow: /2003/03/Translations/byTechnology +Disallow: /2005/11/Translations/Query +Disallow: /2000/06/webdata/xslt +Disallow: /2000/09/webdata/xslt +Disallow: /2005/08/online_xslt/xslt +Disallow: /Bugs/ +Disallow: /Search/Mail/Public/ +Disallow: /2006/02/chartergen +Disallow: /2004/01/pp-impl +Disallow: /Consortium/supporters +Disallow: /2007/08/pyRdfa/ +Disallow: /WAI/PF/comments/ + diff --git a/test/samples/w3c/txml/test189.txml b/test/samples/w3c/txml/test189.txml new file mode 100644 index 0000000..cd1cd19 --- /dev/null +++ b/test/samples/w3c/txml/test189.txml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<!-- we test that #_internal as a target of <send> puts the event on the internal queue. If it does, +event1 will be processed before event2, because event1 is added to the internal queue while event2 is +added to the external queue (event though event2 is generated first) --> + +<scxml initial="s0" version="1.0" conf:datamodel="" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> + + +<state id="s0"> + <onentry> + <!-- goes to the external queue --> + <send event="event2"/> + <!-- to the internal queue --> + <send event="event1" target="#_internal"/> + </onentry> + + <!-- once we've entered the state, we should check for internal events first --> + <transition event="event1" conf:targetpass=""/> + <transition event="event2" conf:targetfail=""/> + </state> + + <conf:pass/> + <conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test190.txml b/test/samples/w3c/txml/test190.txml new file mode 100644 index 0000000..e6090eb --- /dev/null +++ b/test/samples/w3c/txml/test190.txml @@ -0,0 +1,38 @@ +<?xml version="1.0"?> +<!-- we test that #_scxml_sessionid as a target of <send> puts the event on the external queue. If it does, +event1 will be processed before event2, because event1 is added to the internal queue while event2 is +added to the external queue (event though event2 is generated first). we have to make sure that event2 +is actually delivered. The delayed <send> makes sure another event is generated (so the test doesn't hang) --> + +<scxml initial="s0" version="1.0" conf:datamodel="" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> +<datamodel> + <data conf:id="1" conf:quoteExpr="#_scxml_"/> + <data conf:id="2" conf:systemVarExpr="_sessionid"/> + </datamodel> + +<state id="s0"> + <onentry> + <conf:concatVars id1="1" id2="2"/> + <!-- goes to the external queue --> + <send event="event2" conf:targetExpr="1"/> + <!-- to the internal queue --> + <raise event="event1"/> + <!-- this should get added to the external queue after event2 --> + <send event="timeout"/> + </onentry> + + <!-- once we've entered the state, we should check for internal events first --> + <transition event="event1" target="s1"/> + <transition event="*" conf:targetfail=""/> + </state> + +<!-- now check that we get event2 and not a timeout --> +<state id="s1"> + <transition event="event2" conf:targetpass=""/> + <transition event="*" conf:targetfail=""/> + </state> + + <conf:pass/> + <conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test191.txml b/test/samples/w3c/txml/test191.txml new file mode 100644 index 0000000..60b44a9 --- /dev/null +++ b/test/samples/w3c/txml/test191.txml @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!-- we test that #_parent works as a target of <send> . a subscript is invoked and sends the event +childToParent to its parent session (ths session) using #_parent as the target. If we get this event, we +pass, otherwise we fail. The timer insures that some event is generated and that the test does not hang. --> + +<scxml initial="s0" version="1.0" conf:datamodel="" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> + + +<state id="s0" > + <onentry> + <send event="timeout" delay="5s"/> + </onentry> + <invoke type="scxml" > + <content> + <!-- send an event to the parent session using #_parent as the target --> + <scxml initial="sub0" version="1.0" conf:datamodel="" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> + <state id="sub0"> + <onentry> + <send event="childToParent" target="#_parent"/> + </onentry> + <transition target="subFinal"/> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="childToParent" conf:targetpass=""/> + <transition event="*" conf:targetpass=""/> +</state> + + <conf:pass/> + <conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test192.txml b/test/samples/w3c/txml/test192.txml new file mode 100644 index 0000000..7331750 --- /dev/null +++ b/test/samples/w3c/txml/test192.txml @@ -0,0 +1,58 @@ +<?xml version="1.0"?> +<!-- we test that #_invokeid works as a target of <send> . A child script is invoked and sends us +childToParent once its running. Then we send it the event parentToChild using its invokeid as the target. +If it receives this event, it sends sends the event eventReceived to its parent session (ths session). +If we get this event, we pass, otherwise the child script eventually times out sends invoke.done and we fail. +We also set a timeout in this process to make sure the test doesn't hang --> + +<scxml initial="s0" conf:datamodel="" version="1.0" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> + +<state id="s0" initial="s01" > + <onentry> + <send event="timeout" delay="5s"/> + </onentry> + + <invoke type="scxml" id="invokedChild"> + <content> + <!-- let the parent session know we're running by sending childToParent, then wait for parentToChild. + If we get it, send eventReceived. If we don't we eventually time out --> + <scxml initial="sub0" version="1.0" conf:datamodel="" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> + + <state id="sub0"> + <onentry> + <send event="childToParent" target="#_parent"/> + <send event="timeout" delay="3s"/> + </onentry> + + <transition event="parentToChild" target="subFinal"> + <send target="#_parent" event="eventReceived"/> + </transition> + + <transition event="timeout" target="subFinal"/> + </state> + + <final id="subFinal"/> + + </scxml> + </content> + </invoke> + + <transition event="timeout" conf:targetfail=""/> + <transition event="done.invoke" conf:targetfail=""/> + +<state id="s01"> + <transition event="childToParent" target="s02"> + <send target="#_invokedChild" event="parentToChild"/> + </transition> +</state> + +<state id="s02"> + <transition event="eventReceived" conf:targetpass=""/> + </state> + +</state> + + <conf:pass/> + <conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test226.txml b/test/samples/w3c/txml/test226.txml index 843bfdc..0d83070 100644 --- a/test/samples/w3c/txml/test226.txml +++ b/test/samples/w3c/txml/test226.txml @@ -13,7 +13,7 @@ success. otherwise it will hang and the timeout in this doc signifies failure. </onentry> - <invoke type="http://www.w3.org/TR/scxml/" src="file:test226sub1.txml"> + <invoke type="http://www.w3.org/TR/scxml/" src="file:test226sub1.scxml"> <param conf:name="1" conf:expr="1"/> </invoke> diff --git a/test/samples/w3c/txml/test302.txml b/test/samples/w3c/txml/test302.txml index f1b99c0..b5ecbae 100644 --- a/test/samples/w3c/txml/test302.txml +++ b/test/samples/w3c/txml/test302.txml @@ -4,7 +4,7 @@ Var1. Hence, if script is evaluated at download time, Var1 has a value in the initial state s0. This test is valid only for datamodels that support scripting --> -<scxml version="1.0" xmlns="http://www.w3.org/2005/07/scxml" +<scxml version="1.0" xmlns="http://www.w3.org/2005/07/scxml" conf:datamodel="" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0"> <conf:script/> diff --git a/test/samples/w3c/txml/test303.txml b/test/samples/w3c/txml/test303.txml index 6fd1e9c..b7fe556 100644 --- a/test/samples/w3c/txml/test303.txml +++ b/test/samples/w3c/txml/test303.txml @@ -3,7 +3,8 @@ <!-- to test that scripts are run as part of executable content, we check that it changes the value of a var at the right point. This test is valid only for datamodels that support scripting --> -<scxml version="1.0" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0"> +<scxml version="1.0" xmlns="http://www.w3.org/2005/07/scxml" + conf:datamodel="" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0"> <datamodel> <data conf:id="1" conf:expr="0"/> </datamodel> diff --git a/test/samples/w3c/txml/test304.txml b/test/samples/w3c/txml/test304.txml index 9ed6cbb..a165ff8 100644 --- a/test/samples/w3c/txml/test304.txml +++ b/test/samples/w3c/txml/test304.txml @@ -2,7 +2,8 @@ <!-- test that a variable declared by a script can be accessed like any other part of the data model --> -<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0"> +<scxml xmlns="http://www.w3.org/2005/07/scxml" conf:datamodel="" + version="1.0" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0"> <conf:script/> <state id="s0"> diff --git a/test/samples/w3c/txml/test321.txml b/test/samples/w3c/txml/test321.txml index 74da9c3..9cd6b02 100644 --- a/test/samples/w3c/txml/test321.txml +++ b/test/samples/w3c/txml/test321.txml @@ -4,7 +4,7 @@ <scxml initial="s0" conf:datamodel="" version="1.0" xmlns="http://www.w3.org/2005/07/scxml" name="machineName" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> <datamodel> - <data conf:id="1" conf:expr="$_sessionid"/> + <data conf:id="1" conf:systemVarExpr="_sessionid"/> </datamodel> <state id="s0"> diff --git a/test/samples/w3c/txml/test323.txml b/test/samples/w3c/txml/test323.txml index afd3400..a16333c 100644 --- a/test/samples/w3c/txml/test323.txml +++ b/test/samples/w3c/txml/test323.txml @@ -4,7 +4,7 @@ <scxml initial="s0" version="1.0" xmlns="http://www.w3.org/2005/07/scxml" conf:datamodel="" name="machineName" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> <datamodel> - <data conf:id="1" conf:expr="$_name"/> + <data conf:id="1" conf:systemVarExpr="_name"/> </datamodel> <state id="s0"> diff --git a/test/samples/w3c/txml/test347.txml b/test/samples/w3c/txml/test347.txml new file mode 100644 index 0000000..4a87324 --- /dev/null +++ b/test/samples/w3c/txml/test347.txml @@ -0,0 +1,44 @@ +<?xml version="1.0"?> + +<!-- test that the scxml event I/O processor works by sending events back and forth between an invoked child +and its parent process --> + +<scxml initial="s0" conf:datamodel="" version="1.0" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> + + +<state id="s0" initial="s01"> + <invoke id="child" type="scxml" > + <content> + <scxml initial="sub0" version="1.0" conf:datamodel="" name="machineName" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> + <state id="sub0"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" target="#_parent" event="childToParent"/> + </onentry> + <transition event="parentToChild" target="subFinal"/> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <onentry> + <send delay="20s" event="timeout"/> + </onentry> + <transition event="timeout" conf:targetfail=""/> + + <state id="s01"> + <transition event="childToParent" target="s02"/> + </state> + + <state id="s02"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" target="#_child" event="parentToChild"/> + </onentry> + <transition event="done.invoke" conf:targetpass=""/> + <transition event="error" conf:targetfail=""/> + </state> +</state> + + <conf:pass/> + <conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test348.txml b/test/samples/w3c/txml/test348.txml new file mode 100644 index 0000000..c633a74 --- /dev/null +++ b/test/samples/w3c/txml/test348.txml @@ -0,0 +1,20 @@ +<?xml version="1.0"?> + +<scxml initial="s0" conf:datamodel="" version="1.0" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> + + <!-- test that event param of send sets the name of the event --> + +<state id="s0"> + + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" event="s0Event"/> + </onentry> + <transition event="s0Event" conf:targetpass=""/> + <transition event="*" conf:targetfail=""/> + +</state> + + <conf:pass/> + <conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test349.txml b/test/samples/w3c/txml/test349.txml new file mode 100644 index 0000000..6b1fff1 --- /dev/null +++ b/test/samples/w3c/txml/test349.txml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> + +<!-- test that value in origin field can be used to send an event back to the sender --> + +<scxml initial="s0" version="1.0" conf:datamodel="" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> +<datamodel> + <data conf:id="1"/> + </datamodel> + +<state id="s0"> + + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" event="s0Event"/> + </onentry> + <transition event="s0Event" target="s2"> + <assign conf:location="1" conf:eventField="origin"/> + </transition> + <transition event="*" conf:targetfail=""/> + +</state> + +<state id="s2"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" conf:targetVar="1" event="s0Event2"/> + </onentry> + <transition event="s0Event2" conf:targetpass=""/> + <transition event="*" conf:targetfail=""/> +</state> + + <conf:pass/> + <conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test350.txml b/test/samples/w3c/txml/test350.txml new file mode 100644 index 0000000..b57e881 --- /dev/null +++ b/test/samples/w3c/txml/test350.txml @@ -0,0 +1,26 @@ +<?xml version="1.0"?> + +<!-- test that target value is used to decide what session to deliver the event to. A session should be +able to send an event to itself using its own session ID as the target --> + +<scxml initial="s0" conf:datamodel="" version="1.0" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> +<datamodel> + <data conf:id="1" conf:expr="'#_scxml_' + _sessionid"/> + </datamodel> + +<state id="s0"> + + <onentry> + <send delay="5s" event="timeout"/> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" conf:targetVar="1" event="s0Event"/> + </onentry> + <transition event="s0Event" conf:targetpass=""/> + <transition event="*" conf:targetfail=""/> + +</state> + + + <conf:pass/> + <conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test351.txml b/test/samples/w3c/txml/test351.txml new file mode 100644 index 0000000..de3bfcc --- /dev/null +++ b/test/samples/w3c/txml/test351.txml @@ -0,0 +1,52 @@ +<?xml version="1.0"?> + +<!-- test that sendid is set in event if present in send, blank otherwise --> + +<scxml initial="s0" conf:datamodel="" version="1.0" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> +<datamodel> + <data conf:id="1"/> + <data conf:id="2"/> + </datamodel> + + +<state id="s0"> + + <onentry> + <send delay="5s" event="timeout"/> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" id="send1" event="s0Event"/> + </onentry> + <transition event="s0Event" target="s1"> + <assign conf:location="1" conf:eventField="sendid"/> + </transition> + <transition event="*" conf:targetfail=""> + </transition> + +</state> + +<state id="s1"> + <transition conf:idQuoteVal="1=send1" target="s2"/> + <transition conf:targetfail=""/> + </state> + +<state id="s2"> + + <onentry> + <send delay="5s" event="timeout"/> + <send event="s0Event2"/> + </onentry> + <transition event="s0Event2" target="s3"> + <assign conf:location="2" conf:eventField="sendid"/> + </transition> + <transition event="*" conf:targetfail=""/> +</state> + +<state id="s3"> + <transition conf:noValue="2" conf:targetpass=""/> + <transition conf:targetfail=""/> + </state> + + + <conf:pass/> + <conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test352.txml b/test/samples/w3c/txml/test352.txml new file mode 100644 index 0000000..448a21e --- /dev/null +++ b/test/samples/w3c/txml/test352.txml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> + +<!-- test the origintype is 'http://www.w3.org/TR/scxml/#SCXMLEventProcessor' --> +<scxml initial="s0" version="1.0" conf:datamodel="" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> +<datamodel> + <data conf:id="1"/> + </datamodel> + + +<state id="s0"> + <onentry> + <send delay="5s" event="timeout"/> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" event="s0Event"/> + </onentry> + <transition event="s0Event" target="s1"> + <assign conf:location="1" conf:eventField="origintype"/> + </transition> + <transition event="*" conf:targetfail=""> + </transition> + +</state> + +<state id="s1"> + <transition conf:idQuoteVal="1=http://www.w3.org/TR/scxml/#SCXMLEventProcessor" conf:targetpass=""/> + <transition conf:targetfail=""/> + </state> + + + <conf:pass/> + <conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test441a.txml b/test/samples/w3c/txml/test441a.txml deleted file mode 100644 index 9e290a8..0000000 --- a/test/samples/w3c/txml/test441a.txml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<scxml xmlns="http://www.w3.org/2005/07/scxml" datamodel="null" -xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" exmode="lax" initial="s01"> - -<!-- since exmode=lax, the processor should ignore all datamodel elements and complete without an error --> -<datamodel> - <data conf:id="1" conf:expr="1"/> - </datamodel> - -<state id="s0"> - <onentry> - <assign location="foo" expr="2"/> - <script> - x = y - </script> - <foreach array="baz" item="bat"> - <log expr="this is a mistake"/> - </foreach> - </onentry> - - <state id="s01" initial="s01final"> - <final id="s01final"> - <donedata> - <param name="result" expr="foo"/> - </donedata> - </final> - </state> - - <transition conf:idVal="1=1" conf:targetfail=""/> - <transition event="error" conf:targetfail=""/> - <transition event="done" target="s1"/> - </state> - -<state id="s1"> - <onentry> - <raise event="noerror"/> - </onentry> - <transition event="error" conf:targetfail=""/> - <transition event="noerror" conf:targetpass=""/> - </state> - -<conf:pass/> -<conf:fail/> - - -</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test441b.txml b/test/samples/w3c/txml/test441b.txml deleted file mode 100644 index a318b9b..0000000 --- a/test/samples/w3c/txml/test441b.txml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<scxml xmlns="http://www.w3.org/2005/07/scxml" datamodel="null" -xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" exmode="strict" initial="s01"> - -<!-- since exmode=strict, the processor should reject this document. Therefore this is a manual test --> -<datamodel> - <data conf:id="1" conf:expr="1"/> - </datamodel> - -<state id="s0"> - <onentry> - <assign location="foo" expr="2"/> - <script> - x = y - </script> - <foreach array="baz" item="bat"> - <log expr="this is a mistake"/> - </foreach> - </onentry> - - - <state id="s01" initial="s01final"> - <final id="s01final"> - <donedata> - <param name="result" expr="foo"/> - </donedata> - </final> - </state> - - <transition conf:targetfail=""/> - - </state> - -<state id="s1"> - <onentry> - <raise event="noerror"/> - </onentry> - <transition event="error" conf:targetfail=""/> - <transition event="noerror" conf:targetpass=""/> - </state> - -<conf:pass/> -<conf:fail/> - - -</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test456.txml b/test/samples/w3c/txml/test456.txml index 50734d7..e1365e0 100644 --- a/test/samples/w3c/txml/test456.txml +++ b/test/samples/w3c/txml/test456.txml @@ -4,7 +4,7 @@ just run a simple one and check that it can update the data model. --> <scxml initial="s0" version="1.0" datamodel="ecmascript" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> <datamodel> - <data conf:id="1"/> + <data conf:id="1" conf:expr="0"/> </datamodel> <state id="s0"> diff --git a/test/samples/w3c/txml/test486b.txml b/test/samples/w3c/txml/test486b.txml deleted file mode 100644 index bac9748..0000000 --- a/test/samples/w3c/txml/test486b.txml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0"?> - <!-- test that <script> is processed according to 'exmode'. In this - case, the entire file should be rejected (hence this is a manual test --> - - <scxml xmlns="http://www.w3.org/2005/07/scxml" name="scxmltest" exmode="strict" - xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> - <script>some script</script> - -<state id="s0"> - - <transition conf:targetfail=""/> - - </state> - -<conf:pass/> -<conf:fail/> - -</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test495.txml b/test/samples/w3c/txml/test495.txml new file mode 100644 index 0000000..a2cf76c5 --- /dev/null +++ b/test/samples/w3c/txml/test495.txml @@ -0,0 +1,26 @@ +<?xml version="1.0"?> +<!-- test that the scxml event i/o processor puts events in the correct queues.--> + +<scxml initial="s0" version="1.0" conf:datamodel="" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> + + +<state id="s0"> + <onentry> + <!-- default target is external queue --> + <send event="event1" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor"/> + <send event="event2" target="#_internal" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor"/> + </onentry> + <!-- we should get the internal event first --> + <transition event="event1" conf:targetfail=""/> + <transition event="event2" target="s1"/> + </state> + +<state id="s1"> + <transition event="event1" conf:targetpass=""/> + <transition event="*" conf:targetfail=""/> + </state> + + <conf:pass/> + <conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test500.txml b/test/samples/w3c/txml/test500.txml new file mode 100644 index 0000000..21ed2ff --- /dev/null +++ b/test/samples/w3c/txml/test500.txml @@ -0,0 +1,19 @@ +<?xml version="1.0"?> + +<!-- test that location field is found inside entry for SCXML Event I/O processor --> + +<scxml initial="s0" version="1.0" conf:datamodel="" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> +<datamodel> + <data conf:id="1" conf:scxmlEventIOLocation=""/> + </datamodel> + +<state id="s0"> + <transition conf:isBound="1" conf:targetpass=""/> + <transition conf:targetfail=""/> + + </state> + + <conf:pass/> + <conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test501.txml b/test/samples/w3c/txml/test501.txml new file mode 100644 index 0000000..772edc8 --- /dev/null +++ b/test/samples/w3c/txml/test501.txml @@ -0,0 +1,23 @@ +<?xml version="1.0"?> + +<!-- test that the location entry for the SCXML Event I/O processor can be used as the target for an event --> + +<scxml initial="s0" version="1.0" conf:datamodel="" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance"> +<datamodel> + <data conf:id="1" conf:scxmlEventIOLocation=""/> + </datamodel> + +<state id="s0"> + <onentry> + <send conf:targetVar="1" event="foo"/> + <send event="timeout" delay="2s"/> + </onentry> + <transition event="foo" conf:targetpass=""/> + <transition event="*" conf:targetfail=""/> + + </state> + + <conf:pass/> + <conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/txml/test578.txml b/test/samples/w3c/txml/test578.txml new file mode 100644 index 0000000..a4de932 --- /dev/null +++ b/test/samples/w3c/txml/test578.txml @@ -0,0 +1,24 @@ +<?xml version="1.0"?> + <!-- in the ECMA data model, test that processor creates an ECMAScript object + _event.data when receiving JSON in an event --> + + <scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> + + +<state id="s0"> + <onentry> + <send event="foo"> + <content>{ productName : "bar", size : 27 }</content> + </send> + </onentry> + <transition event="foo" cond="_event.data.productName == 'bar'" + conf:targetpass=""/> + <transition event="*" conf:targetfail=""/> + </state> + + +<conf:pass/> +<conf:fail/> + +</scxml>
\ No newline at end of file diff --git a/test/src/scxml-test-framework-client.cpp b/test/src/scxml-test-framework-client.cpp index 73df8ce..0441c0e 100644 --- a/test/src/scxml-test-framework-client.cpp +++ b/test/src/scxml-test-framework-client.cpp @@ -25,21 +25,21 @@ public: static int lastToken; static bool alreadyAnswered; // we need this for delayed events - static std::map<std::string, std::pair<uscxml::Interpreter*, uscxml::HTTPServer::Request> > _interpreters; + static std::map<std::string, std::pair<uscxml::Interpreter, uscxml::HTTPServer::Request> > _interpreters; TestIOProcessor() {} - virtual void beforeCompletion(uscxml::Interpreter* interpreter) { + virtual void beforeCompletion(uscxml::Interpreter interpreter) { onStableConfiguration(interpreter); } - virtual void afterCompletion(uscxml::Interpreter* interpreter) { - _interpreters[interpreter->getName()].second.curlReq = NULL; + virtual void afterCompletion(uscxml::Interpreter interpreter) { + _interpreters[interpreter.getName()].second.curlReq = NULL; } - virtual void beforeMicroStep(uscxml::Interpreter* interpreter) {} - virtual void beforeTakingTransitions(uscxml::Interpreter* interpreter, const Arabica::XPath::NodeSet<std::string>& transitions) {} + virtual void beforeMicroStep(uscxml::Interpreter interpreter) {} + virtual void beforeTakingTransitions(uscxml::Interpreter interpreter, const Arabica::XPath::NodeSet<std::string>& transitions) {} - virtual void beforeEnteringStates(uscxml::Interpreter* interpreter, const Arabica::XPath::NodeSet<std::string>& statesToEnter) { + virtual void beforeEnteringStates(uscxml::Interpreter interpreter, const Arabica::XPath::NodeSet<std::string>& statesToEnter) { std::cout << "Entering states: "; for (int i = 0; i < statesToEnter.size(); i++) { std::cout << ATTR(statesToEnter[i], "id") << ", "; @@ -47,18 +47,18 @@ public: std::cout << std::endl; } - virtual void afterEnteringStates(uscxml::Interpreter* interpreter) { + virtual void afterEnteringStates(uscxml::Interpreter interpreter) { std::cout << "After entering states: "; - for (int i = 0; i < interpreter->getConfiguration().size(); i++) { - std::cout << ATTR(interpreter->getConfiguration()[i], "id") << ", "; + for (int i = 0; i < interpreter.getConfiguration().size(); i++) { + std::cout << ATTR(interpreter.getConfiguration()[i], "id") << ", "; } std::cout << std::endl; } - virtual void beforeExitingStates(uscxml::Interpreter* interpreter, const Arabica::XPath::NodeSet<std::string>& statesToExit) { + virtual void beforeExitingStates(uscxml::Interpreter interpreter, const Arabica::XPath::NodeSet<std::string>& statesToExit) { std::cout << "Configuration: "; - for (int i = 0; i < interpreter->getConfiguration().size(); i++) { - std::cout << ATTR(interpreter->getConfiguration()[i], "id") << ", "; + for (int i = 0; i < interpreter.getConfiguration().size(); i++) { + std::cout << ATTR(interpreter.getConfiguration()[i], "id") << ", "; } std::cout << std::endl; std::cout << "Exiting states: "; @@ -68,22 +68,22 @@ public: std::cout << std::endl; } - virtual void afterExitingStates(uscxml::Interpreter* interpreter) { + virtual void afterExitingStates(uscxml::Interpreter interpreter) { std::cout << "After exiting states: "; - for (int i = 0; i < interpreter->getConfiguration().size(); i++) { - std::cout << ATTR(interpreter->getConfiguration()[i], "id") << ", "; + for (int i = 0; i < interpreter.getConfiguration().size(); i++) { + std::cout << ATTR(interpreter.getConfiguration()[i], "id") << ", "; } std::cout << std::endl; } - virtual void onStableConfiguration(uscxml::Interpreter* interpreter) { + virtual void onStableConfiguration(uscxml::Interpreter interpreter) { if (alreadyAnswered) return; - Arabica::XPath::NodeSet<std::string> configuration = interpreter->getConfiguration(); + Arabica::XPath::NodeSet<std::string> configuration = interpreter.getConfiguration(); uscxml::Data reply; - reply.compound["sessionToken"] = uscxml::Data(interpreter->getName()); + reply.compound["sessionToken"] = uscxml::Data(interpreter.getName()); std::string seperator; for (size_t i = 0; i < configuration.size(); i++) { if (uscxml::Interpreter::isAtomic(configuration[i])) @@ -98,7 +98,7 @@ public: alreadyAnswered = true; - uscxml::HTTPServer::Request httpRequest = _interpreters[interpreter->getName()].second; + uscxml::HTTPServer::Request httpRequest = _interpreters[interpreter.getName()].second; uscxml::HTTPServer::Reply httpReply(httpRequest); httpReply.content = replyString.str(); uscxml::HTTPServer::reply(httpReply); @@ -125,10 +125,9 @@ public: std::cout << "Starting Interpreter with " << filename << std::endl; alreadyAnswered = false; - std::map<std::string, std::pair<uscxml::Interpreter*, uscxml::HTTPServer::Request> >::iterator interpreterIter = _interpreters.begin(); + std::map<std::string, std::pair<uscxml::Interpreter, uscxml::HTTPServer::Request> >::iterator interpreterIter = _interpreters.begin(); while(interpreterIter != _interpreters.end()) { // if (interpreterIter->second.second.curlReq == NULL) { - delete interpreterIter->second.first; _interpreters.erase(interpreterIter++); // } else { // interpreterIter++; @@ -136,14 +135,14 @@ public: } - uscxml::Interpreter* interpreter = uscxml::Interpreter::fromURI(filename); + uscxml::Interpreter interpreter = uscxml::Interpreter::fromURI(filename); if (interpreter) { std::string token = uscxml::toStr(lastToken++); assert(_interpreters.find(token) == _interpreters.end()); - interpreter->setName(token); - interpreter->addMonitor(this); + interpreter.setName(token); + interpreter.addMonitor(this); _interpreters[token] = std::make_pair(interpreter, request); - interpreter->start(); + interpreter.start(); } return; } @@ -159,7 +158,7 @@ public: // evhttp_request_free(_interpreters[token].second); alreadyAnswered = false; _interpreters[token].second = request; - _interpreters[token].first->receive(event); + _interpreters[token].first.receive(event); } } @@ -171,7 +170,7 @@ public: int TestIOProcessor::lastToken; bool TestIOProcessor::alreadyAnswered; -std::map<std::string, std::pair<uscxml::Interpreter*, uscxml::HTTPServer::Request> > TestIOProcessor::_interpreters; +std::map<std::string, std::pair<uscxml::Interpreter, uscxml::HTTPServer::Request> > TestIOProcessor::_interpreters; int main(int argc, char** argv) { TestIOProcessor* testServer = new TestIOProcessor(); diff --git a/test/src/test-predicates.cpp b/test/src/test-predicates.cpp index 58faffb..954afb2 100644 --- a/test/src/test-predicates.cpp +++ b/test/src/test-predicates.cpp @@ -12,31 +12,30 @@ int main(int argc, char** argv) { using namespace Arabica::DOM; using namespace Arabica::XPath; - Interpreter* interpreter = Interpreter::fromURI(argv[1]); - interpreter->init(); + Interpreter interpreter = Interpreter::fromURI(argv[1]); assert(interpreter); - Node<std::string> atomicState = interpreter->getState("atomic"); + Node<std::string> atomicState = interpreter.getState("atomic"); assert(Interpreter::isAtomic(atomicState)); assert(!Interpreter::isParallel(atomicState)); assert(!Interpreter::isCompound(atomicState)); - Node<std::string> compoundState = interpreter->getState("compound"); + Node<std::string> compoundState = interpreter.getState("compound"); assert(!Interpreter::isAtomic(compoundState)); assert(!Interpreter::isParallel(compoundState)); assert(Interpreter::isCompound(compoundState)); - Node<std::string> parallelState = interpreter->getState("parallel"); + Node<std::string> parallelState = interpreter.getState("parallel"); assert(!Interpreter::isAtomic(parallelState)); assert(Interpreter::isParallel(parallelState)); assert(!Interpreter::isCompound(parallelState)); // parallel states are not compound! - NodeSet<std::string> initialState = interpreter->getInitialStates(); + NodeSet<std::string> initialState = interpreter.getInitialStates(); assert(initialState[0] == atomicState); - NodeSet<std::string> childs = interpreter->getChildStates(compoundState); - Node<std::string> compundChild1 = interpreter->getState("compundChild1"); - Node<std::string> compundChild2 = interpreter->getState("compundChild2"); + NodeSet<std::string> childs = interpreter.getChildStates(compoundState); + Node<std::string> compundChild1 = interpreter.getState("compundChild1"); + Node<std::string> compundChild2 = interpreter.getState("compundChild2"); assert(childs.size() > 0); assert(Interpreter::isMember(compundChild1, childs)); assert(Interpreter::isMember(compundChild2, childs)); @@ -46,17 +45,17 @@ int main(int argc, char** argv) { std::string transEvents; transEvents = "error"; - assert(Interpreter::nameMatch(transEvents, "error")); - assert(!Interpreter::nameMatch(transEvents, "foo")); + assert(InterpreterImpl::nameMatch(transEvents, "error")); + assert(!InterpreterImpl::nameMatch(transEvents, "foo")); transEvents = "error foo"; - assert(Interpreter::nameMatch(transEvents, "error")); - assert(Interpreter::nameMatch(transEvents, "error.send")); - assert(Interpreter::nameMatch(transEvents, "error.send.failed")); - assert(Interpreter::nameMatch(transEvents, "foo")); - assert(Interpreter::nameMatch(transEvents, "foo.bar")); - assert(!Interpreter::nameMatch(transEvents, "errors.my.custom")); - assert(!Interpreter::nameMatch(transEvents, "errorhandler.mistake")); - assert(!Interpreter::nameMatch(transEvents, "errOr.send")); - assert(!Interpreter::nameMatch(transEvents, "foobar")); + assert(InterpreterImpl::nameMatch(transEvents, "error")); + assert(InterpreterImpl::nameMatch(transEvents, "error.send")); + assert(InterpreterImpl::nameMatch(transEvents, "error.send.failed")); + assert(InterpreterImpl::nameMatch(transEvents, "foo")); + assert(InterpreterImpl::nameMatch(transEvents, "foo.bar")); + assert(!InterpreterImpl::nameMatch(transEvents, "errors.my.custom")); + assert(!InterpreterImpl::nameMatch(transEvents, "errorhandler.mistake")); + assert(!InterpreterImpl::nameMatch(transEvents, "errOr.send")); + assert(!InterpreterImpl::nameMatch(transEvents, "foobar")); }
\ No newline at end of file diff --git a/test/src/test-url.cpp b/test/src/test-url.cpp index 3165a20..5e8ea02 100644 --- a/test/src/test-url.cpp +++ b/test/src/test-url.cpp @@ -29,10 +29,9 @@ public: int main(int argc, char** argv) { { - Interpreter* interpreter = Interpreter::fromURI("https://raw.github.com/tklab-tud/uscxml/master/test/samples/uscxml/test-execution.scxml"); + Interpreter interpreter = Interpreter::fromURI("https://raw.github.com/tklab-tud/uscxml/master/test/samples/uscxml/test-execution.scxml"); assert(interpreter); - interpreter->interpret(); - delete interpreter; + interpreter.interpret(); } { diff --git a/test/src/test-w3c.cpp b/test/src/test-w3c.cpp index 8dc3e17..70c8b80 100644 --- a/test/src/test-w3c.cpp +++ b/test/src/test-w3c.cpp @@ -96,7 +96,7 @@ void printUsageAndExit() { } class W3CStatusMonitor : public uscxml::InterpreterMonitor { - void beforeCompletion(uscxml::Interpreter* interpreter) { + void beforeCompletion(uscxml::InterpreterImpl* interpreter) { Arabica::XPath::NodeSet<std::string> config = interpreter->getConfiguration(); if (config.size() == 1 && boost::iequals(ATTR(config[0], "id"), "pass")) exit(EXIT_SUCCESS); @@ -145,18 +145,17 @@ int main(int argc, char** argv) { // std::cout << optind << std::endl; LOG(INFO) << "Processing " << argv[optind]; - Interpreter* interpreter = Interpreter::fromURI(argv[optind]); + Interpreter interpreter = Interpreter::fromURI(argv[optind]); if (interpreter) { - interpreter->setCmdLineOptions(argc, argv); + interpreter.setCmdLineOptions(argc, argv); // interpreter->setCapabilities(Interpreter::CAN_NOTHING); // interpreter->setCapabilities(Interpreter::CAN_BASIC_HTTP | Interpreter::CAN_GENERIC_HTTP); W3CStatusMonitor* vm = new W3CStatusMonitor(); - interpreter->addMonitor(vm); + interpreter.addMonitor(vm); - interpreter->start(); - while(interpreter->runOnMainThread(25)); - delete interpreter; + interpreter.start(); + while(interpreter.runOnMainThread(25)); } return EXIT_SUCCESS; |