summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt73
-rw-r--r--apps/mmi-browser.cpp3
-rw-r--r--apps/samples/vrml-server.scxml26
-rw-r--r--contrib/cmake/FindEVENT.cmake17
-rw-r--r--contrib/cmake/FindGLOG.cmake4
-rw-r--r--contrib/cmake/FindSWI.cmake119
-rw-r--r--contrib/cmake/FindV8.cmake20
-rw-r--r--contrib/dom/idl/SCXMLEvent.idl3
-rw-r--r--contrib/dom/scripts/CodeGeneratorArabicaV8.pm4
-rw-r--r--contrib/prebuilt/include/SWI-cpp.h1093
-rw-r--r--src/uscxml/Factory.cpp41
-rw-r--r--src/uscxml/Factory.h63
-rw-r--r--src/uscxml/Interpreter.cpp559
-rw-r--r--src/uscxml/Interpreter.h40
-rw-r--r--src/uscxml/Message.cpp55
-rw-r--r--src/uscxml/Message.h5
-rw-r--r--src/uscxml/URL.cpp894
-rw-r--r--src/uscxml/URL.cpp.old519
-rw-r--r--src/uscxml/URL.h246
-rw-r--r--src/uscxml/URL.h.old154
-rw-r--r--src/uscxml/concurrency/eventqueue/DelayedEventQueue.cpp3
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp20
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h1
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp84
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h88
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp12
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp144
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h106
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp12
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp108
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h60
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp558
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h170
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp12
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp112
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h98
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp418
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h158
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp42
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h80
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp12
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp258
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h108
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp594
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h250
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp54
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h54
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h82
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp32
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h56
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h58
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp102
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h114
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h50
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp104
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h108
-rw-r--r--src/uscxml/plugins/element/fetch/FetchElement.cpp108
-rw-r--r--src/uscxml/plugins/element/fetch/FetchElement.h48
-rw-r--r--src/uscxml/plugins/element/response/ResponseElement.cpp68
-rw-r--r--src/uscxml/plugins/element/response/ResponseElement.h42
-rw-r--r--src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp16
-rw-r--r--src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp147
-rw-r--r--src/uscxml/plugins/invoker/http/HTTPServletInvoker.h55
-rw-r--r--src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp16
-rw-r--r--src/uscxml/plugins/invoker/umundo/UmundoInvoker.h8
-rw-r--r--src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.cpp395
-rw-r--r--src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h79
-rw-r--r--src/uscxml/server/HTTPServer.cpp223
-rw-r--r--src/uscxml/server/HTTPServer.h92
-rw-r--r--test/CMakeLists.txt64
-rwxr-xr-xtest/run-scxml-test-framework.sh7
-rw-r--r--test/samples/uscxml/test-custom-executable-content.scxml19
-rw-r--r--test/samples/uscxml/test-ecmascript.scxml8
-rw-r--r--test/samples/uscxml/test-http-servlet.scxml41
-rw-r--r--test/samples/uscxml/test-response-element.scxml14
-rw-r--r--test/scxml-test-framework/test-ext/node/require/require.json12
-rw-r--r--test/scxml-test-framework/test-ext/node/require/require.scxml56
-rw-r--r--test/scxml-test-framework/test-ext/node/require/script2.js1
-rw-r--r--test/scxml-test-framework/test-ext/node/require/script3.js1
-rw-r--r--test/scxml-test-framework/test-ext/node/require/script4.js1
-rw-r--r--test/scxml-test-framework/test-ext/node/require/submodule1.js1
-rw-r--r--test/scxml-test-framework/test-ext/node/require/submodule2.js1
-rw-r--r--test/scxml-test-framework/test-ext/node/require/submodule3.js1
-rw-r--r--test/scxml-test-framework/test-ext/node/require/submodule4.js1
-rw-r--r--test/scxml-test-framework/test-ext/node/runner.js11
-rw-r--r--test/scxml-test-framework/test/actionSend/send1.json14
-rw-r--r--test/scxml-test-framework/test/actionSend/send1.scxml38
-rw-r--r--test/scxml-test-framework/test/actionSend/send2.json14
-rw-r--r--test/scxml-test-framework/test/actionSend/send2.scxml44
-rw-r--r--test/scxml-test-framework/test/actionSend/send3.json14
-rw-r--r--test/scxml-test-framework/test/actionSend/send3.scxml44
-rw-r--r--test/scxml-test-framework/test/actionSend/send4.json14
-rw-r--r--test/scxml-test-framework/test/actionSend/send4.scxml68
-rw-r--r--test/scxml-test-framework/test/actionSend/send5.json14
-rw-r--r--test/scxml-test-framework/test/actionSend/send5.scxml70
-rw-r--r--test/scxml-test-framework/test/actionSend/send6.json14
-rw-r--r--test/scxml-test-framework/test/actionSend/send6.scxml72
-rw-r--r--test/scxml-test-framework/test/actionSend/send7.json14
-rw-r--r--test/scxml-test-framework/test/actionSend/send7.scxml52
-rw-r--r--test/scxml-test-framework/test/actionSend/send8.json14
-rw-r--r--test/scxml-test-framework/test/actionSend/send8.scxml52
-rw-r--r--test/scxml-test-framework/test/assign-current-small-step/test0.json14
-rw-r--r--test/scxml-test-framework/test/assign-current-small-step/test0.scxml63
-rw-r--r--test/scxml-test-framework/test/assign-current-small-step/test1.json14
-rw-r--r--test/scxml-test-framework/test/assign-current-small-step/test1.scxml49
-rw-r--r--test/scxml-test-framework/test/assign-current-small-step/test2.json14
-rw-r--r--test/scxml-test-framework/test/assign-current-small-step/test2.scxml69
-rw-r--r--test/scxml-test-framework/test/assign-current-small-step/test3.json30
-rw-r--r--test/scxml-test-framework/test/assign-current-small-step/test3.scxml75
-rw-r--r--test/scxml-test-framework/test/assign-current-small-step/test4.json14
-rw-r--r--test/scxml-test-framework/test/assign-current-small-step/test4.scxml45
-rw-r--r--test/scxml-test-framework/test/assign-next-small-step/test0.json12
-rw-r--r--test/scxml-test-framework/test/assign-next-small-step/test1.json12
-rw-r--r--test/scxml-test-framework/test/assign-next-small-step/test1.scxml53
-rw-r--r--test/scxml-test-framework/test/assign-next-small-step/test2.json13
-rw-r--r--test/scxml-test-framework/test/assign-next-small-step/test2.scxml78
-rw-r--r--test/scxml-test-framework/test/assign-next-small-step/test3.json22
-rw-r--r--test/scxml-test-framework/test/assign-next-small-step/test3.scxml81
-rw-r--r--test/scxml-test-framework/test/atom3-basic-tests/m0.json22
-rw-r--r--test/scxml-test-framework/test/atom3-basic-tests/m0.scxml37
-rw-r--r--test/scxml-test-framework/test/atom3-basic-tests/m1.json22
-rw-r--r--test/scxml-test-framework/test/atom3-basic-tests/m1.scxml7
-rw-r--r--test/scxml-test-framework/test/atom3-basic-tests/m2.json22
-rw-r--r--test/scxml-test-framework/test/atom3-basic-tests/m2.scxml7
-rw-r--r--test/scxml-test-framework/test/atom3-basic-tests/m3.json38
-rw-r--r--test/scxml-test-framework/test/atom3-basic-tests/m3.scxml7
-rw-r--r--test/scxml-test-framework/test/basic/basic0.json4
-rw-r--r--test/scxml-test-framework/test/basic/basic0.scxml11
-rw-r--r--test/scxml-test-framework/test/basic/basic1.json14
-rw-r--r--test/scxml-test-framework/test/basic/basic1.scxml19
-rw-r--r--test/scxml-test-framework/test/basic/basic2.json22
-rw-r--r--test/scxml-test-framework/test/basic/basic2.scxml24
-rw-r--r--test/scxml-test-framework/test/cond-js/TestConditionalTransition.json54
-rw-r--r--test/scxml-test-framework/test/cond-js/TestConditionalTransition.scxml116
-rw-r--r--test/scxml-test-framework/test/cond-js/test0.json14
-rw-r--r--test/scxml-test-framework/test/cond-js/test0.scxml19
-rw-r--r--test/scxml-test-framework/test/cond-js/test1.json14
-rw-r--r--test/scxml-test-framework/test/cond-js/test1.scxml23
-rw-r--r--test/scxml-test-framework/test/cond-js/test2.json14
-rw-r--r--test/scxml-test-framework/test/cond-js/test2.scxml19
-rw-r--r--test/scxml-test-framework/test/default-initial-state/initial1.json14
-rw-r--r--test/scxml-test-framework/test/default-initial-state/initial1.scxml16
-rw-r--r--test/scxml-test-framework/test/default-initial-state/initial2.json14
-rw-r--r--test/scxml-test-framework/test/default-initial-state/initial2.scxml16
-rw-r--r--test/scxml-test-framework/test/default-initial-state/initial3.json14
-rw-r--r--test/scxml-test-framework/test/default-initial-state/initial3.scxml33
-rw-r--r--test/scxml-test-framework/test/delayedSend/send1.json24
-rw-r--r--test/scxml-test-framework/test/delayedSend/send1.scxml43
-rw-r--r--test/scxml-test-framework/test/delayedSend/send2.json24
-rw-r--r--test/scxml-test-framework/test/delayedSend/send2.scxml39
-rw-r--r--test/scxml-test-framework/test/delayedSend/send3.json24
-rw-r--r--test/scxml-test-framework/test/delayedSend/send3.scxml39
-rw-r--r--test/scxml-test-framework/test/documentOrder/documentOrder0.json14
-rw-r--r--test/scxml-test-framework/test/documentOrder/documentOrder0.scxml29
-rw-r--r--test/scxml-test-framework/test/foreach/test1.json14
-rw-r--r--test/scxml-test-framework/test/foreach/test1.scxml51
-rw-r--r--test/scxml-test-framework/test/hierarchy+documentOrder/test0.json14
-rw-r--r--test/scxml-test-framework/test/hierarchy+documentOrder/test0.scxml43
-rw-r--r--test/scxml-test-framework/test/hierarchy+documentOrder/test1.json14
-rw-r--r--test/scxml-test-framework/test/hierarchy+documentOrder/test1.scxml43
-rw-r--r--test/scxml-test-framework/test/hierarchy/hier0.json14
-rw-r--r--test/scxml-test-framework/test/hierarchy/hier0.scxml29
-rw-r--r--test/scxml-test-framework/test/hierarchy/hier1.json14
-rw-r--r--test/scxml-test-framework/test/hierarchy/hier1.scxml29
-rw-r--r--test/scxml-test-framework/test/hierarchy/hier2.json14
-rw-r--r--test/scxml-test-framework/test/hierarchy/hier2.scxml29
-rw-r--r--test/scxml-test-framework/test/history/history0.json38
-rw-r--r--test/scxml-test-framework/test/history/history0.scxml39
-rw-r--r--test/scxml-test-framework/test/history/history1.json38
-rw-r--r--test/scxml-test-framework/test/history/history1.scxml43
-rw-r--r--test/scxml-test-framework/test/history/history2.json38
-rw-r--r--test/scxml-test-framework/test/history/history2.scxml43
-rw-r--r--test/scxml-test-framework/test/history/history3.json38
-rw-r--r--test/scxml-test-framework/test/history/history3.scxml67
-rw-r--r--test/scxml-test-framework/test/history/history4.json78
-rw-r--r--test/scxml-test-framework/test/history/history4.scxml143
-rw-r--r--test/scxml-test-framework/test/history/history5.json30
-rw-r--r--test/scxml-test-framework/test/history/history5.scxml99
-rw-r--r--test/scxml-test-framework/test/history/history6.json46
-rw-r--r--test/scxml-test-framework/test/history/history6.scxml59
-rw-r--r--test/scxml-test-framework/test/if-else/test0.json14
-rw-r--r--test/scxml-test-framework/test/if-else/test0.scxml155
-rw-r--r--test/scxml-test-framework/test/in/TestInPredicate.json86
-rw-r--r--test/scxml-test-framework/test/in/TestInPredicate.scxml172
-rw-r--r--test/scxml-test-framework/test/internal-transitions/test0.json17
-rw-r--r--test/scxml-test-framework/test/internal-transitions/test0.scxml56
-rw-r--r--test/scxml-test-framework/test/internal-transitions/test1.json18
-rw-r--r--test/scxml-test-framework/test/internal-transitions/test1.scxml89
-rw-r--r--test/scxml-test-framework/test/more-parallel/test0.json14
-rw-r--r--test/scxml-test-framework/test/more-parallel/test0.scxml18
-rw-r--r--test/scxml-test-framework/test/more-parallel/test1.json14
-rw-r--r--test/scxml-test-framework/test/more-parallel/test1.scxml27
-rw-r--r--test/scxml-test-framework/test/more-parallel/test10.json17
-rw-r--r--test/scxml-test-framework/test/more-parallel/test10.scxml63
-rw-r--r--test/scxml-test-framework/test/more-parallel/test2.json14
-rw-r--r--test/scxml-test-framework/test/more-parallel/test2.scxml31
-rw-r--r--test/scxml-test-framework/test/more-parallel/test3.json14
-rw-r--r--test/scxml-test-framework/test/more-parallel/test3.scxml35
-rw-r--r--test/scxml-test-framework/test/more-parallel/test4.json14
-rw-r--r--test/scxml-test-framework/test/more-parallel/test4.scxml27
-rw-r--r--test/scxml-test-framework/test/more-parallel/test5.json16
-rw-r--r--test/scxml-test-framework/test/more-parallel/test5.scxml27
-rw-r--r--test/scxml-test-framework/test/more-parallel/test6.json14
-rw-r--r--test/scxml-test-framework/test/more-parallel/test6.scxml55
-rw-r--r--test/scxml-test-framework/test/more-parallel/test7.json14
-rw-r--r--test/scxml-test-framework/test/more-parallel/test7.scxml53
-rw-r--r--test/scxml-test-framework/test/more-parallel/test8.json14
-rw-r--r--test/scxml-test-framework/test/more-parallel/test8.scxml61
-rw-r--r--test/scxml-test-framework/test/more-parallel/test9.json14
-rw-r--r--test/scxml-test-framework/test/more-parallel/test9.scxml61
-rw-r--r--test/scxml-test-framework/test/multiple-events-per-transition/test1.json30
-rw-r--r--test/scxml-test-framework/test/multiple-events-per-transition/test1.scxml26
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test0.json14
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test0.scxml29
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test1.json14
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test1.scxml47
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test10.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test10.scxml39
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test11.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test11.scxml43
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test12.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test12.scxml43
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test13.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test13.scxml43
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test14.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test14.scxml87
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test15.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test15.scxml67
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test16.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test16.scxml33
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test17.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test17.scxml33
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test18.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test18.scxml27
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test19.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test19.scxml41
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test2.json14
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test2.scxml39
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test20.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test20.scxml37
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test21.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test21.scxml37
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test22.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test22.scxml41
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test23.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test23.scxml27
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test24.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test24.scxml41
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test25.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test25.scxml37
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test26.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test26.scxml37
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test27.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test27.scxml41
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test28.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test28.scxml31
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test29.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test29.scxml31
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test3.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test3.scxml45
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test30.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test30.scxml41
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test31.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test31.scxml45
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test4.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test4.scxml51
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test5.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test5.scxml51
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test6.json14
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test6.scxml59
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test7.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test7.scxml49
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test8.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test8.scxml49
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test9.json16
-rw-r--r--test/scxml-test-framework/test/parallel+interrupt/test9.scxml47
-rw-r--r--test/scxml-test-framework/test/parallel/test0.json4
-rw-r--r--test/scxml-test-framework/test/parallel/test0.scxml19
-rw-r--r--test/scxml-test-framework/test/parallel/test1.json16
-rw-r--r--test/scxml-test-framework/test/parallel/test1.scxml56
-rw-r--r--test/scxml-test-framework/test/parallel/test1.scxml.fail (renamed from test/scxml-test-framework/test/assign-next-small-step/test0.scxml)46
-rw-r--r--test/scxml-test-framework/test/parallel/test2.json16
-rw-r--r--test/scxml-test-framework/test/parallel/test2.scxml59
-rw-r--r--test/scxml-test-framework/test/parallel/test3.json16
-rw-r--r--test/scxml-test-framework/test/parallel/test3.scxml79
-rw-r--r--test/scxml-test-framework/test/script-src/script-0-0.js2
-rw-r--r--test/scxml-test-framework/test/script-src/script-1-0.js2
-rw-r--r--test/scxml-test-framework/test/script-src/script-1-1.js2
-rw-r--r--test/scxml-test-framework/test/script-src/script-2-0.js2
-rw-r--r--test/scxml-test-framework/test/script-src/script-2-1.js2
-rw-r--r--test/scxml-test-framework/test/script-src/script-2-2.js2
-rw-r--r--test/scxml-test-framework/test/script-src/script-2-3.js2
-rw-r--r--test/scxml-test-framework/test/script-src/script-3-0.js2
-rw-r--r--test/scxml-test-framework/test/script-src/test0.json14
-rw-r--r--test/scxml-test-framework/test/script-src/test0.scxml31
-rw-r--r--test/scxml-test-framework/test/script-src/test1.json14
-rw-r--r--test/scxml-test-framework/test/script-src/test1.scxml51
-rw-r--r--test/scxml-test-framework/test/script-src/test2.json14
-rw-r--r--test/scxml-test-framework/test/script-src/test2.scxml63
-rw-r--r--test/scxml-test-framework/test/script-src/test3.json14
-rw-r--r--test/scxml-test-framework/test/script-src/test3.scxml35
-rw-r--r--test/scxml-test-framework/test/script/test0.json14
-rw-r--r--test/scxml-test-framework/test/script/test0.scxml49
-rw-r--r--test/scxml-test-framework/test/script/test1.json14
-rw-r--r--test/scxml-test-framework/test/script/test1.scxml58
-rw-r--r--test/scxml-test-framework/test/script/test2.json14
-rw-r--r--test/scxml-test-framework/test/script/test2.scxml105
-rw-r--r--test/scxml-test-framework/test/scxml-prefix-event-name-matching/star0.json14
-rw-r--r--test/scxml-test-framework/test/scxml-prefix-event-name-matching/star0.scxml24
-rw-r--r--test/scxml-test-framework/test/scxml-prefix-event-name-matching/test0.json70
-rw-r--r--test/scxml-test-framework/test/scxml-prefix-event-name-matching/test0.scxml44
-rw-r--r--test/scxml-test-framework/test/scxml-prefix-event-name-matching/test1.json70
-rw-r--r--test/scxml-test-framework/test/scxml-prefix-event-name-matching/test1.scxml52
-rw-r--r--test/scxml-test-framework/test/send-data/send1.json25
-rw-r--r--test/scxml-test-framework/test/send-data/send1.scxml82
-rw-r--r--test/scxml-test-framework/test/send-internal/test0.json14
-rw-r--r--test/scxml-test-framework/test/send-internal/test0.scxml80
-rw-r--r--test/scxml-test-framework/test/targetless-transition/test0.json14
-rw-r--r--test/scxml-test-framework/test/targetless-transition/test0.scxml40
-rw-r--r--test/scxml-test-framework/test/targetless-transition/test1.json22
-rw-r--r--test/scxml-test-framework/test/targetless-transition/test1.scxml46
-rw-r--r--test/scxml-test-framework/test/targetless-transition/test2.json22
-rw-r--r--test/scxml-test-framework/test/targetless-transition/test2.scxml52
-rw-r--r--test/scxml-test-framework/test/targetless-transition/test3.json22
-rw-r--r--test/scxml-test-framework/test/targetless-transition/test3.scxml102
-rw-r--r--test/src/scxml-test-framework-client.cpp130
-rw-r--r--test/src/test-communication.cpp.old (renamed from test/src/test-communication.cpp)0
-rw-r--r--test/src/test-completion.cpp.old (renamed from test/src/test-completion.cpp)0
-rw-r--r--test/src/test-curl-multi-api.cpp347
-rw-r--r--test/src/test-ecmascript-v8.cpp.old (renamed from test/src/test-ecmascript-v8.cpp)0
-rw-r--r--test/src/test-execution.cpp.old (renamed from test/src/test-execution.cpp)0
-rw-r--r--test/src/test-prolog-swi.cpp.old (renamed from test/src/test-prolog-swi.cpp)0
339 files changed, 10719 insertions, 7815 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f9d8864..0b655db 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.4)
# specify USCXML version
SET(USCXML_VERSION_MAJOR "0")
SET(USCXML_VERSION_MINOR "0")
-SET(USCXML_VERSION_PATCH "3")
+SET(USCXML_VERSION_PATCH "4")
SET(USCXML_VERSION ${USCXML_VERSION_MAJOR}.${USCXML_VERSION_MINOR}.${USCXML_VERSION_PATCH})
# build type has to be set before the project definition
@@ -134,9 +134,9 @@ include_directories(${USCXML_PREBUILT_LIBRARY_PATH}/include)
#message("CMAKE_FIND_ROOT_PATH: ${CMAKE_FIND_ROOT_PATH}")
if (WIN32)
- include_directories(${PROJECT_SOURCE_DIR}/contrib/snippets)
+ include_directories(${PROJECT_SOURCE_DIR}/contrib/src/getopt)
endif()
-include_directories(${PROJECT_SOURCE_DIR}/contrib/src/jsmn/)
+include_directories(${PROJECT_SOURCE_DIR}/contrib/src/jsmn)
############################################################
# General setup
@@ -373,6 +373,13 @@ list (APPEND USCXML_CORE_LIBS ${EVENT_LIBRARY})
# Actual files of core library
############################################################
+file(GLOB_RECURSE USCXML_SERVER
+ src/uscxml/server/*.cpp
+ src/uscxml/server/*.h
+)
+source_group("Interpreter" FILES ${USCXML_SERVER})
+list (APPEND USCXML_FILES ${USCXML_SERVER})
+
file(GLOB_RECURSE USCXML_CONCURRENCY
src/uscxml/concurrency/*.cpp
src/uscxml/concurrency/*.h
@@ -416,7 +423,7 @@ if (BUILD_AS_PLUGINS)
endif()
#################################################
-# optional libraries we can build as plugins
+# optional things we can build as plugins
# sample invoker - include to make sure it compiles
file(GLOB_RECURSE SAMPLE_INVOKER
@@ -453,6 +460,42 @@ else()
endif()
+# Fetch element
+
+file(GLOB_RECURSE FETCH_ELEMENT
+ src/uscxml/plugins/element/fetch/*.cpp
+ src/uscxml/plugins/element/fetch/*.h
+)
+source_group("Element" FILES ${FETCH_ELEMENT})
+if (BUILD_AS_PLUGINS)
+ add_library(
+ element_fetch SHARED
+ ${FETCH_ELEMENT})
+ target_link_libraries(element_fetch uscxml)
+ set_target_properties(element_fetch PROPERTIES FOLDER "Plugin Element")
+else()
+ list (APPEND USCXML_FILES ${FETCH_ELEMENT})
+endif()
+
+
+# Response element
+
+file(GLOB_RECURSE RESPONSE_ELEMENT
+ src/uscxml/plugins/element/response/*.cpp
+ src/uscxml/plugins/element/response/*.h
+)
+source_group("Element" FILES ${RESPONSE_ELEMENT})
+if (BUILD_AS_PLUGINS)
+ add_library(
+ element_response SHARED
+ ${RESPONSE_ELEMENT})
+ target_link_libraries(element_response uscxml)
+ set_target_properties(element_response PROPERTIES FOLDER "Plugin Element")
+else()
+ list (APPEND USCXML_FILES ${RESPONSE_ELEMENT})
+endif()
+
+
# DirMon invoker to watch for filesystem changes
file(GLOB_RECURSE DIRMON_INVOKER
@@ -646,6 +689,24 @@ else()
endif()
+# HTTP server invoker
+
+file(GLOB_RECURSE HTTPSERVER_INVOKER
+ src/uscxml/plugins/invoker/http/*.cpp
+ src/uscxml/plugins/invoker/http/*.h)
+source_group("Invoker" FILES ${HTTPSERVER_INVOKER})
+if (BUILD_AS_PLUGINS)
+ add_library(
+ invoker_httpserver SHARED
+ ${HTTPSERVER_INVOKER})
+ target_link_libraries(invoker_httpserver
+ uscxml)
+ set_target_properties(invoker_httpserver PROPERTIES FOLDER "Plugin Invoker")
+else()
+ list (APPEND USCXML_FILES ${HTTPSERVER_INVOKER})
+endif()
+
+
# Heartbeat invoker
file(GLOB_RECURSE HEARTBEAT_INVOKER
@@ -760,7 +821,9 @@ if (BUILD_TESTS)
add_subdirectory(test)
endif()
-add_subdirectory(src/bindings)
+if (NOT WIN32)
+ add_subdirectory(src/bindings)
+endif()
############################################################
# Header Files
diff --git a/apps/mmi-browser.cpp b/apps/mmi-browser.cpp
index 3ebe153..7cdd392 100644
--- a/apps/mmi-browser.cpp
+++ b/apps/mmi-browser.cpp
@@ -27,7 +27,9 @@ int main(int argc, char** argv) {
printUsageAndExit();
}
+#ifndef _WIN32
opterr = 0;
+#endif
int option;
while ((option = getopt(argc, argv, "l:p:")) != -1) {
switch(option) {
@@ -55,6 +57,7 @@ int main(int argc, char** argv) {
interpreter->setCmdLineOptions(argc, argv);
interpreter->start();
while(interpreter->runOnMainThread(25));
+ delete interpreter;
}
return EXIT_SUCCESS;
diff --git a/apps/samples/vrml-server.scxml b/apps/samples/vrml-server.scxml
index 82560ef..e88be4c 100644
--- a/apps/samples/vrml-server.scxml
+++ b/apps/samples/vrml-server.scxml
@@ -1,11 +1,31 @@
-<scxml datamodel="ecmascript" name="vrml-convert">
+<scxml datamodel="ecmascript" name="vrml">
<script src="http://uscxml.tk.informatik.tu-darmstadt.de/scripts/dump.js" />
- <state id="main">
+ <datamodel>
+ <data id="files">
+ {
+ "foo" : "bar"
+ }
+ </data>
+ </datamodel>
+ <parallel id="main">
<!-- Stop processing if no vrml-path was given on command line -->
<transition target="final" cond="_x['args']['vrml-path'] == undefined || _x['args']['vrml-path'].length == 0">
<log expr="'No --vrml-path given'" />
</transition>
+ <state id="processHttp">
+ <state id="wait">
+ <transition event="http" target="wait">
+ <script>
+ dump(_event);
+ </script>
+ <response status="200" requestexpr="_event.origin">
+ <content expr="files" />
+ </response>
+ </transition>
+ </state>
+ </state>
+
<!-- Stop processing if an error occurred -->
<transition target="final" event="error">
<log expr="'An error occured:'" />
@@ -41,6 +61,6 @@
</script>
</onentry>
</state>
- </state>
+ </parallel>
<state id="final" final="true" />
</scxml> \ No newline at end of file
diff --git a/contrib/cmake/FindEVENT.cmake b/contrib/cmake/FindEVENT.cmake
index 6a47584..ef6089b 100644
--- a/contrib/cmake/FindEVENT.cmake
+++ b/contrib/cmake/FindEVENT.cmake
@@ -10,10 +10,25 @@ FIND_PATH(EVENT_INCLUDE_DIR event2/event.h
HINTS $ENV{EVENT_SRC}
)
-FIND_LIBRARY(EVENT_LIBRARY
+FIND_LIBRARY(EVENT_LIBRARY_RELEASE
NAMES event libevent
HINTS $ENV{EVENT_SRC}/.libs/
)
+if (EVENT_LIBRARY_RELEASE)
+ list(APPEND EVENT_LIBRARY optimized ${EVENT_LIBRARY_RELEASE})
+endif()
+
+FIND_LIBRARY(EVENT_LIBRARY_DEBUG
+ NAMES event_d libevent_d
+ HINTS $ENV{EVENT_SRC}/.libs/
+)
+if (EVENT_LIBRARY_DEBUG)
+ list(APPEND EVENT_LIBRARY debug ${EVENT_LIBRARY_DEBUG})
+else()
+ if (UNIX)
+ list(APPEND EVENT_LIBRARY debug ${EVENT_LIBRARY_RELEASE})
+ endif()
+endif()
if (NOT WIN32)
FIND_LIBRARY(EVENT_LIBRARY_THREADS
diff --git a/contrib/cmake/FindGLOG.cmake b/contrib/cmake/FindGLOG.cmake
index de7236f..5dc74c1 100644
--- a/contrib/cmake/FindGLOG.cmake
+++ b/contrib/cmake/FindGLOG.cmake
@@ -24,6 +24,10 @@ FIND_LIBRARY(GLOG_LIBRARY_DEBUG
)
if (GLOG_LIBRARY_DEBUG)
list(APPEND GLOG_LIBRARY debug ${GLOG_LIBRARY_DEBUG})
+else()
+ if (UNIX)
+ list(APPEND V8_LIBRARY debug ${GLOG_LIBRARY_RELEASE})
+ endif()
endif()
INCLUDE(FindPackageHandleStandardArgs)
diff --git a/contrib/cmake/FindSWI.cmake b/contrib/cmake/FindSWI.cmake
index fb30be4..1106633 100644
--- a/contrib/cmake/FindSWI.cmake
+++ b/contrib/cmake/FindSWI.cmake
@@ -1,5 +1,28 @@
-set (SWI_SEARCH_PATHS $ENV{SWI_DIR})
+set(64BIT_HOST OFF)
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(64BIT_HOST ON)
+endif()
+
+set(SWI_PLATFORM_ID)
+if (UNIX)
+ if (APPLE AND 64BIT_HOST)
+ set(SWI_PLATFORM_ID "x86_64-${CMAKE_SYSTEM_NAME}${CMAKE_SYSTEM_VERSION}")
+ else()
+ set(SWI_PLATFORM_ID "${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_SYSTEM_NAME}${CMAKE_SYSTEM_VERSION}")
+ endif()
+else()
+ set(SWI_PLATFORM_ID "${CMAKE_SYSTEM_PROCESSOR}-windows")
+endif()
+
+if (SWI_PLATFORM_ID)
+ string(TOLOWER ${SWI_PLATFORM_ID} SWI_PLATFORM_ID)
+endif()
+
+#message("SWI_PLATFORM_ID: ${SWI_PLATFORM_ID}")
+
+set (SWI_SEARCH_PATHS)
list (APPEND SWI_SEARCH_PATHS
+ $ENV{SWI_DIR}
${CMAKE_FIND_ROOT_PATH}
"/usr/lib/swi-prolog/"
"/opt/local/"
@@ -7,12 +30,9 @@ list (APPEND SWI_SEARCH_PATHS
"C:/Program Files/swipl"
)
-set(64BIT_HOST OFF)
-if(CMAKE_SIZEOF_VOID_P EQUAL 8)
- set(64BIT_HOST ON)
-endif()
+#message("SWI_SEARCH_PATHS: ${SWI_SEARCH_PATHS}")
-set (SWI_HOME)
+set (SWI_VERSION)
set (LOOP_DONE 0)
foreach(SWI_SEARCH_PATH ${SWI_SEARCH_PATHS})
if(NOT LOOP_DONE)
@@ -21,59 +41,58 @@ foreach(SWI_SEARCH_PATH ${SWI_SEARCH_PATHS})
set(LOOP_DONE 1)
list(SORT SWI_VERSIONS)
list(REVERSE SWI_VERSIONS)
- list(GET SWI_VERSIONS 0 SWI_HOME)
+ list(GET SWI_VERSIONS 0 SWI_VERSION)
+ STRING(REGEX REPLACE ".*(([0-9]+).([0-9]+).([0-9]+))$" "\\1" SWI_VERSION "${SWI_VERSION}")
endif()
endif()
endforeach()
-set (SWI_PLATFORM_PATH)
-set (LOOP_DONE 0)
-if (SWI_HOME)
+# -- find prolog headers
+FIND_PATH(SWI_INCLUDE_DIR SWI-Prolog.h
+ PATH_SUFFIXES
+ include
+ lib/swipl-${SWI_VERSION}/include
+ PATHS ${SWI_SEARCH_PATHS}
+)
- set(SWI_CPU_SUFFIX ${CMAKE_SYSTEM_PROCESSOR})
- if (APPLE)
- if (64BIT_HOST)
- set(SWI_CPU_SUFFIX "x86_64")
- endif()
- endif()
+FIND_PATH(SWI_CPP_INCLUDE_DIR SWI-cpp.h
+ PATH_SUFFIXES
+ packages/cpp
+ lib/swipl-${SWI_VERSION}/include
+ PATHS ${SWI_SEARCH_PATHS}
+)
- file(GLOB SWI_PLATFORMS ${SWI_HOME}/lib/*)
- foreach(SWI_PLATFORM ${SWI_PLATFORMS})
- STRING(REGEX REPLACE "${SWI_HOME}/lib/" "" REL_SWI_PLATFORM ${SWI_PLATFORM})
- if(NOT LOOP_DONE)
- if (REL_SWI_PLATFORM MATCHES ".*${SWI_CPU_SUFFIX}.*")
- set (SWI_PLATFORM_PATH ${SWI_PLATFORM})
- set(LOOP_DONE 1)
- endif()
- endif()
- endforeach()
-endif()
+FIND_PROGRAM(SWI_BINARY swipl
+ PATH_SUFFIXES
+ src
+ lib/swipl-${SWI_VERSION}/bin/${SWI_PLATFORM_ID}
+ PATHS ${SWI_SEARCH_PATHS}
+)
-#message(STATUS "SWI_PLATFORM_PATH: ${SWI_PLATFORM_PATH}, SWI_HOME: ${SWI_HOME}")
+FIND_LIBRARY(SWI_LIBRARY_RELEASE
+ NAMES libswipl swipl
+ PATH_SUFFIXES
+ lib/${SWI_PLATFORM_ID} # still in source directory
+ lib/swipl-${SWI_VERSION}/lib/${SWI_PLATFORM_ID} # after make install
+ PATHS ${SWI_SEARCH_PATHS}
+)
-if (SWI_PLATFORM_PATH OR SWI_INCLUDE_HINT)
- FIND_PATH(SWI_INCLUDE_DIR SWI-Prolog.h
- PATH_SUFFIXES include
- PATHS ${SWI_HOME}
- HINTS ${SWI_INCLUDE_HINT}
- )
-
- FIND_LIBRARY(SWI_LIBRARY_RELEASE
- NAMES libswipl swipl
- PATHS ${SWI_PLATFORM_PATH}
- HINTS ${SWI_LIBRARY_HINT}
- )
+FIND_LIBRARY(SWI_LIBRARY_DEBUG
+ NAMES libswipl_d swipl_d
+ PATH_SUFFIXES
+ lib/${SWI_PLATFORM_ID} # still in source directory
+ lib/swipl-${SWI_VERSION}/lib/${SWI_PLATFORM_ID} # after make install
+ PATHS ${SWI_SEARCH_PATHS}
+)
- if (SWI_LIBRARY_RELEASE)
- list(APPEND SWI_LIBRARY optimized ${SWI_LIBRARY_RELEASE})
- set(SWI_BINARY ${SWI_PLATFORM_PATH})
+if (NOT SWI_LIBRARY_DEBUG)# no explicit debug build, just reuse release
+ if (UNIX)
+ set(SWI_LIBRARY_DEBUG ${SWI_LIBRARY_RELEASE})
endif()
+endif()
-
- FIND_LIBRARY(SWI_LIBRARY_DEBUG
- NAMES libswipl_d swipl_d
- PATHS ${SWI_PLATFORM_PATH}
- )
+if (SWI_LIBRARY_RELEASE)
+ list(APPEND SWI_LIBRARY optimized ${SWI_LIBRARY_RELEASE})
if (SWI_LIBRARY_DEBUG)
list(APPEND SWI_LIBRARY debug ${SWI_LIBRARY_DEBUG})
elseif(UNIX)
@@ -83,6 +102,8 @@ if (SWI_PLATFORM_PATH OR SWI_INCLUDE_HINT)
endif()
endif()
+#message(FATAL_ERROR "SWI_BINARY: ${SWI_BINARY} / SWI_LIBRARY_RELEASE: ${SWI_LIBRARY_RELEASE} / SWI_LIBRARY_DEBUG: ${SWI_LIBRARY_DEBUG} / SWI_INCLUDE_DIR: ${SWI_INCLUDE_DIR} / SWI_CPP_INCLUDE_DIR: ${SWI_CPP_INCLUDE_DIR}")
+
INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(SWI DEFAULT_MSG SWI_LIBRARY SWI_INCLUDE_DIR SWI_BINARY)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SWI DEFAULT_MSG SWI_LIBRARY SWI_BINARY SWI_INCLUDE_DIR SWI_CPP_INCLUDE_DIR)
MARK_AS_ADVANCED(SWI_LIBRARY SWI_INCLUDE_DIR)
diff --git a/contrib/cmake/FindV8.cmake b/contrib/cmake/FindV8.cmake
index 4606e67..819bedd 100644
--- a/contrib/cmake/FindV8.cmake
+++ b/contrib/cmake/FindV8.cmake
@@ -18,6 +18,14 @@ if (V8_LIBRARY_BASE_RELEASE)
list(APPEND V8_LIBRARY optimized ${V8_LIBRARY_BASE_RELEASE})
endif()
+FIND_LIBRARY(V8_LIBRARY_SNAPSHOT_RELEASE
+ NAMES v8_snapshot
+ HINTS $ENV{V8_SRC}/out/native/
+)
+if (V8_LIBRARY_SNAPSHOT_RELEASE)
+ list(APPEND V8_LIBRARY optimized ${V8_LIBRARY_SNAPSHOT_RELEASE})
+endif()
+
FIND_LIBRARY(V8_LIBRARY_BASE_DEBUG
NAMES v8_base_d v8_d v8_base_g v8_g
HINTS $ENV{V8_SRC}/out/native/
@@ -30,6 +38,18 @@ else()
endif()
endif()
+FIND_LIBRARY(V8_LIBRARY_SNAPSHOT_DEBUG
+ NAMES v8_snapshot_d
+ HINTS $ENV{V8_SRC}/out/native/
+)
+if (V8_LIBRARY_SNAPSHOT_DEBUG)
+ list(APPEND V8_LIBRARY debug ${V8_LIBRARY_SNAPSHOT_DEBUG})
+else()
+ if (UNIX AND V8_LIBRARY_SNAPSHOT_RELEASE)
+ list(APPEND V8_LIBRARY debug ${V8_LIBRARY_SNAPSHOT_RELEASE})
+ endif()
+endif()
+
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(V8 DEFAULT_MSG V8_LIBRARY V8_INCLUDE_DIR)
MARK_AS_ADVANCED(V8_LIBRARY V8_INCLUDE_DIR)
diff --git a/contrib/dom/idl/SCXMLEvent.idl b/contrib/dom/idl/SCXMLEvent.idl
index f70c4d4..4f3438e 100644
--- a/contrib/dom/idl/SCXMLEvent.idl
+++ b/contrib/dom/idl/SCXMLEvent.idl
@@ -1,6 +1,5 @@
[
- AttributesArePublic,
- DontDestroyWrapped
+ AttributesArePublic
] interface SCXMLEvent {
// NodeType
diff --git a/contrib/dom/scripts/CodeGeneratorArabicaV8.pm b/contrib/dom/scripts/CodeGeneratorArabicaV8.pm
index 738e981..0c7d1b5 100644
--- a/contrib/dom/scripts/CodeGeneratorArabicaV8.pm
+++ b/contrib/dom/scripts/CodeGeneratorArabicaV8.pm
@@ -137,6 +137,7 @@ sub GenerateHeader
# - Add default header template
push(@headerContent, GenerateHeaderContentHeader($interface));
+ $headerIncludes{"string"} = 1;
$headerIncludes{"uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"} = 1;
$headerIncludes{"DOM/Node.hpp"} = 1;
$headerIncludes{"v8.h"} = 1;
@@ -146,6 +147,7 @@ sub GenerateHeader
$headerIncludes{"V8${parent}.h"} = 1;
}
+ push(@headerContent, "#include \<string\>\n");
foreach my $headerInclude (sort keys(%headerIncludes)) {
if ($headerInclude =~ /wtf|v8\.h/) {
push(@headerContent, "#include \<${headerInclude}\>\n");
@@ -234,6 +236,8 @@ sub GenerateClassPrototypeHeader
v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
instance->SetInternalFieldCount(1);
END
diff --git a/contrib/prebuilt/include/SWI-cpp.h b/contrib/prebuilt/include/SWI-cpp.h
new file mode 100644
index 0000000..d32a052
--- /dev/null
+++ b/contrib/prebuilt/include/SWI-cpp.h
@@ -0,0 +1,1093 @@
+/* $Id$
+
+ Part of SWI-Prolog
+
+ Author: Jan Wielemaker
+ E-mail: J.Wielemaker@cs.vu.nl
+ WWW: http://www.swi-prolog.org
+ Copyright (C): 1985-2009, University of Amsterdam
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef _SWI_CPP_H
+#define _SWI_CPP_H
+
+#include <SWI-Prolog.h>
+#include <string.h>
+#ifndef __APPLE__
+#include <malloc.h>
+#endif
+
+#ifdef __BORLANDC__
+#define __inline inline
+#endif
+
+#ifdef _MSC_VER /* MSVC doesn't know throw doesn't return */
+#define PL_THROWN(value) return value;
+#else
+#define PL_THROWN(v) (void)0
+#endif
+
+class PlTerm;
+class PlTermv;
+
+ /*******************************
+ * PROLOG CONSTANTS *
+ *******************************/
+
+class PlFunctor
+{
+public:
+ functor_t functor;
+
+ PlFunctor(const char *name, int arity)
+ { functor = PL_new_functor(PL_new_atom(name), arity);
+ }
+};
+
+
+class PlAtom
+{
+public:
+ atom_t handle;
+
+ PlAtom(atom_t h)
+ { handle = h;
+ }
+ PlAtom(const char *text)
+ { handle = PL_new_atom(text);
+ }
+ PlAtom(const PlTerm &t);
+
+ operator const char *(void)
+ { return PL_atom_chars(handle);
+ }
+
+ int operator ==(const char *s)
+ { return strcmp(s, PL_atom_chars(handle)) == 0;
+ }
+ int operator ==(const PlAtom &a)
+ { return handle == a.handle;
+ }
+};
+
+ /*******************************
+ * GENERIC PROLOG TERM *
+ *******************************/
+
+
+class PlTerm
+{
+public:
+ term_t ref;
+
+ PlTerm();
+ PlTerm(term_t t)
+ { ref = t;
+ }
+
+ /* C --> PlTerm */
+ PlTerm(const char *text);
+ PlTerm(long val);
+ PlTerm(double val);
+ PlTerm(const PlAtom &a);
+ PlTerm(void *ptr);
+
+ /* PlTerm --> C */
+ operator term_t(void) const
+ { return ref;
+ }
+ operator char *(void) const;
+ operator long(void) const;
+ operator int(void) const;
+ operator double(void) const;
+ operator PlAtom(void) const;
+ operator void *(void) const;
+
+ int type()
+ { return PL_term_type(ref);
+ }
+
+ /* Compounds */
+ PlTerm operator [](int index) const;
+ int arity();
+ const char *name();
+
+ /* UNIFY */
+ int operator =(const PlTerm &t2); /* term */
+ int operator =(const PlAtom &a); /* atom */
+ int operator =(const char *v); /* atom (from char *) */
+ int operator =(long v); /* integer */
+ int operator =(int v); /* integer */
+ int operator =(double v); /* float */
+ int operator =(const PlFunctor &f); /* functor */
+
+ /* Comparison standard order terms */
+ int operator ==(const PlTerm &t2)
+ { return PL_compare(ref, t2.ref) == 0;
+ }
+ int operator !=(const PlTerm &t2)
+ { return PL_compare(ref, t2.ref) != 0;
+ }
+ int operator <(const PlTerm &t2)
+ { return PL_compare(ref, t2.ref) < 0;
+ }
+ int operator >(const PlTerm &t2)
+ { return PL_compare(ref, t2.ref) > 0;
+ }
+ int operator <=(const PlTerm &t2)
+ { return PL_compare(ref, t2.ref) <= 0;
+ }
+ int operator >=(const PlTerm &t2)
+ { return PL_compare(ref, t2.ref) >= 0;
+ }
+ /* comparison (long) */
+ int operator ==(long v);
+ int operator !=(long v);
+ int operator <(long v);
+ int operator >(long v);
+ int operator <=(long v);
+ int operator >=(long v);
+
+ /* comparison (string) */
+ int operator ==(const char *s);
+ int operator ==(const PlAtom &a);
+};
+
+
+ /*******************************
+ * TERM VECTOR *
+ *******************************/
+
+class PlTermv
+{
+public:
+ term_t a0;
+ int size;
+
+ PlTermv(int n)
+ { a0 = PL_new_term_refs(n);
+ size = n;
+ }
+ PlTermv(int n, term_t t0)
+ { a0 = t0;
+ size = n;
+ }
+
+ /* create from args */
+ PlTermv(PlTerm m0);
+ PlTermv(PlTerm m0, PlTerm m1);
+ PlTermv(PlTerm m0, PlTerm m1, PlTerm m2);
+ PlTermv(PlTerm m0, PlTerm m1, PlTerm m2, PlTerm m3);
+ PlTermv(PlTerm m0, PlTerm m1, PlTerm m2, PlTerm m3, PlTerm m4);
+
+ PlTerm operator [](int n) const;
+};
+
+ /*******************************
+ * SPECIALISED TERMS *
+ *******************************/
+
+class PlCompound : public PlTerm
+{
+public:
+
+ PlCompound(const char *text);
+ PlCompound(const char *functor, const PlTermv &args);
+};
+
+
+class PlString : public PlTerm
+{
+public:
+
+ PlString(const char *text);
+ PlString(const char *text, int len);
+};
+
+
+class PlCodeList : public PlTerm
+{
+public:
+
+ PlCodeList(const char *text);
+};
+
+
+class PlCharList : public PlTerm
+{
+public:
+
+ PlCharList(const char *text);
+};
+
+
+ /*******************************
+ * EXCEPTIONS *
+ *******************************/
+
+class PlException : public PlTerm
+{
+public:
+ PlException()
+ { term_t ex = PL_exception(0);
+ if ( ex )
+ ref = ex;
+ else
+ PL_fatal_error("No exception");
+ }
+
+ PlException(const PlTerm &t)
+ { ref = t.ref;
+ }
+
+ operator const char *(void);
+
+ int plThrow()
+ { return PL_raise_exception(ref);
+ }
+
+ void cppThrow();
+};
+
+
+class PlTypeError : public PlException
+{
+public:
+
+ PlTypeError(const PlTerm &t) : PlException(t) {}
+
+ PlTypeError(const char *expected, PlTerm actual) :
+ PlException(PlCompound("error",
+ PlTermv(PlCompound("type_error",
+ PlTermv(expected, actual)),
+ PlTerm())))
+ {
+ }
+};
+
+
+class PlDomainError : public PlException
+{
+public:
+
+ PlDomainError(const PlTerm &t) : PlException(t) {}
+
+ PlDomainError(const char *expected, PlTerm actual) :
+ PlException(PlCompound("error",
+ PlTermv(PlCompound("domain_error",
+ PlTermv(expected, actual)),
+ PlTerm())))
+ {
+ }
+};
+
+
+class PlResourceError : public PlException
+{
+public:
+ PlResourceError() : PlException() {}
+
+ PlResourceError(const PlTerm &t) : PlException(t) {}
+
+ PlResourceError(const char *resource) :
+ PlException(PlCompound("error",
+ PlTermv(PlCompound("resource_error",
+ PlTermv(PlTerm(resource))),
+ PlTerm())))
+ {
+ }
+};
+
+
+class PlTermvDomainError : public PlException
+{
+public:
+
+ PlTermvDomainError(int size, int n) :
+ PlException(PlCompound("error",
+ PlTermv(PlCompound("domain_error",
+ PlTermv(PlCompound("argv",
+ size),
+ PlTerm((long)n))),
+ PlTerm())))
+ {
+ }
+};
+
+
+ /*******************************
+ * PLTERM IMPLEMENTATION *
+ *******************************/
+
+__inline
+PlTerm::PlTerm()
+{ if ( !(ref = PL_new_term_ref()) )
+ throw PlResourceError();
+}
+
+__inline
+PlTerm::PlTerm(const char *text)
+{ if ( !(ref = PL_new_term_ref()) ||
+ !PL_put_atom_chars(ref, text) )
+ throw PlResourceError();
+}
+
+__inline
+PlTerm::PlTerm(long val)
+{ if ( !(ref = PL_new_term_ref()) ||
+ !PL_put_integer(ref, val) )
+ throw PlResourceError();
+}
+
+__inline
+PlTerm::PlTerm(double val)
+{ ref = PL_new_term_ref();
+
+ if ( !PL_put_float(ref, val) )
+ throw PlResourceError();
+}
+
+__inline
+PlTerm::PlTerm(const PlAtom &a)
+{ if ( !(ref = PL_new_term_ref()) )
+ throw PlResourceError();
+
+ PL_put_atom(ref, a.handle);
+}
+
+__inline
+PlTerm::PlTerm(void *ptr)
+{ if ( !(ref = PL_new_term_ref()) ||
+ !PL_put_pointer(ref, ptr) )
+ throw PlResourceError();
+}
+
+ /*******************************
+ * SPECIALISED IMPLEMENTATIONS *
+ *******************************/
+
+__inline
+PlString::PlString(const char *text) : PlTerm()
+{ if ( !PL_put_string_chars(ref, text) )
+ throw PlResourceError();
+}
+
+__inline
+PlString::PlString(const char *text, int len) : PlTerm()
+{ if ( !PL_put_string_nchars(ref, len, text) )
+ throw PlResourceError();
+}
+
+__inline
+PlCodeList::PlCodeList(const char *text) : PlTerm()
+{ if ( !PL_put_list_codes(ref, text) )
+ throw PlResourceError();
+}
+
+__inline
+PlCharList::PlCharList(const char *text) : PlTerm()
+{ if ( !PL_put_list_chars(ref, text) )
+ throw PlResourceError();
+}
+
+
+ /*******************************
+ * LISTS *
+ *******************************/
+
+class PlTail : public PlTerm
+{
+public:
+
+ PlTail(const PlTerm &l)
+ { if ( PL_is_variable(l.ref) || PL_is_list(l.ref) )
+ { if ( !(ref = PL_copy_term_ref(l.ref)) )
+ throw PlResourceError();
+ } else
+ throw PlTypeError("list", l.ref);
+ }
+
+ /* building */
+ int append(const PlTerm &e)
+ { term_t tmp, ex;
+
+ if ( (tmp = PL_new_term_ref()) &&
+ PL_unify_list(ref, tmp, ref) &&
+ PL_unify(tmp, e.ref) )
+ { PL_reset_term_refs(tmp);
+ return TRUE;
+ }
+
+ if ( (ex = PL_exception(0)) )
+ throw PlResourceError(ex);
+
+ return FALSE;
+ }
+ int close()
+ { return PL_unify_nil(ref);
+ }
+
+ /* enumerating */
+ int next(PlTerm &t)
+ { if ( PL_get_list(ref, t, ref) )
+ return TRUE;
+
+ if ( PL_get_nil(ref) )
+ return FALSE;
+
+ throw PlTypeError("list", ref);
+ PL_THROWN(FALSE);
+ }
+};
+
+
+ /*******************************
+ * REGISTER *
+ *******************************/
+
+
+class PlRegister
+{
+public:
+
+ PlRegister(const char *module, const char *name, int arity,
+ foreign_t (f)(term_t t0, int a, control_t ctx))
+ { PL_register_foreign_in_module(module, name, arity, (void *)f, PL_FA_VARARGS);
+ }
+
+ PlRegister(const char *module, const char *name, foreign_t (*f)(PlTerm a0))
+ { PL_register_foreign_in_module(module, name, 1, (void *)f, 0);
+ }
+ PlRegister(const char *module, const char *name, foreign_t (*f)(PlTerm a0, PlTerm a1))
+ { PL_register_foreign_in_module(module, name, 2, (void *)f, 0);
+ }
+ PlRegister(const char *module, const char *name, foreign_t (*f)(PlTerm a0, PlTerm a1, PlTerm a2))
+ { PL_register_foreign_in_module(module, name, 3, (void *)f, 0);
+ }
+
+ // for non-deterministic calls
+ PlRegister(const char *module, const char *name, int arity,
+ foreign_t (f)(term_t t0, int a, control_t ctx), short flags)
+ { PL_register_foreign_in_module(module, name, arity, (void *)f, flags);
+ }
+
+};
+
+
+ /*******************************
+ * CALLING PROLOG *
+ *******************************/
+
+class PlFrame
+{
+public:
+ fid_t fid;
+
+ PlFrame()
+ { fid = PL_open_foreign_frame();
+ }
+
+ ~PlFrame()
+ { PL_close_foreign_frame(fid);
+ }
+
+ void rewind()
+ { PL_rewind_foreign_frame(fid);
+ }
+};
+
+
+class PlQuery
+{
+public:
+ qid_t qid;
+
+ PlQuery(const char *name, const PlTermv &av)
+ { predicate_t p = PL_predicate(name, av.size, "user");
+
+ qid = PL_open_query((module_t)0, PL_Q_CATCH_EXCEPTION, p, av.a0);
+ if ( !qid )
+ throw PlResourceError();
+ }
+ PlQuery(const char *module, const char *name, const PlTermv &av)
+ { atom_t ma = PL_new_atom(module);
+ atom_t na = PL_new_atom(name);
+ module_t m = PL_new_module(ma);
+ predicate_t p = PL_pred(PL_new_functor(na, av.size), m);
+
+ PL_unregister_atom(ma);
+ PL_unregister_atom(na);
+
+ qid = PL_open_query(m, PL_Q_CATCH_EXCEPTION, p, av.a0);
+ if ( !qid )
+ throw PlResourceError();
+ }
+
+ ~PlQuery()
+ { PL_cut_query(qid);
+ }
+
+ int next_solution();
+};
+
+
+__inline int
+PlCall(const char *predicate, const PlTermv &args)
+{ PlQuery q(predicate, args);
+ return q.next_solution();
+}
+
+__inline int
+PlCall(const char *module, const char *predicate, const PlTermv &args)
+{ PlQuery q(module, predicate, args);
+ return q.next_solution();
+}
+
+__inline int
+PlCall(const char *goal)
+{ PlQuery q("call", PlTermv(PlCompound(goal)));
+ return q.next_solution();
+}
+
+
+
+ /*******************************
+ * ATOM (BODY) *
+ *******************************/
+
+__inline
+PlAtom::PlAtom(const PlTerm &t)
+{ atom_t a;
+
+ if ( PL_get_atom(t.ref, &a) )
+ handle = a;
+ else
+ throw PlTypeError("atom", t);
+}
+
+
+ /*******************************
+ * TERM (BODY) *
+ *******************************/
+
+ /* PlTerm --> C */
+
+__inline PlTerm::operator char *(void) const
+{ char *s;
+
+ if ( PL_get_chars(ref, &s, CVT_ALL|CVT_WRITE|BUF_RING) )
+ return s;
+
+ throw PlTypeError("text", ref);
+ PL_THROWN(NULL);
+}
+
+__inline PlTerm::operator long(void) const
+{ long v;
+
+ if ( PL_get_long(ref, &v) )
+ return v;
+
+ throw PlTypeError("integer", ref);
+ PL_THROWN(0L);
+}
+
+__inline PlTerm::operator int(void) const
+{ int v;
+
+ if ( PL_get_integer(ref, &v) )
+ return v;
+
+ throw PlTypeError("integer", ref);
+ PL_THROWN(0);
+}
+
+__inline PlTerm::operator double(void) const
+{ double v;
+
+ if ( PL_get_float(ref, &v) )
+ return v;
+
+ throw PlTypeError("float", ref);
+ PL_THROWN(0.0);
+}
+
+__inline PlTerm::operator PlAtom(void) const
+{ atom_t v;
+
+ if ( PL_get_atom(ref, &v) )
+ return PlAtom(v);
+
+ throw PlTypeError("atom", ref);
+ PL_THROWN((atom_t)0);
+}
+
+__inline PlTerm::operator void *(void) const
+{ void *ptr;
+
+ if ( PL_get_pointer(ref, &ptr) )
+ return ptr;
+
+ throw PlTypeError("pointer", ref);
+ PL_THROWN(NULL);
+}
+
+ /* compounds */
+
+__inline PlTerm
+PlTerm::operator [](int index) const
+{ PlTerm t;
+
+ if ( PL_get_arg(index, ref, t.ref) )
+ return t;
+
+ if ( !PL_is_compound(ref) )
+ throw PlTypeError("compound", ref);
+ else
+ { if ( !PL_put_integer(t.ref, index) )
+ throw PlResourceError();
+
+ if ( index < 1 )
+ throw PlDomainError("not_less_than_zero", t.ref);
+ else
+ throw PlDomainError("arity", t.ref); /* TBD: proper exception */
+ }
+ PL_THROWN((term_t)0);
+}
+
+
+__inline int
+PlTerm::arity()
+{ atom_t name;
+ int arity;
+
+ if ( PL_get_name_arity(ref, &name, &arity) )
+ return arity;
+
+ throw PlTypeError("compound", ref);
+ PL_THROWN(0);
+}
+
+
+__inline const char *
+PlTerm::name()
+{ atom_t name;
+ int arity;
+
+ if ( PL_get_name_arity(ref, &name, &arity) )
+ return PL_atom_chars(name);
+
+ throw PlTypeError("compound", ref);
+ PL_THROWN(NULL);
+}
+
+
+ /* Unification */
+
+__inline int PlTerm::operator =(const PlTerm &t2) /* term = term */
+{ int rc = PL_unify(ref, t2.ref);
+ term_t ex;
+
+ if ( !rc && (ex=PL_exception(0)) )
+ throw PlResourceError(ex);
+ return rc;
+}
+
+__inline int PlTerm::operator =(const PlAtom &a) /* term = atom */
+{ int rc = PL_unify_atom(ref, a.handle);
+ term_t ex;
+
+ if ( !rc && (ex=PL_exception(0)) )
+ throw PlResourceError(ex);
+ return rc;
+}
+
+__inline int PlTerm::operator =(const char *v) /* term = atom */
+{ int rc = PL_unify_atom_chars(ref, v);
+ term_t ex;
+
+ if ( !rc && (ex=PL_exception(0)) )
+ throw PlResourceError(ex);
+ return rc;
+}
+
+__inline int PlTerm::operator =(long v)
+{ int rc = PL_unify_integer(ref, v);
+ term_t ex;
+
+ if ( !rc && (ex=PL_exception(0)) )
+ throw PlResourceError(ex);
+ return rc;
+}
+
+__inline int PlTerm::operator =(int v)
+{ int rc = PL_unify_integer(ref, v);
+ term_t ex;
+
+ if ( !rc && (ex=PL_exception(0)) )
+ throw PlResourceError(ex);
+ return rc;
+}
+
+__inline int PlTerm::operator =(double v)
+{ int rc = PL_unify_float(ref, v);
+ term_t ex;
+
+ if ( !rc && (ex=PL_exception(0)) )
+ throw PlResourceError(ex);
+ return rc;
+}
+
+__inline int PlTerm::operator =(const PlFunctor &f)
+{ int rc = PL_unify_functor(ref, f.functor);
+ term_t ex;
+
+ if ( !rc && (ex=PL_exception(0)) )
+ throw PlResourceError(ex);
+ return rc;
+}
+
+ /* comparison */
+
+
+__inline int PlTerm::operator ==(long v)
+{ long v0;
+
+ if ( PL_get_long(ref, &v0) )
+ return v0 == v;
+
+ throw PlTypeError("integer", ref);
+ PL_THROWN(0);
+}
+
+__inline int PlTerm::operator !=(long v)
+{ long v0;
+
+ if ( PL_get_long(ref, &v0) )
+ return v0 != v;
+
+ throw PlTypeError("integer", ref);
+ PL_THROWN(0);
+}
+
+__inline int PlTerm::operator <(long v)
+{ long v0;
+
+ if ( PL_get_long(ref, &v0) )
+ return v0 < v;
+
+ throw PlTypeError("integer", ref);
+ PL_THROWN(0);
+}
+
+__inline int PlTerm::operator >(long v)
+{ long v0;
+
+ if ( PL_get_long(ref, &v0) )
+ return v0 > v;
+
+ throw PlTypeError("integer", ref);
+ PL_THROWN(0);
+}
+
+__inline int PlTerm::operator <=(long v)
+{ long v0;
+
+ if ( PL_get_long(ref, &v0) )
+ return v0 <= v;
+
+ throw PlTypeError("integer", ref);
+ PL_THROWN(0);
+}
+
+__inline int PlTerm::operator >=(long v)
+{ long v0;
+
+ if ( PL_get_long(ref, &v0) )
+ return v0 >= v;
+
+ throw PlTypeError("integer", ref);
+ PL_THROWN(0);
+}
+
+ /* comparison (string) */
+
+__inline int PlTerm::operator ==(const char *s)
+{ char *s0;
+
+ if ( PL_get_chars(ref, &s0, CVT_ALL) )
+ return strcmp(s0, s) == 0;
+
+ throw PlTypeError("text", ref);
+ PL_THROWN(0);
+}
+
+
+__inline int PlTerm::operator ==(const PlAtom &a)
+{ atom_t v;
+
+ if ( PL_get_atom(ref, &v) )
+ return v == a.handle;
+
+ throw PlTypeError("atom", ref);
+ PL_THROWN(0);
+}
+
+
+ /*******************************
+ * COMPPOUND (BODY) *
+ *******************************/
+
+
+__inline
+PlCompound::PlCompound(const char *text) : PlTerm()
+{ term_t t = PL_new_term_ref();
+
+ if ( !PL_chars_to_term(text, t) )
+ throw PlException(t);
+
+ PL_put_term(ref, t);
+}
+
+__inline
+PlCompound::PlCompound(const char *functor, const PlTermv &args) : PlTerm()
+{ if ( !PL_cons_functor_v(ref,
+ PL_new_functor(PL_new_atom(functor), args.size),
+ args.a0) )
+ throw PlResourceError();
+}
+
+ /*******************************
+ * TERMV (BODY) *
+ *******************************/
+
+
+__inline PlTermv::PlTermv(PlTerm m0)
+{ size = 1;
+ a0 = m0.ref;
+}
+
+__inline PlTermv::PlTermv(PlTerm m0, PlTerm m1)
+{ size = 2;
+ if ( !(a0 = PL_new_term_refs(2)) )
+ throw PlResourceError();
+ PL_put_term(a0+0, m0);
+ PL_put_term(a0+1, m1);
+}
+
+__inline PlTermv::PlTermv(PlTerm m0, PlTerm m1, PlTerm m2)
+{ size = 3;
+ if ( !(a0 = PL_new_term_refs(3)) )
+ throw PlResourceError();
+ PL_put_term(a0+0, m0);
+ PL_put_term(a0+1, m1);
+ PL_put_term(a0+2, m2);
+}
+
+__inline PlTermv::PlTermv(PlTerm m0, PlTerm m1, PlTerm m2, PlTerm m3)
+{ size = 4;
+ if ( !(a0 = PL_new_term_refs(4)) )
+ throw PlResourceError();
+ PL_put_term(a0+0, m0);
+ PL_put_term(a0+1, m1);
+ PL_put_term(a0+2, m2);
+
+ PL_put_term(a0+3, m3);
+}
+
+__inline PlTermv::PlTermv(PlTerm m0, PlTerm m1, PlTerm m2,
+ PlTerm m3, PlTerm m4)
+{ size = 5;
+ if ( !(a0 = PL_new_term_refs(5)) )
+ throw PlResourceError();
+ PL_put_term(a0+0, m0);
+ PL_put_term(a0+1, m1);
+ PL_put_term(a0+2, m2);
+ PL_put_term(a0+3, m3);
+ PL_put_term(a0+4, m4);
+}
+
+
+__inline PlTerm
+PlTermv::operator [](int n) const
+{ if ( n < 0 || n >= size )
+ throw PlTermvDomainError(size, n);
+
+ return PlTerm(a0+n);
+}
+
+
+ /*******************************
+ * EXCEPTIONS (BODY) *
+ *******************************/
+
+__inline PlException::operator const char *(void)
+{ PlFrame fr;
+#ifdef USE_PRINT_MESSAGE
+ PlTermv av(2);
+
+ av[0] = PlCompound("print_message",
+ PlTermv("error", ref));
+ PlQuery q("$write_on_string", av);
+ if ( q.next_solution() )
+ return (char *)av[1];
+#else
+ PlTermv av(2);
+ av[0] = PlTerm(ref);
+ PlQuery q("$messages", "message_to_string", av);
+ if ( q.next_solution() )
+ return (char *)av[1];
+#endif
+ return "[ERROR: Failed to generate message. Internal error]\n";
+}
+
+
+__inline void
+PlException::cppThrow()
+{ term_t a = PL_new_term_ref();
+ atom_t name;
+ int arity;
+
+ if ( PL_get_arg(1, ref, a) &&
+ PL_get_name_arity(a, &name, &arity) )
+ { const char *s = PL_atom_chars(name);
+
+ if ( strcmp(s, "type_error") == 0 )
+ throw PlTypeError(ref);
+ if ( strcmp(s, "domain_error") == 0 )
+ throw PlDomainError(ref);
+ if ( strcmp(s, "resource_error") == 0 )
+ throw PlResourceError(ref);
+ }
+
+ throw *this;
+}
+
+
+ /*******************************
+ * QUERY (BODY) *
+ *******************************/
+
+__inline int
+PlQuery::next_solution()
+{ int rval;
+
+ if ( !(rval = PL_next_solution(qid)) )
+ { term_t ex;
+
+ if ( (ex = PL_exception(qid)) )
+ PlException(ex).cppThrow();
+ }
+ return rval;
+}
+
+
+ /*******************************
+ * ENGINE *
+ *******************************/
+
+class PlError
+{
+public:
+ char *message;
+
+ PlError(const char *msg)
+ { message = new char[strlen(msg+1)];
+ strcpy(message, msg);
+ }
+};
+
+
+class PlEngine
+{
+public:
+
+ PlEngine(int argc, char **argv)
+ { if ( !PL_initialise(argc, argv) )
+ throw PlError("failed to initialise");
+ }
+
+ PlEngine(char *av0)
+ { int ac = 0;
+ char **av = (char **)malloc(sizeof(char *) * 2);
+
+ av[ac++] = av0;
+
+ if ( !PL_initialise(1, av) )
+ throw PlError("failed to initialise");
+ }
+
+ ~PlEngine()
+ { PL_cleanup(0);
+ }
+};
+
+
+ /*******************************
+ * REGISTER PREDICATES *
+ *******************************/
+
+#ifndef PROLOG_MODULE
+#define PROLOG_MODULE (const char*)NULL
+#endif
+
+#define PREDICATE(name, arity) \
+ static foreign_t \
+ pl_ ## name ## __ ## arity(PlTermv _av); \
+ static foreign_t \
+ _pl_ ## name ## __ ## arity(term_t t0, int a, control_t c) \
+ { try \
+ { \
+ return pl_ ## name ## __ ## arity(PlTermv(arity, t0)); \
+ } catch ( PlException &ex ) \
+ { return ex.plThrow(); \
+ } \
+ } \
+ static PlRegister _x ## name ## __ ## arity(PROLOG_MODULE, #name, arity, \
+ _pl_ ## name ## __ ## arity); \
+ static foreign_t pl_ ## name ## __ ## arity(PlTermv _av)
+
+
+#define PREDICATE_NONDET(name, arity) \
+ static foreign_t \
+ pl_ ## name ## __ ## arity(PlTermv _av, foreign_t handle); \
+ static foreign_t \
+ _pl_ ## name ## __ ## arity(term_t t0, int a, control_t c) \
+ { try \
+ { \
+ return pl_ ## name ## __ ## arity(PlTermv(arity, t0), (foreign_t)c); \
+ } catch ( PlException &ex ) \
+ { return ex.plThrow(); \
+ } \
+ } \
+ static PlRegister _x ## name ## __ ## arity(PROLOG_MODULE, #name, arity, \
+ _pl_ ## name ## __ ## arity, \
+ PL_FA_NONDETERMINISTIC | PL_FA_VARARGS); \
+ static foreign_t pl_ ## name ## __ ## arity(PlTermv _av, foreign_t handle)
+
+#define A1 _av[0]
+#define A2 _av[1]
+#define A3 _av[2]
+#define A4 _av[3]
+#define A5 _av[4]
+#define A6 _av[5]
+#define A7 _av[6]
+#define A8 _av[7]
+#define A9 _av[8]
+#define A10 _av[9]
+
+#endif /*_SWI_CPP_H*/
diff --git a/src/uscxml/Factory.cpp b/src/uscxml/Factory.cpp
index 4481257..d299e7b 100644
--- a/src/uscxml/Factory.cpp
+++ b/src/uscxml/Factory.cpp
@@ -11,6 +11,7 @@
# include "uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h"
# include "uscxml/plugins/invoker/scxml/USCXMLInvoker.h"
+# include "uscxml/plugins/invoker/http/HTTPServletInvoker.h"
# include "uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h"
# include "uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h"
@@ -39,6 +40,10 @@
# include "uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h"
# endif
+# include "uscxml/plugins/element/fetch/FetchElement.h"
+# include "uscxml/plugins/element/response/ResponseElement.h"
+
+
#endif
namespace uscxml {
@@ -129,6 +134,10 @@ Factory::Factory() {
registerInvoker(invoker);
}
{
+ HTTPServletInvoker* invoker = new HTTPServletInvoker();
+ registerInvoker(invoker);
+ }
+ {
HeartbeatInvoker* invoker = new HeartbeatInvoker();
registerInvoker(invoker);
}
@@ -141,6 +150,15 @@ Factory::Factory() {
registerIOProcessor(ioProcessor);
}
+ {
+ FetchElement* element = new FetchElement();
+ registerExecutableContent(element);
+ }
+ {
+ ResponseElement* element = new ResponseElement();
+ registerExecutableContent(element);
+ }
+
#endif
}
@@ -189,6 +207,13 @@ void Factory::registerInvoker(InvokerImpl* invoker) {
}
}
+void Factory::registerExecutableContent(ExecutableContentImpl* executableContent) {
+ std::string localName = executableContent->getLocalName();
+ std::string nameSpace = executableContent->getNamespace();
+ _executableContent[std::make_pair(localName, nameSpace)] = executableContent;
+}
+
+
boost::shared_ptr<InvokerImpl> Factory::createInvoker(const std::string& type, Interpreter* interpreter) {
Factory* factory = getInstance();
if (factory->_invokerAliases.find(type) == factory->_invokerAliases.end()) {
@@ -198,7 +223,7 @@ boost::shared_ptr<InvokerImpl> Factory::createInvoker(const std::string& type, I
std::string canonicalName = factory->_invokerAliases[type];
if (factory->_invokers.find(canonicalName) == factory->_invokers.end()) {
- LOG(ERROR) << "Invoker " << type << " known as " << canonicalName << " but not prototype is available in factory";
+ LOG(ERROR) << "Invoker " << type << " known as " << canonicalName << " but no prototype is available in factory";
return boost::shared_ptr<InvokerImpl>();
}
@@ -214,7 +239,7 @@ boost::shared_ptr<DataModelImpl> Factory::createDataModel(const std::string& typ
std::string canonicalName = factory->_dataModelAliases[type];
if (factory->_dataModels.find(canonicalName) == factory->_dataModels.end()) {
- LOG(ERROR) << "DataModel " << type << " known as " << canonicalName << " but not prototype is available in factory";
+ LOG(ERROR) << "DataModel " << type << " known as " << canonicalName << " but no prototype is available in factory";
return boost::shared_ptr<DataModelImpl>();
}
@@ -230,13 +255,23 @@ boost::shared_ptr<IOProcessorImpl> Factory::createIOProcessor(const std::string&
std::string canonicalName = factory->_ioProcessorAliases[type];
if (factory->_ioProcessors.find(canonicalName) == factory->_ioProcessors.end()) {
- LOG(ERROR) << "IOProcessor " << type << " known as " << canonicalName << " but not prototype is available in factory";
+ LOG(ERROR) << "IOProcessor " << type << " known as " << canonicalName << " but no prototype is available in factory";
return boost::shared_ptr<IOProcessorImpl>();
}
return factory->_ioProcessors[canonicalName]->create(interpreter);
}
+boost::shared_ptr<ExecutableContentImpl> Factory::createExecutableContent(const std::string& localName, const std::string& nameSpace, Interpreter* 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()) {
+ LOG(ERROR) << "Executable content " << localName << " in " << actualNameSpace << " not available in factory";
+ return boost::shared_ptr<ExecutableContentImpl>();
+ }
+ return factory->_executableContent[std::make_pair(localName, actualNameSpace)]->create(interpreter);
+}
+
Factory* Factory::getInstance() {
if (_instance == NULL) {
diff --git a/src/uscxml/Factory.h b/src/uscxml/Factory.h
index 8004366..9397e36 100644
--- a/src/uscxml/Factory.h
+++ b/src/uscxml/Factory.h
@@ -35,13 +35,63 @@ inline bool isNumeric( const char* pszInput, int nNumberBase) {
class Interpreter;
-#if 0
-class ExecutableContent {
+class ExecutableContentImpl {
public:
- ExecutableContent() {};
- virtual boost::shared_ptr<ExecutableContentImpl>* create(Interpreter* interpreter) = 0;
+ ExecutableContentImpl() {};
+ virtual ~ExecutableContentImpl() {};
+ virtual boost::shared_ptr<ExecutableContentImpl> create(Interpreter* interpreter) = 0;
+
+ virtual void setInterpreter(Interpreter* interpreter) {
+ _interpreter = interpreter;
+ }
+
+ virtual std::string getLocalName() = 0; ///< The name of the element.
+ virtual std::string getNamespace() = 0; ///< The namespace of the element.
+ virtual void enterElement(const Arabica::DOM::Node<std::string>& node) = 0; ///< Invoked when entering the element as part of evaluating executable content.
+ virtual void exitElement(const Arabica::DOM::Node<std::string>& node) = 0; ///< Invoked when exiting the element as part of evaluating executable content.
+ virtual bool processChildren() = 0; ///< Whether or not the interpreter should process this elements children.
+
+protected:
+ Interpreter* _interpreter;
};
-#endif
+
+class ExecutableContent {
+public:
+ ExecutableContent() : _impl() {}
+ ExecutableContent(boost::shared_ptr<ExecutableContentImpl> const impl) : _impl(impl) { }
+ ExecutableContent(const ExecutableContent& other) : _impl(other._impl) { }
+ virtual ~ExecutableContent() {};
+
+ operator bool() const {
+ return _impl;
+ }
+ bool operator< (const ExecutableContent& other) const {
+ return _impl < other._impl;
+ }
+ bool operator==(const ExecutableContent& other) const {
+ return _impl == other._impl;
+ }
+ bool operator!=(const ExecutableContent& other) const {
+ return _impl != other._impl;
+ }
+ ExecutableContent& operator= (const ExecutableContent& other) {
+ _impl = other._impl;
+ return *this;
+ }
+
+ void setInterpreter(Interpreter* interpreter) {
+ _impl->setInterpreter(interpreter);
+ }
+
+ std::string getLocalName() { return _impl->getLocalName(); }
+ std::string getNamespace() { return _impl->getNamespace(); }
+ void enterElement(const Arabica::DOM::Node<std::string>& node) { return _impl->enterElement(node); }
+ void exitElement(const Arabica::DOM::Node<std::string>& node) { return _impl->exitElement(node); }
+ bool processChildren() { return _impl->processChildren(); }
+protected:
+ boost::shared_ptr<ExecutableContentImpl> _impl;
+
+ };
class IOProcessorImpl {
public:
@@ -264,10 +314,12 @@ public:
void registerIOProcessor(IOProcessorImpl* ioProcessor);
void registerDataModel(DataModelImpl* dataModel);
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 Factory* getInstance();
@@ -277,6 +329,7 @@ public:
std::map<std::string, std::string> _ioProcessorAliases;
std::map<std::string, InvokerImpl*> _invokers;
std::map<std::string, std::string> _invokerAliases;
+ std::map<std::pair<std::string, std::string>, ExecutableContentImpl*> _executableContent;
static std::string pluginPath;
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index 4f1f31f..448bb7c 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -3,6 +3,8 @@
#include "uscxml/URL.h"
#include "uscxml/debug/SCXMLDotWriter.h"
+#include "uscxml/plugins/invoker/http/HTTPServletInvoker.h"
+
#include <DOM/Simple/DOMImplementation.hpp>
#include <SAX/helpers/InputSourceResolver.hpp>
@@ -17,6 +19,7 @@
#include <assert.h>
#include <algorithm>
+#define VERBOSE 0
namespace uscxml {
@@ -34,6 +37,7 @@ Interpreter::Interpreter() : Arabica::SAX2DOM::Parser<std::string>() {
_thread = NULL;
_sendQueue = NULL;
_parentQueue = NULL;
+ _httpServlet = NULL;
_running = false;
_done = false;
@@ -67,7 +71,14 @@ Interpreter* Interpreter::fromURI(const std::string& uri) {
return NULL;
}
}
- Arabica::SAX::InputSource<std::string> inputSource(absUrl.asString());
+ Arabica::SAX::InputSource<std::string> inputSource;
+
+ // this is required for windows filenames and does not harm on unices
+ if (boost::iequals(absUrl.scheme(), "file")) {
+ inputSource.setSystemId(absUrl.path());
+ } else {
+ inputSource.setSystemId(absUrl.asString());
+ }
Interpreter* interpreter = fromInputSource(inputSource);
// try to establish URI root for relative src attributes in document
@@ -161,8 +172,6 @@ Interpreter* Interpreter::fromInputSource(Arabica::SAX::InputSource<std::string>
}
void Interpreter::init() {
- _sendQueue = new DelayedEventQueue();
- _sendQueue->start();
if (_document) {
NodeList<std::string> scxmls = _document.getElementsByTagNameNS(_nsURL, "scxml");
if (scxmls.getLength() > 0) {
@@ -174,9 +183,15 @@ void Interpreter::init() {
assert(scxmls.size() > 0);
assert(scxmls[0] == _scxml);
- normalize(_document);
if (_name.length() == 0)
_name = (HAS_ATTR(_scxml, "name") ? ATTR(_scxml, "name") : getUUID());
+
+ normalize(_document);
+
+ _sendQueue = new DelayedEventQueue();
+ _httpServlet = new HTTPServletInvoker(this);
+ _sendQueue->start();
+
} else {
LOG(ERROR) << "Cannot find SCXML element" << std::endl;
}
@@ -193,6 +208,8 @@ Interpreter::~Interpreter() {
}
if (_sendQueue)
delete _sendQueue;
+ if (_httpServlet)
+ delete _httpServlet;
}
void Interpreter::start() {
@@ -297,9 +314,6 @@ void Interpreter::interpret() {
initialElem.appendChild(transitionElem);
_scxml.appendChild(initialElem);
initialTransitions.push_back(transitionElem);
-
- } else {
- initialTransitions.push_back(initialTransitions[0]);
}
enterStates(initialTransitions);
@@ -335,7 +349,12 @@ void Interpreter::initializeData(const Arabica::DOM::Node<std::string>& data) {
toAbsoluteURI(srcURL);
std::stringstream ss;
- ss << srcURL;
+ if (_cachedURLs.find(srcURL.asString()) != _cachedURLs.end()) {
+ ss << _cachedURLs[srcURL.asString()];
+ } else {
+ ss << srcURL;
+ _cachedURLs[srcURL.asString()] = srcURL;
+ }
_dataModel.assign(ATTR(data, "id"), ss.str());
} else if (data.hasChildNodes()) {
@@ -445,7 +464,7 @@ void Interpreter::mainEventLoop() {
} else {
Event internalEvent = _internalQueue.front();
_internalQueue.pop_front();
-#if 0
+#if VERBOSE
std::cout << "Received internal event " << internalEvent.name << std::endl;
#endif
if (_dataModel)
@@ -475,15 +494,15 @@ void Interpreter::mainEventLoop() {
continue;
// assume that we have a legal configuration as soon as the internal queue is empty
- assert(hasLegalConfiguration());
+// assert(hasLegalConfiguration());
monIter = _monitors.begin();
- if (!_sendQueue || _sendQueue->isEmpty()) {
+// if (!_sendQueue || _sendQueue->isEmpty()) {
while(monIter != _monitors.end()) {
(*monIter)->onStableConfiguration(this);
monIter++;
}
- }
+// }
// whenever we have a stable configuration, run the mainThread hooks with 200fps
while(_externalQueue.isEmpty() && _thread == NULL) {
@@ -491,6 +510,9 @@ void Interpreter::mainEventLoop() {
}
Event externalEvent = _externalQueue.pop();
+#if VERBOSE
+ std::cout << "Received externalEvent event " << externalEvent.name << std::endl;
+#endif
externalEvent.type = Event::EXTERNAL; // make sure it is set to external
if (!_running)
exitInterpreter();
@@ -580,17 +602,17 @@ void Interpreter::internalDoneSend(const Arabica::DOM::Node<std::string>& state)
LOG(ERROR) << "param element is missing expr or location or no datamodel is specified";
continue;
}
- event.compound[ATTR(doneChilds.item(i), "name")] = paramValue;
+ event.data.compound[ATTR(doneChilds.item(i), "name")] = paramValue;
}
if (boost::iequals(TAGNAME(doneChilds.item(i)), _xmlNSPrefix + "content")) {
if (HAS_ATTR(doneChilds.item(i), "expr")) {
if (_dataModel) {
- event.compound["content"] = Data(_dataModel.evalAsString(ATTR(doneChilds.item(i), "expr")), Data::VERBATIM);
+ event.data.compound["content"] = Data(_dataModel.evalAsString(ATTR(doneChilds.item(i), "expr")), Data::VERBATIM);
} else {
LOG(ERROR) << "content element has expr attribute but no datamodel is specified.";
}
} else if (doneChilds.item(i).hasChildNodes()) {
- event.compound["content"] = Data(doneChilds.item(i).getFirstChild().getNodeValue(), Data::VERBATIM);
+ event.data.compound["content"] = Data(doneChilds.item(i).getFirstChild().getNodeValue(), Data::VERBATIM);
} else {
LOG(ERROR) << "content element does not specify any content.";
}
@@ -599,7 +621,7 @@ void Interpreter::internalDoneSend(const Arabica::DOM::Node<std::string>& state)
}
}
- event.name = "done.state." + parent.getAttribute("id");
+ event.name = "done.state." + ATTR(stateElem.getParentNode(), "id"); // parent?!
_internalQueue.push_back(event);
}
@@ -678,12 +700,16 @@ void Interpreter::send(const Arabica::DOM::Node<std::string>& element) {
}
// namelist
if (HAS_ATTR(element, "namelist")) {
- std::vector<std::string> names = tokenizeIdRefs(ATTR(element, "namelist"));
- for (int i = 0; i < names.size(); i++) {
- std::string namelistValue = _dataModel.evalAsString(names[i]);
- sendReq.namelist[names[i]] = namelistValue;
- sendReq.compound[names[i]] = Data(namelistValue, Data::VERBATIM);
- }
+ if (_dataModel) {
+ std::vector<std::string> names = tokenizeIdRefs(ATTR(element, "namelist"));
+ for (int i = 0; i < names.size(); i++) {
+ std::string namelistValue = _dataModel.evalAsString(names[i]);
+ sendReq.namelist[names[i]] = namelistValue;
+ sendReq.data.compound[names[i]] = Data(namelistValue, Data::VERBATIM);
+ }
+ } else {
+ LOG(ERROR) << "Namelist attribute at send requires datamodel to be defined";
+ }
}
// params
@@ -705,7 +731,7 @@ void Interpreter::send(const Arabica::DOM::Node<std::string>& element) {
std::string paramKey = ATTR(params[i], "name");
boost::algorithm::to_lower(paramKey);
sendReq.params.insert(std::make_pair(paramKey, paramValue));
- sendReq.compound[paramKey] = Data(paramValue, Data::VERBATIM);
+ sendReq.data.compound[paramKey] = Data(paramValue, Data::VERBATIM);
}
// content
@@ -717,15 +743,15 @@ void Interpreter::send(const Arabica::DOM::Node<std::string>& element) {
if (_dataModel) {
std::string contentValue = _dataModel.evalAsString(ATTR(contents[0], "expr"));
sendReq.content = contentValue;
- sendReq.atom = contentValue;
- sendReq.type = Data::VERBATIM;
+// sendReq.data.atom = contentValue;
+// sendReq.data.type = Data::VERBATIM;
} else {
LOG(ERROR) << "content element has expr attribute but no datamodel is specified.";
}
} else if (contents[0].hasChildNodes()) {
sendReq.content = contents[0].getFirstChild().getNodeValue();
- sendReq.atom = sendReq.content;
- sendReq.type = Data::VERBATIM;
+// sendReq.data.atom = sendReq.content;
+// sendReq.data.type = Data::VERBATIM;
} else {
LOG(ERROR) << "content element does not specify any content.";
}
@@ -848,7 +874,7 @@ void Interpreter::invoke(const Arabica::DOM::Node<std::string>& element) {
if (_dataModel) {
paramValue = _dataModel.evalAsString(ATTR(params[i], "expr"));
} else {
- paramValue = ATTR(params[i], "expr");
+ LOG(ERROR) << "Cannot use param expr without a datamodel!";
}
} else if(HAS_ATTR(params[i], "location") && _dataModel) {
paramValue = _dataModel.evalAsString(ATTR(params[i], "location"));
@@ -873,14 +899,18 @@ void Interpreter::invoke(const Arabica::DOM::Node<std::string>& element) {
Invoker invoker(Factory::createInvoker(invokeReq.type, this));
if (invoker) {
tthread::lock_guard<tthread::mutex> lock(_mutex);
- invoker.setInvokeId(invokeReq.invokeid);
- invoker.setType(invokeReq.type);
- invoker.setInterpreter(this);
- _invokers[invokeReq.invokeid] = invoker;
- LOG(INFO) << "Added invoker " << invokeReq.type << " at " << invokeReq.invokeid;
- invoker.invoke(invokeReq);
- if (_dataModel) {
- _dataModel.assign("_invokers['" + invokeReq.invokeid + "']", invoker.getDataModelVariables());
+ try {
+ invoker.setInvokeId(invokeReq.invokeid);
+ invoker.setType(invokeReq.type);
+ invoker.setInterpreter(this);
+ _invokers[invokeReq.invokeid] = invoker;
+ LOG(INFO) << "Added invoker " << invokeReq.type << " at " << invokeReq.invokeid;
+ invoker.invoke(invokeReq);
+ if (_dataModel) {
+ _dataModel.assign("_invokers['" + invokeReq.invokeid + "']", invoker.getDataModelVariables());
+ }
+ } catch (...) {
+ LOG(ERROR) << "Invoker " << invokeReq.type << " threw an exception";
}
} else {
LOG(ERROR) << "No invoker known for type " << invokeReq.type;
@@ -936,8 +966,23 @@ Arabica::XPath::NodeSet<std::string> Interpreter::selectTransitions(const std::s
for (unsigned int j = 0; j < sortedAncestors.size(); j++) {
NodeSet<std::string> transitions = filterChildElements(_xmlNSPrefix + "transition", sortedAncestors[j]);
for (unsigned int k = 0; k < transitions.size(); k++) {
- if (((Arabica::DOM::Element<std::string>)transitions[k]).hasAttribute("event") &&
- nameMatch(((Arabica::DOM::Element<std::string>)transitions[k]).getAttribute("event"), event) &&
+ std::string eventName;
+ if (HAS_ATTR(transitions[k], "event")) {
+ eventName = ATTR(transitions[k], "event");
+ } else if(HAS_ATTR(transitions[k], "eventexpr")) {
+ if (_dataModel) {
+ eventName = _dataModel.evalAsString(ATTR(transitions[k], "eventexpr"));
+ } else {
+ LOG(ERROR) << "Transition has eventexpr attribute with no datamodel defined";
+ goto LOOP;
+ }
+ } else {
+ LOG(ERROR) << "Transition has neither event nor eventexpr attribute";
+ goto LOOP;
+ }
+
+ if (eventName.length() > 0 &&
+ nameMatch(eventName, event) &&
hasConditionMatch(transitions[k])) {
enabledTransitions.push_back(transitions[k]);
goto LOOP;
@@ -1010,7 +1055,7 @@ Arabica::XPath::NodeSet<std::string> Interpreter::selectEventlessTransitions() {
for (unsigned int j = 0; j < ancestors.size(); j++) {
NodeSet<std::string> transitions = filterChildElements(_xmlNSPrefix + "transition", ancestors[j]);
for (unsigned int k = 0; k < transitions.size(); k++) {
- if (!((Arabica::DOM::Element<std::string>)transitions[k]).hasAttribute("event") && hasConditionMatch(transitions[k])) {
+ if (!HAS_ATTR(transitions[k], "event") && hasConditionMatch(transitions[k])) {
enabledTransitions.push_back(transitions[k]);
goto LOOP;
}
@@ -1035,13 +1080,19 @@ LOOP:
}
bool Interpreter::hasConditionMatch(const Arabica::DOM::Node<std::string>& conditional) {
- try {
- if (_dataModel && HAS_ATTR(conditional, "cond"))
- return _dataModel.evalAsBool(ATTR(conditional, "cond"));
- } catch (Event e) {
- LOG(ERROR) << "Syntax error in cond attribute of " << TAGNAME(conditional) << " element:" << std::endl << e << std::endl;
- return false;
- }
+
+ if (HAS_ATTR(conditional, "cond")) {
+ if (!_dataModel) {
+ LOG(ERROR) << "Cannot check a condition without a datamodel";
+ return false;
+ }
+ try {
+ return _dataModel.evalAsBool(ATTR(conditional, "cond"));
+ } catch (Event e) {
+ LOG(ERROR) << "Syntax error in cond attribute of " << TAGNAME(conditional) << " element:" << std::endl << e << std::endl;
+ return false;
+ }
+ }
return true; // no condition is always true
}
@@ -1052,8 +1103,8 @@ Arabica::XPath::NodeSet<std::string> Interpreter::filterPreempted(const Arabica:
for (unsigned int j = i+1; j < enabledTransitions.size(); j++) {
Arabica::DOM::Node<std::string> t2 = enabledTransitions[j];
if (isPreemptingTransition(t2, t)) {
-#if 0
- std::cout << "Preempting transitions: " << std::endl << t2 << std::endl << t;
+#if VERBOSE
+ std::cout << "Transition preempted!: " << std::endl << t2 << std::endl << t << std::endl;
#endif
goto LOOP;
}
@@ -1069,7 +1120,7 @@ bool Interpreter::isPreemptingTransition(const Arabica::DOM::Node<std::string>&
assert(t1);
assert(t2);
-#if 0
+#if VERBOSE
std::cout << "Checking preemption: " << std::endl << t1 << std::endl << t2 << std::endl;
#endif
@@ -1101,6 +1152,7 @@ bool Interpreter::isPreemptingTransition(const Arabica::DOM::Node<std::string>&
/**
* filterPreempted approach from chris nuernberger
*/
+#if 0
Arabica::DOM::Node<std::string> Interpreter::getTransitionSubgraph(const Arabica::DOM::Node<std::string>& transition) {
Arabica::XPath::NodeSet<std::string> targets = getTargetStates(transition);
Arabica::DOM::Node<std::string> source = getSourceState(transition);
@@ -1123,6 +1175,7 @@ Arabica::DOM::Node<std::string> Interpreter::getTransitionSubgraph(const Arabica
targets.push_back(source);
return findLCCA(targets);
}
+#endif
void Interpreter::microstep(const Arabica::XPath::NodeSet<std::string>& enabledTransitions) {
#if 0
@@ -1164,9 +1217,7 @@ void Interpreter::exitInterpreter() {
}
void Interpreter::executeTransitionContent(const Arabica::XPath::NodeSet<std::string>& enabledTransitions) {
- for (int i = 0; i < enabledTransitions.size(); i++) {
- executeContent(enabledTransitions[i]);
- }
+ executeContent(enabledTransitions);
}
void Interpreter::executeContent(const NodeList<std::string>& content) {
@@ -1177,11 +1228,27 @@ void Interpreter::executeContent(const NodeList<std::string>& content) {
}
}
+void Interpreter::executeContent(const NodeSet<std::string>& content) {
+ for (unsigned int i = 0; i < content.size(); i++) {
+ if (content[i].getNodeType() != Node_base::ELEMENT_NODE)
+ continue;
+ executeContent(content[i]);
+ }
+}
+
void Interpreter::executeContent(const Arabica::DOM::Node<std::string>& content) {
if (content.getNodeType() != Node_base::ELEMENT_NODE)
return;
if (false) {
+ } else if (boost::iequals(TAGNAME(content), _xmlNSPrefix + "onentry") ||
+ boost::iequals(TAGNAME(content), _xmlNSPrefix + "onexit") ||
+ boost::iequals(TAGNAME(content), _xmlNSPrefix + "transition")) {
+ // --- CONVENIENCE LOOP --------------------------
+ NodeList<std::string> executable = content.getChildNodes();
+ for (int i = 0; i < executable.getLength(); i++) {
+ executeContent(executable.item(i));
+ }
} else if (boost::iequals(TAGNAME(content), _xmlNSPrefix + "raise")) {
// --- RAISE --------------------------
if (HAS_ATTR(content, "event")) {
@@ -1305,8 +1372,14 @@ ELSIF_ELEM_MATCH:
}
std::stringstream srcContent;
- srcContent << scriptUrl;
+ if (_cachedURLs.find(scriptUrl.asString()) != _cachedURLs.end()) {
+ srcContent << _cachedURLs[scriptUrl.asString()];
+ } else {
+ srcContent << scriptUrl;
+ _cachedURLs[scriptUrl.asString()] = scriptUrl;
+ }
+
try {
_dataModel.eval(srcContent.str());
} catch (Event e) {
@@ -1349,10 +1422,27 @@ ELSIF_ELEM_MATCH:
} else if (boost::iequals(TAGNAME(content), _xmlNSPrefix + "invoke")) {
// --- INVOKE --------------------------
} else {
- NodeList<std::string> executable = content.getChildNodes();
- for (int i = 0; i < executable.getLength(); i++) {
- executeContent(executable.item(i));
- }
+ // --- Custom Executable Content
+ ExecutableContent execContent;
+ if (_executableContent.find(content) == _executableContent.end()) {
+ execContent = Factory::createExecutableContent(content.getLocalName(), content.getNamespaceURI(), this);
+ if (!execContent) {
+ LOG(ERROR) << "No custom executable content known for " << content.getLocalName() << " in " << content.getNamespaceURI();
+ return;
+ }
+ _executableContent[content] = execContent;
+ } else {
+ execContent = _executableContent[content];
+ }
+
+ execContent.enterElement(content);
+ if (execContent.processChildren()) {
+ NodeList<std::string> executable = content.getChildNodes();
+ for (int i = 0; i < executable.getLength(); i++) {
+ executeContent(executable.item(i));
+ }
+ }
+ execContent.exitElement(content);
}
}
@@ -1363,7 +1453,7 @@ void Interpreter::exitStates(const Arabica::XPath::NodeSet<std::string>& enabled
NodeSet<std::string> statesToExit;
std::set<InterpreterMonitor*>::iterator monIter;
-#if 1
+#if VERBOSE
std::cout << "Enabled exit transitions: " << std::endl;
for (int i = 0; i < enabledTransitions.size(); i++) {
std::cout << enabledTransitions[i] << std::endl;
@@ -1395,7 +1485,7 @@ void Interpreter::exitStates(const Arabica::XPath::NodeSet<std::string>& enabled
tmpStates.push_back(source);
tmpStates.insert(tmpStates.end(), tStates.begin(), tStates.end());
-#if 1
+#if VERBOSE
std::cout << "tmpStates: ";
for (int i = 0; i < tmpStates.size(); i++) {
std::cout << ATTR(tmpStates[i], "id") << ", ";
@@ -1405,7 +1495,7 @@ void Interpreter::exitStates(const Arabica::XPath::NodeSet<std::string>& enabled
ancestor = findLCCA(tmpStates);
}
-#if 1
+#if VERBOSE
std::cout << "Ancestor: " << ATTR(ancestor, "id") << std::endl;;
#endif
@@ -1416,10 +1506,10 @@ void Interpreter::exitStates(const Arabica::XPath::NodeSet<std::string>& enabled
}
}
-#if 1
+#if VERBOSE
std::cout << "States to exit: ";
for (int i = 0; i < statesToExit.size(); i++) {
- std::cout << ATTR(statesToExit[i], "id") << ", ";
+ std::cout << LOCALNAME(statesToExit[i]) << ":" << ATTR(statesToExit[i], "id") << ", ";
}
std::cout << std::endl;
@@ -1503,12 +1593,13 @@ void Interpreter::exitStates(const Arabica::XPath::NodeSet<std::string>& enabled
}
+#ifdef ORIG_ENTERSTATES
void Interpreter::enterStates(const Arabica::XPath::NodeSet<std::string>& enabledTransitions) {
NodeSet<std::string> statesToEnter;
NodeSet<std::string> statesForDefaultEntry;
std::set<InterpreterMonitor*>::iterator monIter;
-#if 1
+#if VERBOSE
std::cout << "Enabled enter transitions: " << std::endl;
for (int i = 0; i < enabledTransitions.size(); i++) {
std::cout << enabledTransitions[i] << std::endl;
@@ -1522,7 +1613,7 @@ void Interpreter::enterStates(const Arabica::XPath::NodeSet<std::string>& enable
std::string transitionType = (boost::iequals(transition.getAttribute("type"), "internal") ? "internal" : "external");
NodeSet<std::string> tStates = getTargetStates(transition);
-#if 1
+#if VERBOSE
std::cout << "Target States: ";
for (int i = 0; i < tStates.size(); i++) {
std::cout << ATTR(tStates[i], "id") << ", ";
@@ -1532,7 +1623,7 @@ void Interpreter::enterStates(const Arabica::XPath::NodeSet<std::string>& enable
Arabica::DOM::Node<std::string> ancestor;
Arabica::DOM::Node<std::string> source = getSourceState(transition);
-#if 1
+#if VERBOSE
std::cout << "Source States: " << ATTR(source, "id") << std::endl;
#endif
assert(source);
@@ -1556,7 +1647,7 @@ void Interpreter::enterStates(const Arabica::XPath::NodeSet<std::string>& enable
ancestor = findLCCA(tmpStates);
}
-#if 1
+#if VERBOSE
std::cout << "Ancestor: " << ATTR(ancestor, "id") << std::endl;
#endif
@@ -1564,10 +1655,10 @@ void Interpreter::enterStates(const Arabica::XPath::NodeSet<std::string>& enable
addStatesToEnter(tStates[j], statesToEnter, statesForDefaultEntry);
}
-#if 1
+#if VERBOSE
std::cout << "States to enter: ";
for (int i = 0; i < statesToEnter.size(); i++) {
- std::cout << ATTR(statesToEnter[i], "id") << ", ";
+ std::cout << LOCALNAME(statesToEnter[i]) << ":" << ATTR(statesToEnter[i], "id") << ", ";
}
std::cout << std::endl;
#endif
@@ -1575,7 +1666,7 @@ void Interpreter::enterStates(const Arabica::XPath::NodeSet<std::string>& enable
for (int j = 0; j < tStates.size(); j++) {
NodeSet<std::string> ancestors = getProperAncestors(tStates[j], ancestor);
-#if 1
+#if VERBOSE
std::cout << "Proper Ancestors of " << ATTR(tStates[j], "id") << " and " << ATTR(ancestor, "id") << ": ";
for (int i = 0; i < ancestors.size(); i++) {
std::cout << ATTR(ancestors[i], "id") << ", ";
@@ -1628,9 +1719,8 @@ void Interpreter::enterStates(const Arabica::XPath::NodeSet<std::string>& enable
}
// execute onentry executable content
NodeSet<std::string> onEntryElems = filterChildElements(_xmlNSPrefix + "onEntry", stateElem);
- for (int j = 0; j < onEntryElems.size(); j++) {
- executeContent(onEntryElems[j]);
- }
+ executeContent(onEntryElems);
+
if (isMember(stateElem, statesForDefaultEntry)) {
// execute initial transition content for compund states
Arabica::XPath::NodeSet<std::string> transitions = _xpath.evaluate("" + _xpathPrefix + "initial/" + _xpathPrefix + "transition", stateElem).asNodeSet();
@@ -1675,6 +1765,248 @@ void Interpreter::enterStates(const Arabica::XPath::NodeSet<std::string>& enable
}
}
+
+void Interpreter::addStatesToEnter(const Arabica::DOM::Node<std::string>& state,
+ Arabica::XPath::NodeSet<std::string>& statesToEnter,
+ Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry) {
+ std::string stateId = ((Arabica::DOM::Element<std::string>)state).getAttribute("id");
+
+#if VERBOSE
+ std::cout << "Adding state to enter: " << stateId << std::endl;
+#endif
+ if (isHistory(state)) {
+ if (_historyValue.find(stateId) != _historyValue.end()) {
+ Arabica::XPath::NodeSet<std::string> historyValue = _historyValue[stateId];
+
+#if VERBOSE
+ std::cout << "History State " << ATTR(state, "id") << ": ";
+ for (int i = 0; i < historyValue.size(); i++) {
+ std::cout << ATTR(historyValue[i], "id") << ", ";
+ }
+ std::cout << std::endl;
+#endif
+
+ for (int i = 0; i < historyValue.size(); i++) {
+ addStatesToEnter(historyValue[i], statesToEnter, statesForDefaultEntry);
+ NodeSet<std::string> ancestors = getProperAncestors(historyValue[i], state);
+
+#if VERBOSE
+ std::cout << "Proper Ancestors: ";
+ for (int i = 0; i < ancestors.size(); i++) {
+ std::cout << ATTR(ancestors[i], "id") << ", ";
+ }
+ std::cout << std::endl;
+#endif
+
+ for (int j = 0; j < ancestors.size(); j++) {
+ statesToEnter.push_back(ancestors[j]);
+ }
+ }
+ } else {
+ NodeSet<std::string> transitions = filterChildElements(_xmlNSPrefix + "transition", state);
+ for (int i = 0; i < transitions.size(); i++) {
+ NodeSet<std::string> targets = getTargetStates(transitions[i]);
+ for (int j = 0; j < targets.size(); j++) {
+ addStatesToEnter(targets[j], statesToEnter, statesForDefaultEntry);
+
+ // Modifications from chris nuernberger
+ NodeSet<std::string> ancestors = getProperAncestors(targets[j], state);
+ for (int k = 0; k < ancestors.size(); k++) {
+ statesToEnter.push_back(ancestors[k]);
+ }
+ }
+ }
+ }
+ } else {
+ statesToEnter.push_back(state);
+ if (isCompound(state)) {
+ statesForDefaultEntry.push_back(state);
+
+ addStatesToEnter(getInitialState(state), statesToEnter, statesForDefaultEntry);
+
+# if 0
+ NodeSet<std::string> tStates = getTargetStates(getInitialState(state));
+ for (int i = 0; i < tStates.size(); i++) {
+ addStatesToEnter(tStates[i], statesToEnter, statesForDefaultEntry);
+ }
+# endif
+ // addStatesToEnter(getInitialState(state), statesToEnter, statesForDefaultEntry);
+ // NodeSet<std::string> tStates = getTargetStates(getInitialState(state));
+
+ } else if(isParallel(state)) {
+ NodeSet<std::string> childStates = getChildStates(state);
+ for (int i = 0; i < childStates.size(); i++) {
+ addStatesToEnter(childStates[i], statesToEnter, statesForDefaultEntry);
+ }
+ }
+ }
+}
+#endif
+
+#ifdef ENTERSTATES_02_2013
+void Interpreter::enterStates(const Arabica::XPath::NodeSet<std::string>& enabledTransitions) {
+ NodeSet<std::string> statesToEnter;
+ NodeSet<std::string> statesForDefaultEntry;
+ std::set<InterpreterMonitor*>::iterator monIter;
+
+ computeEntrySet(enabledTransitions, statesToEnter, statesForDefaultEntry);
+ statesToEnter.sort(); // entry order is document order
+ for (int i = 0; i < statesToEnter.size(); i++) {
+ Arabica::DOM::Element<std::string> s = (Arabica::DOM::Element<std::string>)statesToEnter[i];
+ _configuration.push_back(s);
+ _statesToInvoke.push_back(s);
+
+ if (_binding == LATE && ATTR(s, "isFirstEntry").size() > 0) {
+ NodeSet<std::string> dataModelElems = filterChildElements(_xmlNSPrefix + "datamodel", s);
+ if(dataModelElems.size() > 0 && _dataModel) {
+ Arabica::XPath::NodeSet<std::string> dataElems = filterChildElements(_xmlNSPrefix + "data", dataModelElems[0]);
+ for (int j = 0; j < dataElems.size(); j++) {
+ initializeData(dataElems[j]);
+ }
+ }
+ s.setAttribute("isFirstEntry", "");
+ }
+ executeContent(filterChildElements(_xmlNSPrefix + "onEntry", s));
+ if (isMember(s, statesForDefaultEntry)) {
+ executeContent(getInitialState(s)); // TODO: This part is unclear
+ }
+
+#if VERBOSE
+ std::cout << "Is state " << ATTR(s, "id") << " final?";
+#endif
+ if (isFinal(s)) {
+ if (parentIsScxmlState(s)) {
+ _running = false;
+ _done = true;
+ } else {
+ Arabica::DOM::Element<std::string> parent = (Arabica::DOM::Element<std::string>)s.getParentNode();
+ Arabica::DOM::Element<std::string> grandParent = (Arabica::DOM::Element<std::string>)parent.getParentNode();
+ internalDoneSend(parent);
+
+ if (isParallel(grandParent)) {
+ Arabica::XPath::NodeSet<std::string> childs = getChildStates(grandParent);
+ bool inFinalState = true;
+ for (int j = 0; j < childs.size(); j++) {
+ if (!isInFinalState(childs[j])) {
+ inFinalState = false;
+ break;
+ }
+ }
+ if (inFinalState) {
+ internalDoneSend(grandParent);
+ }
+ }
+ }
+ }
+ }
+}
+void Interpreter::computeEntrySet(const Arabica::XPath::NodeSet<std::string>& transitions,
+ Arabica::XPath::NodeSet<std::string>& statesToEnter,
+ Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry) {
+ for (int i = 0; i < transitions.size(); i++) {
+ NodeSet<std::string> targets = getTargetStates(transitions[i]);
+ for (int j = 0; j < targets.size(); j++) {
+ statesToEnter.push_back(targets[i]);
+ }
+ }
+ for (int i = 0; i < transitions.size(); i++) {
+ Arabica::DOM::Node<std::string> ancestor = getTransitionDomain(transitions[i]);
+ NodeSet<std::string> targets = getTargetStates(transitions[i]);
+ for (int j = 0; j < targets.size(); j++) {
+ addAncestorStatesToEnter(targets[j], ancestor, statesToEnter, statesForDefaultEntry);
+ }
+ }
+}
+void Interpreter::addDescendentStatesToEnter(const Arabica::DOM::Node<std::string>& state,
+ Arabica::XPath::NodeSet<std::string>& statesToEnter,
+ Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry) {
+ if (isHistory(state)) {
+ if (_historyValue.find(ATTR(state, "id")) != _historyValue.end()) {
+ Arabica::XPath::NodeSet<std::string> history = _historyValue[ATTR(state, "id")];
+ for (int i = 0; i < history.size(); i++) {
+ addDescendentStatesToEnter(history[i], statesToEnter, statesForDefaultEntry);
+ addAncestorStatesToEnter(history[i], state.getParentNode(), statesToEnter, statesForDefaultEntry);
+ }
+ } else {
+ NodeSet<std::string> transitions = filterChildElements(_xmlNSPrefix + "transition", state);
+ for (int i = 0; i < transitions.size(); i++) {
+ NodeSet<std::string> targets = getTargetStates(transitions[i]);
+ for (int j = 0; j < targets.size(); j++) {
+ addDescendentStatesToEnter(targets[j],statesToEnter,statesForDefaultEntry);
+ addAncestorStatesToEnter(targets[j], state.getParentNode(), statesToEnter, statesForDefaultEntry);
+ }
+ }
+ }
+ } else {
+ statesToEnter.push_back(state);
+ if (isCompound(state)) {
+ statesForDefaultEntry.push_back(state);
+ Node<std::string> initial = getInitialState(state);
+ addDescendentStatesToEnter(initial, statesToEnter, statesForDefaultEntry);
+ addAncestorStatesToEnter(initial, state.getParentNode(), statesToEnter, statesForDefaultEntry);
+ } else if (isParallel(state)) {
+ NodeSet<std::string> childs = getChildStates(state);
+ for (int i = 0; i < childs.size(); i++) {
+ bool someAreDescendants = false;
+ for (int j = 0; i < statesToEnter.size(); j++) {
+ if (isDescendant(statesToEnter[j], childs[i]))
+ someAreDescendants = true;
+ }
+ if (!someAreDescendants) {
+ addDescendentStatesToEnter(childs[i], statesToEnter, statesForDefaultEntry);
+ }
+ }
+ }
+ }
+}
+
+void Interpreter::addAncestorStatesToEnter(const Arabica::DOM::Node<std::string>& state,
+ const Arabica::DOM::Node<std::string>& ancestor,
+ Arabica::XPath::NodeSet<std::string>& statesToEnter,
+ Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry) {
+ NodeSet<std::string> properAncs = getProperAncestors(state, ancestor);
+ for (int k = 0; k < properAncs.size(); k++) {
+ statesToEnter.push_back(properAncs[k]);
+ if (isParallel(properAncs[k])) {
+ NodeSet<std::string> childs = getChildStates(properAncs[k]);
+ for (int i = 0; i < childs.size(); i++) {
+ bool someAreDescendants = false;
+ for (int j = 0; i < statesToEnter.size(); j++) {
+ if (isDescendant(statesToEnter[j], childs[i]))
+ someAreDescendants = true;
+ }
+ if (!someAreDescendants) {
+ addDescendentStatesToEnter(childs[i], statesToEnter, statesForDefaultEntry);
+ }
+ }
+ }
+ }
+}
+
+Arabica::DOM::Node<std::string> Interpreter::getTransitionDomain(const Arabica::DOM::Node<std::string>& transition) {
+ Arabica::DOM::Node<std::string> source = getSourceState(transition);
+ if (isTargetless(transition)) {
+ return source;
+ }
+
+ Arabica::XPath::NodeSet<std::string> targets = getTargetStates(transition);
+ if (boost::iequals(ATTR(transition, "type"), "internal") && isCompound(source)) {
+ bool allDescendants = true;
+ for (int i = 0; i < targets.size(); i++) {
+ if (!isDescendant(targets[i], source)) {
+ allDescendants = false;
+ break;
+ }
+ }
+ if (allDescendants)
+ return source;
+ }
+
+ targets.push_back(source);
+ return findLCCA(targets);
+}
+
+#endif
bool Interpreter::parentIsScxmlState(Arabica::DOM::Node<std::string> state) {
Arabica::DOM::Element<std::string> stateElem = (Arabica::DOM::Element<std::string>)state;
@@ -1710,79 +2042,6 @@ bool Interpreter::isMember(const Arabica::DOM::Node<std::string>& node, const Ar
return false;
}
-void Interpreter::addStatesToEnter(const Arabica::DOM::Node<std::string>& state,
- Arabica::XPath::NodeSet<std::string>& statesToEnter,
- Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry) {
- std::string stateId = ((Arabica::DOM::Element<std::string>)state).getAttribute("id");
-
-#if 1
- std::cout << "Adding state to enter: " << stateId << std::endl;
-#endif
- if (isHistory(state)) {
- if (_historyValue.find(stateId) != _historyValue.end()) {
- Arabica::XPath::NodeSet<std::string> historyValue = _historyValue[stateId];
-
-#if 1
- std::cout << "History State " << ATTR(state, "id") << ": ";
- for (int i = 0; i < historyValue.size(); i++) {
- std::cout << ATTR(historyValue[i], "id") << ", ";
- }
- std::cout << std::endl;
-#endif
-
- for (int i = 0; i < historyValue.size(); i++) {
- addStatesToEnter(historyValue[i], statesToEnter, statesForDefaultEntry);
- NodeSet<std::string> ancestors = getProperAncestors(historyValue[i], state);
-
-#if 1
- std::cout << "Proper Ancestors: ";
- for (int i = 0; i < ancestors.size(); i++) {
- std::cout << ATTR(ancestors[i], "id") << ", ";
- }
- std::cout << std::endl;
-#endif
-
- for (int j = 0; j < ancestors.size(); j++) {
- statesToEnter.push_back(ancestors[j]);
- }
- }
- } else {
- NodeSet<std::string> transitions = filterChildElements(_xmlNSPrefix + "transition", state);
- for (int i = 0; i < transitions.size(); i++) {
- NodeSet<std::string> targets = getTargetStates(transitions[i]);
- for (int j = 0; j < targets.size(); j++) {
- addStatesToEnter(targets[j], statesToEnter, statesForDefaultEntry);
-
- // Modifications from chris nuernberger
- NodeSet<std::string> ancestors = getProperAncestors(targets[j], state);
- for (int k = 0; k < ancestors.size(); k++) {
- statesToEnter.push_back(ancestors[k]);
- }
- }
- }
- }
- } else {
- statesToEnter.push_back(state);
- if (isCompound(state)) {
- statesForDefaultEntry.push_back(state);
-#if 0
- NodeSet<std::string> tStates = getTargetStates(getInitialState(state));
- for (int i = 0; i < tStates.size(); i++) {
- addStatesToEnter(tStates[i], statesToEnter, statesForDefaultEntry);
- }
-#endif
- addStatesToEnter(getInitialState(state), statesToEnter, statesForDefaultEntry);
-// NodeSet<std::string> tStates = getTargetStates(getInitialState(state));
-
- } else if(isParallel(state)) {
- NodeSet<std::string> childStates = getChildStates(state);
- for (int i = 0; i < childStates.size(); i++) {
- addStatesToEnter(childStates[i], statesToEnter, statesForDefaultEntry);
- }
- }
- }
-}
-
Arabica::XPath::NodeSet<std::string> Interpreter::getChildStates(const Arabica::DOM::Node<std::string>& state) {
Arabica::XPath::NodeSet<std::string> childs;
@@ -1899,6 +2158,10 @@ Arabica::DOM::Node<std::string> Interpreter::getInitialState(Arabica::DOM::Node<
state = state.getNextSibling();
}
+#if VERBOSE
+ std::cout << "Getting initial state of " << TAGNAME(state) << " " << ATTR(state, "id") << std::endl;
+#endif
+
assert(isCompound(state) || isParallel(state));
// initial attribute at element
@@ -1925,8 +2188,10 @@ Arabica::DOM::Node<std::string> Interpreter::getInitialState(Arabica::DOM::Node<
NodeSet<std::string> Interpreter::getTargetStates(const Arabica::DOM::Node<std::string>& transition) {
NodeSet<std::string> targetStates;
+ assert(boost::iequals(LOCALNAME(transition), "transition"));
+
// if we are called with a state, process all its transitions
- if (isState(transition)) {
+ if (isState(transition) || (transition.getNodeType() == Node_base::ELEMENT_NODE && boost::iequals(_xmlNSPrefix + "initial", TAGNAME(transition)))) {
NodeList<std::string> childs = transition.getChildNodes();
for (int i = 0; i < childs.getLength(); i++) {
if (childs.item(i).getNodeType() == Node_base::ELEMENT_NODE && boost::iequals(TAGNAME(childs.item(i)), _xmlNSPrefix + "transition")) {
@@ -2027,6 +2292,8 @@ bool Interpreter::isWithinSameChild(const Arabica::DOM::Node<std::string>& trans
// @todo: do we need to look at parallel as well?
if (_xpath.evaluate("" + _xpathPrefix + "state[id=\"" + target + "\"]", transition.getParentNode()).asNodeSet().size() > 0)
return true;
+ if (_xpath.evaluate("" + _xpathPrefix + "parallel[id=\"" + target + "\"]", transition.getParentNode()).asNodeSet().size() > 0)
+ return true;
}
return false;
}
diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h
index 7b30fd9..9ec4eb1 100644
--- a/src/uscxml/Interpreter.h
+++ b/src/uscxml/Interpreter.h
@@ -24,8 +24,12 @@
#include "uscxml/Message.h"
#include "uscxml/Factory.h"
+#define ORIG_ENTERSTATES
+
namespace uscxml {
+class HTTPServletInvoker;
+
class InterpreterMonitor {
public:
virtual ~InterpreterMonitor() {}
@@ -146,6 +150,8 @@ public:
return _sessionId;
}
+ HTTPServletInvoker* getHTTPServlet() { return _httpServlet; }
+
bool runOnMainThread(int fps, bool blocking = true);
static bool isMember(const Arabica::DOM::Node<std::string>& node, const Arabica::XPath::NodeSet<std::string>& set);
@@ -209,22 +215,44 @@ protected:
uscxml::concurrency::BlockingQueue<Event>* _parentQueue;
DelayedEventQueue* _sendQueue;
+ HTTPServletInvoker* _httpServlet;
+
std::set<InterpreterMonitor*> _monitors;
static URL toBaseURI(const URL& url);
void microstep(const Arabica::XPath::NodeSet<std::string>& enabledTransitions);
- void exitStates(const Arabica::XPath::NodeSet<std::string>& enabledTransitions);
- void enterStates(const Arabica::XPath::NodeSet<std::string>& enabledTransitions);
void executeTransitionContent(const Arabica::XPath::NodeSet<std::string>& enabledTransitions);
void executeContent(const Arabica::DOM::Node<std::string>& content);
void executeContent(const Arabica::DOM::NodeList<std::string>& content);
+ void executeContent(const Arabica::XPath::NodeSet<std::string>& content);
void initializeData(const Arabica::DOM::Node<std::string>& data);
void exitInterpreter();
+#ifdef ORIG_ENTERSTATES
+ void enterStates(const Arabica::XPath::NodeSet<std::string>& enabledTransitions);
void addStatesToEnter(const Arabica::DOM::Node<std::string>& state,
Arabica::XPath::NodeSet<std::string>& statesToEnter,
Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry);
+#endif
+
+#ifdef ENTERSTATES_02_2013
+ void enterStates(const Arabica::XPath::NodeSet<std::string>& enabledTransitions);
+ void computeEntrySet(const Arabica::XPath::NodeSet<std::string>& transitions,
+ Arabica::XPath::NodeSet<std::string>& statesToEnter,
+ Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry);
+ void addDescendentStatesToEnter(const Arabica::DOM::Node<std::string>& state,
+ Arabica::XPath::NodeSet<std::string>& statesToEnter,
+ Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry);
+ void addAncestorStatesToEnter(const Arabica::DOM::Node<std::string>& state,
+ const Arabica::DOM::Node<std::string>& ancestor,
+ Arabica::XPath::NodeSet<std::string>& statesToEnter,
+ Arabica::XPath::NodeSet<std::string>& statesForDefaultEntry);
+ Arabica::DOM::Node<std::string> getTransitionDomain(const Arabica::DOM::Node<std::string>& transition);
+
+#endif
+
+ void exitStates(const Arabica::XPath::NodeSet<std::string>& enabledTransitions);
Arabica::XPath::NodeSet<std::string> selectEventlessTransitions();
Arabica::XPath::NodeSet<std::string> selectTransitions(const std::string& event);
@@ -242,13 +270,13 @@ protected:
static bool nameMatch(const std::string& transitionEvent, const std::string& event);
Arabica::XPath::NodeSet<std::string> filterPreempted(const Arabica::XPath::NodeSet<std::string>& enabledTransitions);
- bool hasConditionMatch(const Arabica::DOM::Node<std::string>& conditional);
bool isPreemptingTransition(const Arabica::DOM::Node<std::string>& t1, const Arabica::DOM::Node<std::string>& t2);
- bool isInFinalState(const Arabica::DOM::Node<std::string>& state);
bool isWithinSameChild(const Arabica::DOM::Node<std::string>& transition);
+ 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);
- Arabica::DOM::Node<std::string> getTransitionSubgraph(const Arabica::DOM::Node<std::string>& transition);
+// Arabica::DOM::Node<std::string> getTransitionSubgraph(const Arabica::DOM::Node<std::string>& transition);
static std::vector<std::string> tokenizeIdRefs(const std::string& idRefs);
@@ -267,9 +295,11 @@ protected:
std::map<std::string, std::pair<Interpreter*, SendRequest> > _sendIds;
std::map<std::string, Invoker> _invokers;
std::map<std::string, Invoker> _autoForwardees;
+ std::map<Arabica::DOM::Node<std::string>, ExecutableContent> _executableContent;
/// We need to remember to adapt them when the DOM is operated upon
std::map<std::string, Arabica::DOM::Node<std::string> > _cachedStates;
+ std::map<std::string, URL> _cachedURLs;
};
}
diff --git a/src/uscxml/Message.cpp b/src/uscxml/Message.cpp
index 9453508..1466b6a 100644
--- a/src/uscxml/Message.cpp
+++ b/src/uscxml/Message.cpp
@@ -5,6 +5,7 @@
//#include "uscxml/Interpreter.h"
#include <DOM/SAX2DOM/SAX2DOM.hpp>
#include <SAX/helpers/CatchErrorHandler.hpp>
+#include <glog/logging.h>
#ifdef HAS_STRING_H
#include <string.h>
@@ -109,7 +110,7 @@ Arabica::DOM::Document<std::string> Data::toDocument() {
Arabica::DOM::Document<std::string> Event::toDocument() {
Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
- Arabica::DOM::Document<std::string> document = Data::toDocument();
+ Arabica::DOM::Document<std::string> document = data.toDocument();
Arabica::DOM::Element<std::string> scxmlMsg = document.getDocumentElement();
@@ -178,17 +179,47 @@ Data Data::fromXML(const std::string& xmlString) {
Data Data::fromJSON(const std::string& jsonString) {
Data data;
+ jsmn_parser p;
- // unimplemented
-// assert(false);
+ jsmntok_t* t = NULL;
- jsmn_parser p;
- jsmntok_t t[1024];
- memset(&t, 0, sizeof(t));
- jsmn_init(&p);
+ // we do not know the number of tokens beforehand, start with something sensible and increase
+ int rv;
+ int frac = 32; // this will get decreased to 16 to first iteration for 1/16 length/token ratio
+ do {
+ jsmn_init(&p);
+
+ frac /= 2;
+ int nrTokens = jsonString.size() / frac;
+ if (t != NULL) {
+ free(t);
+// LOG(INFO) << "Increasing JSON length to token ratio to 1/" << frac;
+ }
+ t = (jsmntok_t*)malloc(nrTokens * sizeof(jsmntok_t));
+ if (t == NULL) {
+ LOG(ERROR) << "Cannot parse JSON, ran out of memory!";
+ return data;
+ }
+ memset(t, 0, nrTokens * sizeof(jsmntok_t));
+
+ rv = jsmn_parse(&p, jsonString.c_str(), t, nrTokens);
+ } while (rv == JSMN_ERROR_NOMEM && frac > 1);
- int rv = jsmn_parse(&p, jsonString.c_str(), t, 1024);
if (rv != 0) {
+ switch (rv) {
+ case JSMN_ERROR_NOMEM:
+ LOG(ERROR) << "Cannot parse JSON, not enough tokens were provided!";
+ break;
+ case JSMN_ERROR_INVAL:
+ LOG(ERROR) << "Cannot parse JSON, invalid character inside JSON string!";
+ break;
+ case JSMN_ERROR_PART:
+ LOG(ERROR) << "Cannot parse JSON, the string is not a full JSON packet, more bytes expected!";
+ break;
+ default:
+ break;
+ }
+ free(t);
return data;
}
@@ -216,7 +247,7 @@ Data Data::fromJSON(const std::string& jsonString) {
// there are no more tokens
if (t[currTok].end == 0 || tokenStack.empty())
break;
-
+
// next token starts after current one => pop
if (t[currTok].end > tokenStack.back().end)
tokenStack.pop_back();
@@ -233,6 +264,8 @@ Data Data::fromJSON(const std::string& jsonString) {
}
} while (true);
+
+ free(t);
return data;
}
@@ -271,7 +304,7 @@ Event Event::fromXML(const std::string& xmlString) {
break;
}
}
- event.compound[key] = Data(value, VERBATIM);
+ event.data.compound[key] = Data(value, Data::VERBATIM);
}
}
}
@@ -401,7 +434,7 @@ std::ostream& operator<< (std::ostream& os, const Event& event) {
if (event.origintype.size() > 0)
os << indent << " origintype: " << event.origintype << std::endl;
_dataIndentation++;
- os << indent << " data: " << (Data)event << std::endl;
+ os << indent << " data: " << event.data << std::endl;
_dataIndentation--;
return os;
}
diff --git a/src/uscxml/Message.h b/src/uscxml/Message.h
index 43eecdf..96ff6c8 100644
--- a/src/uscxml/Message.h
+++ b/src/uscxml/Message.h
@@ -52,7 +52,7 @@ protected:
#endif
};
-class Event : public Data {
+class Event {
public:
enum Type {
INTERNAL = 1,
@@ -70,7 +70,8 @@ public:
Arabica::DOM::Node<std::string> dom;
std::string sendid;
std::string invokeid;
-
+ Data data;
+
static Event fromXML(const std::string& xmlString);
Arabica::DOM::Document<std::string> toDocument();
std::string toXMLString() {
diff --git a/src/uscxml/URL.cpp b/src/uscxml/URL.cpp
index 015ed6c..8656cd2 100644
--- a/src/uscxml/URL.cpp
+++ b/src/uscxml/URL.cpp
@@ -1,23 +1,8 @@
-#include <algorithm>
-#include <assert.h>
-#include <iostream>
-#include <fstream>
-
#include <glog/logging.h>
-#include <boost/algorithm/string.hpp>
-
-#include <stdio.h>
-#include <string.h>
-#ifndef WIN32
-#include <sys/time.h>
-#endif
-#include <stdlib.h>
-#include <errno.h>
-
-#include "uscxml/Common.h"
#include "URL.h"
#include "uscxml/config.h"
+#include <fstream>
#include <stdio.h> /* defines FILENAME_MAX */
#ifdef _WIN32
@@ -36,484 +21,493 @@
#include <unistd.h> // mkstemp legacy
#endif
+#include <boost/algorithm/string.hpp>
+
namespace uscxml {
+URLImpl::URLImpl(const std::string& url) : _handle(NULL), _uri(url), _isDownloaded(false), _hasFailed(false) {
+ _handle = curl_easy_init();
+ if (_handle == NULL) {
+ LOG(ERROR) << "curl_easy_init returned NULL, this is bad!";
+ }
+}
+
URLImpl::~URLImpl() {
- if (_localFile.length() > 0)
- remove(_localFile.c_str());
+ if (_handle != NULL)
+ curl_easy_cleanup(_handle);
}
-
-const bool URLImpl::toAbsoluteCwd() {
- char currPath[FILENAME_MAX];
- if (!getcwd(currPath, sizeof(currPath))) {
- return false;
- }
- currPath[sizeof(currPath) - 1] = '\0'; /* not really required */
- return toAbsolute(std::string("file://" + std::string(currPath) + "/"));
+
+size_t URLImpl::writeHandler(void *ptr, size_t size, size_t nmemb, void *userdata) {
+ URLImpl* url = (URLImpl*)userdata;
+ url->_inContent.write((char*)ptr, size * nmemb);
+
+ monIter_t monIter = url->_monitors.begin();
+ while(monIter != url->_monitors.end()) {
+ (*monIter)->contentChunkReceived(URL(url->shared_from_this()), std::string((char*)ptr, size * nmemb));
+ monIter++;
+ }
+
+ return size * nmemb;
}
-std::string URLImpl::getLocalFilename(const std::string& suffix) {
- if (_localFile.length() > 0)
- return _localFile;
-
- if (_uri.scheme().compare("file") == 0)
- return _uri.path();
-
- // try hard to find a temporary directory
- const char* tmpDir = NULL;
- if (tmpDir == NULL)
- tmpDir = getenv("TMPDIR");
- if (tmpDir == NULL)
- tmpDir = getenv("TMP");
- if (tmpDir == NULL)
- tmpDir = getenv("TEMP");
- if (tmpDir == NULL)
- tmpDir = getenv("USERPROFILE");
- if (tmpDir == NULL)
- tmpDir = "/tmp";
-
- char* tmpl = (char*)malloc(strlen(tmpDir) + 11 + suffix.length());
- char* writePtr = tmpl;
- memcpy(writePtr, tmpDir, strlen(tmpDir));
- writePtr += strlen(tmpDir);
- memcpy(writePtr, "scxmlXXXXXX", 11);
- writePtr += 11;
- memcpy(writePtr, suffix.c_str(), suffix.length());
- writePtr += suffix.length();
- tmpl[writePtr - tmpl] = 0;
+size_t URLImpl::headerHandler(void *ptr, size_t size, size_t nmemb, void *userdata) {
+ URLImpl* url = (URLImpl*)userdata;
+ url->_inHeader.write((char*)ptr, size * nmemb);
-#ifdef _WIN32
- _mktemp_s(tmpl, strlen(tmpl) + 1);
- int fd = _open(tmpl, _O_CREAT, _S_IREAD | _S_IWRITE);
-#else
- int fd = mkstemps(tmpl, suffix.length());
-#endif
- if (fd < 0) {
- LOG(ERROR) << "mkstemp: " << strerror(errno) << std::endl;
- return "";
- }
-#ifdef WIN32
- _close(fd);
-#else
- close(fd);
-#endif
- return std::string(tmpl);
-}
+ monIter_t monIter = url->_monitors.begin();
+ while(monIter != url->_monitors.end()) {
+ (*monIter)->headerChunkReceived(URL(url->shared_from_this()), std::string((char*)ptr, size * nmemb));
+ monIter++;
+ }
-boost::shared_ptr<URLImpl> URLImpl::toLocalFile(const std::string& content, const std::string& suffix) {
- boost::shared_ptr<URLImpl> urlImpl = boost::shared_ptr<URLImpl>(new URLImpl());
- urlImpl->_localFile = urlImpl->getLocalFilename(suffix);
- urlImpl->_uri = std::string("file://") + urlImpl->_localFile;
-
- std::ofstream file(urlImpl->_localFile.c_str(), std::ios_base::out);
- if(file.is_open()) {
- file << content;
- file.close();
- } else {
- return boost::shared_ptr<URLImpl>();
- }
-
- return urlImpl;
+ return size * nmemb;
}
-const bool URLImpl::toAbsolute(const std::string& baseUrl) {
- if (_uri.is_absolute())
- return true;
- _uri = Arabica::io::URI(baseUrl, _uri.as_string());
- if (!_uri.is_absolute())
- return false;
- return true;
+void URLImpl::downloadStarted() {
+ LOG(INFO) << "Starting download of " << asString() << std::endl;
+ _inContent.str("");
+ _inContent.clear();
+ _inHeader.str("");
+ _inHeader.clear();
+
+ monIter_t monIter = _monitors.begin();
+ while(monIter != _monitors.end()) {
+ (*monIter)->downloadStarted(URL(shared_from_this()));
+ monIter++;
+ }
}
-const std::string URLImpl::asLocalFile(const std::string& suffix, bool reload) {
- // this is already a local file
- if (_uri.scheme().compare("file") == 0)
- return _uri.path();
-
- if (_localFile.length() > 0 && !reload)
- return _localFile;
-
- if (_localFile.length() > 0)
- remove(_localFile.c_str());
+void URLImpl::downloadCompleted() {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- _localFile = getLocalFilename(suffix);
+ LOG(INFO) << "Finished downloading " << asString() << " with " << _inContent.str().size() << " bytes";
- std::ofstream file(_localFile.c_str(), std::ios_base::out);
- if(file.is_open()) {
- file << URL(this->shared_from_this());
- file.close();
- } else {
- _localFile = "";
- }
+ _hasFailed = false;
+ _isDownloaded = true;
+ _condVar.notify_all();
- return _localFile;
+ monIter_t monIter = _monitors.begin();
+ while(monIter != _monitors.end()) {
+ (*monIter)->downloadCompleted(URL(shared_from_this()));
+ monIter++;
+ }
}
-std::ostream & operator<<(std::ostream & stream, const URL& url) {
-
- std::string urlString = url.asString();
- std::string fileURL = "file://";
-
- // strip file:// to support relative filenames
- if(urlString.substr(0, fileURL.size()) == fileURL) {
- urlString = urlString.substr(fileURL.size());
-#ifdef _WIN32
- urlString = urlString.substr(0,1) + ":" + urlString.substr(1);
-// std::replace( urlString.begin(), urlString.end(), '/', '\\');
-#endif
- }
-// LOG(ERROR) << "Trying to open " << urlString;
- URL_FILE *handle = url_fopen(urlString.c_str(), "r");
+void URLImpl::downloadFailed(int errorCode) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+
+ LOG(ERROR) << "Downloading " << asString() << " failed: " << strerror(errorCode);
+
+ _hasFailed = true;
+ _isDownloaded = false;
+ _condVar.notify_all();
+
+ monIter_t monIter = _monitors.begin();
+ while(monIter != _monitors.end()) {
+ (*monIter)->downloadFailed(URL(shared_from_this()), errorCode);
+ monIter++;
+ }
- if(!handle) {
- LOG(ERROR) << "Cannot open URL " << url.asString();
- return stream;
- }
-
- int nread;
- char buffer[256];
-
- do {
- nread = url_fread(buffer, 1,sizeof(buffer), handle);
- stream.write(buffer, nread);
- } while(nread);
-
- url_fclose(handle);
- return stream;
}
-
-/* we use a global one for convenience */
-CURLM *multi_handle;
-
-/* curl calls this routine to get more data */
-static size_t write_callback(char *buffer,
- size_t size,
- size_t nitems,
- void *userp) {
- char *newbuff;
- size_t rembuff;
-
- URL_FILE *url = (URL_FILE *)userp;
- size *= nitems;
-
- rembuff=url->buffer_len - url->buffer_pos; /* remaining space in buffer */
-
- if(size > rembuff) {
- /* not enough space in buffer */
- newbuff=(char*)realloc(url->buffer,url->buffer_len + (size - rembuff));
- if(newbuff==NULL) {
- fprintf(stderr,"callback buffer grow failed\n");
- size=rembuff;
- } else {
- /* realloc suceeded increase buffer size*/
- url->buffer_len+=size - rembuff;
- url->buffer=newbuff;
- }
- }
-
- memcpy(&url->buffer[url->buffer_pos], buffer, size);
- url->buffer_pos += size;
-
- return size;
+
+const std::map<std::string, std::string> URLImpl::getInHeaderFields() {
+ if (!_isDownloaded) {
+ download(true);
+ }
+
+ std::map<std::string, std::string> headerFields;
+ std::string line;
+ while (std::getline(_inHeader, line)) {
+ size_t colon = line.find_first_of(":");
+ size_t newline = line.find_first_of("\r\n");
+ if (newline == std::string::npos)
+ newline = line.size();
+
+ if (colon == std::string::npos) {
+ if (headerFields.size() == 0) {
+ // put http status in a key that can never occur otherwise
+ headerFields["status:"] = line.substr(0, newline);
+ } else {
+ headerFields[line.substr(0, newline)] = line.substr(0, newline); // this should never happen
+ }
+ } else {
+ std::string key = line.substr(0, colon);
+ size_t firstChar = line.find_first_not_of(": ", colon, 2);
+ if (firstChar == std::string::npos) {
+ // nothing but spaces?
+ headerFields[line.substr(0, newline)] = "";
+ } else {
+ std::string value = line.substr(firstChar, newline - firstChar);
+ headerFields[key] = value;
+ }
+ }
+ }
+
+ return headerFields;
}
-/* use to attempt to fill the read buffer up to requested number of bytes */
-static int fill_buffer(URL_FILE *file, size_t want) {
- fd_set fdread;
- fd_set fdwrite;
- fd_set fdexcep;
- struct timeval timeout;
- int rc;
-
- /* only attempt to fill buffer if transactions still running and buffer
- * doesnt exceed required size already
- */
- if((!file->still_running) || (file->buffer_pos > want))
- return 0;
-
- /* attempt to fill buffer */
- do {
- int maxfd = -1;
- long curl_timeo = -1;
-
- FD_ZERO(&fdread);
- FD_ZERO(&fdwrite);
- FD_ZERO(&fdexcep);
-
- /* set a suitable timeout to fail on */
- timeout.tv_sec = 60; /* 1 minute */
- timeout.tv_usec = 0;
-
- curl_multi_timeout(multi_handle, &curl_timeo);
- if(curl_timeo >= 0) {
- timeout.tv_sec = curl_timeo / 1000;
- if(timeout.tv_sec > 1)
- timeout.tv_sec = 1;
- else
- timeout.tv_usec = (curl_timeo % 1000) * 1000;
- }
-
- /* get file descriptors from the transfers */
- curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
-
- /* In a real-world program you OF COURSE check the return code of the
- function calls. On success, the value of maxfd is guaranteed to be
- greater or equal than -1. We call select(maxfd + 1, ...), specially
- in case of (maxfd == -1), we call select(0, ...), which is basically
- equal to sleep. */
-
- rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
-
- switch(rc) {
- case -1:
- /* select error */
- break;
-
- case 0:
- default:
- /* timeout or readable/writable sockets */
- curl_multi_perform(multi_handle, &file->still_running);
- break;
- }
- } while(file->still_running && (file->buffer_pos < want));
- return 1;
+void URLImpl::setRequestType(const std::string& requestType) {
+ _requestType = requestType;
}
-/* use to remove want bytes from the front of a files buffer */
-static int use_buffer(URL_FILE *file,int want) {
- /* sort out buffer */
- if((file->buffer_pos - want) <=0) {
- /* ditch buffer - write will recreate */
- if(file->buffer)
- free(file->buffer);
-
- file->buffer=NULL;
- file->buffer_pos=0;
- file->buffer_len=0;
- } else {
- /* move rest down make it available for later */
- memmove(file->buffer,
- &file->buffer[want],
- (file->buffer_pos - want));
-
- file->buffer_pos -= want;
- }
- return 0;
+void URLImpl::setOutContent(const std::string& content) {
+ _outContent = content;
}
-URL_FILE *url_fopen(const char *url,const char *operation) {
- /* this code could check for URLs or types in the 'url' and
- basicly use the real fopen() for standard files */
-
- URL_FILE *file;
- (void)operation;
-
- file = (URL_FILE*)malloc(sizeof(URL_FILE));
- if(!file)
- return NULL;
-
- memset(file, 0, sizeof(URL_FILE));
-
- if((file->handle.file=fopen(url,operation)))
- file->type = CFTYPE_FILE; /* marked as URL */
-
- else {
- file->type = CFTYPE_CURL; /* marked as URL */
- file->handle.curl = curl_easy_init();
-
- curl_easy_setopt(file->handle.curl, CURLOPT_URL, url);
- curl_easy_setopt(file->handle.curl, CURLOPT_WRITEDATA, file);
- curl_easy_setopt(file->handle.curl, CURLOPT_VERBOSE, 0L);
- curl_easy_setopt(file->handle.curl, CURLOPT_WRITEFUNCTION, write_callback);
-
- if(!multi_handle)
- multi_handle = curl_multi_init();
-
- curl_multi_add_handle(multi_handle, file->handle.curl);
-
- /* lets start the fetch */
- curl_multi_perform(multi_handle, &file->still_running);
-
- if((file->buffer_pos == 0) && (!file->still_running)) {
- /* if still_running is 0 now, we should return NULL */
-
- /* make sure the easy handle is not in the multi handle anymore */
- curl_multi_remove_handle(multi_handle, file->handle.curl);
-
- /* cleanup */
- curl_easy_cleanup(file->handle.curl);
-
- free(file);
-
- file = NULL;
- }
- }
- return file;
+const std::string URLImpl::getInContent(bool forceReload) {
+ if (!_isDownloaded) {
+ download(true);
+ }
+ return _inContent.str();
}
-int url_fclose(URL_FILE *file) {
- int ret=0;/* default is good return */
-
- switch(file->type) {
- case CFTYPE_FILE:
- ret=fclose(file->handle.file); /* passthrough */
- break;
-
- case CFTYPE_CURL:
- /* make sure the easy handle is not in the multi handle anymore */
- curl_multi_remove_handle(multi_handle, file->handle.curl);
-
- /* cleanup */
- curl_easy_cleanup(file->handle.curl);
- break;
-
- default: /* unknown or supported type - oh dear */
- ret=EOF;
- errno=EBADF;
- break;
- }
-
- if(file->buffer)
- free(file->buffer);/* free any allocated buffer space */
-
- free(file);
-
- return ret;
+const void URLImpl::download(bool blocking) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+
+ if (_isDownloaded)
+ return;
+
+ URL url(shared_from_this());
+ URLFetcher::fetchURL(url);
+
+ if (blocking) {
+ while(!_isDownloaded && !_hasFailed) {
+ _condVar.wait(_mutex); // wait for notification
+ }
+ }
}
-int url_feof(URL_FILE *file) {
- int ret=0;
-
- switch(file->type) {
- case CFTYPE_FILE:
- ret=feof(file->handle.file);
- break;
-
- case CFTYPE_CURL:
- if((file->buffer_pos == 0) && (!file->still_running))
- ret = 1;
- break;
-
- default: /* unknown or supported type - oh dear */
- ret=-1;
- errno=EBADF;
- break;
- }
- return ret;
+const bool URLImpl::toAbsoluteCwd() {
+ char currPath[FILENAME_MAX];
+ if (!getcwd(currPath, sizeof(currPath))) {
+ return false;
+ }
+ currPath[sizeof(currPath) - 1] = '\0'; /* not really required */
+ return toAbsolute(std::string("file://" + std::string(currPath) + "/"));
}
-size_t url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file) {
- size_t want;
-
- switch(file->type) {
- case CFTYPE_FILE:
- want=fread(ptr,size,nmemb,file->handle.file);
- break;
-
- case CFTYPE_CURL:
- want = nmemb * size;
-
- fill_buffer(file,want);
-
- /* check if theres data in the buffer - if not fill_buffer()
- * either errored or EOF */
- if(!file->buffer_pos)
- return 0;
-
- /* ensure only available data is considered */
- if(file->buffer_pos < want)
- want = file->buffer_pos;
-
- /* xfer data to caller */
- memcpy(ptr, file->buffer, want);
-
- use_buffer(file,want);
-
- want = want / size; /* number of items */
- break;
-
- default: /* unknown or supported type - oh dear */
- want=0;
- errno=EBADF;
- break;
-
- }
- return want;
+std::string URLImpl::getLocalFilename(const std::string& suffix) {
+ if (_localFile.length() > 0)
+ return _localFile;
+
+ if (_uri.scheme().compare("file") == 0)
+ return _uri.path();
+
+ // try hard to find a temporary directory
+ const char* tmpDir = NULL;
+ if (tmpDir == NULL)
+ tmpDir = getenv("TMPDIR");
+ if (tmpDir == NULL)
+ tmpDir = getenv("TMP");
+ if (tmpDir == NULL)
+ tmpDir = getenv("TEMP");
+ if (tmpDir == NULL)
+ tmpDir = getenv("USERPROFILE");
+ if (tmpDir == NULL)
+ tmpDir = "/tmp/";
+
+ char* tmpl = (char*)malloc(strlen(tmpDir) + 11 + suffix.length());
+ char* writePtr = tmpl;
+ memcpy(writePtr, tmpDir, strlen(tmpDir));
+ writePtr += strlen(tmpDir);
+ memcpy(writePtr, "scxmlXXXXXX", 11);
+ writePtr += 11;
+ memcpy(writePtr, suffix.c_str(), suffix.length());
+ writePtr += suffix.length();
+ tmpl[writePtr - tmpl] = 0;
+
+#ifdef _WIN32
+ _mktemp_s(tmpl, strlen(tmpl) + 1);
+ int fd = _open(tmpl, _O_CREAT, _S_IREAD | _S_IWRITE);
+#else
+ int fd = mkstemps(tmpl, suffix.length());
+#endif
+ if (fd < 0) {
+ LOG(ERROR) << "mkstemp " << tmpl << ": " << strerror(errno) << std::endl;
+ return "";
+ }
+#ifdef WIN32
+ _close(fd);
+#else
+ close(fd);
+#endif
+ return std::string(tmpl);
}
-char *url_fgets(char *ptr, size_t size, URL_FILE *file) {
- size_t want = size - 1;/* always need to leave room for zero termination */
- size_t loop;
-
- switch(file->type) {
- case CFTYPE_FILE:
- ptr = fgets(ptr,size,file->handle.file);
- break;
-
- case CFTYPE_CURL:
- fill_buffer(file,want);
-
- /* check if theres data in the buffer - if not fill either errored or
- * EOF */
- if(!file->buffer_pos)
- return NULL;
-
- /* ensure only available data is considered */
- if(file->buffer_pos < want)
- want = file->buffer_pos;
-
- /*buffer contains data */
- /* look for newline or eof */
- for(loop=0; loop < want; loop++) {
- if(file->buffer[loop] == '\n') {
- want=loop+1;/* include newline */
- break;
- }
- }
-
- /* xfer data to caller */
- memcpy(ptr, file->buffer, want);
- ptr[want]=0;/* allways null terminate */
-
- use_buffer(file,want);
-
- break;
+const bool URLImpl::toAbsolute(const std::string& baseUrl) {
+ if (_uri.is_absolute())
+ return true;
+ _uri = Arabica::io::URI(baseUrl, _uri.as_string());
+ if (!_uri.is_absolute())
+ return false;
+ return true;
+}
- default: /* unknown or supported type - oh dear */
- ptr=NULL;
- errno=EBADF;
- break;
- }
+boost::shared_ptr<URLImpl> URLImpl::toLocalFile(const std::string& content, const std::string& suffix) {
+ boost::shared_ptr<URLImpl> urlImpl = boost::shared_ptr<URLImpl>(new URLImpl());
+ urlImpl->_localFile = urlImpl->getLocalFilename(suffix);
+ urlImpl->_uri = std::string("file://") + urlImpl->_localFile;
+
+ std::ofstream file(urlImpl->_localFile.c_str(), std::ios_base::out);
+ if(file.is_open()) {
+ file << content;
+ file.close();
+ } else {
+ return boost::shared_ptr<URLImpl>();
+ }
+
+ return urlImpl;
+}
+
+const std::string URLImpl::asLocalFile(const std::string& suffix, bool reload) {
+ // this is already a local file
+ if (_uri.scheme().compare("file") == 0)
+ return _uri.path();
+
+ if (_localFile.length() > 0 && !reload)
+ return _localFile;
+
+ if (_localFile.length() > 0)
+ remove(_localFile.c_str());
+
+ _localFile = getLocalFilename(suffix);
+
+ std::ofstream file(_localFile.c_str(), std::ios_base::out);
+ if(file.is_open()) {
+ file << URL(this->shared_from_this());
+ file.close();
+ } else {
+ _localFile = "";
+ }
+
+ return _localFile;
+}
- return ptr;/*success */
+std::ostream & operator<<(std::ostream & stream, const URL& url) {
+ URL nonConstUrl = url; // this is a hack
+ stream << nonConstUrl.getInContent();
+ return stream;
}
-void url_rewind(URL_FILE *file) {
- switch(file->type) {
- case CFTYPE_FILE:
- rewind(file->handle.file); /* passthrough */
- break;
+URLFetcher::URLFetcher() {
+ _isStarted = false;
+ _multiHandle = curl_multi_init();
+ start();
+}
+
+URLFetcher::~URLFetcher() {
+ stop();
+ curl_multi_cleanup(_multiHandle);
+}
+
+void URLFetcher::fetchURL(URL& url) {
+ URLFetcher* instance = getInstance();
+ tthread::lock_guard<tthread::recursive_mutex> lock(instance->_mutex);
+
+ assert(url._impl->_handle != NULL);
+ if (url._impl->_handle == NULL)
+ return;
+
+ if (instance->_handlesToURLs.find(url._impl->_handle) == instance->_handlesToURLs.end()) {
+ CURLcode curlError;
+ CURL* handle = url._impl->_handle;
+
+ (curlError = curl_easy_setopt(handle, CURLOPT_URL, url.asString().c_str())) == CURLE_OK ||
+ LOG(ERROR) << "Cannot set url to " << url.asString() << ": " << curl_easy_strerror(curlError);
+
+ (curlError = curl_easy_setopt(handle, CURLOPT_WRITEDATA, url._impl.get())) == CURLE_OK ||
+ LOG(ERROR) << "Cannot register this as write userdata: " << curl_easy_strerror(curlError);
+
+ (curlError = curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, URLImpl::writeHandler)) == CURLE_OK ||
+ LOG(ERROR) << "Cannot set write callback: " << curl_easy_strerror(curlError);
+
+ (curlError = curl_easy_setopt(handle, CURLOPT_HEADERFUNCTION, URLImpl::headerHandler)) == CURLE_OK ||
+ LOG(ERROR) << "Cannot request header from curl: " << curl_easy_strerror(curlError);
+
+ (curlError = curl_easy_setopt(handle, CURLOPT_HEADERDATA, url._impl.get())) == CURLE_OK ||
+ LOG(ERROR) << "Cannot register this as header userdata: " << curl_easy_strerror(curlError);
+
+
+ if (boost::iequals(url._impl->_requestType, "post")) {
+
+ (curlError = curl_easy_setopt(handle, CURLOPT_POST, 1)) == CURLE_OK ||
+ LOG(ERROR) << "Cannot set request type to post for " << url.asString() << ": " << curl_easy_strerror(curlError);
+
+ (curlError = curl_easy_setopt(handle, CURLOPT_COPYPOSTFIELDS, url._impl->_outContent.c_str())) == CURLE_OK ||
+ LOG(ERROR) << "Cannot set post data " << url.asString() << ": " << curl_easy_strerror(curlError);
+
+ struct curl_slist* headers = NULL;
+ std::map<std::string, std::string>::iterator paramIter = url._impl->_outHeader.begin();
+ while(paramIter != url._impl->_outHeader.end()) {
+ char* key = curl_easy_escape(handle, paramIter->first.c_str(), paramIter->first.length());
+ char* value = curl_easy_escape(handle, paramIter->second.c_str(), paramIter->second.length());
+
+ char* header = (char*)malloc(paramIter->first.size() + strlen(value) + 3);
+ sprintf(header,"%s: %s", paramIter->first.c_str(), value);
+ headers = curl_slist_append(headers, header);
+
+ curl_free(key);
+ curl_free(value);
+ paramIter++;
+ }
+ (curlError = curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers)) == CURLE_OK ||
+ LOG(ERROR) << "Cannot headers for " << url.asString() << ": " << curl_easy_strerror(curlError);
+
+ //curl_slist_free_all(headers);
+
+
+ } else if (boost::iequals(url._impl->_requestType, "get")) {
+ (curlError = curl_easy_setopt(handle, CURLOPT_HTTPGET, 1)) == CURLE_OK ||
+ LOG(ERROR) << "Cannot set request type to get for " << url.asString() << ": " << curl_easy_strerror(curlError);
+ }
+
+ url.downloadStarted();
+ instance->_handlesToURLs[handle] = url;
+ assert(instance->_handlesToURLs.size() > 0);
+
+ curl_multi_add_handle(instance->_multiHandle, handle);
+ instance->_condVar.notify_all();
+ }
+}
- case CFTYPE_CURL:
- /* halt transaction */
- curl_multi_remove_handle(multi_handle, file->handle.curl);
+void URLFetcher::breakURL(URL& url) {
+ URLFetcher* instance = getInstance();
+ CURL* handle = url._impl->_handle;
- /* restart */
- curl_multi_add_handle(multi_handle, file->handle.curl);
+ tthread::lock_guard<tthread::recursive_mutex> lock(instance->_mutex);
+ if (instance->_handlesToURLs.find(handle) != instance->_handlesToURLs.end()) {
+ url.downloadFailed(0);
+ curl_multi_remove_handle(instance->_multiHandle, handle);
+ instance->_handlesToURLs.erase(handle);
+ }
+}
- /* ditch buffer - write will recreate - resets stream pos*/
- if(file->buffer)
- free(file->buffer);
+void URLFetcher::start() {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ if (!_isStarted) {
+ _isStarted = true;
+ _thread = new tthread::thread(URLFetcher::run, this);
+ }
+}
+
+void URLFetcher::stop() {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ if (_isStarted) {
+ _isStarted = false;
+ _thread->join();
+ delete _thread;
+ }
+}
- file->buffer=NULL;
- file->buffer_pos=0;
- file->buffer_len=0;
+void URLFetcher::run(void* instance) {
+ URLFetcher* fetcher = (URLFetcher*)instance;
+ while(fetcher->_isStarted) {
+ fetcher->perform();
+ }
+ LOG(ERROR) << "URLFetcher thread stopped!";
+}
+
+void URLFetcher::perform() {
+
+ CURLMsg *msg; /* for picking up messages with the transfer status */
+ int msgsLeft; /* how many messages are left */
+ int stillRunning;
+
+ {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ if (_handlesToURLs.empty()) {
+ std::cout << "Waiting for work" << std::endl;
+ _condVar.wait(_mutex);
+ }
+ curl_multi_perform(_multiHandle, &stillRunning);
+ }
+
+ do {
+ struct timeval timeout;
+ int rc; /* select() return code */
+
+ fd_set fdread, fdwrite, fdexcep;
+ FD_ZERO(&fdread); FD_ZERO(&fdwrite); FD_ZERO(&fdexcep);
+
+ int maxfd = -1;
+ long curlTimeOut = -1;
+
+ /* set a suitable timeout to play around with */
+ timeout.tv_sec = 1;
+ timeout.tv_usec = 0;
+
+ {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ curl_multi_timeout(_multiHandle, &curlTimeOut);
+ }
+
+ if(curlTimeOut >= 0) {
+ timeout.tv_sec = curlTimeOut / 1000;
+ if(timeout.tv_sec > 1)
+ timeout.tv_sec = 1;
+ else
+ timeout.tv_usec = (curlTimeOut % 1000) * 1000;
+ }
+
+ /* get file descriptors from the transfers */
+ {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ curl_multi_fdset(_multiHandle, &fdread, &fdwrite, &fdexcep, &maxfd);
+ }
+
+ rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+
+ switch(rc) {
+ case -1:
+ /* select error */
+ break;
+ case 0: /* timeout */
+ default: /* action */
+ {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ curl_multi_perform(_multiHandle, &stillRunning);
+ }
+ break;
+ }
+
+ {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ while ((msg = curl_multi_info_read(_multiHandle, &msgsLeft))) {
+ if (msg->msg == CURLMSG_DONE) {
+ switch (msg->data.result) {
+ case CURLM_OK:
+ _handlesToURLs[msg->easy_handle].downloadCompleted();
+ curl_multi_remove_handle(_multiHandle, msg->easy_handle);
+ _handlesToURLs.erase(msg->easy_handle);
+ break;
+ case CURLM_BAD_HANDLE:
+ case CURLM_BAD_EASY_HANDLE:
+ case CURLM_OUT_OF_MEMORY:
+ case CURLM_INTERNAL_ERROR:
+ case CURLM_BAD_SOCKET:
+ case CURLM_UNKNOWN_OPTION:
+ case CURLM_LAST:
+ _handlesToURLs[msg->easy_handle].downloadFailed(msg->data.result);
+ curl_multi_remove_handle(_multiHandle, msg->easy_handle);
+ _handlesToURLs.erase(msg->easy_handle);
+ default:
+ break;
+ }
+ } else {
+ LOG(ERROR) << "Curl reports info on unfinished download?!";
+ }
+ }
+ }
+ } while(stillRunning && _isStarted);
+}
- break;
+URLFetcher* URLFetcher::_instance = NULL;
- default: /* unknown or supported type - oh dear */
- break;
+URLFetcher* URLFetcher::getInstance() {
+ if (_instance == NULL) {
+ _instance = new URLFetcher();
}
+ return _instance;
}
} \ No newline at end of file
diff --git a/src/uscxml/URL.cpp.old b/src/uscxml/URL.cpp.old
new file mode 100644
index 0000000..20c9a18
--- /dev/null
+++ b/src/uscxml/URL.cpp.old
@@ -0,0 +1,519 @@
+#include <algorithm>
+#include <assert.h>
+#include <iostream>
+#include <fstream>
+
+#include <glog/logging.h>
+#include <boost/algorithm/string.hpp>
+
+#include <stdio.h>
+#include <string.h>
+#ifndef WIN32
+#include <sys/time.h>
+#endif
+#include <stdlib.h>
+#include <errno.h>
+
+#include "uscxml/Common.h"
+#include "URL.h"
+
+#include "uscxml/config.h"
+
+#include <stdio.h> /* defines FILENAME_MAX */
+#ifdef _WIN32
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <io.h>
+#include <direct.h>
+#define getcwd _getcwd
+#else
+#include <unistd.h>
+#endif
+
+#include <cstdlib> // mkstemp
+#ifdef HAS_UNISTD_H
+#include <unistd.h> // mkstemp legacy
+#endif
+
+namespace uscxml {
+
+URLImpl::~URLImpl() {
+ if (_localFile.length() > 0)
+ remove(_localFile.c_str());
+}
+
+const bool URLImpl::toAbsoluteCwd() {
+ char currPath[FILENAME_MAX];
+ if (!getcwd(currPath, sizeof(currPath))) {
+ return false;
+ }
+ currPath[sizeof(currPath) - 1] = '\0'; /* not really required */
+ return toAbsolute(std::string("file://" + std::string(currPath) + "/"));
+}
+
+std::string URLImpl::getLocalFilename(const std::string& suffix) {
+ if (_localFile.length() > 0)
+ return _localFile;
+
+ if (_uri.scheme().compare("file") == 0)
+ return _uri.path();
+
+ // try hard to find a temporary directory
+ const char* tmpDir = NULL;
+ if (tmpDir == NULL)
+ tmpDir = getenv("TMPDIR");
+ if (tmpDir == NULL)
+ tmpDir = getenv("TMP");
+ if (tmpDir == NULL)
+ tmpDir = getenv("TEMP");
+ if (tmpDir == NULL)
+ tmpDir = getenv("USERPROFILE");
+ if (tmpDir == NULL)
+ tmpDir = "/tmp";
+
+ char* tmpl = (char*)malloc(strlen(tmpDir) + 11 + suffix.length());
+ char* writePtr = tmpl;
+ memcpy(writePtr, tmpDir, strlen(tmpDir));
+ writePtr += strlen(tmpDir);
+ memcpy(writePtr, "scxmlXXXXXX", 11);
+ writePtr += 11;
+ memcpy(writePtr, suffix.c_str(), suffix.length());
+ writePtr += suffix.length();
+ tmpl[writePtr - tmpl] = 0;
+
+#ifdef _WIN32
+ _mktemp_s(tmpl, strlen(tmpl) + 1);
+ int fd = _open(tmpl, _O_CREAT, _S_IREAD | _S_IWRITE);
+#else
+ int fd = mkstemps(tmpl, suffix.length());
+#endif
+ if (fd < 0) {
+ LOG(ERROR) << "mkstemp " << tmpl << ": " << strerror(errno) << std::endl;
+ return "";
+ }
+#ifdef WIN32
+ _close(fd);
+#else
+ close(fd);
+#endif
+ return std::string(tmpl);
+}
+
+boost::shared_ptr<URLImpl> URLImpl::toLocalFile(const std::string& content, const std::string& suffix) {
+ boost::shared_ptr<URLImpl> urlImpl = boost::shared_ptr<URLImpl>(new URLImpl());
+ urlImpl->_localFile = urlImpl->getLocalFilename(suffix);
+ urlImpl->_uri = std::string("file://") + urlImpl->_localFile;
+
+ std::ofstream file(urlImpl->_localFile.c_str(), std::ios_base::out);
+ if(file.is_open()) {
+ file << content;
+ file.close();
+ } else {
+ return boost::shared_ptr<URLImpl>();
+ }
+
+ return urlImpl;
+}
+
+const bool URLImpl::toAbsolute(const std::string& baseUrl) {
+ if (_uri.is_absolute())
+ return true;
+ _uri = Arabica::io::URI(baseUrl, _uri.as_string());
+ if (!_uri.is_absolute())
+ return false;
+ return true;
+}
+
+const std::string URLImpl::asLocalFile(const std::string& suffix, bool reload) {
+ // this is already a local file
+ if (_uri.scheme().compare("file") == 0)
+ return _uri.path();
+
+ if (_localFile.length() > 0 && !reload)
+ return _localFile;
+
+ if (_localFile.length() > 0)
+ remove(_localFile.c_str());
+
+ _localFile = getLocalFilename(suffix);
+
+ std::ofstream file(_localFile.c_str(), std::ios_base::out);
+ if(file.is_open()) {
+ file << URL(this->shared_from_this());
+ file.close();
+ } else {
+ _localFile = "";
+ }
+
+ return _localFile;
+}
+
+std::ostream & operator<<(std::ostream & stream, const URL& url) {
+
+ std::string urlString = url.asString();
+ std::string fileURL = "file://";
+
+ // strip file:// to support relative filenames
+ if(urlString.substr(0, fileURL.size()) == fileURL) {
+ urlString = urlString.substr(fileURL.size());
+#ifdef _WIN32
+ urlString = urlString.substr(0,1) + ":" + urlString.substr(1);
+// std::replace( urlString.begin(), urlString.end(), '/', '\\');
+#endif
+ }
+// LOG(ERROR) << "Trying to open " << urlString;
+ URL_FILE *handle = url_fopen(urlString.c_str(), "r");
+
+ if(!handle) {
+ LOG(ERROR) << "Cannot open URL " << url.asString();
+ return stream;
+ }
+
+ int nread;
+ char buffer[256];
+
+ do {
+ nread = url_fread(buffer, 1,sizeof(buffer), handle);
+ stream.write(buffer, nread);
+ } while(nread);
+
+ url_fclose(handle);
+ return stream;
+}
+
+/* we use a global one for convenience */
+CURLM *multi_handle;
+
+/* curl calls this routine to get more data */
+static size_t write_callback(char *buffer,
+ size_t size,
+ size_t nitems,
+ void *userp) {
+ char *newbuff;
+ size_t rembuff;
+
+ URL_FILE *url = (URL_FILE *)userp;
+ size *= nitems;
+
+ rembuff=url->buffer_len - url->buffer_pos; /* remaining space in buffer */
+
+ if(size > rembuff) {
+ /* not enough space in buffer */
+ newbuff=(char*)realloc(url->buffer,url->buffer_len + (size - rembuff));
+ if(newbuff==NULL) {
+ fprintf(stderr,"callback buffer grow failed\n");
+ size=rembuff;
+ } else {
+ /* realloc suceeded increase buffer size*/
+ url->buffer_len+=size - rembuff;
+ url->buffer=newbuff;
+ }
+ }
+
+ memcpy(&url->buffer[url->buffer_pos], buffer, size);
+ url->buffer_pos += size;
+
+ return size;
+}
+
+/* use to attempt to fill the read buffer up to requested number of bytes */
+static int fill_buffer(URL_FILE *file, size_t want) {
+ fd_set fdread;
+ fd_set fdwrite;
+ fd_set fdexcep;
+ struct timeval timeout;
+ int rc;
+
+ /* only attempt to fill buffer if transactions still running and buffer
+ * doesnt exceed required size already
+ */
+ if((!file->still_running) || (file->buffer_pos > want))
+ return 0;
+
+ /* attempt to fill buffer */
+ do {
+ int maxfd = -1;
+ long curl_timeo = -1;
+
+ FD_ZERO(&fdread);
+ FD_ZERO(&fdwrite);
+ FD_ZERO(&fdexcep);
+
+ /* set a suitable timeout to fail on */
+ timeout.tv_sec = 60; /* 1 minute */
+ timeout.tv_usec = 0;
+
+ curl_multi_timeout(multi_handle, &curl_timeo);
+ if(curl_timeo >= 0) {
+ timeout.tv_sec = curl_timeo / 1000;
+ if(timeout.tv_sec > 1)
+ timeout.tv_sec = 1;
+ else
+ timeout.tv_usec = (curl_timeo % 1000) * 1000;
+ }
+
+ /* get file descriptors from the transfers */
+ curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
+
+ /* In a real-world program you OF COURSE check the return code of the
+ function calls. On success, the value of maxfd is guaranteed to be
+ greater or equal than -1. We call select(maxfd + 1, ...), specially
+ in case of (maxfd == -1), we call select(0, ...), which is basically
+ equal to sleep. */
+
+ rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+
+ switch(rc) {
+ case -1:
+ /* select error */
+ break;
+
+ case 0:
+ default:
+ /* timeout or readable/writable sockets */
+ curl_multi_perform(multi_handle, &file->still_running);
+ break;
+ }
+ } while(file->still_running && (file->buffer_pos < want));
+ return 1;
+}
+
+/* use to remove want bytes from the front of a files buffer */
+static int use_buffer(URL_FILE *file,int want) {
+ /* sort out buffer */
+ if((file->buffer_pos - want) <=0) {
+ /* ditch buffer - write will recreate */
+ if(file->buffer)
+ free(file->buffer);
+
+ file->buffer=NULL;
+ file->buffer_pos=0;
+ file->buffer_len=0;
+ } else {
+ /* move rest down make it available for later */
+ memmove(file->buffer,
+ &file->buffer[want],
+ (file->buffer_pos - want));
+
+ file->buffer_pos -= want;
+ }
+ return 0;
+}
+
+URL_FILE *url_fopen(const char *url,const char *operation) {
+ /* this code could check for URLs or types in the 'url' and
+ basicly use the real fopen() for standard files */
+
+ URL_FILE *file;
+ (void)operation;
+
+ file = (URL_FILE*)malloc(sizeof(URL_FILE));
+ if(!file)
+ return NULL;
+
+ memset(file, 0, sizeof(URL_FILE));
+
+ if((file->handle.file=fopen(url,operation)))
+ file->type = CFTYPE_FILE; /* marked as URL */
+
+ else {
+ file->type = CFTYPE_CURL; /* marked as URL */
+ file->handle.curl = curl_easy_init();
+
+ curl_easy_setopt(file->handle.curl, CURLOPT_URL, url);
+ curl_easy_setopt(file->handle.curl, CURLOPT_WRITEDATA, file);
+ curl_easy_setopt(file->handle.curl, CURLOPT_VERBOSE, 0L);
+ curl_easy_setopt(file->handle.curl, CURLOPT_WRITEFUNCTION, write_callback);
+
+ if(!multi_handle)
+ multi_handle = curl_multi_init();
+
+ curl_multi_add_handle(multi_handle, file->handle.curl);
+
+ /* lets start the fetch */
+ curl_multi_perform(multi_handle, &file->still_running);
+
+ if((file->buffer_pos == 0) && (!file->still_running)) {
+ /* if still_running is 0 now, we should return NULL */
+
+ /* make sure the easy handle is not in the multi handle anymore */
+ curl_multi_remove_handle(multi_handle, file->handle.curl);
+
+ /* cleanup */
+ curl_easy_cleanup(file->handle.curl);
+
+ free(file);
+
+ file = NULL;
+ }
+ }
+ return file;
+}
+
+int url_fclose(URL_FILE *file) {
+ int ret=0;/* default is good return */
+
+ switch(file->type) {
+ case CFTYPE_FILE:
+ ret=fclose(file->handle.file); /* passthrough */
+ break;
+
+ case CFTYPE_CURL:
+ /* make sure the easy handle is not in the multi handle anymore */
+ curl_multi_remove_handle(multi_handle, file->handle.curl);
+
+ /* cleanup */
+ curl_easy_cleanup(file->handle.curl);
+ break;
+
+ default: /* unknown or supported type - oh dear */
+ ret=EOF;
+ errno=EBADF;
+ break;
+ }
+
+ if(file->buffer)
+ free(file->buffer);/* free any allocated buffer space */
+
+ free(file);
+
+ return ret;
+}
+
+int url_feof(URL_FILE *file) {
+ int ret=0;
+
+ switch(file->type) {
+ case CFTYPE_FILE:
+ ret=feof(file->handle.file);
+ break;
+
+ case CFTYPE_CURL:
+ if((file->buffer_pos == 0) && (!file->still_running))
+ ret = 1;
+ break;
+
+ default: /* unknown or supported type - oh dear */
+ ret=-1;
+ errno=EBADF;
+ break;
+ }
+ return ret;
+}
+
+size_t url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file) {
+ size_t want;
+
+ switch(file->type) {
+ case CFTYPE_FILE:
+ want=fread(ptr,size,nmemb,file->handle.file);
+ break;
+
+ case CFTYPE_CURL:
+ want = nmemb * size;
+
+ fill_buffer(file,want);
+
+ /* check if theres data in the buffer - if not fill_buffer()
+ * either errored or EOF */
+ if(!file->buffer_pos)
+ return 0;
+
+ /* ensure only available data is considered */
+ if(file->buffer_pos < want)
+ want = file->buffer_pos;
+
+ /* xfer data to caller */
+ memcpy(ptr, file->buffer, want);
+
+ use_buffer(file,want);
+
+ want = want / size; /* number of items */
+ break;
+
+ default: /* unknown or supported type - oh dear */
+ want=0;
+ errno=EBADF;
+ break;
+
+ }
+ return want;
+}
+
+char *url_fgets(char *ptr, size_t size, URL_FILE *file) {
+ size_t want = size - 1;/* always need to leave room for zero termination */
+ size_t loop;
+
+ switch(file->type) {
+ case CFTYPE_FILE:
+ ptr = fgets(ptr,size,file->handle.file);
+ break;
+
+ case CFTYPE_CURL:
+ fill_buffer(file,want);
+
+ /* check if theres data in the buffer - if not fill either errored or
+ * EOF */
+ if(!file->buffer_pos)
+ return NULL;
+
+ /* ensure only available data is considered */
+ if(file->buffer_pos < want)
+ want = file->buffer_pos;
+
+ /*buffer contains data */
+ /* look for newline or eof */
+ for(loop=0; loop < want; loop++) {
+ if(file->buffer[loop] == '\n') {
+ want=loop+1;/* include newline */
+ break;
+ }
+ }
+
+ /* xfer data to caller */
+ memcpy(ptr, file->buffer, want);
+ ptr[want]=0;/* allways null terminate */
+
+ use_buffer(file,want);
+
+ break;
+
+ default: /* unknown or supported type - oh dear */
+ ptr=NULL;
+ errno=EBADF;
+ break;
+ }
+
+ return ptr;/*success */
+}
+
+void url_rewind(URL_FILE *file) {
+ switch(file->type) {
+ case CFTYPE_FILE:
+ rewind(file->handle.file); /* passthrough */
+ break;
+
+ case CFTYPE_CURL:
+ /* halt transaction */
+ curl_multi_remove_handle(multi_handle, file->handle.curl);
+
+ /* restart */
+ curl_multi_add_handle(multi_handle, file->handle.curl);
+
+ /* ditch buffer - write will recreate - resets stream pos*/
+ if(file->buffer)
+ free(file->buffer);
+
+ file->buffer=NULL;
+ file->buffer_pos=0;
+ file->buffer_len=0;
+
+ break;
+
+ default: /* unknown or supported type - oh dear */
+ break;
+ }
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/URL.h b/src/uscxml/URL.h
index 9ff24c5..0858626 100644
--- a/src/uscxml/URL.h
+++ b/src/uscxml/URL.h
@@ -1,77 +1,106 @@
-#ifndef URL_H_27HPRH76
-#define URL_H_27HPRH76
+#ifndef URL_H_9DAEGSMV
+#define URL_H_9DAEGSMV
+#include <curl/curl.h>
#include <string>
+#include <iostream>
#include <sstream>
-#include <curl/curl.h>
+#include <map>
+#include <set>
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+
+#include "uscxml/concurrency/tinythread.h"
// use arabica URL parser
#include <io/uri.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/enable_shared_from_this.hpp>
-
namespace uscxml {
+class URL;
+
+class URLMonitor {
+public:
+ virtual void downloadStarted(const URL& url) {};
+ virtual void downloadCompleted(const URL& url) {};
+ virtual void downloadFailed(const URL& url, int errorCode) {};
+ virtual void headerChunkReceived(const URL& url, const std::string& headerChunk) {};
+ virtual void contentChunkReceived(const URL& url, const std::string& contentChunk) {};
+};
+
class URLImpl : public boost::enable_shared_from_this<URLImpl> {
public:
- URLImpl() {}
- URLImpl(const std::string uri) : _uri(uri) {}
- virtual ~URLImpl();
- const bool toAbsoluteCwd();
+ URLImpl(const std::string& url);
+ ~URLImpl();
+ static boost::shared_ptr<URLImpl> toLocalFile(const std::string& content, const std::string& suffix);
+
+ static size_t writeHandler(void *ptr, size_t size, size_t nmemb, void *userdata);
+ static size_t headerHandler(void *ptr, size_t size, size_t nmemb, void *userdata);
+
+ void addMonitor(URLMonitor* monitor) { _monitors.insert(monitor); }
+ void removeMonitor(URLMonitor* monitor) { _monitors.erase(monitor); }
+
+ const bool isAbsolute() const { return _uri.is_absolute(); }
+ const std::string scheme() const { return _uri.scheme(); }
+ const std::string host() const { return _uri.host(); }
+ const std::string port() const { return _uri.port(); }
+ const std::string path() const { return _uri.path(); }
+ const std::string asString() const { return _uri.as_string(); }
+
+ const bool toAbsoluteCwd();
const bool toAbsolute(const std::string& baseUrl);
const std::string asLocalFile(const std::string& suffix, bool reload = false);
- static boost::shared_ptr<URLImpl> toLocalFile(const std::string& content, const std::string& suffix);
+ void addOutHeader(const std::string& key, const std::string& value) { _outHeader[key] = value; }
+ void setOutContent(const std::string& content);
+ void setRequestType(const std::string& requestType);
+
+ const std::map<std::string, std::string> getInHeaderFields();
+ const std::string getInContent(bool forceReload = false);
+ const void download(bool blocking = false);
+
+ void downloadStarted();
+ void downloadCompleted();
+ void downloadFailed(int errorCode);
- const bool isAbsolute() const {
- return _uri.is_absolute();
- }
- const std::string scheme() const {
- return _uri.scheme();
- }
- const std::string host() const {
- return _uri.host();
- }
- const std::string port() const {
- return _uri.port();
- }
- const std::string path() const {
- return _uri.path();
- }
- const std::string asString() const {
- return _uri.as_string();
- }
+ friend class URLFetcher;
-private:
+protected:
+ URLImpl() : _handle(NULL), _isDownloaded(false), _hasFailed(false) {}
std::string getLocalFilename(const std::string& suffix);
- Arabica::io::URI _uri;
- std::string _localFile;
+ std::string _outContent;
+ std::map<std::string, std::string> _outHeader;
+ std::string _requestType;
+
+ CURL* _handle;
+ std::stringstream _inContent;
+ std::stringstream _inHeader;
+
+ Arabica::io::URI _uri;
+ bool _isDownloaded;
+ bool _hasFailed;
+
+ std::string _localFile;
+
+ tthread::condition_variable _condVar;
+ tthread::recursive_mutex _mutex;
+
+ std::set<URLMonitor*> _monitors;
+ typedef std::set<URLMonitor*>::iterator monIter_t;
};
class URL {
-public:
+public:
URL() : _impl() {}
- URL(const std::string uri) : _impl(new URLImpl(uri)) {}
+ URL(const std::string url) : _impl(new URLImpl(url)) {}
URL(boost::shared_ptr<URLImpl> const impl) : _impl(impl) { }
URL(const URL& other) : _impl(other._impl) { }
virtual ~URL() {};
-
- static URL toLocalFile(const std::string& content, const std::string& suffix) {
- boost::shared_ptr<URLImpl> impl = URLImpl::toLocalFile(content, suffix);
- return URL(impl);
- }
-
- operator bool() const {
- return _impl;
- }
- bool operator< (const URL& other) const {
- return _impl < other._impl;
- }
- bool operator==(const URL& other) const {
- return _impl == other._impl;
- }
+
+ operator bool() const { return _impl; }
+ bool operator< (const URL& other) const { return _impl < other._impl; }
+ bool operator==(const URL& other) const { return _impl == other._impl; }
bool operator!=(const URL& other) const {
return _impl != other._impl;
}
@@ -80,75 +109,72 @@ public:
return *this;
}
- const bool toAbsoluteCwd() {
- return _impl->toAbsoluteCwd();
- }
- const bool toAbsolute(const std::string& baseUrl) {
- return _impl->toAbsolute(baseUrl);
- }
- const bool toAbsolute(const URL& baseUrl) {
- return _impl->toAbsolute(baseUrl.asString());
- }
- const std::string asLocalFile(const std::string& suffix, bool reload = false) {
- return _impl->asLocalFile(suffix, reload);
- }
-
- const bool isAbsolute() const {
- return _impl->isAbsolute();
- }
- const std::string scheme() const {
- return _impl->scheme();
- }
- const std::string host() const {
- return _impl->host();
- }
- const std::string port() const {
- return _impl->port();
- }
- const std::string path() const {
- return _impl->path();
- }
- const std::string asString() const {
- return _impl->asString();
- }
-
+ const std::map<std::string, std::string> getInHeaderFields() const { return _impl->getInHeaderFields(); }
+ const std::string getInContent() const { return _impl->getInContent(); }
+ const void download(bool blocking = false) const { return _impl->download(blocking); }
+
+ void addOutHeader(const std::string& key, const std::string& value) { _impl->addOutHeader(key, value); }
+ void setRequestType(const std::string& requestType) { _impl->setRequestType(requestType); }
+ void setOutContent(const std::string& content) { _impl->setOutContent(content); }
+
+ const bool toAbsoluteCwd() { return _impl->toAbsoluteCwd(); }
+ const bool toAbsolute(const std::string& baseUrl) { return _impl->toAbsolute(baseUrl); }
+ const bool toAbsolute(const URL& baseUrl) { return _impl->toAbsolute(baseUrl.asString()); }
+ const std::string asLocalFile(const std::string& suffix, bool reload = false) { return _impl->asLocalFile(suffix, reload); }
+
+ static URL toLocalFile(const std::string& content, const std::string& suffix) {
+ boost::shared_ptr<URLImpl> impl = URLImpl::toLocalFile(content, suffix);
+ return URL(impl);
+ }
+
+ void addMonitor(URLMonitor* monitor) { _impl->addMonitor(monitor); }
+ void removeMonitor(URLMonitor* monitor) { _impl->removeMonitor(monitor); }
+
+ const bool isAbsolute() const { return _impl->isAbsolute(); }
+ const std::string scheme() const { return _impl->scheme(); }
+ const std::string host() const { return _impl->host(); }
+ const std::string port() const { return _impl->port(); }
+ const std::string path() const { return _impl->path(); }
+ const std::string asString() const { return _impl->asString(); }
+
+ friend class URLFetcher;
friend std::ostream & operator<<(std::ostream &stream, const URL& p);
protected:
- boost::shared_ptr<URLImpl> _impl;
-};
-
-enum fcurl_type_e {
- CFTYPE_NONE=0,
- CFTYPE_FILE=1,
- CFTYPE_CURL=2
-};
+ void downloadStarted() { return _impl->downloadStarted(); }
+ void downloadCompleted() { return _impl->downloadCompleted(); }
+ void downloadFailed(int errorCode) { return _impl->downloadFailed(errorCode); }
-struct fcurl_data {
- enum fcurl_type_e type; /* type of handle */
- union {
- CURL *curl;
- FILE *file;
- } handle; /* handle */
-
- char *buffer; /* buffer to store cached data*/
- size_t buffer_len; /* currently allocated buffers length */
- size_t buffer_pos; /* end of data in buffer*/
- int still_running; /* Is background url fetch still in progress */
+ boost::shared_ptr<URLImpl> _impl;
};
-typedef struct fcurl_data URL_FILE;
+class URLFetcher {
+public:
+ URLFetcher();
+ ~URLFetcher();
+
+ static void fetchURL(URL& url);
+ static void breakURL(URL& url);
-URL_FILE *url_fopen(const char *url,const char *operation);
-int url_fclose(URL_FILE *file);
-int url_feof(URL_FILE *file);
-size_t url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file);
-char * url_fgets(char *ptr, size_t size, URL_FILE *file);
-void url_rewind(URL_FILE *file);
+ void start();
+ void stop();
-std::ostream & operator<<(std::ostream &stream, const URL& url);
+protected:
+ static URLFetcher* _instance;
+ static URLFetcher* getInstance();
+
+ static void run(void* instance);
+ void perform();
+
+ tthread::thread* _thread;
+ tthread::condition_variable _condVar;
+ tthread::recursive_mutex _mutex;
+ bool _isStarted;
+
+ std::map<CURL*, URL> _handlesToURLs;
+ CURLM* _multiHandle;
+};
}
-
-#endif /* end of include guard: URL_H_27HPRH76 */
+#endif /* end of include guard: URL_H_9DAEGSMV */
diff --git a/src/uscxml/URL.h.old b/src/uscxml/URL.h.old
new file mode 100644
index 0000000..9ff24c5
--- /dev/null
+++ b/src/uscxml/URL.h.old
@@ -0,0 +1,154 @@
+#ifndef URL_H_27HPRH76
+#define URL_H_27HPRH76
+
+#include <string>
+#include <sstream>
+#include <curl/curl.h>
+
+// use arabica URL parser
+#include <io/uri.hpp>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+
+namespace uscxml {
+
+class URLImpl : public boost::enable_shared_from_this<URLImpl> {
+public:
+ URLImpl() {}
+ URLImpl(const std::string uri) : _uri(uri) {}
+ virtual ~URLImpl();
+ const bool toAbsoluteCwd();
+ const bool toAbsolute(const std::string& baseUrl);
+ const std::string asLocalFile(const std::string& suffix, bool reload = false);
+
+ static boost::shared_ptr<URLImpl> toLocalFile(const std::string& content, const std::string& suffix);
+
+ const bool isAbsolute() const {
+ return _uri.is_absolute();
+ }
+ const std::string scheme() const {
+ return _uri.scheme();
+ }
+ const std::string host() const {
+ return _uri.host();
+ }
+ const std::string port() const {
+ return _uri.port();
+ }
+ const std::string path() const {
+ return _uri.path();
+ }
+ const std::string asString() const {
+ return _uri.as_string();
+ }
+
+private:
+ std::string getLocalFilename(const std::string& suffix);
+
+ Arabica::io::URI _uri;
+ std::string _localFile;
+};
+
+class URL {
+public:
+ URL() : _impl() {}
+ URL(const std::string uri) : _impl(new URLImpl(uri)) {}
+ URL(boost::shared_ptr<URLImpl> const impl) : _impl(impl) { }
+ URL(const URL& other) : _impl(other._impl) { }
+ virtual ~URL() {};
+
+ static URL toLocalFile(const std::string& content, const std::string& suffix) {
+ boost::shared_ptr<URLImpl> impl = URLImpl::toLocalFile(content, suffix);
+ return URL(impl);
+ }
+
+ operator bool() const {
+ return _impl;
+ }
+ bool operator< (const URL& other) const {
+ return _impl < other._impl;
+ }
+ bool operator==(const URL& other) const {
+ return _impl == other._impl;
+ }
+ bool operator!=(const URL& other) const {
+ return _impl != other._impl;
+ }
+ URL& operator= (const URL& other) {
+ _impl = other._impl;
+ return *this;
+ }
+
+ const bool toAbsoluteCwd() {
+ return _impl->toAbsoluteCwd();
+ }
+ const bool toAbsolute(const std::string& baseUrl) {
+ return _impl->toAbsolute(baseUrl);
+ }
+ const bool toAbsolute(const URL& baseUrl) {
+ return _impl->toAbsolute(baseUrl.asString());
+ }
+ const std::string asLocalFile(const std::string& suffix, bool reload = false) {
+ return _impl->asLocalFile(suffix, reload);
+ }
+
+ const bool isAbsolute() const {
+ return _impl->isAbsolute();
+ }
+ const std::string scheme() const {
+ return _impl->scheme();
+ }
+ const std::string host() const {
+ return _impl->host();
+ }
+ const std::string port() const {
+ return _impl->port();
+ }
+ const std::string path() const {
+ return _impl->path();
+ }
+ const std::string asString() const {
+ return _impl->asString();
+ }
+
+ friend std::ostream & operator<<(std::ostream &stream, const URL& p);
+
+protected:
+ boost::shared_ptr<URLImpl> _impl;
+};
+
+enum fcurl_type_e {
+ CFTYPE_NONE=0,
+ CFTYPE_FILE=1,
+ CFTYPE_CURL=2
+};
+
+struct fcurl_data {
+ enum fcurl_type_e type; /* type of handle */
+ union {
+ CURL *curl;
+ FILE *file;
+ } handle; /* handle */
+
+ char *buffer; /* buffer to store cached data*/
+ size_t buffer_len; /* currently allocated buffers length */
+ size_t buffer_pos; /* end of data in buffer*/
+ int still_running; /* Is background url fetch still in progress */
+};
+
+typedef struct fcurl_data URL_FILE;
+
+URL_FILE *url_fopen(const char *url,const char *operation);
+int url_fclose(URL_FILE *file);
+int url_feof(URL_FILE *file);
+size_t url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file);
+char * url_fgets(char *ptr, size_t size, URL_FILE *file);
+void url_rewind(URL_FILE *file);
+
+std::ostream & operator<<(std::ostream &stream, const URL& url);
+
+}
+
+
+#endif /* end of include guard: URL_H_27HPRH76 */
diff --git a/src/uscxml/concurrency/eventqueue/DelayedEventQueue.cpp b/src/uscxml/concurrency/eventqueue/DelayedEventQueue.cpp
index 4390927..e0b5a8d 100644
--- a/src/uscxml/concurrency/eventqueue/DelayedEventQueue.cpp
+++ b/src/uscxml/concurrency/eventqueue/DelayedEventQueue.cpp
@@ -17,7 +17,7 @@ DelayedEventQueue::DelayedEventQueue() {
DelayedEventQueue::~DelayedEventQueue() {
// std::cout << "Deleting DelayedEventQueue" << std::endl;
stop();
- if (_thread)
+ if (_thread && _isStarted)
_thread->join();
if(_eventLoop)
event_base_free(_eventLoop);
@@ -66,6 +66,7 @@ void DelayedEventQueue::cancelEvent(std::string eventId) {
void DelayedEventQueue::start() {
_isStarted = true;
_thread = new tthread::thread(DelayedEventQueue::run, this);
+ _isStarted = false;
}
void DelayedEventQueue::stop() {
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
index d8a3c8d..c190e3b 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
@@ -105,21 +105,21 @@ void V8DataModel::initialize() {
}
void V8DataModel::setEvent(const Event& event) {
- _event = event;
v8::Locker locker;
v8::HandleScope handleScope;
v8::Context::Scope contextScope(_contexts.front());
v8::Handle<v8::Object> global = _contexts.front()->Global();
v8::Handle<v8::Function> eventCtor = Arabica::DOM::V8SCXMLEvent::getTmpl()->GetFunction();
- v8::Handle<v8::Object> eventObj = eventCtor->NewInstance();
+ v8::Persistent<v8::Object> eventObj = v8::Persistent<v8::Object>::New(eventCtor->NewInstance());
Arabica::DOM::V8SCXMLEvent::V8SCXMLEventPrivate* privData = new Arabica::DOM::V8SCXMLEvent::V8SCXMLEventPrivate();
- privData->nativeObj = &_event;
+ privData->nativeObj = new Event(event);
privData->dom = _dom;
eventObj->SetInternalField(0, Arabica::DOM::V8DOM::toExternal(privData));
+ eventObj.MakeWeak(0, Arabica::DOM::V8SCXMLEvent::jsDestructor);
- eventObj->Set(v8::String::New("data"), getDataAsValue(event)); // set data part of _event
+ eventObj->Set(v8::String::New("data"), getDataAsValue(event.data)); // set data part of _event
global->Set(v8::String::New("_event"), eventObj);
}
@@ -312,20 +312,20 @@ v8::Handle<v8::Value> V8DataModel::evalAsValue(const std::string& expr) {
exceptionEvent.name = "error.execution";
std::string exceptionString(*v8::String::AsciiValue(tryCatch.Exception()));
- exceptionEvent.compound["exception"] = Data(exceptionString, Data::VERBATIM);;
+ exceptionEvent.data.compound["exception"] = Data(exceptionString, Data::VERBATIM);;
v8::Handle<v8::Message> message = tryCatch.Message();
if (!message.IsEmpty()) {
std::string filename(*v8::String::AsciiValue(message->GetScriptResourceName()));
- exceptionEvent.compound["filename"] = Data(filename, Data::VERBATIM);
+ exceptionEvent.data.compound["filename"] = Data(filename, Data::VERBATIM);
std::string sourceLine(*v8::String::AsciiValue(message->GetSourceLine()));
- exceptionEvent.compound["sourceline"] = Data(sourceLine, Data::VERBATIM);
+ exceptionEvent.data.compound["sourceline"] = Data(sourceLine, Data::VERBATIM);
std::stringstream ssLineNumber;
int lineNumber = message->GetLineNumber();
ssLineNumber << lineNumber;
- exceptionEvent.compound["linenumber"] = Data(ssLineNumber.str());
+ exceptionEvent.data.compound["linenumber"] = Data(ssLineNumber.str());
int startColumn = message->GetStartColumn();
int endColumn = message->GetEndColumn();
@@ -334,10 +334,10 @@ v8::Handle<v8::Value> V8DataModel::evalAsValue(const std::string& expr) {
ssUnderline << " ";
for (int i = startColumn; i < endColumn; i++)
ssUnderline << "^";
- exceptionEvent.compound["sourcemark"] = Data(ssUnderline.str(), Data::VERBATIM);
+ exceptionEvent.data.compound["sourcemark"] = Data(ssUnderline.str(), Data::VERBATIM);
std::string stackTrace(*v8::String::AsciiValue(tryCatch.StackTrace()));
- exceptionEvent.compound["stacktrace"] = Data(stackTrace, Data::VERBATIM);
+ exceptionEvent.data.compound["stacktrace"] = Data(stackTrace, Data::VERBATIM);
}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h
index b99392f..18e1ea4 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h
@@ -59,7 +59,6 @@ public:
protected:
std::list<v8::Persistent<v8::Context> > _contexts;
- Event _event;
Arabica::DOM::V8DOM* _dom;
v8::Handle<v8::Value> evalAsValue(const std::string& expr);
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp
index bee6042..d16f81b 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp
@@ -5,59 +5,59 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8Attr::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8Attr::Tmpl;
-v8::Handle<v8::Value> V8Attr::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Attr::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getName().c_str());
-}
+ return v8::String::New(privData->nativeObj->getName().c_str());
+ }
-v8::Handle<v8::Value> V8Attr::specifiedAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Attr::specifiedAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
- return v8::Boolean::New(privData->nativeObj->getSpecified());
-}
+ return v8::Boolean::New(privData->nativeObj->getSpecified());
+ }
-v8::Handle<v8::Value> V8Attr::valueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Attr::valueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getValue().c_str());
-}
+ return v8::String::New(privData->nativeObj->getValue().c_str());
+ }
-void V8Attr::valueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localValue(value);
- privData->nativeObj->setValue(*localValue);
-}
+ void V8Attr::valueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localValue(value);
+ privData->nativeObj->setValue(*localValue);
+ }
-v8::Handle<v8::Value> V8Attr::ownerElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Attr::ownerElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
- if (!privData->nativeObj->getOwnerElement()) return v8::Undefined();
- Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->nativeObj->getOwnerElement());
+ if (!privData->nativeObj->getOwnerElement()) return v8::Undefined();
+ Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->nativeObj->getOwnerElement());
- v8::Handle<v8::Function> arbaicaRetCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Element::jsDestructor);
+ return arbaicaRetObj;
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Element::jsDestructor);
- return arbaicaRetObj;
+ }
+ bool V8Attr::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-bool V8Attr::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h
index e290415..e317698 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h
@@ -21,8 +21,10 @@
#ifndef V8Attr_h
#define V8Attr_h
+#include <string>
#include "DOM/Node.hpp"
#include "V8Node.h"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -31,48 +33,50 @@ namespace DOM {
class V8Attr {
public:
- struct V8AttrPrivate {
- V8DOM* dom;
- Arabica::DOM::Attr<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8AttrPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
-
- static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> specifiedAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> valueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static void valueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> ownerElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Attr"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("name"), V8Attr::nameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("specified"), V8Attr::specifiedAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("value"), V8Attr::valueAttrGetter, V8Attr::valueAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("ownerElement"), V8Attr::ownerElementAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8AttrPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Attr<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8AttrPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+ static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> specifiedAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> valueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void valueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> ownerElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Attr"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("name"), V8Attr::nameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("specified"), V8Attr::specifiedAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("value"), V8Attr::valueAttrGetter, V8Attr::valueAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("ownerElement"), V8Attr::ownerElementAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp
index a9e5ac9..90495f4 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp
@@ -4,11 +4,11 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8CDATASection::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8CDATASection::Tmpl;
-bool V8CDATASection::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8CDATASection::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h
index a0b5ced..f9767a0 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h
@@ -21,8 +21,10 @@
#ifndef V8CDATASection_h
#define V8CDATASection_h
+#include <string>
#include "DOM/Node.hpp"
#include "V8Text.h"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -31,35 +33,37 @@ namespace DOM {
class V8CDATASection {
public:
- struct V8CDATASectionPrivate {
- V8DOM* dom;
- Arabica::DOM::CDATASection<std::string>* nativeObj;
- };
+ struct V8CDATASectionPrivate {
+ V8DOM* dom;
+ Arabica::DOM::CDATASection<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8CDATASectionPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8CDATASectionPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("CDATASection"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("CDATASection"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
- tmpl->Inherit(V8Text::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ tmpl->Inherit(V8Text::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp
index 459cf96..74c80ea 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp
@@ -4,102 +4,102 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8CharacterData::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8CharacterData::Tmpl;
-v8::Handle<v8::Value> V8CharacterData::dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8CharacterData::dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getData().c_str());
-}
+ return v8::String::New(privData->nativeObj->getData().c_str());
+ }
-void V8CharacterData::dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localData(value);
- privData->nativeObj->setData(*localData);
-}
+ void V8CharacterData::dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(value);
+ privData->nativeObj->setData(*localData);
+ }
-v8::Handle<v8::Value> V8CharacterData::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8CharacterData::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- return v8::Integer::New(privData->nativeObj->getLength());
-}
-v8::Handle<v8::Value> V8CharacterData::substringDataCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in substringData");
+ return v8::Integer::New(privData->nativeObj->getLength());
+ }
+ v8::Handle<v8::Value> V8CharacterData::substringDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in substringData");
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
- unsigned long localCount = args[1]->ToNumber()->Uint32Value();
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ unsigned long localCount = args[1]->ToNumber()->Uint32Value();
- std::string retVal = privData->nativeObj->substringData(localOffset, localCount);
+ std::string retVal = privData->nativeObj->substringData(localOffset, localCount);
- return v8::String::New(retVal.c_str());
-}
+ return v8::String::New(retVal.c_str());
+ }
-v8::Handle<v8::Value> V8CharacterData::appendDataCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in appendData");
+ v8::Handle<v8::Value> V8CharacterData::appendDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in appendData");
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localArg(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localArg(args[0]);
- privData->nativeObj->appendData(*localArg);
+ privData->nativeObj->appendData(*localArg);
- return v8::Undefined();
-}
+ return v8::Undefined();
+ }
-v8::Handle<v8::Value> V8CharacterData::insertDataCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in insertData");
+ v8::Handle<v8::Value> V8CharacterData::insertDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in insertData");
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
- v8::String::AsciiValue localArg(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ v8::String::AsciiValue localArg(args[1]);
- privData->nativeObj->insertData(localOffset, *localArg);
+ privData->nativeObj->insertData(localOffset, *localArg);
- return v8::Undefined();
-}
+ return v8::Undefined();
+ }
-v8::Handle<v8::Value> V8CharacterData::deleteDataCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in deleteData");
+ v8::Handle<v8::Value> V8CharacterData::deleteDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in deleteData");
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
- unsigned long localCount = args[1]->ToNumber()->Uint32Value();
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ unsigned long localCount = args[1]->ToNumber()->Uint32Value();
- privData->nativeObj->deleteData(localOffset, localCount);
+ privData->nativeObj->deleteData(localOffset, localCount);
- return v8::Undefined();
-}
+ return v8::Undefined();
+ }
-v8::Handle<v8::Value> V8CharacterData::replaceDataCallback(const v8::Arguments& args) {
- if (args.Length() < 3)
- throw V8Exception("Wrong number of arguments in replaceData");
+ v8::Handle<v8::Value> V8CharacterData::replaceDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 3)
+ throw V8Exception("Wrong number of arguments in replaceData");
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
- unsigned long localCount = args[1]->ToNumber()->Uint32Value();
- v8::String::AsciiValue localArg(args[2]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ unsigned long localCount = args[1]->ToNumber()->Uint32Value();
+ v8::String::AsciiValue localArg(args[2]);
- privData->nativeObj->replaceData(localOffset, localCount, *localArg);
+ privData->nativeObj->replaceData(localOffset, localCount, *localArg);
- return v8::Undefined();
-}
+ return v8::Undefined();
+ }
-bool V8CharacterData::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8CharacterData::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h
index a86519b..fe93896 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h
@@ -21,8 +21,10 @@
#ifndef V8CharacterData_h
#define V8CharacterData_h
+#include <string>
#include "DOM/Node.hpp"
#include "V8Node.h"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -31,57 +33,59 @@ namespace DOM {
class V8CharacterData {
public:
- struct V8CharacterDataPrivate {
- V8DOM* dom;
- Arabica::DOM::CharacterData<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8CharacterDataPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> substringDataCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> appendDataCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> insertDataCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> deleteDataCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> replaceDataCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static void dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("CharacterData"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("data"), V8CharacterData::dataAttrGetter, V8CharacterData::dataAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("length"), V8CharacterData::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("substringData"),
- v8::FunctionTemplate::New(V8CharacterData::substringDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("appendData"),
- v8::FunctionTemplate::New(V8CharacterData::appendDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("insertData"),
- v8::FunctionTemplate::New(V8CharacterData::insertDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("deleteData"),
- v8::FunctionTemplate::New(V8CharacterData::deleteDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("replaceData"),
- v8::FunctionTemplate::New(V8CharacterData::replaceDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8CharacterDataPrivate {
+ V8DOM* dom;
+ Arabica::DOM::CharacterData<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8CharacterDataPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> substringDataCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> appendDataCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> insertDataCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> deleteDataCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> replaceDataCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("CharacterData"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("data"), V8CharacterData::dataAttrGetter, V8CharacterData::dataAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("length"), V8CharacterData::lengthAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("substringData"),
+ v8::FunctionTemplate::New(V8CharacterData::substringDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("appendData"),
+ v8::FunctionTemplate::New(V8CharacterData::appendDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("insertData"),
+ v8::FunctionTemplate::New(V8CharacterData::insertDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("deleteData"),
+ v8::FunctionTemplate::New(V8CharacterData::deleteDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("replaceData"),
+ v8::FunctionTemplate::New(V8CharacterData::replaceDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp
index f754ea7..e470a70 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp
@@ -4,11 +4,11 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8Comment::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8Comment::Tmpl;
-bool V8Comment::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8Comment::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h
index b07bf19..c659150 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h
@@ -21,8 +21,10 @@
#ifndef V8Comment_h
#define V8Comment_h
+#include <string>
#include "DOM/Node.hpp"
#include "V8CharacterData.h"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -31,35 +33,37 @@ namespace DOM {
class V8Comment {
public:
- struct V8CommentPrivate {
- V8DOM* dom;
- Arabica::DOM::Comment<std::string>* nativeObj;
- };
+ struct V8CommentPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Comment<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8CommentPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8CommentPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Comment"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Comment"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
- tmpl->Inherit(V8CharacterData::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ tmpl->Inherit(V8CharacterData::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp
index f7a7575..0f81958 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp
@@ -5,77 +5,77 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8DOMImplementation::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8DOMImplementation::Tmpl;
-v8::Handle<v8::Value> V8DOMImplementation::hasFeatureCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in hasFeature");
+ v8::Handle<v8::Value> V8DOMImplementation::hasFeatureCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in hasFeature");
- v8::Local<v8::Object> self = args.Holder();
- struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localFeature(args[0]);
- v8::String::AsciiValue localVersion(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localFeature(args[0]);
+ v8::String::AsciiValue localVersion(args[1]);
- bool retVal = privData->nativeObj->hasFeature(*localFeature, *localVersion);
+ bool retVal = privData->nativeObj->hasFeature(*localFeature, *localVersion);
- return v8::Boolean::New(retVal);
-}
+ return v8::Boolean::New(retVal);
+ }
-v8::Handle<v8::Value> V8DOMImplementation::createDocumentTypeCallback(const v8::Arguments& args) {
- if (args.Length() < 3)
- throw V8Exception("Wrong number of arguments in createDocumentType");
+ v8::Handle<v8::Value> V8DOMImplementation::createDocumentTypeCallback(const v8::Arguments& args) {
+ if (args.Length() < 3)
+ throw V8Exception("Wrong number of arguments in createDocumentType");
- v8::Local<v8::Object> self = args.Holder();
- struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localQualifiedName(args[0]);
- v8::String::AsciiValue localPublicId(args[1]);
- v8::String::AsciiValue localSystemId(args[2]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localQualifiedName(args[0]);
+ v8::String::AsciiValue localPublicId(args[1]);
+ v8::String::AsciiValue localSystemId(args[2]);
- Arabica::DOM::DocumentType<std::string>* retVal = new Arabica::DOM::DocumentType<std::string>(privData->nativeObj->createDocumentType(*localQualifiedName, *localPublicId, *localSystemId));
- v8::Handle<v8::Function> retCtor = V8DocumentType::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::DocumentType<std::string>* retVal = new Arabica::DOM::DocumentType<std::string>(privData->nativeObj->createDocumentType(*localQualifiedName, *localPublicId, *localSystemId));
+ v8::Handle<v8::Function> retCtor = V8DocumentType::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8DocumentType::V8DocumentTypePrivate* retPrivData = new V8DocumentType::V8DocumentTypePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8DocumentType::V8DocumentTypePrivate* retPrivData = new V8DocumentType::V8DocumentTypePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8DocumentType::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8DocumentType::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8DOMImplementation::createDocumentCallback(const v8::Arguments& args) {
- if (args.Length() < 3)
- throw V8Exception("Wrong number of arguments in createDocument");
- if (!(V8DocumentType::hasInstance(args[2])))
- throw V8Exception("Parameter mismatch while calling createDocument");
+ v8::Handle<v8::Value> V8DOMImplementation::createDocumentCallback(const v8::Arguments& args) {
+ if (args.Length() < 3)
+ throw V8Exception("Wrong number of arguments in createDocument");
+ if (!(V8DocumentType::hasInstance(args[2])))
+ throw V8Exception("Parameter mismatch while calling createDocument");
- v8::Local<v8::Object> self = args.Holder();
- struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localQualifiedName(args[1]);
- Arabica::DOM::DocumentType<std::string>* localDoctype = V8DOM::toClassPtr<V8DocumentType::V8DocumentTypePrivate >(args[2]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localQualifiedName(args[1]);
+ Arabica::DOM::DocumentType<std::string>* localDoctype = V8DOM::toClassPtr<V8DocumentType::V8DocumentTypePrivate >(args[2]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Document<std::string>* retVal = new Arabica::DOM::Document<std::string>(privData->nativeObj->createDocument(*localNamespaceURI, *localQualifiedName, *localDoctype));
- v8::Handle<v8::Function> retCtor = V8Document::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Document<std::string>* retVal = new Arabica::DOM::Document<std::string>(privData->nativeObj->createDocument(*localNamespaceURI, *localQualifiedName, *localDoctype));
+ v8::Handle<v8::Function> retCtor = V8Document::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Document::V8DocumentPrivate* retPrivData = new V8Document::V8DocumentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Document::V8DocumentPrivate* retPrivData = new V8Document::V8DocumentPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Document::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Document::jsDestructor);
+ return retObj;
-}
+ }
-bool V8DOMImplementation::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8DOMImplementation::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h
index 5a4c9d3..6fb8c7e 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h
@@ -21,7 +21,9 @@
#ifndef V8DOMImplementation_h
#define V8DOMImplementation_h
+#include <string>
#include "DOM/Node.hpp"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -30,43 +32,45 @@ namespace DOM {
class V8DOMImplementation {
public:
- struct V8DOMImplementationPrivate {
- V8DOM* dom;
- Arabica::DOM::DOMImplementation<std::string>* nativeObj;
- };
+ struct V8DOMImplementationPrivate {
+ V8DOM* dom;
+ Arabica::DOM::DOMImplementation<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8DOMImplementationPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8DOMImplementationPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Handle<v8::Value> hasFeatureCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createDocumentTypeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createDocumentCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasFeatureCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createDocumentTypeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createDocumentCallback(const v8::Arguments&);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("DOMImplementation"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("DOMImplementation"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
- prototype->Set(v8::String::NewSymbol("hasFeature"),
- v8::FunctionTemplate::New(V8DOMImplementation::hasFeatureCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createDocumentType"),
- v8::FunctionTemplate::New(V8DOMImplementation::createDocumentTypeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createDocument"),
- v8::FunctionTemplate::New(V8DOMImplementation::createDocumentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasFeature"),
+ v8::FunctionTemplate::New(V8DOMImplementation::hasFeatureCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createDocumentType"),
+ v8::FunctionTemplate::New(V8DOMImplementation::createDocumentTypeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createDocument"),
+ v8::FunctionTemplate::New(V8DOMImplementation::createDocumentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp
index 06191ea..d9d123a 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp
@@ -15,397 +15,397 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8Document::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8Document::Tmpl;
-v8::Handle<v8::Value> V8Document::doctypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Document::doctypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- if (!privData->nativeObj->getDoctype()) return v8::Undefined();
- Arabica::DOM::DocumentType<std::string>* arbaicaRet = new Arabica::DOM::DocumentType<std::string>(privData->nativeObj->getDoctype());
+ if (!privData->nativeObj->getDoctype()) return v8::Undefined();
+ Arabica::DOM::DocumentType<std::string>* arbaicaRet = new Arabica::DOM::DocumentType<std::string>(privData->nativeObj->getDoctype());
- v8::Handle<v8::Function> arbaicaRetCtor = V8DocumentType::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8DocumentType::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- struct V8DocumentType::V8DocumentTypePrivate* retPrivData = new V8DocumentType::V8DocumentTypePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ struct V8DocumentType::V8DocumentTypePrivate* retPrivData = new V8DocumentType::V8DocumentTypePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8DocumentType::jsDestructor);
+ return arbaicaRetObj;
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8DocumentType::jsDestructor);
- return arbaicaRetObj;
+ }
-}
+ v8::Handle<v8::Value> V8Document::implementationAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
-v8::Handle<v8::Value> V8Document::implementationAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ if (!privData->nativeObj->getImplementation()) return v8::Undefined();
+ Arabica::DOM::DOMImplementation<std::string>* arbaicaRet = new Arabica::DOM::DOMImplementation<std::string>(privData->nativeObj->getImplementation());
- if (!privData->nativeObj->getImplementation()) return v8::Undefined();
- Arabica::DOM::DOMImplementation<std::string>* arbaicaRet = new Arabica::DOM::DOMImplementation<std::string>(privData->nativeObj->getImplementation());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8DOMImplementation::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- v8::Handle<v8::Function> arbaicaRetCtor = V8DOMImplementation::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ struct V8DOMImplementation::V8DOMImplementationPrivate* retPrivData = new V8DOMImplementation::V8DOMImplementationPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8DOMImplementation::jsDestructor);
+ return arbaicaRetObj;
- struct V8DOMImplementation::V8DOMImplementationPrivate* retPrivData = new V8DOMImplementation::V8DOMImplementationPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ }
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8DOMImplementation::jsDestructor);
- return arbaicaRetObj;
+ v8::Handle<v8::Value> V8Document::documentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
-}
+ if (!privData->nativeObj->getDocumentElement()) return v8::Undefined();
+ Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->nativeObj->getDocumentElement());
-v8::Handle<v8::Value> V8Document::documentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- if (!privData->nativeObj->getDocumentElement()) return v8::Undefined();
- Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->nativeObj->getDocumentElement());
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Element::jsDestructor);
+ return arbaicaRetObj;
- v8::Handle<v8::Function> arbaicaRetCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ }
+ v8::Handle<v8::Value> V8Document::createElementCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createElement");
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localTagName(args[0]);
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Element::jsDestructor);
- return arbaicaRetObj;
+ Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->createElement(*localTagName));
+ v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-}
-v8::Handle<v8::Value> V8Document::createElementCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in createElement");
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localTagName(args[0]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->createElement(*localTagName));
- v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8Element::jsDestructor);
+ return retObj;
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::createDocumentFragmentCallback(const v8::Arguments& args) {
- retObj.MakeWeak(0, V8Element::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
-}
+ Arabica::DOM::DocumentFragment<std::string>* retVal = new Arabica::DOM::DocumentFragment<std::string>(privData->nativeObj->createDocumentFragment());
+ v8::Handle<v8::Function> retCtor = V8DocumentFragment::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::createDocumentFragmentCallback(const v8::Arguments& args) {
+ struct V8DocumentFragment::V8DocumentFragmentPrivate* retPrivData = new V8DocumentFragment::V8DocumentFragmentPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::DocumentFragment<std::string>* retVal = new Arabica::DOM::DocumentFragment<std::string>(privData->nativeObj->createDocumentFragment());
- v8::Handle<v8::Function> retCtor = V8DocumentFragment::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8DocumentFragment::jsDestructor);
+ return retObj;
- struct V8DocumentFragment::V8DocumentFragmentPrivate* retPrivData = new V8DocumentFragment::V8DocumentFragmentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::createTextNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createTextNode");
- retObj.MakeWeak(0, V8DocumentFragment::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(args[0]);
-}
+ Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->nativeObj->createTextNode(*localData));
+ v8::Handle<v8::Function> retCtor = V8Text::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::createTextNodeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in createTextNode");
+ struct V8Text::V8TextPrivate* retPrivData = new V8Text::V8TextPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localData(args[0]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->nativeObj->createTextNode(*localData));
- v8::Handle<v8::Function> retCtor = V8Text::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8Text::jsDestructor);
+ return retObj;
- struct V8Text::V8TextPrivate* retPrivData = new V8Text::V8TextPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::createCommentCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createComment");
- retObj.MakeWeak(0, V8Text::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(args[0]);
-}
+ Arabica::DOM::Comment<std::string>* retVal = new Arabica::DOM::Comment<std::string>(privData->nativeObj->createComment(*localData));
+ v8::Handle<v8::Function> retCtor = V8Comment::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::createCommentCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in createComment");
+ struct V8Comment::V8CommentPrivate* retPrivData = new V8Comment::V8CommentPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localData(args[0]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::Comment<std::string>* retVal = new Arabica::DOM::Comment<std::string>(privData->nativeObj->createComment(*localData));
- v8::Handle<v8::Function> retCtor = V8Comment::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8Comment::jsDestructor);
+ return retObj;
- struct V8Comment::V8CommentPrivate* retPrivData = new V8Comment::V8CommentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::createCDATASectionCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createCDATASection");
- retObj.MakeWeak(0, V8Comment::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(args[0]);
-}
+ Arabica::DOM::CDATASection<std::string>* retVal = new Arabica::DOM::CDATASection<std::string>(privData->nativeObj->createCDATASection(*localData));
+ v8::Handle<v8::Function> retCtor = V8CDATASection::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::createCDATASectionCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in createCDATASection");
+ struct V8CDATASection::V8CDATASectionPrivate* retPrivData = new V8CDATASection::V8CDATASectionPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localData(args[0]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::CDATASection<std::string>* retVal = new Arabica::DOM::CDATASection<std::string>(privData->nativeObj->createCDATASection(*localData));
- v8::Handle<v8::Function> retCtor = V8CDATASection::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8CDATASection::jsDestructor);
+ return retObj;
- struct V8CDATASection::V8CDATASectionPrivate* retPrivData = new V8CDATASection::V8CDATASectionPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::createProcessingInstructionCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in createProcessingInstruction");
- retObj.MakeWeak(0, V8CDATASection::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localTarget(args[0]);
+ v8::String::AsciiValue localData(args[1]);
-}
+ Arabica::DOM::ProcessingInstruction<std::string>* retVal = new Arabica::DOM::ProcessingInstruction<std::string>(privData->nativeObj->createProcessingInstruction(*localTarget, *localData));
+ v8::Handle<v8::Function> retCtor = V8ProcessingInstruction::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::createProcessingInstructionCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in createProcessingInstruction");
+ struct V8ProcessingInstruction::V8ProcessingInstructionPrivate* retPrivData = new V8ProcessingInstruction::V8ProcessingInstructionPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localTarget(args[0]);
- v8::String::AsciiValue localData(args[1]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::ProcessingInstruction<std::string>* retVal = new Arabica::DOM::ProcessingInstruction<std::string>(privData->nativeObj->createProcessingInstruction(*localTarget, *localData));
- v8::Handle<v8::Function> retCtor = V8ProcessingInstruction::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8ProcessingInstruction::jsDestructor);
+ return retObj;
- struct V8ProcessingInstruction::V8ProcessingInstructionPrivate* retPrivData = new V8ProcessingInstruction::V8ProcessingInstructionPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::createAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createAttribute");
- retObj.MakeWeak(0, V8ProcessingInstruction::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
-}
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->createAttribute(*localName));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::createAttributeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in createAttribute");
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->createAttribute(*localName));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::createEntityReferenceCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createEntityReference");
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
-}
+ Arabica::DOM::EntityReference<std::string>* retVal = new Arabica::DOM::EntityReference<std::string>(privData->nativeObj->createEntityReference(*localName));
+ v8::Handle<v8::Function> retCtor = V8EntityReference::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::createEntityReferenceCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in createEntityReference");
+ struct V8EntityReference::V8EntityReferencePrivate* retPrivData = new V8EntityReference::V8EntityReferencePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::EntityReference<std::string>* retVal = new Arabica::DOM::EntityReference<std::string>(privData->nativeObj->createEntityReference(*localName));
- v8::Handle<v8::Function> retCtor = V8EntityReference::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8EntityReference::jsDestructor);
+ return retObj;
- struct V8EntityReference::V8EntityReferencePrivate* retPrivData = new V8EntityReference::V8EntityReferencePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::getElementsByTagNameCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getElementsByTagName");
- retObj.MakeWeak(0, V8EntityReference::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localTagname(args[0]);
-}
+ Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagName(*localTagname));
+ v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::getElementsByTagNameCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in getElementsByTagName");
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localTagname(args[0]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagName(*localTagname));
- v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return retObj;
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::importNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in importNode");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling importNode");
- retObj.MakeWeak(0, V8NodeList::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localImportedNode = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ bool localDeep = args[1]->ToBoolean()->BooleanValue();
-}
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->importNode(*localImportedNode, localDeep));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::importNodeCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in importNode");
- if (!(V8Node::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling importNode");
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localImportedNode = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- bool localDeep = args[1]->ToBoolean()->BooleanValue();
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->importNode(*localImportedNode, localDeep));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::createElementNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in createElementNS");
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localQualifiedName(args[1]);
-}
+ Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->createElementNS(*localNamespaceURI, *localQualifiedName));
+ v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::createElementNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in createElementNS");
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localQualifiedName(args[1]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->createElementNS(*localNamespaceURI, *localQualifiedName));
- v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8Element::jsDestructor);
+ return retObj;
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::createAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in createAttributeNS");
- retObj.MakeWeak(0, V8Element::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localQualifiedName(args[1]);
-}
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->createAttributeNS(*localNamespaceURI, *localQualifiedName));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::createAttributeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in createAttributeNS");
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localQualifiedName(args[1]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->createAttributeNS(*localNamespaceURI, *localQualifiedName));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::getElementsByTagNameNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getElementsByTagNameNS");
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
-}
+ Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagNameNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::getElementsByTagNameNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in getElementsByTagNameNS");
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagNameNS(*localNamespaceURI, *localLocalName));
- v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return retObj;
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::getElementByIdCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getElementById");
- retObj.MakeWeak(0, V8NodeList::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localElementId(args[0]);
-}
+ Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->getElementById(*localElementId));
+ v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::getElementByIdCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in getElementById");
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localElementId(args[0]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->getElementById(*localElementId));
- v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8Element::jsDestructor);
+ return retObj;
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ bool V8Document::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
- retObj.MakeWeak(0, V8Element::jsDestructor);
- return retObj;
-
-}
-
-bool V8Document::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h
index da61876..c12e0dc 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h
@@ -21,8 +21,10 @@
#ifndef V8Document_h
#define V8Document_h
+#include <string>
#include "DOM/Node.hpp"
#include "V8Node.h"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -31,89 +33,91 @@ namespace DOM {
class V8Document {
public:
- struct V8DocumentPrivate {
- V8DOM* dom;
- Arabica::DOM::Document<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8DocumentPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> createElementCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createDocumentFragmentCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createTextNodeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createCommentCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createCDATASectionCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createProcessingInstructionCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createAttributeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createEntityReferenceCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> importNodeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createElementNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createAttributeNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getElementByIdCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> evaluateCustomCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> doctypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> implementationAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> documentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Document"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("doctype"), V8Document::doctypeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("implementation"), V8Document::implementationAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("documentElement"), V8Document::documentElementAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("createElement"),
- v8::FunctionTemplate::New(V8Document::createElementCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createDocumentFragment"),
- v8::FunctionTemplate::New(V8Document::createDocumentFragmentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createTextNode"),
- v8::FunctionTemplate::New(V8Document::createTextNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createComment"),
- v8::FunctionTemplate::New(V8Document::createCommentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createCDATASection"),
- v8::FunctionTemplate::New(V8Document::createCDATASectionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createProcessingInstruction"),
- v8::FunctionTemplate::New(V8Document::createProcessingInstructionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createAttribute"),
- v8::FunctionTemplate::New(V8Document::createAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createEntityReference"),
- v8::FunctionTemplate::New(V8Document::createEntityReferenceCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
- v8::FunctionTemplate::New(V8Document::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("importNode"),
- v8::FunctionTemplate::New(V8Document::importNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createElementNS"),
- v8::FunctionTemplate::New(V8Document::createElementNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createAttributeNS"),
- v8::FunctionTemplate::New(V8Document::createAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
- v8::FunctionTemplate::New(V8Document::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementById"),
- v8::FunctionTemplate::New(V8Document::getElementByIdCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("evaluate"),
- v8::FunctionTemplate::New(V8Document::evaluateCustomCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8DocumentPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Document<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8DocumentPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> createElementCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createDocumentFragmentCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createTextNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createCommentCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createCDATASectionCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createProcessingInstructionCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createEntityReferenceCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> importNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createElementNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createAttributeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementByIdCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> evaluateCustomCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> doctypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> implementationAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> documentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Document"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("doctype"), V8Document::doctypeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("implementation"), V8Document::implementationAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("documentElement"), V8Document::documentElementAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("createElement"),
+ v8::FunctionTemplate::New(V8Document::createElementCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createDocumentFragment"),
+ v8::FunctionTemplate::New(V8Document::createDocumentFragmentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createTextNode"),
+ v8::FunctionTemplate::New(V8Document::createTextNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createComment"),
+ v8::FunctionTemplate::New(V8Document::createCommentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createCDATASection"),
+ v8::FunctionTemplate::New(V8Document::createCDATASectionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createProcessingInstruction"),
+ v8::FunctionTemplate::New(V8Document::createProcessingInstructionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createAttribute"),
+ v8::FunctionTemplate::New(V8Document::createAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createEntityReference"),
+ v8::FunctionTemplate::New(V8Document::createEntityReferenceCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
+ v8::FunctionTemplate::New(V8Document::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("importNode"),
+ v8::FunctionTemplate::New(V8Document::importNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createElementNS"),
+ v8::FunctionTemplate::New(V8Document::createElementNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createAttributeNS"),
+ v8::FunctionTemplate::New(V8Document::createAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
+ v8::FunctionTemplate::New(V8Document::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementById"),
+ v8::FunctionTemplate::New(V8Document::getElementByIdCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("evaluate"),
+ v8::FunctionTemplate::New(V8Document::evaluateCustomCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp
index 1403574..e6bec84 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp
@@ -4,11 +4,11 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8DocumentFragment::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8DocumentFragment::Tmpl;
-bool V8DocumentFragment::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8DocumentFragment::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h
index 62dc58d..cf7f6ba 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h
@@ -21,8 +21,10 @@
#ifndef V8DocumentFragment_h
#define V8DocumentFragment_h
+#include <string>
#include "DOM/Node.hpp"
#include "V8Node.h"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -31,35 +33,37 @@ namespace DOM {
class V8DocumentFragment {
public:
- struct V8DocumentFragmentPrivate {
- V8DOM* dom;
- Arabica::DOM::DocumentFragment<std::string>* nativeObj;
- };
+ struct V8DocumentFragmentPrivate {
+ V8DOM* dom;
+ Arabica::DOM::DocumentFragment<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8DocumentFragmentPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8DocumentFragmentPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("DocumentFragment"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("DocumentFragment"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp
index 6b9a7b0..a2098f2 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp
@@ -5,79 +5,79 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8DocumentType::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8DocumentType::Tmpl;
-v8::Handle<v8::Value> V8DocumentType::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8DocumentType::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getName().c_str());
-}
+ return v8::String::New(privData->nativeObj->getName().c_str());
+ }
-v8::Handle<v8::Value> V8DocumentType::entitiesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8DocumentType::entitiesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+
+ Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getEntities());
- Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getEntities());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
+ return arbaicaRetObj;
- struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ }
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
- return arbaicaRetObj;
+ v8::Handle<v8::Value> V8DocumentType::notationsAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
-}
+
+ Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getNotations());
-v8::Handle<v8::Value> V8DocumentType::notationsAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
+ return arbaicaRetObj;
- Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getNotations());
+ }
- v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Value> V8DocumentType::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
- struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ return v8::String::New(privData->nativeObj->getPublicId().c_str());
+ }
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
- return arbaicaRetObj;
+ v8::Handle<v8::Value> V8DocumentType::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
-}
+ return v8::String::New(privData->nativeObj->getSystemId().c_str());
+ }
-v8::Handle<v8::Value> V8DocumentType::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8DocumentType::internalSubsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getPublicId().c_str());
-}
+ return v8::String::New(privData->nativeObj->getInternalSubset().c_str());
+ }
+ bool V8DocumentType::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-v8::Handle<v8::Value> V8DocumentType::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
-
- return v8::String::New(privData->nativeObj->getSystemId().c_str());
-}
-
-v8::Handle<v8::Value> V8DocumentType::internalSubsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
-
- return v8::String::New(privData->nativeObj->getInternalSubset().c_str());
-}
-bool V8DocumentType::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h
index f4d0c15..65ce30c 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h
@@ -21,8 +21,10 @@
#ifndef V8DocumentType_h
#define V8DocumentType_h
+#include <string>
#include "DOM/Node.hpp"
#include "V8Node.h"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -31,53 +33,55 @@ namespace DOM {
class V8DocumentType {
public:
- struct V8DocumentTypePrivate {
- V8DOM* dom;
- Arabica::DOM::DocumentType<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8DocumentTypePrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
-
- static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> entitiesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> notationsAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> internalSubsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("DocumentType"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("name"), V8DocumentType::nameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("entities"), V8DocumentType::entitiesAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("notations"), V8DocumentType::notationsAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("publicId"), V8DocumentType::publicIdAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("systemId"), V8DocumentType::systemIdAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("internalSubset"), V8DocumentType::internalSubsetAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8DocumentTypePrivate {
+ V8DOM* dom;
+ Arabica::DOM::DocumentType<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8DocumentTypePrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+ static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> entitiesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> notationsAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> internalSubsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("DocumentType"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("name"), V8DocumentType::nameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("entities"), V8DocumentType::entitiesAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("notations"), V8DocumentType::notationsAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("publicId"), V8DocumentType::publicIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("systemId"), V8DocumentType::systemIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("internalSubset"), V8DocumentType::internalSubsetAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp
index 680dd5e..d476daa 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp
@@ -6,297 +6,297 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8Element::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8Element::Tmpl;
-v8::Handle<v8::Value> V8Element::tagNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Element::tagNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getTagName().c_str());
-}
-v8::Handle<v8::Value> V8Element::getAttributeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in getAttribute");
+ return v8::String::New(privData->nativeObj->getTagName().c_str());
+ }
+ v8::Handle<v8::Value> V8Element::getAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getAttribute");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- std::string retVal = privData->nativeObj->getAttribute(*localName);
+ std::string retVal = privData->nativeObj->getAttribute(*localName);
- return v8::String::New(retVal.c_str());
-}
+ return v8::String::New(retVal.c_str());
+ }
-v8::Handle<v8::Value> V8Element::setAttributeCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in setAttribute");
+ v8::Handle<v8::Value> V8Element::setAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in setAttribute");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
- v8::String::AsciiValue localValue(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
+ v8::String::AsciiValue localValue(args[1]);
- privData->nativeObj->setAttribute(*localName, *localValue);
+ privData->nativeObj->setAttribute(*localName, *localValue);
- return v8::Undefined();
-}
+ return v8::Undefined();
+ }
-v8::Handle<v8::Value> V8Element::removeAttributeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in removeAttribute");
+ v8::Handle<v8::Value> V8Element::removeAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in removeAttribute");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- privData->nativeObj->removeAttribute(*localName);
+ privData->nativeObj->removeAttribute(*localName);
- return v8::Undefined();
-}
+ return v8::Undefined();
+ }
-v8::Handle<v8::Value> V8Element::getAttributeNodeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in getAttributeNode");
+ v8::Handle<v8::Value> V8Element::getAttributeNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getAttributeNode");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->getAttributeNode(*localName));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->getAttributeNode(*localName));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8Element::setAttributeNodeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in setAttributeNode");
- if (!(V8Attr::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling setAttributeNode");
+ v8::Handle<v8::Value> V8Element::setAttributeNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in setAttributeNode");
+ if (!(V8Attr::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling setAttributeNode");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- Arabica::DOM::Attr<std::string>* localNewAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Attr<std::string>* localNewAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->setAttributeNode(*localNewAttr));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->setAttributeNode(*localNewAttr));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8Element::removeAttributeNodeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in removeAttributeNode");
- if (!(V8Attr::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling removeAttributeNode");
+ v8::Handle<v8::Value> V8Element::removeAttributeNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in removeAttributeNode");
+ if (!(V8Attr::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling removeAttributeNode");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- Arabica::DOM::Attr<std::string>* localOldAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Attr<std::string>* localOldAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->removeAttributeNode(*localOldAttr));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->removeAttributeNode(*localOldAttr));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8Element::getElementsByTagNameCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in getElementsByTagName");
+ v8::Handle<v8::Value> V8Element::getElementsByTagNameCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getElementsByTagName");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagName(*localName));
- v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagName(*localName));
+ v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8NodeList::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8Element::getAttributeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in getAttributeNS");
+ v8::Handle<v8::Value> V8Element::getAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getAttributeNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- std::string retVal = privData->nativeObj->getAttributeNS(*localNamespaceURI, *localLocalName);
+ std::string retVal = privData->nativeObj->getAttributeNS(*localNamespaceURI, *localLocalName);
- return v8::String::New(retVal.c_str());
-}
+ return v8::String::New(retVal.c_str());
+ }
-v8::Handle<v8::Value> V8Element::setAttributeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 3)
- throw V8Exception("Wrong number of arguments in setAttributeNS");
+ v8::Handle<v8::Value> V8Element::setAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 3)
+ throw V8Exception("Wrong number of arguments in setAttributeNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localQualifiedName(args[1]);
- v8::String::AsciiValue localValue(args[2]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localQualifiedName(args[1]);
+ v8::String::AsciiValue localValue(args[2]);
- privData->nativeObj->setAttributeNS(*localNamespaceURI, *localQualifiedName, *localValue);
+ privData->nativeObj->setAttributeNS(*localNamespaceURI, *localQualifiedName, *localValue);
- return v8::Undefined();
-}
+ return v8::Undefined();
+ }
-v8::Handle<v8::Value> V8Element::removeAttributeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in removeAttributeNS");
+ v8::Handle<v8::Value> V8Element::removeAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in removeAttributeNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- privData->nativeObj->removeAttributeNS(*localNamespaceURI, *localLocalName);
+ privData->nativeObj->removeAttributeNS(*localNamespaceURI, *localLocalName);
- return v8::Undefined();
-}
+ return v8::Undefined();
+ }
-v8::Handle<v8::Value> V8Element::getAttributeNodeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in getAttributeNodeNS");
+ v8::Handle<v8::Value> V8Element::getAttributeNodeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getAttributeNodeNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->getAttributeNodeNS(*localNamespaceURI, *localLocalName));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->getAttributeNodeNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8Element::setAttributeNodeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in setAttributeNodeNS");
- if (!(V8Attr::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling setAttributeNodeNS");
+ v8::Handle<v8::Value> V8Element::setAttributeNodeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in setAttributeNodeNS");
+ if (!(V8Attr::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling setAttributeNodeNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- Arabica::DOM::Attr<std::string>* localNewAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Attr<std::string>* localNewAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->setAttributeNodeNS(*localNewAttr));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->setAttributeNodeNS(*localNewAttr));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8Element::getElementsByTagNameNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in getElementsByTagNameNS");
+ v8::Handle<v8::Value> V8Element::getElementsByTagNameNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getElementsByTagNameNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagNameNS(*localNamespaceURI, *localLocalName));
- v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagNameNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8NodeList::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8Element::hasAttributeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in hasAttribute");
+ v8::Handle<v8::Value> V8Element::hasAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in hasAttribute");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- bool retVal = privData->nativeObj->hasAttribute(*localName);
+ bool retVal = privData->nativeObj->hasAttribute(*localName);
- return v8::Boolean::New(retVal);
-}
+ return v8::Boolean::New(retVal);
+ }
-v8::Handle<v8::Value> V8Element::hasAttributeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in hasAttributeNS");
+ v8::Handle<v8::Value> V8Element::hasAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in hasAttributeNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- bool retVal = privData->nativeObj->hasAttributeNS(*localNamespaceURI, *localLocalName);
+ bool retVal = privData->nativeObj->hasAttributeNS(*localNamespaceURI, *localLocalName);
- return v8::Boolean::New(retVal);
-}
+ return v8::Boolean::New(retVal);
+ }
-bool V8Element::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8Element::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h
index 338c249..499ae0e 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h
@@ -21,8 +21,10 @@
#ifndef V8Element_h
#define V8Element_h
+#include <string>
#include "DOM/Node.hpp"
#include "V8Node.h"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -31,83 +33,85 @@ namespace DOM {
class V8Element {
public:
- struct V8ElementPrivate {
- V8DOM* dom;
- Arabica::DOM::Element<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8ElementPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> getAttributeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setAttributeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeAttributeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getAttributeNodeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setAttributeNodeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeAttributeNodeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getAttributeNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setAttributeNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeAttributeNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getAttributeNodeNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setAttributeNodeNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> hasAttributeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> hasAttributeNSCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> tagNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Element"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("tagName"), V8Element::tagNameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("getAttribute"),
- v8::FunctionTemplate::New(V8Element::getAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttribute"),
- v8::FunctionTemplate::New(V8Element::setAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeAttribute"),
- v8::FunctionTemplate::New(V8Element::removeAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getAttributeNode"),
- v8::FunctionTemplate::New(V8Element::getAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttributeNode"),
- v8::FunctionTemplate::New(V8Element::setAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeAttributeNode"),
- v8::FunctionTemplate::New(V8Element::removeAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
- v8::FunctionTemplate::New(V8Element::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getAttributeNS"),
- v8::FunctionTemplate::New(V8Element::getAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttributeNS"),
- v8::FunctionTemplate::New(V8Element::setAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeAttributeNS"),
- v8::FunctionTemplate::New(V8Element::removeAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getAttributeNodeNS"),
- v8::FunctionTemplate::New(V8Element::getAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttributeNodeNS"),
- v8::FunctionTemplate::New(V8Element::setAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
- v8::FunctionTemplate::New(V8Element::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasAttribute"),
- v8::FunctionTemplate::New(V8Element::hasAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasAttributeNS"),
- v8::FunctionTemplate::New(V8Element::hasAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8ElementPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Element<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8ElementPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> getAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getAttributeNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setAttributeNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeAttributeNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getAttributeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setAttributeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeAttributeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getAttributeNodeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setAttributeNodeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasAttributeNSCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> tagNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Element"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("tagName"), V8Element::tagNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("getAttribute"),
+ v8::FunctionTemplate::New(V8Element::getAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttribute"),
+ v8::FunctionTemplate::New(V8Element::setAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeAttribute"),
+ v8::FunctionTemplate::New(V8Element::removeAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getAttributeNode"),
+ v8::FunctionTemplate::New(V8Element::getAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttributeNode"),
+ v8::FunctionTemplate::New(V8Element::setAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeAttributeNode"),
+ v8::FunctionTemplate::New(V8Element::removeAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
+ v8::FunctionTemplate::New(V8Element::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::getAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::setAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::removeAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getAttributeNodeNS"),
+ v8::FunctionTemplate::New(V8Element::getAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttributeNodeNS"),
+ v8::FunctionTemplate::New(V8Element::setAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
+ v8::FunctionTemplate::New(V8Element::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasAttribute"),
+ v8::FunctionTemplate::New(V8Element::hasAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::hasAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp
index f3ce21d..6db7b15 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp
@@ -4,32 +4,32 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8Entity::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8Entity::Tmpl;
-v8::Handle<v8::Value> V8Entity::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Entity::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getPublicId().c_str());
-}
+ return v8::String::New(privData->nativeObj->getPublicId().c_str());
+ }
-v8::Handle<v8::Value> V8Entity::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Entity::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getSystemId().c_str());
-}
+ return v8::String::New(privData->nativeObj->getSystemId().c_str());
+ }
-v8::Handle<v8::Value> V8Entity::notationNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Entity::notationNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getNotationName().c_str());
-}
-bool V8Entity::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ return v8::String::New(privData->nativeObj->getNotationName().c_str());
+ }
+ bool V8Entity::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h
index c8e0eaf..acea6ea 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h
@@ -21,8 +21,10 @@
#ifndef V8Entity_h
#define V8Entity_h
+#include <string>
#include "DOM/Node.hpp"
#include "V8Node.h"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -31,44 +33,46 @@ namespace DOM {
class V8Entity {
public:
- struct V8EntityPrivate {
- V8DOM* dom;
- Arabica::DOM::Entity<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8EntityPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
-
- static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> notationNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Entity"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("publicId"), V8Entity::publicIdAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("systemId"), V8Entity::systemIdAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("notationName"), V8Entity::notationNameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8EntityPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Entity<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8EntityPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+ static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> notationNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Entity"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("publicId"), V8Entity::publicIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("systemId"), V8Entity::systemIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("notationName"), V8Entity::notationNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp
index 197fadd..95ceee8 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp
@@ -4,11 +4,11 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8EntityReference::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8EntityReference::Tmpl;
-bool V8EntityReference::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8EntityReference::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h
index 85cc7cc..9bfb86d 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h
@@ -21,8 +21,10 @@
#ifndef V8EntityReference_h
#define V8EntityReference_h
+#include <string>
#include "DOM/Node.hpp"
#include "V8Node.h"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -31,35 +33,37 @@ namespace DOM {
class V8EntityReference {
public:
- struct V8EntityReferencePrivate {
- V8DOM* dom;
- Arabica::DOM::EntityReference<std::string>* nativeObj;
- };
+ struct V8EntityReferencePrivate {
+ V8DOM* dom;
+ Arabica::DOM::EntityReference<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8EntityReferencePrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8EntityReferencePrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("EntityReference"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("EntityReference"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp
index 037d651..e09bbb8 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp
@@ -4,185 +4,185 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8NamedNodeMap::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8NamedNodeMap::Tmpl;
-v8::Handle<v8::Value> V8NamedNodeMap::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8NamedNodeMap::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- return v8::Integer::New(privData->nativeObj->getLength());
-}
-v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in getNamedItem");
+ return v8::Integer::New(privData->nativeObj->getLength());
+ }
+ v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getNamedItem");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNamedItem(*localName));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNamedItem(*localName));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in setNamedItem");
- if (!(V8Node::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling setNamedItem");
+ v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in setNamedItem");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling setNamedItem");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localArg = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localArg = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->setNamedItem(*localArg));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->setNamedItem(*localArg));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8NamedNodeMap::removeNamedItemCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in removeNamedItem");
+ v8::Handle<v8::Value> V8NamedNodeMap::removeNamedItemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in removeNamedItem");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeNamedItem(*localName));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeNamedItem(*localName));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8NamedNodeMap::itemCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in item");
+ v8::Handle<v8::Value> V8NamedNodeMap::itemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in item");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(localIndex));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(localIndex));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in getNamedItemNS");
+ v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getNamedItemNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNamedItemNS(*localNamespaceURI, *localLocalName));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNamedItemNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemNSCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in setNamedItemNS");
- if (!(V8Node::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling setNamedItemNS");
+ v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in setNamedItemNS");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling setNamedItemNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localArg = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localArg = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->setNamedItemNS(*localArg));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->setNamedItemNS(*localArg));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8NamedNodeMap::removeNamedItemNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in removeNamedItemNS");
+ v8::Handle<v8::Value> V8NamedNodeMap::removeNamedItemNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in removeNamedItemNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeNamedItemNS(*localNamespaceURI, *localLocalName));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeNamedItemNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
-}
+ }
-bool V8NamedNodeMap::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8NamedNodeMap::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h
index b8bc873..a98c5ee 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h
@@ -21,7 +21,9 @@
#ifndef V8NamedNodeMap_h
#define V8NamedNodeMap_h
+#include <string>
#include "DOM/Node.hpp"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -30,58 +32,60 @@ namespace DOM {
class V8NamedNodeMap {
public:
- struct V8NamedNodeMapPrivate {
- V8DOM* dom;
- Arabica::DOM::NamedNodeMap<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8NamedNodeMapPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> getNamedItemCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setNamedItemCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeNamedItemCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> itemCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getNamedItemNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setNamedItemNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeNamedItemNSCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("NamedNodeMap"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("length"), V8NamedNodeMap::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("getNamedItem"),
- v8::FunctionTemplate::New(V8NamedNodeMap::getNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setNamedItem"),
- v8::FunctionTemplate::New(V8NamedNodeMap::setNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeNamedItem"),
- v8::FunctionTemplate::New(V8NamedNodeMap::removeNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("item"),
- v8::FunctionTemplate::New(V8NamedNodeMap::itemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getNamedItemNS"),
- v8::FunctionTemplate::New(V8NamedNodeMap::getNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setNamedItemNS"),
- v8::FunctionTemplate::New(V8NamedNodeMap::setNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeNamedItemNS"),
- v8::FunctionTemplate::New(V8NamedNodeMap::removeNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8NamedNodeMapPrivate {
+ V8DOM* dom;
+ Arabica::DOM::NamedNodeMap<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8NamedNodeMapPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> getNamedItemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setNamedItemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeNamedItemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> itemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getNamedItemNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setNamedItemNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeNamedItemNSCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("NamedNodeMap"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("length"), V8NamedNodeMap::lengthAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("getNamedItem"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::getNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setNamedItem"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::setNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeNamedItem"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::removeNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("item"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::itemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getNamedItemNS"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::getNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setNamedItemNS"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::setNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeNamedItemNS"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::removeNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp
index b77f38e..7de50f6 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp
@@ -6,396 +6,396 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8Node::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8Node::Tmpl;
-v8::Handle<v8::Value> V8Node::nodeNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Node::nodeNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getNodeName().c_str());
-}
+ return v8::String::New(privData->nativeObj->getNodeName().c_str());
+ }
-v8::Handle<v8::Value> V8Node::nodeValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Node::nodeValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getNodeValue().c_str());
-}
+ return v8::String::New(privData->nativeObj->getNodeValue().c_str());
+ }
-void V8Node::nodeValueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNodeValue(value);
- privData->nativeObj->setNodeValue(*localNodeValue);
-}
+ void V8Node::nodeValueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNodeValue(value);
+ privData->nativeObj->setNodeValue(*localNodeValue);
+ }
-v8::Handle<v8::Value> V8Node::nodeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Node::nodeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- return v8::Integer::New(privData->nativeObj->getNodeType());
-}
+ return v8::Integer::New(privData->nativeObj->getNodeType());
+ }
-v8::Handle<v8::Value> V8Node::parentNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Node::parentNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- if (!privData->nativeObj->getParentNode()) return v8::Undefined();
- Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getParentNode());
+ if (!privData->nativeObj->getParentNode()) return v8::Undefined();
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getParentNode());
- v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
- return arbaicaRetObj;
+ }
-}
+ v8::Handle<v8::Value> V8Node::childNodesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
-v8::Handle<v8::Value> V8Node::childNodesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+
+ Arabica::DOM::NodeList<std::string>* arbaicaRet = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getChildNodes());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- Arabica::DOM::NodeList<std::string>* arbaicaRet = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getChildNodes());
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return arbaicaRetObj;
- v8::Handle<v8::Function> arbaicaRetCtor = V8NodeList::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ }
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ v8::Handle<v8::Value> V8Node::firstChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8NodeList::jsDestructor);
- return arbaicaRetObj;
+ if (!privData->nativeObj->getFirstChild()) return v8::Undefined();
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getFirstChild());
-}
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
-v8::Handle<v8::Value> V8Node::firstChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
- if (!privData->nativeObj->getFirstChild()) return v8::Undefined();
- Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getFirstChild());
+ }
- v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Value> V8Node::lastChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ if (!privData->nativeObj->getLastChild()) return v8::Undefined();
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getLastChild());
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
- return arbaicaRetObj;
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
-}
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
-v8::Handle<v8::Value> V8Node::lastChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ }
+
+ v8::Handle<v8::Value> V8Node::previousSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+
+ if (!privData->nativeObj->getPreviousSibling()) return v8::Undefined();
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getPreviousSibling());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Node::nextSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+
+ if (!privData->nativeObj->getNextSibling()) return v8::Undefined();
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNextSibling());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
- if (!privData->nativeObj->getLastChild()) return v8::Undefined();
- Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getLastChild());
+ }
- v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Value> V8Node::attributesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+
+ Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getAttributes());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
+ return arbaicaRetObj;
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
- return arbaicaRetObj;
+ }
-}
+ v8::Handle<v8::Value> V8Node::ownerDocumentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
-v8::Handle<v8::Value> V8Node::previousSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ if (!privData->nativeObj->getOwnerDocument()) return v8::Undefined();
+ Arabica::DOM::Document<std::string>* arbaicaRet = new Arabica::DOM::Document<std::string>(privData->nativeObj->getOwnerDocument());
- if (!privData->nativeObj->getPreviousSibling()) return v8::Undefined();
- Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getPreviousSibling());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Document::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ struct V8Document::V8DocumentPrivate* retPrivData = new V8Document::V8DocumentPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Document::jsDestructor);
+ return arbaicaRetObj;
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ }
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
- return arbaicaRetObj;
+ v8::Handle<v8::Value> V8Node::namespaceURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
-}
+ return v8::String::New(privData->nativeObj->getNamespaceURI().c_str());
+ }
-v8::Handle<v8::Value> V8Node::nextSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Node::prefixAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- if (!privData->nativeObj->getNextSibling()) return v8::Undefined();
- Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNextSibling());
+ return v8::String::New(privData->nativeObj->getPrefix().c_str());
+ }
- v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ void V8Node::prefixAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localPrefix(value);
+ privData->nativeObj->setPrefix(*localPrefix);
+ }
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ v8::Handle<v8::Value> V8Node::localNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
- return arbaicaRetObj;
+ return v8::String::New(privData->nativeObj->getLocalName().c_str());
+ }
+ v8::Handle<v8::Value> V8Node::insertBeforeCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in insertBefore");
+ if (!((V8Node::hasInstance(args[0])) && (V8Node::hasInstance(args[1]))))
+ throw V8Exception("Parameter mismatch while calling insertBefore");
-}
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ Arabica::DOM::Node<std::string>* localRefChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[1]->ToObject()->GetInternalField(0))->nativeObj;
-v8::Handle<v8::Value> V8Node::attributesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->insertBefore(*localNewChild, *localRefChild));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getAttributes());
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ }
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
- return arbaicaRetObj;
+ v8::Handle<v8::Value> V8Node::replaceChildCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in replaceChild");
+ if (!((V8Node::hasInstance(args[0])) && (V8Node::hasInstance(args[1]))))
+ throw V8Exception("Parameter mismatch while calling replaceChild");
-}
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[1]->ToObject()->GetInternalField(0))->nativeObj;
-v8::Handle<v8::Value> V8Node::ownerDocumentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->replaceChild(*localNewChild, *localOldChild));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- if (!privData->nativeObj->getOwnerDocument()) return v8::Undefined();
- Arabica::DOM::Document<std::string>* arbaicaRet = new Arabica::DOM::Document<std::string>(privData->nativeObj->getOwnerDocument());
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Handle<v8::Function> arbaicaRetCtor = V8Document::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- struct V8Document::V8DocumentPrivate* retPrivData = new V8Document::V8DocumentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Document::jsDestructor);
- return arbaicaRetObj;
+ }
-}
+ v8::Handle<v8::Value> V8Node::removeChildCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in removeChild");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling removeChild");
-v8::Handle<v8::Value> V8Node::namespaceURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- return v8::String::New(privData->nativeObj->getNamespaceURI().c_str());
-}
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeChild(*localOldChild));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Node::prefixAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- return v8::String::New(privData->nativeObj->getPrefix().c_str());
-}
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-void V8Node::prefixAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localPrefix(value);
- privData->nativeObj->setPrefix(*localPrefix);
-}
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
-v8::Handle<v8::Value> V8Node::localNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ }
- return v8::String::New(privData->nativeObj->getLocalName().c_str());
-}
-v8::Handle<v8::Value> V8Node::insertBeforeCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in insertBefore");
- if (!((V8Node::hasInstance(args[0])) && (V8Node::hasInstance(args[1]))))
- throw V8Exception("Parameter mismatch while calling insertBefore");
+ v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in appendChild");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling appendChild");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Node<std::string>* localRefChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[1]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->insertBefore(*localNewChild, *localRefChild));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->appendChild(*localNewChild));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8Node::replaceChildCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in replaceChild");
- if (!((V8Node::hasInstance(args[0])) && (V8Node::hasInstance(args[1]))))
- throw V8Exception("Parameter mismatch while calling replaceChild");
+ v8::Handle<v8::Value> V8Node::hasChildNodesCallback(const v8::Arguments& args) {
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[1]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->replaceChild(*localNewChild, *localOldChild));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ bool retVal = privData->nativeObj->hasChildNodes();
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ return v8::Boolean::New(retVal);
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Node::cloneNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in cloneNode");
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ bool localDeep = args[0]->ToBoolean()->BooleanValue();
-}
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->cloneNode(localDeep));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Node::removeChildCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in removeChild");
- if (!(V8Node::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling removeChild");
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeChild(*localOldChild));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Node::normalizeCallback(const v8::Arguments& args) {
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
-}
+ privData->nativeObj->normalize();
-v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in appendChild");
- if (!(V8Node::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling appendChild");
+ return v8::Undefined();
+ }
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Handle<v8::Value> V8Node::isSupportedCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in isSupported");
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->appendChild(*localNewChild));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localFeature(args[0]);
+ v8::String::AsciiValue localVersion(args[1]);
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ bool retVal = privData->nativeObj->isSupported(*localFeature, *localVersion);
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ return v8::Boolean::New(retVal);
+ }
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ v8::Handle<v8::Value> V8Node::hasAttributesCallback(const v8::Arguments& args) {
-}
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
-v8::Handle<v8::Value> V8Node::hasChildNodesCallback(const v8::Arguments& args) {
+ bool retVal = privData->nativeObj->hasAttributes();
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ return v8::Boolean::New(retVal);
+ }
- bool retVal = privData->nativeObj->hasChildNodes();
+ bool V8Node::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
- return v8::Boolean::New(retVal);
-}
-
-v8::Handle<v8::Value> V8Node::cloneNodeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in cloneNode");
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- bool localDeep = args[0]->ToBoolean()->BooleanValue();
-
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->cloneNode(localDeep));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
-
-}
-
-v8::Handle<v8::Value> V8Node::normalizeCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
-
- privData->nativeObj->normalize();
-
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Node::isSupportedCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in isSupported");
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localFeature(args[0]);
- v8::String::AsciiValue localVersion(args[1]);
-
- bool retVal = privData->nativeObj->isSupported(*localFeature, *localVersion);
-
- return v8::Boolean::New(retVal);
-}
-
-v8::Handle<v8::Value> V8Node::hasAttributesCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
-
- bool retVal = privData->nativeObj->hasAttributes();
-
- return v8::Boolean::New(retVal);
-}
-
-bool V8Node::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h
index a15a676..cd427e5 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h
@@ -21,7 +21,9 @@
#ifndef V8Node_h
#define V8Node_h
+#include <string>
#include "DOM/Node.hpp"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -30,129 +32,131 @@ namespace DOM {
class V8Node {
public:
- struct V8NodePrivate {
- V8DOM* dom;
- Arabica::DOM::Node<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8NodePrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> insertBeforeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> replaceChildCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeChildCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> appendChildCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> hasChildNodesCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> cloneNodeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> normalizeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> isSupportedCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> hasAttributesCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> nodeNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> nodeValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static void nodeValueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> nodeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> parentNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> childNodesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> firstChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> lastChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> previousSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> nextSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> attributesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> ownerDocumentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> namespaceURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> prefixAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static void prefixAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> localNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Node"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("nodeName"), V8Node::nodeNameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("nodeValue"), V8Node::nodeValueAttrGetter, V8Node::nodeValueAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("nodeType"), V8Node::nodeTypeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("parentNode"), V8Node::parentNodeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("childNodes"), V8Node::childNodesAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("firstChild"), V8Node::firstChildAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("lastChild"), V8Node::lastChildAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("previousSibling"), V8Node::previousSiblingAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("nextSibling"), V8Node::nextSiblingAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("attributes"), V8Node::attributesAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("ownerDocument"), V8Node::ownerDocumentAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("namespaceURI"), V8Node::namespaceURIAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("prefix"), V8Node::prefixAttrGetter, V8Node::prefixAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("localName"), V8Node::localNameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("insertBefore"),
- v8::FunctionTemplate::New(V8Node::insertBeforeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("replaceChild"),
- v8::FunctionTemplate::New(V8Node::replaceChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeChild"),
- v8::FunctionTemplate::New(V8Node::removeChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("appendChild"),
- v8::FunctionTemplate::New(V8Node::appendChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasChildNodes"),
- v8::FunctionTemplate::New(V8Node::hasChildNodesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("cloneNode"),
- v8::FunctionTemplate::New(V8Node::cloneNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("normalize"),
- v8::FunctionTemplate::New(V8Node::normalizeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("isSupported"),
- v8::FunctionTemplate::New(V8Node::isSupportedCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasAttributes"),
- v8::FunctionTemplate::New(V8Node::hasAttributesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(5), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(5), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(6), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(6), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(7), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(7), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(8), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(8), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(9), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(9), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(10), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(10), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(11), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(11), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(12), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(12), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8NodePrivate {
+ V8DOM* dom;
+ Arabica::DOM::Node<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8NodePrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> insertBeforeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> replaceChildCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeChildCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> appendChildCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasChildNodesCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> cloneNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> normalizeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> isSupportedCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasAttributesCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> nodeNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> nodeValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void nodeValueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> nodeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> parentNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> childNodesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> firstChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> lastChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> previousSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> nextSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> attributesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> ownerDocumentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> namespaceURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> prefixAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void prefixAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> localNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Node"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("nodeName"), V8Node::nodeNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("nodeValue"), V8Node::nodeValueAttrGetter, V8Node::nodeValueAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("nodeType"), V8Node::nodeTypeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("parentNode"), V8Node::parentNodeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("childNodes"), V8Node::childNodesAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("firstChild"), V8Node::firstChildAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("lastChild"), V8Node::lastChildAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("previousSibling"), V8Node::previousSiblingAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("nextSibling"), V8Node::nextSiblingAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("attributes"), V8Node::attributesAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("ownerDocument"), V8Node::ownerDocumentAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("namespaceURI"), V8Node::namespaceURIAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("prefix"), V8Node::prefixAttrGetter, V8Node::prefixAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("localName"), V8Node::localNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("insertBefore"),
+ v8::FunctionTemplate::New(V8Node::insertBeforeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("replaceChild"),
+ v8::FunctionTemplate::New(V8Node::replaceChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeChild"),
+ v8::FunctionTemplate::New(V8Node::removeChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("appendChild"),
+ v8::FunctionTemplate::New(V8Node::appendChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasChildNodes"),
+ v8::FunctionTemplate::New(V8Node::hasChildNodesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("cloneNode"),
+ v8::FunctionTemplate::New(V8Node::cloneNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("normalize"),
+ v8::FunctionTemplate::New(V8Node::normalizeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("isSupported"),
+ v8::FunctionTemplate::New(V8Node::isSupportedCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasAttributes"),
+ v8::FunctionTemplate::New(V8Node::hasAttributesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+ tmpl->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(5), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(5), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(6), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(6), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(7), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(7), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(8), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(8), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(9), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(9), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(10), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(10), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(11), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(11), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(12), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(12), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp
index bee706e..bc2afb5 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp
@@ -4,41 +4,41 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8NodeList::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8NodeList::Tmpl;
-v8::Handle<v8::Value> V8NodeList::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8NodeList::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0));
- return v8::Integer::New(privData->nativeObj->getLength());
-}
-v8::Handle<v8::Value> V8NodeList::itemCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in item");
+ return v8::Integer::New(privData->nativeObj->getLength());
+ }
+ v8::Handle<v8::Value> V8NodeList::itemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in item");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0));
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0));
+ unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(localIndex));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(localIndex));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
-}
+ }
-bool V8NodeList::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8NodeList::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h
index 771d82c..667af40 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h
@@ -21,7 +21,9 @@
#ifndef V8NodeList_h
#define V8NodeList_h
+#include <string>
#include "DOM/Node.hpp"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -30,40 +32,42 @@ namespace DOM {
class V8NodeList {
public:
- struct V8NodeListPrivate {
- V8DOM* dom;
- Arabica::DOM::NodeList<std::string>* nativeObj;
- };
+ struct V8NodeListPrivate {
+ V8DOM* dom;
+ Arabica::DOM::NodeList<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8NodeListPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8NodeListPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Handle<v8::Value> itemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> itemCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("NodeList"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("NodeList"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
- instance->SetAccessor(v8::String::NewSymbol("length"), V8NodeList::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("length"), V8NodeList::lengthAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- prototype->Set(v8::String::NewSymbol("item"),
- v8::FunctionTemplate::New(V8NodeList::itemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("item"),
+ v8::FunctionTemplate::New(V8NodeList::itemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp
index fade729..6f59a90 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp
@@ -3,35 +3,35 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8NodeSet::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8NodeSet::Tmpl;
-v8::Handle<v8::Value> V8NodeSet::sizeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8NodeSet::sizeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
- return v8::Integer::New(privData->nativeObj->size());
-}
+ return v8::Integer::New(privData->nativeObj->size());
+ }
-v8::Handle<v8::Value> V8NodeSet::emptyAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8NodeSet::emptyAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
- return v8::Boolean::New(privData->nativeObj->empty());
-}
-v8::Handle<v8::Value> V8NodeSet::toDocumentOrderCallback(const v8::Arguments& args) {
+ return v8::Boolean::New(privData->nativeObj->empty());
+ }
+ v8::Handle<v8::Value> V8NodeSet::toDocumentOrderCallback(const v8::Arguments& args) {
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
- privData->nativeObj->to_document_order();
+ privData->nativeObj->to_document_order();
- return v8::Undefined();
-}
+ return v8::Undefined();
+ }
-bool V8NodeSet::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8NodeSet::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h
index 294d851..78e4410 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h
@@ -21,7 +21,9 @@
#ifndef V8NodeSet_h
#define V8NodeSet_h
+#include <string>
#include "DOM/Node.hpp"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -30,45 +32,47 @@ namespace DOM {
class V8NodeSet {
public:
- struct V8NodeSetPrivate {
- V8DOM* dom;
- Arabica::XPath::NodeSet<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8NodeSetPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> toDocumentOrderCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> sizeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> emptyAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("NodeSet"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("size"), V8NodeSet::sizeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("empty"), V8NodeSet::emptyAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- instance->SetIndexedPropertyHandler(V8NodeSet::indexedPropertyCustomGetter, 0);
- prototype->Set(v8::String::NewSymbol("toDocumentOrder"),
- v8::FunctionTemplate::New(V8NodeSet::toDocumentOrderCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8NodeSetPrivate {
+ V8DOM* dom;
+ Arabica::XPath::NodeSet<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8NodeSetPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> toDocumentOrderCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> sizeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> emptyAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("NodeSet"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("size"), V8NodeSet::sizeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("empty"), V8NodeSet::emptyAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ instance->SetIndexedPropertyHandler(V8NodeSet::indexedPropertyCustomGetter, 0);
+ prototype->Set(v8::String::NewSymbol("toDocumentOrder"),
+ v8::FunctionTemplate::New(V8NodeSet::toDocumentOrderCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp
index 129563d..5ecdd10 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp
@@ -4,25 +4,25 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8Notation::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8Notation::Tmpl;
-v8::Handle<v8::Value> V8Notation::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NotationPrivate* privData = V8DOM::toClassPtr<V8NotationPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Notation::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NotationPrivate* privData = V8DOM::toClassPtr<V8NotationPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getPublicId().c_str());
-}
+ return v8::String::New(privData->nativeObj->getPublicId().c_str());
+ }
-v8::Handle<v8::Value> V8Notation::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NotationPrivate* privData = V8DOM::toClassPtr<V8NotationPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Notation::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NotationPrivate* privData = V8DOM::toClassPtr<V8NotationPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getSystemId().c_str());
-}
-bool V8Notation::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ return v8::String::New(privData->nativeObj->getSystemId().c_str());
+ }
+ bool V8Notation::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h
index ba90056..2102a24 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h
@@ -21,8 +21,10 @@
#ifndef V8Notation_h
#define V8Notation_h
+#include <string>
#include "DOM/Node.hpp"
#include "V8Node.h"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -31,41 +33,43 @@ namespace DOM {
class V8Notation {
public:
- struct V8NotationPrivate {
- V8DOM* dom;
- Arabica::DOM::Notation<std::string>* nativeObj;
- };
+ struct V8NotationPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Notation<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8NotationPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8NotationPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Notation"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Notation"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
- instance->SetAccessor(v8::String::NewSymbol("publicId"), V8Notation::publicIdAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("systemId"), V8Notation::systemIdAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("publicId"), V8Notation::publicIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("systemId"), V8Notation::systemIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp
index c6d2b28..f28a56d 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp
@@ -4,32 +4,32 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8ProcessingInstruction::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8ProcessingInstruction::Tmpl;
-v8::Handle<v8::Value> V8ProcessingInstruction::targetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8ProcessingInstruction::targetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getTarget().c_str());
-}
+ return v8::String::New(privData->nativeObj->getTarget().c_str());
+ }
-v8::Handle<v8::Value> V8ProcessingInstruction::dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8ProcessingInstruction::dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getData().c_str());
-}
+ return v8::String::New(privData->nativeObj->getData().c_str());
+ }
-void V8ProcessingInstruction::dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localData(value);
- privData->nativeObj->setData(*localData);
-}
-bool V8ProcessingInstruction::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ void V8ProcessingInstruction::dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(value);
+ privData->nativeObj->setData(*localData);
+ }
+ bool V8ProcessingInstruction::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h
index 995d066..a588b1f 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h
@@ -21,8 +21,10 @@
#ifndef V8ProcessingInstruction_h
#define V8ProcessingInstruction_h
+#include <string>
#include "DOM/Node.hpp"
#include "V8Node.h"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -31,42 +33,44 @@ namespace DOM {
class V8ProcessingInstruction {
public:
- struct V8ProcessingInstructionPrivate {
- V8DOM* dom;
- Arabica::DOM::ProcessingInstruction<std::string>* nativeObj;
- };
+ struct V8ProcessingInstructionPrivate {
+ V8DOM* dom;
+ Arabica::DOM::ProcessingInstruction<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8ProcessingInstructionPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8ProcessingInstructionPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Handle<v8::Value> targetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static void dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> targetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("ProcessingInstruction"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("ProcessingInstruction"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
- instance->SetAccessor(v8::String::NewSymbol("target"), V8ProcessingInstruction::targetAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("data"), V8ProcessingInstruction::dataAttrGetter, V8ProcessingInstruction::dataAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("target"), V8ProcessingInstruction::targetAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("data"), V8ProcessingInstruction::dataAttrGetter, V8ProcessingInstruction::dataAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp
index ed6133a..72c0651 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp
@@ -4,73 +4,73 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8SCXMLEvent::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8SCXMLEvent::Tmpl;
-v8::Handle<v8::Value> V8SCXMLEvent::typeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8SCXMLEvent::typeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
- return v8::Integer::New(privData->nativeObj->type);
-}
+ return v8::Integer::New(privData->nativeObj->type);
+ }
-v8::Handle<v8::Value> V8SCXMLEvent::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8SCXMLEvent::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->name.c_str());
-}
+ return v8::String::New(privData->nativeObj->name.c_str());
+ }
-v8::Handle<v8::Value> V8SCXMLEvent::originAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8SCXMLEvent::originAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->origin.c_str());
-}
+ return v8::String::New(privData->nativeObj->origin.c_str());
+ }
-v8::Handle<v8::Value> V8SCXMLEvent::origintypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8SCXMLEvent::origintypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->origintype.c_str());
-}
+ return v8::String::New(privData->nativeObj->origintype.c_str());
+ }
-v8::Handle<v8::Value> V8SCXMLEvent::domAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8SCXMLEvent::domAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
- if (!privData->nativeObj->dom) return v8::Undefined();
- Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->dom);
+ if (!privData->nativeObj->dom) return v8::Undefined();
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->dom);
- v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
- return arbaicaRetObj;
+ }
-}
+ v8::Handle<v8::Value> V8SCXMLEvent::sendidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
-v8::Handle<v8::Value> V8SCXMLEvent::sendidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+ return v8::String::New(privData->nativeObj->sendid.c_str());
+ }
- return v8::String::New(privData->nativeObj->sendid.c_str());
-}
+ v8::Handle<v8::Value> V8SCXMLEvent::invokeidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
-v8::Handle<v8::Value> V8SCXMLEvent::invokeidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+ return v8::String::New(privData->nativeObj->invokeid.c_str());
+ }
+ bool V8SCXMLEvent::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
- return v8::String::New(privData->nativeObj->invokeid.c_str());
-}
-bool V8SCXMLEvent::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h
index 26ac8b6..a1c76c1 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h
@@ -21,7 +21,9 @@
#ifndef V8SCXMLEvent_h
#define V8SCXMLEvent_h
+#include <string>
#include "DOM/Node.hpp"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -30,61 +32,63 @@ namespace DOM {
class V8SCXMLEvent {
public:
- struct V8SCXMLEventPrivate {
- V8DOM* dom;
- uscxml::Event* nativeObj;
- };
-
- V8_DESTRUCTOR_KEEP_WRAPPED(V8SCXMLEventPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
-
- static v8::Handle<v8::Value> typeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> originAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> origintypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> domAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> sendidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> invokeidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("SCXMLEvent"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("type"), V8SCXMLEvent::typeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("name"), V8SCXMLEvent::nameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("origin"), V8SCXMLEvent::originAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("origintype"), V8SCXMLEvent::origintypeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("dom"), V8SCXMLEvent::domAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("sendid"), V8SCXMLEvent::sendidAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("invokeid"), V8SCXMLEvent::invokeidAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
-
- tmpl->Set(v8::String::NewSymbol("INTERNAL"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("INTERNAL"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("EXTERNAL"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("EXTERNAL"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("PLATFORM"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("PLATFORM"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8SCXMLEventPrivate {
+ V8DOM* dom;
+ uscxml::Event* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8SCXMLEventPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+ static v8::Handle<v8::Value> typeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> originAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> origintypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> domAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> sendidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> invokeidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("SCXMLEvent"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("type"), V8SCXMLEvent::typeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("name"), V8SCXMLEvent::nameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("origin"), V8SCXMLEvent::originAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("origintype"), V8SCXMLEvent::origintypeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("dom"), V8SCXMLEvent::domAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("sendid"), V8SCXMLEvent::sendidAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("invokeid"), V8SCXMLEvent::invokeidAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+
+ tmpl->Set(v8::String::NewSymbol("INTERNAL"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("INTERNAL"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("EXTERNAL"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("EXTERNAL"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("PLATFORM"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("PLATFORM"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp
index 42b298a..fb027d5 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp
@@ -4,34 +4,34 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8Text::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8Text::Tmpl;
-v8::Handle<v8::Value> V8Text::splitTextCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in splitText");
+ v8::Handle<v8::Value> V8Text::splitTextCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in splitText");
- v8::Local<v8::Object> self = args.Holder();
- struct V8TextPrivate* privData = V8DOM::toClassPtr<V8TextPrivate >(self->GetInternalField(0));
- unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8TextPrivate* privData = V8DOM::toClassPtr<V8TextPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
- Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->nativeObj->splitText(localOffset));
- v8::Handle<v8::Function> retCtor = V8Text::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->nativeObj->splitText(localOffset));
+ v8::Handle<v8::Function> retCtor = V8Text::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Text::V8TextPrivate* retPrivData = new V8Text::V8TextPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Text::V8TextPrivate* retPrivData = new V8Text::V8TextPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Text::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Text::jsDestructor);
+ return retObj;
-}
+ }
-bool V8Text::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8Text::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h
index 4861dc8..bbf2577 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h
@@ -21,8 +21,10 @@
#ifndef V8Text_h
#define V8Text_h
+#include <string>
#include "DOM/Node.hpp"
#include "V8CharacterData.h"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -31,38 +33,40 @@ namespace DOM {
class V8Text {
public:
- struct V8TextPrivate {
- V8DOM* dom;
- Arabica::DOM::Text<std::string>* nativeObj;
- };
+ struct V8TextPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Text<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8TextPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8TextPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Handle<v8::Value> splitTextCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> splitTextCallback(const v8::Arguments&);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Text"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Text"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
- prototype->Set(v8::String::NewSymbol("splitText"),
- v8::FunctionTemplate::New(V8Text::splitTextCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("splitText"),
+ v8::FunctionTemplate::New(V8Text::splitTextCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- tmpl->Inherit(V8CharacterData::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ tmpl->Inherit(V8CharacterData::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp
index 968e53d..38f69ae 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp
@@ -4,82 +4,82 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8XPathResult::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8XPathResult::Tmpl;
-v8::Handle<v8::Value> V8XPathResult::numberValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8XPathResult::numberValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- return v8::Number::New(privData->nativeObj->asNumber());
-}
+ return v8::Number::New(privData->nativeObj->asNumber());
+ }
-v8::Handle<v8::Value> V8XPathResult::stringValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8XPathResult::stringValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->asString().c_str());
-}
+ return v8::String::New(privData->nativeObj->asString().c_str());
+ }
-v8::Handle<v8::Value> V8XPathResult::booleanValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8XPathResult::booleanValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- return v8::Boolean::New(privData->nativeObj->asBool());
-}
-v8::Handle<v8::Value> V8XPathResult::asNodeSetCallback(const v8::Arguments& args) {
+ return v8::Boolean::New(privData->nativeObj->asBool());
+ }
+ v8::Handle<v8::Value> V8XPathResult::asNodeSetCallback(const v8::Arguments& args) {
- v8::Local<v8::Object> self = args.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- Arabica::XPath::NodeSet<std::string>* retVal = new Arabica::XPath::NodeSet<std::string>(privData->nativeObj->asNodeSet());
- v8::Handle<v8::Function> retCtor = V8NodeSet::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::XPath::NodeSet<std::string>* retVal = new Arabica::XPath::NodeSet<std::string>(privData->nativeObj->asNodeSet());
+ v8::Handle<v8::Function> retCtor = V8NodeSet::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8NodeSet::V8NodeSetPrivate* retPrivData = new V8NodeSet::V8NodeSetPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8NodeSet::V8NodeSetPrivate* retPrivData = new V8NodeSet::V8NodeSetPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8NodeSet::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8NodeSet::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8XPathResult::asBoolCallback(const v8::Arguments& args) {
+ v8::Handle<v8::Value> V8XPathResult::asBoolCallback(const v8::Arguments& args) {
- v8::Local<v8::Object> self = args.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- bool retVal = privData->nativeObj->asBool();
+ bool retVal = privData->nativeObj->asBool();
- return v8::Boolean::New(retVal);
-}
+ return v8::Boolean::New(retVal);
+ }
-v8::Handle<v8::Value> V8XPathResult::asStringCallback(const v8::Arguments& args) {
+ v8::Handle<v8::Value> V8XPathResult::asStringCallback(const v8::Arguments& args) {
- v8::Local<v8::Object> self = args.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- std::string retVal = privData->nativeObj->asString();
+ std::string retVal = privData->nativeObj->asString();
- return v8::String::New(retVal.c_str());
-}
+ return v8::String::New(retVal.c_str());
+ }
-v8::Handle<v8::Value> V8XPathResult::asNumberCallback(const v8::Arguments& args) {
+ v8::Handle<v8::Value> V8XPathResult::asNumberCallback(const v8::Arguments& args) {
- v8::Local<v8::Object> self = args.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- double retVal = privData->nativeObj->asNumber();
+ double retVal = privData->nativeObj->asNumber();
- return v8::Number::New(retVal);
-}
+ return v8::Number::New(retVal);
+ }
-bool V8XPathResult::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8XPathResult::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h
index 9a3bf4d..1fae618 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h
@@ -21,7 +21,9 @@
#ifndef V8XPathResult_h
#define V8XPathResult_h
+#include <string>
#include "DOM/Node.hpp"
+#include "string"
#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
#include <v8.h>
@@ -30,58 +32,60 @@ namespace DOM {
class V8XPathResult {
public:
- struct V8XPathResultPrivate {
- V8DOM* dom;
- Arabica::XPath::XPathValue<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8XPathResultPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> asNodeSetCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> asBoolCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> asStringCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> asNumberCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> numberValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> stringValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> booleanValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> singleNodeValueCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("XPathResult"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("numberValue"), V8XPathResult::numberValueAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("stringValue"), V8XPathResult::stringValueAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("booleanValue"), V8XPathResult::booleanValueAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("singleNodeValue"), V8XPathResult::singleNodeValueCustomAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("asNodeSet"),
- v8::FunctionTemplate::New(V8XPathResult::asNodeSetCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("asBool"),
- v8::FunctionTemplate::New(V8XPathResult::asBoolCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("asString"),
- v8::FunctionTemplate::New(V8XPathResult::asStringCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("asNumber"),
- v8::FunctionTemplate::New(V8XPathResult::asNumberCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8XPathResultPrivate {
+ V8DOM* dom;
+ Arabica::XPath::XPathValue<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8XPathResultPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> asNodeSetCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> asBoolCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> asStringCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> asNumberCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> numberValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> stringValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> booleanValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> singleNodeValueCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("XPathResult"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("numberValue"), V8XPathResult::numberValueAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("stringValue"), V8XPathResult::stringValueAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("booleanValue"), V8XPathResult::booleanValueAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("singleNodeValue"), V8XPathResult::singleNodeValueCustomAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("asNodeSet"),
+ v8::FunctionTemplate::New(V8XPathResult::asNodeSetCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("asBool"),
+ v8::FunctionTemplate::New(V8XPathResult::asBoolCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("asString"),
+ v8::FunctionTemplate::New(V8XPathResult::asStringCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("asNumber"),
+ v8::FunctionTemplate::New(V8XPathResult::asNumberCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/element/fetch/FetchElement.cpp b/src/uscxml/plugins/element/fetch/FetchElement.cpp
new file mode 100644
index 0000000..33cb76e
--- /dev/null
+++ b/src/uscxml/plugins/element/fetch/FetchElement.cpp
@@ -0,0 +1,108 @@
+#include "FetchElement.h"
+#include <glog/logging.h>
+
+#include <event2/http.h>
+#include <event2/http_struct.h>
+
+#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 FetchElementProvider() );
+ return true;
+}
+#endif
+
+boost::shared_ptr<ExecutableContentImpl> FetchElement::create(Interpreter* interpreter) {
+ boost::shared_ptr<FetchElement> invoker = boost::shared_ptr<FetchElement>(new FetchElement());
+ invoker->_interpreter = interpreter;
+ return invoker;
+}
+
+FetchElement::~FetchElement() {
+ URLFetcher::breakURL(_targetUrl);
+}
+
+void FetchElement::downloadCompleted(const URL& url) {
+ Event event;
+ event.name = _callback;
+
+ std::string content = url.getInContent();
+ std::map<std::string, std::string> headerFields = url.getInHeaderFields();
+
+ if (false) {
+ } else if (boost::iequals(_type, "text")) {
+ event.data.atom = content;
+ event.data.type = Data::VERBATIM;
+ } else if (boost::iequals(_type, "url")) {
+ } else if (boost::iequals(_type, "json")) {
+ event.data = Data::fromJSON(content);
+ } else if (boost::iequals(_type, "xml")) {
+ event = Event::fromXML(content);
+ }
+
+ _interpreter->receive(event);
+
+}
+
+void FetchElement::downloadFailed(const URL& url, int errorCode) {
+ Event event;
+ event.name = _callback + ".failed";
+
+ _interpreter->receive(event);
+
+}
+
+void FetchElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ if (!HAS_ATTR(node, "target") && !HAS_ATTR(node, "targetexpr")) {
+ LOG(ERROR) << "Fetch element requires target or targetexpr";
+ return;
+ }
+ if (HAS_ATTR(node, "targetexpr") && !_interpreter->getDataModel()) {
+ LOG(ERROR) << "Fetch element with targetexpr requires datamodel";
+ return;
+ }
+ _target = (HAS_ATTR(node, "target") ? ATTR(node, "target") : _interpreter->getDataModel().evalAsString(ATTR(node, "targetexpr")));
+
+ if (!HAS_ATTR(node, "callback") && !HAS_ATTR(node, "callbackexpr")) {
+ LOG(ERROR) << "Fetch element requires callback or callbackexpr";
+ return;
+ }
+ if (HAS_ATTR(node, "callbackexpr") && !_interpreter->getDataModel()) {
+ LOG(ERROR) << "Fetch element with callbackexpr requires datamodel";
+ return;
+ }
+ _callback = (HAS_ATTR(node, "callback") ? ATTR(node, "callback") : _interpreter->getDataModel().evalAsString(ATTR(node, "callbackexpr")));
+
+ _type = (HAS_ATTR(node, "type") ? ATTR(node, "type") : "text");
+ if (!boost::iequals(_type, "text") &&
+ !boost::iequals(_type, "url") &&
+ !boost::iequals(_type, "json") &&
+ !boost::iequals(_type, "xml")) {
+ LOG(ERROR) << "Fetch element type attribute not one of text, url, json, xml.";
+ return;
+ }
+
+ _targetUrl = URL(_target);
+ if (!_targetUrl.isAbsolute()) {
+ if (!_interpreter->toAbsoluteURI(_targetUrl)) {
+ LOG(ERROR) << "Cannot transform " << _target << " into absolute URL";
+ return;
+ }
+ }
+
+ _targetUrl.addMonitor(this);
+ URLFetcher::fetchURL(_targetUrl);
+
+}
+
+void FetchElement::exitElement(const Arabica::DOM::Node<std::string>& node) {
+
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/element/fetch/FetchElement.h b/src/uscxml/plugins/element/fetch/FetchElement.h
new file mode 100644
index 0000000..0229048
--- /dev/null
+++ b/src/uscxml/plugins/element/fetch/FetchElement.h
@@ -0,0 +1,48 @@
+#ifndef FETCHELEMENT_H_R6GH94FV
+#define FETCHELEMENT_H_R6GH94FV
+
+#include <uscxml/Interpreter.h>
+
+#ifdef BUILD_AS_PLUGINS
+#include "uscxml/plugins/Plugins.h"
+#endif
+
+namespace uscxml {
+
+class FetchElement : public ExecutableContentImpl, public URLMonitor {
+public:
+ FetchElement() {}
+ virtual ~FetchElement();
+ boost::shared_ptr<ExecutableContentImpl> create(Interpreter* interpreter);
+
+ std::string getLocalName() {
+ return "fetch";
+ }
+
+ std::string getNamespace() {
+ return "http://www.w3.org/2005/07/scxml";
+ }
+
+ bool processChildren() {
+ return false;
+ }
+
+ void enterElement(const Arabica::DOM::Node<std::string>& node);
+ void exitElement(const Arabica::DOM::Node<std::string>& node);
+ void downloadCompleted(const URL& url);
+ void downloadFailed(const URL& url, int errorCode);
+
+protected:
+ URL _targetUrl;
+ std::string _target;
+ std::string _callback;
+ std::string _type;
+};
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_INHERIT_PROVIDER(FetchElement, Element);
+#endif
+
+}
+
+#endif /* end of include guard: FETCHELEMENT_H_R6GH94FV */
diff --git a/src/uscxml/plugins/element/response/ResponseElement.cpp b/src/uscxml/plugins/element/response/ResponseElement.cpp
new file mode 100644
index 0000000..ce25036
--- /dev/null
+++ b/src/uscxml/plugins/element/response/ResponseElement.cpp
@@ -0,0 +1,68 @@
+#include "ResponseElement.h"
+#include "uscxml/plugins/invoker/http/HTTPServletInvoker.h"
+#include <glog/logging.h>
+
+#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 ResponseElementProvider() );
+ return true;
+}
+#endif
+
+boost::shared_ptr<ExecutableContentImpl> ResponseElement::create(Interpreter* interpreter) {
+ boost::shared_ptr<ResponseElement> invoker = boost::shared_ptr<ResponseElement>(new ResponseElement());
+ invoker->_interpreter = interpreter;
+ return invoker;
+}
+
+void ResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ if (!HAS_ATTR(node, "request") && !HAS_ATTR(node, "requestexpr")) {
+ LOG(ERROR) << "Response element requires request or requestexpr";
+ return;
+ }
+ if (HAS_ATTR(node, "requestexpr") && !_interpreter->getDataModel()) {
+ LOG(ERROR) << "Response element with requestexpr requires datamodel";
+ return;
+ }
+ if (HAS_ATTR(node, "close")) {
+
+ }
+
+ std::string requestId = (HAS_ATTR(node, "request") ? ATTR(node, "request") : _interpreter->getDataModel().evalAsString(ATTR(node, "requestexpr")));
+
+ HTTPServletInvoker* servlet = _interpreter->getHTTPServlet();
+ tthread::lock_guard<tthread::recursive_mutex> lock(servlet->getMutex());
+
+ if (servlet->getRequests().find(requestId) == servlet->getRequests().end()) {
+ LOG(ERROR) << "No matching HTTP request for response element";
+ return;
+ }
+
+ std::string statusStr = (HAS_ATTR(node, "status") ? ATTR(node, "status") : "200");
+ if (!isNumeric(statusStr.c_str(), 10)) {
+ LOG(ERROR) << "Response element with non-numeric status " << statusStr;
+ return;
+ }
+ int status = strTo<int>(statusStr);
+
+ HTTPServer::Request httpReq = servlet->getRequests()[requestId];
+
+ HTTPServer::Reply httpReply(httpReq);
+ httpReply.status = status;
+
+ HTTPServer::reply(httpReply);
+ servlet->getRequests().erase(requestId);
+}
+
+void ResponseElement::exitElement(const Arabica::DOM::Node<std::string>& node) {
+
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/element/response/ResponseElement.h b/src/uscxml/plugins/element/response/ResponseElement.h
new file mode 100644
index 0000000..97ff9db
--- /dev/null
+++ b/src/uscxml/plugins/element/response/ResponseElement.h
@@ -0,0 +1,42 @@
+#ifndef RESPONSEELEMENT_H_I11KQ39Q
+#define RESPONSEELEMENT_H_I11KQ39Q
+
+#include <uscxml/Interpreter.h>
+
+#ifdef BUILD_AS_PLUGINS
+#include "uscxml/plugins/Plugins.h"
+#endif
+
+namespace uscxml {
+
+class ResponseElement : public ExecutableContentImpl {
+public:
+ ResponseElement() {}
+ virtual ~ResponseElement() {}
+ boost::shared_ptr<ExecutableContentImpl> create(Interpreter* interpreter);
+
+ std::string getLocalName() {
+ return "response";
+ }
+
+ std::string getNamespace() {
+ return "http://www.w3.org/2005/07/scxml";
+ }
+
+ bool processChildren() {
+ return false;
+ }
+
+ void enterElement(const Arabica::DOM::Node<std::string>& node);
+ void exitElement(const Arabica::DOM::Node<std::string>& node);
+
+};
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_INHERIT_PROVIDER(ResponseElement, Element);
+#endif
+
+}
+
+
+#endif /* end of include guard: RESPONSEELEMENT_H_I11KQ39Q */
diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp
index 8489d1d..2d308ce 100644
--- a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp
+++ b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp
@@ -116,13 +116,13 @@ void DirMonInvoker::handleFileAction(FW::WatchID watchid, const FW::String& dir,
break;
}
- event.compound["file"].compound["name"] = Data(filename, Data::VERBATIM);
- event.compound["file"].compound["dir"] = Data(dir, Data::VERBATIM);
+ event.data.compound["file"].compound["name"] = Data(filename, Data::VERBATIM);
+ event.data.compound["file"].compound["dir"] = Data(dir, Data::VERBATIM);
- event.compound["file"].compound["mtime"] = toStr(fileStat.st_mtime);
- event.compound["file"].compound["ctime"] = toStr(fileStat.st_ctime);
- event.compound["file"].compound["atime"] = toStr(fileStat.st_atime);
- event.compound["file"].compound["size"] = toStr(fileStat.st_size);
+ event.data.compound["file"].compound["mtime"] = toStr(fileStat.st_mtime);
+ event.data.compound["file"].compound["ctime"] = toStr(fileStat.st_ctime);
+ event.data.compound["file"].compound["atime"] = toStr(fileStat.st_atime);
+ event.data.compound["file"].compound["size"] = toStr(fileStat.st_size);
returnEvent(event);
}
@@ -158,8 +158,8 @@ void DirMonInvoker::reportExistingIn(const std::string dir, FW::WatchID watchid)
if (boost::iequals(dname, ".") || boost::iequals(dname, ".."))
continue;
- char* filename;
- asprintf(&filename, "%s/%s", dir.c_str(), dname.c_str());
+ char* filename = (char*)malloc(dir.size() + dname.size() + 2);
+ sprintf(filename, "%s/%s", dir.c_str(), dname.c_str());
struct stat fileStat;
if (stat(filename, &fileStat) != 0) {
diff --git a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp
new file mode 100644
index 0000000..40f8b66
--- /dev/null
+++ b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp
@@ -0,0 +1,147 @@
+#include "HTTPServletInvoker.h"
+#include <glog/logging.h>
+
+#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 HTTPServletInvokerProvider() );
+ return true;
+}
+#endif
+
+HTTPServletInvoker::HTTPServletInvoker() {
+ _isInterpreterGlobal = false;
+}
+
+HTTPServletInvoker::HTTPServletInvoker(Interpreter* interpreter) {
+ _isInterpreterGlobal = true;
+ _interpreter = interpreter;
+ std::stringstream path;
+ path << _interpreter->getName();
+ int i = 2;
+ while(!HTTPServer::registerServlet(path.str(), this)) {
+ path.clear();
+ path.str();
+ path << _interpreter->getName() << toStr(i++);
+ }
+}
+
+HTTPServletInvoker::~HTTPServletInvoker() {
+ HTTPServer::unregisterServlet(this);
+
+};
+
+boost::shared_ptr<IOProcessorImpl> HTTPServletInvoker::create(Interpreter* interpreter) {
+ boost::shared_ptr<HTTPServletInvoker> invoker = boost::shared_ptr<HTTPServletInvoker>(new HTTPServletInvoker());
+ invoker->_interpreter = interpreter;
+ return invoker;
+}
+
+Data HTTPServletInvoker::getDataModelVariables() {
+ Data data;
+ assert(_url.length() > 0);
+ data.compound["location"] = Data(_url, Data::VERBATIM);
+ return data;
+}
+
+void HTTPServletInvoker::send(const SendRequest& req) {
+ assert(!_isInterpreterGlobal);
+
+ if (req.name.find("reply.", 0, req.name.length())) {
+ // this is a reply
+ const std::string requestId = req.name.substr(6);
+ if (_requests.find(requestId) == _requests.end()) {
+ LOG(ERROR) << "Replying to non existing request " << requestId;
+ return;
+ }
+
+ HTTPServer::Request httpRequest = _requests[requestId];
+ HTTPServer::Reply httpReply(httpRequest);
+ httpReply.content = req.content;
+
+ std::map<std::string, std::string>::const_iterator nameListIter = req.namelist.begin();
+ while(nameListIter != req.namelist.end()) {
+ httpReply.headers[nameListIter->first] = nameListIter->second;
+ nameListIter++;
+ }
+
+ std::multimap<std::string, std::string>::const_iterator paramIter = req.params.begin();
+ while(paramIter != req.params.end()) {
+ httpReply.headers[paramIter->first] = paramIter->second;
+ paramIter++;
+ }
+
+ HTTPServer::reply(httpReply);
+ return;
+ }
+}
+
+void HTTPServletInvoker::cancel(const std::string sendId) {
+ assert(!_isInterpreterGlobal);
+}
+
+void HTTPServletInvoker::invoke(const InvokeRequest& req) {
+ assert(!_isInterpreterGlobal);
+
+ _invokeId = req.invokeid;
+ if (req.params.find("path") == req.params.end()) {
+ LOG(ERROR) << "Path parameter required with httpserver";
+ }
+ _path = (*req.params.find("path")).second;
+
+ if (req.params.find("callback") != req.params.end()) {
+ _callback = (*req.params.find("callback")).second;
+ } else {
+ _callback = _path;
+ std::replace(_callback.begin(), _callback.end(), '/', '.');
+ }
+
+ if (!HTTPServer::registerServlet(_path, this)) {
+ LOG(ERROR) << "Cannot register http servlet at " << _path << ": " << " already taken";
+ }
+}
+
+/**
+ * Receive a request and deliver it to the interpreter
+ */
+void HTTPServletInvoker::httpRecvRequest(const HTTPServer::Request& req) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+
+// evhttp_request_own(req.curlReq);
+
+ _requests[toStr((uintptr_t)req.curlReq)] = req;
+
+ Event event;
+
+ if (_isInterpreterGlobal) {
+ event.name = "http." + req.type;
+ event.origin = toStr((uintptr_t)req.curlReq);
+ } else {
+ event.name = _callback;
+ event.data.compound["reqId"] = Data(toStr((uintptr_t)req.curlReq), Data::VERBATIM);
+ }
+
+ std::map<std::string, std::string>::const_iterator headerIter = req.headers.begin();
+ while(headerIter != req.headers.end()) {
+ event.data.compound["headers"].compound[headerIter->first] = Data(headerIter->second, Data::VERBATIM);
+ headerIter++;
+ }
+
+ event.data.compound["content"] = Data(req.content, Data::VERBATIM);
+ event.data.compound["type"] = Data(req.type, Data::VERBATIM);
+
+ returnEvent(event);
+
+}
+
+std::string HTTPServletInvoker::getPath() {
+ return _path;
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h
new file mode 100644
index 0000000..1d667de
--- /dev/null
+++ b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h
@@ -0,0 +1,55 @@
+#ifndef HTTPSERVERINVOKER_H_OAAWX8NF
+#define HTTPSERVERINVOKER_H_OAAWX8NF
+
+#include <uscxml/Interpreter.h>
+#include <uscxml/server/HTTPServer.h>
+
+#ifdef BUILD_AS_PLUGINS
+#include "uscxml/plugins/Plugins.h"
+#endif
+
+namespace uscxml {
+
+class HTTPServletInvoker : public InvokerImpl, public HTTPServlet {
+public:
+ HTTPServletInvoker();
+ HTTPServletInvoker(Interpreter* interpreter);
+ virtual ~HTTPServletInvoker();
+ virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter);
+
+ virtual std::set<std::string> getNames() {
+ std::set<std::string> names;
+ names.insert("httpserver");
+ names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#httpserver");
+ return names;
+ }
+
+ virtual Data getDataModelVariables();
+ virtual void send(const SendRequest& req);
+ virtual void cancel(const std::string sendId);
+ virtual void invoke(const InvokeRequest& req);
+
+ // HTTPServlet
+ virtual void httpRecvRequest(const HTTPServer::Request& req);
+ virtual std::string getPath();
+ virtual void setURL(const std::string& url) { _url = url; }
+
+ tthread::recursive_mutex& getMutex() { return _mutex; }
+ std::map<std::string, HTTPServer::Request>& getRequests() { return _requests; }
+
+protected:
+ tthread::recursive_mutex _mutex;
+ std::map<std::string, HTTPServer::Request> _requests;
+ std::string _path;
+ std::string _callback;
+ std::string _url;
+ bool _isInterpreterGlobal;
+};
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_INHERIT_PROVIDER(HTTPServletInvoker, Invoker);
+#endif
+
+}
+
+#endif /* end of include guard: HTTPSERVERINVOKER_H_OAAWX8NF */
diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
index 1e15865..4005d03 100644
--- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
+++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
@@ -77,7 +77,7 @@ void UmundoInvoker::send(const SendRequest& req) {
Event event;
void* rv = NULL;
stub->callStubMethod(req.name, pbMsg, type, rv, "");
- protobufToData(event, *(const google::protobuf::Message*)rv);
+ protobufToData(event.data, *(const google::protobuf::Message*)rv);
event.name = _invokeId + ".reply." + req.name;
event.origin = msg->getMeta("um.channel");
@@ -162,9 +162,9 @@ void UmundoInvoker::invoke(const InvokeRequest& req) {
} else if (serviceName.length() > 0) {
// use umundo to access services
- _svcFilter = umundo::ServiceFilter(serviceName);
- _node->connect(&_svcMgr);
- _svcMgr.startQuery(_svcFilter, this);
+ _svcFilter = new umundo::ServiceFilter(serviceName);
+ _node->connect(_svcMgr);
+ _svcMgr->startQuery(*_svcFilter, this);
}
}
@@ -185,13 +185,13 @@ void UmundoInvoker::receive(void* object, umundo::Message* msg) {
// event.compound["class"] = msg->getMeta("um.s11n.type");
if (object != NULL)
- protobufToData(event, *(const google::protobuf::Message*)object);
+ protobufToData(event.data, *(const google::protobuf::Message*)object);
// get meta fields into event
std::map<std::string, std::string>::const_iterator metaIter = msg->getMeta().begin();
while(metaIter != msg->getMeta().end()) {
if (metaIter->first.substr(0,3).compare("um.") != 0)
- event.compound[metaIter->first] = Data(metaIter->second, Data::VERBATIM);
+ event.data.compound[metaIter->first] = Data(metaIter->second, Data::VERBATIM);
metaIter++;
}
@@ -213,7 +213,7 @@ void UmundoInvoker::added(umundo::ServiceDescription desc) {
std::map<std::string, std::string>::const_iterator propIter = desc.getProperties().begin();
while(propIter != desc.getProperties().end()) {
- addedEvent.compound[propIter->first] = Data(propIter->second, Data::VERBATIM);
+ addedEvent.data.compound[propIter->first] = Data(propIter->second, Data::VERBATIM);
propIter++;
}
@@ -239,7 +239,7 @@ void UmundoInvoker::removed(umundo::ServiceDescription desc) {
std::map<std::string, std::string>::const_iterator propIter = desc.getProperties().begin();
while(propIter != desc.getProperties().end()) {
- addedEvent.compound[propIter->first] = Data(propIter->second, Data::VERBATIM);
+ addedEvent.data.compound[propIter->first] = Data(propIter->second, Data::VERBATIM);
propIter++;
}
diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
index f03006b..a7f45f1 100644
--- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
+++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
@@ -1,12 +1,12 @@
#ifndef UMUNDOINVOKER_H_77YXQGU7
#define UMUNDOINVOKER_H_77YXQGU7
+#include <uscxml/Interpreter.h>
+#include <google/protobuf/message.h>
#include <umundo/core.h>
#include <umundo/s11n.h>
#include <umundo/rpc.h>
#include <umundo/s11n/protobuf/PBSerializer.h>
-#include <uscxml/Interpreter.h>
-#include <google/protobuf/message.h>
#ifdef BUILD_AS_PLUGINS
#include "uscxml/plugins/Plugins.h"
@@ -51,8 +51,8 @@ protected:
umundo::TypedPublisher* _pub;
umundo::TypedSubscriber* _sub;
- umundo::ServiceFilter _svcFilter;
- umundo::ServiceManager _svcMgr;
+ umundo::ServiceFilter* _svcFilter;
+ umundo::ServiceManager* _svcMgr;
std::map<umundo::ServiceDescription, umundo::ServiceStub*> _svcs;
static std::multimap<std::string, std::pair<std::string, umundo::Node*> > _nodes;
diff --git a/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.cpp
index 98d08b3..ed51ef8 100644
--- a/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.cpp
+++ b/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.cpp
@@ -40,32 +40,25 @@ EventIOProcessor::EventIOProcessor() {
}
EventIOProcessor::~EventIOProcessor() {
- _asyncQueue.stop();
- evdns_base_free(_dns, 1);
- EventIOServer* httpServer = EventIOServer::getInstance();
- httpServer->unregisterProcessor(this);
+ 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());
io->_interpreter = interpreter;
- io->_dns = evdns_base_new(io->_asyncQueue._eventLoop, 1);
- assert(io->_dns);
- assert(evdns_base_count_nameservers(io->_dns) > 0);
-
// register at http server
- EventIOServer* httpServer = EventIOServer::getInstance();
- httpServer->registerProcessor(io.get());
+ std::string path = interpreter->getName();
+ path += "/basichttp";
+ if (!HTTPServer::registerServlet(path, io.get())) {
+ LOG(ERROR) << "Cannot register basichttp ioprocessor at " << path << ": " << " already taken";
+ }
- io->start();
return io;
}
-void EventIOProcessor::start() {
- _asyncQueue.start();
-}
-
Data EventIOProcessor::getDataModelVariables() {
Data data;
assert(_url.length() > 0);
@@ -73,335 +66,107 @@ Data EventIOProcessor::getDataModelVariables() {
return data;
}
-
-void EventIOProcessor::send(const SendRequest& req) {
-
- _sendData[req.sendid] = new SendData();
- _sendData[req.sendid]->scxmlReq = req;
- _sendData[req.sendid]->ioProcessor = this;
-
- int err = 0;
- char uriBuf[1024];
-
- struct evhttp_uri* targetURI = evhttp_uri_parse(_sendData[req.sendid]->scxmlReq.target.c_str());
- if (evhttp_uri_get_port(targetURI) < 0)
- evhttp_uri_set_port(targetURI, 80);
- const char* hostName = evhttp_uri_get_host(targetURI);
-
- // use synchronous dns resolving for multicast dns
- if(hostName && strlen(hostName) >= strlen(".local")) {
- if(strcmp(hostName + strlen(hostName) - strlen(".local"), ".local") == 0) {
- evhttp_uri_set_host(targetURI, EventIOServer::syncResolve(hostName).c_str()) && LOG(ERROR) << "evhttp_uri_set_host: " << strerror(errno);
- }
+void EventIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
+ Event reqEvent;
+ reqEvent.type = Event::EXTERNAL;
+ bool scxmlStructFound = false;
+
+ std::map<std::string, std::string>::const_iterator headerIter = req.headers.begin();
+ while(headerIter != req.headers.end()) {
+ if (boost::iequals("_scxmleventstruct", headerIter->first)) {
+ reqEvent = Event::fromXML(evhttp_decode_uri(headerIter->second.c_str()));
+ scxmlStructFound = true;
+ break;
+ } else if (boost::iequals("_scxmleventname", headerIter->first)) {
+ reqEvent.name = evhttp_decode_uri(headerIter->second.c_str());
+ } else {
+ reqEvent.data.compound[headerIter->first] = Data(evhttp_decode_uri(headerIter->second.c_str()), Data::VERBATIM);
+ }
+ headerIter++;
+ }
+
+ if (reqEvent.name.length() == 0)
+ reqEvent.name = req.type;
+
+ if (!scxmlStructFound) {
+ // get content into event
+ reqEvent.data.compound["content"] = Data(req.content, Data::VERBATIM);
}
- evhttp_uri_join(targetURI, uriBuf, 1024) || LOG(ERROR) << "evhttp_uri_join: " << strerror(errno);
- LOG(INFO) << "URI for send request: " << uriBuf << std::endl;
-
- int port = evhttp_uri_get_port(targetURI);
- if (port <= 0)
- port = 80;
-
- std::stringstream ssEndPoint;
- ssEndPoint << evhttp_uri_get_host(targetURI) << ":" << port;
- std::string endPoint = ssEndPoint.str();
-
- std::stringstream ssLocalURI;
- ssLocalURI << evhttp_uri_get_path(targetURI) << evhttp_uri_get_fragment(targetURI);
- std::string localURI = ssLocalURI.str();
+
+ returnEvent(reqEvent);
+ evhttp_send_reply(req.curlReq, 200, "OK", NULL);
+}
- if (_httpConnections.find(endPoint) == _httpConnections.end()) {
- struct evhttp_connection* conn = evhttp_connection_base_new(_asyncQueue._eventLoop, _dns, evhttp_uri_get_host(targetURI), evhttp_uri_get_port(targetURI));
- evhttp_connection_set_retries(conn, 3);
- _httpConnections[endPoint] = conn;
- }
+void EventIOProcessor::send(const SendRequest& req) {
- struct evhttp_connection* httpConn = _httpConnections[endPoint];
- struct evhttp_request* httpReq = evhttp_request_new(EventIOServer::httpSendReqDoneCallback, _sendData[req.sendid]);
+ std::string target = req.target;
+ URL targetURL(target);
- // event name
+ // event name
if (req.name.size() > 0) {
- evhttp_add_header(evhttp_request_get_output_headers(httpReq), "_scxmleventname", evhttp_encode_uri(req.name.c_str())) && LOG(ERROR) << "evhttp_add_header: " << strerror(errno);
+ targetURL.addOutHeader("_scxmleventname", evhttp_encode_uri(req.name.c_str()));
}
- // event namelist
+ // event namelist
if (req.namelist.size() > 0) {
std::map<std::string, std::string>::const_iterator namelistIter = req.namelist.begin();
while (namelistIter != req.namelist.end()) {
- evhttp_add_header(evhttp_request_get_output_headers(httpReq),
- namelistIter->first.c_str(),
- evhttp_encode_uri(namelistIter->second.c_str()))
- && LOG(ERROR) << "evhttp_add_header: " << strerror(errno);
+ targetURL.addOutHeader(namelistIter->first, namelistIter->second);
namelistIter++;
}
}
- // event params
+ // event params
if (req.params.size() > 0) {
std::multimap<std::string, std::string>::const_iterator paramIter = req.params.begin();
while (paramIter != req.params.end()) {
-// LOG(INFO) << paramIter->first << " = " << paramIter->second << std::endl;
- evhttp_add_header(evhttp_request_get_output_headers(httpReq),
- paramIter->first.c_str(),
- evhttp_encode_uri(paramIter->second.c_str()))
- && LOG(ERROR) << "evhttp_add_header: " << strerror(errno);
+ targetURL.addOutHeader(paramIter->first, paramIter->second);
paramIter++;
}
}
-
+
// content
if (req.content.size() > 0)
- evbuffer_add(evhttp_request_get_output_buffer(httpReq), req.content.c_str(), req.content.size()) && LOG(ERROR) << "evbuffer_add: " << strerror(errno);
-
-#if 0
- evhttp_add_header(evhttp_request_get_output_headers(httpReq), "_scxmleventstruct", evhttp_encode_uri(req.toXMLString().c_str()));
-#endif
- // required as per http 1.1 RFC2616 section 14.23
- evhttp_add_header(evhttp_request_get_output_headers(httpReq), "Host", evhttp_uri_get_host(targetURI)) && LOG(ERROR) << "evhttp_add_header: " << strerror(errno);
-
- _httpRequests[req.sendid] = httpReq;
- err = evhttp_make_request(httpConn,
- httpReq,
- EVHTTP_REQ_POST, localURI.c_str());
- if (err) {
- LOG(ERROR) << "Could not make http request to " << req.target;
- }
-}
+ targetURL.setOutContent(req.content);
-void EventIOProcessor::httpSendReqDone(struct SendData* sendData) {
- if (sendData->httpReq == NULL || evhttp_request_get_response_code(sendData->httpReq) != 200) {
- Event failureEvent;
- failureEvent.name = "error.communication";
- sendData->ioProcessor->returnEvent(failureEvent);
+ targetURL.setRequestType("post");
+ targetURL.addMonitor(this);
+
+ _sendRequests[req.sendid] = std::make_pair(targetURL, req);
+ URLFetcher::fetchURL(targetURL);
+}
+
+void EventIOProcessor::downloadStarted(const URL& url) {}
+
+void EventIOProcessor::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) {
+ _sendRequests.erase(reqIter);
+ return;
+ }
+ reqIter++;
}
- delete _sendData[sendData->scxmlReq.sendid];
-}
-
-void EventIOProcessor::httpRecvReq(struct evhttp_request *req) {
-
- const char *cmdtype;
- struct evkeyvalq *headers;
- struct evkeyval *header;
- struct evbuffer *buf;
-
- switch (evhttp_request_get_command(req)) {
- case EVHTTP_REQ_GET:
- cmdtype = "GET";
- break;
- case EVHTTP_REQ_POST:
- cmdtype = "POST";
- break;
- case EVHTTP_REQ_HEAD:
- cmdtype = "HEAD";
- break;
- case EVHTTP_REQ_PUT:
- cmdtype = "PUT";
- break;
- case EVHTTP_REQ_DELETE:
- cmdtype = "DELETE";
- break;
- case EVHTTP_REQ_OPTIONS:
- cmdtype = "OPTIONS";
- break;
- case EVHTTP_REQ_TRACE:
- cmdtype = "TRACE";
- break;
- case EVHTTP_REQ_CONNECT:
- cmdtype = "CONNECT";
- break;
- case EVHTTP_REQ_PATCH:
- cmdtype = "PATCH";
- break;
- default:
- cmdtype = "unknown";
- break;
- }
-
- Event reqEvent;
- reqEvent.type = Event::EXTERNAL;
- bool scxmlStructFound = false;
-
- // map headers to event structure
- headers = evhttp_request_get_input_headers(req);
- for (header = headers->tqh_first; header;
- header = header->next.tqe_next) {
-// std::cout << "Header: " << header->key << std::endl;
-// std::cout << "Value: " << evhttp_decode_uri(header->value) << std::endl;
- if (boost::iequals("_scxmleventstruct", header->key)) {
- reqEvent = Event::fromXML(evhttp_decode_uri(header->value));
- scxmlStructFound = true;
- break;
- } else if (boost::iequals("_scxmleventname", header->key)) {
- reqEvent.name = evhttp_decode_uri(header->value);
- } else {
- reqEvent.compound[header->key] = Data(evhttp_decode_uri(header->value), Data::VERBATIM);
- }
- }
-
- if (reqEvent.name.length() == 0)
- reqEvent.name = cmdtype;
-
- if (!scxmlStructFound) {
- // get content into event
- std::string content;
- buf = evhttp_request_get_input_buffer(req);
- while (evbuffer_get_length(buf)) {
- int n;
- char cbuf[128];
- n = evbuffer_remove(buf, cbuf, sizeof(buf)-1);
- if (n > 0) {
- content.append(cbuf, n);
- }
- }
- reqEvent.compound["content"] = Data(content, Data::VERBATIM);
- }
-
- returnEvent(reqEvent);
- evhttp_send_reply(req, 200, "OK", NULL);
-}
-
-EventIOServer::EventIOServer(unsigned short port) {
- _port = port;
- _base = event_base_new();
- _http = evhttp_new(_base);
- _handle = NULL;
- while((_handle = evhttp_bind_socket_with_handle(_http, INADDR_ANY, _port)) == NULL) {
- _port++;
- }
- determineAddress();
-}
-
-EventIOServer::~EventIOServer() {
+ assert(false);
}
-EventIOServer* EventIOServer::_instance = NULL;
-tthread::recursive_mutex EventIOServer::_instanceMutex;
-
-EventIOServer* EventIOServer::getInstance() {
- tthread::lock_guard<tthread::recursive_mutex> lock(_instanceMutex);
- if (_instance == NULL) {
- _instance = new EventIOServer(8080);
- _instance->start();
- }
- return _instance;
-}
-
-void EventIOServer::registerProcessor(EventIOProcessor* processor) {
- EventIOServer* INSTANCE = getInstance();
- tthread::lock_guard<tthread::recursive_mutex> lock(INSTANCE->_mutex);
-
- /**
- * Determine path for interpreter.
- *
- * If the interpreter has a name and it is not yet taken, choose it as the path
- * for requests. If the interpreters name path is already taken, append digits
- * until we have an available path.
- *
- * If the interpreter does not specify a name, take its sessionid.
- */
-
- std::string path = processor->getPath();
- if (path.size() == 0) {
- path = processor->_interpreter->getSessionId();
- }
- assert(path.size() > 0);
-
- std::stringstream actualPath(path);
- int i = 1;
- while(INSTANCE->_processors.find(actualPath.str()) != INSTANCE->_processors.end()) {
- actualPath.str(std::string());
- actualPath.clear();
- actualPath << path << ++i;
- }
-
- std::stringstream processorURL;
- processorURL << "http://" << INSTANCE->_address << ":" << INSTANCE->_port << "/" << actualPath.str();
-
- INSTANCE->_processors[actualPath.str()] = processor;
- processor->setURL(processorURL.str());
-
- LOG(INFO) << "SCXML listening at: " << processorURL.str() << std::endl;
-
- evhttp_set_cb(INSTANCE->_http, ("/" + actualPath.str()).c_str(), EventIOServer::httpRecvReqCallback, processor);
+void EventIOProcessor::downloadFailed(const URL& url, int errorCode) {
-// evhttp_set_cb(THIS->_http, "/", EventIOProcessor::httpRecvReq, processor);
-// evhttp_set_gencb(THIS->_http, EventIOProcessor::httpRecvReq, NULL);
-}
-
-void EventIOServer::unregisterProcessor(EventIOProcessor* processor) {
- EventIOServer* INSTANCE = getInstance();
- tthread::lock_guard<tthread::recursive_mutex> lock(INSTANCE->_mutex);
- evhttp_del_cb(INSTANCE->_http, processor->_url.c_str());
-}
-
-void EventIOServer::start() {
- _isRunning = true;
- _thread = new tthread::thread(EventIOServer::run, this);
-}
-
-void EventIOServer::run(void* instance) {
- EventIOServer* INSTANCE = (EventIOServer*)instance;
- while(INSTANCE->_isRunning) {
- event_base_dispatch(INSTANCE->_base);
- }
- LOG(INFO) << "HTTP Server stopped" << std::endl;
-}
-
-std::string EventIOServer::syncResolve(const std::string& hostname) {
- struct hostent *he;
- struct in_addr **addr_list;
- int i;
+ std::map<std::string, std::pair<URL, SendRequest> >::iterator reqIter = _sendRequests.begin();
+ while(reqIter != _sendRequests.end()) {
+ if (reqIter->second.first == url) {
+ Event failEvent;
+ failEvent.name = "error.communication";
+ returnEvent(failEvent);
+
+ _sendRequests.erase(reqIter);
+ return;
+ }
+ reqIter++;
+ }
+ assert(false);
- if ( (he = gethostbyname( hostname.c_str() ) ) != NULL) {
- addr_list = (struct in_addr **) he->h_addr_list;
- for(i = 0; addr_list[i] != NULL; i++) {
- return std::string(inet_ntoa(*addr_list[i]));
- }
- }
- return "";
}
-void EventIOServer::determineAddress() {
-
- char hostname[1024];
- gethostname(hostname, 1024);
- _address = std::string(hostname);
-
-#if 0
- struct sockaddr_storage ss;
- evutil_socket_t fd;
- ev_socklen_t socklen = sizeof(ss);
- char addrbuf[128];
-
- void *inaddr;
- const char *addr;
- int got_port = -1;
- fd = evhttp_bound_socket_get_fd(_handle);
- memset(&ss, 0, sizeof(ss));
- if (getsockname(fd, (struct sockaddr *)&ss, &socklen)) {
- perror("getsockname() failed");
- return;
- }
-
- if (ss.ss_family == AF_INET) {
- got_port = ntohs(((struct sockaddr_in*)&ss)->sin_port);
- inaddr = &((struct sockaddr_in*)&ss)->sin_addr;
- } else if (ss.ss_family == AF_INET6) {
- got_port = ntohs(((struct sockaddr_in6*)&ss)->sin6_port);
- inaddr = &((struct sockaddr_in6*)&ss)->sin6_addr;
- } else {
- fprintf(stderr, "Weird address family %d\n",
- ss.ss_family);
- return;
- }
- addr = evutil_inet_ntop(ss.ss_family, inaddr, addrbuf,
- sizeof(addrbuf));
- if (addr) {
- _address = std::string(addr);
- } else {
- fprintf(stderr, "evutil_inet_ntop failed\n");
- return;
- }
-#endif
-}
} \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h b/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h
index 7dd1c41..416761f 100644
--- a/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h
+++ b/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h
@@ -2,6 +2,7 @@
#define EVENTIOPROCESSOR_H_2CUY93KU
#include "uscxml/concurrency/eventqueue/DelayedEventQueue.h"
+#include "uscxml/server/HTTPServer.h"
#include "uscxml/Interpreter.h"
#include "uscxml/Factory.h"
#ifndef _WIN32
@@ -19,14 +20,8 @@ namespace uscxml {
class EventIOServer;
-class EventIOProcessor : public IOProcessorImpl {
+class EventIOProcessor : public IOProcessorImpl, public HTTPServlet, public URLMonitor {
public:
- struct SendData {
- EventIOProcessor* ioProcessor;
- uscxml::SendRequest scxmlReq;
- evhttp_request* httpReq;
- };
-
EventIOProcessor();
virtual ~EventIOProcessor();
virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::Interpreter* interpreter);
@@ -41,73 +36,19 @@ public:
virtual void send(const SendRequest& req);
Data getDataModelVariables();
- void setURL(const std::string& url) {
- _url = url;
- }
- void start();
- static void run(void* instance);
+ /// HTTPServlet
+ void httpRecvRequest(const HTTPServer::Request& req);
+ void setURL(const std::string& url) { _url = url; }
- virtual std::string getPath() { return _interpreter->getName(); }
- virtual void httpSendReqDone(struct SendData* sendData);
- virtual void httpRecvReq(struct evhttp_request *req);
+ // URLMonitor
+ void downloadStarted(const URL& url);
+ void downloadCompleted(const URL& url);
+ void downloadFailed(const URL& url, int errorCode);
protected:
- std::map<std::string, SendData*> _sendData;
-
std::string _url;
-
- uscxml::DelayedEventQueue _asyncQueue;
- std::map<std::string, struct evhttp_connection*> _httpConnections;
- std::map<std::string, struct evhttp_request*> _httpRequests;
- struct evdns_base* _dns;
-
- friend class EventIOServer;
-};
-
-class EventIOServer {
-public:
- static EventIOServer* getInstance();
-
- static void registerProcessor(EventIOProcessor* processor);
- static void unregisterProcessor(EventIOProcessor* processor);
-
-private:
- EventIOServer(unsigned short port);
- ~EventIOServer();
-
- void start();
- void stop();
- static void run(void* instance);
-
- void determineAddress();
- static std::string syncResolve(const std::string& hostname);
-
- static void httpSendReqDoneCallback(struct evhttp_request *req, void *cb_arg) {
- EventIOProcessor::SendData* sendData = (EventIOProcessor::SendData*)cb_arg;
- sendData->httpReq = req;
- sendData->ioProcessor->httpSendReqDone(sendData);
- }
- static void httpRecvReqCallback(struct evhttp_request *req, void *cb_arg) {
- ((EventIOProcessor*)cb_arg)->httpRecvReq(req);
- }
-
- std::map<std::string, EventIOProcessor*> _processors;
-
- struct event_base* _base;
- struct evhttp* _http;
- struct evhttp_bound_socket* _handle;
-
- unsigned short _port;
- std::string _address;
-
- static EventIOServer* _instance;
- static tthread::recursive_mutex _instanceMutex;
- tthread::thread* _thread;
- tthread::recursive_mutex _mutex;
- bool _isRunning;
-
- friend class EventIOProcessor;
+ std::map<std::string, std::pair<URL, SendRequest> > _sendRequests;
};
#ifdef BUILD_AS_PLUGINS
diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp
new file mode 100644
index 0000000..e151f9e
--- /dev/null
+++ b/src/uscxml/server/HTTPServer.cpp
@@ -0,0 +1,223 @@
+#ifdef _WIN32
+#include <winsock2.h>
+#include <windows.h>
+#endif
+
+#include "uscxml/server/HTTPServer.h"
+#include "uscxml/Message.h"
+#include <iostream>
+#include <event2/dns.h>
+#include <event2/event.h>
+#include <event2/buffer.h>
+#include <event2/http.h>
+#include <event2/keyvalq_struct.h>
+#include <event2/http_struct.h>
+#include <event2/thread.h>
+
+#include <string.h>
+
+#include <glog/logging.h>
+#include <boost/algorithm/string.hpp>
+
+#ifndef _WIN32
+#include <netdb.h>
+#include <arpa/inet.h>
+#endif
+
+#ifdef BUILD_AS_PLUGINS
+#include <Pluma/Connector.hpp>
+#endif
+
+namespace uscxml {
+
+HTTPServer::HTTPServer(unsigned short port) {
+ _port = port;
+ _base = event_base_new();
+ _http = evhttp_new(_base);
+ _handle = NULL;
+ while((_handle = evhttp_bind_socket_with_handle(_http, INADDR_ANY, _port)) == NULL) {
+ _port++;
+ }
+ determineAddress();
+}
+
+HTTPServer::~HTTPServer() {
+}
+
+HTTPServer* HTTPServer::_instance = NULL;
+tthread::recursive_mutex HTTPServer::_instanceMutex;
+
+HTTPServer* HTTPServer::getInstance(int port) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_instanceMutex);
+ if (_instance == NULL) {
+#ifndef _WIN32
+ evthread_use_pthreads();
+#else
+ evthread_use_windows_threads();
+#endif
+ _instance = new HTTPServer(port);
+ _instance->start();
+ }
+ return _instance;
+}
+
+void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackData) {
+// std::cout << (uintptr_t)req << ": Replying" << std::endl;
+// evhttp_send_reply(req, 200, NULL, NULL);
+// return;
+
+ Request request;
+ request.curlReq = req;
+
+ switch (evhttp_request_get_command(req)) {
+ case EVHTTP_REQ_GET:
+ request.type = "GET";
+ break;
+ case EVHTTP_REQ_POST:
+ request.type = "POST";
+ break;
+ case EVHTTP_REQ_HEAD:
+ request.type = "HEAD";
+ break;
+ case EVHTTP_REQ_PUT:
+ request.type = "PUT";
+ break;
+ case EVHTTP_REQ_DELETE:
+ request.type = "DELETE";
+ break;
+ case EVHTTP_REQ_OPTIONS:
+ request.type = "OPTIONS";
+ break;
+ case EVHTTP_REQ_TRACE:
+ request.type = "TRACE";
+ break;
+ case EVHTTP_REQ_CONNECT:
+ request.type = "CONNECT";
+ break;
+ case EVHTTP_REQ_PATCH:
+ request.type = "PATCH";
+ break;
+ default:
+ request.type = "unknown";
+ break;
+ }
+
+ struct evkeyvalq *headers;
+ struct evkeyval *header;
+ struct evbuffer *buf;
+
+ // map headers to event structure
+ headers = evhttp_request_get_input_headers(req);
+ for (header = headers->tqh_first; header; header = header->next.tqe_next) {
+ request.headers[header->key] = header->value;
+ }
+
+ request.remoteHost = req->remote_host;
+ request.remotePort = req->remote_port;
+ request.httpMajor = req->major;
+ request.httpMinor = req->minor;
+ request.uri = req->uri;
+
+ // get content
+ buf = evhttp_request_get_input_buffer(req);
+ while (evbuffer_get_length(buf)) {
+ int n;
+ char cbuf[1024];
+ n = evbuffer_remove(buf, cbuf, sizeof(buf)-1);
+ if (n > 0) {
+ request.content.append(cbuf, n);
+ }
+ }
+
+ ((HTTPServlet*)callbackData)->httpRecvRequest(request);
+}
+
+void HTTPServer::reply(const Reply& reply) {
+ struct evbuffer *evb = evbuffer_new();
+
+ std::map<std::string, std::string>::const_iterator headerIter = reply.headers.begin();
+ while(headerIter != reply.headers.end()) {
+ evhttp_add_header(evhttp_request_get_output_headers(reply.curlReq), headerIter->first.c_str(), headerIter->second.c_str());
+ headerIter++;
+ }
+
+ if (!boost::iequals(reply.type, "HEAD"))
+ evbuffer_add(evb, reply.content.data(), reply.content.size());
+
+ evhttp_send_reply(reply.curlReq, reply.status, NULL, evb);
+ evbuffer_free(evb);
+// evhttp_request_free(reply.curlReq);
+
+}
+
+bool HTTPServer::registerServlet(const std::string& path, HTTPServlet* servlet) {
+ HTTPServer* INSTANCE = getInstance();
+ tthread::lock_guard<tthread::recursive_mutex> lock(INSTANCE->_mutex);
+
+ /**
+ * Determine path for interpreter.
+ *
+ * If the interpreter has a name and it is not yet taken, choose it as the path
+ * for requests. If the interpreters name path is already taken, append digits
+ * until we have an available path.
+ *
+ * If the interpreter does not specify a name, take its sessionid.
+ *
+ * Responsibility moved to individual servlets.
+ */
+
+ if(INSTANCE->_servlets.find(path) != INSTANCE->_servlets.end()) {
+ return false;
+ }
+
+ std::stringstream servletURL;
+ servletURL << "http://" << INSTANCE->_address << ":" << INSTANCE->_port << "/" << path;
+ servlet->setURL(servletURL.str());
+
+ INSTANCE->_servlets[path] = servlet;
+
+ LOG(INFO) << "HTTP Servlet listening at: " << servletURL.str() << std::endl;
+
+ // register callback
+ evhttp_set_cb(INSTANCE->_http, ("/" + path).c_str(), HTTPServer::httpRecvReqCallback, servlet);
+
+ return true;
+ // generic callback
+// evhttp_set_cb(THIS->_http, "/", EventIOProcessor::httpRecvReq, processor);
+// evhttp_set_gencb(THIS->_http, EventIOProcessor::httpRecvReq, NULL);
+}
+
+void HTTPServer::unregisterServlet(HTTPServlet* servlet) {
+ HTTPServer* INSTANCE = getInstance();
+ tthread::lock_guard<tthread::recursive_mutex> lock(INSTANCE->_mutex);
+ servlet_iter_t servletIter = INSTANCE->_servlets.begin();
+ while(servletIter != INSTANCE->_servlets.end()) {
+ if (servletIter->second == servlet) {
+ evhttp_del_cb(INSTANCE->_http, std::string("/" + servletIter->first).c_str());
+ INSTANCE->_servlets.erase(servletIter);
+ break;
+ }
+ servletIter++;
+ }
+}
+
+void HTTPServer::start() {
+ _isRunning = true;
+ _thread = new tthread::thread(HTTPServer::run, this);
+}
+
+void HTTPServer::run(void* instance) {
+ HTTPServer* INSTANCE = (HTTPServer*)instance;
+ while(INSTANCE->_isRunning) {
+ event_base_dispatch(INSTANCE->_base);
+ }
+ LOG(INFO) << "HTTP Server stopped" << std::endl;
+}
+
+void HTTPServer::determineAddress() {
+ char hostname[1024];
+ gethostname(hostname, 1024);
+ _address = std::string(hostname);
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/server/HTTPServer.h b/src/uscxml/server/HTTPServer.h
new file mode 100644
index 0000000..597c749
--- /dev/null
+++ b/src/uscxml/server/HTTPServer.h
@@ -0,0 +1,92 @@
+#ifndef HTTPSERVER_H_AIH108EG
+#define HTTPSERVER_H_AIH108EG
+
+#include <string>
+#include <map>
+
+#include <event2/http.h>
+
+#include "uscxml/concurrency/tinythread.h"
+
+namespace uscxml {
+
+class HTTPServlet;
+
+class HTTPServer {
+public:
+ class Request {
+ public:
+ Request() : curlReq(NULL) {}
+ std::string type;
+ std::map<std::string, std::string> headers;
+ std::string content;
+ std::string remoteHost;
+ unsigned short remotePort;
+ std::string httpMajor;
+ std::string httpMinor;
+ std::string uri;
+ struct evhttp_request* curlReq;
+ };
+
+ class Reply {
+ public:
+ Reply(Request req) : status(200), type(req.type), curlReq(req.curlReq) {}
+ int status;
+ std::string type;
+ std::map<std::string, std::string> headers;
+ std::string content;
+ struct evhttp_request* curlReq;
+ };
+
+ struct CallbackData {
+ HTTPServlet* servlet;
+ evhttp_request* httpReq;
+ };
+
+ static HTTPServer* getInstance(int port = 8080);
+ static void reply(const Reply& reply);
+
+ static bool registerServlet(const std::string& path, HTTPServlet* servlet); ///< Register a servlet, returns false if path is already taken
+ static void unregisterServlet(HTTPServlet* servlet);
+
+private:
+ HTTPServer(unsigned short port);
+ ~HTTPServer();
+
+ void start();
+ void stop();
+ static void run(void* instance);
+
+ void determineAddress();
+
+ static void httpRecvReqCallback(struct evhttp_request *req, void *callbackData);
+
+ std::map<std::string, HTTPServlet*> _servlets;
+ typedef std::map<std::string, HTTPServlet*>::iterator servlet_iter_t;
+
+ struct event_base* _base;
+ struct evhttp* _http;
+ struct evhttp_bound_socket* _handle;
+
+ unsigned short _port;
+ std::string _address;
+
+ static HTTPServer* _instance;
+
+ static tthread::recursive_mutex _instanceMutex;
+ tthread::thread* _thread;
+ tthread::recursive_mutex _mutex;
+ bool _isRunning;
+
+ friend class HTTPServlet;
+};
+
+class HTTPServlet {
+public:
+ virtual void httpRecvRequest(const HTTPServer::Request& request) = 0;
+ virtual void setURL(const std::string& url) = 0; /// Called by the server with the actual URL
+};
+
+}
+
+#endif /* end of include guard: HTTPSERVER_H_AIH108EG */
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 88d10e9..b6cbdc0 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,36 +1,25 @@
-find_program(XMLLINT xmllint)
-if (XMLLINT)
- file(GLOB SCXML_FILES samples/uscxml/*.scxml)
-
-endif()
-
-add_executable(test-predicates src/test-predicates.cpp)
-target_link_libraries(test-predicates uscxml)
-add_test(test-predicates ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-predicates ${CMAKE_SOURCE_DIR}/test/samples/uscxml/test-predicates.scxml)
-set_target_properties(test-predicates PROPERTIES FOLDER "Tests")
+# find_program(XMLLINT xmllint)
+# if (XMLLINT)
+# file(GLOB SCXML_FILES samples/uscxml/*.scxml)
+# endif()
-add_executable(test-execution src/test-execution.cpp)
-target_link_libraries(test-execution uscxml)
-add_test(test-execution ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-execution ${CMAKE_SOURCE_DIR}/test/samples/uscxml/test-execution.scxml)
-set_target_properties(test-execution PROPERTIES FOLDER "Tests")
+if (NOT WIN32)
+ add_executable(test-predicates src/test-predicates.cpp)
+ target_link_libraries(test-predicates uscxml)
+ add_test(test-predicates ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-predicates ${CMAKE_SOURCE_DIR}/test/samples/uscxml/test-predicates.scxml)
+ set_target_properties(test-predicates PROPERTIES FOLDER "Tests")
+endif()
-# add_executable(test-apache-commons src/test-apache-commons.cpp)
-# target_link_libraries(test-apache-commons uscxml)
-# add_test(test-apache-commons ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-apache-commons ${CMAKE_SOURCE_DIR}/test/samples/apache)
-# set_target_properties(test-apache-commons PROPERTIES FOLDER "Tests")
-
-# if (V8_FOUND)
-# add_executable(test-ecmascript-v8 src/test-ecmascript-v8.cpp)
-# target_link_libraries(test-ecmascript-v8 uscxml)
-# add_test(test-ecmascript-v8 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-ecmascript-v8 ${CMAKE_SOURCE_DIR}/test/samples/uscxml/test-ecmascript.scxml)
-# set_target_properties(test-ecmascript-v8 PROPERTIES FOLDER "Tests")
-# endif()
+add_test(test-execution ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/mmi-browser ${CMAKE_SOURCE_DIR}/test/samples/uscxml/test-execution.scxml)
+add_test(test-communication ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/mmi-browser ${CMAKE_SOURCE_DIR}/test/samples/uscxml/test-communication.scxml)
+add_test(test-done-data ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/mmi-browser ${CMAKE_SOURCE_DIR}/test/samples/uscxml/test-donedata.scxml)
if (SWI_FOUND)
- add_executable(test-prolog-swi src/test-prolog-swi.cpp)
- target_link_libraries(test-prolog-swi uscxml)
- add_test(test-prolog-swi ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-prolog-swi ${CMAKE_SOURCE_DIR}/test/samples/uscxml/test-prolog.scxml)
- set_target_properties(test-prolog-swi PROPERTIES FOLDER "Tests")
+ add_test(test-prolog-swi ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/mmi-browser ${CMAKE_SOURCE_DIR}/test/samples/uscxml/test-prolog.scxml)
+endif()
+
+if (V8_FOUND)
+ add_test(test-ecmascript ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/mmi-browser ${CMAKE_SOURCE_DIR}/test/samples/uscxml/test-ecmascript.scxml)
endif()
if (OPENSCENEGRAPH_FOUND)
@@ -39,21 +28,11 @@ if (OPENSCENEGRAPH_FOUND)
set_target_properties(test-osg PROPERTIES FOLDER "Tests")
endif()
-add_executable(test-communication src/test-communication.cpp)
-target_link_libraries(test-communication uscxml)
-add_test(test-communication ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-communication ${CMAKE_SOURCE_DIR}/test/samples/uscxml/test-communication.scxml)
-set_target_properties(test-communication PROPERTIES FOLDER "Tests")
-
add_executable(test-eventdelay src/test-eventdelay.cpp)
target_link_libraries(test-eventdelay uscxml)
add_test(test-eventdelay ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-eventdelay)
set_target_properties(test-eventdelay PROPERTIES FOLDER "Tests")
-add_executable(test-completion src/test-completion.cpp)
-target_link_libraries(test-completion uscxml)
-add_test(test-completion ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-completion ${CMAKE_SOURCE_DIR}/test/samples/uscxml/test-donedata.scxml)
-set_target_properties(test-completion PROPERTIES FOLDER "Tests")
-
if (NOT WIN32)
add_executable(test-arabica-events src/test-arabica-events.cpp)
target_link_libraries(test-arabica-events uscxml)
@@ -67,8 +46,11 @@ add_test(test-url ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-url)
set_target_properties(test-url PROPERTIES FOLDER "Tests")
add_executable(scxml-test-framework-client
- ${PROJECT_SOURCE_DIR}/contrib/src/jsmn/jsmn.c
src/scxml-test-framework-client.cpp)
-target_link_libraries(scxml-test-framework-client uscxml)
+ target_link_libraries(scxml-test-framework-client uscxml)
set_target_properties(scxml-test-framework-client PROPERTIES FOLDER "Tests")
+# add_executable(test-curl-multi-api src/test-curl-multi-api.cpp)
+# target_link_libraries(test-curl-multi-api uscxml)
+# add_test(test-curl-multi-api ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-completion)
+# set_target_properties(test-curl-multi-api PROPERTIES FOLDER "Tests")
diff --git a/test/run-scxml-test-framework.sh b/test/run-scxml-test-framework.sh
index e20afe9..83cb403 100755
--- a/test/run-scxml-test-framework.sh
+++ b/test/run-scxml-test-framework.sh
@@ -100,7 +100,7 @@ TESTS=""
# TESTS="${TESTS} scxml-test-framework/test/multiple-events-per-transition/test1.scxml" # passed
# TESTS="${TESTS} scxml-test-framework/test/parallel/test0.scxml" # passed
-# TESTS="${TESTS} scxml-test-framework/test/parallel/test1.scxml" # passed
+# TESTS="${TESTS} scxml-test-framework/test/parallel/test1.scxml" # failed
# TESTS="${TESTS} scxml-test-framework/test/parallel/test2.scxml" # passed
# TESTS="${TESTS} scxml-test-framework/test/parallel/test3.scxml" # passed
@@ -142,7 +142,7 @@ TESTS=""
# TESTS="${TESTS} scxml-test-framework/test/script/test2.scxml" # getData not defined
# TESTS="${TESTS} scxml-test-framework/test/script-src/test0.scxml" # getData not defined
# TESTS="${TESTS} scxml-test-framework/test/script-src/test1.scxml" # getData not defined
-# TESTS="${TESTS} scxml-test-framework/test/script-src/test2.scxml" # getData not defined
+#TESTS="${TESTS} scxml-test-framework/test/script-src/test2.scxml" # getData not defined
# TESTS="${TESTS} scxml-test-framework/test/script-src/test3.scxml" # getData not defined
# TESTS="${TESTS} scxml-test-framework/test/scxml-prefix-event-name-matching/star0.scxml" # passed
@@ -155,8 +155,9 @@ TESTS=""
# TESTS="${TESTS} scxml-test-framework/test/targetless-transition/test0.scxml" # passed
# TESTS="${TESTS} scxml-test-framework/test/targetless-transition/test1.scxml" # passed
# TESTS="${TESTS} scxml-test-framework/test/targetless-transition/test2.scxml" # passed
-TESTS="${TESTS} scxml-test-framework/test/targetless-transition/test3.scxml" # failed
+# TESTS="${TESTS} scxml-test-framework/test/targetless-transition/test3.scxml" # failed
+TESTS="${TESTS} scxml-test-framework/test/*/*.scxml"
#trap 'killall ${SCXML_TEST_FRAMEWORK_NAME}' 0
#$SCXML_TEST_FRAMEWORK_FULL &
diff --git a/test/samples/uscxml/test-custom-executable-content.scxml b/test/samples/uscxml/test-custom-executable-content.scxml
new file mode 100644
index 0000000..a40af93
--- /dev/null
+++ b/test/samples/uscxml/test-custom-executable-content.scxml
@@ -0,0 +1,19 @@
+<scxml datamodel="ecmascript">
+ <script src="http://uscxml.tk.informatik.tu-darmstadt.de/scripts/dump.js" />
+ <state id="start">
+ <onentry>
+ <fetch
+ target="http://data.wien.gv.at/daten/wfs?service=WFS&amp;request=GetFeature&amp;version=1.1.0&amp;typeName=ogdwien:BAUMOGD&amp;srsName=EPSG:4326&amp;outputFormat=json&amp;maxfeatures=5"
+ callback="data.wien"
+ type="json" />
+ </onentry>
+ <state id="wait">
+ <transition event="data.wien" target="final">
+ <script>
+ dump(_event);
+ </script>
+ </transition>
+ </state>
+ </state>
+ <final id="final" />
+</scxml> \ No newline at end of file
diff --git a/test/samples/uscxml/test-ecmascript.scxml b/test/samples/uscxml/test-ecmascript.scxml
index aa88f17..7dfd94c 100644
--- a/test/samples/uscxml/test-ecmascript.scxml
+++ b/test/samples/uscxml/test-ecmascript.scxml
@@ -77,13 +77,7 @@
</foreach>
</foreach>
</onentry>
- <transition target="externalEvents" />
- </state>
- <state id="externalEvents">
- <onentry>
- <log expr="'-- External Events'" />
- </onentry>
- <transition target="datamodels" event="event1" cond="_event.name == 'event1'" />
+ <transition target="datamodels" />
</state>
<state id="datamodels">
<datamodel>
diff --git a/test/samples/uscxml/test-http-servlet.scxml b/test/samples/uscxml/test-http-servlet.scxml
new file mode 100644
index 0000000..8836b76
--- /dev/null
+++ b/test/samples/uscxml/test-http-servlet.scxml
@@ -0,0 +1,41 @@
+<scxml datamodel="ecmascript">
+ <script src="http://uscxml.tk.informatik.tu-darmstadt.de/scripts/dump.js" />
+ <state id="start">
+ <!--
+ I went for explicit invokers instead of a response element in executable content
+ as it provides better control on the path where to serve data.
+ -->
+ <invoke type="httpserver" id="servlet.data">
+ <!-- server path where to listen -->
+ <param name="path" expr="'data'" />
+ <!-- the name of events originating from requests at this url -->
+ <param name="callback" expr="'http.data'" />
+ </invoke>
+ <invoke type="httpserver" id="servlet.exit">
+ <param name="path" expr="'exit'" />
+ <param name="callback" expr="'http.exit'" />
+ </invoke>
+ <state id="loop">
+ <transition event="http.data" target="loop">
+ <script>
+ dump(_event);
+ </script>
+ <!-- Sending a http reply is to send the invoker id a "reply.<requestId>" event -->
+ <send target="#_servlet.data" eventexpr="'reply.' + _event.data.reqId">
+ <!-- This will end up as a header field -->
+ <param name="Foo" expr="_ioprocessors" />
+ <!-- JSON string in the content -->
+ <content expr="_ioprocessors" />
+ </send>
+ </transition>
+ <transition event="http.exit" target="final">
+ <script>
+ dump(_event);
+ </script>
+ <!-- This will never get delivered as we terminate before -->
+ <send target="#_servlet.exit" eventexpr="'reply.' + _event.data.reqId" />
+ </transition>
+ </state>
+ </state>
+ <final id="final" />
+</scxml> \ No newline at end of file
diff --git a/test/samples/uscxml/test-response-element.scxml b/test/samples/uscxml/test-response-element.scxml
new file mode 100644
index 0000000..d3d3c53
--- /dev/null
+++ b/test/samples/uscxml/test-response-element.scxml
@@ -0,0 +1,14 @@
+<scxml datamodel="ecmascript" name="test">
+ <script src="http://uscxml.tk.informatik.tu-darmstadt.de/scripts/dump.js" />
+ <state id="start">
+ <state id="loop">
+ <transition event="http" target="loop">
+ <!-- script>
+ dump(_event);
+ </script -->
+ <response status="200" requestexpr="_event.origin" />
+ </transition>
+ </state>
+ </state>
+ <final id="final" />
+</scxml> \ No newline at end of file
diff --git a/test/scxml-test-framework/test-ext/node/require/require.json b/test/scxml-test-framework/test-ext/node/require/require.json
deleted file mode 100644
index 1d2faec..0000000
--- a/test/scxml-test-framework/test-ext/node/require/require.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b"]
- }
- ]
-}
-
-
-
diff --git a/test/scxml-test-framework/test-ext/node/require/require.scxml b/test/scxml-test-framework/test-ext/node/require/require.scxml
deleted file mode 100644
index 221ad81..0000000
--- a/test/scxml-test-framework/test-ext/node/require/require.scxml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <datamodel>
- <data id="util"/>
- <data id="submodule1"/>
- <data id="submodule2"/>
- <data id="submodule3"/>
- <data id="submodule4"/>
- </datamodel>
-
- <script>
- util = require('util'); //require built-in module
- console.log('hello');
- submodule1 = require('./submodule1');
- </script>
-
- <script src="script2.js"/>
-
- <state id="a">
- <onentry>
- <script>
- submodule3 = require('./submodule3');
- </script>
- <script src="script4.js"/>
- <log label="util" expr="util"/>
- <log label="submodules" expr="[submodule1, submodule2, submodule3, submodule4]"/>
- </onentry>
-
- <transition event="t" target="b" cond="util &amp;&amp; submodule1 &amp;&amp; submodule2 &amp;&amp; submodule3 &amp;&amp; submodule4"/>
- <transition event="t" target="f"/>
- </state>
-
- <state id="b"/>
- <state id="f"/>
-
-</scxml>
diff --git a/test/scxml-test-framework/test-ext/node/require/script2.js b/test/scxml-test-framework/test-ext/node/require/script2.js
deleted file mode 100644
index 25259e7..0000000
--- a/test/scxml-test-framework/test-ext/node/require/script2.js
+++ /dev/null
@@ -1 +0,0 @@
-submodule2 = require('./submodule2');
diff --git a/test/scxml-test-framework/test-ext/node/require/script3.js b/test/scxml-test-framework/test-ext/node/require/script3.js
deleted file mode 100644
index 76a37e1..0000000
--- a/test/scxml-test-framework/test-ext/node/require/script3.js
+++ /dev/null
@@ -1 +0,0 @@
-submodule3 = require('./submodule3');
diff --git a/test/scxml-test-framework/test-ext/node/require/script4.js b/test/scxml-test-framework/test-ext/node/require/script4.js
deleted file mode 100644
index 348b8c9..0000000
--- a/test/scxml-test-framework/test-ext/node/require/script4.js
+++ /dev/null
@@ -1 +0,0 @@
-submodule4 = require('./submodule4');
diff --git a/test/scxml-test-framework/test-ext/node/require/submodule1.js b/test/scxml-test-framework/test-ext/node/require/submodule1.js
deleted file mode 100644
index bd816ea..0000000
--- a/test/scxml-test-framework/test-ext/node/require/submodule1.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = 1;
diff --git a/test/scxml-test-framework/test-ext/node/require/submodule2.js b/test/scxml-test-framework/test-ext/node/require/submodule2.js
deleted file mode 100644
index 4bbffde..0000000
--- a/test/scxml-test-framework/test-ext/node/require/submodule2.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = 2;
diff --git a/test/scxml-test-framework/test-ext/node/require/submodule3.js b/test/scxml-test-framework/test-ext/node/require/submodule3.js
deleted file mode 100644
index 690aad3..0000000
--- a/test/scxml-test-framework/test-ext/node/require/submodule3.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = 3;
diff --git a/test/scxml-test-framework/test-ext/node/require/submodule4.js b/test/scxml-test-framework/test-ext/node/require/submodule4.js
deleted file mode 100644
index a9bbdd8..0000000
--- a/test/scxml-test-framework/test-ext/node/require/submodule4.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = 4;
diff --git a/test/scxml-test-framework/test-ext/node/runner.js b/test/scxml-test-framework/test-ext/node/runner.js
deleted file mode 100644
index da68716..0000000
--- a/test/scxml-test-framework/test-ext/node/runner.js
+++ /dev/null
@@ -1,11 +0,0 @@
-var scion = require('scion');
-
-scion.pathToModel('require/require.scxml',function(err,model){
- if(err) throw err;
-
- var scxml = new scion.SCXML(model);
- var initialConfig = scxml.start();
- console.log("initialConfig",initialConfig);
- var nextConfig = scxml.gen("t");
- console.log("nextConfig",nextConfig);
-});
diff --git a/test/scxml-test-framework/test/actionSend/send1.json b/test/scxml-test-framework/test/actionSend/send1.json
index 8424ef5..0e49c49 100644
--- a/test/scxml-test-framework/test/actionSend/send1.json
+++ b/test/scxml-test-framework/test/actionSend/send1.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/actionSend/send1.scxml b/test/scxml-test-framework/test/actionSend/send1.scxml
index dcccc56..5c62852 100644
--- a/test/scxml-test-framework/test/actionSend/send1.scxml
+++ b/test/scxml-test-framework/test/actionSend/send1.scxml
@@ -15,27 +15,23 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- datamodel="ecmascript"
- id="root">
-
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
-
- <state id="a">
- <transition target="b" event="t">
- <raise event="s"/>
- </transition>
- </state>
-
- <state id="b">
- <transition target="c" event="s"/>
- </state>
-
- <state id="c">
- </state>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ initial="a"
+ version="1.0">
+
+ <state id="a">
+ <transition target="b" event="t">
+ <raise event="s"/>
+ </transition>
+ </state>
+
+ <state id="b">
+ <transition target="c" event="s"/>
+ </state>
+
+ <state id="c">
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/actionSend/send2.json b/test/scxml-test-framework/test/actionSend/send2.json
index 8a11f79..6831c27 100644
--- a/test/scxml-test-framework/test/actionSend/send2.json
+++ b/test/scxml-test-framework/test/actionSend/send2.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/actionSend/send2.scxml b/test/scxml-test-framework/test/actionSend/send2.scxml
index 8fcb593..6eb8dda 100644
--- a/test/scxml-test-framework/test/actionSend/send2.scxml
+++ b/test/scxml-test-framework/test/actionSend/send2.scxml
@@ -15,30 +15,26 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
-
- <state id="a">
- <onexit>
- <raise event="s"/>
- </onexit>
-
- <transition target="b" event="t">
- </transition>
- </state>
-
- <state id="b">
- <transition target="c" event="s"/>
- </state>
-
- <state id="c">
- </state>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ initial="a"
+ version="1.0">
+
+ <state id="a">
+ <onexit>
+ <raise event="s"/>
+ </onexit>
+
+ <transition target="b" event="t">
+ </transition>
+ </state>
+
+ <state id="b">
+ <transition target="c" event="s"/>
+ </state>
+
+ <state id="c">
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/actionSend/send3.json b/test/scxml-test-framework/test/actionSend/send3.json
index 7a67a87..a61d05d 100644
--- a/test/scxml-test-framework/test/actionSend/send3.json
+++ b/test/scxml-test-framework/test/actionSend/send3.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/actionSend/send3.scxml b/test/scxml-test-framework/test/actionSend/send3.scxml
index 1a224ac..c7237cf 100644
--- a/test/scxml-test-framework/test/actionSend/send3.scxml
+++ b/test/scxml-test-framework/test/actionSend/send3.scxml
@@ -15,30 +15,26 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
-
- <state id="a">
- <transition target="b" event="t">
- </transition>
- </state>
-
- <state id="b">
- <onentry>
- <raise event="s"/>
- </onentry>
-
- <transition target="c" event="s"/>
- </state>
-
- <state id="c">
- </state>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ initial="a"
+ version="1.0">
+
+ <state id="a">
+ <transition target="b" event="t">
+ </transition>
+ </state>
+
+ <state id="b">
+ <onentry>
+ <raise event="s"/>
+ </onentry>
+
+ <transition target="c" event="s"/>
+ </state>
+
+ <state id="c">
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/actionSend/send4.json b/test/scxml-test-framework/test/actionSend/send4.json
index d994bfe..f5f76a3 100644
--- a/test/scxml-test-framework/test/actionSend/send4.json
+++ b/test/scxml-test-framework/test/actionSend/send4.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["d"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["d"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/actionSend/send4.scxml b/test/scxml-test-framework/test/actionSend/send4.scxml
index 473355b..77ede37 100644
--- a/test/scxml-test-framework/test/actionSend/send4.scxml
+++ b/test/scxml-test-framework/test/actionSend/send4.scxml
@@ -18,41 +18,37 @@
This is a test to illustrate the event lifeline. In c, event "s" should no longer be in the event queue, as we are using Next Small Step semantics, so we should end up in d. This would not be true if we were using Remainder semantics.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
-
- <state id="a">
- <transition target="b" event="t">
- </transition>
- </state>
-
- <state id="b">
- <onentry>
- <raise event="s"/>
- </onentry>
-
- <transition target="c" event="s"/>
- <transition target="f1"/>
- </state>
-
- <state id="c">
- <transition target="f2" event="s"/>
- <transition target="d"/>
- </state>
-
- <state id="f1">
- </state>
-
- <state id="d">
- </state>
-
- <state id="f2">
- </state>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ initial="a"
+ version="1.0">
+
+ <state id="a">
+ <transition target="b" event="t">
+ </transition>
+ </state>
+
+ <state id="b">
+ <onentry>
+ <raise event="s"/>
+ </onentry>
+
+ <transition target="c" event="s"/>
+ <transition target="f1"/>
+ </state>
+
+ <state id="c">
+ <transition target="f2" event="s"/>
+ <transition target="d"/>
+ </state>
+
+ <state id="f1">
+ </state>
+
+ <state id="d">
+ </state>
+
+ <state id="f2">
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/actionSend/send5.json b/test/scxml-test-framework/test/actionSend/send5.json
index c749e69..60a56b6 100644
--- a/test/scxml-test-framework/test/actionSend/send5.json
+++ b/test/scxml-test-framework/test/actionSend/send5.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["d"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["d"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/actionSend/send5.scxml b/test/scxml-test-framework/test/actionSend/send5.scxml
index 47a9906..9e8a450 100644
--- a/test/scxml-test-framework/test/actionSend/send5.scxml
+++ b/test/scxml-test-framework/test/actionSend/send5.scxml
@@ -18,43 +18,39 @@
This is a test to illustrate the event lifeline, and how multiple events are handled. The whole set of triggered events will be dequeued from the inner event queue in the next small step. This is different from scxml, where only one event will be dequeued at a time in the next small step. So, SCXML semantics would lead to f2, whereas our semantics would lead to d.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
-
- <state id="a">
- <transition target="b" event="t">
- </transition>
- </state>
-
- <state id="b">
- <onentry>
- <raise event="s"/>
- <raise event="r"/>
- </onentry>
-
- <transition target="c" event="s"/>
- <transition target="f1"/>
- </state>
-
- <state id="c">
- <transition target="f2" event="r"/>
- <transition target="d"/>
- </state>
-
- <state id="f1">
- </state>
-
- <state id="d">
- </state>
-
- <state id="f2">
- </state>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ initial="a"
+ version="1.0">
+
+ <state id="a">
+ <transition target="b" event="t">
+ </transition>
+ </state>
+
+ <state id="b">
+ <onentry>
+ <raise event="s"/>
+ <raise event="r"/>
+ </onentry>
+
+ <transition target="c" event="s"/>
+ <transition target="f1"/>
+ </state>
+
+ <state id="c">
+ <transition target="f2" event="r"/>
+ <transition target="d"/>
+ </state>
+
+ <state id="f1">
+ </state>
+
+ <state id="d">
+ </state>
+
+ <state id="f2">
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/actionSend/send6.json b/test/scxml-test-framework/test/actionSend/send6.json
index 41b718a..abb5069 100644
--- a/test/scxml-test-framework/test/actionSend/send6.json
+++ b/test/scxml-test-framework/test/actionSend/send6.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["d"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["d"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/actionSend/send6.scxml b/test/scxml-test-framework/test/actionSend/send6.scxml
index ac2f3ad..bb77351 100644
--- a/test/scxml-test-framework/test/actionSend/send6.scxml
+++ b/test/scxml-test-framework/test/actionSend/send6.scxml
@@ -15,46 +15,42 @@
limitations under the License.
-->
<!--
- This is a quick followup to send5.json, to show that order in the event set does not matter. Transitions with events r and s are switched.
+ This is a quick followup to send5.json, to show that order in the event set does not matter. Transitions with events r and s are switched.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
-
- <state id="a">
- <transition target="b" event="t">
- </transition>
- </state>
-
- <state id="b">
- <onentry>
- <raise event="s"/>
- <raise event="r"/>
- </onentry>
-
- <transition target="c" event="r"/>
- <transition target="f1"/>
- </state>
-
- <state id="c">
- <transition target="f2" event="s"/>
- <transition target="d"/>
- </state>
-
- <state id="f1">
- </state>
-
- <state id="d">
- </state>
-
- <state id="f2">
- </state>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ initial="a"
+ version="1.0" >
+
+ <state id="a">
+ <transition target="b" event="t">
+ </transition>
+ </state>
+
+ <state id="b">
+ <onentry>
+ <raise event="s"/>
+ <raise event="r"/>
+ </onentry>
+
+ <transition target="c" event="r"/>
+ <transition target="f1"/>
+ </state>
+
+ <state id="c">
+ <transition target="f2" event="s"/>
+ <transition target="d"/>
+ </state>
+
+ <state id="f1">
+ </state>
+
+ <state id="d">
+ </state>
+
+ <state id="f2">
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/actionSend/send7.json b/test/scxml-test-framework/test/actionSend/send7.json
index 92bc2ef..7e334b0 100644
--- a/test/scxml-test-framework/test/actionSend/send7.json
+++ b/test/scxml-test-framework/test/actionSend/send7.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b3"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["b3"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/actionSend/send7.scxml b/test/scxml-test-framework/test/actionSend/send7.scxml
index a8bc512..5e7dffd 100644
--- a/test/scxml-test-framework/test/actionSend/send7.scxml
+++ b/test/scxml-test-framework/test/actionSend/send7.scxml
@@ -15,36 +15,32 @@
limitations under the License.
-->
<!--
- Illustrates one of the edge cases of these semantics. Because initial transition will be taken in its own small step, triggered event "s" will be "lost" - not availble in the next small step from b1. Will therefore end up in b3.
+ Illustrates one of the edge cases of these semantics. Because initial transition will be taken in its own small step, triggered event "s" will be "lost" - not availble in the next small step from b1. Will therefore end up in b3.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
-
- <state id="a">
- <transition target="b" event="t">
- <raise event="s"/>
- </transition>
- </state>
-
- <state id="b" initial="b1">
- <state id="b1">
- <transition event="s" target="b2"/>
- <transition target="b3"/>
- </state>
-
- <state id="b2">
- </state>
-
- <state id="b3">
- </state>
- </state>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ initial="a"
+ version="1.0">
+
+ <state id="a">
+ <transition target="b" event="t">
+ <raise event="s"/>
+ </transition>
+ </state>
+
+ <state id="b" initial="b1">
+ <state id="b1">
+ <transition event="s" target="b2"/>
+ <transition target="b3"/>
+ </state>
+
+ <state id="b2">
+ </state>
+
+ <state id="b3">
+ </state>
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/actionSend/send8.json b/test/scxml-test-framework/test/actionSend/send8.json
index b7da171..8b988bf 100644
--- a/test/scxml-test-framework/test/actionSend/send8.json
+++ b/test/scxml-test-framework/test/actionSend/send8.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b2"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["b2"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/actionSend/send8.scxml b/test/scxml-test-framework/test/actionSend/send8.scxml
index 164e046..2484433 100644
--- a/test/scxml-test-framework/test/actionSend/send8.scxml
+++ b/test/scxml-test-framework/test/actionSend/send8.scxml
@@ -15,36 +15,32 @@
limitations under the License.
-->
<!--
- Illustrates one of the edge cases of these semantics. Followup to send7. If we target, not the outer composite state, but the inner state directly, the event will be available in the next small step. This is an example of the way in which these semantics break the synchrony hypthosesis.
+ Illustrates one of the edge cases of these semantics. Followup to send7. If we target, not the outer composite state, but the inner state directly, the event will be available in the next small step. This is an example of the way in which these semantics break the synchrony hypthosesis.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
-
- <state id="a">
- <transition target="b1" event="t">
- <raise event="s"/>
- </transition>
- </state>
-
- <state id="b" initial="b1">
- <state id="b1">
- <transition event="s" target="b2"/>
- <transition target="b3"/>
- </state>
-
- <state id="b2">
- </state>
-
- <state id="b3">
- </state>
- </state>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ initial="a"
+ version="1.0">
+
+ <state id="a">
+ <transition target="b1" event="t">
+ <raise event="s"/>
+ </transition>
+ </state>
+
+ <state id="b" initial="b1">
+ <state id="b1">
+ <transition event="s" target="b2"/>
+ <transition target="b3"/>
+ </state>
+
+ <state id="b2">
+ </state>
+
+ <state id="b3">
+ </state>
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/assign-current-small-step/test0.json b/test/scxml-test-framework/test/assign-current-small-step/test0.json
index 8424ef5..0e49c49 100644
--- a/test/scxml-test-framework/test/assign-current-small-step/test0.json
+++ b/test/scxml-test-framework/test/assign-current-small-step/test0.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/assign-current-small-step/test0.scxml b/test/scxml-test-framework/test/assign-current-small-step/test0.scxml
index 63f2f74..12131d8 100644
--- a/test/scxml-test-framework/test/assign-current-small-step/test0.scxml
+++ b/test/scxml-test-framework/test/assign-current-small-step/test0.scxml
@@ -15,47 +15,42 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <datamodel>
- <data id="a"/>
- </datamodel>
+ <datamodel>
+ <data id="x"/>
+ </datamodel>
- <state id="a">
- <onentry>
- <!-- first -1 will be assigned to the datamodel. then, in the same small-step, this will be overridden by the 99 -->
- <assign location="a" expr="-1"/>
- <assign location="a" expr="99"/>
- </onentry>
+ <state id="a">
+ <onentry>
+ <!-- first -1 will be assigned to the datamodel. then, in the same small-step, this will be overridden by the 99 -->
+ <assign location="x" expr="-1"/>
+ <assign location="x" expr="99"/>
+ </onentry>
- <!-- in order for this transition to be taken, a must be updated immediately, in the same small-step -->
- <transition event="t" target="b" cond="a === 99">
- <assign location="a" expr="a + 1"/>
- </transition>
- </state>
+ <!-- in order for this transition to be taken, a must be updated immediately, in the same small-step -->
+ <transition event="t" target="b" cond="x === 99">
+ <assign location="x" expr="x + 1"/>
+ </transition>
+ </state>
- <state id="b">
- <!-- use regular assignment syntax, assuming datamodel variables are in script scope -->
- <onentry>
- <script>
- a *= 2;
- </script>
- </onentry>
+ <state id="b">
+ <!-- use regular assignment syntax, assuming datamodel variables are in script scope -->
+ <onentry>
+ <script>
+ x *= 2;
+ </script>
+ </onentry>
- <transition target="c" cond="a === 200"/>
- <transition target="f"/>
- </state>
+ <transition target="c" cond="x === 200"/>
+ <transition target="f"/>
+ </state>
- <state id="c"/>
+ <state id="c"/>
- <state id="f"/>
+ <state id="f"/>
</scxml>
-
-
-
-
diff --git a/test/scxml-test-framework/test/assign-current-small-step/test1.json b/test/scxml-test-framework/test/assign-current-small-step/test1.json
index 8424ef5..0e49c49 100644
--- a/test/scxml-test-framework/test/assign-current-small-step/test1.json
+++ b/test/scxml-test-framework/test/assign-current-small-step/test1.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/assign-current-small-step/test1.scxml b/test/scxml-test-framework/test/assign-current-small-step/test1.scxml
index 632d1f0..21e8777 100644
--- a/test/scxml-test-framework/test/assign-current-small-step/test1.scxml
+++ b/test/scxml-test-framework/test/assign-current-small-step/test1.scxml
@@ -18,32 +18,27 @@
This test illustrates how possibly infinite loops may be created. Here, without the counter and the cond, the big-step would never complete.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <datamodel>
- <data id="i"/>
- </datamodel>
-
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
-
- <state id="a">
- <transition target="b" event="t">
- <assign location="i" expr="0"/>
- </transition>
- </state>
-
- <state id="b">
- <transition target="b" cond="i &lt; 100">
- <assign location="i" expr="i + 1"/>
- </transition>
- <transition target="c" cond="i === 100"/>
- </state>
-
- <state id="c"/>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
+ <datamodel>
+ <data id="i"/>
+ </datamodel>
+
+ <state id="a">
+ <transition target="b" event="t">
+ <assign location="i" expr="0"/>
+ </transition>
+ </state>
+
+ <state id="b">
+ <transition target="b" cond="i &lt; 100">
+ <assign location="i" expr="i + 1"/>
+ </transition>
+ <transition target="c" cond="i === 100"/>
+ </state>
+
+ <state id="c"/>
</scxml>
diff --git a/test/scxml-test-framework/test/assign-current-small-step/test2.json b/test/scxml-test-framework/test/assign-current-small-step/test2.json
index 6769dfe..36628bc 100644
--- a/test/scxml-test-framework/test/assign-current-small-step/test2.json
+++ b/test/scxml-test-framework/test/assign-current-small-step/test2.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["e"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["e"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/assign-current-small-step/test2.scxml b/test/scxml-test-framework/test/assign-current-small-step/test2.scxml
index b5a5828..05cf13b 100644
--- a/test/scxml-test-framework/test/assign-current-small-step/test2.scxml
+++ b/test/scxml-test-framework/test/assign-current-small-step/test2.scxml
@@ -18,53 +18,48 @@
This is another test that illustrates how possibly infinite loops may be created. Here, without the counter and the cond, the big-step would never complete.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <datamodel>
- <data id="i"/>
- </datamodel>
+ <datamodel>
+ <data id="i"/>
+ </datamodel>
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
+ <state id="a">
+ <transition target="b" event="t">
+ <assign location="i" expr="0"/>
+ </transition>
+ </state>
- <state id="a">
- <transition target="b" event="t">
- <assign location="i" expr="0"/>
- </transition>
- </state>
+ <state id="A">
- <state id="A">
+ <state id="b">
+ <transition target="c" cond="i &lt; 100">
+ <assign location="i" expr="i + 1"/>
+ </transition>
+ </state>
- <state id="b">
- <transition target="c" cond="i &lt; 100">
- <assign location="i" expr="i + 1"/>
- </transition>
- </state>
+ <state id="c">
+ <transition target="b" cond="i &lt; 100">
+ <assign location="i" expr="i + 1"/>
+ </transition>
+ </state>
- <state id="c">
- <transition target="b" cond="i &lt; 100">
- <assign location="i" expr="i + 1"/>
- </transition>
- </state>
+ <transition target="d" cond="i === 100">
+ <assign location="i" expr="i * 2"/>
+ </transition>
+ </state>
- <transition target="d" cond="i === 100">
- <assign location="i" expr="i * 2"/>
- </transition>
- </state>
+ <state id="d">
+ <transition target="e" cond="i === 200"/>
+ <transition target="f"/>
+ </state>
- <state id="d">
- <transition target="e" cond="i === 200"/>
- <transition target="f"/>
- </state>
+ <state id="e"/>
- <state id="e"/>
-
- <state id="f"/>
+ <state id="f"/>
</scxml>
diff --git a/test/scxml-test-framework/test/assign-current-small-step/test3.json b/test/scxml-test-framework/test/assign-current-small-step/test3.json
index d31828b..58b5b14 100644
--- a/test/scxml-test-framework/test/assign-current-small-step/test3.json
+++ b/test/scxml-test-framework/test/assign-current-small-step/test3.json
@@ -1,19 +1,19 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t1" },
- "nextConfiguration" : ["b1","c1"]
- },
- {
- "event" : { "name" : "t2" },
- "nextConfiguration" : ["b2","c2"]
- },
- {
- "event" : { "name" : "t3" },
- "nextConfiguration" : ["d"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["b1","c1"]
+ },
+ {
+ "event" : { "name" : "t2" },
+ "nextConfiguration" : ["b2","c2"]
+ },
+ {
+ "event" : { "name" : "t3" },
+ "nextConfiguration" : ["d"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/assign-current-small-step/test3.scxml b/test/scxml-test-framework/test/assign-current-small-step/test3.scxml
index 431717e..203ed43 100644
--- a/test/scxml-test-framework/test/assign-current-small-step/test3.scxml
+++ b/test/scxml-test-framework/test/assign-current-small-step/test3.scxml
@@ -18,57 +18,52 @@
This test demonstrates the way the memory model semantics interact with transition order and concurrency semantics. Here, transitions originating from c1 and b1 will be taken in the same small-step, however i will not be updated until the end of that small step. The transitions actions are evaluated in document order, though, so the outcome is deterministic, so the assignment action on the transition originating from c1 will win.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <datamodel>
- <data id="i"/>
- </datamodel>
+ <datamodel>
+ <data id="i"/>
+ </datamodel>
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
+ <state id="a">
+ <transition target="p" event="t1">
+ <assign location="i" expr="0"/>
+ </transition>
+ </state>
- <state id="a">
- <transition target="p" event="t1">
- <assign location="i" expr="0"/>
- </transition>
- </state>
+ <parallel id="p">
- <parallel id="p">
+ <state id="b" initial="b1">
+ <state id="b1">
+ <transition event="t2" target="b2">
+ <assign location="i" expr="i + 1"/>
+ </transition>
+ </state>
- <state id="b" initial="b1">
- <state id="b1">
- <transition event="t2" target="b2">
- <assign location="i" expr="i + 1"/>
- </transition>
- </state>
+ <state id="b2">
+ </state>
+ </state>
- <state id="b2">
- </state>
- </state>
+ <state id="c" initial="c1">
+ <state id="c1">
+ <transition event="t2" target="c2">
+ <assign location="i" expr="i - 1"/>
+ </transition>
+ </state>
- <state id="c" initial="c1">
- <state id="c1">
- <transition event="t2" target="c2">
- <assign location="i" expr="i - 1"/>
- </transition>
- </state>
+ <state id="c2">
+ </state>
+ </state>
- <state id="c2">
- </state>
- </state>
+ <transition event="t3" target="d" cond="i === 0"/>
+ <transition event="t3" target="f"/>
+ </parallel>
- <transition event="t3" target="d" cond="i === 0"/>
- <transition event="t3" target="f"/>
- </parallel>
+ <state id="d"/>
- <state id="d"/>
-
- <state id="f"/>
+ <state id="f"/>
</scxml>
diff --git a/test/scxml-test-framework/test/assign-current-small-step/test4.json b/test/scxml-test-framework/test/assign-current-small-step/test4.json
index ce82511..d616eb4 100644
--- a/test/scxml-test-framework/test/assign-current-small-step/test4.json
+++ b/test/scxml-test-framework/test/assign-current-small-step/test4.json
@@ -1,9 +1,9 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/assign-current-small-step/test4.scxml b/test/scxml-test-framework/test/assign-current-small-step/test4.scxml
index 856f943..64a8a8b 100644
--- a/test/scxml-test-framework/test/assign-current-small-step/test4.scxml
+++ b/test/scxml-test-framework/test/assign-current-small-step/test4.scxml
@@ -15,28 +15,27 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <datamodel>
- <data id="x"/>
- </datamodel>
+ <datamodel>
+ <data id="x"/>
+ </datamodel>
- <state id="a">
- <onentry>
- <assign location="x" expr="2"/>
- </onentry>
+ <state id="a">
+ <onentry>
+ <assign location="x" expr="2"/>
+ </onentry>
- <transition event="t" target="b1"/>
- </state>
+ <transition event="t" target="b1"/>
+ </state>
- <state id="b">
- <onentry>
- <assign location="x" expr="x * 3"/>
- <log expr="'b, x:' + x"/>
- </onentry>
+ <state id="b">
+ <onentry>
+ <assign location="x" expr="x * 3"/>
+ <log expr="'b, x:' + x"/>
+ </onentry>
<state id="b1">
<onentry>
@@ -52,12 +51,12 @@
</onentry>
</state>
- <transition target="c" cond="x === 30"/>
- <transition target="f"/>
- </state>
+ <transition target="c" cond="x === 30"/>
+ <transition target="f"/>
+ </state>
- <state id="c"/>
+ <state id="c"/>
- <state id="f"/>
+ <state id="f"/>
</scxml>
diff --git a/test/scxml-test-framework/test/assign-next-small-step/test0.json b/test/scxml-test-framework/test/assign-next-small-step/test0.json
deleted file mode 100644
index 1d2faec..0000000
--- a/test/scxml-test-framework/test/assign-next-small-step/test0.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b"]
- }
- ]
-}
-
-
-
diff --git a/test/scxml-test-framework/test/assign-next-small-step/test1.json b/test/scxml-test-framework/test/assign-next-small-step/test1.json
deleted file mode 100644
index 8424ef5..0000000
--- a/test/scxml-test-framework/test/assign-next-small-step/test1.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c"]
- }
- ]
-}
-
-
-
diff --git a/test/scxml-test-framework/test/assign-next-small-step/test1.scxml b/test/scxml-test-framework/test/assign-next-small-step/test1.scxml
deleted file mode 100644
index bc7074e..0000000
--- a/test/scxml-test-framework/test/assign-next-small-step/test1.scxml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!--
- This test illustrates how possibly infinite loops may be created. Here, without the counter and the cond, the big-step would never complete.
- -->
-<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <datamodel>
- <data id="i"/>
- </datamodel>
-
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
-
- <state id="a">
- <transition target="b" event="t">
- <script>
- setData('i',0);
- </script>
- </transition>
- </state>
-
- <state id="b">
- <transition target="b" cond="getData('i') &lt; 100">
- <script>
- setData('i',getData('i') + 1);
- </script>
- </transition>
- <transition target="c" cond="getData('i') === 100"/>
- </state>
-
- <state id="c"/>
-
-</scxml>
diff --git a/test/scxml-test-framework/test/assign-next-small-step/test2.json b/test/scxml-test-framework/test/assign-next-small-step/test2.json
deleted file mode 100644
index 6769dfe..0000000
--- a/test/scxml-test-framework/test/assign-next-small-step/test2.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["e"]
- }
- ]
-}
-
-
-
-
diff --git a/test/scxml-test-framework/test/assign-next-small-step/test2.scxml b/test/scxml-test-framework/test/assign-next-small-step/test2.scxml
deleted file mode 100644
index 1448d70..0000000
--- a/test/scxml-test-framework/test/assign-next-small-step/test2.scxml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!--
- This is another test that illustrates how possibly infinite loops may be created. Here, without the counter and the cond, the big-step would never complete.
- -->
-<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <datamodel>
- <data id="i"/>
- </datamodel>
-
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
-
- <state id="a">
- <transition target="b" event="t">
- <script>
- setData('i',0);
- </script>
- </transition>
- </state>
-
- <state id="A">
-
- <state id="b">
- <transition target="c" cond="getData('i') &lt; 100">
- <script>
- setData('i',getData('i') + 1);
- </script>
- </transition>
- </state>
-
- <state id="c">
- <transition target="b" cond="getData('i') &lt; 100">
- <script>
- setData('i',getData('i') + 1);
- </script>
- </transition>
- </state>
-
- <transition target="d" cond="getData('i') === 100">
- <script>
- setData('i',getData('i') * 2);
- </script>
- </transition>
- </state>
-
-
- <state id="d">
- <transition target="e" cond="getData('i') === 200"/>
- <transition target="f"/>
- </state>
-
- <state id="e"/>
-
- <state id="f"/>
-
-</scxml>
-
diff --git a/test/scxml-test-framework/test/assign-next-small-step/test3.json b/test/scxml-test-framework/test/assign-next-small-step/test3.json
deleted file mode 100644
index d31828b..0000000
--- a/test/scxml-test-framework/test/assign-next-small-step/test3.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t1" },
- "nextConfiguration" : ["b1","c1"]
- },
- {
- "event" : { "name" : "t2" },
- "nextConfiguration" : ["b2","c2"]
- },
- {
- "event" : { "name" : "t3" },
- "nextConfiguration" : ["d"]
- }
- ]
-}
-
-
-
-
-
diff --git a/test/scxml-test-framework/test/assign-next-small-step/test3.scxml b/test/scxml-test-framework/test/assign-next-small-step/test3.scxml
deleted file mode 100644
index d30be88..0000000
--- a/test/scxml-test-framework/test/assign-next-small-step/test3.scxml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!--
- This test demonstrates the way the memory model semantics interact with transition order and concurrency semantics. Here, transitions originating from c1 and b1 will be taken in the same small-step, however i will not be updated until the end of that small step. The transitions actions are evaluated in document order, though, so the outcome is deterministic, so the assignment action on the transition originating from c1 will win.
--->
-<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <datamodel>
- <data id="i"/>
- </datamodel>
-
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
-
- <state id="a">
- <transition target="p" event="t1">
- <script>
- setData('i',0);
- </script>
- </transition>
- </state>
-
- <parallel id="p">
-
- <state id="b" initial="b1">
- <state id="b1">
- <transition event="t2" target="b2">
- <script>
- setData('i',getData('i') + 1);
- </script>
- </transition>
- </state>
-
- <state id="b2">
- </state>
- </state>
-
- <state id="c" initial="c1">
- <state id="c1">
- <transition event="t2" target="c2">
- <script>
- setData('i',getData('i') - 1);
- </script>
- </transition>
- </state>
-
- <state id="c2">
- </state>
- </state>
-
- <transition event="t3" target="d" cond="getData('i') === -1"/>
- <transition event="t3" target="f" cond="getData('i') === 1"/>
- </parallel>
-
-
- <state id="d"/>
-
- <state id="f"/>
-
-</scxml>
-
-
diff --git a/test/scxml-test-framework/test/atom3-basic-tests/m0.json b/test/scxml-test-framework/test/atom3-basic-tests/m0.json
index 66fe90f..2121cdd 100644
--- a/test/scxml-test-framework/test/atom3-basic-tests/m0.json
+++ b/test/scxml-test-framework/test/atom3-basic-tests/m0.json
@@ -1,13 +1,13 @@
{
- "initialConfiguration" : ["A"],
- "events" : [
- {
- "event" : { "name" : "e1" },
- "nextConfiguration" : ["B"]
- },
- {
- "event" : { "name" : "e2" },
- "nextConfiguration" : ["A"]
- }
- ]
+ "initialConfiguration" : ["A"],
+ "events" : [
+ {
+ "event" : { "name" : "e1" },
+ "nextConfiguration" : ["B"]
+ },
+ {
+ "event" : { "name" : "e2" },
+ "nextConfiguration" : ["A"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/atom3-basic-tests/m0.scxml b/test/scxml-test-framework/test/atom3-basic-tests/m0.scxml
index 99bdc23..32026af 100644
--- a/test/scxml-test-framework/test/atom3-basic-tests/m0.scxml
+++ b/test/scxml-test-framework/test/atom3-basic-tests/m0.scxml
@@ -1,19 +1,18 @@
-<scxml xmlns="http://www.w3.org/2005/07/scxml" profile="ecmascript" version="1.0" name="root">
- <state id="A">
- <onentry>
- <log expr="&quot;entering A&quot;"/>
- </onentry>
- <onexit>
- <log expr="&quot;exiting A&quot;"/>
- </onexit>
- <transition target="B" event="e1">
- <log expr="&quot;doing A-&gt;B transition&quot;"/>
- </transition>
- </state>
- <initial>
- <transition target="A"/>
- </initial>
- <state id="B">
- <transition target="A" event="e2"/>
- </state>
-</scxml>
+<ns0:scxml
+ datamodel="ecmascript"
+ xmlns:ns0="http://www.w3.org/2005/07/scxml" version="1.0" name="root">
+ <ns0:state id="A">
+ <ns0:onentry>
+ <ns0:log expr="&quot;entering A&quot;"/>
+ </ns0:onentry>
+ <ns0:onexit>
+ <ns0:log expr="&quot;exiting A&quot;"/>
+ </ns0:onexit>
+ <ns0:transition target="B" event="e1">
+ <ns0:log expr="&quot;doing A-&gt;B transition&quot;"/>
+ </ns0:transition>
+ </ns0:state>
+ <ns0:state id="B">
+ <ns0:transition target="A" event="e2"/>
+ </ns0:state>
+</ns0:scxml>
diff --git a/test/scxml-test-framework/test/atom3-basic-tests/m1.json b/test/scxml-test-framework/test/atom3-basic-tests/m1.json
index dfb2ca4..eb25138 100644
--- a/test/scxml-test-framework/test/atom3-basic-tests/m1.json
+++ b/test/scxml-test-framework/test/atom3-basic-tests/m1.json
@@ -1,14 +1,14 @@
{
- "initialConfiguration" : ["A"],
- "events" : [
- {
- "event" : { "name" : "e1" },
- "nextConfiguration" : ["B"]
- },
- {
- "event" : { "name" : "e2" },
- "nextConfiguration" : ["A"]
- }
- ]
+ "initialConfiguration" : ["A"],
+ "events" : [
+ {
+ "event" : { "name" : "e1" },
+ "nextConfiguration" : ["B"]
+ },
+ {
+ "event" : { "name" : "e2" },
+ "nextConfiguration" : ["A"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/atom3-basic-tests/m1.scxml b/test/scxml-test-framework/test/atom3-basic-tests/m1.scxml
index e233f2c..6d8a01f 100644
--- a/test/scxml-test-framework/test/atom3-basic-tests/m1.scxml
+++ b/test/scxml-test-framework/test/atom3-basic-tests/m1.scxml
@@ -1,4 +1,6 @@
-<ns0:scxml xmlns:ns0="http://www.w3.org/2005/07/scxml" profile="ecmascript" version="1.0" name="root">
+<ns0:scxml
+ datamodel="ecmascript"
+ xmlns:ns0="http://www.w3.org/2005/07/scxml" version="1.0" name="root">
<ns0:state id="A">
<ns0:onentry>
<ns0:log expr="&quot;entering state A&quot;"/>
@@ -10,9 +12,6 @@
<ns0:log expr="&quot;triggered by e1&quot;"/>
</ns0:transition>
</ns0:state>
- <ns0:initial>
- <ns0:transition target="A"/>
- </ns0:initial>
<ns0:state id="B">
<ns0:transition target="A" event="e2">
<ns0:log expr="&quot;triggered by e2&quot;"/>
diff --git a/test/scxml-test-framework/test/atom3-basic-tests/m2.json b/test/scxml-test-framework/test/atom3-basic-tests/m2.json
index 7c0f278..3ac5a1a 100644
--- a/test/scxml-test-framework/test/atom3-basic-tests/m2.json
+++ b/test/scxml-test-framework/test/atom3-basic-tests/m2.json
@@ -1,15 +1,15 @@
{
- "initialConfiguration" : ["A"],
- "events" : [
- {
- "event" : { "name" : "e1" },
- "nextConfiguration" : ["B"]
- },
- {
- "event" : { "name" : "e2" },
- "nextConfiguration" : ["A"]
- }
- ]
+ "initialConfiguration" : ["A"],
+ "events" : [
+ {
+ "event" : { "name" : "e1" },
+ "nextConfiguration" : ["B"]
+ },
+ {
+ "event" : { "name" : "e2" },
+ "nextConfiguration" : ["A"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/atom3-basic-tests/m2.scxml b/test/scxml-test-framework/test/atom3-basic-tests/m2.scxml
index 750d263..eb959b9 100644
--- a/test/scxml-test-framework/test/atom3-basic-tests/m2.scxml
+++ b/test/scxml-test-framework/test/atom3-basic-tests/m2.scxml
@@ -1,4 +1,6 @@
-<ns0:scxml xmlns:ns0="http://www.w3.org/2005/07/scxml" profile="ecmascript" version="1.0" name="root">
+<ns0:scxml
+ datamodel="ecmascript"
+ xmlns:ns0="http://www.w3.org/2005/07/scxml" version="1.0" name="root">
<ns0:state id="AB">
<ns0:initial>
<ns0:transition target="A"/>
@@ -20,7 +22,4 @@
</ns0:transition>
</ns0:state>
</ns0:state>
- <ns0:initial>
- <ns0:transition target="AB"/>
- </ns0:initial>
</ns0:scxml>
diff --git a/test/scxml-test-framework/test/atom3-basic-tests/m3.json b/test/scxml-test-framework/test/atom3-basic-tests/m3.json
index 981ac5f..7a3414f 100644
--- a/test/scxml-test-framework/test/atom3-basic-tests/m3.json
+++ b/test/scxml-test-framework/test/atom3-basic-tests/m3.json
@@ -1,23 +1,23 @@
{
- "initialConfiguration" : ["A"],
- "events" : [
- {
- "event" : { "name" : "e1" },
- "nextConfiguration" : ["B"]
- },
- {
- "event" : { "name" : "e2" },
- "nextConfiguration" : ["A"]
- },
- {
- "event" : { "name" : "e1" },
- "nextConfiguration" : ["B"]
- },
- {
- "event" : { "name" : "e1" },
- "nextConfiguration" : ["C"]
- }
- ]
+ "initialConfiguration" : ["A"],
+ "events" : [
+ {
+ "event" : { "name" : "e1" },
+ "nextConfiguration" : ["B"]
+ },
+ {
+ "event" : { "name" : "e2" },
+ "nextConfiguration" : ["A"]
+ },
+ {
+ "event" : { "name" : "e1" },
+ "nextConfiguration" : ["B"]
+ },
+ {
+ "event" : { "name" : "e1" },
+ "nextConfiguration" : ["C"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/atom3-basic-tests/m3.scxml b/test/scxml-test-framework/test/atom3-basic-tests/m3.scxml
index ddef66c..a2ceb34 100644
--- a/test/scxml-test-framework/test/atom3-basic-tests/m3.scxml
+++ b/test/scxml-test-framework/test/atom3-basic-tests/m3.scxml
@@ -1,4 +1,6 @@
-<ns0:scxml xmlns:ns0="http://www.w3.org/2005/07/scxml" profile="ecmascript" version="1.0" name="root">
+<ns0:scxml
+ datamodel="ecmascript"
+ xmlns:ns0="http://www.w3.org/2005/07/scxml" version="1.0" name="root">
<ns0:state id="AB">
<ns0:initial>
<ns0:transition target="A"/>
@@ -21,9 +23,6 @@
</ns0:state>
<ns0:transition target="C" event="e1"/>
</ns0:state>
- <ns0:initial>
- <ns0:transition target="AB"/>
- </ns0:initial>
<ns0:state id="C">
<ns0:onentry>
<ns0:log expr="&quot;entering state C&quot;"/>
diff --git a/test/scxml-test-framework/test/basic/basic0.json b/test/scxml-test-framework/test/basic/basic0.json
index 871e757..0df730d 100644
--- a/test/scxml-test-framework/test/basic/basic0.json
+++ b/test/scxml-test-framework/test/basic/basic0.json
@@ -1,6 +1,6 @@
{
- "initialConfiguration" : ["a"],
- "events" : []
+ "initialConfiguration" : ["a"],
+ "events" : []
}
diff --git a/test/scxml-test-framework/test/basic/basic0.scxml b/test/scxml-test-framework/test/basic/basic0.scxml
index 926495f..23eff63 100644
--- a/test/scxml-test-framework/test/basic/basic0.scxml
+++ b/test/scxml-test-framework/test/basic/basic0.scxml
@@ -15,13 +15,12 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="a">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="a">
- <state id="a"/>
+ <state id="a"/>
</scxml>
diff --git a/test/scxml-test-framework/test/basic/basic1.json b/test/scxml-test-framework/test/basic/basic1.json
index 1d2faec..c27c2fd 100644
--- a/test/scxml-test-framework/test/basic/basic1.json
+++ b/test/scxml-test-framework/test/basic/basic1.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["b"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/basic/basic1.scxml b/test/scxml-test-framework/test/basic/basic1.scxml
index d12b092..304efbc 100644
--- a/test/scxml-test-framework/test/basic/basic1.scxml
+++ b/test/scxml-test-framework/test/basic/basic1.scxml
@@ -15,19 +15,14 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
+ <state id="a">
+ <transition target="b" event="t"/>
+ </state>
- <state id="a">
- <transition target="b" event="t"/>
- </state>
-
- <state id="b"/>
+ <state id="b"/>
</scxml>
diff --git a/test/scxml-test-framework/test/basic/basic2.json b/test/scxml-test-framework/test/basic/basic2.json
index 3fa286e..9eac7e9 100644
--- a/test/scxml-test-framework/test/basic/basic2.json
+++ b/test/scxml-test-framework/test/basic/basic2.json
@@ -1,15 +1,15 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b"]
- },
- {
- "event" : { "name" : "t2" },
- "nextConfiguration" : ["c"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["b"]
+ },
+ {
+ "event" : { "name" : "t2" },
+ "nextConfiguration" : ["c"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/basic/basic2.scxml b/test/scxml-test-framework/test/basic/basic2.scxml
index 66364c3..68057fd 100644
--- a/test/scxml-test-framework/test/basic/basic2.scxml
+++ b/test/scxml-test-framework/test/basic/basic2.scxml
@@ -15,24 +15,18 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
+ <state id="a">
+ <transition target="b" event="t"/>
+ </state>
- <state id="a">
- <transition target="b" event="t"/>
- </state>
+ <state id="b">
+ <transition target="c" event="t2"/>
+ </state>
- <state id="b">
- <transition target="c" event="t2"/>
- </state>
-
- <state id="c"/>
+ <state id="c"/>
</scxml>
diff --git a/test/scxml-test-framework/test/cond-js/TestConditionalTransition.json b/test/scxml-test-framework/test/cond-js/TestConditionalTransition.json
index b586923..2806be0 100644
--- a/test/scxml-test-framework/test/cond-js/TestConditionalTransition.json
+++ b/test/scxml-test-framework/test/cond-js/TestConditionalTransition.json
@@ -1,31 +1,31 @@
{
- "initialConfiguration" : ["b"],
- "events" : [
- {
- "event" : { "name" : "t1" },
- "nextConfiguration" : ["d1"]
- },
- {
- "event" : { "name" : "t2" },
- "nextConfiguration" : ["e1"]
- },
- {
- "event" : { "name" : "t3" },
- "nextConfiguration" : ["f2"]
- },
- {
- "event" : { "name" : "t4" },
- "nextConfiguration" : ["h"]
- },
- {
- "event" : { "name" : "t5" },
- "nextConfiguration" : ["i"]
- },
- {
- "event" : { "name" : "t5" },
- "nextConfiguration" : ["last"]
- }
- ]
+ "initialConfiguration" : ["b"],
+ "events" : [
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["d1"]
+ },
+ {
+ "event" : { "name" : "t2" },
+ "nextConfiguration" : ["e1"]
+ },
+ {
+ "event" : { "name" : "t3" },
+ "nextConfiguration" : ["f2"]
+ },
+ {
+ "event" : { "name" : "t4" },
+ "nextConfiguration" : ["h"]
+ },
+ {
+ "event" : { "name" : "t5" },
+ "nextConfiguration" : ["i"]
+ },
+ {
+ "event" : { "name" : "t5" },
+ "nextConfiguration" : ["last"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/cond-js/TestConditionalTransition.scxml b/test/scxml-test-framework/test/cond-js/TestConditionalTransition.scxml
index ed4b733..5d541be 100644
--- a/test/scxml-test-framework/test/cond-js/TestConditionalTransition.scxml
+++ b/test/scxml-test-framework/test/cond-js/TestConditionalTransition.scxml
@@ -20,84 +20,80 @@ This is to test transitions with guard conditions, and multiple
transitions originating from the same state.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- name="root"
- profile="ecmascript">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ name="root">
- <initial>
- <transition target="a"/>
- </initial>
+ <!-- default transition -->
+ <state id="a">
+ <transition target="b"/>
+ </state>
- <!-- default transition -->
- <state id="a">
- <transition target="b"/>
- </state>
+ <!-- regular transition -->
+ <state id="b">
+ <transition target="c" event="t1"/>
+ </state>
- <!-- regular transition -->
- <state id="b">
- <transition target="c" event="t1"/>
- </state>
+ <!-- two default transitions, first should get priority (based on document order), end in d1 -->
+ <state id="c">
+ <transition target="d1"/>
+ <transition target="d2"/>
+ </state>
- <!-- two default transitions, first should get priority (based on document order), end in d1 -->
- <state id="c">
- <transition target="d1"/>
- <transition target="d2"/>
- </state>
+ <!-- two regular transitions, first should get priority, end in e1 -->
+ <state id="d1">
+ <transition target="e1" event="t2"/>
+ <transition target="e2" event="t2"/>
+ </state>
- <!-- two regular transitions, first should get priority, end in e1 -->
- <state id="d1">
- <transition target="e1" event="t2"/>
- <transition target="e2" event="t2"/>
- </state>
+ <state id="d2"/>
- <state id="d2"/>
+ <!-- two transitions with guard conditions;
+ first has priority, but will fail, so second transition should be taken,
+ end in f2 -->
+ <state id="e1">
+ <transition target="f1" event="t3" cond="false"/>
+ <transition target="f2" event="t3" cond="true"/>
+ </state>
- <!-- two transitions with guard conditions;
- first has priority, but will fail, so second transition should be taken,
- end in f2 -->
- <state id="e1">
- <transition target="f1" event="t3" cond="false"/>
- <transition target="f2" event="t3" cond="true"/>
- </state>
+ <state id="e2"/>
- <state id="e2"/>
+ <state id="f1"/>
- <state id="f1"/>
+ <!-- like above, but with three transitions -->
+ <state id="f2">
+ <transition target="g1" event="t4" cond="false"/>
+ <transition target="g2" event="t4" cond="false"/>
+ <transition target="g3" event="t4" cond="true"/>
+ </state>
- <!-- like above, but with three transitions -->
- <state id="f2">
- <transition target="g1" event="t4" cond="false"/>
- <transition target="g2" event="t4" cond="false"/>
- <transition target="g3" event="t4" cond="true"/>
- </state>
+ <state id="g1"/>
- <state id="g1"/>
+ <state id="g2"/>
- <state id="g2"/>
+ <state id="g3">
- <state id="g3">
+ <initial>
+ <transition target="h"/>
+ </initial>
- <initial>
- <transition target="h"/>
- </initial>
+ <!-- this one should pass -->
+ <state id="h">
+ <transition target="i" event="t5" cond="true"/>
+ </state>
- <!-- this one should pass -->
- <state id="h">
- <transition target="i" event="t5" cond="true"/>
- </state>
+ <!-- this one should not pass, and the outer transition should be taken -->
+ <state id="i">
+ <transition target="j" event="t5" cond="false"/>
+ </state>
- <!-- this one should not pass, and the outer transition should be taken -->
- <state id="i">
- <transition target="j" event="t5" cond="false"/>
- </state>
+ <state id="j"/>
- <state id="j"/>
+ <transition target="last" event="t5" cond="true"/>
+ </state>
- <transition target="last" event="t5" cond="true"/>
- </state>
-
- <state id="last"/>
+ <state id="last"/>
</scxml>
diff --git a/test/scxml-test-framework/test/cond-js/test0.json b/test/scxml-test-framework/test/cond-js/test0.json
index 1d2faec..c27c2fd 100644
--- a/test/scxml-test-framework/test/cond-js/test0.json
+++ b/test/scxml-test-framework/test/cond-js/test0.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["b"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/cond-js/test0.scxml b/test/scxml-test-framework/test/cond-js/test0.scxml
index 11d6a3b..696f55b 100644
--- a/test/scxml-test-framework/test/cond-js/test0.scxml
+++ b/test/scxml-test-framework/test/cond-js/test0.scxml
@@ -15,20 +15,15 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
+ <state id="a">
+ <transition target="b" event="t" cond="true"/>
+ </state>
- <state id="a">
- <transition target="b" event="t" cond="true"/>
- </state>
-
- <state id="b"/>
+ <state id="b"/>
</scxml>
diff --git a/test/scxml-test-framework/test/cond-js/test1.json b/test/scxml-test-framework/test/cond-js/test1.json
index 1d2faec..c27c2fd 100644
--- a/test/scxml-test-framework/test/cond-js/test1.json
+++ b/test/scxml-test-framework/test/cond-js/test1.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["b"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/cond-js/test1.scxml b/test/scxml-test-framework/test/cond-js/test1.scxml
index a25535b..84fe1fa 100644
--- a/test/scxml-test-framework/test/cond-js/test1.scxml
+++ b/test/scxml-test-framework/test/cond-js/test1.scxml
@@ -15,23 +15,18 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
+ <state id="a">
+ <transition target="f" event="t" cond="false"/>
+ <transition target="b" event="t" cond="true"/>
+ </state>
- <state id="a">
- <transition target="f" event="t" cond="false"/>
- <transition target="b" event="t" cond="true"/>
- </state>
+ <state id="b"/>
- <state id="b"/>
-
- <state id="f"/>
+ <state id="f"/>
</scxml>
diff --git a/test/scxml-test-framework/test/cond-js/test2.json b/test/scxml-test-framework/test/cond-js/test2.json
index 1d2faec..c27c2fd 100644
--- a/test/scxml-test-framework/test/cond-js/test2.json
+++ b/test/scxml-test-framework/test/cond-js/test2.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["b"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/cond-js/test2.scxml b/test/scxml-test-framework/test/cond-js/test2.scxml
index 11d6a3b..696f55b 100644
--- a/test/scxml-test-framework/test/cond-js/test2.scxml
+++ b/test/scxml-test-framework/test/cond-js/test2.scxml
@@ -15,20 +15,15 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
+ <state id="a">
+ <transition target="b" event="t" cond="true"/>
+ </state>
- <state id="a">
- <transition target="b" event="t" cond="true"/>
- </state>
-
- <state id="b"/>
+ <state id="b"/>
</scxml>
diff --git a/test/scxml-test-framework/test/default-initial-state/initial1.json b/test/scxml-test-framework/test/default-initial-state/initial1.json
index 1d2faec..c27c2fd 100644
--- a/test/scxml-test-framework/test/default-initial-state/initial1.json
+++ b/test/scxml-test-framework/test/default-initial-state/initial1.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["b"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/default-initial-state/initial1.scxml b/test/scxml-test-framework/test/default-initial-state/initial1.scxml
index 0e28f5a..76634c2 100644
--- a/test/scxml-test-framework/test/default-initial-state/initial1.scxml
+++ b/test/scxml-test-framework/test/default-initial-state/initial1.scxml
@@ -15,15 +15,15 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript" >
- <!-- notice that no id is specified here -->
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+ <!-- notice that no id is specified here -->
- <state id="a">
- <transition target="b" event="t"/>
- </state>
+ <state id="a">
+ <transition target="b" event="t"/>
+ </state>
- <state id="b"/>
+ <state id="b"/>
</scxml>
diff --git a/test/scxml-test-framework/test/default-initial-state/initial2.json b/test/scxml-test-framework/test/default-initial-state/initial2.json
index 12656c3..6c8bd47 100644
--- a/test/scxml-test-framework/test/default-initial-state/initial2.json
+++ b/test/scxml-test-framework/test/default-initial-state/initial2.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["b"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/default-initial-state/initial2.scxml b/test/scxml-test-framework/test/default-initial-state/initial2.scxml
index da3aa62..0fc28b9 100644
--- a/test/scxml-test-framework/test/default-initial-state/initial2.scxml
+++ b/test/scxml-test-framework/test/default-initial-state/initial2.scxml
@@ -15,16 +15,16 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- initial="a">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="a">
- <state id="a">
- <transition target="b" event="t"/>
- </state>
+ <state id="a">
+ <transition target="b" event="t"/>
+ </state>
- <state id="b"/>
+ <state id="b"/>
</scxml>
diff --git a/test/scxml-test-framework/test/default-initial-state/initial3.json b/test/scxml-test-framework/test/default-initial-state/initial3.json
deleted file mode 100644
index 510b8b6..0000000
--- a/test/scxml-test-framework/test/default-initial-state/initial3.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b"]
- }
- ]
-}
-
-
-
-
-
diff --git a/test/scxml-test-framework/test/default-initial-state/initial3.scxml b/test/scxml-test-framework/test/default-initial-state/initial3.scxml
deleted file mode 100644
index 2517fb3..0000000
--- a/test/scxml-test-framework/test/default-initial-state/initial3.scxml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript" >
-
- <initial>
- <transition target="a"/>
- </initial>
-
- <state id="a">
- <transition target="b" event="t"/>
- </state>
-
- <state id="b"/>
-
-</scxml>
-
diff --git a/test/scxml-test-framework/test/delayedSend/send1.json b/test/scxml-test-framework/test/delayedSend/send1.json
index b219e13..2c1cda6 100644
--- a/test/scxml-test-framework/test/delayedSend/send1.json
+++ b/test/scxml-test-framework/test/delayedSend/send1.json
@@ -1,16 +1,16 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t1" },
- "nextConfiguration" : ["b"]
- },
- {
- "after" : 100,
- "event" : { "name" : "t2" },
- "nextConfiguration" : ["d"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["b"]
+ },
+ {
+ "after" : 100,
+ "event" : { "name" : "t2" },
+ "nextConfiguration" : ["d"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/delayedSend/send1.scxml b/test/scxml-test-framework/test/delayedSend/send1.scxml
index 5e9b83d..de2d401 100644
--- a/test/scxml-test-framework/test/delayedSend/send1.scxml
+++ b/test/scxml-test-framework/test/delayedSend/send1.scxml
@@ -15,30 +15,25 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
-
- <state id="a">
- <transition target="b" event="t1">
- <send event="s" delay="10ms"/>
- </transition>
- </state>
-
- <state id="b">
- <transition target="c" event="s"/>
- </state>
-
- <state id="c">
- <transition target="d" event="t2"/>
- </state>
-
- <state id="d"/>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
+ <state id="a">
+ <transition target="b" event="t1">
+ <send event="s" delay="10ms"/>
+ </transition>
+ </state>
+
+ <state id="b">
+ <transition target="c" event="s"/>
+ </state>
+
+ <state id="c">
+ <transition target="d" event="t2"/>
+ </state>
+
+ <state id="d"/>
</scxml>
diff --git a/test/scxml-test-framework/test/delayedSend/send2.json b/test/scxml-test-framework/test/delayedSend/send2.json
index b219e13..2c1cda6 100644
--- a/test/scxml-test-framework/test/delayedSend/send2.json
+++ b/test/scxml-test-framework/test/delayedSend/send2.json
@@ -1,16 +1,16 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t1" },
- "nextConfiguration" : ["b"]
- },
- {
- "after" : 100,
- "event" : { "name" : "t2" },
- "nextConfiguration" : ["d"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["b"]
+ },
+ {
+ "after" : 100,
+ "event" : { "name" : "t2" },
+ "nextConfiguration" : ["d"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/delayedSend/send2.scxml b/test/scxml-test-framework/test/delayedSend/send2.scxml
index b88e127..c16064a 100644
--- a/test/scxml-test-framework/test/delayedSend/send2.scxml
+++ b/test/scxml-test-framework/test/delayedSend/send2.scxml
@@ -15,33 +15,28 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
+ <state id="a">
+ <onexit>
+ <send event="s" delay="10ms"/>
+ </onexit>
- <state id="a">
- <onexit>
- <send event="s" delay="10ms"/>
- </onexit>
+ <transition target="b" event="t1">
+ </transition>
+ </state>
- <transition target="b" event="t1">
- </transition>
- </state>
+ <state id="b">
+ <transition target="c" event="s"/>
+ </state>
- <state id="b">
- <transition target="c" event="s"/>
- </state>
+ <state id="c">
+ <transition target="d" event="t2"/>
+ </state>
- <state id="c">
- <transition target="d" event="t2"/>
- </state>
-
- <state id="d"/>
+ <state id="d"/>
</scxml>
diff --git a/test/scxml-test-framework/test/delayedSend/send3.json b/test/scxml-test-framework/test/delayedSend/send3.json
index b219e13..2c1cda6 100644
--- a/test/scxml-test-framework/test/delayedSend/send3.json
+++ b/test/scxml-test-framework/test/delayedSend/send3.json
@@ -1,16 +1,16 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t1" },
- "nextConfiguration" : ["b"]
- },
- {
- "after" : 100,
- "event" : { "name" : "t2" },
- "nextConfiguration" : ["d"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["b"]
+ },
+ {
+ "after" : 100,
+ "event" : { "name" : "t2" },
+ "nextConfiguration" : ["d"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/delayedSend/send3.scxml b/test/scxml-test-framework/test/delayedSend/send3.scxml
index efcbc3b..6c2fcc9 100644
--- a/test/scxml-test-framework/test/delayedSend/send3.scxml
+++ b/test/scxml-test-framework/test/delayedSend/send3.scxml
@@ -15,33 +15,28 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
+ <state id="a">
+ <transition target="b" event="t1">
+ </transition>
+ </state>
- <state id="a">
- <transition target="b" event="t1">
- </transition>
- </state>
+ <state id="b">
+ <onentry>
+ <send event="s" delay="10ms"/>
+ </onentry>
- <state id="b">
- <onentry>
- <send event="s" delay="10ms"/>
- </onentry>
+ <transition target="c" event="s"/>
+ </state>
- <transition target="c" event="s"/>
- </state>
+ <state id="c">
+ <transition target="d" event="t2"/>
+ </state>
- <state id="c">
- <transition target="d" event="t2"/>
- </state>
-
- <state id="d"/>
+ <state id="d"/>
</scxml>
diff --git a/test/scxml-test-framework/test/documentOrder/documentOrder0.json b/test/scxml-test-framework/test/documentOrder/documentOrder0.json
index 1d2faec..c27c2fd 100644
--- a/test/scxml-test-framework/test/documentOrder/documentOrder0.json
+++ b/test/scxml-test-framework/test/documentOrder/documentOrder0.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["b"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/documentOrder/documentOrder0.scxml b/test/scxml-test-framework/test/documentOrder/documentOrder0.scxml
index 21d25e7..530a981 100644
--- a/test/scxml-test-framework/test/documentOrder/documentOrder0.scxml
+++ b/test/scxml-test-framework/test/documentOrder/documentOrder0.scxml
@@ -15,23 +15,18 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
-
- <state id="a">
- <transition target="b" event="t"/>
- <transition target="c" event="t"/>
- </state>
-
- <state id="b"/>
-
- <state id="c"/>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
+ <state id="a">
+ <transition target="b" event="t"/>
+ <transition target="c" event="t"/>
+ </state>
+
+ <state id="b"/>
+
+ <state id="c"/>
</scxml>
diff --git a/test/scxml-test-framework/test/foreach/test1.json b/test/scxml-test-framework/test/foreach/test1.json
index 8424ef5..0e49c49 100644
--- a/test/scxml-test-framework/test/foreach/test1.json
+++ b/test/scxml-test-framework/test/foreach/test1.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/foreach/test1.scxml b/test/scxml-test-framework/test/foreach/test1.scxml
index 80762da..6b7f87e 100644
--- a/test/scxml-test-framework/test/foreach/test1.scxml
+++ b/test/scxml-test-framework/test/foreach/test1.scxml
@@ -18,34 +18,33 @@
This test illustrates how possibly infinite loops may be created. Here, without the counter and the cond, the big-step would never complete.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <datamodel>
- <data id="myArray" expr="[1,3,5,7,9]"/>
- <data id="myItem" expr="0"/>
- <data id="myIndex" expr="0"/>
- <data id="sum" expr="0"/>
- <data id="indexSum" expr="0"/>
- </datamodel>
+ <datamodel>
+ <data id="myArray" expr="[1,3,5,7,9]"/>
+ <data id="myItem" expr="0"/>
+ <data id="myIndex" expr="0"/>
+ <data id="sum" expr="0"/>
+ <data id="indexSum" expr="0"/>
+ </datamodel>
- <state id="a">
- <onentry>
- <log label="before" expr="[sum,indexSum]"/>
- <foreach array="myArray" item="myItem" index="myIndex">
- <assign location="sum" expr="sum + myItem"/>
- <assign location="indexSum" expr="indexSum + myIndex"/>
- </foreach>
- <foreach array="myArray" item="myItem">
- <assign location="sum" expr="sum + myItem"/>
- </foreach>
- <log label="after" expr="[sum,indexSum]"/>
- </onentry>
- <transition target="c" event="t" cond="sum === 50 &amp;&amp; indexSum === 10"/>
- </state>
+ <state id="a">
+ <onentry>
+ <log label="before" expr="[sum,indexSum]"/>
+ <foreach array="myArray" item="myItem" index="myIndex">
+ <assign location="sum" expr="sum + myItem"/>
+ <assign location="indexSum" expr="indexSum + myIndex"/>
+ </foreach>
+ <foreach array="myArray" item="myItem">
+ <assign location="sum" expr="sum + myItem"/>
+ </foreach>
+ <log label="after" expr="[sum,indexSum]"/>
+ </onentry>
+ <transition target="c" event="t" cond="sum === 50 &amp;&amp; indexSum === 10"/>
+ </state>
- <state id="c"/>
+ <state id="c"/>
</scxml>
diff --git a/test/scxml-test-framework/test/hierarchy+documentOrder/test0.json b/test/scxml-test-framework/test/hierarchy+documentOrder/test0.json
index 883bfd9..116f26c 100644
--- a/test/scxml-test-framework/test/hierarchy+documentOrder/test0.json
+++ b/test/scxml-test-framework/test/hierarchy+documentOrder/test0.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a2"]
- }
- ]
+ "initialConfiguration" : ["a1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a2"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/hierarchy+documentOrder/test0.scxml b/test/scxml-test-framework/test/hierarchy+documentOrder/test0.scxml
index 6b48a10..540c944 100644
--- a/test/scxml-test-framework/test/hierarchy+documentOrder/test0.scxml
+++ b/test/scxml-test-framework/test/hierarchy+documentOrder/test0.scxml
@@ -15,30 +15,25 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <initial id="intitial1">
- <transition target="a1"/>
- </initial>
-
- <state id="a">
- <state id="a1">
- <transition target="a2" event="t"/>
- <transition target="c" event="t"/>
- </state>
-
- <state id="a2">
- </state>
-
- <transition target="b" event="t"/>
- </state>
-
- <state id="b"/>
-
- <state id="c"/>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
+ <state id="a">
+ <state id="a1">
+ <transition target="a2" event="t"/>
+ <transition target="c" event="t"/>
+ </state>
+
+ <state id="a2">
+ </state>
+
+ <transition target="b" event="t"/>
+ </state>
+
+ <state id="b"/>
+
+ <state id="c"/>
</scxml>
diff --git a/test/scxml-test-framework/test/hierarchy+documentOrder/test1.json b/test/scxml-test-framework/test/hierarchy+documentOrder/test1.json
index 12390fe..7fd2206 100644
--- a/test/scxml-test-framework/test/hierarchy+documentOrder/test1.json
+++ b/test/scxml-test-framework/test/hierarchy+documentOrder/test1.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b"]
- }
- ]
+ "initialConfiguration" : ["a1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["b"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/hierarchy+documentOrder/test1.scxml b/test/scxml-test-framework/test/hierarchy+documentOrder/test1.scxml
index d8b23f0..7f29543 100644
--- a/test/scxml-test-framework/test/hierarchy+documentOrder/test1.scxml
+++ b/test/scxml-test-framework/test/hierarchy+documentOrder/test1.scxml
@@ -15,30 +15,25 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <initial id="intitial1">
- <transition target="a1"/>
- </initial>
-
- <state id="a">
- <state id="a1">
- <transition target="b" event="t"/>
- <transition target="c" event="t"/>
- </state>
-
- <state id="a2">
- </state>
-
- <transition target="a2" event="t"/>
- </state>
-
- <state id="b"/>
-
- <state id="c"/>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
+ <state id="a">
+ <state id="a1">
+ <transition target="b" event="t"/>
+ <transition target="c" event="t"/>
+ </state>
+
+ <state id="a2">
+ </state>
+
+ <transition target="a2" event="t"/>
+ </state>
+
+ <state id="b"/>
+
+ <state id="c"/>
</scxml>
diff --git a/test/scxml-test-framework/test/hierarchy/hier0.json b/test/scxml-test-framework/test/hierarchy/hier0.json
index 883bfd9..116f26c 100644
--- a/test/scxml-test-framework/test/hierarchy/hier0.json
+++ b/test/scxml-test-framework/test/hierarchy/hier0.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a2"]
- }
- ]
+ "initialConfiguration" : ["a1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a2"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/hierarchy/hier0.scxml b/test/scxml-test-framework/test/hierarchy/hier0.scxml
index 1c45ba7..dad78a3 100644
--- a/test/scxml-test-framework/test/hierarchy/hier0.scxml
+++ b/test/scxml-test-framework/test/hierarchy/hier0.scxml
@@ -15,23 +15,18 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <initial id="intitial1">
- <transition target="a1"/>
- </initial>
-
- <state id="a">
- <state id="a1">
- <transition target="a2" event="t"/>
- </state>
-
- <state id="a2">
- </state>
- </state>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
+ <state id="a">
+ <state id="a1">
+ <transition target="a2" event="t"/>
+ </state>
+
+ <state id="a2">
+ </state>
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/hierarchy/hier1.json b/test/scxml-test-framework/test/hierarchy/hier1.json
index 883bfd9..116f26c 100644
--- a/test/scxml-test-framework/test/hierarchy/hier1.json
+++ b/test/scxml-test-framework/test/hierarchy/hier1.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a2"]
- }
- ]
+ "initialConfiguration" : ["a1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a2"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/hierarchy/hier1.scxml b/test/scxml-test-framework/test/hierarchy/hier1.scxml
index 654994d..c4d76ee 100644
--- a/test/scxml-test-framework/test/hierarchy/hier1.scxml
+++ b/test/scxml-test-framework/test/hierarchy/hier1.scxml
@@ -15,27 +15,22 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <initial id="intitial1">
- <transition target="a1"/>
- </initial>
+ <state id="a">
+ <state id="a1">
+ <transition target="a2" event="t"/>
+ </state>
- <state id="a">
- <state id="a1">
- <transition target="a2" event="t"/>
- </state>
+ <state id="a2">
+ </state>
- <state id="a2">
- </state>
+ <transition target="b" event="t"/>
+ </state>
- <transition target="b" event="t"/>
- </state>
-
- <state id="b"/>
+ <state id="b"/>
</scxml>
diff --git a/test/scxml-test-framework/test/hierarchy/hier2.json b/test/scxml-test-framework/test/hierarchy/hier2.json
index 12390fe..7fd2206 100644
--- a/test/scxml-test-framework/test/hierarchy/hier2.json
+++ b/test/scxml-test-framework/test/hierarchy/hier2.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b"]
- }
- ]
+ "initialConfiguration" : ["a1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["b"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/hierarchy/hier2.scxml b/test/scxml-test-framework/test/hierarchy/hier2.scxml
index e1c3bb1..d0405f6 100644
--- a/test/scxml-test-framework/test/hierarchy/hier2.scxml
+++ b/test/scxml-test-framework/test/hierarchy/hier2.scxml
@@ -15,27 +15,22 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <initial id="intitial1">
- <transition target="a1"/>
- </initial>
+ <state id="a">
+ <state id="a1">
+ <transition target="b" event="t"/>
+ </state>
- <state id="a">
- <state id="a1">
- <transition target="b" event="t"/>
- </state>
+ <state id="a2">
+ </state>
- <state id="a2">
- </state>
+ <transition target="a2" event="t"/>
+ </state>
- <transition target="a2" event="t"/>
- </state>
-
- <state id="b"/>
+ <state id="b"/>
</scxml>
diff --git a/test/scxml-test-framework/test/history/history0.json b/test/scxml-test-framework/test/history/history0.json
index b614a61..cba3ae5 100644
--- a/test/scxml-test-framework/test/history/history0.json
+++ b/test/scxml-test-framework/test/history/history0.json
@@ -1,23 +1,23 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t1" },
- "nextConfiguration" : ["b2"]
- },
- {
- "event" : { "name" : "t2" },
- "nextConfiguration" : ["b3"]
- },
- {
- "event" : { "name" : "t3" },
- "nextConfiguration" : ["a"]
- },
- {
- "event" : { "name" : "t1" },
- "nextConfiguration" : ["b3"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["b2"]
+ },
+ {
+ "event" : { "name" : "t2" },
+ "nextConfiguration" : ["b3"]
+ },
+ {
+ "event" : { "name" : "t3" },
+ "nextConfiguration" : ["a"]
+ },
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["b3"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/history/history0.scxml b/test/scxml-test-framework/test/history/history0.scxml
index 1473049..0dbd622 100644
--- a/test/scxml-test-framework/test/history/history0.scxml
+++ b/test/scxml-test-framework/test/history/history0.scxml
@@ -15,32 +15,31 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="a">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="a">
- <state id="a">
- <transition target="h" event="t1"/>
- </state>
+ <state id="a">
+ <transition target="h" event="t1"/>
+ </state>
- <state id="b" initial="b1">
+ <state id="b" initial="b1">
- <history id="h">
- <transition target="b2"/>
- </history>
+ <history id="h">
+ <transition target="b2"/>
+ </history>
- <state id="b1"/>
+ <state id="b1"/>
- <state id="b2">
- <transition event="t2" target="b3"/>
- </state>
+ <state id="b2">
+ <transition event="t2" target="b3"/>
+ </state>
- <state id="b3">
- <transition event="t3" target="a"/>
- </state>
- </state>
+ <state id="b3">
+ <transition event="t3" target="a"/>
+ </state>
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/history/history1.json b/test/scxml-test-framework/test/history/history1.json
index 02eb502..1dfeb82 100644
--- a/test/scxml-test-framework/test/history/history1.json
+++ b/test/scxml-test-framework/test/history/history1.json
@@ -1,23 +1,23 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t1" },
- "nextConfiguration" : ["b1.2"]
- },
- {
- "event" : { "name" : "t2" },
- "nextConfiguration" : ["b1.3"]
- },
- {
- "event" : { "name" : "t3" },
- "nextConfiguration" : ["a"]
- },
- {
- "event" : { "name" : "t1" },
- "nextConfiguration" : ["b1.3"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["b1.2"]
+ },
+ {
+ "event" : { "name" : "t2" },
+ "nextConfiguration" : ["b1.3"]
+ },
+ {
+ "event" : { "name" : "t3" },
+ "nextConfiguration" : ["a"]
+ },
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["b1.3"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/history/history1.scxml b/test/scxml-test-framework/test/history/history1.scxml
index 4dd5aec..6d2235f 100644
--- a/test/scxml-test-framework/test/history/history1.scxml
+++ b/test/scxml-test-framework/test/history/history1.scxml
@@ -15,36 +15,35 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="a">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="a">
- <state id="a">
- <transition target="h" event="t1"/>
- </state>
+ <state id="a">
+ <transition target="h" event="t1"/>
+ </state>
- <state id="b" initial="b1">
+ <state id="b" initial="b1">
- <history id="h" type="deep">
- <transition target="b1.2"/>
- </history>
+ <history id="h" type="deep">
+ <transition target="b1.2"/>
+ </history>
- <state id="b1" initial="b1.1">
- <state id="b1.1"/>
+ <state id="b1" initial="b1.1">
+ <state id="b1.1"/>
- <state id="b1.2">
- <transition event="t2" target="b1.3"/>
- </state>
+ <state id="b1.2">
+ <transition event="t2" target="b1.3"/>
+ </state>
- <state id="b1.3">
- <transition event="t3" target="a"/>
- </state>
- </state>
+ <state id="b1.3">
+ <transition event="t3" target="a"/>
+ </state>
+ </state>
- </state>
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/history/history2.json b/test/scxml-test-framework/test/history/history2.json
index 3bbcac1..4cc3ee4 100644
--- a/test/scxml-test-framework/test/history/history2.json
+++ b/test/scxml-test-framework/test/history/history2.json
@@ -1,23 +1,23 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t1" },
- "nextConfiguration" : ["b1.2"]
- },
- {
- "event" : { "name" : "t2" },
- "nextConfiguration" : ["b1.3"]
- },
- {
- "event" : { "name" : "t3" },
- "nextConfiguration" : ["a"]
- },
- {
- "event" : { "name" : "t1" },
- "nextConfiguration" : ["b1.1"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["b1.2"]
+ },
+ {
+ "event" : { "name" : "t2" },
+ "nextConfiguration" : ["b1.3"]
+ },
+ {
+ "event" : { "name" : "t3" },
+ "nextConfiguration" : ["a"]
+ },
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["b1.1"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/history/history2.scxml b/test/scxml-test-framework/test/history/history2.scxml
index 9c691cb..2a2ab95 100644
--- a/test/scxml-test-framework/test/history/history2.scxml
+++ b/test/scxml-test-framework/test/history/history2.scxml
@@ -15,36 +15,35 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="a">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="a">
- <state id="a">
- <transition target="h" event="t1"/>
- </state>
+ <state id="a">
+ <transition target="h" event="t1"/>
+ </state>
- <state id="b" initial="b1">
+ <state id="b" initial="b1">
- <history id="h" type="shallow">
- <transition target="b1.2"/>
- </history>
+ <history id="h" type="shallow">
+ <transition target="b1.2"/>
+ </history>
- <state id="b1" initial="b1.1">
- <state id="b1.1"/>
+ <state id="b1" initial="b1.1">
+ <state id="b1.1"/>
- <state id="b1.2">
- <transition event="t2" target="b1.3"/>
- </state>
+ <state id="b1.2">
+ <transition event="t2" target="b1.3"/>
+ </state>
- <state id="b1.3">
- <transition event="t3" target="a"/>
- </state>
- </state>
+ <state id="b1.3">
+ <transition event="t3" target="a"/>
+ </state>
+ </state>
- </state>
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/history/history3.json b/test/scxml-test-framework/test/history/history3.json
index d7b3593..4786e3a 100644
--- a/test/scxml-test-framework/test/history/history3.json
+++ b/test/scxml-test-framework/test/history/history3.json
@@ -1,23 +1,23 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t1" },
- "nextConfiguration" : ["b1","c1"]
- },
- {
- "event" : { "name" : "t2" },
- "nextConfiguration" : ["b2","c2"]
- },
- {
- "event" : { "name" : "t3" },
- "nextConfiguration" : ["a"]
- },
- {
- "event" : { "name" : "t4" },
- "nextConfiguration" : ["b2","c2"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["b1","c1"]
+ },
+ {
+ "event" : { "name" : "t2" },
+ "nextConfiguration" : ["b2","c2"]
+ },
+ {
+ "event" : { "name" : "t3" },
+ "nextConfiguration" : ["a"]
+ },
+ {
+ "event" : { "name" : "t4" },
+ "nextConfiguration" : ["b2","c2"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/history/history3.scxml b/test/scxml-test-framework/test/history/history3.scxml
index 0723031..6fd4de1 100644
--- a/test/scxml-test-framework/test/history/history3.scxml
+++ b/test/scxml-test-framework/test/history/history3.scxml
@@ -15,39 +15,40 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="a">
-
-
- <state id="a">
- <transition target="p" event="t1"/>
- <transition target="h" event="t4"/>
- </state>
-
- <parallel id="p">
- <history id="h" type="deep"/>
-
- <state id="b" initial="b1">
- <state id="b1">
- <transition target="b2" event="t2"/>
- </state>
-
- <state id="b2"/>
- </state>
-
- <state id="c" initial="c1">
- <state id="c1">
- <transition target="c2" event="t2"/>
- </state>
-
- <state id="c2"/>
- </state>
-
- <transition target="a" event="t3"/>
- </parallel>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="a">
+
+
+ <state id="a">
+ <transition target="p" event="t1"/>
+ <transition target="h" event="t4"/>
+ </state>
+
+ <parallel id="p">
+ <history id="h" type="deep">
+ <transition target="b"/>
+ </history>
+
+ <state id="b" initial="b1">
+ <state id="b1">
+ <transition target="b2" event="t2"/>
+ </state>
+
+ <state id="b2"/>
+ </state>
+
+ <state id="c" initial="c1">
+ <state id="c1">
+ <transition target="c2" event="t2"/>
+ </state>
+
+ <state id="c2"/>
+ </state>
+
+ <transition target="a" event="t3"/>
+ </parallel>
</scxml>
diff --git a/test/scxml-test-framework/test/history/history4.json b/test/scxml-test-framework/test/history/history4.json
index 094701b..e5bbc31 100644
--- a/test/scxml-test-framework/test/history/history4.json
+++ b/test/scxml-test-framework/test/history/history4.json
@@ -1,43 +1,43 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t1" },
- "nextConfiguration" : ["b1.1","c1.1"]
- },
- {
- "event" : { "name" : "t2" },
- "nextConfiguration" : ["b1.2","c1.2"]
- },
- {
- "event" : { "name" : "t3" },
- "nextConfiguration" : ["b2.1","c2.1"]
- },
- {
- "event" : { "name" : "t4" },
- "nextConfiguration" : ["b2.2","c2.2"]
- },
- {
- "event" : { "name" : "t5" },
- "nextConfiguration" : ["a"]
- },
- {
- "event" : { "name" : "t6" },
- "nextConfiguration" : ["b2.2","c2.1"]
- },
- {
- "event" : { "name" : "t7" },
- "nextConfiguration" : ["b2.2","c2.2"]
- },
- {
- "event" : { "name" : "t8" },
- "nextConfiguration" : ["a"]
- },
- {
- "event" : { "name" : "t9" },
- "nextConfiguration" : ["b2.2","c2.2"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["b1.1","c1.1"]
+ },
+ {
+ "event" : { "name" : "t2" },
+ "nextConfiguration" : ["b1.2","c1.2"]
+ },
+ {
+ "event" : { "name" : "t3" },
+ "nextConfiguration" : ["b2.1","c2.1"]
+ },
+ {
+ "event" : { "name" : "t4" },
+ "nextConfiguration" : ["b2.2","c2.2"]
+ },
+ {
+ "event" : { "name" : "t5" },
+ "nextConfiguration" : ["a"]
+ },
+ {
+ "event" : { "name" : "t6" },
+ "nextConfiguration" : ["b2.2","c2.1"]
+ },
+ {
+ "event" : { "name" : "t7" },
+ "nextConfiguration" : ["b2.2","c2.2"]
+ },
+ {
+ "event" : { "name" : "t8" },
+ "nextConfiguration" : ["a"]
+ },
+ {
+ "event" : { "name" : "t9" },
+ "nextConfiguration" : ["b2.2","c2.2"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/history/history4.scxml b/test/scxml-test-framework/test/history/history4.scxml
index 4296c8a..4c59e17 100644
--- a/test/scxml-test-framework/test/history/history4.scxml
+++ b/test/scxml-test-framework/test/history/history4.scxml
@@ -18,77 +18,78 @@
illustrates both deep and shallow history, working in both AND and OR states
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="a">
-
-
- <state id="a">
- <transition target="p" event="t1"/>
- <transition target="p" event="t6"/>
- <transition target="hp" event="t9"/>
- </state>
-
- <parallel id="p">
- <history id="hp" type="deep"/>
-
- <state id="b" initial="hb">
-
- <history id="hb" type="deep">
- <transition target="b1"/>
- </history>
-
- <state id="b1" initial="b1.1">
- <state id="b1.1">
- <transition target="b1.2" event="t2"/>
- </state>
-
- <state id="b1.2">
- <transition target="b2" event="t3"/>
- </state>
- </state>
-
- <state id="b2" initial="b2.1">
- <state id="b2.1">
- <transition target="b2.2" event="t4"/>
- </state>
-
- <state id="b2.2">
- <transition target="a" event="t5"/>
- <transition target="a" event="t8"/>
- </state>
- </state>
- </state>
-
- <state id="c" initial="hc">
-
- <history id="hc" type="shallow">
- <transition target="c1"/>
- </history>
-
- <state id="c1" initial="c1.1">
- <state id="c1.1">
- <transition target="c1.2" event="t2"/>
- </state>
-
- <state id="c1.2">
- <transition target="c2" event="t3"/>
- </state>
- </state>
-
- <state id="c2" initial="c2.1">
- <state id="c2.1">
- <transition target="c2.2" event="t4"/>
- <transition target="c2.2" event="t7"/>
- </state>
-
- <state id="c2.2">
- </state>
- </state>
- </state>
- </parallel>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="a">
+
+
+ <state id="a">
+ <transition target="p" event="t1"/>
+ <transition target="p" event="t6"/>
+ <transition target="hp" event="t9"/>
+ </state>
+
+ <parallel id="p">
+ <history id="hp" type="deep">
+ <transition target="b"/>
+ </history>
+
+ <state id="b" initial="hb">
+
+ <history id="hb" type="deep">
+ <transition target="b1"/>
+ </history>
+
+ <state id="b1" initial="b1.1">
+ <state id="b1.1">
+ <transition target="b1.2" event="t2"/>
+ </state>
+
+ <state id="b1.2">
+ <transition target="b2" event="t3"/>
+ </state>
+ </state>
+
+ <state id="b2" initial="b2.1">
+ <state id="b2.1">
+ <transition target="b2.2" event="t4"/>
+ </state>
+
+ <state id="b2.2">
+ <transition target="a" event="t5"/>
+ <transition target="a" event="t8"/>
+ </state>
+ </state>
+ </state>
+
+ <state id="c" initial="hc">
+
+ <history id="hc" type="shallow">
+ <transition target="c1"/>
+ </history>
+
+ <state id="c1" initial="c1.1">
+ <state id="c1.1">
+ <transition target="c1.2" event="t2"/>
+ </state>
+
+ <state id="c1.2">
+ <transition target="c2" event="t3"/>
+ </state>
+ </state>
+
+ <state id="c2" initial="c2.1">
+ <state id="c2.1">
+ <transition target="c2.2" event="t4"/>
+ <transition target="c2.2" event="t7"/>
+ </state>
+
+ <state id="c2.2">
+ </state>
+ </state>
+ </state>
+ </parallel>
</scxml>
diff --git a/test/scxml-test-framework/test/history/history5.json b/test/scxml-test-framework/test/history/history5.json
index a6c52a7..fcd1cb6 100644
--- a/test/scxml-test-framework/test/history/history5.json
+++ b/test/scxml-test-framework/test/history/history5.json
@@ -1,19 +1,19 @@
{
- "initialConfiguration" : ["i1","j","h","g","f1","k"],
- "events" : [
- {
- "event" : { "name" : "t1" },
- "nextConfiguration" : ["i2","j","h","g","f2","k"]
- },
- {
- "event" : { "name" : "t2" },
- "nextConfiguration" : ["l"]
- },
- {
- "event" : { "name" : "t3" },
- "nextConfiguration" : ["i2","j","h","g","f2","k"]
- }
+ "initialConfiguration" : ["i1","j","h","g","f1","k"],
+ "events" : [
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["i2","j","h","g","f2","k"]
+ },
+ {
+ "event" : { "name" : "t2" },
+ "nextConfiguration" : ["l"]
+ },
+ {
+ "event" : { "name" : "t3" },
+ "nextConfiguration" : ["i2","j","h","g","f2","k"]
+ }
- ]
+ ]
}
diff --git a/test/scxml-test-framework/test/history/history5.scxml b/test/scxml-test-framework/test/history/history5.scxml
index c2f497d..0b97e26 100644
--- a/test/scxml-test-framework/test/history/history5.scxml
+++ b/test/scxml-test-framework/test/history/history5.scxml
@@ -18,55 +18,56 @@
illustrates deep history with many parallel states
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="a">
-
- <parallel id="a">
- <history id="ha" type="deep"/>
-
- <parallel id="b">
- <parallel id="c">
- <parallel id="d">
- <parallel id="e">
-
- <state id="i" initial="i1">
- <state id="i1">
- <transition target="i2" event="t1"/>
- </state>
-
- <state id="i2">
- <transition target="l" event="t2"/>
- </state>
- </state>
-
- <state id="j"/>
- </parallel>
-
- <state id="h"/>
- </parallel>
-
- <state id="g"/>
- </parallel>
-
- <state id="f" initial="f1">
- <state id="f1">
- <transition target="f2" event="t1"/>
- </state>
-
- <state id="f2">
- </state>
- </state>
- </parallel>
-
- <state id="k"/>
- </parallel>
-
- <state id="l">
- <transition target="ha" event="t3"/>
- </state>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="a">
+
+ <parallel id="a">
+ <history id="ha" type="deep">
+ <transition target="b"/>
+ </history>
+
+ <parallel id="b">
+ <parallel id="c">
+ <parallel id="d">
+ <parallel id="e">
+
+ <state id="i" initial="i1">
+ <state id="i1">
+ <transition target="i2" event="t1"/>
+ </state>
+
+ <state id="i2">
+ <transition target="l" event="t2"/>
+ </state>
+ </state>
+
+ <state id="j"/>
+ </parallel>
+
+ <state id="h"/>
+ </parallel>
+
+ <state id="g"/>
+ </parallel>
+
+ <state id="f" initial="f1">
+ <state id="f1">
+ <transition target="f2" event="t1"/>
+ </state>
+
+ <state id="f2">
+ </state>
+ </state>
+ </parallel>
+
+ <state id="k"/>
+ </parallel>
+
+ <state id="l">
+ <transition target="ha" event="t3"/>
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/history/history6.json b/test/scxml-test-framework/test/history/history6.json
index 2face8d..ff5c582 100644
--- a/test/scxml-test-framework/test/history/history6.json
+++ b/test/scxml-test-framework/test/history/history6.json
@@ -1,27 +1,27 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t1" },
- "nextConfiguration" : ["b2"]
- },
- {
- "event" : { "name" : "t2" },
- "nextConfiguration" : ["b3"]
- },
- {
- "event" : { "name" : "t3" },
- "nextConfiguration" : ["a"]
- },
- {
- "event" : { "name" : "t1" },
- "nextConfiguration" : ["b3"]
- },
- {
- "event" : { "name" : "t4" },
- "nextConfiguration" : ["success"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["b2"]
+ },
+ {
+ "event" : { "name" : "t2" },
+ "nextConfiguration" : ["b3"]
+ },
+ {
+ "event" : { "name" : "t3" },
+ "nextConfiguration" : ["a"]
+ },
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["b3"]
+ },
+ {
+ "event" : { "name" : "t4" },
+ "nextConfiguration" : ["success"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/history/history6.scxml b/test/scxml-test-framework/test/history/history6.scxml
index b726427..48cfd9a 100644
--- a/test/scxml-test-framework/test/history/history6.scxml
+++ b/test/scxml-test-framework/test/history/history6.scxml
@@ -15,56 +15,55 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="a">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="a">
<datamodel>
- <data id="x" expr="2"/>
+ <data id="x" expr="2"/>
</datamodel>
- <state id="a">
- <transition target="h" event="t1"/>
- </state>
+ <state id="a">
+ <transition target="h" event="t1"/>
+ </state>
- <state id="b" initial="b1">
- <onentry>
- <assign location="x" expr="x * 3"/>
- <log expr="'b, x:' + x"/>
- </onentry>
+ <state id="b" initial="b1">
+ <onentry>
+ <assign location="x" expr="x * 3"/>
+ <log expr="'b, x:' + x"/>
+ </onentry>
- <history id="h">
- <transition target="b2"/>
- </history>
+ <history id="h">
+ <transition target="b2"/>
+ </history>
- <state id="b1"/>
+ <state id="b1"/>
- <state id="b2">
+ <state id="b2">
<onentry>
<assign location="x" expr="x * 5"/>
<log expr="'b2, x:' + x"/>
</onentry>
- <transition event="t2" target="b3"/>
- </state>
+ <transition event="t2" target="b3"/>
+ </state>
- <state id="b3">
+ <state id="b3">
<onentry>
<assign location="x" expr="x * 7"/>
<log expr="'b3, x:' + x"/>
</onentry>
- <transition event="t3" target="a"/>
- </state>
+ <transition event="t3" target="a"/>
+ </state>
<!-- 4410 should be the value of x after the following sequence of enter actions:
a, b, b2, b3, a, b, b3 -->
- <transition event="t4" target="success" cond="x === 4410"/>
- <!-- we make a special 'really-fail' state because of a particular bug in SCION I am trying to illustrate -->
- <transition event="t4" target="really-fail" cond="x === 1470"/>
- <!-- for everything else, we just fail -->
- <transition event="t4" target="fail"/>
- </state>
+ <transition event="t4" target="success" cond="x === 4410"/>
+ <!-- we make a special 'really-fail' state because of a particular bug in SCION I am trying to illustrate -->
+ <transition event="t4" target="really-fail" cond="x === 1470"/>
+ <!-- for everything else, we just fail -->
+ <transition event="t4" target="fail"/>
+ </state>
<state id="success"/>
diff --git a/test/scxml-test-framework/test/if-else/test0.json b/test/scxml-test-framework/test/if-else/test0.json
index 8424ef5..0e49c49 100644
--- a/test/scxml-test-framework/test/if-else/test0.json
+++ b/test/scxml-test-framework/test/if-else/test0.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/if-else/test0.scxml b/test/scxml-test-framework/test/if-else/test0.scxml
index 369222b..3dfc1a5 100644
--- a/test/scxml-test-framework/test/if-else/test0.scxml
+++ b/test/scxml-test-framework/test/if-else/test0.scxml
@@ -15,93 +15,92 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <datamodel>
- <data id="a" expr="0"/>
- </datamodel>
-
- <state id="a">
- <onentry>
- <!-- test if -->
- <log label="a" expr="a"/>
- <if cond="a === 0">
- <assign location="a" expr="10"/>
- <elseif cond="a === 10"/>
- <assign location="a" expr="20"/>
- <else/>
- <assign location="a" expr="30"/>
- </if>
- <log label="a" expr="a"/>
- </onentry>
-
- <transition event="t" target="b" cond="a === 10">
- <assign location="a" expr="a + 1"/>
- </transition>
-
- <onexit>
- <!-- test else -->
- <log label="a" expr="a"/>
- <if cond="a !== 10">
- <assign location="a" expr="a * 3"/>
- <else/>
- <assign location="a" expr="a * 2"/>
- </if>
- <log label="a" expr="a"/>
- </onexit>
- </state>
-
- <state id="b">
- <onentry>
- <!-- test elseif -->
- <log label="a" expr="a"/>
- <if cond="a === 0">
- <assign location="a" expr="100"/>
- <elseif cond="a === 21"/>
- <assign location="a" expr="a + 2"/>
- <assign location="a" expr="a + 3"/>
- <else/>
- <assign location="a" expr="200"/>
- </if>
-
- <if cond="a === 26">
- <assign location="a" expr="a + 1"/>
- </if>
-
- <if cond="a === 26">
- <elseif cond="a === 27"/>
- <assign location="a" expr="a + 1"/>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
+ <datamodel>
+ <data id="x" expr="0"/>
+ </datamodel>
+
+ <state id="a">
+ <onentry>
+ <!-- test if -->
+ <log label="x" expr="x"/>
+ <if cond="x === 0">
+ <assign location="x" expr="10"/>
+ <elseif cond="x === 10"/>
+ <assign location="x" expr="20"/>
<else/>
- <assign location="a" expr="a + 10"/>
- </if>
+ <assign location="x" expr="30"/>
+ </if>
+ <log label="x" expr="x"/>
+ </onentry>
+
+ <transition event="t" target="b" cond="x === 10">
+ <assign location="x" expr="x + 1"/>
+ </transition>
+
+ <onexit>
+ <!-- test else -->
+ <log label="x" expr="x"/>
+ <if cond="x !== 10">
+ <assign location="x" expr="x * 3"/>
+ <else/>
+ <assign location="x" expr="x * 2"/>
+ </if>
+ <log label="x" expr="x"/>
+ </onexit>
+ </state>
+
+ <state id="b">
+ <onentry>
+ <!-- test elseif -->
+ <log label="x" expr="x"/>
+ <if cond="x === 0">
+ <assign location="x" expr="100"/>
+ <elseif cond="x === 21"/>
+ <assign location="x" expr="x + 2"/>
+ <assign location="x" expr="x + 3"/>
+ <else/>
+ <assign location="x" expr="200"/>
+ </if>
+
+ <if cond="x === 26">
+ <assign location="x" expr="x + 1"/>
+ </if>
+
+ <if cond="x === 26">
+ <elseif cond="x === 27"/>
+ <assign location="x" expr="x + 1"/>
+ <else/>
+ <assign location="x" expr="x + 10"/>
+ </if>
- <if cond="a === 28">
- <assign location="a" expr="a + 12"/>
- <if cond="a === 40">
- <assign location="a" expr="a + 10"/>
+ <if cond="x === 28">
+ <assign location="x" expr="x + 12"/>
+ <if cond="x === 40">
+ <assign location="x" expr="x + 10"/>
</if>
- </if>
+ </if>
- <if cond="a === 50">
- <assign location="a" expr="a + 1"/>
- <if cond="a !== 51">
+ <if cond="x === 50">
+ <assign location="x" expr="x + 1"/>
+ <if cond="x !== 51">
<else/>
- <assign location="a" expr="a + 20"/>
+ <assign location="x" expr="x + 20"/>
</if>
- </if>
+ </if>
- <log label="a" expr="a"/>
- </onentry>
+ <log label="x" expr="x"/>
+ </onentry>
- <transition target="c" cond="a === 71"/>
- <transition target="f"/>
- </state>
+ <transition target="c" cond="x === 71"/>
+ <transition target="f"/>
+ </state>
- <state id="c"/>
+ <state id="c"/>
- <state id="f"/>
+ <state id="f"/>
</scxml>
diff --git a/test/scxml-test-framework/test/in/TestInPredicate.json b/test/scxml-test-framework/test/in/TestInPredicate.json
index 5ef98f1..861374e 100644
--- a/test/scxml-test-framework/test/in/TestInPredicate.json
+++ b/test/scxml-test-framework/test/in/TestInPredicate.json
@@ -1,47 +1,47 @@
{
- "initialConfiguration" : ["a1","a2"],
- "events" : [
- {
- "event" : { "name" : "t1" },
- "nextConfiguration" : ["b1","a2"]
- },
- {
- "event" : { "name" : "t2" },
- "nextConfiguration" : ["c1","a2"]
- },
- {
- "event" : { "name" : "t3" },
- "nextConfiguration" : ["d1","a2"]
- },
- {
- "event" : { "name" : "t4" },
- "nextConfiguration" : ["e1","a2"]
- },
- {
- "event" : { "name" : "t5" },
- "nextConfiguration" : ["f1","a2"]
- },
- {
- "event" : { "name" : "t6" },
- "nextConfiguration" : ["g1","b2"]
- },
- {
- "event" : { "name" : "t7" },
- "nextConfiguration" : ["h1","d2"]
- },
- {
- "event" : { "name" : "t8" },
- "nextConfiguration" : ["i1","d2"]
- },
- {
- "event" : { "name" : "t9" },
- "nextConfiguration" : ["j1","e2"]
- },
- {
- "event" : { "name" : "t10" },
- "nextConfiguration" : ["k1","e2"]
- }
- ]
+ "initialConfiguration" : ["a1","a2"],
+ "events" : [
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["b1","a2"]
+ },
+ {
+ "event" : { "name" : "t2" },
+ "nextConfiguration" : ["c1","a2"]
+ },
+ {
+ "event" : { "name" : "t3" },
+ "nextConfiguration" : ["d1","a2"]
+ },
+ {
+ "event" : { "name" : "t4" },
+ "nextConfiguration" : ["e1","a2"]
+ },
+ {
+ "event" : { "name" : "t5" },
+ "nextConfiguration" : ["f1","a2"]
+ },
+ {
+ "event" : { "name" : "t6" },
+ "nextConfiguration" : ["g1","b2"]
+ },
+ {
+ "event" : { "name" : "t7" },
+ "nextConfiguration" : ["h1","d2"]
+ },
+ {
+ "event" : { "name" : "t8" },
+ "nextConfiguration" : ["i1","d2"]
+ },
+ {
+ "event" : { "name" : "t9" },
+ "nextConfiguration" : ["j1","e2"]
+ },
+ {
+ "event" : { "name" : "t10" },
+ "nextConfiguration" : ["k1","e2"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/in/TestInPredicate.scxml b/test/scxml-test-framework/test/in/TestInPredicate.scxml
index 4a6fedb..d89611b 100644
--- a/test/scxml-test-framework/test/in/TestInPredicate.scxml
+++ b/test/scxml-test-framework/test/in/TestInPredicate.scxml
@@ -19,94 +19,90 @@
This is to test the use of the In() predicate.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- name="root">
-
- <initial>
- <transition target="p1"/>
- </initial>
-
- <parallel id="p1">
-
- <state id="r1" initial="a1">
- <!-- sanity tests -->
- <state id="a1">
- <transition event="t1" target="b1" cond="In('a1')"/>
- </state>
-
- <state id="b1">
- <transition event="t2" target="c1" cond="In('r1')"/>
- </state>
-
- <state id="c1">
- <transition event="t3" target="d1" cond="In('p1')"/>
- </state>
-
- <!-- tests for failure -->
- <state id="d1">
- <transition event="t4" target="e1" cond="!In('e2')"/>
- </state>
-
- <state id="e1">
- <transition event="t5" target="f1" cond="!In('c2')"/>
- </state>
-
- <!-- tests for success -->
- <state id="f1">
- <transition event="t6" target="g1" cond="In('a2')">
- <raise event="gen1"/>
- </transition>
- </state>
-
- <state id="g1">
- <transition event="t7" target="h1" cond="In('b2')">
- <raise event="gen2"/>
- </transition>
- </state>
-
- <state id="h1">
- <transition event="t8" target="i1" cond="In('c2')"/>
- </state>
-
- <state id="i1">
- <transition event="t9" target="j1" cond="In('d2')">
- <raise event="gen3"/>
- </transition>
- </state>
-
- <state id="j1">
- <transition event="t10" target="k1" cond="In('e2')"/>
- </state>
-
- <state id="k1"/>
-
- </state>
-
- <state id="r2" initial="a2">
- <state id="a2">
- <transition event="gen1" target="b2"/>
- </state>
-
- <state id="b2">
- <transition event="gen2" target="c2"/>
- </state>
-
- <state id="c2">
- <initial>
- <transition target="d2"/>
- </initial>
-
- <state id="d2">
- <transition event="gen3" target="e2"/>
- </state>
-
- <state id="e2"/>
- </state>
- </state>
-
- </parallel>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ initial="p1"
+ version="1.0">
+
+ <parallel id="p1">
+
+ <state id="r1" initial="a1">
+ <!-- sanity tests -->
+ <state id="a1">
+ <transition event="t1" target="b1" cond="In('a1')"/>
+ </state>
+
+ <state id="b1">
+ <transition event="t2" target="c1" cond="In('r1')"/>
+ </state>
+
+ <state id="c1">
+ <transition event="t3" target="d1" cond="In('p1')"/>
+ </state>
+
+ <!-- tests for failure -->
+ <state id="d1">
+ <transition event="t4" target="e1" cond="!In('e2')"/>
+ </state>
+
+ <state id="e1">
+ <transition event="t5" target="f1" cond="!In('c2')"/>
+ </state>
+
+ <!-- tests for success -->
+ <state id="f1">
+ <transition event="t6" target="g1" cond="In('a2')">
+ <raise event="gen1"/>
+ </transition>
+ </state>
+
+ <state id="g1">
+ <transition event="t7" target="h1" cond="In('b2')">
+ <raise event="gen2"/>
+ </transition>
+ </state>
+
+ <state id="h1">
+ <transition event="t8" target="i1" cond="In('c2')"/>
+ </state>
+
+ <state id="i1">
+ <transition event="t9" target="j1" cond="In('d2')">
+ <raise event="gen3"/>
+ </transition>
+ </state>
+
+ <state id="j1">
+ <transition event="t10" target="k1" cond="In('e2')"/>
+ </state>
+
+ <state id="k1"/>
+
+ </state>
+
+ <state id="r2" initial="a2">
+ <state id="a2">
+ <transition event="gen1" target="b2"/>
+ </state>
+
+ <state id="b2">
+ <transition event="gen2" target="c2"/>
+ </state>
+
+ <state id="c2">
+ <initial>
+ <transition target="d2"/>
+ </initial>
+
+ <state id="d2">
+ <transition event="gen3" target="e2"/>
+ </state>
+
+ <state id="e2"/>
+ </state>
+ </state>
+
+ </parallel>
</scxml>
diff --git a/test/scxml-test-framework/test/internal-transitions/test0.json b/test/scxml-test-framework/test/internal-transitions/test0.json
new file mode 100644
index 0000000..4808030
--- /dev/null
+++ b/test/scxml-test-framework/test/internal-transitions/test0.json
@@ -0,0 +1,17 @@
+{
+ "initialConfiguration" : ["a1"],
+ "events" : [
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["a2"]
+ },
+ {
+ "event" : { "name" : "t2" },
+ "nextConfiguration" : ["b"]
+ },
+ {
+ "event" : { "name" : "t3" },
+ "nextConfiguration" : ["c"]
+ }
+ ]
+}
diff --git a/test/scxml-test-framework/test/internal-transitions/test0.scxml b/test/scxml-test-framework/test/internal-transitions/test0.scxml
new file mode 100644
index 0000000..f9a620d
--- /dev/null
+++ b/test/scxml-test-framework/test/internal-transitions/test0.scxml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<scxml
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ datamodel="ecmascript">
+
+ <datamodel>
+ <data id="x" expr="0"/>
+ </datamodel>
+
+ <transition event="*">
+ <log label="x" expr="x"/>
+ </transition>
+
+ <state id="a">
+ <onentry>
+ <assign location="x" expr="x + 1"/>
+ </onentry>
+
+ <onexit>
+ <assign location="x" expr="x + 1"/>
+ </onexit>
+
+ <state id="a1">
+ </state>
+
+ <state id="a2">
+ <!-- if we had exited and re-entered 'a', then x would be 3. but instead it's 1 -->
+ <transition target="b" event="t2" cond="x === 1" />
+ </state>
+
+ <transition target="a2" event="t1" type="internal" cond="x === 1"/>
+ </state>
+
+ <state id="b">
+ <transition target="c" event="t3" cond="x === 2" />
+ </state>
+
+ <state id="c"/>
+
+</scxml>
diff --git a/test/scxml-test-framework/test/internal-transitions/test1.json b/test/scxml-test-framework/test/internal-transitions/test1.json
new file mode 100644
index 0000000..d3e59ca
--- /dev/null
+++ b/test/scxml-test-framework/test/internal-transitions/test1.json
@@ -0,0 +1,18 @@
+{
+ "initialConfiguration" : ["a1", "b1"],
+ "events" : [
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["a2", "b1"]
+ },
+ {
+ "event" : { "name" : "t2" },
+ "nextConfiguration" : ["c"]
+ },
+ {
+ "event" : { "name" : "t3" },
+ "nextConfiguration" : ["d"]
+ }
+ ]
+}
+
diff --git a/test/scxml-test-framework/test/internal-transitions/test1.scxml b/test/scxml-test-framework/test/internal-transitions/test1.scxml
new file mode 100644
index 0000000..81e7cc3
--- /dev/null
+++ b/test/scxml-test-framework/test/internal-transitions/test1.scxml
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<scxml
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ datamodel="ecmascript">
+
+ <datamodel>
+ <data id="x" expr="0"/>
+ </datamodel>
+
+ <parallel id="p">
+ <onentry>
+ <assign location="x" expr="x + 1"/>
+ </onentry>
+
+ <onexit>
+ <assign location="x" expr="x + 1"/>
+ </onexit>
+
+ <state id="a">
+ <onentry>
+ <assign location="x" expr="x + 1"/>
+ </onentry>
+
+ <onexit>
+ <assign location="x" expr="x + 1"/>
+ </onexit>
+
+ <state id="a1">
+ <onentry>
+ <assign location="x" expr="x + 1"/>
+ </onentry>
+
+ <onexit>
+ <assign location="x" expr="x + 1"/>
+ </onexit>
+ </state>
+
+ <state id="a2">
+ <onentry>
+ <assign location="x" expr="x + 1"/>
+ </onentry>
+
+ <onexit>
+ <assign location="x" expr="x + 1"/>
+ </onexit>
+
+ <!-- exited a1 (3 + 1 = 4), entered a2 (4 + 1 = 5) -->
+ <transition target="c" event="t2" cond="x === 5"/>
+ </state>
+
+ <!-- entered p, a, a1 (x = 1 + 1 + 1 = 3) -->
+ <transition target="a2" event="t1" type="internal" cond="x === 3"/>
+ </state>
+
+ <state id="b">
+ <state id="b1">
+ </state>
+
+ <state id="b2">
+ </state>
+ </state>
+
+ </parallel>
+
+ <state id="c">
+ <!-- exited a2, a, p (5 + 1 + 1 + 1 = 8) -->
+ <transition target="d" event="t3" cond="x === 8"/>
+ </state>
+
+ <state id="d"/>
+
+</scxml>
+
diff --git a/test/scxml-test-framework/test/more-parallel/test0.json b/test/scxml-test-framework/test/more-parallel/test0.json
index 4de58d0..a316c55 100644
--- a/test/scxml-test-framework/test/more-parallel/test0.json
+++ b/test/scxml-test-framework/test/more-parallel/test0.json
@@ -1,10 +1,10 @@
{
- "initialConfiguration" : ["a","b"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a","b"]
- }
+ "initialConfiguration" : ["a","b"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a","b"]
+ }
- ]
+ ]
}
diff --git a/test/scxml-test-framework/test/more-parallel/test0.scxml b/test/scxml-test-framework/test/more-parallel/test0.scxml
index 460143d..19ab416 100644
--- a/test/scxml-test-framework/test/more-parallel/test0.scxml
+++ b/test/scxml-test-framework/test/more-parallel/test0.scxml
@@ -15,17 +15,17 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <parallel id="p">
- <state id="a">
- <transition target="a" event="t"/>
- </state>
+ <parallel id="p">
+ <state id="a">
+ <transition target="a" event="t"/>
+ </state>
- <state id="b"/>
- </parallel>
+ <state id="b"/>
+ </parallel>
</scxml>
diff --git a/test/scxml-test-framework/test/more-parallel/test1.json b/test/scxml-test-framework/test/more-parallel/test1.json
index 29793c8..0fb5018 100644
--- a/test/scxml-test-framework/test/more-parallel/test1.json
+++ b/test/scxml-test-framework/test/more-parallel/test1.json
@@ -1,10 +1,10 @@
{
- "initialConfiguration" : ["a1","b1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a1","b1"]
- }
+ "initialConfiguration" : ["a1","b1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a1","b1"]
+ }
- ]
+ ]
}
diff --git a/test/scxml-test-framework/test/more-parallel/test1.scxml b/test/scxml-test-framework/test/more-parallel/test1.scxml
index 94afb20..58eee87 100644
--- a/test/scxml-test-framework/test/more-parallel/test1.scxml
+++ b/test/scxml-test-framework/test/more-parallel/test1.scxml
@@ -15,28 +15,27 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <parallel id="p">
- <state id="a">
+ <parallel id="p">
+ <state id="a">
<transition event="t" target="a"/>
- <state id="a1"/>
+ <state id="a1"/>
- <state id="a2"/>
- </state>
+ <state id="a2"/>
+ </state>
- <state id="b">
+ <state id="b">
- <state id="b1"/>
+ <state id="b1"/>
- <state id="b2"/>
- </state>
- </parallel>
+ <state id="b2"/>
+ </state>
+ </parallel>
</scxml>
diff --git a/test/scxml-test-framework/test/more-parallel/test10.json b/test/scxml-test-framework/test/more-parallel/test10.json
new file mode 100644
index 0000000..b02dc37
--- /dev/null
+++ b/test/scxml-test-framework/test/more-parallel/test10.json
@@ -0,0 +1,17 @@
+{
+ "initialConfiguration" : ["a","b"],
+ "events" : [
+ {
+ "event" : { "name" : "t1" },
+ "nextConfiguration" : ["a","b"]
+ },
+ {
+ "event" : { "name" : "t2" },
+ "nextConfiguration" : ["c"]
+ },
+ {
+ "event" : { "name" : "t3" },
+ "nextConfiguration" : ["d"]
+ }
+ ]
+}
diff --git a/test/scxml-test-framework/test/more-parallel/test10.scxml b/test/scxml-test-framework/test/more-parallel/test10.scxml
new file mode 100644
index 0000000..1d6f371
--- /dev/null
+++ b/test/scxml-test-framework/test/more-parallel/test10.scxml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<scxml
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
+ <datamodel>
+ <data id="x" expr="0"/>
+ </datamodel>
+
+ <parallel id="p">
+ <onentry>
+ <assign location="x" expr="x +1"/>
+ </onentry>
+ <onexit>
+ <assign location="x" expr="x + 1"/>
+ </onexit>
+
+ <state id="a">
+ <onentry>
+ <assign location="x" expr="x + 1"/>
+ </onentry>
+ <onexit>
+ <assign location="x" expr="x + 1"/>
+ </onexit>
+
+ <!-- we've entered p, a, so x === 2 here -->
+
+ <transition target="a" event="t1" cond="x === 2"/>
+ </state>
+
+ <state id="b"/>
+
+ <!-- we've exited and re-entered p, a, so x === 6 here -->
+ <transition target="c" event="t2" cond="x === 6"/>
+ </parallel>
+
+ <state id="c">
+ <!-- we've exited p, a here, so x === 8 -->
+ <transition target="d" event="t3" cond="x === 8"/>
+ </state>
+
+ <state id="d"/>
+
+</scxml>
+
+
+
diff --git a/test/scxml-test-framework/test/more-parallel/test2.json b/test/scxml-test-framework/test/more-parallel/test2.json
index f024462..afcef7a 100644
--- a/test/scxml-test-framework/test/more-parallel/test2.json
+++ b/test/scxml-test-framework/test/more-parallel/test2.json
@@ -1,10 +1,10 @@
{
- "initialConfiguration" : ["a1","b1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a1","b2"]
- }
+ "initialConfiguration" : ["a1","b1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a1","b2"]
+ }
- ]
+ ]
}
diff --git a/test/scxml-test-framework/test/more-parallel/test2.scxml b/test/scxml-test-framework/test/more-parallel/test2.scxml
index 96d54fd..2adbb3b 100644
--- a/test/scxml-test-framework/test/more-parallel/test2.scxml
+++ b/test/scxml-test-framework/test/more-parallel/test2.scxml
@@ -15,30 +15,29 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <parallel id="p">
- <state id="a">
+ <parallel id="p">
+ <state id="a">
<transition event="t" target="a"/>
- <state id="a1"/>
+ <state id="a1"/>
- <state id="a2"/>
- </state>
+ <state id="a2"/>
+ </state>
- <state id="b">
+ <state id="b">
- <state id="b1">
- <transition event="t" target="b2"/>
- </state>
+ <state id="b1">
+ <transition event="t" target="b2"/>
+ </state>
- <state id="b2"/>
- </state>
- </parallel>
+ <state id="b2"/>
+ </state>
+ </parallel>
</scxml>
diff --git a/test/scxml-test-framework/test/more-parallel/test3.json b/test/scxml-test-framework/test/more-parallel/test3.json
index c2277fa..bc31df4 100644
--- a/test/scxml-test-framework/test/more-parallel/test3.json
+++ b/test/scxml-test-framework/test/more-parallel/test3.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a1","b1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a2","b2"]
- }
+ "initialConfiguration" : ["a1","b1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a1","b2"]
+ }
- ]
+ ]
}
diff --git a/test/scxml-test-framework/test/more-parallel/test3.scxml b/test/scxml-test-framework/test/more-parallel/test3.scxml
index e959293..14d613e 100644
--- a/test/scxml-test-framework/test/more-parallel/test3.scxml
+++ b/test/scxml-test-framework/test/more-parallel/test3.scxml
@@ -15,34 +15,29 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0" >
- <parallel id="p">
- <state id="a">
+ <parallel id="p">
+ <state id="a">
<transition event="t" target="a2"/>
- <state id="a1"/>
+ <state id="a1"/>
- <state id="a2"/>
- </state>
+ <state id="a2"/>
+ </state>
- <state id="b">
+ <state id="b">
- <state id="b1">
- <transition event="t" target="b2"/>
- </state>
+ <state id="b1">
+ <transition event="t" target="b2"/>
+ </state>
- <state id="b2"/>
- </state>
- </parallel>
+ <state id="b2"/>
+ </state>
+ </parallel>
</scxml>
-
-
-
-
diff --git a/test/scxml-test-framework/test/more-parallel/test4.json b/test/scxml-test-framework/test/more-parallel/test4.json
index 8335a57..3f05f83 100644
--- a/test/scxml-test-framework/test/more-parallel/test4.json
+++ b/test/scxml-test-framework/test/more-parallel/test4.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["a1","b1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a1","b1"]
- }
+ "initialConfiguration" : ["a1","b1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a1","b1"]
+ }
- ]
+ ]
}
diff --git a/test/scxml-test-framework/test/more-parallel/test4.scxml b/test/scxml-test-framework/test/more-parallel/test4.scxml
index 3818e1b..b211cad 100644
--- a/test/scxml-test-framework/test/more-parallel/test4.scxml
+++ b/test/scxml-test-framework/test/more-parallel/test4.scxml
@@ -15,30 +15,29 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <parallel id="p">
- <state id="a">
+ <parallel id="p">
+ <state id="a">
<transition event="t" target="a"/>
- <state id="a1"/>
+ <state id="a1"/>
- <state id="a2"/>
- </state>
+ <state id="a2"/>
+ </state>
- <state id="b">
+ <state id="b">
<transition event="t" target="b"/>
- <state id="b1"/>
+ <state id="b1"/>
- <state id="b2"/>
- </state>
- </parallel>
+ <state id="b2"/>
+ </state>
+ </parallel>
</scxml>
diff --git a/test/scxml-test-framework/test/more-parallel/test5.json b/test/scxml-test-framework/test/more-parallel/test5.json
index 16791aa..b07bacf 100644
--- a/test/scxml-test-framework/test/more-parallel/test5.json
+++ b/test/scxml-test-framework/test/more-parallel/test5.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["a1","b1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a2","b2"]
- }
-
- ]
+ "initialConfiguration" : ["a1","b1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a2","b1"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/more-parallel/test5.scxml b/test/scxml-test-framework/test/more-parallel/test5.scxml
index df2fc78..7f4c7ab 100644
--- a/test/scxml-test-framework/test/more-parallel/test5.scxml
+++ b/test/scxml-test-framework/test/more-parallel/test5.scxml
@@ -15,30 +15,29 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <parallel id="p">
- <state id="a">
+ <parallel id="p">
+ <state id="a">
<transition event="t" target="a2"/>
- <state id="a1"/>
+ <state id="a1"/>
- <state id="a2"/>
- </state>
+ <state id="a2"/>
+ </state>
- <state id="b">
+ <state id="b">
<transition event="t" target="b2"/>
- <state id="b1"/>
+ <state id="b1"/>
- <state id="b2"/>
- </state>
- </parallel>
+ <state id="b2"/>
+ </state>
+ </parallel>
</scxml>
diff --git a/test/scxml-test-framework/test/more-parallel/test6.json b/test/scxml-test-framework/test/more-parallel/test6.json
index 17a169b..9e33fe5 100644
--- a/test/scxml-test-framework/test/more-parallel/test6.json
+++ b/test/scxml-test-framework/test/more-parallel/test6.json
@@ -1,10 +1,10 @@
{
- "initialConfiguration" : ["a11","b11"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a22","b12"]
- }
+ "initialConfiguration" : ["a11","b11"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a11","b12"]
+ }
- ]
+ ]
}
diff --git a/test/scxml-test-framework/test/more-parallel/test6.scxml b/test/scxml-test-framework/test/more-parallel/test6.scxml
index 35be417..efe2442 100644
--- a/test/scxml-test-framework/test/more-parallel/test6.scxml
+++ b/test/scxml-test-framework/test/more-parallel/test6.scxml
@@ -15,42 +15,41 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <parallel id="p">
- <state id="a">
+ <parallel id="p">
+ <state id="a">
<transition event="t" target="a22"/>
- <state id="a1">
- <state id="a11"/>
- <state id="a12"/>
- </state>
+ <state id="a1">
+ <state id="a11"/>
+ <state id="a12"/>
+ </state>
- <state id="a2">
- <state id="a21"/>
- <state id="a22"/>
- </state>
- </state>
+ <state id="a2">
+ <state id="a21"/>
+ <state id="a22"/>
+ </state>
+ </state>
- <state id="b">
+ <state id="b">
- <state id="b1">
- <state id="b11">
+ <state id="b1">
+ <state id="b11">
<transition event="t" target="b12"/>
- </state>
- <state id="b12"/>
- </state>
-
- <state id="b2">
- <state id="b21"/>
- <state id="b22"/>
- </state>
- </state>
- </parallel>
+ </state>
+ <state id="b12"/>
+ </state>
+
+ <state id="b2">
+ <state id="b21"/>
+ <state id="b22"/>
+ </state>
+ </state>
+ </parallel>
</scxml>
diff --git a/test/scxml-test-framework/test/more-parallel/test7.json b/test/scxml-test-framework/test/more-parallel/test7.json
index 12c66d9..db9e53f 100644
--- a/test/scxml-test-framework/test/more-parallel/test7.json
+++ b/test/scxml-test-framework/test/more-parallel/test7.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a11","b11"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a22","b22"]
- }
+ "initialConfiguration" : ["a11","b11"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a22","b11"]
+ }
- ]
+ ]
}
diff --git a/test/scxml-test-framework/test/more-parallel/test7.scxml b/test/scxml-test-framework/test/more-parallel/test7.scxml
index 6050d0e..dcaee1e 100644
--- a/test/scxml-test-framework/test/more-parallel/test7.scxml
+++ b/test/scxml-test-framework/test/more-parallel/test7.scxml
@@ -15,42 +15,41 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <parallel id="p">
- <state id="a">
+ <parallel id="p">
+ <state id="a">
<transition event="t" target="a22"/>
- <state id="a1">
- <state id="a11"/>
- <state id="a12"/>
- </state>
+ <state id="a1">
+ <state id="a11"/>
+ <state id="a12"/>
+ </state>
- <state id="a2">
- <state id="a21"/>
- <state id="a22"/>
- </state>
- </state>
+ <state id="a2">
+ <state id="a21"/>
+ <state id="a22"/>
+ </state>
+ </state>
- <state id="b">
+ <state id="b">
<transition event="t" target="b22"/>
- <state id="b1">
- <state id="b11"/>
- <state id="b12"/>
- </state>
-
- <state id="b2">
- <state id="b21"/>
- <state id="b22"/>
- </state>
- </state>
- </parallel>
+ <state id="b1">
+ <state id="b11"/>
+ <state id="b12"/>
+ </state>
+
+ <state id="b2">
+ <state id="b21"/>
+ <state id="b22"/>
+ </state>
+ </state>
+ </parallel>
</scxml>
diff --git a/test/scxml-test-framework/test/more-parallel/test8.json b/test/scxml-test-framework/test/more-parallel/test8.json
index 26269b8..d36bc3c 100644
--- a/test/scxml-test-framework/test/more-parallel/test8.json
+++ b/test/scxml-test-framework/test/more-parallel/test8.json
@@ -1,10 +1,10 @@
{
- "initialConfiguration" : ["x"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a22","b11"]
- }
+ "initialConfiguration" : ["x"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a22","b11"]
+ }
- ]
+ ]
}
diff --git a/test/scxml-test-framework/test/more-parallel/test8.scxml b/test/scxml-test-framework/test/more-parallel/test8.scxml
index 03f492a..1c6f60c 100644
--- a/test/scxml-test-framework/test/more-parallel/test8.scxml
+++ b/test/scxml-test-framework/test/more-parallel/test8.scxml
@@ -15,39 +15,38 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
<state id="x">
<transition event="t" target="a22"/>
</state>
- <parallel id="p">
- <state id="a">
- <state id="a1">
- <state id="a11"/>
- <state id="a12"/>
- </state>
-
- <state id="a2">
- <state id="a21"/>
- <state id="a22"/>
- </state>
- </state>
-
- <state id="b">
-
- <state id="b1">
- <state id="b11"/>
- <state id="b12"/>
- </state>
-
- <state id="b2">
- <state id="b21"/>
- <state id="b22"/>
- </state>
- </state>
- </parallel>
+ <parallel id="p">
+ <state id="a">
+ <state id="a1">
+ <state id="a11"/>
+ <state id="a12"/>
+ </state>
+
+ <state id="a2">
+ <state id="a21"/>
+ <state id="a22"/>
+ </state>
+ </state>
+
+ <state id="b">
+
+ <state id="b1">
+ <state id="b11"/>
+ <state id="b12"/>
+ </state>
+
+ <state id="b2">
+ <state id="b21"/>
+ <state id="b22"/>
+ </state>
+ </state>
+ </parallel>
</scxml>
diff --git a/test/scxml-test-framework/test/more-parallel/test9.json b/test/scxml-test-framework/test/more-parallel/test9.json
index b435564..142f1f7 100644
--- a/test/scxml-test-framework/test/more-parallel/test9.json
+++ b/test/scxml-test-framework/test/more-parallel/test9.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["x"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a22","b22"]
- }
+ "initialConfiguration" : ["x"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a22","b22"]
+ }
- ]
+ ]
}
diff --git a/test/scxml-test-framework/test/more-parallel/test9.scxml b/test/scxml-test-framework/test/more-parallel/test9.scxml
index 9223c95..0e95f17 100644
--- a/test/scxml-test-framework/test/more-parallel/test9.scxml
+++ b/test/scxml-test-framework/test/more-parallel/test9.scxml
@@ -15,40 +15,39 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
<state id="x">
<transition event="t" target="a22 b22"/>
</state>
- <parallel id="p">
- <state id="a">
- <state id="a1">
- <state id="a11"/>
- <state id="a12"/>
- </state>
-
- <state id="a2">
- <state id="a21"/>
- <state id="a22"/>
- </state>
- </state>
-
- <state id="b">
-
- <state id="b1">
- <state id="b11"/>
- <state id="b12"/>
- </state>
-
- <state id="b2">
- <state id="b21"/>
- <state id="b22"/>
- </state>
- </state>
- </parallel>
+ <parallel id="p">
+ <state id="a">
+ <state id="a1">
+ <state id="a11"/>
+ <state id="a12"/>
+ </state>
+
+ <state id="a2">
+ <state id="a21"/>
+ <state id="a22"/>
+ </state>
+ </state>
+
+ <state id="b">
+
+ <state id="b1">
+ <state id="b11"/>
+ <state id="b12"/>
+ </state>
+
+ <state id="b2">
+ <state id="b21"/>
+ <state id="b22"/>
+ </state>
+ </state>
+ </parallel>
</scxml>
diff --git a/test/scxml-test-framework/test/multiple-events-per-transition/test1.json b/test/scxml-test-framework/test/multiple-events-per-transition/test1.json
index aa3a778..155aa6f 100644
--- a/test/scxml-test-framework/test/multiple-events-per-transition/test1.json
+++ b/test/scxml-test-framework/test/multiple-events-per-transition/test1.json
@@ -1,19 +1,19 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "foo" },
- "nextConfiguration" : ["b"]
- },
- {
- "event" : { "name" : "bar" },
- "nextConfiguration" : ["c"]
- },
- {
- "event" : { "name" : "bat" },
- "nextConfiguration" : ["d"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "foo" },
+ "nextConfiguration" : ["b"]
+ },
+ {
+ "event" : { "name" : "bar" },
+ "nextConfiguration" : ["c"]
+ },
+ {
+ "event" : { "name" : "bat" },
+ "nextConfiguration" : ["d"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/multiple-events-per-transition/test1.scxml b/test/scxml-test-framework/test/multiple-events-per-transition/test1.scxml
index fdea437..3ee5fa2 100644
--- a/test/scxml-test-framework/test/multiple-events-per-transition/test1.scxml
+++ b/test/scxml-test-framework/test/multiple-events-per-transition/test1.scxml
@@ -15,22 +15,22 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <state id="a">
- <transition target="b" event="foo bar bat"/>
- </state>
+ <state id="a">
+ <transition target="b" event="foo bar bat"/>
+ </state>
- <state id="b">
- <transition target="c" event="foo bar bat"/>
- </state>
+ <state id="b">
+ <transition target="c" event="foo bar bat"/>
+ </state>
- <state id="c">
- <transition target="d" event="foo bar bat"/>
- </state>
+ <state id="c">
+ <transition target="d" event="foo bar bat"/>
+ </state>
- <state id="d"/>
+ <state id="d"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test0.json b/test/scxml-test-framework/test/parallel+interrupt/test0.json
index f8c3982..95b109d 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test0.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test0.json
@@ -1,10 +1,10 @@
{
- "initialConfiguration" : ["c","d"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a1"]
- }
+ "initialConfiguration" : ["c","d"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a1"]
+ }
- ]
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test0.scxml b/test/scxml-test-framework/test/parallel+interrupt/test0.scxml
index 5684784..e8072f0 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test0.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test0.scxml
@@ -19,26 +19,25 @@ orthogonal preemption - inner or states interrupt one-another
in our semantics, source state is at the same level of hierarchy, so document order will resolve conflict. a1 will win.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <state id="c">
- <transition event="t" target="a1"/>
- </state>
+ <parallel id="b">
+ <state id="c">
+ <transition event="t" target="a1"/>
+ </state>
- <state id="d">
- <transition event="t" target="a2"/>
- </state>
+ <state id="d">
+ <transition event="t" target="a2"/>
+ </state>
- </parallel>
+ </parallel>
- <state id="a1"/>
+ <state id="a1"/>
- <state id="a2"/>
+ <state id="a2"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test1.json b/test/scxml-test-framework/test/parallel+interrupt/test1.json
index 09312a0..723901c 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test1.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test1.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["c1","d1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c2","d1"]
- }
+ "initialConfiguration" : ["c1","d1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c2","d1"]
+ }
- ]
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test1.scxml b/test/scxml-test-framework/test/parallel+interrupt/test1.scxml
index 8dd8661..83ad119 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test1.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test1.scxml
@@ -19,29 +19,28 @@ orthogonal preemption - transition originating at inner OR state interrupts tran
first OR state should win, as the transitions originate at the same level of hierarchy, and wins by document order
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
-
- <parallel id="b">
- <state id="c" initial="c1">
- <state id="c1">
- <transition event="t" target="c2"/>
- </state>
-
- <state id="c2"/>
- </state>
-
- <state id="d" initial="d1">
- <state id="d1">
- <transition event="t" target="a1"/>
- </state>
- </state>
-
- </parallel>
-
- <state id="a1"/>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
+
+ <parallel id="b">
+ <state id="c" initial="c1">
+ <state id="c1">
+ <transition event="t" target="c2"/>
+ </state>
+
+ <state id="c2"/>
+ </state>
+
+ <state id="d" initial="d1">
+ <state id="d1">
+ <transition event="t" target="a1"/>
+ </state>
+ </state>
+
+ </parallel>
+
+ <state id="a1"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test10.json b/test/scxml-test-framework/test/parallel+interrupt/test10.json
index 4db82db..cc1a4ff 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test10.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test10.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["b1","b2"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c1","c2"]
- }
-
- ]
+ "initialConfiguration" : ["b1","b2"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c1","c2"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test10.scxml b/test/scxml-test-framework/test/parallel+interrupt/test10.scxml
index bf84721..b68c38e 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test10.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test10.scxml
@@ -20,32 +20,31 @@ initial: [b1,b2]
after t: [c1,c2]
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="a">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="a">
- <state id="a" initial="b">
+ <state id="a" initial="b">
- <transition event="t" target="c"/>
+ <transition event="t" target="c"/>
- <parallel id="b">
- <state id="b1">
- </state>
+ <parallel id="b">
+ <state id="b1">
+ </state>
- <state id="b2">
- </state>
- </parallel>
+ <state id="b2">
+ </state>
+ </parallel>
- <parallel id="c">
- <state id="c1">
- </state>
+ <parallel id="c">
+ <state id="c1">
+ </state>
- <state id="c2">
- </state>
- </parallel>
- </state>
+ <state id="c2">
+ </state>
+ </parallel>
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test11.json b/test/scxml-test-framework/test/parallel+interrupt/test11.json
index 3d4a03b..19f29fb 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test11.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test11.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["b1","b2"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["d"]
- }
-
- ]
+ "initialConfiguration" : ["b1","b2"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["d"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test11.scxml b/test/scxml-test-framework/test/parallel+interrupt/test11.scxml
index 0ba2be3..c098dc0 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test11.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test11.scxml
@@ -4,35 +4,34 @@ initial: [b1,b2]
after t: [d]
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="a">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="a">
- <state id="a" initial="b">
+ <state id="a" initial="b">
- <parallel id="b">
- <state id="b1">
- <transition event="t" target="d"/>
- </state>
+ <parallel id="b">
+ <state id="b1">
+ <transition event="t" target="d"/>
+ </state>
- <state id="b2">
- <transition event="t" target="c"/>
- </state>
+ <state id="b2">
+ <transition event="t" target="c"/>
+ </state>
- </parallel>
+ </parallel>
- <parallel id="c">
- <state id="c1">
- </state>
+ <parallel id="c">
+ <state id="c1">
+ </state>
- <state id="c2">
- </state>
- </parallel>
+ <state id="c2">
+ </state>
+ </parallel>
- </state>
+ </state>
- <state id="d"/>
+ <state id="d"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test12.json b/test/scxml-test-framework/test/parallel+interrupt/test12.json
index c1d01f4..93a1a43 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test12.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test12.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["b1","b2"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c1","c2"]
- }
-
- ]
+ "initialConfiguration" : ["b1","b2"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c1","c2"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test12.scxml b/test/scxml-test-framework/test/parallel+interrupt/test12.scxml
index 8f7a66a..f7025a4 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test12.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test12.scxml
@@ -19,35 +19,34 @@ initial: [b1,b2]
after t: [c1,c2]
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="a">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="a">
- <state id="a" initial="b">
- <parallel id="b">
- <state id="b1">
- <transition event="t" target="c"/>
- </state>
+ <state id="a" initial="b">
+ <parallel id="b">
+ <state id="b1">
+ <transition event="t" target="c"/>
+ </state>
- <state id="b2">
- <transition event="t" target="d"/>
- </state>
+ <state id="b2">
+ <transition event="t" target="d"/>
+ </state>
- </parallel>
+ </parallel>
- <parallel id="c">
- <state id="c1">
- </state>
+ <parallel id="c">
+ <state id="c1">
+ </state>
- <state id="c2">
- </state>
- </parallel>
+ <state id="c2">
+ </state>
+ </parallel>
- </state>
+ </state>
- <state id="d"/>
+ <state id="d"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test13.json b/test/scxml-test-framework/test/parallel+interrupt/test13.json
index b97af4f..f84429c 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test13.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test13.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["b1","b2"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c1","c2"]
- }
-
- ]
+ "initialConfiguration" : ["b1","b2"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c1","c2"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test13.scxml b/test/scxml-test-framework/test/parallel+interrupt/test13.scxml
index a0fcf54..5e87469 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test13.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test13.scxml
@@ -19,37 +19,36 @@ initial: [b1,b2]
after t: [c1,c2]
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="a">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="a">
- <state id="a" initial="b">
+ <state id="a" initial="b">
- <parallel id="b">
- <state id="b1">
- <transition event="t" target="c"/>
- </state>
+ <parallel id="b">
+ <state id="b1">
+ <transition event="t" target="c"/>
+ </state>
- <state id="b2">
- </state>
+ <state id="b2">
+ </state>
- <transition event="t" target="d"/>
+ <transition event="t" target="d"/>
- </parallel>
+ </parallel>
- <parallel id="c">
- <state id="c1">
- </state>
+ <parallel id="c">
+ <state id="c1">
+ </state>
- <state id="c2">
- </state>
- </parallel>
+ <state id="c2">
+ </state>
+ </parallel>
- </state>
+ </state>
- <state id="d"/>
+ <state id="d"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test14.json b/test/scxml-test-framework/test/parallel+interrupt/test14.json
index cd93b1d..f3c1994 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test14.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test14.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["i1","j","h","g","f1","k"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["l"]
- }
-
- ]
+ "initialConfiguration" : ["i1","j","h","g","f1","k"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["l"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test14.scxml b/test/scxml-test-framework/test/parallel+interrupt/test14.scxml
index 098ecf1..dead195 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test14.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test14.scxml
@@ -19,50 +19,49 @@ initial: [i1,j,h,g,f1,i1,k]
after t: [l]
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="a">
-
- <parallel id="a">
- <parallel id="b">
- <parallel id="c">
- <parallel id="d">
- <parallel id="e">
-
- <state id="i" initial="i1">
- <state id="i1">
- <transition target="l" event="t"/>
- </state>
-
- <state id="i2">
- </state>
- </state>
-
- <state id="j"/>
- </parallel>
-
- <state id="h"/>
- </parallel>
-
- <state id="g"/>
- </parallel>
-
- <state id="f" initial="f1">
- <state id="f1">
- <transition target="f2" event="t"/>
- </state>
-
- <state id="f2">
- </state>
- </state>
- </parallel>
-
- <state id="k"/>
- </parallel>
-
- <state id="l"/>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="a">
+
+ <parallel id="a">
+ <parallel id="b">
+ <parallel id="c">
+ <parallel id="d">
+ <parallel id="e">
+
+ <state id="i" initial="i1">
+ <state id="i1">
+ <transition target="l" event="t"/>
+ </state>
+
+ <state id="i2">
+ </state>
+ </state>
+
+ <state id="j"/>
+ </parallel>
+
+ <state id="h"/>
+ </parallel>
+
+ <state id="g"/>
+ </parallel>
+
+ <state id="f" initial="f1">
+ <state id="f1">
+ <transition target="f2" event="t"/>
+ </state>
+
+ <state id="f2">
+ </state>
+ </state>
+ </parallel>
+
+ <state id="k"/>
+ </parallel>
+
+ <state id="l"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test15.json b/test/scxml-test-framework/test/parallel+interrupt/test15.json
index 6737f6e..e3d8a56 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test15.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test15.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["i1","j","h","g","f1","k"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["i2","j","h","g","f1","k"]
- }
-
- ]
+ "initialConfiguration" : ["i1","j","h","g","f1","k"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["i2","j","h","g","f1","k"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test15.scxml b/test/scxml-test-framework/test/parallel+interrupt/test15.scxml
index d9bf6f8..2c2fc67 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test15.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test15.scxml
@@ -19,48 +19,47 @@ initial: [i1,j,h,g,f1,i1,k]
after t: ["i2","j","h","g","f1","k"]
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="a">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="a">
- <parallel id="a">
- <parallel id="b">
- <parallel id="c">
- <parallel id="d">
- <parallel id="e">
+ <parallel id="a">
+ <parallel id="b">
+ <parallel id="c">
+ <parallel id="d">
+ <parallel id="e">
- <state id="i" initial="i1">
- <state id="i1">
- <transition target="i2" event="t"/>
- </state>
+ <state id="i" initial="i1">
+ <state id="i1">
+ <transition target="i2" event="t"/>
+ </state>
- <state id="i2">
- </state>
- </state>
+ <state id="i2">
+ </state>
+ </state>
- <state id="j"/>
- </parallel>
+ <state id="j"/>
+ </parallel>
- <state id="h"/>
- </parallel>
+ <state id="h"/>
+ </parallel>
- <state id="g"/>
- </parallel>
+ <state id="g"/>
+ </parallel>
- <state id="f" initial="f1">
- <state id="f1">
- <transition target="l" event="t"/>
- </state>
+ <state id="f" initial="f1">
+ <state id="f1">
+ <transition target="l" event="t"/>
+ </state>
- <state id="f2">
- </state>
- </state>
- </parallel>
+ <state id="f2">
+ </state>
+ </state>
+ </parallel>
- <state id="k"/>
- </parallel>
+ <state id="k"/>
+ </parallel>
- <state id="l"/>
+ <state id="l"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test16.json b/test/scxml-test-framework/test/parallel+interrupt/test16.json
index 3e7a63f..b73fce9 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test16.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test16.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["c","d"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a1"]
- }
-
- ]
+ "initialConfiguration" : ["c","d"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a1"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test16.scxml b/test/scxml-test-framework/test/parallel+interrupt/test16.scxml
index 3312fa8..d7ec9fc 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test16.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test16.scxml
@@ -20,27 +20,26 @@ illustrates target interrupt
in our semantics, source state is at the same level of hierarchy, so document order will resolve conflict. a1 will win.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <state id="c">
- <transition event="t" target="a"/>
- </state>
+ <parallel id="b">
+ <state id="c">
+ <transition event="t" target="a"/>
+ </state>
- <state id="d">
- <transition event="t" target="a2"/>
- </state>
+ <state id="d">
+ <transition event="t" target="a2"/>
+ </state>
- </parallel>
+ </parallel>
- <state id="a" initial="a1">
- <state id="a1"/>
+ <state id="a" initial="a1">
+ <state id="a1"/>
- <state id="a2"/>
- </state>
+ <state id="a2"/>
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test17.json b/test/scxml-test-framework/test/parallel+interrupt/test17.json
index 586da7a..5b9f8af 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test17.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test17.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["c","d"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a2"]
- }
-
- ]
+ "initialConfiguration" : ["c","d"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a2"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test17.scxml b/test/scxml-test-framework/test/parallel+interrupt/test17.scxml
index 944c2b0..4af40c5 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test17.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test17.scxml
@@ -20,28 +20,27 @@ illustrates target interrupt
in our semantics, source state is at the same level of hierarchy, so document order will resolve conflict. a1 will win.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <state id="c">
- <transition event="t" target="a2"/>
- </state>
+ <parallel id="b">
+ <state id="c">
+ <transition event="t" target="a2"/>
+ </state>
- <state id="d">
- <transition event="t" target="a"/>
- </state>
+ <state id="d">
+ <transition event="t" target="a"/>
+ </state>
- </parallel>
+ </parallel>
- <state id="a" initial="a1">
- <state id="a1"/>
+ <state id="a" initial="a1">
+ <state id="a1"/>
- <state id="a2"/>
- </state>
+ <state id="a2"/>
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test18.json b/test/scxml-test-framework/test/parallel+interrupt/test18.json
index 46b284f..55abbba 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test18.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test18.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["c","d"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a2"]
- }
-
- ]
+ "initialConfiguration" : ["c","d"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a2"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test18.scxml b/test/scxml-test-framework/test/parallel+interrupt/test18.scxml
index 2765d52..e0d14a8 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test18.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test18.scxml
@@ -16,25 +16,24 @@
-->
<!-- orthogonal preemption - outer and state interrupts inner or state -->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <state id="c"/>
+ <parallel id="b">
+ <state id="c"/>
- <state id="d">
- <transition event="t" target="a2"/>
- </state>
+ <state id="d">
+ <transition event="t" target="a2"/>
+ </state>
- <transition event="t" target="a1"/>
- </parallel>
+ <transition event="t" target="a1"/>
+ </parallel>
- <state id="a1"/>
+ <state id="a1"/>
- <state id="a2"/>
+ <state id="a2"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test19.json b/test/scxml-test-framework/test/parallel+interrupt/test19.json
index e899562..9c0458f 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test19.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test19.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["c1","d1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c2","d2"]
- }
-
- ]
+ "initialConfiguration" : ["c1","d1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c2","d2"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test19.scxml b/test/scxml-test-framework/test/parallel+interrupt/test19.scxml
index 1eee200..d5c8967 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test19.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test19.scxml
@@ -16,34 +16,33 @@
-->
<!-- orthogonal preemption - two transitions originating at internal OR states are interrupted by a transition originating at outer AND state -->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <state id="c" initial="c1">
- <state id="c1">
- <transition event="t" target="c2"/>
- </state>
+ <parallel id="b">
+ <state id="c" initial="c1">
+ <state id="c1">
+ <transition event="t" target="c2"/>
+ </state>
- <state id="c2"/>
- </state>
+ <state id="c2"/>
+ </state>
- <state id="d" initial="d1">
- <state id="d1">
- <transition event="t" target="d2"/>
- </state>
+ <state id="d" initial="d1">
+ <state id="d1">
+ <transition event="t" target="d2"/>
+ </state>
- <state id="d2"/>
- </state>
+ <state id="d2"/>
+ </state>
- <transition event="t" target="a1" />
+ <transition event="t" target="a1" />
- </parallel>
+ </parallel>
- <state id="a1"/>
+ <state id="a1"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test2.json b/test/scxml-test-framework/test/parallel+interrupt/test2.json
index 5d1076a..e3b3b9d 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test2.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test2.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["c1","d1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a1"]
- }
+ "initialConfiguration" : ["c1","d1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a1"]
+ }
- ]
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test2.scxml b/test/scxml-test-framework/test/parallel+interrupt/test2.scxml
index 975431d..1c3757f 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test2.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test2.scxml
@@ -19,34 +19,33 @@ orthogonal preemption - transition originating at inner OR state interrupts tran
again, first OR state should win, as the transitions originate at the same level of hierarchy, and wins by document order
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
+ <parallel id="b">
- <state id="c" initial="c1">
- <state id="c1">
- <transition event="t" target="a1"/>
- </state>
+ <state id="c" initial="c1">
+ <state id="c1">
+ <transition event="t" target="a1"/>
+ </state>
- <state id="c2"/>
- </state>
+ <state id="c2"/>
+ </state>
- <state id="d" initial="d1">
- <state id="d1">
- <transition event="t" target="d2"/>
- </state>
+ <state id="d" initial="d1">
+ <state id="d1">
+ <transition event="t" target="d2"/>
+ </state>
- <state id="d2"/>
- </state>
+ <state id="d2"/>
+ </state>
- </parallel>
+ </parallel>
- <state id="a1"/>
+ <state id="a1"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test20.json b/test/scxml-test-framework/test/parallel+interrupt/test20.json
index c29b31d..470a986 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test20.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test20.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["c1","d"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c2","d"]
- }
-
- ]
+ "initialConfiguration" : ["c1","d"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c2","d"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test20.scxml b/test/scxml-test-framework/test/parallel+interrupt/test20.scxml
index 1e2473c..2066be5 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test20.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test20.scxml
@@ -18,32 +18,31 @@
here we have multiple interrupt conflicts, originating from d and a2.
transition from c1 will win, for same reasons listed above -->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <state id="c" initial="c1">
- <state id="c1">
- <transition event="t" target="c2"/>
- </state>
+ <parallel id="b">
+ <state id="c" initial="c1">
+ <state id="c1">
+ <transition event="t" target="c2"/>
+ </state>
- <state id="c2"/>
- </state>
+ <state id="c2"/>
+ </state>
- <state id="d">
- <transition event="t" target="a1"/>
- </state>
+ <state id="d">
+ <transition event="t" target="a1"/>
+ </state>
- <transition event="t" target="a2"/>
+ <transition event="t" target="a2"/>
- </parallel>
+ </parallel>
- <state id="a1"/>
+ <state id="a1"/>
- <state id="a2"/>
+ <state id="a2"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test21.json b/test/scxml-test-framework/test/parallel+interrupt/test21.json
index 99f729c..15fb75b 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test21.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test21.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["c","d1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c","d2"]
- }
-
- ]
+ "initialConfiguration" : ["c","d1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c","d2"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test21.scxml b/test/scxml-test-framework/test/parallel+interrupt/test21.scxml
index 55bdcdf..4e66fda 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test21.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test21.scxml
@@ -18,31 +18,30 @@
here we have multiple interrupt conflicts, originating from d and a2.
transition from d1 will win, for same reasons listed above -->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
+ <parallel id="b">
- <state id="c">
- <transition event="t" target="a1"/>
- </state>
+ <state id="c">
+ <transition event="t" target="a1"/>
+ </state>
- <state id="d" initial="d1">
- <state id="d1">
- <transition event="t" target="d2"/>
- </state>
+ <state id="d" initial="d1">
+ <state id="d1">
+ <transition event="t" target="d2"/>
+ </state>
- <state id="d2"/>
- </state>
+ <state id="d2"/>
+ </state>
- <transition event="t" target="a2"/>
+ <transition event="t" target="a2"/>
- </parallel>
+ </parallel>
- <state id="a1"/>
+ <state id="a1"/>
- <state id="a2"/>
+ <state id="a2"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test22.json b/test/scxml-test-framework/test/parallel+interrupt/test22.json
index d3434f7..4d7bf5a 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test22.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test22.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["c1","d1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c2","d2"]
- }
-
- ]
+ "initialConfiguration" : ["c1","d1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c2","d2"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test22.scxml b/test/scxml-test-framework/test/parallel+interrupt/test22.scxml
index b313fa5..2e71d50 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test22.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test22.scxml
@@ -18,33 +18,32 @@
here we have multiple interrupt conflicts, originating from d and a2.
transitions from c1 and d1 will win, for same reasons listed above -->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <state id="c" initial="c1">
- <state id="c1">
- <transition event="t" target="c2"/>
- </state>
+ <parallel id="b">
+ <state id="c" initial="c1">
+ <state id="c1">
+ <transition event="t" target="c2"/>
+ </state>
- <state id="c2"/>
- </state>
+ <state id="c2"/>
+ </state>
- <state id="d" initial="d1">
- <state id="d1">
- <transition event="t" target="d2"/>
- </state>
+ <state id="d" initial="d1">
+ <state id="d1">
+ <transition event="t" target="d2"/>
+ </state>
- <state id="d2"/>
- </state>
+ <state id="d2"/>
+ </state>
- <transition event="t" target="a1" />
+ <transition event="t" target="a1" />
- </parallel>
+ </parallel>
- <state id="a1"/>
+ <state id="a1"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test23.json b/test/scxml-test-framework/test/parallel+interrupt/test23.json
index 7321890..db53da4 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test23.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test23.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["c","d"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a2"]
- }
-
- ]
+ "initialConfiguration" : ["c","d"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a2"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test23.scxml b/test/scxml-test-framework/test/parallel+interrupt/test23.scxml
index e5b24e7..04245a6 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test23.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test23.scxml
@@ -16,25 +16,24 @@
-->
<!-- orthogonal preemption - outer and state interrupts inner or state -->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <state id="c"/>
+ <parallel id="b">
+ <state id="c"/>
- <state id="d">
- <transition event="t" target="a2"/>
- </state>
+ <state id="d">
+ <transition event="t" target="a2"/>
+ </state>
- <transition event="t" target="a1"/>
- </parallel>
+ <transition event="t" target="a1"/>
+ </parallel>
- <state id="a1"/>
+ <state id="a1"/>
- <state id="a2"/>
+ <state id="a2"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test24.json b/test/scxml-test-framework/test/parallel+interrupt/test24.json
index 90c50b5..d1c8f8b 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test24.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test24.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["c1","d1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c2","d2"]
- }
-
- ]
+ "initialConfiguration" : ["c1","d1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c2","d2"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test24.scxml b/test/scxml-test-framework/test/parallel+interrupt/test24.scxml
index 1faa9ce..6534d68 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test24.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test24.scxml
@@ -16,34 +16,33 @@
-->
<!-- orthogonal preemption - two transitions originating at internal OR states are interrupted by a transition originating at outer AND state -->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <state id="c" initial="c1">
- <state id="c1">
- <transition event="t" target="c2"/>
- </state>
+ <parallel id="b">
+ <state id="c" initial="c1">
+ <state id="c1">
+ <transition event="t" target="c2"/>
+ </state>
- <state id="c2"/>
- </state>
+ <state id="c2"/>
+ </state>
- <state id="d" initial="d1">
- <state id="d1">
- <transition event="t" target="d2"/>
- </state>
+ <state id="d" initial="d1">
+ <state id="d1">
+ <transition event="t" target="d2"/>
+ </state>
- <state id="d2"/>
- </state>
+ <state id="d2"/>
+ </state>
- <transition event="t" target="a1" />
+ <transition event="t" target="a1" />
- </parallel>
+ </parallel>
- <state id="a1"/>
+ <state id="a1"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test25.json b/test/scxml-test-framework/test/parallel+interrupt/test25.json
index 444f24e..7c380c8 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test25.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test25.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["c1","d"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c2","d"]
- }
-
- ]
+ "initialConfiguration" : ["c1","d"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c2","d"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test25.scxml b/test/scxml-test-framework/test/parallel+interrupt/test25.scxml
index add7ebd..2084c90 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test25.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test25.scxml
@@ -18,32 +18,31 @@
here we have multiple interrupt conflicts, originating from d and b.
transition from c1 will win, for same reasons listed above -->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <state id="c" initial="c1">
- <state id="c1">
- <transition event="t" target="c2"/>
- </state>
+ <parallel id="b">
+ <state id="c" initial="c1">
+ <state id="c1">
+ <transition event="t" target="c2"/>
+ </state>
- <state id="c2"/>
- </state>
+ <state id="c2"/>
+ </state>
- <state id="d">
- <transition event="t" target="a1"/>
- </state>
+ <state id="d">
+ <transition event="t" target="a1"/>
+ </state>
- <transition event="t" target="a2"/>
+ <transition event="t" target="a2"/>
- </parallel>
+ </parallel>
- <state id="a1"/>
+ <state id="a1"/>
- <state id="a2"/>
+ <state id="a2"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test26.json b/test/scxml-test-framework/test/parallel+interrupt/test26.json
index e6740f3..89e21a1 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test26.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test26.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["c","d1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c","d2"]
- }
-
- ]
+ "initialConfiguration" : ["c","d1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c","d2"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test26.scxml b/test/scxml-test-framework/test/parallel+interrupt/test26.scxml
index 1a5ab71..355e7f0 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test26.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test26.scxml
@@ -3,33 +3,32 @@
here we have multiple interrupt conflicts, originating from d and a2.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
+ <parallel id="b">
- <state id="c">
- <transition event="t" target="a1"/>
- </state>
+ <state id="c">
+ <transition event="t" target="a1"/>
+ </state>
- <state id="d" initial="d1">
- <state id="d1">
- <transition event="t" target="d2"/>
- </state>
+ <state id="d" initial="d1">
+ <state id="d1">
+ <transition event="t" target="d2"/>
+ </state>
- <state id="d2"/>
- </state>
+ <state id="d2"/>
+ </state>
- <transition event="t" target="a2"/>
+ <transition event="t" target="a2"/>
- </parallel>
+ </parallel>
- <state id="a1"/>
+ <state id="a1"/>
- <state id="a2"/>
+ <state id="a2"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test27.json b/test/scxml-test-framework/test/parallel+interrupt/test27.json
index 1bfe6bf..46de906 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test27.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test27.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["c1","d1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c2","d2"]
- }
-
- ]
+ "initialConfiguration" : ["c1","d1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c2","d2"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test27.scxml b/test/scxml-test-framework/test/parallel+interrupt/test27.scxml
index 6bf78b8..e5b7384 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test27.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test27.scxml
@@ -18,34 +18,33 @@
here we have multiple interrupt conflicts, originating from d and a2.
transitions from c1 and d1 will win, for same reasons listed above -->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <state id="c" initial="c1">
- <state id="c1">
- <transition event="t" target="c2"/>
- </state>
+ <parallel id="b">
+ <state id="c" initial="c1">
+ <state id="c1">
+ <transition event="t" target="c2"/>
+ </state>
- <state id="c2"/>
- </state>
+ <state id="c2"/>
+ </state>
- <state id="d" initial="d1">
- <state id="d1">
- <transition event="t" target="d2"/>
- </state>
+ <state id="d" initial="d1">
+ <state id="d1">
+ <transition event="t" target="d2"/>
+ </state>
- <state id="d2"/>
- </state>
+ <state id="d2"/>
+ </state>
- <transition event="t" target="a1" />
+ <transition event="t" target="a1" />
- </parallel>
+ </parallel>
- <state id="a1"/>
+ <state id="a1"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test28.json b/test/scxml-test-framework/test/parallel+interrupt/test28.json
index 54a4859..ebb83a8 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test28.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test28.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["c","d"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a2"]
- }
-
- ]
+ "initialConfiguration" : ["c","d"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a2"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test28.scxml b/test/scxml-test-framework/test/parallel+interrupt/test28.scxml
index a0ce570..724a023 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test28.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test28.scxml
@@ -18,28 +18,27 @@
inner transition will have priority, so final state will be a2.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <state id="c"/>
+ <parallel id="b">
+ <state id="c"/>
- <state id="d">
- <transition event="t" target="a2"/>
- </state>
+ <state id="d">
+ <transition event="t" target="a2"/>
+ </state>
- <transition event="t" target="a"/>
- </parallel>
+ <transition event="t" target="a"/>
+ </parallel>
- <state id="a" initial="a1">
- <state id="a1"/>
+ <state id="a" initial="a1">
+ <state id="a1"/>
- <state id="a2"/>
- </state>
+ <state id="a2"/>
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test29.json b/test/scxml-test-framework/test/parallel+interrupt/test29.json
index cf79edb..744f5da 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test29.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test29.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["c","d"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a1"]
- }
-
- ]
+ "initialConfiguration" : ["c","d"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a1"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test29.scxml b/test/scxml-test-framework/test/parallel+interrupt/test29.scxml
index 3e111d8..d6bc1f0 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test29.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test29.scxml
@@ -18,28 +18,27 @@
inner transition will have priority, so final state will be a1.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <state id="c"/>
+ <parallel id="b">
+ <state id="c"/>
- <state id="d">
- <transition event="t" target="a"/>
- </state>
+ <state id="d">
+ <transition event="t" target="a"/>
+ </state>
- <transition event="t" target="a2"/>
- </parallel>
+ <transition event="t" target="a2"/>
+ </parallel>
- <state id="a" initial="a1">
- <state id="a1"/>
+ <state id="a" initial="a1">
+ <state id="a1"/>
- <state id="a2"/>
- </state>
+ <state id="a2"/>
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test3.json b/test/scxml-test-framework/test/parallel+interrupt/test3.json
index e2fcd8b..804186e 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test3.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test3.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["e","f","d"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a1"]
- }
-
- ]
+ "initialConfiguration" : ["e","f","d"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a1"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test3.scxml b/test/scxml-test-framework/test/parallel+interrupt/test3.scxml
index 84c8c78..a21a4e2 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test3.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test3.scxml
@@ -4,37 +4,36 @@ orthogonal preemption - inner or states interrupt one-another
in our semantics, source state is at the same level of hierarchy, so document order will resolve conflict. a1 will win.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <parallel id="c">
- <state id="e">
- <transition event="t" target="a1"/>
- </state>
+ <parallel id="b">
+ <parallel id="c">
+ <state id="e">
+ <transition event="t" target="a1"/>
+ </state>
- <state id="f">
- <transition event="t" target="a2"/>
- </state>
+ <state id="f">
+ <transition event="t" target="a2"/>
+ </state>
- <transition event="t" target="a3"/>
- </parallel>
+ <transition event="t" target="a3"/>
+ </parallel>
- <state id="d">
- <transition event="t" target="a4"/>
- </state>
+ <state id="d">
+ <transition event="t" target="a4"/>
+ </state>
- </parallel>
+ </parallel>
- <state id="a1"/>
+ <state id="a1"/>
- <state id="a2"/>
+ <state id="a2"/>
- <state id="a3"/>
+ <state id="a3"/>
- <state id="a4"/>
+ <state id="a4"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test30.json b/test/scxml-test-framework/test/parallel+interrupt/test30.json
index 4f2cf18..3730a94 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test30.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test30.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["c1","d"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c2","d"]
- }
-
- ]
+ "initialConfiguration" : ["c1","d"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c2","d"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test30.scxml b/test/scxml-test-framework/test/parallel+interrupt/test30.scxml
index 6163338..b10720b 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test30.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test30.scxml
@@ -19,34 +19,33 @@ here we have multiple interrupt conflicts, originating from d and a2.
transition from c1 will win, for same reasons listed above.
final state will be: c2 -->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <state id="c" initial="c1">
- <state id="c1">
- <transition event="t" target="c2"/>
- </state>
+ <parallel id="b">
+ <state id="c" initial="c1">
+ <state id="c1">
+ <transition event="t" target="c2"/>
+ </state>
- <state id="c2"/>
- </state>
+ <state id="c2"/>
+ </state>
- <state id="d">
- <transition event="t" target="a"/>
- </state>
+ <state id="d">
+ <transition event="t" target="a"/>
+ </state>
- <transition event="t" target="a2"/>
+ <transition event="t" target="a2"/>
- </parallel>
+ </parallel>
- <state id="a" initial="a1">
- <state id="a1"/>
+ <state id="a" initial="a1">
+ <state id="a1"/>
- <state id="a2"/>
- </state>
+ <state id="a2"/>
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test31.json b/test/scxml-test-framework/test/parallel+interrupt/test31.json
index 355a5b3..a66b39a 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test31.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test31.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["c1","d1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a1"]
- }
-
- ]
+ "initialConfiguration" : ["c1","d1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a1"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test31.scxml b/test/scxml-test-framework/test/parallel+interrupt/test31.scxml
index c20d2d9..a90fe8f 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test31.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test31.scxml
@@ -19,37 +19,36 @@ here we have multiple interrupt conflicts, originating from d and a2.
transition from c1 will win, for same reasons listed above.
final state will be: a1 -->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
+ <parallel id="b">
- <state id="c" initial="c1">
- <state id="c1">
- <transition event="t" target="a"/>
- </state>
- </state>
+ <state id="c" initial="c1">
+ <state id="c1">
+ <transition event="t" target="a"/>
+ </state>
+ </state>
- <state id="d" initial="d1">
- <state id="d1">
- <transition event="t" target="d2"/>
- </state>
+ <state id="d" initial="d1">
+ <state id="d1">
+ <transition event="t" target="d2"/>
+ </state>
- <state id="d2"/>
- </state>
+ <state id="d2"/>
+ </state>
- <transition event="t" target="a2"/>
+ <transition event="t" target="a2"/>
- </parallel>
+ </parallel>
- <state id="a" initial="a1">
- <state id="a1"/>
+ <state id="a" initial="a1">
+ <state id="a1"/>
- <state id="a2"/>
- </state>
+ <state id="a2"/>
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test4.json b/test/scxml-test-framework/test/parallel+interrupt/test4.json
index bbdc56d..497debc 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test4.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test4.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["e","f","g"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a1"]
- }
-
- ]
+ "initialConfiguration" : ["e","f","g"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a1"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test4.scxml b/test/scxml-test-framework/test/parallel+interrupt/test4.scxml
index d705279..ca9d2bd 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test4.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test4.scxml
@@ -18,43 +18,42 @@
orthogonal preemption - inner or states interrupt one-another
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <parallel id="p">
- <state id="e">
- <transition event="t" target="a1"/>
- </state>
+ <parallel id="b">
+ <parallel id="p">
+ <state id="e">
+ <transition event="t" target="a1"/>
+ </state>
- <state id="f">
- <transition event="t" target="a2"/>
- </state>
+ <state id="f">
+ <transition event="t" target="a2"/>
+ </state>
- <transition event="t" target="a3"/>
- </parallel>
+ <transition event="t" target="a3"/>
+ </parallel>
- <state id="d" initial="g">
- <state id="g">
- <transition event="t" target="h"/>
- </state>
+ <state id="d" initial="g">
+ <state id="g">
+ <transition event="t" target="h"/>
+ </state>
- <state id="h"/>
- </state>
+ <state id="h"/>
+ </state>
- </parallel>
+ </parallel>
- <state id="a1"/>
+ <state id="a1"/>
- <state id="a2"/>
+ <state id="a2"/>
- <state id="a3"/>
+ <state id="a3"/>
- <state id="a4"/>
+ <state id="a4"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test5.json b/test/scxml-test-framework/test/parallel+interrupt/test5.json
index fd1c05f..117dc4d 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test5.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test5.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["e","f","g"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["e","f","h"]
- }
-
- ]
+ "initialConfiguration" : ["e","f","g"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["e","f","h"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test5.scxml b/test/scxml-test-framework/test/parallel+interrupt/test5.scxml
index f96d49e..2d853a4 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test5.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test5.scxml
@@ -18,41 +18,40 @@
orthogonal preemption - inner or states interrupt one-another
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <state id="d" initial="g">
- <state id="g">
- <transition event="t" target="h"/>
- </state>
+ <parallel id="b">
+ <state id="d" initial="g">
+ <state id="g">
+ <transition event="t" target="h"/>
+ </state>
- <state id="h"/>
- </state>
+ <state id="h"/>
+ </state>
- <parallel id="p">
- <state id="e">
- <transition event="t" target="a1"/>
- </state>
+ <parallel id="p">
+ <state id="e">
+ <transition event="t" target="a1"/>
+ </state>
- <state id="f">
- <transition event="t" target="a2"/>
- </state>
+ <state id="f">
+ <transition event="t" target="a2"/>
+ </state>
- <transition event="t" target="a3"/>
- </parallel>
- </parallel>
+ <transition event="t" target="a3"/>
+ </parallel>
+ </parallel>
- <state id="a1"/>
+ <state id="a1"/>
- <state id="a2"/>
+ <state id="a2"/>
- <state id="a3"/>
+ <state id="a3"/>
- <state id="a4"/>
+ <state id="a4"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test6.json b/test/scxml-test-framework/test/parallel+interrupt/test6.json
index 8cec47b..2876d0b 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test6.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test6.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["g","e1","f1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["h","e2","f2"]
- }
+ "initialConfiguration" : ["g","e1","f1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["h","e2","f2"]
+ }
- ]
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test6.scxml b/test/scxml-test-framework/test/parallel+interrupt/test6.scxml
index e2640ba..5b5702a 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test6.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test6.scxml
@@ -16,47 +16,46 @@
-->
<!--
orthogonal preemption - inner or states interrupt one-another
- no conflicts here
- initial configuration: [g,e1,f1]
- given event t: [h,e2,f2]
+ no conflicts here
+ initial configuration: [g,e1,f1]
+ given event t: [h,e2,f2]
TODO: move this to basic parallel group
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <state id="c" initial="g">
- <state id="g">
- <transition event="t" target="h"/>
- </state>
+ <parallel id="b">
+ <state id="c" initial="g">
+ <state id="g">
+ <transition event="t" target="h"/>
+ </state>
- <state id="h"/>
- </state>
+ <state id="h"/>
+ </state>
- <parallel id="d">
- <state id="e" initial="e1">
- <state id="e1">
- <transition event="t" target="e2"/>
- </state>
+ <parallel id="d">
+ <state id="e" initial="e1">
+ <state id="e1">
+ <transition event="t" target="e2"/>
+ </state>
- <state id="e2"/>
- </state>
+ <state id="e2"/>
+ </state>
- <state id="f" initial="f1">
- <state id="f1">
- <transition event="t" target="f2"/>
- </state>
+ <state id="f" initial="f1">
+ <state id="f1">
+ <transition event="t" target="f2"/>
+ </state>
- <state id="f2"/>
- </state>
+ <state id="f2"/>
+ </state>
- </parallel>
+ </parallel>
- </parallel>
+ </parallel>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test7.json b/test/scxml-test-framework/test/parallel+interrupt/test7.json
index 2c94f66..ec5e2b4 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test7.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test7.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["c","e1","f1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c","e2","f2"]
- }
-
- ]
+ "initialConfiguration" : ["c","e1","f1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c","e2","f2"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test7.scxml b/test/scxml-test-framework/test/parallel+interrupt/test7.scxml
index b16c052..97a3513 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test7.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test7.scxml
@@ -22,39 +22,38 @@ initial configuration: [c,e1,f1]
given event t: [c,e2,f2]
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="b">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="b">
- <parallel id="b">
- <state id="c">
- <transition event="t" target="a1"/>
- </state>
+ <parallel id="b">
+ <state id="c">
+ <transition event="t" target="a1"/>
+ </state>
- <parallel id="d">
- <state id="e" initial="e1">
- <state id="e1">
- <transition event="t" target="e2"/>
- </state>
+ <parallel id="d">
+ <state id="e" initial="e1">
+ <state id="e1">
+ <transition event="t" target="e2"/>
+ </state>
- <state id="e2"/>
- </state>
+ <state id="e2"/>
+ </state>
- <state id="f" initial="f1">
- <state id="f1">
- <transition event="t" target="f2"/>
- </state>
+ <state id="f" initial="f1">
+ <state id="f1">
+ <transition event="t" target="f2"/>
+ </state>
- <state id="f2"/>
- </state>
+ <state id="f2"/>
+ </state>
- </parallel>
+ </parallel>
- </parallel>
+ </parallel>
- <state id="a1"/>
+ <state id="a1"/>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test8.json b/test/scxml-test-framework/test/parallel+interrupt/test8.json
index 95ce85e..dea59df 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test8.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test8.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["b1","b2"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c1","c2"]
- }
-
- ]
+ "initialConfiguration" : ["b1","b2"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c1","c2"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test8.scxml b/test/scxml-test-framework/test/parallel+interrupt/test8.scxml
index a81b230..9068ff3 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test8.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test8.scxml
@@ -20,31 +20,30 @@ initial: [b1,b2]
after t: [c1,c2]
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="a">
-
- <state id="a" initial="b">
- <parallel id="b">
- <state id="b1">
- </state>
-
- <state id="b2">
- </state>
-
- <transition event="t" target="c"/>
- </parallel>
-
- <parallel id="c">
- <state id="c1">
- </state>
-
- <state id="c2">
- </state>
- </parallel>
- </state>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="a">
+
+ <state id="a" initial="b">
+ <parallel id="b">
+ <state id="b1">
+ </state>
+
+ <state id="b2">
+ </state>
+
+ <transition event="t" target="c"/>
+ </parallel>
+
+ <parallel id="c">
+ <state id="c1">
+ </state>
+
+ <state id="c2">
+ </state>
+ </parallel>
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test9.json b/test/scxml-test-framework/test/parallel+interrupt/test9.json
index b7eb5cd..621ba48 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test9.json
+++ b/test/scxml-test-framework/test/parallel+interrupt/test9.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["b1","b2"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c1","c2"]
- }
-
- ]
+ "initialConfiguration" : ["b1","b2"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c1","c2"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel+interrupt/test9.scxml b/test/scxml-test-framework/test/parallel+interrupt/test9.scxml
index 0169ed4..65231e8 100644
--- a/test/scxml-test-framework/test/parallel+interrupt/test9.scxml
+++ b/test/scxml-test-framework/test/parallel+interrupt/test9.scxml
@@ -20,30 +20,29 @@ initial: [b1,b2]
after t: [c1,c2]
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="a">
-
- <state id="a" initial="b">
- <parallel id="b">
- <state id="b1">
- <transition event="t" target="c"/>
- </state>
-
- <state id="b2">
- </state>
- </parallel>
-
- <parallel id="c">
- <state id="c1">
- </state>
-
- <state id="c2">
- </state>
- </parallel>
- </state>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="a">
+
+ <state id="a" initial="b">
+ <parallel id="b">
+ <state id="b1">
+ <transition event="t" target="c"/>
+ </state>
+
+ <state id="b2">
+ </state>
+ </parallel>
+
+ <parallel id="c">
+ <state id="c1">
+ </state>
+
+ <state id="c2">
+ </state>
+ </parallel>
+ </state>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel/test0.json b/test/scxml-test-framework/test/parallel/test0.json
index 5eccd85..0150078 100644
--- a/test/scxml-test-framework/test/parallel/test0.json
+++ b/test/scxml-test-framework/test/parallel/test0.json
@@ -1,6 +1,6 @@
{
- "initialConfiguration" : ["a","b"],
- "events" : [ ]
+ "initialConfiguration" : ["a","b"],
+ "events" : [ ]
}
diff --git a/test/scxml-test-framework/test/parallel/test0.scxml b/test/scxml-test-framework/test/parallel/test0.scxml
index 968b281..6ae0838 100644
--- a/test/scxml-test-framework/test/parallel/test0.scxml
+++ b/test/scxml-test-framework/test/parallel/test0.scxml
@@ -15,20 +15,15 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <initial id="intitial1">
- <transition target="p"/>
- </initial>
+ <parallel id="p">
+ <state id="a"/>
- <parallel id="p">
- <state id="a"/>
-
- <state id="b"/>
- </parallel>
+ <state id="b"/>
+ </parallel>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel/test1.json b/test/scxml-test-framework/test/parallel/test1.json
index 16791aa..6827a36 100644
--- a/test/scxml-test-framework/test/parallel/test1.json
+++ b/test/scxml-test-framework/test/parallel/test1.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["a1","b1"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["a2","b2"]
- }
-
- ]
+ "initialConfiguration" : ["a1","b1"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["a2","b2"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel/test1.scxml b/test/scxml-test-framework/test/parallel/test1.scxml
deleted file mode 100644
index 8fb9fda..0000000
--- a/test/scxml-test-framework/test/parallel/test1.scxml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <initial>
- <transition target="p"/>
- </initial>
-
- <parallel id="p">
- <state id="a">
- <initial>
- <transition target="a1"/>
- </initial>
-
- <state id="a1">
- <transition event="t" target="a2"/>
- </state>
-
- <state id="a2"/>
- </state>
-
- <state id="b">
- <initial>
- <transition target="b1"/>
- </initial>
-
- <state id="b1">
- <transition event="t" target="b2"/>
- </state>
-
- <state id="b2"/>
- </state>
- </parallel>
-
-
-</scxml>
-
-
diff --git a/test/scxml-test-framework/test/assign-next-small-step/test0.scxml b/test/scxml-test-framework/test/parallel/test1.scxml.fail
index b7ffdfe..1c0fc61 100644
--- a/test/scxml-test-framework/test/assign-next-small-step/test0.scxml
+++ b/test/scxml-test-framework/test/parallel/test1.scxml.fail
@@ -15,35 +15,37 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <datamodel>
- <data id="a"/>
- </datamodel>
+ <parallel id="p">
+ <state id="a">
+ <initial id="ia">
+ <transition target="a1"/>
+ </initial>
- <initial id="intitial1">
- <transition target="a">
- <script>
- setData('a',100);
- </script>
- </transition>
- </initial>
+ <state id="a1">
+ <transition event="t" target="a2"/>
+ </state>
- <state id="a">
- <transition target="b" event="t" cond="getData('a') === 100"/>
- <transition target="f" event="t" />
- </state>
+ <state id="a2"/>
+ </state>
- <state id="b"/>
+ <state id="b">
+ <initial id="ib">
+ <transition target="b1"/>
+ </initial>
- <state id="f"/>
+ <state id="b1">
+ <transition event="t" target="b2"/>
+ </state>
-
-</scxml>
+ <state id="b2"/>
+ </state>
+ </parallel>
+</scxml>
diff --git a/test/scxml-test-framework/test/parallel/test2.json b/test/scxml-test-framework/test/parallel/test2.json
index 367322c..7e7f790 100644
--- a/test/scxml-test-framework/test/parallel/test2.json
+++ b/test/scxml-test-framework/test/parallel/test2.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["s3","s4","s7","s8"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["s5","s6","s9","s10"]
- }
-
- ]
+ "initialConfiguration" : ["s3","s4","s7","s8"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["s5","s6","s9","s10"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel/test2.scxml b/test/scxml-test-framework/test/parallel/test2.scxml
index 2802842..c73d0dd 100644
--- a/test/scxml-test-framework/test/parallel/test2.scxml
+++ b/test/scxml-test-framework/test/parallel/test2.scxml
@@ -19,50 +19,45 @@ initial configuration: [s3,s4,s7,s8]
after event t: [s5,s6,s9,s10]
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <initial>
- <transition target="p1"/>
- </initial>
+ <parallel id="p1">
+ <state id="s1" initial="p2">
+ <parallel id="p2">
+ <state id="s3"/>
- <parallel id="p1">
- <state id="s1" initial="p2">
- <parallel id="p2">
- <state id="s3"/>
+ <state id="s4"/>
- <state id="s4"/>
+ <transition target="p3" event="t"/>
+ </parallel>
- <transition target="p3" event="t"/>
- </parallel>
+ <parallel id="p3">
+ <state id="s5"/>
- <parallel id="p3">
- <state id="s5"/>
+ <state id="s6"/>
+ </parallel>
- <state id="s6"/>
- </parallel>
+ </state>
- </state>
+ <state id="s2" initial="p4">
+ <parallel id="p4">
+ <state id="s7"/>
- <state id="s2" initial="p4">
- <parallel id="p4">
- <state id="s7"/>
+ <state id="s8"/>
- <state id="s8"/>
+ <transition target="p5" event="t"/>
+ </parallel>
- <transition target="p5" event="t"/>
- </parallel>
+ <parallel id="p5">
+ <state id="s9"/>
- <parallel id="p5">
- <state id="s9"/>
+ <state id="s10"/>
+ </parallel>
+ </state>
- <state id="s10"/>
- </parallel>
- </state>
-
- </parallel>
+ </parallel>
</scxml>
diff --git a/test/scxml-test-framework/test/parallel/test3.json b/test/scxml-test-framework/test/parallel/test3.json
index 99379fe..88737e1 100644
--- a/test/scxml-test-framework/test/parallel/test3.json
+++ b/test/scxml-test-framework/test/parallel/test3.json
@@ -1,12 +1,12 @@
{
- "initialConfiguration" : ["s3.1","s4","s7","s8"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["s3.2","s4","s9","s10"]
- }
-
- ]
+ "initialConfiguration" : ["s3.1","s4","s7","s8"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["s3.2","s4","s9","s10"]
+ }
+
+ ]
}
diff --git a/test/scxml-test-framework/test/parallel/test3.scxml b/test/scxml-test-framework/test/parallel/test3.scxml
index a0ab2ff..e143417 100644
--- a/test/scxml-test-framework/test/parallel/test3.scxml
+++ b/test/scxml-test-framework/test/parallel/test3.scxml
@@ -19,59 +19,58 @@ initial configuration: [s3.1,s4,s7,s8]
after event t: [s3.2,s4,s9,s10]
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root"
- initial="p1">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ initial="p1">
- <parallel id="p1">
- <state id="s1" initial="p2">
- <parallel id="p2">
- <state id="s3" initial="s3.1">
- <state id="s3.1">
- <transition target="s3.2" event="t"/>
- </state>
+ <parallel id="p1">
+ <state id="s1" initial="p2">
+ <parallel id="p2">
+ <state id="s3" initial="s3.1">
+ <state id="s3.1">
+ <transition target="s3.2" event="t"/>
+ </state>
- <state id="s3.2"/>
- </state>
+ <state id="s3.2"/>
+ </state>
- <state id="s4">
- </state>
+ <state id="s4">
+ </state>
- </parallel>
+ </parallel>
- <parallel id="p3">
- <state id="s5">
- </state>
+ <parallel id="p3">
+ <state id="s5">
+ </state>
- <state id="s6">
- </state>
- </parallel>
+ <state id="s6">
+ </state>
+ </parallel>
- </state>
+ </state>
- <state id="s2" initial="p4">
- <parallel id="p4">
- <state id="s7">
- </state>
+ <state id="s2" initial="p4">
+ <parallel id="p4">
+ <state id="s7">
+ </state>
- <state id="s8">
- </state>
+ <state id="s8">
+ </state>
- <transition target="p5" event="t"/>
- </parallel>
+ <transition target="p5" event="t"/>
+ </parallel>
- <parallel id="p5">
- <state id="s9">
- </state>
+ <parallel id="p5">
+ <state id="s9">
+ </state>
- <state id="s10">
- </state>
- </parallel>
- </state>
+ <state id="s10">
+ </state>
+ </parallel>
+ </state>
- </parallel>
+ </parallel>
</scxml>
diff --git a/test/scxml-test-framework/test/script-src/script-0-0.js b/test/scxml-test-framework/test/script-src/script-0-0.js
index 6a2b22f..062f555 100644
--- a/test/scxml-test-framework/test/script-src/script-0-0.js
+++ b/test/scxml-test-framework/test/script-src/script-0-0.js
@@ -1 +1 @@
-setData('a',100);
+x = 100;
diff --git a/test/scxml-test-framework/test/script-src/script-1-0.js b/test/scxml-test-framework/test/script-src/script-1-0.js
index e93bc2c..226697f 100644
--- a/test/scxml-test-framework/test/script-src/script-1-0.js
+++ b/test/scxml-test-framework/test/script-src/script-1-0.js
@@ -1 +1 @@
-setData('i',0)
+i = 0;
diff --git a/test/scxml-test-framework/test/script-src/script-1-1.js b/test/scxml-test-framework/test/script-src/script-1-1.js
index 5c7d88d..8dca7b1 100644
--- a/test/scxml-test-framework/test/script-src/script-1-1.js
+++ b/test/scxml-test-framework/test/script-src/script-1-1.js
@@ -1 +1 @@
-setData('i',getData('i') + 1)
+i = i + 1;
diff --git a/test/scxml-test-framework/test/script-src/script-2-0.js b/test/scxml-test-framework/test/script-src/script-2-0.js
index e93bc2c..226697f 100644
--- a/test/scxml-test-framework/test/script-src/script-2-0.js
+++ b/test/scxml-test-framework/test/script-src/script-2-0.js
@@ -1 +1 @@
-setData('i',0)
+i = 0;
diff --git a/test/scxml-test-framework/test/script-src/script-2-1.js b/test/scxml-test-framework/test/script-src/script-2-1.js
index 5c7d88d..8dca7b1 100644
--- a/test/scxml-test-framework/test/script-src/script-2-1.js
+++ b/test/scxml-test-framework/test/script-src/script-2-1.js
@@ -1 +1 @@
-setData('i',getData('i') + 1)
+i = i + 1;
diff --git a/test/scxml-test-framework/test/script-src/script-2-2.js b/test/scxml-test-framework/test/script-src/script-2-2.js
index 5c7d88d..8dca7b1 100644
--- a/test/scxml-test-framework/test/script-src/script-2-2.js
+++ b/test/scxml-test-framework/test/script-src/script-2-2.js
@@ -1 +1 @@
-setData('i',getData('i') + 1)
+i = i + 1;
diff --git a/test/scxml-test-framework/test/script-src/script-2-3.js b/test/scxml-test-framework/test/script-src/script-2-3.js
index d60b3c8..795c1f2 100644
--- a/test/scxml-test-framework/test/script-src/script-2-3.js
+++ b/test/scxml-test-framework/test/script-src/script-2-3.js
@@ -1 +1 @@
-setData('i',getData('i') * 2)
+i = i * 2;
diff --git a/test/scxml-test-framework/test/script-src/script-3-0.js b/test/scxml-test-framework/test/script-src/script-3-0.js
index ccc8f7b..de469c4 100644
--- a/test/scxml-test-framework/test/script-src/script-3-0.js
+++ b/test/scxml-test-framework/test/script-src/script-3-0.js
@@ -1,3 +1,3 @@
function foo(){
- a = 100;
+ x = 100;
}
diff --git a/test/scxml-test-framework/test/script-src/test0.json b/test/scxml-test-framework/test/script-src/test0.json
index 1d2faec..c27c2fd 100644
--- a/test/scxml-test-framework/test/script-src/test0.json
+++ b/test/scxml-test-framework/test/script-src/test0.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["b"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/script-src/test0.scxml b/test/scxml-test-framework/test/script-src/test0.scxml
index c2c12cd..358405c 100644
--- a/test/scxml-test-framework/test/script-src/test0.scxml
+++ b/test/scxml-test-framework/test/script-src/test0.scxml
@@ -15,29 +15,28 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
<datamodel>
- <data id="a"/>
+ <data id="x"/>
</datamodel>
- <initial id="intitial1">
- <transition target="a">
- <script src="script-0-0.js"/>
- </transition>
- </initial>
+ <state id="initial">
+ <transition target="a">
+ <script src="script-0-0.js"/>
+ </transition>
+ </state>
- <state id="a">
- <transition target="b" event="t" cond="getData('a') === 100"/>
- <transition target="f" event="t" />
- </state>
+ <state id="a">
+ <transition target="b" event="t" cond="x === 100"/>
+ <transition target="f" event="t" />
+ </state>
- <state id="b"/>
+ <state id="b"/>
- <state id="f"/>
+ <state id="f"/>
</scxml>
diff --git a/test/scxml-test-framework/test/script-src/test1.json b/test/scxml-test-framework/test/script-src/test1.json
index 8424ef5..0e49c49 100644
--- a/test/scxml-test-framework/test/script-src/test1.json
+++ b/test/scxml-test-framework/test/script-src/test1.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/script-src/test1.scxml b/test/scxml-test-framework/test/script-src/test1.scxml
index 5ccf8a6..acb601c 100644
--- a/test/scxml-test-framework/test/script-src/test1.scxml
+++ b/test/scxml-test-framework/test/script-src/test1.scxml
@@ -15,33 +15,28 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <datamodel>
- <data id="i"/>
- </datamodel>
-
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
-
- <state id="a">
- <transition target="b" event="t">
- <assign location="i" expr="0"/>
- <script src="script-1-0.js"/>
- </transition>
- </state>
-
- <state id="b">
- <transition target="b" cond="getData('i') &lt; 100">
- <script src="script-1-1.js"/>
- </transition>
- <transition target="c" cond="getData('i') === 100"/>
- </state>
-
- <state id="c"/>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
+ <datamodel>
+ <data id="i"/>
+ </datamodel>
+
+ <state id="a">
+ <transition target="b" event="t">
+ <assign location="i" expr="0"/>
+ <script src="script-1-0.js"/>
+ </transition>
+ </state>
+
+ <state id="b">
+ <transition target="b" cond="i &lt; 100">
+ <script src="script-1-1.js"/>
+ </transition>
+ <transition target="c" cond="i === 100"/>
+ </state>
+
+ <state id="c"/>
</scxml>
diff --git a/test/scxml-test-framework/test/script-src/test2.json b/test/scxml-test-framework/test/script-src/test2.json
index 6769dfe..36628bc 100644
--- a/test/scxml-test-framework/test/script-src/test2.json
+++ b/test/scxml-test-framework/test/script-src/test2.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["e"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["e"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/script-src/test2.scxml b/test/scxml-test-framework/test/script-src/test2.scxml
index 6b9192d..aa920ee 100644
--- a/test/scxml-test-framework/test/script-src/test2.scxml
+++ b/test/scxml-test-framework/test/script-src/test2.scxml
@@ -15,53 +15,48 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
<datamodel>
<data id="i"/>
</datamodel>
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
+ <state id="a">
+ <transition target="b" event="t">
+ <script src="script-2-0.js"/>
+ </transition>
+ </state>
- <state id="a">
- <transition target="b" event="t">
- <script src="script-2-0.js"/>
- </transition>
- </state>
+ <state id="A">
- <state id="A">
+ <state id="b">
+ <transition target="c" cond="i &lt; 100">
+ <script src="script-2-1.js"/>
+ </transition>
+ </state>
- <state id="b">
- <transition target="c" cond="getData('i') &lt; 100">
- <script src="script-2-1.js"/>
- </transition>
- </state>
+ <state id="c">
+ <transition target="b" cond="i &lt; 100">
+ <script src="script-2-2.js"/>
+ </transition>
+ </state>
- <state id="c">
- <transition target="b" cond="getData('i') &lt; 100">
- <script src="script-2-2.js"/>
- </transition>
- </state>
+ <transition target="d" cond="i === 100">
+ <script src="script-2-3.js"/>
+ </transition>
+ </state>
- <transition target="d" cond="getData('i') === 100">
- <script src="script-2-3.js"/>
- </transition>
- </state>
+ <state id="d">
+ <transition target="e" cond="i === 200"/>
+ <transition target="f"/>
+ </state>
- <state id="d">
- <transition target="e" cond="getData('i') === 200"/>
- <transition target="f"/>
- </state>
+ <state id="e"/>
- <state id="e"/>
-
- <state id="f"/>
+ <state id="f"/>
</scxml>
diff --git a/test/scxml-test-framework/test/script-src/test3.json b/test/scxml-test-framework/test/script-src/test3.json
index 1d2faec..c27c2fd 100644
--- a/test/scxml-test-framework/test/script-src/test3.json
+++ b/test/scxml-test-framework/test/script-src/test3.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["b"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/script-src/test3.scxml b/test/scxml-test-framework/test/script-src/test3.scxml
index c3cdb08..d712686 100644
--- a/test/scxml-test-framework/test/script-src/test3.scxml
+++ b/test/scxml-test-framework/test/script-src/test3.scxml
@@ -15,33 +15,32 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
<script src="script-3-0.js"/>
<datamodel>
- <data id="a"/>
+ <data id="x"/>
</datamodel>
- <initial id="intitial1">
- <transition target="a">
- <script>
- foo();
- </script>
- </transition>
- </initial>
+ <state id="intitial1">
+ <transition target="a">
+ <script>
+ foo();
+ </script>
+ </transition>
+ </state>
- <state id="a">
- <transition target="b" event="t" cond="getData('a') === 100"/>
- <transition target="f" event="t" />
- </state>
+ <state id="a">
+ <transition target="b" event="t" cond="x === 100"/>
+ <transition target="f" event="t" />
+ </state>
- <state id="b"/>
+ <state id="b"/>
- <state id="f"/>
+ <state id="f"/>
</scxml>
diff --git a/test/scxml-test-framework/test/script/test0.json b/test/scxml-test-framework/test/script/test0.json
index 1d2faec..c27c2fd 100644
--- a/test/scxml-test-framework/test/script/test0.json
+++ b/test/scxml-test-framework/test/script/test0.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["b"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/script/test0.scxml b/test/scxml-test-framework/test/script/test0.scxml
index 43d9e0b..21d911d 100644
--- a/test/scxml-test-framework/test/script/test0.scxml
+++ b/test/scxml-test-framework/test/script/test0.scxml
@@ -15,31 +15,30 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <initial id="intitial1">
- <transition target="a">
- <script>
- setData('a',100)
- </script>
- </transition>
- </initial>
-
- <datamodel>
- <data id="a"/>
- </datamodel>
-
- <state id="a">
- <transition target="b" event="t" cond="getData('a') === 100"/>
- <transition target="f" event="t" />
- </state>
-
- <state id="b"/>
-
- <state id="f"/>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
+ <datamodel>
+ <data id="x"/>
+ </datamodel>
+
+ <state id="intitial1">
+ <transition target="a">
+ <script>
+ x = 100;
+ </script>
+ </transition>
+ </state>
+
+ <state id="a">
+ <transition target="b" event="t" cond="x === 100"/>
+ <transition target="f" event="t" />
+ </state>
+
+ <state id="b"/>
+
+ <state id="f"/>
</scxml>
diff --git a/test/scxml-test-framework/test/script/test1.json b/test/scxml-test-framework/test/script/test1.json
index 8424ef5..0e49c49 100644
--- a/test/scxml-test-framework/test/script/test1.json
+++ b/test/scxml-test-framework/test/script/test1.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["c"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["c"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/script/test1.scxml b/test/scxml-test-framework/test/script/test1.scxml
index 4646c2e..cd6b2e6 100644
--- a/test/scxml-test-framework/test/script/test1.scxml
+++ b/test/scxml-test-framework/test/script/test1.scxml
@@ -15,37 +15,31 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <datamodel>
- <data id="i"/>
- </datamodel>
-
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
-
- <state id="a">
- <transition target="b" event="t">
- <assign location="i" expr="0"/>
- <script>
- setData('i',0)
- </script>
- </transition>
- </state>
-
- <state id="b">
- <transition target="b" cond="getData('i') &lt; 100">
- <script>
- setData('i',getData('i') + 1)
- </script>
- </transition>
- <transition target="c" cond="getData('i') === 100"/>
- </state>
-
- <state id="c"/>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
+ <datamodel>
+ <data id="x"/>
+ </datamodel>
+
+ <state id="a">
+ <transition target="b" event="t">
+ <script>
+ x = 0;
+ </script>
+ </transition>
+ </state>
+
+ <state id="b">
+ <transition target="b" cond="x &lt; 100">
+ <script>
+ x = x + 1;
+ </script>
+ </transition>
+ <transition target="c" cond="x === 100"/>
+ </state>
+
+ <state id="c"/>
</scxml>
diff --git a/test/scxml-test-framework/test/script/test2.json b/test/scxml-test-framework/test/script/test2.json
index 6769dfe..36628bc 100644
--- a/test/scxml-test-framework/test/script/test2.json
+++ b/test/scxml-test-framework/test/script/test2.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["e"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["e"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/script/test2.scxml b/test/scxml-test-framework/test/script/test2.scxml
index 9623cd6..f3b469e 100644
--- a/test/scxml-test-framework/test/script/test2.scxml
+++ b/test/scxml-test-framework/test/script/test2.scxml
@@ -15,61 +15,56 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="root">
-
- <initial id="intitial1">
- <transition target="a"/>
- </initial>
-
- <datamodel>
- <data id="i"/>
- </datamodel>
-
- <state id="a">
- <transition target="b" event="t">
- <script>
- setData('i',0)
- </script>
- </transition>
- </state>
-
- <state id="A">
-
- <state id="b">
- <transition target="c" cond="getData('i') &lt; 100">
- <script>
- setData('i',getData('i') + 1)
- </script>
- </transition>
- </state>
-
- <state id="c">
- <transition target="b" cond="getData('i') &lt; 100">
- <script>
- setData('i',getData('i') + 1)
- </script>
- </transition>
- </state>
-
- <transition target="d" cond="getData('i') === 100">
- <script>
- setData('i',getData('i') * 2)
- </script>
- </transition>
- </state>
-
-
- <state id="d">
- <transition target="e" cond="getData('i') === 200"/>
- <transition target="f"/>
- </state>
-
- <state id="e"/>
-
- <state id="f"/>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
+ <datamodel>
+ <data id="x"/>
+ </datamodel>
+
+ <state id="a">
+ <transition target="b" event="t">
+ <script>
+ x = 0;
+ </script>
+ </transition>
+ </state>
+
+ <state id="A">
+
+ <state id="b">
+ <transition target="c" cond="x &lt; 100">
+ <script>
+ x = x + 1;
+ </script>
+ </transition>
+ </state>
+
+ <state id="c">
+ <transition target="b" cond="x &lt; 100">
+ <script>
+ x = x + 1;
+ </script>
+ </transition>
+ </state>
+
+ <transition target="d" cond="x === 100">
+ <script>
+ x = x * 2;
+ </script>
+ </transition>
+ </state>
+
+
+ <state id="d">
+ <transition target="e" cond="x === 200"/>
+ <transition target="f"/>
+ </state>
+
+ <state id="e"/>
+
+ <state id="f"/>
</scxml>
diff --git a/test/scxml-test-framework/test/scxml-prefix-event-name-matching/star0.json b/test/scxml-test-framework/test/scxml-prefix-event-name-matching/star0.json
index d5bb5f5..577a005 100644
--- a/test/scxml-test-framework/test/scxml-prefix-event-name-matching/star0.json
+++ b/test/scxml-test-framework/test/scxml-prefix-event-name-matching/star0.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "foo" },
- "nextConfiguration" : ["b"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "foo" },
+ "nextConfiguration" : ["b"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/scxml-prefix-event-name-matching/star0.scxml b/test/scxml-test-framework/test/scxml-prefix-event-name-matching/star0.scxml
index 54a86d5..31345a8 100644
--- a/test/scxml-test-framework/test/scxml-prefix-event-name-matching/star0.scxml
+++ b/test/scxml-test-framework/test/scxml-prefix-event-name-matching/star0.scxml
@@ -15,20 +15,20 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript" >
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <state id="a">
- <!-- we send foo here, and it matches the * event -->
- <transition target="b" event="*"/>
- <transition target="fail" event="foo"/>
- </state>
-
- <state id="b">
- </state>
+ <state id="a">
+ <!-- we send foo here, and it matches the * event -->
+ <transition target="b" event="*"/>
+ <transition target="fail" event="foo"/>
+ </state>
+
+ <state id="b">
+ </state>
- <state id="fail"/>
+ <state id="fail"/>
</scxml>
diff --git a/test/scxml-test-framework/test/scxml-prefix-event-name-matching/test0.json b/test/scxml-test-framework/test/scxml-prefix-event-name-matching/test0.json
index ec26a85..bf11b72 100644
--- a/test/scxml-test-framework/test/scxml-prefix-event-name-matching/test0.json
+++ b/test/scxml-test-framework/test/scxml-prefix-event-name-matching/test0.json
@@ -1,39 +1,39 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "foo" },
- "nextConfiguration" : ["b"]
- },
- {
- "event" : { "name" : "foo.bar" },
- "nextConfiguration" : ["c"]
- },
- {
- "event" : { "name" : "foo.bar.bat" },
- "nextConfiguration" : ["d"]
- },
- {
- "event" : { "name" : "foo.bar.bat" },
- "nextConfiguration" : ["e"]
- },
- {
- "event" : { "name" : "foo" },
- "nextConfiguration" : ["e"]
- },
- {
- "event" : { "name" : "foo.bar.bat" },
- "nextConfiguration" : ["f"]
- },
- {
- "event" : { "name" : "foobar" },
- "nextConfiguration" : ["f"]
- },
- {
- "event" : { "name" : "foo.bar.bat.bif" },
- "nextConfiguration" : ["g"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "foo" },
+ "nextConfiguration" : ["b"]
+ },
+ {
+ "event" : { "name" : "foo.bar" },
+ "nextConfiguration" : ["c"]
+ },
+ {
+ "event" : { "name" : "foo.bar.bat" },
+ "nextConfiguration" : ["d"]
+ },
+ {
+ "event" : { "name" : "foo.bar.bat" },
+ "nextConfiguration" : ["e"]
+ },
+ {
+ "event" : { "name" : "foo" },
+ "nextConfiguration" : ["e"]
+ },
+ {
+ "event" : { "name" : "foo.bar.bat" },
+ "nextConfiguration" : ["f"]
+ },
+ {
+ "event" : { "name" : "foobar" },
+ "nextConfiguration" : ["f"]
+ },
+ {
+ "event" : { "name" : "foo.bar.bat.bif" },
+ "nextConfiguration" : ["g"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/scxml-prefix-event-name-matching/test0.scxml b/test/scxml-test-framework/test/scxml-prefix-event-name-matching/test0.scxml
index 85c9a54..3d14125 100644
--- a/test/scxml-test-framework/test/scxml-prefix-event-name-matching/test0.scxml
+++ b/test/scxml-test-framework/test/scxml-prefix-event-name-matching/test0.scxml
@@ -15,34 +15,34 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript" >
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <state id="a">
- <transition target="b" event="foo"/>
- </state>
+ <state id="a">
+ <transition target="b" event="foo"/>
+ </state>
- <state id="b">
- <transition target="c" event="foo.bar"/>
- </state>
+ <state id="b">
+ <transition target="c" event="foo.bar"/>
+ </state>
- <state id="c">
- <transition target="d" event="foo.bar.bat"/>
- </state>
+ <state id="c">
+ <transition target="d" event="foo.bar.bat"/>
+ </state>
- <state id="d">
- <transition target="e" event="foo"/>
- </state>
+ <state id="d">
+ <transition target="e" event="foo"/>
+ </state>
- <state id="e">
- <transition target="f" event="foo.bar"/>
- </state>
+ <state id="e">
+ <transition target="f" event="foo.bar"/>
+ </state>
- <state id="f">
- <transition target="g" event="foo.bar.bat"/>
- </state>
+ <state id="f">
+ <transition target="g" event="foo.bar.bat"/>
+ </state>
- <state id="g"/>
+ <state id="g"/>
</scxml>
diff --git a/test/scxml-test-framework/test/scxml-prefix-event-name-matching/test1.json b/test/scxml-test-framework/test/scxml-prefix-event-name-matching/test1.json
index db698ba..c3c994c 100644
--- a/test/scxml-test-framework/test/scxml-prefix-event-name-matching/test1.json
+++ b/test/scxml-test-framework/test/scxml-prefix-event-name-matching/test1.json
@@ -1,39 +1,39 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "foo" },
- "nextConfiguration" : ["b"]
- },
- {
- "event" : { "name" : "foo.bar" },
- "nextConfiguration" : ["c"]
- },
- {
- "event" : { "name" : "foo.bar.bat" },
- "nextConfiguration" : ["d"]
- },
- {
- "event" : { "name" : "foo.bar.bat" },
- "nextConfiguration" : ["e"]
- },
- {
- "event" : { "name" : "foo" },
- "nextConfiguration" : ["e"]
- },
- {
- "event" : { "name" : "foo.bar.bat" },
- "nextConfiguration" : ["f"]
- },
- {
- "event" : { "name" : "foobar" },
- "nextConfiguration" : ["f"]
- },
- {
- "event" : { "name" : "foo.bar.bat.bif" },
- "nextConfiguration" : ["g"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "foo" },
+ "nextConfiguration" : ["b"]
+ },
+ {
+ "event" : { "name" : "foo.bar" },
+ "nextConfiguration" : ["c"]
+ },
+ {
+ "event" : { "name" : "foo.bar.bat" },
+ "nextConfiguration" : ["d"]
+ },
+ {
+ "event" : { "name" : "foo.bar.bat" },
+ "nextConfiguration" : ["e"]
+ },
+ {
+ "event" : { "name" : "foo" },
+ "nextConfiguration" : ["e"]
+ },
+ {
+ "event" : { "name" : "foo.bar.bat" },
+ "nextConfiguration" : ["f"]
+ },
+ {
+ "event" : { "name" : "foobar" },
+ "nextConfiguration" : ["f"]
+ },
+ {
+ "event" : { "name" : "foo.bar.bat.bif" },
+ "nextConfiguration" : ["g"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/scxml-prefix-event-name-matching/test1.scxml b/test/scxml-test-framework/test/scxml-prefix-event-name-matching/test1.scxml
index 9e7c4e3..4515b3a 100644
--- a/test/scxml-test-framework/test/scxml-prefix-event-name-matching/test1.scxml
+++ b/test/scxml-test-framework/test/scxml-prefix-event-name-matching/test1.scxml
@@ -15,39 +15,39 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript" >
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
- <state id="a">
- <transition target="b" event="foo"/>
- </state>
+ <state id="a">
+ <transition target="b" event="foo"/>
+ </state>
- <state id="b">
- <transition target="c" event="foo.bar"/>
- </state>
+ <state id="b">
+ <transition target="c" event="foo.bar"/>
+ </state>
- <state id="c">
- <transition target="d" event="foo.bar.bat"/>
- </state>
+ <state id="c">
+ <transition target="d" event="foo.bar.bat"/>
+ </state>
- <state id="d">
- <transition target="e" event="foo.*"/>
- <transition target="fail" event="foo"/>
- </state>
+ <state id="d">
+ <transition target="e" event="foo.*"/>
+ <transition target="fail" event="foo"/>
+ </state>
- <state id="e">
- <transition target="f" event="foo.bar.*"/>
- <transition target="fail" event="foo.bar"/>
- </state>
+ <state id="e">
+ <transition target="f" event="foo.bar.*"/>
+ <transition target="fail" event="foo.bar"/>
+ </state>
- <state id="f">
- <transition target="g" event="foo.bar.bat.*"/>
- <transition target="fail" event="foo.bar.bat"/>
- </state>
+ <state id="f">
+ <transition target="g" event="foo.bar.bat.*"/>
+ <transition target="fail" event="foo.bar.bat"/>
+ </state>
- <state id="g"/>
+ <state id="g"/>
- <state id="fail"/>
+ <state id="fail"/>
</scxml>
diff --git a/test/scxml-test-framework/test/send-data/send1.json b/test/scxml-test-framework/test/send-data/send1.json
index 0f7f7f3..f21ee8b 100644
--- a/test/scxml-test-framework/test/send-data/send1.json
+++ b/test/scxml-test-framework/test/send-data/send1.json
@@ -1,14 +1,15 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["b"]
- },
- {
- "after" : 100,
- "event" : { "name" : "t2" },
- "nextConfiguration" : ["e"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["b"]
+ },
+ {
+ "after" : 100,
+ "event" : { "name" : "t2" },
+ "nextConfiguration" : ["e"]
+ }
+ ]
}
+
diff --git a/test/scxml-test-framework/test/send-data/send1.scxml b/test/scxml-test-framework/test/send-data/send1.scxml
index d150ad5..c663ce3 100644
--- a/test/scxml-test-framework/test/send-data/send1.scxml
+++ b/test/scxml-test-framework/test/send-data/send1.scxml
@@ -15,57 +15,59 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- datamodel="ecmascript">
-
- <datamodel>
- <data id="foo" expr="1"/>
- <data id="bar" expr="2"/>
- <data id="bat" expr="3"/>
- </datamodel>
-
- <state id="a">
- <transition target="b" event="t">
- <send delayexpr="'10ms'" eventexpr="'s1'" namelist="foo bar">
- <param name="bif" location="bat"/>
- <param name="belt" expr="4"/>
- </send>
- </transition>
- </state>
-
- <state id="b">
- <transition event="s1" target="c"
- cond="_event.data.foo === 1 &amp;&amp;
- _event.data.bar === 2 &amp;&amp;
- _event.data.bif === 3 &amp;&amp;
- _event.data.belt === 4">
-
- <send delayexpr="'10ms'" eventexpr="'s2'">
- <content>More content.</content>
- </send>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
+ <datamodel>
+ <data id="foo" expr="1"/>
+ <data id="bar" expr="2"/>
+ <data id="bat" expr="3"/>
+ </datamodel>
+
+ <state id="a">
+ <transition target="b" event="t">
+ <send delayexpr="'10ms'" eventexpr="'s1'" namelist="foo bar">
+ <param name="bif" location="bat"/>
+ <param name="belt" expr="4"/>
+ </send>
+ </transition>
+ </state>
+
+ <state id="b">
+ <transition event="s1" target="c"
+ cond="_event.data.foo === 1 &amp;&amp;
+ _event.data.bar === 2 &amp;&amp;
+ _event.data.bif === 3 &amp;&amp;
+ _event.data.belt === 4">
+
+ <send delayexpr="'10ms'" eventexpr="'s2'">
+ <content>More content.</content>
+ </send>
</transition>
- <transition event="s1" target="f"/>
- </state>
+ <transition event="s1" target="f"/>
+ </state>
- <state id="c">
- <transition event="s2" target="d"
- cond="_event.data === 'More content.'"/>
+ <state id="c">
+ <transition event="s2" target="d"
+ cond="_event.data === 'More content.'"/>
- <transition event="s2" target="f"/>
- </state>
+ <transition event="s2" target="f">
+ <log label="_event" expr="_event"/>
+ </transition>
+ </state>
- <state id="d">
- <transition event="t2" target="e"/>
- </state>
+ <state id="d">
+ <transition event="t2" target="e"/>
+ </state>
<state id="e"/>
- <state id="f"/>
+ <state id="f"/>
</scxml>
diff --git a/test/scxml-test-framework/test/send-internal/test0.json b/test/scxml-test-framework/test/send-internal/test0.json
index 855e0ee..a7f8799 100644
--- a/test/scxml-test-framework/test/send-internal/test0.json
+++ b/test/scxml-test-framework/test/send-internal/test0.json
@@ -1,9 +1,9 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["d"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["d"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/send-internal/test0.scxml b/test/scxml-test-framework/test/send-internal/test0.scxml
index 943322c..03ac96a 100644
--- a/test/scxml-test-framework/test/send-internal/test0.scxml
+++ b/test/scxml-test-framework/test/send-internal/test0.scxml
@@ -15,54 +15,54 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript">
-
- <datamodel>
- <data id="foo" expr="1"/>
- <data id="bar" expr="2"/>
- <data id="bat" expr="3"/>
- </datamodel>
-
- <state id="a">
- <transition target="b" event="t">
- <send eventexpr="'s1'" namelist="foo bar" target="#_internal">
- <param name="bif" location="bat"/>
- <param name="belt" expr="4"/>
- </send>
- </transition>
- </state>
-
- <state id="b">
- <transition event="s1" target="c"
- cond="_event.data.foo === 1 &amp;&amp;
- _event.data.bar === 2 &amp;&amp;
- _event.data.bif === 3 &amp;&amp;
- _event.data.belt === 4">
-
- <send eventexpr="'s2'" target="#_internal">
- <content>More content.</content>
- </send>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
+ <datamodel>
+ <data id="foo" expr="1"/>
+ <data id="bar" expr="2"/>
+ <data id="bat" expr="3"/>
+ </datamodel>
+
+ <state id="a">
+ <transition target="b" event="t">
+ <send eventexpr="'s1'" namelist="foo bar" target="#_internal">
+ <param name="bif" location="bat"/>
+ <param name="belt" expr="4"/>
+ </send>
+ </transition>
+ </state>
+
+ <state id="b">
+ <transition event="s1" target="c"
+ cond="_event.data.foo === 1 &amp;&amp;
+ _event.data.bar === 2 &amp;&amp;
+ _event.data.bif === 3 &amp;&amp;
+ _event.data.belt === 4">
+
+ <send eventexpr="'s2'" target="#_internal">
+ <content>More content.</content>
+ </send>
</transition>
- <transition event="s1" target="f"/>
- </state>
+ <transition event="s1" target="f"/>
+ </state>
- <state id="c">
- <transition event="s2" target="d"
- cond="_event.data === 'More content.'"/>
+ <state id="c">
+ <transition event="s2" target="d"
+ cond="_event.data === 'More content.'"/>
- <transition event="s2" target="f">
- <log label="_event" expr="_event"/>
- </transition>
- </state>
+ <transition event="s2" target="f">
+ <log label="_event" expr="_event"/>
+ </transition>
+ </state>
- <state id="d"/>
+ <state id="d"/>
- <state id="f"/>
+ <state id="f"/>
</scxml>
diff --git a/test/scxml-test-framework/test/targetless-transition/test0.json b/test/scxml-test-framework/test/targetless-transition/test0.json
index 91e35b6..43f1a91 100644
--- a/test/scxml-test-framework/test/targetless-transition/test0.json
+++ b/test/scxml-test-framework/test/targetless-transition/test0.json
@@ -1,11 +1,11 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "t" },
- "nextConfiguration" : ["done"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "t" },
+ "nextConfiguration" : ["done"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/targetless-transition/test0.scxml b/test/scxml-test-framework/test/targetless-transition/test0.scxml
index c1cd27d..5b95d73 100644
--- a/test/scxml-test-framework/test/targetless-transition/test0.scxml
+++ b/test/scxml-test-framework/test/targetless-transition/test0.scxml
@@ -15,25 +15,25 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript">
-
- <datamodel>
- <data id="i" expr="0"/>
- </datamodel>
-
- <state id="a">
- <transition target="b" event="t"/>
- </state>
-
- <state id="b">
- <transition target="done" cond="i === 100"/>
- <transition>
- <assign location="i" expr="i + 1"/>
- </transition>
- </state>
-
- <state id="done"/>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
+ <datamodel>
+ <data id="i" expr="0"/>
+ </datamodel>
+
+ <state id="a">
+ <transition target="b" event="t"/>
+ </state>
+
+ <state id="b">
+ <transition target="done" cond="i === 100"/>
+ <transition>
+ <assign location="i" expr="i + 1"/>
+ </transition>
+ </state>
+
+ <state id="done"/>
</scxml>
diff --git a/test/scxml-test-framework/test/targetless-transition/test1.json b/test/scxml-test-framework/test/targetless-transition/test1.json
index 4ebbbd4..f82edf4 100644
--- a/test/scxml-test-framework/test/targetless-transition/test1.json
+++ b/test/scxml-test-framework/test/targetless-transition/test1.json
@@ -1,15 +1,15 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "foo" },
- "nextConfiguration" : ["a"]
- },
- {
- "event" : { "name" : "bar" },
- "nextConfiguration" : ["done"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "foo" },
+ "nextConfiguration" : ["a"]
+ },
+ {
+ "event" : { "name" : "bar" },
+ "nextConfiguration" : ["done"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/targetless-transition/test1.scxml b/test/scxml-test-framework/test/targetless-transition/test1.scxml
index f8f9f9f..11520bf 100644
--- a/test/scxml-test-framework/test/targetless-transition/test1.scxml
+++ b/test/scxml-test-framework/test/targetless-transition/test1.scxml
@@ -15,29 +15,29 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript">
-
- <datamodel>
- <data id="i" expr="1"/>
- </datamodel>
-
- <state id="A">
- <transition event="foo">
- <assign location="i" expr="i * 2"/>
- </transition>
-
- <state id="a">
- <transition event="bar">
- <assign location="i" expr="Math.pow(i,3)"/>
- </transition>
- </state>
-
- <transition target="done" cond="i === 8"/>
- </state>
-
- <state id="done"/>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
+ <datamodel>
+ <data id="i" expr="1"/>
+ </datamodel>
+
+ <state id="A">
+ <transition event="foo">
+ <assign location="i" expr="i * 2"/>
+ </transition>
+
+ <state id="a">
+ <transition event="bar">
+ <assign location="i" expr="Math.pow(i,3)"/>
+ </transition>
+ </state>
+
+ <transition target="done" cond="i === 8"/>
+ </state>
+
+ <state id="done"/>
</scxml>
diff --git a/test/scxml-test-framework/test/targetless-transition/test2.json b/test/scxml-test-framework/test/targetless-transition/test2.json
index a37a4cc..f97a06f 100644
--- a/test/scxml-test-framework/test/targetless-transition/test2.json
+++ b/test/scxml-test-framework/test/targetless-transition/test2.json
@@ -1,15 +1,15 @@
{
- "initialConfiguration" : ["a"],
- "events" : [
- {
- "event" : { "name" : "foo" },
- "nextConfiguration" : ["a"]
- },
- {
- "event" : { "name" : "bar" },
- "nextConfiguration" : ["done"]
- }
- ]
+ "initialConfiguration" : ["a"],
+ "events" : [
+ {
+ "event" : { "name" : "foo" },
+ "nextConfiguration" : ["a"]
+ },
+ {
+ "event" : { "name" : "bar" },
+ "nextConfiguration" : ["done"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/targetless-transition/test2.scxml b/test/scxml-test-framework/test/targetless-transition/test2.scxml
index b6b3f5d..12609dd 100644
--- a/test/scxml-test-framework/test/targetless-transition/test2.scxml
+++ b/test/scxml-test-framework/test/targetless-transition/test2.scxml
@@ -15,32 +15,32 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript">
-
- <datamodel>
- <data id="i" expr="1"/>
- </datamodel>
-
- <state id="A">
- <transition event="foo">
- <assign location="i" expr="i * 2"/>
- </transition>
- <transition event="bar">
- <assign location="i" expr="Math.pow(i,3)"/>
- </transition>
-
- <state id="a">
- <transition event="foo">
- <assign location="i" expr="i + 2"/>
- </transition>
- </state>
-
- <transition target="done" cond="i === 27"/>
- </state>
-
- <state id="done"/>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
+ <datamodel>
+ <data id="i" expr="1"/>
+ </datamodel>
+
+ <state id="A">
+ <transition event="foo">
+ <assign location="i" expr="i * 2"/>
+ </transition>
+ <transition event="bar">
+ <assign location="i" expr="Math.pow(i,3)"/>
+ </transition>
+
+ <state id="a">
+ <transition event="foo">
+ <assign location="i" expr="i + 2"/>
+ </transition>
+ </state>
+
+ <transition target="done" cond="i === 27"/>
+ </state>
+
+ <state id="done"/>
</scxml>
diff --git a/test/scxml-test-framework/test/targetless-transition/test3.json b/test/scxml-test-framework/test/targetless-transition/test3.json
index a002827..f1300b1 100644
--- a/test/scxml-test-framework/test/targetless-transition/test3.json
+++ b/test/scxml-test-framework/test/targetless-transition/test3.json
@@ -1,15 +1,15 @@
{
- "initialConfiguration" : ["a1","b1","c"],
- "events" : [
- {
- "event" : { "name" : "foo" },
- "nextConfiguration" : ["a2","b2","c"]
- },
- {
- "event" : { "name" : "bar" },
- "nextConfiguration" : ["done"]
- }
- ]
+ "initialConfiguration" : ["a1","b1","c"],
+ "events" : [
+ {
+ "event" : { "name" : "foo" },
+ "nextConfiguration" : ["a2","b2","c"]
+ },
+ {
+ "event" : { "name" : "bar" },
+ "nextConfiguration" : ["done"]
+ }
+ ]
}
diff --git a/test/scxml-test-framework/test/targetless-transition/test3.scxml b/test/scxml-test-framework/test/targetless-transition/test3.scxml
index 9d3d630..3af50cc 100644
--- a/test/scxml-test-framework/test/targetless-transition/test3.scxml
+++ b/test/scxml-test-framework/test/targetless-transition/test3.scxml
@@ -15,57 +15,57 @@
limitations under the License.
-->
<scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript">
-
- <datamodel>
- <data id="i" expr="1"/>
- </datamodel>
-
- <parallel id="p">
-
- <transition target="done" cond="i === 100"/>
-
- <transition event="bar">
- <assign location="i" expr="i * 20"/>
- <log expr="i"/>
- </transition>
-
- <state id="a">
- <state id="a1">
- <transition event="foo" target="a2">
- <assign location="i" expr="i * 2"/>
- <log expr="i"/>
- </transition>
- </state>
-
- <state id="a2">
- </state>
- </state>
-
- <state id="b">
- <state id="b1">
- <transition event="foo" target="b2">
- <assign location="i" expr="Math.pow(i,3)"/>
- <log expr="i"/>
- </transition>
- </state>
-
- <state id="b2">
- </state>
- </state>
-
- <state id="c">
- <transition event="foo">
- <assign location="i" expr="i - 3"/>
- <log expr="i"/>
- </transition>
- </state>
-
- </parallel>
-
- <state id="done"/>
+ datamodel="ecmascript"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0">
+
+ <datamodel>
+ <data id="i" expr="1"/>
+ </datamodel>
+
+ <parallel id="p">
+
+ <transition target="done" cond="i === 100"/>
+
+ <transition event="bar">
+ <assign location="i" expr="i * 20"/>
+ <log expr="i"/>
+ </transition>
+
+ <state id="a">
+ <state id="a1">
+ <transition event="foo" target="a2">
+ <assign location="i" expr="i * 2"/>
+ <log expr="i"/>
+ </transition>
+ </state>
+
+ <state id="a2">
+ </state>
+ </state>
+
+ <state id="b">
+ <state id="b1">
+ <transition event="foo" target="b2">
+ <assign location="i" expr="Math.pow(i,3)"/>
+ <log expr="i"/>
+ </transition>
+ </state>
+
+ <state id="b2">
+ </state>
+ </state>
+
+ <state id="c">
+ <transition event="foo">
+ <assign location="i" expr="i - 3"/>
+ <log expr="i"/>
+ </transition>
+ </state>
+
+ </parallel>
+
+ <state id="done"/>
</scxml>
diff --git a/test/src/scxml-test-framework-client.cpp b/test/src/scxml-test-framework-client.cpp
index 841df0f..1eeab9c 100644
--- a/test/src/scxml-test-framework-client.cpp
+++ b/test/src/scxml-test-framework-client.cpp
@@ -1,5 +1,5 @@
#include "uscxml/Interpreter.h"
-#include "uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h"
+#include "uscxml/server/HTTPServer.h"
#include <sstream>
extern "C" {
@@ -20,40 +20,19 @@ extern "C" {
{"load":"http://localhost:9999/scxml-test-framework/test/targetless-transition/test3.scxml"}
*/
-class TestIOProcessor : public uscxml::EventIOProcessor, public uscxml::InterpreterMonitor {
+class TestIOProcessor : public uscxml::HTTPServlet, public uscxml::InterpreterMonitor {
public:
-
static int lastToken;
- static std::map<std::string, std::pair<uscxml::Interpreter*, evhttp_request*> > _interpreters;
+ static bool alreadyAnswered; // we need this for delayed events
+ static std::map<std::string, std::pair<uscxml::Interpreter*, uscxml::HTTPServer::Request> > _interpreters;
TestIOProcessor() {}
- virtual void onStableConfiguration(uscxml::Interpreter* interpreter) {
- Arabica::XPath::NodeSet<std::string> configuration = interpreter->getConfiguration();
-
- uscxml::Data reply;
- 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]))
- reply.compound["nextConfiguration"].array.push_back(uscxml::Data(ATTR(configuration[i], "id"), uscxml::Data::VERBATIM));
- }
-
- std::cout << "---- reply:" << std::endl;
- std::cout << reply << std::endl;
-
- std::stringstream replyString;
- replyString << reply;
-
- struct evbuffer *databuf = evbuffer_new();
- evbuffer_add(databuf, replyString.str().c_str(), replyString.str().length());
- evhttp_send_reply(_interpreters[interpreter->getName()].second, 200, "OK", databuf);
- evbuffer_free(databuf);
-
+ virtual void beforeCompletion(uscxml::Interpreter* interpreter) {
+ _interpreters[interpreter->getName()].second.curlReq = NULL;
}
- virtual void beforeCompletion(uscxml::Interpreter* interpreter) {}
virtual void afterCompletion(uscxml::Interpreter* interpreter) {}
virtual void beforeMicroStep(uscxml::Interpreter* interpreter) {}
virtual void beforeTakingTransitions(uscxml::Interpreter* interpreter, const Arabica::XPath::NodeSet<std::string>& transitions) {}
@@ -65,6 +44,7 @@ public:
}
std::cout << std::endl;
}
+
virtual void afterEnteringStates(uscxml::Interpreter* interpreter) {
std::cout << "After entering states: ";
for (int i = 0; i < interpreter->getConfiguration().size(); i++) {
@@ -72,6 +52,7 @@ public:
}
std::cout << std::endl;
}
+
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++) {
@@ -84,6 +65,7 @@ public:
}
std::cout << std::endl;
}
+
virtual void afterExitingStates(uscxml::Interpreter* interpreter) {
std::cout << "After exiting states: ";
for (int i = 0; i < interpreter->getConfiguration().size(); i++) {
@@ -92,37 +74,46 @@ public:
std::cout << std::endl;
}
- virtual void httpRecvReq(struct evhttp_request *req) {
-
- std::cout << "---- received:" << std::endl;
-
- if (evhttp_request_get_command(req) != EVHTTP_REQ_POST)
+ virtual void onStableConfiguration(uscxml::Interpreter* interpreter) {
+ if (alreadyAnswered)
return;
- evhttp_request_own(req);
-
- struct evkeyval *header;
- struct evkeyvalq *headers;
- headers = evhttp_request_get_input_headers(req);
+ Arabica::XPath::NodeSet<std::string> configuration = interpreter->getConfiguration();
- for (header = headers->tqh_first; header;
- header = header->next.tqe_next) {
-// std::cout << header->key << ": " << header->value << std::endl;
+ uscxml::Data reply;
+ 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]))
+ reply.compound["nextConfiguration"].array.push_back(uscxml::Data(ATTR(configuration[i], "id"), uscxml::Data::VERBATIM));
}
+
+ std::cout << "---- reply:" << std::endl;
+ std::cout << reply << std::endl;
+
+ std::stringstream replyString;
+ replyString << reply;
+
+ alreadyAnswered = true;
+
+ uscxml::HTTPServer::Request httpRequest = _interpreters[interpreter->getName()].second;
+ uscxml::HTTPServer::Reply httpReply(httpRequest);
+ httpReply.content = replyString.str();
+ uscxml::HTTPServer::reply(httpReply);
+
+ }
- std::string content;
- struct evbuffer *buf;
- buf = evhttp_request_get_input_buffer(req);
- while (evbuffer_get_length(buf)) {
- int n;
- char cbuf[128];
- n = evbuffer_remove(buf, cbuf, sizeof(buf)-1);
- if (n > 0) {
- content.append(cbuf, n);
- }
- }
+ void httpRecvRequest(const uscxml::HTTPServer::Request& request) {
+
+// uscxml::HTTPServer::Reply httpReply(request);
+// uscxml::HTTPServer::reply(httpReply);
+// return;
- uscxml::Data jsonReq = uscxml::Data::fromJSON(content);
+ std::cout << "---- received:" << std::endl;
+ evhttp_request_own(request.curlReq);
+
+ std::cout << request.content << std::endl;
+ uscxml::Data jsonReq = uscxml::Data::fromJSON(request.content);
std::cout << jsonReq << std::endl;
@@ -130,6 +121,19 @@ public:
if (jsonReq.compound.find("load") != jsonReq.compound.end()) {
std::string filename = jsonReq.compound["load"].atom;
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();
+ while(interpreterIter != _interpreters.end()) {
+// if (interpreterIter->second.second.curlReq == NULL) {
+ delete interpreterIter->second.first;
+ _interpreters.erase(interpreterIter++);
+// } else {
+// interpreterIter++;
+// }
+ }
+
+
uscxml::Interpreter* interpreter = uscxml::Interpreter::fromURI(filename);
if (interpreter) {
std::string token = uscxml::toStr(lastToken++);
@@ -137,7 +141,7 @@ public:
interpreter->setName(token);
interpreter->addMonitor(this);
interpreter->start();
- _interpreters[token] = std::make_pair(interpreter, req);
+ _interpreters[token] = std::make_pair(interpreter, request);
}
return;
}
@@ -151,33 +155,27 @@ public:
event.name = jsonReq.compound["event"].compound["name"].atom;
std::cout << "Sending event " << event << std::endl;
// evhttp_request_free(_interpreters[token].second);
- _interpreters[token].second = req;
+ alreadyAnswered = false;
+ _interpreters[token].second = request;
_interpreters[token].first->receive(event);
}
-
- }
-
- std::string getPath() {
- return "test";
+
}
-
+
void setURL(const std::string& url) {
std::cout << "Listening at " << url << std::endl;
- _url = url;
}
};
int TestIOProcessor::lastToken;
-std::map<std::string, std::pair<uscxml::Interpreter*, evhttp_request*> > TestIOProcessor::_interpreters;
+bool TestIOProcessor::alreadyAnswered;
+std::map<std::string, std::pair<uscxml::Interpreter*, uscxml::HTTPServer::Request> > TestIOProcessor::_interpreters;
int main(int argc, char** argv) {
TestIOProcessor* testServer = new TestIOProcessor();
- uscxml::EventIOServer::registerProcessor(testServer);
+ uscxml::HTTPServer::registerServlet("test", testServer);
while(true)
tthread::this_thread::sleep_for(tthread::chrono::milliseconds(20));
-// uscxml::Interpreter* interpreter = uscxml::Interpreter::fromURI(argv[1]);
-// interpreter->dump();
-// interpreter->interpret();
} \ No newline at end of file
diff --git a/test/src/test-communication.cpp b/test/src/test-communication.cpp.old
index a0cdbbd..a0cdbbd 100644
--- a/test/src/test-communication.cpp
+++ b/test/src/test-communication.cpp.old
diff --git a/test/src/test-completion.cpp b/test/src/test-completion.cpp.old
index 67d8708..67d8708 100644
--- a/test/src/test-completion.cpp
+++ b/test/src/test-completion.cpp.old
diff --git a/test/src/test-curl-multi-api.cpp b/test/src/test-curl-multi-api.cpp
new file mode 100644
index 0000000..fac06dc
--- /dev/null
+++ b/test/src/test-curl-multi-api.cpp
@@ -0,0 +1,347 @@
+#include <curl/curl.h>
+#include <glog/logging.h>
+#include <string>
+#include <iostream>
+#include <sstream>
+#include <map>
+#include <set>
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+
+#include "uscxml/concurrency/tinythread.h"
+
+// use arabica URL parser
+#include <io/uri.hpp>
+
+class URL;
+
+class URLMonitor {
+public:
+ virtual void downloadStarted(const URL& url) {};
+ virtual void downloadCompleted(const URL& url) {};
+ virtual void downloadFailed(const URL& url, int errorCode) {};
+ virtual void headerChunkReceived(const URL& url, const std::string& headerChunk) {};
+ virtual void contentChunkReceived(const URL& url, const std::string& contentChunk) {};
+};
+
+class URLImpl : public boost::enable_shared_from_this<URLImpl> {
+public:
+ URLImpl(const std::string& url) : _handle(NULL), _uri(url), _isDownloaded(false) {
+ _handle = curl_easy_init();
+ if (_handle != NULL) {
+ CURLcode curlError;
+ curlError = curl_easy_setopt(_handle, CURLOPT_URL, _uri.as_string().c_str());
+ if (curlError != CURLE_OK)
+ LOG(ERROR) << "Cannot set url to " << _uri.as_string() << ": " << curl_easy_strerror(curlError);
+
+ curlError = curl_easy_setopt(_handle, CURLOPT_WRITEDATA, this);
+ if (curlError != CURLE_OK)
+ LOG(ERROR) << "Cannot register this as write userdata: " << curl_easy_strerror(curlError);
+
+ curlError = curl_easy_setopt(_handle, CURLOPT_WRITEFUNCTION, URLImpl::writeHandler);
+ if (curlError != CURLE_OK)
+ LOG(ERROR) << "Cannot set write callback: " << curl_easy_strerror(curlError);
+
+ curlError = curl_easy_setopt(_handle, CURLOPT_HEADERFUNCTION, URLImpl::headerHandler);
+ if (curlError != CURLE_OK)
+ LOG(ERROR) << "Cannot request header from curl: " << curl_easy_strerror(curlError);
+
+ curlError = curl_easy_setopt(_handle, CURLOPT_HEADERDATA, this);
+ if (curlError != CURLE_OK)
+ LOG(ERROR) << "Cannot register this as header userdata: " << curl_easy_strerror(curlError);
+ } else {
+ LOG(ERROR) << "curl_easy_init returned NULL, this is bad!";
+ }
+ }
+
+ ~URLImpl() {
+ if (_handle != NULL)
+ curl_easy_cleanup(_handle);
+ }
+
+ static size_t writeHandler(void *ptr, size_t size, size_t nmemb, void *userdata) {
+ URLImpl* url = (URLImpl*)userdata;
+ url->_content.write((char*)ptr, size * nmemb);
+ return size * nmemb;
+ }
+
+ static size_t headerHandler(void *ptr, size_t size, size_t nmemb, void *userdata) {
+ URLImpl* url = (URLImpl*)userdata;
+ url->_header.write((char*)ptr, size * nmemb);
+ return size * nmemb;
+ }
+
+ void addMonitor(URLMonitor* monitor) { _monitors.insert(monitor); }
+ void removeMonitor(URLMonitor* monitor) { _monitors.erase(monitor); }
+
+ const bool isAbsolute() const { return _uri.is_absolute(); }
+ const std::string scheme() const { return _uri.scheme(); }
+ const std::string host() const { return _uri.host(); }
+ const std::string port() const { return _uri.port(); }
+ const std::string path() const { return _uri.path(); }
+ const std::string asString() const { return _uri.as_string(); }
+
+ void downloadStarted() {
+ std::cout << "Starting download of " << asString() << std::endl;
+ _content.str("");
+ _content.clear();
+ _header.str("");
+ _header.clear();
+ monIter_t monIter = _monitors.begin();
+ while(monIter != _monitors.end()) {
+// (*monIter)->downloadStarted(URL(shared_from_this()));
+ monIter++;
+ }
+ }
+
+ void downloadCompleted() {
+ std::cout << "Finished loading " << asString() << " with " << _content.str().size() << " bytes" << std::endl;
+ _isDownloaded = true;
+ }
+
+ void downloadFailed(int errorCode) {
+ std::cout << "FAILED!" << strerror(errorCode) << std::endl;
+ }
+
+ std::string getHeader(bool forceReload = false) {
+ return _header.str();
+ }
+
+ std::string getContent(bool forceReload = false) {
+ return _content.str();
+ }
+
+ std::stringstream _content;
+ std::stringstream _header;
+ CURL* _handle;
+ Arabica::io::URI _uri;
+ bool _isDownloaded;
+
+ std::set<URLMonitor*> _monitors;
+ typedef std::set<URLMonitor*>::iterator monIter_t;
+};
+
+class URL {
+public:
+ URL() : _impl() {}
+ URL(const std::string url) : _impl(new URLImpl(url)) {}
+ URL(boost::shared_ptr<URLImpl> const impl) : _impl(impl) { }
+ URL(const URL& other) : _impl(other._impl) { }
+ virtual ~URL() {};
+
+ operator bool() const { return _impl; }
+ bool operator< (const URL& other) const { return _impl < other._impl; }
+ bool operator==(const URL& other) const { return _impl == other._impl; }
+ bool operator!=(const URL& other) const {
+ return _impl != other._impl;
+ }
+ URL& operator= (const URL& other) {
+ _impl = other._impl;
+ return *this;
+ }
+
+ std::string getHeader() { return _impl->getHeader(); }
+ std::string getContent() { return _impl->getContent(); }
+
+ const bool toAbsoluteCwd() { return _impl->toAbsoluteCwd(); }
+ const bool toAbsolute(const std::string& baseUrl) { return _impl->toAbsolute(baseUrl); }
+ const bool toAbsolute(const URL& baseUrl) { return _impl->toAbsolute(baseUrl.asString()); }
+ const std::string asLocalFile(const std::string& suffix, bool reload = false) { return _impl->asLocalFile(suffix, reload); }
+
+ void addMonitor(URLMonitor* monitor) { _impl->addMonitor(monitor); }
+ void removeMonitor(URLMonitor* monitor) { _impl->removeMonitor(monitor); }
+
+ const bool isAbsolute() const { return _impl->isAbsolute(); }
+ const std::string scheme() const { return _impl->scheme(); }
+ const std::string host() const { return _impl->host(); }
+ const std::string port() const { return _impl->port(); }
+ const std::string path() const { return _impl->path(); }
+ const std::string asString() const { return _impl->asString(); }
+
+ friend class URLFetcher;
+ friend std::ostream & operator<<(std::ostream &stream, const URL& p);
+
+protected:
+ void downloadStarted() { return _impl->downloadStarted(); }
+ void downloadCompleted() { return _impl->downloadCompleted(); }
+ void downloadFailed(int errorCode) { return _impl->downloadFailed(errorCode); }
+
+ boost::shared_ptr<URLImpl> _impl;
+};
+
+class URLFetcher {
+public:
+ URLFetcher() {
+ _multiHandle = curl_multi_init();
+ start();
+ }
+
+ ~URLFetcher() {
+ curl_multi_cleanup(_multiHandle);
+ stop();
+ }
+
+ void fetchURL(URL& url) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ url.downloadStarted();
+ _handlesToURLs[url._impl->_handle] = url;
+ curl_multi_add_handle(_multiHandle, url._impl->_handle);
+ _condVar.notify_all();
+ }
+
+ void breakURL(URL& url) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ if (_handlesToURLs.find(url._impl->_handle) != _handlesToURLs.end()) {
+ url.downloadFailed(0);
+ curl_multi_remove_handle(_multiHandle, url._impl->_handle);
+ _handlesToURLs.erase(url._impl->_handle);
+ }
+ }
+
+ void start() {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ if (!_isStarted) {
+ _isStarted = true;
+ _thread = new tthread::thread(URLFetcher::run, this);
+ }
+ }
+
+ void stop() {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ if (_isStarted) {
+ _isStarted = false;
+ _thread->join();
+ delete _thread;
+ }
+ }
+
+ static void run(void* instance) {
+ URLFetcher* THIS = (URLFetcher*)instance;
+ THIS->_mutex.lock();
+ while(THIS->_isStarted) {
+ if(THIS->_handlesToURLs.size() > 0) {
+ THIS->_mutex.unlock();
+ THIS->perform();
+ THIS->_mutex.lock();
+ }
+ THIS->_condVar.wait(THIS->_mutex);
+ }
+ THIS->_mutex.unlock();
+ }
+
+ void perform() {
+
+ CURLMsg *msg; /* for picking up messages with the transfer status */
+ int msgsLeft; /* how many messages are left */
+ int stillRunning;
+
+ {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ curl_multi_perform(_multiHandle, &stillRunning);
+ }
+
+ do {
+ struct timeval timeout;
+ int rc; /* select() return code */
+
+ fd_set fdread, fdwrite, fdexcep;
+ FD_ZERO(&fdread); FD_ZERO(&fdwrite); FD_ZERO(&fdexcep);
+
+ int maxfd = -1;
+ long curlTimeOut = -1;
+
+ /* set a suitable timeout to play around with */
+ timeout.tv_sec = 1;
+ timeout.tv_usec = 0;
+
+ {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ curl_multi_timeout(_multiHandle, &curlTimeOut);
+ }
+
+ if(curlTimeOut >= 0) {
+ timeout.tv_sec = curlTimeOut / 1000;
+ if(timeout.tv_sec > 1)
+ timeout.tv_sec = 1;
+ else
+ timeout.tv_usec = (curlTimeOut % 1000) * 1000;
+ }
+
+ /* get file descriptors from the transfers */
+ {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ curl_multi_fdset(_multiHandle, &fdread, &fdwrite, &fdexcep, &maxfd);
+ }
+
+ rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+
+ switch(rc) {
+ case -1:
+ /* select error */
+ break;
+ case 0: /* timeout */
+ default: /* action */
+ {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ curl_multi_perform(_multiHandle, &stillRunning);
+ }
+ break;
+ }
+
+ {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ while ((msg = curl_multi_info_read(_multiHandle, &msgsLeft))) {
+ if (msg->msg == CURLMSG_DONE) {
+ _handlesToURLs[msg->easy_handle].downloadCompleted();
+ curl_multi_remove_handle(_multiHandle, msg->easy_handle);
+ _handlesToURLs.erase(msg->easy_handle);
+ } else {
+ switch (msg->data.result) {
+ case CURLM_OK:
+ break;
+ case CURLM_BAD_HANDLE:
+ case CURLM_BAD_EASY_HANDLE:
+ case CURLM_OUT_OF_MEMORY:
+ case CURLM_INTERNAL_ERROR:
+ case CURLM_BAD_SOCKET:
+ case CURLM_UNKNOWN_OPTION:
+ case CURLM_LAST:
+ _handlesToURLs[msg->easy_handle].downloadFailed(msg->data.result);
+ curl_multi_remove_handle(_multiHandle, msg->easy_handle);
+ _handlesToURLs.erase(msg->easy_handle);
+ default:
+ break;
+ }
+ }
+ }
+ }
+ } while(stillRunning && _isStarted);
+
+ }
+
+ tthread::condition_variable _condVar;
+ tthread::thread* _thread;
+ tthread::recursive_mutex _mutex;
+ bool _isStarted;
+
+ std::map<CURL*, URL> _handlesToURLs;
+ CURLM* _multiHandle;
+};
+
+
+int main(int argc, char** argv) {
+ URLFetcher fetcher;
+ URL heise("http://www.heise.de");
+ URL localFile("file:///Users/sradomski/Desktop/scxml.xsd");
+ URL slashdot("http://slashdot.org");
+ URL asdf("daf://localhost:234");
+ URL bahn("http://www.bahn.de");
+
+ fetcher.fetchURL(heise);
+ fetcher.fetchURL(localFile);
+ fetcher.fetchURL(asdf);
+ fetcher.fetchURL(slashdot);
+ fetcher.fetchURL(bahn);
+
+ while(1) {}
+} \ No newline at end of file
diff --git a/test/src/test-ecmascript-v8.cpp b/test/src/test-ecmascript-v8.cpp.old
index 9ce39d9..9ce39d9 100644
--- a/test/src/test-ecmascript-v8.cpp
+++ b/test/src/test-ecmascript-v8.cpp.old
diff --git a/test/src/test-execution.cpp b/test/src/test-execution.cpp.old
index 272ce41..272ce41 100644
--- a/test/src/test-execution.cpp
+++ b/test/src/test-execution.cpp.old
diff --git a/test/src/test-prolog-swi.cpp b/test/src/test-prolog-swi.cpp.old
index 9e44f12..9e44f12 100644
--- a/test/src/test-prolog-swi.cpp
+++ b/test/src/test-prolog-swi.cpp.old